class ProcessingKz::GetTransaction

Attributes

amount_authorized[R]
amount_refunded[R]
amount_requested[R]
auth_code[R]
customer_reference[R]
goods[R]
merchant_id[R]
merchant_local_date_time[R]
merchant_online_address[R]
purchaser_email[R]
purchaser_name[R]
purchaser_phone[R]
transaction_currency_code[R]
transaction_status[R]

Public Class Methods

new(args= {}) click to toggle source
# File lib/processing_kz/get_transaction.rb, line 21
def initialize(args= {})
  @merchant_id = args[:merchant_id] || Config.merchant_id
  @customer_reference = args[:customer_reference]
  request!
end

Public Instance Methods

goods=(goods) click to toggle source
# File lib/processing_kz/get_transaction.rb, line 31
def goods=(goods)
  @goods = goods if goods.class == Array
  @goods = [goods] unless goods.class == Array
end
hashed_goods_list() click to toggle source
# File lib/processing_kz/get_transaction.rb, line 45
def hashed_goods_list
  hash = []
  goods_list.each do |good|
    hash << good.to_hash
  end
  hash
end
request!() click to toggle source
# File lib/processing_kz/get_transaction.rb, line 53
def request!
  client = Savon.client(wsdl: Config.wsdl, endpoint: Config.host)
  response = client.call(:get_transaction_status, message: { 
    merchant_id: merchant_id,
    reference_nr: customer_reference
    }
  )
  response(response.body[:get_transaction_status_response][:return])
end
response(args = {}) click to toggle source
# File lib/processing_kz/get_transaction.rb, line 63
def response(args = {})
  @transaction_status = args[:transaction_status]
  @transaction_currency_code = args[:currency_code] || Config.currency_code
  @amount_requested = args[:amount_requested]
  @amount_authorized = args[:amount_authorized]
  @amount_refunded = args[:amount_refunded]
  @auth_code = args[:auth_code]
  @purchaser_name = args[:purchaser_name]
  @purchaser_email = args[:purchaser_email]
  @purchaser_phone = args[:purchaser_phone]
  @merchant_online_address = args[:merchant_online_address]
  @merchant_local_date_time = args[:merchant_local_date_time] || Time.now
  self.goods = args[:goods_list]
end
status() click to toggle source
# File lib/processing_kz/get_transaction.rb, line 27
def status
  @transaction_status
end
total_amount() click to toggle source
# File lib/processing_kz/get_transaction.rb, line 36
def total_amount
  raise NoGoodsError unless goods_list
  total = 0
  goods_list.each do |good|
    total += good.amount
  end
  total
end