Class: Laundry::PaymentsGateway::ClientDriver

Inherits:
MerchantAuthenticatableDriver show all
Defined in:
lib/laundry/payments_gateway/drivers/client_driver.rb

Instance Attribute Summary

Attributes inherited from MerchantAuthenticatableDriver

#merchant

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MerchantAuthenticatableDriver

#default_body, #initialize, prettifiable_fields, #setup_client!, uglify_hash

Methods included from SOAPModel

#actions, extended, #setup

Constructor Details

This class inherits a constructor from Laundry::PaymentsGateway::MerchantAuthenticatableDriver

Class Method Details

.wsdlObject

Setup WSDL



7
8
9
10
11
12
13
# File 'lib/laundry/payments_gateway/drivers/client_driver.rb', line 7

def self.wsdl
  if Laundry.sandboxed?
    "https://sandbox.paymentsgateway.net/WS/Client.wsdl"
  else
    "https://ws.paymentsgateway.net/Service/v1/Client.wsdl"
  end
end

Instance Method Details

#create!(options = {}) ⇒ Object

Creates a client and returns the newly created client id.



25
26
27
28
29
30
# File 'lib/laundry/payments_gateway/drivers/client_driver.rb', line 25

def create!(options = {})
  r = create_client({'client' => ClientDriver.default_hash.merge(options).merge({'MerchantID' => self.merchant.id, 'ClientID' => 0, 'Status' => 'Active'})} ) do
    http.headers["SOAPAction"] = 'https://ws.paymentsgateway.net/v1/IClientService/createClient'
  end
  r[:create_client_response][:create_client_result]
end

#find(id) ⇒ Object



17
18
19
20
21
22
# File 'lib/laundry/payments_gateway/drivers/client_driver.rb', line 17

def find(id)
  r = get_client({'ClientID' => id}) do
    http.headers["SOAPAction"] = 'https://ws.paymentsgateway.net/v1/IClientService/getClient'
  end
  Client.from_response(r, self.merchant)
end