Class: ActiveMerchant::Billing::Integrations::Rbkmoney::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Rbkmoney::Notification
show all
- Defined in:
- lib/active_merchant/billing/integrations/rbkmoney/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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/active_merchant/billing/integrations/rbkmoney/notification.rb', line 61
def acknowledge(authcode = nil)
string = [
eshop_id,
order_id,
service_name,
eshop_account,
recipient_amount,
recipient_currency,
payment_status,
user_name,
user_email,
payment_data,
@options[:secret]
].join '::'
signature = case hash.to_s.length
when 32
Digest::MD5.hexdigest(string)
when 128
Digest::SHA512.hexdigest(string)
else
return false
end
signature == hash
end
|
#complete? ⇒ Boolean
26
27
28
|
# File 'lib/active_merchant/billing/integrations/rbkmoney/notification.rb', line 26
def complete?
(payment_status == '5')
end
|
#status ⇒ Object
34
35
36
37
38
39
40
41
42
|
# File 'lib/active_merchant/billing/integrations/rbkmoney/notification.rb', line 34
def status
case payment_status
when '3'
'pending'
when '5'
'completed'
else 'unknown'
end
end
|
#test? ⇒ Boolean
30
31
32
|
# File 'lib/active_merchant/billing/integrations/rbkmoney/notification.rb', line 30
def test?
false
end
|
#user_fields ⇒ Object
44
45
46
47
48
49
50
51
|
# File 'lib/active_merchant/billing/integrations/rbkmoney/notification.rb', line 44
def user_fields
params.inject({}) do |fields, (k,v)|
if /\AuserField_[\d+]\z/.match(k)
fields[k] = v
end
fields
end
end
|