module PxFusion::Transaction::Request

Public Class Methods

get_transaction_id(transaction) click to toggle source
# File lib/pxfusion/transaction.rb, line 107
def self.get_transaction_id(transaction)
  # Build the hash to be sent to DPS
  # THE ORDER MATTERS
  attributes = transaction.instance_variable_get("@table")

  attributes[:token_billing] ? get_transaction_id_with_token(transaction) : get_transaction_id_without_token(transaction)
end
get_transaction_id_with_token(transaction) click to toggle source
# File lib/pxfusion/transaction.rb, line 72
def self.get_transaction_id_with_token(transaction)
  attributes = transaction.instance_variable_get("@table")

  msg = {
    username: attributes[:username],
    password: attributes[:password],
    tranDetail: {
      amount: attributes[:amount],
      currency: attributes[:currency],
      enableAddBillCard: true,
      merchantReference: attributes[:reference],
      returnUrl: attributes[:return_url],
      txnRef: attributes[:reference],
      txnType: attributes[:type]
    }
  }
end
get_transaction_id_without_token(transaction) click to toggle source
# File lib/pxfusion/transaction.rb, line 90
def self.get_transaction_id_without_token(transaction)
  attributes = transaction.instance_variable_get("@table")

  msg = {
    username: attributes[:username],
    password: attributes[:password],
    tranDetail: {
      amount: attributes[:amount],
      currency: attributes[:currency],
      merchantReference: attributes[:reference],
      returnUrl: attributes[:return_url],
      txnRef: attributes[:reference],
      txnType: attributes[:type]
    }
  }
end