Class: ActiveMerchant::Billing::Integrations::PayuIn::Return
- Inherits:
-
Return
- Object
- Return
- ActiveMerchant::Billing::Integrations::PayuIn::Return
- Defined in:
- lib/active_merchant/payu_in/return.rb
Instance Method Summary collapse
- #cancelled? ⇒ Boolean
-
#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?(order_id, order_amount) ⇒ Boolean
check success of the transaction check order_id and.
-
#transaction_id ⇒ Object
PayU Transaction Id.
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, = {}) @notification = Notification.new(query_string, ) end |
Instance Method Details
#cancelled? ⇒ Boolean
44 45 46 |
# File 'lib/active_merchant/payu_in/return.rb', line 44 def cancelled? false end |
#message ⇒ Object
48 49 50 |
# File 'lib/active_merchant/payu_in/return.rb', line 48 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
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
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_id ⇒ Object
PayU Transaction Id
13 14 15 |
# File 'lib/active_merchant/payu_in/return.rb', line 13 def transaction_id @notification.transaction_id end |