require 'net/http' require 'net/https' module ActiveMerchant #:nodoc: module Billing #:nodoc: module Integrations #:nodoc: module Payline class WebPayment def authorize xml= Builder::XmlMarkup.new xml.instruct! xmlns= { 'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:impl' => 'http://impl.ws.payline.experian.com', 'xmlns:obj' => 'http://obj.ws.payline.experian.com' } xml.tag! "soapenv:Envelope", xmlns do xml.tag! "soapenv:Header" xml.tag! "soapenv:Body" do do_web_payment_envelope(xml) end end http= Net::HTTP.new('https://homologation.payline.com/', 443) #http = Net::HTTP.new(self.service_url, 443) http.use_ssl= true path= 'V4/services/DirectPaymentAPI' data= xml.target! resp, data = http.post(path, data) puts resp.inspect puts data.inspect end private def do_web_payment_envelope(xml) xml.tag! 'impl:doWebPaymentRequest' do xml.tag! 'impl:securityMode' do xml.text! 'SSL' end xml.tag! 'impl:languageCode' xml.tag! 'impl:customPaymentPageCode' do end add_urls(xml) add_payment(xml) add_order(xml) add_contract(xml) add_buyer(xml) end xml end private def add_urls(xml) xml.tag! 'impl:returnURL' do end xml.tag! 'impl:cancelURL' do end xml.tag! 'impl:notificationURL' do end xml.tag! 'impl:customPaymentTemplateURL' do end xml end def add_payment(xml) xml.tag! 'impl:payment' do end end private def add_order(xml) xml.tag! 'impl:order' do end end private def add_contract(xml) xml.tag! 'impl:contract' do end end private def add_buyer(xml) xml.tag! 'impl:buyer' do end end end end end end end