Class: OffsitePayments::Integrations::Liqpay::Return
- Inherits:
-
Return
- Object
- Return
- OffsitePayments::Integrations::Liqpay::Return
show all
- Defined in:
- lib/offsite_payments/integrations/liqpay.rb
Instance Attribute Summary
Attributes inherited from Return
#notification, #params
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Return
#cancelled?, #message, #parse, #success?
Constructor Details
#initialize(post) ⇒ Return
Returns a new instance of Return.
144
145
146
147
148
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 144
def initialize(post)
super
xml = Base64.decode64(@params["operation_xml"])
@params.merge!(Hash.from_xml(xml)["response"])
end
|
Class Method Details
.recognizes?(params) ⇒ Boolean
140
141
142
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 140
def self.recognizes?(params)
params.has_key?('amount') && params.has_key?('order_id')
end
|
Instance Method Details
#account ⇒ Object
154
155
156
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 154
def account
params['merchant_id']
end
|
#acknowledge(authcode = nil) ⇒ Object
210
211
212
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 210
def acknowledge(authcode = nil)
security_key == generate_signature
end
|
#action_name ⇒ Object
170
171
172
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 170
def action_name
params['action_name'] end
|
#amount ⇒ Object
158
159
160
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 158
def amount
BigDecimal(gross)
end
|
#code ⇒ Object
198
199
200
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 198
def code
params['code']
end
|
#complete? ⇒ Boolean
150
151
152
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 150
def complete?
status == 'success'
end
|
#currency ⇒ Object
190
191
192
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 190
def currency
params['currency']
end
|
#generate_signature ⇒ Object
206
207
208
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 206
def generate_signature
Base64.encode64(Digest::SHA1.digest(generate_signature_string)).gsub(/\n/, '')
end
|
#generate_signature_string ⇒ Object
202
203
204
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 202
def generate_signature_string
['', version, @options[:secret], action_name, sender_phone, account, gross, currency, item_id, transaction_id, status, code, ''].flatten.compact.join('|')
end
|
#gross ⇒ Object
186
187
188
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 186
def gross
params['amount']
end
|
#item_id ⇒ Object
162
163
164
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 162
def item_id
params['order_id']
end
|
#security_key ⇒ Object
182
183
184
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 182
def security_key
params[OffsitePayments::Integrations::Liqpay.signature_parameter_name]
end
|
#sender_phone ⇒ Object
178
179
180
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 178
def sender_phone
params['sender_phone']
end
|
#status ⇒ Object
194
195
196
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 194
def status
params['status'] end
|
#transaction_id ⇒ Object
166
167
168
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 166
def transaction_id
params['transaction_id']
end
|
#version ⇒ Object
174
175
176
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 174
def version
params['version']
end
|