lib/active_merchant/billing/gateways/transbank_oneclick.rb
# Build up a soap request envelope including the payload and basic structure.
# Please use extreme caution when modifying this method. Canonicalization is
# complicated and can be easily put off course.
Build up a soap request envelope including the payload and basic structure.
Please use extreme caution when modifying this method. Canonicalization is
complicated and can be easily put off course.
Build up a soap request envelope including the payload and basic structure . Please use extreme caution when modifying this method . Canonicalization is complicated and can be easily put off course .
def build_soap_envelope
        xml = Nokogiri::XML::Builder.new do |xml|
          xml.Envelope('xmlns:soap' => SOAP_NAMESPACE, 'xmlns:web' => TRANSBANK_NAMESPACE, 'xmlns:wsse' => WSSE_NAMESPACE) do
            ns = xml.parent.namespace_definitions.find{|ns|ns.prefix=="soap"}
            xml.doc.root.namespace = ns
            xml['soap'].Header do
              xml['wsse'].Security('soap:mustUnderstand' => '1', 'xmlns:wsu' => WSU_NAMESPACE, 'xmlns:ec' => EC_NAMESPACE, 'xmlns:ds' => DS_NAMESPACE) do
                xml['ds'].Signature(:Id => 'SIG-16') do |xml|
                  xml['ds'].SignedInfo do |xml|
                    xml['ds'].CanonicalizationMethod('Algorithm' => C14N_ALGORITHM) do
                      xml['ec'].InclusiveNamespaces('PrefixList' => "soap web")
                    end
                    xml['ds'].SignatureMethod('Algorithm' => SIGNATURE_ALGORITHM)
                    xml['ds'].Reference(:URI => '#id-body-1') do |xml|
                      xml['ds'].Transforms do
                        xml['ds'].Transform('Algorithm' => C14N_ALGORITHM) do
                          xml['ec'].InclusiveNamespaces('PrefixList' => "web")
                        end
                      end
                      xml['ds'].DigestMethod('Algorithm' => DIGEST_ALGORITHM)
                      xml['ds'].DigestValue '' 
                    end
                  end
                  xml['ds'].SignatureValue '' 
                  xml['ds'].KeyInfo(:Id => 'KI-1') do
                    xml['wsse'].SecurityTokenReference('wsu:Id' => 'STR-1') do
                      xml['ds'].X509Data do
                        xml['ds'].X509IssuerSerial do
                          xml['ds'].X509IssuerName   certificate_issuer
                          xml['ds'].X509SerialNumber certificate.serial
                        end
                      end
                    end
                  end 
                end 
              end 
            end 
            xml['soap'].Body('wsu:Id' => 'id-body-1', 'xmlns:wsu' => WSU_NAMESPACE) do
              yield xml
            end
          end
        end
        xml
      end
def build_soap_envelope xml = Nokogiri :: XML :: Builder . new do | xml | xml . Envelope ( 'xmlns:soap' => SOAP_NAMESPACE , 'xmlns:web' => TRANSBANK_NAMESPACE , 'xmlns:wsse' => WSSE_NAMESPACE ) do ns = xml . parent . namespace_definitions . find { | ns | ns . prefix == "soap" } xml . doc . root . namespace = ns xml [ 'soap' ] . Header do xml [ 'wsse' ] . Security ( 'soap:mustUnderstand' => '1' , 'xmlns:wsu' => WSU_NAMESPACE , 'xmlns:ec' => EC_NAMESPACE , 'xmlns:ds' => DS_NAMESPACE ) do xml [ 'ds' ] . Signature ( :Id => 'SIG-16' ) do | xml | xml [ 'ds' ] . SignedInfo do | xml | xml [ 'ds' ] . CanonicalizationMethod ( 'Algorithm' => C14N_ALGORITHM ) do xml [ 'ec' ] . InclusiveNamespaces ( 'PrefixList' => "soap web" ) end xml [ 'ds' ] . SignatureMethod ( 'Algorithm' => SIGNATURE_ALGORITHM ) xml [ 'ds' ] . Reference ( :URI => '#id-body-1' ) do | xml | xml [ 'ds' ] . Transforms do xml [ 'ds' ] . Transform ( 'Algorithm' => C14N_ALGORITHM ) do xml [ 'ec' ] . InclusiveNamespaces ( 'PrefixList' => "web" ) end end xml [ 'ds' ] . DigestMethod ( 'Algorithm' => DIGEST_ALGORITHM ) xml [ 'ds' ] . DigestValue '' end end xml [ 'ds' ] . SignatureValue '' xml [ 'ds' ] . KeyInfo ( :Id => 'KI-1' ) do xml [ 'wsse' ] . SecurityTokenReference ( 'wsu:Id' => 'STR-1' ) do xml [ 'ds' ] . X509Data do xml [ 'ds' ] . X509IssuerSerial do xml [ 'ds' ] . X509IssuerName certificate_issuer xml [ 'ds' ] . X509SerialNumber certificate . serial end end end end end end end xml [ 'soap' ] . Body ( 'wsu:Id' => 'id-body-1' , 'xmlns:wsu' => WSU_NAMESPACE ) do yield xml end end end xml end
Build up a soap request envelope including the payload and basic structure.
Build up a soap request envelope including the payload and basic structure .
# Add soap namespace to root # Add the header # Digest placeholder # Signature placeholder # KeyInfo # Signature # Security # Header # Add the actual payload