Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worldpay: Add AVS and CVC Mapping #3107

Merged
merged 1 commit into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* TrustCommerce: Use `application_id` [nfarve] #3103
* Stripe: Add 3DS Support [nfarve] #3086
* WorldPay: Pull CVC and AVS Result from Response [nfarve] #3106
* Worldpay: Add AVS and CVC Mapping [nfarve] #3107


== Version 1.89.0 (December 17, 2018)
Expand Down
20 changes: 20 additions & 0 deletions lib/active_merchant/billing/gateways/worldpay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ class WorldpayGateway < Gateway
'diners_club' => 'DINERS-SSL',
}

AVS_CODE_MAP = {
'A' => 'M', # Match
'B' => 'P', # Postcode matches, address not verified
'C' => 'Z', # Postcode matches, address does not match
'D' => 'B', # Address matched; postcode not checked
'E' => 'I', # Address and postal code not checked
'F' => 'A', # Address matches, postcode does not match
'G' => 'C', # Address does not match, postcode not checked
'H' => 'I', # Address and postcode not provided
'I' => 'C', # Address not checked postcode does not match
'J' => 'C', # Address and postcode does not match
}

CVC_CODE_MAP = {
'A' => 'M', # CVV matches
'B' => 'P', # Not provided
'C' => 'P', # Not checked
'D' => 'N', # Does not match
}

def initialize(options = {})
requires!(options, :login, :password)
super
Expand Down