Class: OffsitePayments::Integrations::Pxpay::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pxpay::Notification
show all
- Includes:
- ActiveUtils::PostsData, ActiveUtils::RequiresParameters
- Defined in:
- lib/offsite_payments/integrations/pxpay.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #iso_currency, #valid_sender?
Constructor Details
#initialize(query_string, options = {}) ⇒ Notification
Returns a new instance of Notification.
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 110
def initialize(query_string, options={})
query_string[/\?/] = '&' if query_string[/\?/]
super
@encrypted_params = @params
@params = {}
requires! @encrypted_params, "result"
requires! @options, :credential1, :credential2
decrypt_transaction_result(@encrypted_params["result"])
end
|
Instance Method Details
#account ⇒ Object
159
160
161
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 159
def account
@params['userid']
end
|
#acknowledge(authcode = nil) ⇒ Object
was the notification a validly formed request?
126
127
128
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 126
def acknowledge(authcode = nil)
@valid == '1'
end
|
#auth_code ⇒ Object
171
172
173
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 171
def auth_code
@params['AuthCode']
end
|
#cancelled? ⇒ Boolean
140
141
142
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 140
def cancelled?
!success?
end
|
#card_holder_name ⇒ Object
179
180
181
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 179
def card_holder_name
@params['CardHolderName']
end
|
#card_number ⇒ Object
183
184
185
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 183
def card_number
@params['CardNumber']
end
|
#card_type ⇒ Object
175
176
177
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 175
def card_type
@params['CardName']
end
|
#client_ip ⇒ Object
191
192
193
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 191
def client_ip
@params['ClientInfo']
end
|
#complete? ⇒ Boolean
136
137
138
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 136
def complete?
@params['TxnType'] == 'Purchase' && success?
end
|
#currency ⇒ Object
155
156
157
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 155
def currency
@params['CurrencySettlement']
end
|
167
168
169
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 167
def currency_input
@params['CurrencyInput']
end
|
#expiry_date ⇒ Object
187
188
189
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 187
def expiry_date
@params['DateExpiry']
end
|
#gross ⇒ Object
151
152
153
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 151
def gross
@params['AmountSettlement']
end
|
#item_id ⇒ Object
163
164
165
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 163
def item_id
@params['MerchantReference']
end
|
#message ⇒ Object
216
217
218
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 216
def message
@params['ResponseText']
end
|
#optional_data ⇒ Object
220
221
222
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 220
def optional_data
[@params['TxnData1'],@fields['TxnData2'],@fields['TxnData3']]
end
|
#order_id ⇒ Object
195
196
197
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 195
def order_id
item_id
end
|
#payer_email ⇒ Object
199
200
201
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 199
def payer_email
@params['EmailAddress']
end
|
#received_at ⇒ Object
When was this payment was received by the client.
225
226
227
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 225
def received_at
settlement_date
end
|
#settlement_date ⇒ Object
207
208
209
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 207
def settlement_date
@params['DateSettlement']
end
|
#status ⇒ Object
130
131
132
133
134
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 130
def status
return 'Failed' unless success?
return 'Completed' if complete?
'Error'
end
|
#success? ⇒ Boolean
147
148
149
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 147
def success?
@params['Success'] == '1'
end
|
#test? ⇒ Boolean
Was this a test transaction?
230
231
232
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 230
def test?
nil
end
|
#transaction_id ⇒ Object
203
204
205
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 203
def transaction_id
@params['DpsTxnRef']
end
|
#txn_mac ⇒ Object
Indication of the uniqueness of a card number
212
213
214
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 212
def txn_mac
@params['TxnMac']
end
|