Class: Mundipagg::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/mundipagg/client.rb

Instance Method Summary collapse

Instance Method Details

#adapterObject



6
7
8
9
10
11
12
13
# File 'lib/mundipagg/client.rb', line 6

def adapter
  @adapter ||= Savon.client do
    wsdl "https://transaction.mundipaggone.com/MundiPaggService.svc?wsdl"
    namespaces "xmlns:mun" => "http://schemas.datacontract.org/2004/07/MundiPagg.One.Service.DataContracts"
    log_level ::ActiveMerchant::Billing::Base.test? ? :debug : :error
    log true
  end
end

#call(operation, command, message) ⇒ Object



15
16
17
18
19
20
# File 'lib/mundipagg/client.rb', line 15

def call(operation, command, message)
  root = Mundipagg::Key.new(command, "tns").to_s
  message = Mundipagg::Message.new(message).translate

  adapter.call(operation, message: { root => message })
end

#create_order(message) ⇒ Object



26
27
28
# File 'lib/mundipagg/client.rb', line 26

def create_order(message)
  call :create_order, :create_order_request, message
end

#manage_order(message) ⇒ Object



22
23
24
# File 'lib/mundipagg/client.rb', line 22

def manage_order(message)
  call :manage_order, :manage_order_request, message
end