Class: ActiveMerchant::Billing::Integrations::Liqpay::Return
- Inherits:
-
Return
- Object
- Return
- ActiveMerchant::Billing::Integrations::Liqpay::Return
show all
- Defined in:
- lib/active_merchant/billing/integrations/liqpay/return.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.
10
11
12
13
14
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 10
def initialize(post)
super
xml = Base64.decode64(@params["operation_xml"])
@params.merge!(Hash.from_xml(xml)["response"])
end
|
Class Method Details
.recognizes?(params) ⇒ Boolean
6
7
8
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 6
def self.recognizes?(params)
params.has_key?('amount') && params.has_key?('order_id')
end
|
Instance Method Details
#account ⇒ Object
20
21
22
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 20
def account
params['merchant_id']
end
|
#acknowledge ⇒ Object
76
77
78
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 76
def acknowledge
security_key == generate_signature
end
|
#action_name ⇒ Object
36
37
38
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 36
def action_name
params['action_name'] end
|
#amount ⇒ Object
24
25
26
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 24
def amount
BigDecimal.new(gross)
end
|
#code ⇒ Object
64
65
66
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 64
def code
params['code']
end
|
#complete? ⇒ Boolean
16
17
18
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 16
def complete?
status == 'success'
end
|
#currency ⇒ Object
56
57
58
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 56
def currency
params['currency']
end
|
#generate_signature ⇒ Object
72
73
74
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 72
def generate_signature
Base64.encode64(Digest::SHA1.digest(generate_signature_string)).gsub(/\n/, '')
end
|
#generate_signature_string ⇒ Object
68
69
70
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 68
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
52
53
54
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 52
def gross
params['amount']
end
|
#item_id ⇒ Object
28
29
30
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 28
def item_id
params['order_id']
end
|
#sender_phone ⇒ Object
44
45
46
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 44
def sender_phone
params['sender_phone']
end
|
#status ⇒ Object
60
61
62
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 60
def status
params['status'] end
|
#transaction_id ⇒ Object
32
33
34
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 32
def transaction_id
params['transaction_id']
end
|
#version ⇒ Object
40
41
42
|
# File 'lib/active_merchant/billing/integrations/liqpay/return.rb', line 40
def version
params['version']
end
|