Class: OffsitePayments::Integrations::WorldPay::Notification

Inherits:
Notification
  • Object
show all
Defined in:
lib/offsite_payments/integrations/world_pay.rb

Instance Attribute Summary

Attributes inherited from Notification

#params, #raw

Instance Method Summary collapse

Methods inherited from Notification

#amount, #empty!, #gross_cents, #initialize, #iso_currency, #valid_sender?

Constructor Details

This class inherits a constructor from OffsitePayments::Notification

Instance Method Details

#accountObject



125
126
127
# File 'lib/offsite_payments/integrations/world_pay.rb', line 125

def 
  params['instId']
end

#acknowledge(authcode = nil) ⇒ Object



224
225
226
# File 'lib/offsite_payments/integrations/world_pay.rb', line 224

def acknowledge(authcode = nil)
  return true
end

#addressObject



169
170
171
# File 'lib/offsite_payments/integrations/world_pay.rb', line 169

def address
  params['address']
end

#address_statusObject



216
217
218
# File 'lib/offsite_payments/integrations/world_pay.rb', line 216

def address_status
  return avs_value_to_symbol(params['AVS'][2].chr)
end

#card_typeObject



193
194
195
# File 'lib/offsite_payments/integrations/world_pay.rb', line 193

def card_type
  params['cardType']
end

#complete?Boolean

Returns:

  • (Boolean)


121
122
123
# File 'lib/offsite_payments/integrations/world_pay.rb', line 121

def complete?
  status == 'Completed'
end

#countryObject



177
178
179
# File 'lib/offsite_payments/integrations/world_pay.rb', line 177

def country
  params['country']
end

#country_statusObject



220
221
222
# File 'lib/offsite_payments/integrations/world_pay.rb', line 220

def country_status
  return avs_value_to_symbol(params['AVS'][3].chr)
end

#currencyObject



152
153
154
# File 'lib/offsite_payments/integrations/world_pay.rb', line 152

def currency
  params['authCurrency']
end

#custom_paramsObject

WorldPay supports the passing of custom parameters through to the callback script



229
230
231
# File 'lib/offsite_payments/integrations/world_pay.rb', line 229

def custom_params
  return @custom_params ||= read_custom_params
end

#cvv_statusObject

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


208
209
210
# File 'lib/offsite_payments/integrations/world_pay.rb', line 208

def cvv_status
  return avs_value_to_symbol(params['AVS'][0].chr)
end

#email_addressObject



189
190
191
# File 'lib/offsite_payments/integrations/world_pay.rb', line 189

def email_address
  params['email']
end

#fax_numberObject



185
186
187
# File 'lib/offsite_payments/integrations/world_pay.rb', line 185

def fax_number
  params['fax']
end

#grossObject

the money amount we received in X.2 decimal.



148
149
150
# File 'lib/offsite_payments/integrations/world_pay.rb', line 148

def gross
  params['authAmount']
end

#item_idObject



129
130
131
# File 'lib/offsite_payments/integrations/world_pay.rb', line 129

def item_id
  params['cartId']
end

#nameObject



165
166
167
# File 'lib/offsite_payments/integrations/world_pay.rb', line 165

def name
  params['name']
end

#phone_numberObject



181
182
183
# File 'lib/offsite_payments/integrations/world_pay.rb', line 181

def phone_number
  params['tel']
end

#postcodeObject



173
174
175
# File 'lib/offsite_payments/integrations/world_pay.rb', line 173

def postcode
  params['postcode']
end

#postcode_statusObject



212
213
214
# File 'lib/offsite_payments/integrations/world_pay.rb', line 212

def postcode_status
  return avs_value_to_symbol(params['AVS'][1].chr)
end

#received_atObject

Time this payment was received by the client in UTC time.



138
139
140
# File 'lib/offsite_payments/integrations/world_pay.rb', line 138

def received_at
  Time.at(params['transTime'].to_i / 1000).utc
end

#security_keyObject

Callback password set in the WorldPay CMS



143
144
145
# File 'lib/offsite_payments/integrations/world_pay.rb', line 143

def security_key
  params['callbackPW']
end

#statusObject



161
162
163
# File 'lib/offsite_payments/integrations/world_pay.rb', line 161

def status
  params['transStatus'] == 'Y' ? 'Completed' : 'Cancelled'
end

#test?Boolean

Was this a test transaction?

Returns:

  • (Boolean)


157
158
159
# File 'lib/offsite_payments/integrations/world_pay.rb', line 157

def test?
  params.key?('testMode') && params['testMode'] != '0'
end

#transaction_idObject



133
134
135
# File 'lib/offsite_payments/integrations/world_pay.rb', line 133

def transaction_id
  params['transId']
end