Class: ActiveMerchant::Billing::Integrations::PayuIn::Return
- Defined in:
- lib/active_merchant/billing/integrations/payu_in/return.rb
Instance Attribute Summary
Attributes inherited from Return
Instance Method Summary collapse
-
#initialize(query_string, options = {}) ⇒ Return
constructor
A new instance of Return.
- #message ⇒ Object
-
#status(order_id, order_amount) ⇒ Object
Returns the status of the transaction as a string The status can be one of the following.
-
#success? ⇒ Boolean
check success of the transaction check order_id and.
-
#transaction_id ⇒ Object
PayU Transaction Id.
Methods inherited from Return
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, = {}) super @notification = Notification.new(query_string, ) end |
Instance Method Details
#message ⇒ Object
45 46 47 |
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 45 def @notification. 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
31 32 33 34 35 36 37 |
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 31 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
check success of the transaction check order_id and
41 42 43 |
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 41 def success? status( @params['txnid'], @params['amount'] ) == 'success' end |
#transaction_id ⇒ Object
PayU Transaction Id
14 15 16 |
# File 'lib/active_merchant/billing/integrations/payu_in/return.rb', line 14 def transaction_id @notification.transaction_id end |