lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.119.0 vs lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.120.0
- old
+ new
@@ -23,12 +23,12 @@
class CyberSourceGateway < Gateway
self.test_url = 'https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor'
self.live_url = 'https://ics2wsa.ic3.com/commerce/1.x/transactionProcessor'
# Schema files can be found here: https://ics2ws.ic3.com/commerce/1.x/transactionProcessor/
- TEST_XSD_VERSION = '1.164'
- PRODUCTION_XSD_VERSION = '1.164'
+ TEST_XSD_VERSION = '1.181'
+ PRODUCTION_XSD_VERSION = '1.181'
ECI_BRAND_MAPPING = {
visa: 'vbv',
master: 'spa',
maestro: 'spa',
american_express: 'aesk',
@@ -296,10 +296,12 @@
add_stored_credential_subsequent_auth(xml, options)
add_issuer_additional_data(xml, options)
add_partner_solution_id(xml)
add_stored_credential_options(xml, options)
add_merchant_description(xml, options)
+ add_sales_slip_number(xml, options)
+ add_airline_data(xml, options)
xml.target!
end
def build_tax_calculation_request(creditcard, options)
@@ -334,10 +336,12 @@
xml = Builder::XmlMarkup.new indent: 2
add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
add_threeds_2_ucaf_data(xml, payment_method_or_reference, options)
add_decision_manager_fields(xml, options)
add_mdd_fields(xml, options)
+ add_sales_slip_number(xml, options)
+ add_airline_data(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
@@ -521,19 +525,32 @@
xml.tag! 'locality', options[:merchant_descriptor_locality] if options[:merchant_descriptor_locality]
end
end
end
+ def add_sales_slip_number(xml, options)
+ xml.tag! 'salesSlipNumber', options[:sales_slip_number] if options[:sales_slip_number]
+ end
+
+ def add_airline_data(xml, options)
+ return unless options[:airline_agent_code]
+
+ xml.tag! 'airlineData' do
+ xml.tag! 'agentCode', options[:airline_agent_code]
+ end
+ end
+
def add_purchase_data(xml, money = 0, include_grand_total = false, options = {})
xml.tag! 'purchaseTotals' do
xml.tag! 'currency', options[:currency] || currency(money)
xml.tag!('grandTotalAmount', localized_amount(money.to_i, options[:currency] || default_currency)) if include_grand_total
end
end
def add_address(xml, payment_method, address, options, shipTo = false)
first_name, last_name = address_names(address[:name], payment_method)
+ bill_to_merchant_tax_id = options[:merchant_tax_id] unless shipTo
xml.tag! shipTo ? 'shipTo' : 'billTo' do
xml.tag! 'firstName', first_name if first_name
xml.tag! 'lastName', last_name if last_name
xml.tag! 'street1', address[:address1]
@@ -547,10 +564,11 @@
xml.tag! 'phoneNumber', address[:phone] unless address[:phone].blank?
xml.tag! 'email', options[:email].presence || 'null@cybersource.com'
xml.tag! 'ipAddress', options[:ip] unless options[:ip].blank? || shipTo
xml.tag! 'driversLicenseNumber', options[:drivers_license_number] unless options[:drivers_license_number].blank?
xml.tag! 'driversLicenseState', options[:drivers_license_state] unless options[:drivers_license_state].blank?
+ xml.tag! 'merchantTaxID', bill_to_merchant_tax_id unless bill_to_merchant_tax_id.blank?
end
end
def address_names(address_name, payment_method)
names = split_names(address_name)
@@ -602,11 +620,11 @@
return unless options.keys.any? { |key| key.to_s.start_with?('mdd_field') && options[key] }
xml.tag! 'merchantDefinedData' do
(1..100).each do |each|
key = "mdd_field_#{each}".to_sym
- xml.tag!("field#{each}", options[key]) if options[key]
+ xml.tag!('mddField', options[key], 'id' => each) if options[key]
end
end
end
def add_check(xml, check)
@@ -851,9 +869,11 @@
def add_installments(xml, options)
return unless options[:installment_total_count]
xml.tag! 'installment' do
xml.tag! 'totalCount', options[:installment_total_count]
+ xml.tag!('planType', options[:installment_plan_type]) if options[:installment_plan_type]
+ xml.tag!('firstInstallmentDate', options[:first_installment_date]) if options[:first_installment_date]
end
end
def add_validate_pinless_debit_service(xml)
xml.tag! 'pinlessDebitValidateService', { 'run' => 'true' }