Class: ActiveMerchant::Billing::Integrations::PayuIn::Return

Inherits:
Return
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/payu_in/return.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.



7
8
9
10
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 7

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

Instance Method Details

#messageObject



28
29
30
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 28

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 16

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

#success?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 24

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

#transaction_idObject



12
13
14
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 12

def transaction_id
  @notification.transaction_id
end