Class: OffsitePayments::Integrations::Molpay::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Molpay::Notification
show all
- Includes:
- ActiveUtils::PostsData
- Defined in:
- lib/offsite_payments/integrations/molpay.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #iso_currency, #valid_sender?
Instance Method Details
#account ⇒ Object
113
114
115
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 113
def account
params["domain"]
end
|
#acknowledge(authcode = nil) ⇒ Object
159
160
161
162
163
164
165
166
167
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 159
def acknowledge(authcode = nil)
payload = raw + '&treq=1'
ssl_post(Molpay.acknowledge_url, payload,
'Content-Length' => "#{payload.size}",
'User-Agent' => "Shopify/OffsitePayments"
)
status == 'Completed' && security_key == generate_signature
end
|
#auth_code ⇒ Object
135
136
137
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 135
def auth_code
params['appcode']
end
|
#channel ⇒ Object
126
127
128
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 126
def channel
params['channel']
end
|
#complete? ⇒ Boolean
101
102
103
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 101
def complete?
status == 'Completed'
end
|
#currency ⇒ Object
122
123
124
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 122
def currency
params['currency']
end
|
#error_code ⇒ Object
139
140
141
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 139
def error_code
params['error_code']
end
|
#error_desc ⇒ Object
143
144
145
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 143
def error_desc
params['error_desc']
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
118
119
120
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 118
def gross
params['amount']
end
|
#item_id ⇒ Object
105
106
107
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 105
def item_id
params['orderid']
end
|
#received_at ⇒ Object
When was this payment received by the client.
131
132
133
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 131
def received_at
params['paydate']
end
|
#security_key ⇒ Object
147
148
149
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 147
def security_key
params['skey']
end
|
#status ⇒ Object
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 90
def status
case params['status']
when '00'
'Completed'
when '11'
'Failed'
when '22'
'Pending'
end
end
|
#status_orig ⇒ Object
155
156
157
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 155
def status_orig
params['status']
end
|
#test? ⇒ Boolean
151
152
153
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 151
def test?
gross.blank? && auth_code.blank? && error_code.blank? && error_desc.blank? && security_key.blank?
end
|
#transaction_id ⇒ Object
109
110
111
|
# File 'lib/offsite_payments/integrations/molpay.rb', line 109
def transaction_id
params['tranID']
end
|