lib/active_merchant/billing/gateways/monei.rb in activemerchant-1.105.0 vs lib/active_merchant/billing/gateways/monei.rb in activemerchant-1.106.0

- old
+ new

@@ -149,15 +149,15 @@ commit(request) end # Private: Build XML wrapping code yielding to code to fill the transaction information def build_request - builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| - xml.Request(:version => '1.0') do - xml.Header { xml.Security(:sender => @options[:sender_id]) } - xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do - xml.User(:login => @options[:login], :pwd => @options[:pwd]) + builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml| + xml.Request(version: '1.0') do + xml.Header { xml.Security(sender: @options[:sender_id]) } + xml.Transaction(mode: test? ? 'CONNECTOR_TEST' : 'LIVE', response: 'SYNC', channel: @options[:channel_id]) do + xml.User(login: @options[:login], pwd: @options[:pwd]) yield xml end end end builder.to_xml @@ -181,11 +181,11 @@ # Private: Add payment part to XML def add_payment(xml, action, money, options) code = tanslate_payment_code(action) - xml.Payment(:code => code) do + xml.Payment(code: code) do xml.Presentation do xml.Amount amount(money) xml.Currency options[:currency] || currency(money) xml.Usage options[:description] || options[:order_id] end unless money.nil? @@ -196,11 +196,11 @@ def add_account(xml, credit_card) xml.Account do xml.Holder credit_card.name xml.Number credit_card.number xml.Brand credit_card.brand.upcase - xml.Expiry(:month => credit_card.month, :year => credit_card.year) + xml.Expiry(month: credit_card.month, year: credit_card.year) xml.Verification credit_card.verification_value end end # Private: Add customer part to XML @@ -246,26 +246,26 @@ end # Private : Add the 3DSecure infos to XML def add_three_d_secure(xml, options) if options[:three_d_secure] - xml.Authentication(:type => '3DSecure') do + xml.Authentication(type: '3DSecure') do xml.ResultIndicator eci_to_result_indicator options[:three_d_secure][:eci] - xml.Parameter(:name => 'VERIFICATION_ID') { xml.text options[:three_d_secure][:cavv] } - xml.Parameter(:name => 'XID') { xml.text options[:three_d_secure][:xid] } + xml.Parameter(name: 'VERIFICATION_ID') { xml.text options[:three_d_secure][:cavv] } + xml.Parameter(name: 'XID') { xml.text options[:three_d_secure][:xid] } end end end # Private: Parse XML response from Monei servers def parse(body) xml = Nokogiri::XML(body) { - :unique_id => xml.xpath('//Response/Transaction/Identification/UniqueID').text, - :status => translate_status_code(xml.xpath('//Response/Transaction/Processing/Status/@code').text), - :reason => translate_status_code(xml.xpath('//Response/Transaction/Processing/Reason/@code').text), - :message => xml.xpath('//Response/Transaction/Processing/Return').text + unique_id: xml.xpath('//Response/Transaction/Identification/UniqueID').text, + status: translate_status_code(xml.xpath('//Response/Transaction/Processing/Status/@code').text), + reason: translate_status_code(xml.xpath('//Response/Transaction/Processing/Reason/@code').text), + message: xml.xpath('//Response/Transaction/Processing/Return').text } end # Private: Send XML transaction to Monei servers and create AM response def commit(xml) @@ -324,14 +324,14 @@ end # Private: Translate AM operations to Monei operations codes def tanslate_payment_code(action) { - :purchase => 'CC.DB', - :authorize => 'CC.PA', - :capture => 'CC.CP', - :refund => 'CC.RF', - :void => 'CC.RV' + purchase: 'CC.DB', + authorize: 'CC.PA', + capture: 'CC.CP', + refund: 'CC.RF', + void: 'CC.RV' }[action] end end end end