-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
CyberSource: update NT methods to allow for recurring AP #4817
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -799,23 +799,31 @@ def add_auth_network_tokenization(xml, payment_method, options) | |
|
||
brand = card_brand(payment_method).to_sym | ||
|
||
# stored_credential_overrides is not documented on the gateway guide in docs | ||
# I think the easiest way to solve for apple pay recurring is to create a new field within the hash | ||
# commerce_indicator can be passed in as 'internet' but is assigned that value in an earlier method so will be overwritten by the card brand if there is not something done within this method | ||
commerce_indicator = 'internet' if options.dig(:stored_credential_overrides, :type) == 'apple_pay' | ||
|
||
case brand | ||
when :visa | ||
xml.tag! 'ccAuthService', { 'run' => 'true' } do | ||
xml.tag!('cavv', payment_method.payment_cryptogram) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we removing the cryptogram fields entirely or only for recurring transactions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only for recurring Apple Pay transactions. That's why I said the guard clauses should probably be revisited, but this was more of a draft/means to get getting a passing test. |
||
xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand]) | ||
xml.tag!('xid', payment_method.payment_cryptogram) | ||
# these guard clauses need more consideration but work for the needs of this edge case remote test | ||
xml.tag!('cavv', payment_method.payment_cryptogram) unless options[:stored_credential_overrides] | ||
xml.commerceIndicator commerce_indicator.nil? ? ECI_BRAND_MAPPING[brand] : commerce_indicator | ||
xml.tag!('xid', payment_method.payment_cryptogram) unless options[:stored_credential_overrides] | ||
xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id] | ||
end | ||
when :master | ||
# mastercard is more finicky, has different fields required. no passing test yet. | ||
xml.tag! 'ucaf' do | ||
xml.tag!('authenticationData', payment_method.payment_cryptogram) | ||
xml.tag!('authenticationData', payment_method.payment_cryptogram) unless options[:stored_credential_overrides] | ||
xml.tag!('collectionIndicator', DEFAULT_COLLECTION_INDICATOR) | ||
end | ||
xml.tag! 'ccAuthService', { 'run' => 'true' } do | ||
xml.tag!('commerceIndicator', ECI_BRAND_MAPPING[brand]) | ||
xml.commerceIndicator commerce_indicator.nil? ? ECI_BRAND_MAPPING[brand] : commerce_indicator | ||
xml.tag!('reconciliationID', options[:reconciliation_id]) if options[:reconciliation_id] | ||
end | ||
# AmEx isn't part of NTID scheme so not sure if this will work with AP that is underlying AmEx | ||
when :american_express | ||
cryptogram = Base64.decode64(payment_method.payment_cryptogram) | ||
xml.tag! 'ccAuthService', { 'run' => 'true' } do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you envisioning the merchant passing in this GSF or adding when we build the params in the gateway class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a thought, but this was more of a means to an end to see if I could get a passing remote test. I'm open to other options.