Class: OffsitePayments::Integrations::PayuIn::Return

Inherits:
Return
  • Object
show all
Defined in:
lib/offsite_payments/integrations/payu_in.rb

Instance Attribute Summary

Attributes inherited from Return

#notification, #params

Instance Method Summary collapse

Methods inherited from Return

#cancelled?, #parse

Constructor Details

#initialize(query_string, options = {}) ⇒ Return

Returns a new instance of Return.



251
252
253
254
# File 'lib/offsite_payments/integrations/payu_in.rb', line 251

def initialize(query_string, options = {})
  super
  @notification = Notification.new(query_string, options)
end

Instance Method Details

#messageObject



272
273
274
# File 'lib/offsite_payments/integrations/payu_in.rb', line 272

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object



260
261
262
263
264
265
266
# File 'lib/offsite_payments/integrations/payu_in.rb', line 260

def status( order_id, order_amount )
  if @notification.invoice_ok?( order_id ) && @notification.amount_ok?( BigDecimal(order_amount) )
    @notification.status
  else
    'Mismatch'
  end
end

#success?Boolean

Returns:

  • (Boolean)


268
269
270
# File 'lib/offsite_payments/integrations/payu_in.rb', line 268

def success?
  status( @params['txnid'], @params['amount'] ) == 'Completed'
end

#transaction_idObject



256
257
258
# File 'lib/offsite_payments/integrations/payu_in.rb', line 256

def transaction_id
  @notification.transaction_id
end