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

Inherits:
Return
  • Object
show all
Defined in:
lib/active_merchant/payu_in/return.rb

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Return.



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

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

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/active_merchant/payu_in/return.rb', line 44

def cancelled?
  false
end

#messageObject



48
49
50
# File 'lib/active_merchant/payu_in/return.rb', line 48

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object

Returns the status of the transaction as a string The status can be one of the following

invalid - transaction id not present tampered - checksum does not mismatch mismatch - order id mismatch success - transaction success pending - transaction pending failure - transaction failure

payu does not put the discount field in the checksum it can be easily forged by the attacker without detection



30
31
32
33
34
35
36
# File 'lib/active_merchant/payu_in/return.rb', line 30

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

#success?(order_id, order_amount) ⇒ Boolean

check success of the transaction check order_id and

Returns:

  • (Boolean)


40
41
42
# File 'lib/active_merchant/payu_in/return.rb', line 40

def success?( order_id, order_amount )
  status( order_id, order_amount ) == 'success'
end

#transaction_idObject

PayU Transaction Id



13
14
15
# File 'lib/active_merchant/payu_in/return.rb', line 13

def transaction_id
  @notification.transaction_id
end