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.



249
250
251
252
# File 'lib/offsite_payments/integrations/payu_in.rb', line 249

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

Instance Method Details

#messageObject



270
271
272
# File 'lib/offsite_payments/integrations/payu_in.rb', line 270

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object



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

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)


266
267
268
# File 'lib/offsite_payments/integrations/payu_in.rb', line 266

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

#transaction_idObject



254
255
256
# File 'lib/offsite_payments/integrations/payu_in.rb', line 254

def transaction_id
  @notification.transaction_id
end