lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.96.0 vs lib/active_merchant/billing/gateways/cyber_source.rb in activemerchant-1.97.0

- old
+ new

@@ -22,11 +22,13 @@ # the documentation exactly. 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' - XSD_VERSION = '1.153' + # Schema files can be found here: https://ics2ws.ic3.com/commerce/1.x/transactionProcessor/ + TEST_XSD_VERSION = '1.156' + PRODUCTION_XSD_VERSION = '1.155' self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro, :elo] self.supported_countries = %w(US BR CA CN DK FI FR DE IN JP MX NO SE GB SG LB PK) self.default_currency = 'USD' @@ -261,10 +263,12 @@ 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_issuer_additional_data(xml, options) + xml.target! end def build_tax_calculation_request(creditcard, options) xml = Builder::XmlMarkup.new :indent => 2 @@ -299,10 +303,12 @@ 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] end + add_issuer_additional_data(xml, options) + xml.target! end def build_void_request(identification, options) order_id, request_id, request_token, action, money, currency = identification.split(';') @@ -483,10 +489,18 @@ xml.tag! 'enabled', options[:decision_manager_enabled] if options[:decision_manager_enabled] xml.tag! 'profile', options[:decision_manager_profile] if options[:decision_manager_profile] end end + def add_issuer_additional_data(xml, options) + return unless options[:issuer_additional_data] + + xml.tag! 'issuer' do + xml.tag! 'additionalData', options[:issuer_additional_data] + end + end + def add_mdd_fields(xml, options) return unless options.keys.any? { |key| key.to_s.start_with?('mdd_field') } xml.tag! 'merchantDefinedData' do (1..100).each do |each| @@ -711,10 +725,12 @@ end end # Where we actually build the full SOAP request using builder def build_request(body, options) + xsd_version = test? ? TEST_XSD_VERSION : PRODUCTION_XSD_VERSION + xml = Builder::XmlMarkup.new :indent => 2 xml.instruct! xml.tag! 's:Envelope', {'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/'} do xml.tag! 's:Header' do xml.tag! 'wsse:Security', {'s:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'} do @@ -723,10 +739,10 @@ xml.tag! 'wsse:Password', @options[:password], 'Type' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText' end end end xml.tag! 's:Body', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do - xml.tag! 'requestMessage', {'xmlns' => "urn:schemas-cybersource-com:transaction-data-#{XSD_VERSION}"} do + xml.tag! 'requestMessage', {'xmlns' => "urn:schemas-cybersource-com:transaction-data-#{xsd_version}"} do add_merchant_data(xml, options) xml << body end end end