Class: OffsitePayments::Integrations::Megakassa::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Megakassa::Notification
show all
- Defined in:
- lib/offsite_payments/integrations/megakassa.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #iso_currency, #test?, #valid_sender?
Instance Method Details
#acknowledge(authcode = nil) ⇒ Object
164
165
166
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 164
def acknowledge(authcode = nil)
security_key == generate_signature
end
|
#amount_client ⇒ Object
128
129
130
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 128
def amount_client
Money.new(gross_client_cents, currency)
end
|
#amount_shop ⇒ Object
116
117
118
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 116
def amount_shop
Money.new(gross_shop_cents, currency)
end
|
#client_email ⇒ Object
148
149
150
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 148
def client_email
params['client_email']
end
|
#complete? ⇒ Boolean
96
97
98
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 96
def complete?
true
end
|
#currency ⇒ Object
132
133
134
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 132
def currency
params['currency']
end
|
#generate_signature ⇒ Object
92
93
94
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 92
def generate_signature
Digest::MD5.hexdigest(generate_signature_string)
end
|
#generate_signature_string ⇒ Object
88
89
90
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 88
def generate_signature_string
"#{uid}:#{gross}:#{gross_shop}:#{gross_client}:#{currency}:#{order_id}:#{payment_method_id}:#{payment_method_title}:#{client_email}:#{secret}"
end
|
#gross ⇒ Object
104
105
106
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 104
def gross
params['amount']
end
|
#gross_client ⇒ Object
120
121
122
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 120
def gross_client
params['amount_client']
end
|
#gross_client_cents ⇒ Object
124
125
126
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 124
def gross_client_cents
(gross_client.to_f * 100.0).round
end
|
#gross_shop ⇒ Object
108
109
110
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 108
def gross_shop
params['amount_shop']
end
|
#gross_shop_cents ⇒ Object
112
113
114
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 112
def gross_shop_cents
(gross_shop.to_f * 100.0).round
end
|
#order_id ⇒ Object
136
137
138
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 136
def order_id
params['order_id']
end
|
#payment_method_id ⇒ Object
140
141
142
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 140
def payment_method_id
params['payment_method_id']
end
|
#payment_method_title ⇒ Object
144
145
146
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 144
def payment_method_title
params['payment_method_title']
end
|
#secret ⇒ Object
160
161
162
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 160
def secret
@options[:secret]
end
|
#status ⇒ Object
156
157
158
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 156
def status
'success'
end
|
#success_response(*args) ⇒ Object
168
169
170
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 168
def success_response(*args)
'ok'
end
|
#uid ⇒ Object
100
101
102
|
# File 'lib/offsite_payments/integrations/megakassa.rb', line 100
def uid
params['uid']
end
|