lib/active_merchant/billing/gateways/transbank_oneclick.rb
# Add the magical security signatures to the soap envelope so that it
# is ready to send to the server.
Add the magical security signatures to the soap envelope so that it
is ready to send to the server.
Add the magical security signatures to the soap envelope so that it is ready to send to the server .
def add_soap_digital_signatures(xml)
        doc = Nokogiri::XML.parse(xml.doc.to_xml)
        body = doc.xpath('/soap:Envelope/soap:Body', 'soap' => SOAP_NAMESPACE).first()
        body = body.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0, ['web'])
        digest = doc.xpath('//ds:DigestValue', 'ds' => DS_NAMESPACE).first
        digest.content = digest_for(body)
        signed_info = doc.xpath('//ds:SignedInfo', 'ds' => DS_NAMESPACE).first
        canon = signed_info.canonicalize(Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0, ['soap', 'web'])
        signed_value = doc.xpath('//ds:SignatureValue', 'ds' => DS_NAMESPACE).first
        signed_value.content = signature_for(canon)
        doc.to_xml
      end
def add_soap_digital_signatures ( xml ) doc = Nokogiri :: XML . parse ( xml . doc . to_xml ) body = doc . xpath ( '/soap:Envelope/soap:Body' , 'soap' => SOAP_NAMESPACE ) . first ( ) body = body . canonicalize ( Nokogiri :: XML :: XML_C14N_EXCLUSIVE_1_0 , [ 'web' ] ) digest = doc . xpath ( '//ds:DigestValue' , 'ds' => DS_NAMESPACE ) . first digest . content = digest_for ( body ) signed_info = doc . xpath ( '//ds:SignedInfo' , 'ds' => DS_NAMESPACE ) . first canon = signed_info . canonicalize ( Nokogiri :: XML :: XML_C14N_EXCLUSIVE_1_0 , [ 'soap' , 'web' ] ) signed_value = doc . xpath ( '//ds:SignatureValue' , 'ds' => DS_NAMESPACE ) . first signed_value . content = signature_for ( canon ) doc . to_xml end
Add the magical security signatures to the soap envelope so that it
is ready to send to the server.
Add the magical security signatures to the soap envelope so that it is ready to send to the server .
# To get round silly namespace issues and help canonicalization, # reload the doc # Extract the Body and generate for digest # Set the digest # Prepare the SignedInfo for the signature # Add the signature to the document
xml