Class: OffsitePayments::Integrations::Pxpay::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::Pxpay::Notification
show all
- Includes:
- ActiveMerchant::PostsData, ActiveMerchant::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.
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 108
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
157
158
159
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 157
def account
@params['userid']
end
|
#acknowledge(authcode = nil) ⇒ Object
was the notification a validly formed request?
124
125
126
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 124
def acknowledge(authcode = nil)
@valid == '1'
end
|
#auth_code ⇒ Object
169
170
171
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 169
def auth_code
@params['AuthCode']
end
|
#cancelled? ⇒ Boolean
138
139
140
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 138
def cancelled?
!success?
end
|
#card_holder_name ⇒ Object
177
178
179
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 177
def card_holder_name
@params['CardHolderName']
end
|
#card_number ⇒ Object
181
182
183
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 181
def card_number
@params['CardNumber']
end
|
#card_type ⇒ Object
173
174
175
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 173
def card_type
@params['CardName']
end
|
#client_ip ⇒ Object
189
190
191
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 189
def client_ip
@params['ClientInfo']
end
|
#complete? ⇒ Boolean
134
135
136
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 134
def complete?
@params['TxnType'] == 'Purchase' && success?
end
|
#currency ⇒ Object
153
154
155
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 153
def currency
@params['CurrencySettlement']
end
|
165
166
167
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 165
def currency_input
@params['CurrencyInput']
end
|
#expiry_date ⇒ Object
185
186
187
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 185
def expiry_date
@params['DateExpiry']
end
|
#gross ⇒ Object
149
150
151
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 149
def gross
@params['AmountSettlement']
end
|
#item_id ⇒ Object
161
162
163
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 161
def item_id
@params['MerchantReference']
end
|
#message ⇒ Object
214
215
216
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 214
def message
@params['ResponseText']
end
|
#optional_data ⇒ Object
218
219
220
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 218
def optional_data
[@params['TxnData1'],@fields['TxnData2'],@fields['TxnData3']]
end
|
#order_id ⇒ Object
193
194
195
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 193
def order_id
item_id
end
|
#payer_email ⇒ Object
197
198
199
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 197
def payer_email
@params['EmailAddress']
end
|
#received_at ⇒ Object
When was this payment was received by the client.
223
224
225
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 223
def received_at
settlement_date
end
|
#settlement_date ⇒ Object
205
206
207
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 205
def settlement_date
@params['DateSettlement']
end
|
#status ⇒ Object
128
129
130
131
132
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 128
def status
return 'Failed' unless success?
return 'Completed' if complete?
'Error'
end
|
#success? ⇒ Boolean
145
146
147
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 145
def success?
@params['Success'] == '1'
end
|
#test? ⇒ Boolean
Was this a test transaction?
228
229
230
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 228
def test?
nil
end
|
#transaction_id ⇒ Object
201
202
203
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 201
def transaction_id
@params['DpsTxnRef']
end
|
#txn_mac ⇒ Object
Indication of the uniqueness of a card number
210
211
212
|
# File 'lib/offsite_payments/integrations/pxpay.rb', line 210
def txn_mac
@params['TxnMac']
end
|