Class: OffsitePayments::Integrations::Paytm::Return

Inherits:
Return
  • Object
show all
Defined in:
lib/offsite_payments/integrations/paytm.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.



238
239
240
241
# File 'lib/offsite_payments/integrations/paytm.rb', line 238

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

Instance Method Details

#messageObject



259
260
261
# File 'lib/offsite_payments/integrations/paytm.rb', line 259

def message
  @notification.message
end

#status(order_id, order_amount) ⇒ Object



247
248
249
250
251
252
253
# File 'lib/offsite_payments/integrations/paytm.rb', line 247

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)


255
256
257
# File 'lib/offsite_payments/integrations/paytm.rb', line 255

def success?
  status(@params['MERC_UNQ_REF'], @params['TXNAMOUNT']) == 'Completed'
end

#transaction_idObject



243
244
245
# File 'lib/offsite_payments/integrations/paytm.rb', line 243

def transaction_id
  @notification.transaction_id
end