class Przelewy24::Ekspres::Client

Public Class Methods

new(login, password) click to toggle source
# File lib/przelewy24/ekspres/client.rb, line 6
def initialize(login, password)
  @login = login
  @password = password
end

Public Instance Methods

register_transfer(transaction) click to toggle source
# File lib/przelewy24/ekspres/client.rb, line 11
def register_transfer(transaction)
  response = client.call(:register_transfer, message: {
    'authorizeIn' => authorization_object,
    'o_transactionIn' => transaction
  })

  SoapResponse.new(response.body[:register_transfer_response][:return])
rescue Savon::SOAPFault => error
  raise InvalidAttributes
end

Private Instance Methods

authorization_object() click to toggle source
# File lib/przelewy24/ekspres/client.rb, line 28
def authorization_object
  {
    login: @login,
    pass: @password
  }
end
client() click to toggle source
# File lib/przelewy24/ekspres/client.rb, line 24
def client
  @client ||= Savon::Client.new(wsdl: 'https://ekspres.przelewy24.pl/wsdl/pay/service_sandbox.php?wsdl')
end