Class: OffsitePayments::Integrations::Liqpay::Notification
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Class Method Summary
collapse
Instance Method Summary
collapse
#empty!, #gross_cents, #iso_currency, #test?, #valid_sender?
Constructor Details
#initialize(post, options = {}) ⇒ Notification
Returns a new instance of Notification.
64
65
66
67
68
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 64
def initialize(post, options = {})
raise ArgumentError if post.blank?
super
@params.merge!(Hash.from_xml(Base64.decode64(xml))["response"])
end
|
Class Method Details
.recognizes?(params) ⇒ Boolean
60
61
62
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 60
def self.recognizes?(params)
params.has_key?('amount') && params.has_key?('order_id')
end
|
Instance Method Details
#account ⇒ Object
78
79
80
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 78
def account
params['merchant_id']
end
|
#acknowledge(authcode = nil) ⇒ Object
134
135
136
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 134
def acknowledge(authcode = nil)
security_key == generate_signature
end
|
#action_name ⇒ Object
94
95
96
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 94
def action_name
params['action_name'] end
|
#amount ⇒ Object
82
83
84
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 82
def amount
Money.from_amount(BigDecimal(gross), currency)
end
|
#code ⇒ Object
122
123
124
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 122
def code
params['code']
end
|
#complete? ⇒ Boolean
74
75
76
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 74
def complete?
status == 'success'
end
|
#currency ⇒ Object
114
115
116
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 114
def currency
params['currency']
end
|
#generate_signature ⇒ Object
130
131
132
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 130
def generate_signature
Base64.encode64(Digest::SHA1.digest(generate_signature_string)).strip
end
|
#generate_signature_string ⇒ Object
126
127
128
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 126
def generate_signature_string
"#{@options[:secret]}#{Base64.decode64(xml)}#{@options[:secret]}"
end
|
#gross ⇒ Object
110
111
112
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 110
def gross
params['amount']
end
|
#item_id ⇒ Object
86
87
88
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 86
def item_id
params['order_id']
end
|
#security_key ⇒ Object
106
107
108
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 106
def security_key
params[OffsitePayments::Integrations::Liqpay.signature_parameter_name]
end
|
#sender_phone ⇒ Object
102
103
104
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 102
def sender_phone
params['sender_phone']
end
|
#status ⇒ Object
118
119
120
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 118
def status
params['status'] end
|
#transaction_id ⇒ Object
90
91
92
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 90
def transaction_id
params['transaction_id']
end
|
#version ⇒ Object
98
99
100
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 98
def version
params['version']
end
|
#xml ⇒ Object
70
71
72
|
# File 'lib/offsite_payments/integrations/liqpay.rb', line 70
def xml
@params["operation_xml"]
end
|