Class: OffsitePayments::Integrations::WorldPay::Notification
- Inherits:
-
Notification
- Object
- Notification
- OffsitePayments::Integrations::WorldPay::Notification
show all
- Defined in:
- lib/offsite_payments/integrations/world_pay.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #initialize, #iso_currency
Instance Method Details
#account ⇒ Object
126
127
128
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 126
def account
params['instId']
end
|
#acknowledge(authcode = nil) ⇒ Object
225
226
227
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 225
def acknowledge(authcode = nil)
return true
end
|
#address ⇒ Object
170
171
172
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 170
def address
params['address']
end
|
#address_status ⇒ Object
217
218
219
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 217
def address_status
return avs_value_to_symbol(params['AVS'][2].chr)
end
|
#card_type ⇒ Object
194
195
196
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 194
def card_type
params['cardType']
end
|
#complete? ⇒ Boolean
122
123
124
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 122
def complete?
status == 'Completed'
end
|
#country ⇒ Object
178
179
180
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 178
def country
params['country']
end
|
#country_status ⇒ Object
221
222
223
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 221
def country_status
return avs_value_to_symbol(params['AVS'][3].chr)
end
|
#currency ⇒ Object
153
154
155
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 153
def currency
params['authCurrency']
end
|
#custom_params ⇒ Object
WorldPay supports the passing of custom parameters through to the callback script
230
231
232
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 230
def custom_params
return @custom_params ||= read_custom_params
end
|
#cvv_status ⇒ Object
WorldPay extended fraud checks returned as a 4 character string
1st char: Credit card CVV check
2nd char: Postcode AVS check
3rd char: Address AVS check
4th char: Country comparison check
Possible values are:
:not_supported - 0
:not_checked - 1
:matched - 2
:not_matched - 4
:partial_match - 8
209
210
211
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 209
def cvv_status
return avs_value_to_symbol(params['AVS'][0].chr)
end
|
#email_address ⇒ Object
190
191
192
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 190
def email_address
params['email']
end
|
#fax_number ⇒ Object
186
187
188
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 186
def fax_number
params['fax']
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
149
150
151
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 149
def gross
params['authAmount']
end
|
#item_id ⇒ Object
130
131
132
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 130
def item_id
params['cartId']
end
|
#name ⇒ Object
166
167
168
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 166
def name
params['name']
end
|
#phone_number ⇒ Object
182
183
184
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 182
def phone_number
params['tel']
end
|
#postcode ⇒ Object
174
175
176
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 174
def postcode
params['postcode']
end
|
#postcode_status ⇒ Object
213
214
215
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 213
def postcode_status
return avs_value_to_symbol(params['AVS'][1].chr)
end
|
#received_at ⇒ Object
Time this payment was received by the client in UTC time.
139
140
141
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 139
def received_at
Time.at(params['transTime'].to_i / 1000).utc
end
|
#security_key ⇒ Object
Callback password set in the WorldPay CMS
144
145
146
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 144
def security_key
params['callbackPW']
end
|
#status ⇒ Object
162
163
164
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 162
def status
params['transStatus'] == 'Y' ? 'Completed' : 'Cancelled'
end
|
#test? ⇒ Boolean
Was this a test transaction?
158
159
160
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 158
def test?
params.key?('testMode') && params['testMode'] != '0'
end
|
#transaction_id ⇒ Object
134
135
136
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 134
def transaction_id
params['transId']
end
|
#valid_sender?(ip) ⇒ Boolean
Check if the request comes from IP range 195.35.90.0 – 195.35.91.255
235
236
237
238
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 235
def valid_sender?(ip)
return true if OffsitePayments.mode == :test
IPAddr.new("195.35.90.0/23").include?(IPAddr.new(ip))
end
|