lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.56.0 vs lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.57.0

- old
+ new

@@ -31,11 +31,11 @@ # the documentation exactly. class CyberSourceGateway < Gateway self.test_url = 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor' self.live_url = 'https://ics2ws.ic3.com/commerce/1.x/transactionProcessor' - XSD_VERSION = "1.109" + XSD_VERSION = "1.121" # visa, master, american_express, discover self.supported_cardtypes = [:visa, :master, :american_express, :discover] self.supported_countries = %w(US BR CA CN DK FI FR DE JP MX NO SE GB SG) self.default_currency = 'USD' @@ -259,10 +259,11 @@ end def build_auth_request(money, creditcard_or_reference, options) xml = Builder::XmlMarkup.new :indent => 2 add_payment_method_or_subscription(xml, money, creditcard_or_reference, options) + add_mdd_fields(xml, options) add_auth_service(xml, creditcard_or_reference, options) add_business_rules_data(xml, creditcard_or_reference, options) xml.target! end @@ -289,10 +290,11 @@ end def build_purchase_request(money, payment_method_or_reference, options) xml = Builder::XmlMarkup.new :indent => 2 add_payment_method_or_subscription(xml, money, payment_method_or_reference, 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) else add_purchase_service(xml, payment_method_or_reference, options) add_business_rules_data(xml, payment_method_or_reference, options) unless options[:pinless_debit_card] @@ -471,9 +473,18 @@ xml.tag! 'accountNumber', creditcard.number xml.tag! 'expirationMonth', format(creditcard.month, :two_digits) xml.tag! 'expirationYear', format(creditcard.year, :four_digits) xml.tag!('cvNumber', creditcard.verification_value) unless (@options[:ignore_cvv] || creditcard.verification_value.blank? ) xml.tag! 'cardType', @@credit_card_codes[card_brand(creditcard).to_sym] + end + end + + def add_mdd_fields(xml, options) + xml.tag! 'merchantDefinedData' do + (1..20).each do |each| + key = "mdd_field_#{each}".to_sym + xml.tag!("field#{each}", options[key]) if options[key] + end end end def add_check(xml, check) xml.tag! 'check' do