module ActiveMerchant #:nodoc: module Billing #:nodoc: module Integrations #:nodoc: module Payline class WebPaymentRequest #merchant_id, merchant_key, contract, return_url, amount attr_accessor :options def initialize(options = {}) self.options= options end def to_xml 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.soapenv :Envelope, xmlns do xml.soapenv :Header do end xml.soapenv :Body do do_web_payment_envelope xml end end xml.target! end private def do_web_payment_envelope(xml) xml.impl :doWebPaymentRequest do xml.impl :securityMode, 'SSL' xml.impl :languageCode xml.impl :customPaymentPageCode add_urls_to xml add_payment_to xml add_order_to xml add_contract_to xml add_buyer_to xml end xml end private def add_urls_to(xml) xml.impl :returnURL, '' xml.impl :cancelURL, '' xml.impl :notificationURL, '' xml.impl :customPaymentTemplateURL, '' xml end private def add_payment_to(xml) xml.impl :payment do xml.obj :amount, '' xml.obj :currency, '' xml.obj :action, '' xml.obj :mode, '' xml.obj :contractNumber, '' xml.obj :differedActionDate, '' end end private def add_order_to(xml) xml.impl :order do xml.obj :ref, '' xml.obj :origin, '' xml.obj :country, '' xml.obj :taxes, '' xml.obj :amount, '' xml.obj :currency, '' xml.obj :date, '' xml.obj :details do xml.obj :details do xml.obj :ref, '' xml.obj :price, '' xml.obj :quantity, '' xml.obj :comment, '' end end end end private def add_contract_to(xml) xml.impl :selectedContractList do xml.obj :selectedContract, '' end end private def add_buyer_to(xml) xml.impl :buyer do xml.obj :lastName, '' xml.obj :firstName, '' xml.obj :email, '' xml.obj :accountCreateDate, '' xml.obj :accountAverageAmount, '' xml.obj :accountOrderCount, '' xml.obj :ip, '' xml.obj :shippingAdress do xml.obj :name, '' xml.obj :street1, '' xml.obj :street2, '' xml.obj :cityName, '' xml.obj :zipCode, '' xml.obj :country, '' xml.obj :phone, '' end end end end end end end end