class OffsitePayments::Integrations::WorldPay::Notification
Public Instance Methods
account()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 126 def account params['instId'] end
acknowledge(authcode = nil)
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 225 def acknowledge(authcode = nil) return true end
address()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 170 def address params['address'] end
address_status()
click to toggle source
# 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()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 194 def card_type params['cardType'] end
complete?()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 122 def complete? status == 'Completed' end
country()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 178 def country params['country'] end
country_status()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 221 def country_status return avs_value_to_symbol(params['AVS'][3].chr) end
currency()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 153 def currency params['authCurrency'] end
custom_params()
click to toggle source
WorldPay
supports the passing of custom parameters through to the callback script
# File lib/offsite_payments/integrations/world_pay.rb, line 230 def custom_params return @custom_params ||= read_custom_params end
cvv_status()
click to toggle source
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
# 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()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 190 def email_address params['email'] end
fax_number()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 186 def fax_number params['fax'] end
gross()
click to toggle source
the money amount we received in X.2 decimal.
# File lib/offsite_payments/integrations/world_pay.rb, line 149 def gross params['authAmount'] end
item_id()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 130 def item_id params['cartId'] end
name()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 166 def name params['name'] end
phone_number()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 182 def phone_number params['tel'] end
postcode()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 174 def postcode params['postcode'] end
postcode_status()
click to toggle source
# 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()
click to toggle source
Time this payment was received by the client in UTC time.
# File lib/offsite_payments/integrations/world_pay.rb, line 139 def received_at Time.at(params['transTime'].to_i / 1000).utc end
security_key()
click to toggle source
Callback password set in the WorldPay
CMS
# File lib/offsite_payments/integrations/world_pay.rb, line 144 def security_key params['callbackPW'] end
status()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 162 def status params['transStatus'] == 'Y' ? 'Completed' : 'Cancelled' end
test?()
click to toggle source
Was this a test transaction?
# File lib/offsite_payments/integrations/world_pay.rb, line 158 def test? params.key?('testMode') && params['testMode'] != '0' end
transaction_id()
click to toggle source
# File lib/offsite_payments/integrations/world_pay.rb, line 134 def transaction_id params['transId'] end
valid_sender?(ip)
click to toggle source
Check if the request comes from IP range 195.35.90.0 – 195.35.91.255
# 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
Private Instance Methods
avs_value_to_symbol(value)
click to toggle source
Convert a AVS value to a symbol - see above for more about AVS
# File lib/offsite_payments/integrations/world_pay.rb, line 263 def avs_value_to_symbol(value) case value.to_s when '8' :partial_match when '4' :no_match when '2' :matched when '1' :not_checked else :not_supported end end
parse(post)
click to toggle source
Take the posted data and move the relevant data into a hash
# File lib/offsite_payments/integrations/world_pay.rb, line 243 def parse(post) @raw = post for line in post.split('&') key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten params[key] = value end end
read_custom_params()
click to toggle source
Read the custom params into a hash
# File lib/offsite_payments/integrations/world_pay.rb, line 252 def read_custom_params custom = {} params.each do |key, value| if /\A(M_|MC_|CM_)/ === key custom[key.gsub(/\A(M_|MC_|CM_)/, '').to_sym] = value end end custom end