lib/active_merchant/billing/gateways/iridium.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/iridium.rb in activemerchant-1.116.0

- old
+ new

@@ -249,20 +249,20 @@ def capture(money, authorization, options = {}) commit(build_reference_request('COLLECTION', money, authorization, options), options) end - def credit(money, authorization, options={}) + def credit(money, authorization, options = {}) ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE refund(money, authorization, options) end - def refund(money, authorization, options={}) + def refund(money, authorization, options = {}) commit(build_reference_request('REFUND', money, authorization, options), options) end - def void(authorization, options={}) + def void(authorization, options = {}) commit(build_reference_request('VOID', nil, authorization, options), options) end def supports_scrubbing true @@ -290,16 +290,16 @@ options[:action] = 'CrossReferenceTransaction' order_id, cross_reference, = authorization.split(';') build_request(options) do |xml| if money currency = options[:currency] || currency(money) - details = {'CurrencyCode' => currency_code(currency), 'Amount' => localized_amount(money, currency)} + details = { 'CurrencyCode' => currency_code(currency), 'Amount' => localized_amount(money, currency) } else - details = {'CurrencyCode' => currency_code(default_currency), 'Amount' => '0'} + details = { 'CurrencyCode' => currency_code(default_currency), 'Amount' => '0' } end xml.tag! 'TransactionDetails', details do - xml.tag! 'MessageDetails', {'TransactionType' => type, 'CrossReference' => cross_reference} + xml.tag! 'MessageDetails', { 'TransactionType' => type, 'CrossReference' => cross_reference } xml.tag! 'OrderID', (options[:order_id] || order_id) end end end @@ -307,13 +307,13 @@ requires!(options, :action) xml = Builder::XmlMarkup.new indent: 2 xml.instruct!(:xml, version: '1.0', encoding: 'utf-8') xml.tag! 'soap:Envelope', { 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', - 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do + 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema' } do xml.tag! 'soap:Body' do - xml.tag! options[:action], {'xmlns' => 'https://www.thepaymentgateway.net/'} do + xml.tag! options[:action], { 'xmlns' => 'https://www.thepaymentgateway.net/' } do xml.tag! 'PaymentMessage' do add_merchant_data(xml, options) yield(xml) end end @@ -328,12 +328,12 @@ end def add_purchase_data(xml, type, money, options) currency = options[:currency] || currency(money) requires!(options, :order_id) - xml.tag! 'TransactionDetails', {'Amount' => localized_amount(money, currency), 'CurrencyCode' => currency_code(currency)} do - xml.tag! 'MessageDetails', {'TransactionType' => type} + xml.tag! 'TransactionDetails', { 'Amount' => localized_amount(money, currency), 'CurrencyCode' => currency_code(currency) } do + xml.tag! 'MessageDetails', { 'TransactionType' => type } xml.tag! 'OrderID', options[:order_id] xml.tag! 'TransactionControl' do xml.tag! 'ThreeDSecureOverridePolicy', 'FALSE' xml.tag! 'EchoAVSCheckResult', 'TRUE' xml.tag! 'EchoCV2CheckResult', 'TRUE' @@ -369,17 +369,17 @@ xml.tag! 'ExpiryDate', { 'Month' => creditcard.month.to_s.rjust(2, '0'), 'Year' => creditcard.year.to_s[/\d\d$/] } end end def add_merchant_data(xml, options) - xml.tag! 'MerchantAuthentication', {'MerchantID' => @options[:login], 'Password' => @options[:password]} + xml.tag! 'MerchantAuthentication', { 'MerchantID' => @options[:login], 'Password' => @options[:password] } end def commit(request, options) requires!(options, :action) response = parse(ssl_post(test? ? self.test_url : self.live_url, request, - {'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action], + { 'SOAPAction' => 'https://www.thepaymentgateway.net/' + options[:action], 'Content-Type' => 'text/xml; charset=utf-8' })) success = response[:transaction_result][:status_code] == '0' message = response[:transaction_result][:message] authorization = success ? [options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code]].compact.join(';') : nil @@ -389,17 +389,16 @@ authorization: authorization, avs_result: { street_match: AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ], postal_match: AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ] }, - cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ] - ) + cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]) end def parse(xml) reply = {} xml = REXML::Document.new(xml) - if (root = REXML::XPath.first(xml, '//CardDetailsTransactionResponse')) or + if (root = REXML::XPath.first(xml, '//CardDetailsTransactionResponse')) || (root = REXML::XPath.first(xml, '//CrossReferenceTransactionResponse')) root.elements.to_a.each do |node| case node.name when 'Message' reply[:message] = reply(node.text)