Sha256: 3ac669b25312a606132e11a18f6c26a0ea09f972dddfa169e5a85b0d99c72714

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'active_merchant'


module ActiveMerchant
  module Billing
    module Integrations
      module Payline
        
        def mock_request
          build_request
        end
        
        def build_request(body, options)
          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
                  xml.tag! 'wsse:UsernameToken' do
                    xml.tag! 'wsse:Username', @options[:login]
                    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-1.32'} do
                  add_merchant_data(xml, options)
                  xml << body
                end
              end
            end
          xml.target! 
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_merchant_payline-0.1.2 lib/active_merchant_payline.rb
active_merchant_payline-0.1.1 lib/active_merchant_payline.rb
active_merchant_payline-0.1.0 lib/active_merchant_payline.rb