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
121
122
123
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 121
def account
params['instId']
end
|
#acknowledge(authcode = nil) ⇒ Object
220
221
222
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 220
def acknowledge(authcode = nil)
return true
end
|
#address ⇒ Object
165
166
167
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 165
def address
params['address']
end
|
#address_status ⇒ Object
212
213
214
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 212
def address_status
return avs_value_to_symbol(params['AVS'][2].chr)
end
|
#card_type ⇒ Object
189
190
191
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 189
def card_type
params['cardType']
end
|
#complete? ⇒ Boolean
117
118
119
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 117
def complete?
status == 'Completed'
end
|
#country ⇒ Object
173
174
175
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 173
def country
params['country']
end
|
#country_status ⇒ Object
216
217
218
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 216
def country_status
return avs_value_to_symbol(params['AVS'][3].chr)
end
|
#currency ⇒ Object
148
149
150
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 148
def currency
params['currency']
end
|
#custom_params ⇒ Object
WorldPay supports the passing of custom parameters through to the callback script
225
226
227
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 225
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
204
205
206
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 204
def cvv_status
return avs_value_to_symbol(params['AVS'][0].chr)
end
|
#email_address ⇒ Object
185
186
187
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 185
def email_address
params['email']
end
|
#fax_number ⇒ Object
181
182
183
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 181
def fax_number
params['fax']
end
|
#gross ⇒ Object
the money amount we received in X.2 decimal.
144
145
146
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 144
def gross
params['amount']
end
|
#item_id ⇒ Object
125
126
127
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 125
def item_id
params['cartId']
end
|
#name ⇒ Object
161
162
163
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 161
def name
params['name']
end
|
#phone_number ⇒ Object
177
178
179
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 177
def phone_number
params['tel']
end
|
#postcode ⇒ Object
169
170
171
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 169
def postcode
params['postcode']
end
|
#postcode_status ⇒ Object
208
209
210
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 208
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.
134
135
136
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 134
def received_at
Time.at(params['transTime'].to_i / 1000).utc
end
|
#security_key ⇒ Object
Callback password set in the WorldPay CMS
139
140
141
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 139
def security_key
params['callbackPW']
end
|
#status ⇒ Object
157
158
159
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 157
def status
params['transStatus'] == 'Y' ? 'Completed' : 'Cancelled'
end
|
#test? ⇒ Boolean
Was this a test transaction?
153
154
155
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 153
def test?
params.key?('testMode') && params['testMode'] != '0'
end
|
#transaction_id ⇒ Object
129
130
131
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 129
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
230
231
232
233
|
# File 'lib/offsite_payments/integrations/world_pay.rb', line 230
def valid_sender?(ip)
return true if OffsitePayments.mode == :test
IPAddr.new("195.35.90.0/23").include?(IPAddr.new(ip))
end
|