Class: ActiveMerchant::Billing::Integrations::TwoCheckout::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::TwoCheckout::Notification
- Defined in:
- lib/active_merchant/billing/integrations/two_checkout/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
-
#acknowledge(authcode = nil) ⇒ Object
Checks against MD5 Hash.
- #complete? ⇒ Boolean
-
#currency ⇒ Object
Allow seller to define default currency (should match 2Checkout account pricing currency).
-
#gross ⇒ Object
The money amount we received in X.2 decimal.
-
#item_id ⇒ Object
Third Party Cart parameters will return ‘card_order_id’ Pass Through Product parameters will only return ‘merchant_order_id’.
-
#payer_email ⇒ Object
Customer Email.
- #received_at ⇒ Object
- #receiver_email ⇒ Object
-
#secret ⇒ Object
Secret Word defined in 2Checkout account.
-
#security_key ⇒ Object
The MD5 Hash.
-
#status ⇒ Object
2Checkout only returns ‘Y’ for this parameter.
-
#test? ⇒ Boolean
Was this a test transaction? # Use the hash Please note 2Checkout forces the order number computed in the hash to ‘1’ on demo sales.
-
#transaction_id ⇒ Object
2Checkout Sale ID.
Methods inherited from Notification
#amount, #empty!, #gross_cents, #initialize, #valid_sender?
Constructor Details
This class inherits a constructor from ActiveMerchant::Billing::Integrations::Notification
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
Checks against MD5 Hash
118 119 120 121 122 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 118 def acknowledge(authcode = nil) return false if security_key.blank? Digest::MD5.hexdigest("#{secret}#{params['sid']}#{transaction_id}#{gross}").upcase == security_key.upcase end |
#complete? ⇒ Boolean
54 55 56 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 54 def complete? status == 'Completed' end |
#currency ⇒ Object
Allow seller to define default currency (should match 2Checkout account pricing currency)
50 51 52 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 50 def currency 'USD' end |
#gross ⇒ Object
The money amount we received in X.2 decimal.
92 93 94 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 92 def gross params['total'] end |
#item_id ⇒ Object
Third Party Cart parameters will return ‘card_order_id’ Pass Through Product parameters will only return ‘merchant_order_id’
60 61 62 63 64 65 66 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 60 def item_id if (params['cart_order_id'].nil?) params['merchant_order_id'] else params['cart_order_id'] end end |
#payer_email ⇒ Object
Customer Email
78 79 80 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 78 def payer_email params['email'] end |
#received_at ⇒ Object
73 74 75 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 73 def received_at params[''] end |
#receiver_email ⇒ Object
82 83 84 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 82 def receiver_email params[''] end |
#secret ⇒ Object
Secret Word defined in 2Checkout account
113 114 115 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 113 def secret @options[:credential2] end |
#security_key ⇒ Object
The MD5 Hash
87 88 89 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 87 def security_key params['key'] end |
#status ⇒ Object
2Checkout only returns ‘Y’ for this parameter. If the sale is not authorized, no passback occurs.
103 104 105 106 107 108 109 110 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 103 def status case params['credit_card_processed'] when 'Y' 'Completed' else 'Failed' end end |
#test? ⇒ Boolean
Was this a test transaction? # Use the hash Please note 2Checkout forces the order number computed in the hash to ‘1’ on demo sales.
98 99 100 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 98 def test? params['demo'] == 'Y' end |
#transaction_id ⇒ Object
2Checkout Sale ID
69 70 71 |
# File 'lib/active_merchant/billing/integrations/two_checkout/notification.rb', line 69 def transaction_id params['order_number'] end |