Class: MerbMerchant::Billing::Integrations::TwoCheckout::Notification
- Inherits:
-
Notification
- Object
- Notification
- MerbMerchant::Billing::Integrations::TwoCheckout::Notification
show all
- Defined in:
- lib/merb_merchant/billing/integrations/two_checkout/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #valid_sender?
Instance Method Details
#acknowledge ⇒ Object
96
97
98
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 96
def acknowledge
true
end
|
#complete? ⇒ Boolean
40
41
42
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 40
def complete?
status == 'Completed'
end
|
#currency ⇒ Object
order_number 2Checkout.com order number
card_holder_name Card holder's name
street_address Card holder's address
city Card holder's city
state Card holder's state
zip Card holder's zip
country Card holder's country
email Card holder's email
phone Card holder's phone
credit_card_processed Y if successful, K if waiting for approval
total Total purchase amount
ship_name Shipping information
ship_street_address Shipping information
ship_city Shipping information
ship_state Shipping information
ship_zip Shipping information
ship_country Shipping information
product_id 2Checkout product ID for purchased items will append a number if more than one item.
ex. product_id,product_id1,product_id2
quantity quantity of corresponding product will append a number if more than one item.
ex. quantity,quantity1,quantity2
merchant_product_id your product ID for purchased items will append a number if more than one item.
ex. merchant_product_id,merchant_product_id1,merchant_product_id2
product_description your description for purchased items will append a number if more than one item.
ex. product_description,product_description1,product_description2
36
37
38
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 36
def currency
'USD'
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
70
71
72
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 70
def gross
params['total']
end
|
#item_id ⇒ Object
44
45
46
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 44
def item_id
params['cart_order_id']
end
|
#payer_email ⇒ Object
56
57
58
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 56
def payer_email
params['email']
end
|
#received_at ⇒ Object
52
53
54
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 52
def received_at
params['']
end
|
#receiver_email ⇒ Object
60
61
62
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 60
def receiver_email
params['']
end
|
#security_key ⇒ Object
65
66
67
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 65
def security_key
params['key']
end
|
#status ⇒ Object
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 79
def status
case params['credit_card_processed']
when 'Y'
'Completed'
when 'K'
'Pending'
else
'Failed'
end
end
|
#test? ⇒ Boolean
Was this a test transaction? # Use the hash
75
76
77
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 75
def test?
params['demo'] == 'Y'
end
|
#transaction_id ⇒ Object
48
49
50
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 48
def transaction_id
params['order_number']
end
|
#verify(secret) ⇒ Object
90
91
92
93
94
|
# File 'lib/merb_merchant/billing/integrations/two_checkout/notification.rb', line 90
def verify(secret)
return false if security_key.blank?
Digest::MD5.hexdigest("#{secret}#{params['sid']}#{transaction_id}#{gross}").upcase == security_key.upcase
end
|