lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.111.0 vs lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.112.0
- old
+ new
@@ -28,13 +28,15 @@
TEST_XSD_VERSION = '1.164'
PRODUCTION_XSD_VERSION = '1.164'
ECI_BRAND_MAPPING = {
visa: 'vbv',
master: 'spa',
+ maestro: 'spa',
american_express: 'aesk',
jcb: 'js',
discover: 'pb',
+ diners_club: 'pb',
}.freeze
DEFAULT_COLLECTION_INDICATOR = 2
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb dankort maestro elo]
self.supported_countries = %w(US AE BR CA CN DK FI FR DE IN JP MX NO SE GB SG LB PK)
@@ -276,14 +278,15 @@
add_mdd_fields(xml, options)
add_auth_service(xml, creditcard_or_reference, options)
add_threeds_services(xml, options)
add_payment_network_token(xml) if network_tokenization?(creditcard_or_reference)
add_business_rules_data(xml, creditcard_or_reference, options)
- add_stored_credential_options(xml, options)
+ add_stored_credential_subsequent_auth(xml, options)
add_issuer_additional_data(xml, options)
- add_merchant_description(xml, options)
add_partner_solution_id(xml)
+ add_stored_credential_options(xml, options)
+ add_merchant_description(xml, options)
xml.target!
end
def build_tax_calculation_request(creditcard, options)
@@ -320,21 +323,24 @@
add_threeds_2_ucaf_data(xml, payment_method_or_reference, options)
add_decision_manager_fields(xml, options)
add_mdd_fields(xml, options)
if !payment_method_or_reference.is_a?(String) && card_brand(payment_method_or_reference) == 'check'
add_check_service(xml)
+ add_issuer_additional_data(xml, options)
+ add_partner_solution_id(xml)
else
add_purchase_service(xml, payment_method_or_reference, options)
add_threeds_services(xml, options)
add_payment_network_token(xml) if network_tokenization?(payment_method_or_reference)
add_business_rules_data(xml, payment_method_or_reference, options) unless options[:pinless_debit_card]
+ add_stored_credential_subsequent_auth(xml, options)
+ add_issuer_additional_data(xml, options)
+ add_partner_solution_id(xml)
add_stored_credential_options(xml, options)
end
- add_issuer_additional_data(xml, options)
add_merchant_description(xml, options)
- add_partner_solution_id(xml)
xml.target!
end
def build_void_request(identification, options)
@@ -841,23 +847,30 @@
def lookup_country_code(country_field)
country_code = Country.find(country_field) rescue nil
country_code&.code(:alpha2)
end
- def add_stored_credential_options(xml, options={})
+ def add_stored_credential_subsequent_auth(xml, options={})
return unless options[:stored_credential] || options[:stored_credential_overrides]
stored_credential_subsequent_auth = 'true' if options.dig(:stored_credential, :initiator) == 'merchant'
+
+ override_subsequent_auth = options.dig(:stored_credential_overrides, :subsequent_auth)
+
+ xml.subsequentAuth override_subsequent_auth.nil? ? stored_credential_subsequent_auth : override_subsequent_auth
+ end
+
+ def add_stored_credential_options(xml, options={})
+ return unless options[:stored_credential] || options[:stored_credential_overrides]
+
stored_credential_subsequent_auth_first = 'true' if options.dig(:stored_credential, :initial_transaction)
stored_credential_transaction_id = options.dig(:stored_credential, :network_transaction_id) if options.dig(:stored_credential, :initiator) == 'merchant'
stored_credential_subsequent_auth_stored_cred = 'true' if options.dig(:stored_credential, :initiator) == 'cardholder' && !options.dig(:stored_credential, :initial_transaction) || options.dig(:stored_credential, :initiator) == 'merchant' && options.dig(:stored_credential, :reason_type) == 'unscheduled'
- override_subsequent_auth = options.dig(:stored_credential_overrides, :subsequent_auth)
override_subsequent_auth_first = options.dig(:stored_credential_overrides, :subsequent_auth_first)
override_subsequent_auth_transaction_id = options.dig(:stored_credential_overrides, :subsequent_auth_transaction_id)
override_subsequent_auth_stored_cred = options.dig(:stored_credential_overrides, :subsequent_auth_stored_credential)
- xml.subsequentAuth override_subsequent_auth.nil? ? stored_credential_subsequent_auth : override_subsequent_auth
xml.subsequentAuthFirst override_subsequent_auth_first.nil? ? stored_credential_subsequent_auth_first : override_subsequent_auth_first
xml.subsequentAuthTransactionID override_subsequent_auth_transaction_id.nil? ? stored_credential_transaction_id : override_subsequent_auth_transaction_id
xml.subsequentAuthStoredCredential override_subsequent_auth_stored_cred.nil? ? stored_credential_subsequent_auth_stored_cred : override_subsequent_auth_stored_cred
end