Class: ActiveMerchant::Billing::Integrations::EPaymentPlans::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::EPaymentPlans::Notification
show all
- Includes:
- PostsData
- Defined in:
- lib/active_merchant/billing/integrations/e_payment_plans/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(authcode = nil) ⇒ Object
Acknowledge the transaction to EPaymentPlans. This method has to be called after a new apc arrives. EPaymentPlans will verify that all the information we received are correct and will return ok or a fail.
Example:
def ipn
notify = EPaymentPlans.notification(request.raw_post)
if notify.acknowledge
... process order ... if notify.complete?
else
... log possible hacking attempt ...
end
61
62
63
64
65
66
67
68
69
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 61
def acknowledge(authcode = nil)
payload = raw
response = ssl_post(EPaymentPlans.notification_confirmation_url, payload)
raise StandardError.new("Faulty EPaymentPlans result: #{response}") unless ["AUTHORISED", "DECLINED"].include?(response)
response == "AUTHORISED"
end
|
#complete? ⇒ Boolean
9
10
11
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 9
def complete?
status == "Completed"
end
|
#currency ⇒ Object
30
31
32
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 30
def currency
params['currency']
end
|
#gross ⇒ Object
26
27
28
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 26
def gross
params['gross']
end
|
#item_id ⇒ Object
17
18
19
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 17
def item_id
params['item_id']
end
|
#received_at ⇒ Object
When was this payment received by the client.
22
23
24
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 22
def received_at
Time.parse(params['received_at'].to_s).utc
end
|
#security_key ⇒ Object
34
35
36
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 34
def security_key
params['security_key']
end
|
#status ⇒ Object
43
44
45
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 43
def status
params['status'].capitalize
end
|
#test? ⇒ Boolean
Was this a test transaction?
39
40
41
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 39
def test?
params['test'] == 'test'
end
|
#transaction_id ⇒ Object
13
14
15
|
# File 'lib/active_merchant/billing/integrations/e_payment_plans/notification.rb', line 13
def transaction_id
params['transaction_id']
end
|