class MerchantESolutions::DetailRecord

Attributes

auth_code[R]
batch_date[R]
batch_number[R]
card_code[R]
card_number[R]
client_reference_number[R]
entry_mode[R]
organization_id[R]
organization_name[R]
purchase_id[R]
term_number[R]
transaction_amount[R]
transaction_date[R]
trident_transaction_id[R]

Public Class Methods

new(row) click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 10
def initialize(row)
  @organization_id = row["Merchant Id"]
  @organization_name = row["DBA Name"]
  @term_number = row["Term Num"]
  @batch_number = row["Batch Num"]
  @batch_date = parse_date(row["Batch Date"])
  @transaction_date = parse_date(row["Tran Date"])
  @card_code = row["Card Type"]
  @card_number = row["Card Number"]
  @reference_number = row["Reference"]
  @purchase_id = row["Purchase Id"]
  @auth_code = row["Auth Code"]
  @entry_mode = row["Entry Mode"]
  @transaction_amount = row["Tran Amount"]
  @trident_transaction_id = row["Trident Tran Id"]
  @client_reference_number = row["Client Ref Num"]
end

Public Instance Methods

credit_company() click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 38
def credit_company
  {
    "AM" => "American Express",
    "DS" => "Discover",
    "MB" => "MasterCard",
    "MC" => "MasterCard",
    "MD" => "MasterCard",
    "VB" => "Visa",
    "VD" => "Visa",
    "VS" => "Visa",
  }.fetch(card_code, card_code)
end
credit_type() click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 51
def credit_type
  if ["MC", "VS", "AM", "DS"].include? card_code
    "Credit"
  elsif ["MD", "VD"].include? card_code
    "Debit"
  elsif ["MB", "VB"].include? card_code
    "Business"
  end
end
reference_number(options={}) click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 28
def reference_number(options={})
  return @reference_number if options[:unchanged]
  cleaned_reference_number
end

Private Instance Methods

cleaned_purchase_id() click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 72
def cleaned_purchase_id
  @purchase_id.strip
end
cleaned_reference_number() click to toggle source
# File lib/merchant_e_solutions/detail_record.rb, line 64
def cleaned_reference_number
  if @reference_number.start_with?("'")
    @reference_number[1..-1]
  else
    @reference_number
  end
end