Class: ActiveMerchant::Billing::Integrations::EasyPay::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::EasyPay::Notification
show all
- Includes:
- Common
- Defined in:
- lib/active_merchant/billing/integrations/easy_pay/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Common
#generate_signature, #notify_signature_string, #request_signature_string
#empty!, #gross_cents, #test?, #valid_sender?
Constructor Details
#initialize(data, options) ⇒ Notification
Returns a new instance of Notification.
8
9
10
11
12
13
14
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 8
def initialize(data, options)
if options[:credential2].nil?
raise ArgumentError, "You need to provide the md5 secret as the option :credential2 to verify that the notification originated from EasyPay"
end
super
end
|
Class Method Details
.recognizes?(params) ⇒ Boolean
16
17
18
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 16
def self.recognizes?(params)
params.has_key?('order_mer_code') && params.has_key?('sum')
end
|
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
48
49
50
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 48
def acknowledge(authcode = nil)
security_key == generate_signature(:notify)
end
|
#amount ⇒ Object
24
25
26
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 24
def amount
BigDecimal.new(gross)
end
|
#complete? ⇒ Boolean
20
21
22
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 20
def complete?
true
end
|
#gross ⇒ Object
36
37
38
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 36
def gross
params['sum']
end
|
#item_id ⇒ Object
28
29
30
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 28
def item_id
params['order_mer_code']
end
|
#secret ⇒ Object
44
45
46
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 44
def secret
@options[:credential2]
end
|
#security_key ⇒ Object
32
33
34
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 32
def security_key
params[ActiveMerchant::Billing::Integrations::EasyPay.notify_signature_parameter_name]
end
|
#status ⇒ Object
40
41
42
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 40
def status
'Completed'
end
|
#success_response(*args) ⇒ Object
52
53
54
|
# File 'lib/active_merchant/billing/integrations/easy_pay/notification.rb', line 52
def success_response(*args)
{ :nothing => true }
end
|