Class: Laundry::PaymentsGateway::Merchant

Inherits:
Object
  • Object
show all
Extended by:
SOAPModel
Defined in:
lib/laundry/payments_gateway/models/merchant.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SOAPModel

actions, extended, setup

Constructor Details

#initialize(options = {}) ⇒ Merchant

Returns a new instance of Merchant.



22
23
24
25
26
27
28
29
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 22

def initialize(options = {})

  self.id = options[:id]
  self. = options[:api_login_id]
  self.api_password = options[:api_password]
  self.transaction_password = options[:transaction_password]

end

Instance Attribute Details

#api_login_idObject

Returns the value of attribute api_login_id.



20
21
22
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 20

def 
  @api_login_id
end

#api_passwordObject

Returns the value of attribute api_password.



20
21
22
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 20

def api_password
  @api_password
end

#idObject

Returns the value of attribute id.



20
21
22
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 20

def id
  @id
end

#transaction_passwordObject

Returns the value of attribute transaction_password.



20
21
22
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 20

def transaction_password
  @transaction_password
end

Class Method Details

.default_merchant(options = nil) ⇒ Object

Deprecated. Avoid this.



15
16
17
18
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 15

def self.default_merchant(options = nil)
  @@default_merchant = Merchant.new(options) if options
  @@default_merchant
end

Instance Method Details

#client_driverObject Also known as: clients



31
32
33
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 31

def client_driver
  @client_driver ||= ClientDriver.new(self)
end

#login_credentialsObject



45
46
47
48
49
50
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 45

def 
  # Time diff from 1/1/0001 00:00:00 to 1/1/1970 00:00:00
  utc_time = (Time.now.to_i + 62135596800).to_s + '0000000'
  ts_hash = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new('md5'), self.api_password, "#{self.}|#{utc_time}")
  {'ticket' => {'APILoginID' => self., 'TSHash' => ts_hash, 'UTCTime' => utc_time}}
end

#socket_driverObject



41
42
43
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 41

def socket_driver
  @socket_driver ||= SocketDriver.new(self)
end

#transaction_driverObject Also known as: transactions



36
37
38
# File 'lib/laundry/payments_gateway/models/merchant.rb', line 36

def transaction_driver
  @transaction_driver ||= TransactionDriver.new(self)
end