Class: MerchantESolutions::DetailRecord

Inherits:
Record
  • Object
show all
Defined in:
lib/merchant_e_solutions/detail_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ DetailRecord

Returns a new instance of DetailRecord.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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

Instance Attribute Details

#auth_codeObject (readonly)

Returns the value of attribute auth_code.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def auth_code
  @auth_code
end

#batch_dateObject (readonly)

Returns the value of attribute batch_date.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def batch_date
  @batch_date
end

#batch_numberObject (readonly)

Returns the value of attribute batch_number.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def batch_number
  @batch_number
end

#card_codeObject (readonly)

Returns the value of attribute card_code.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def card_code
  @card_code
end

#card_numberObject (readonly)

Returns the value of attribute card_number.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def card_number
  @card_number
end

#client_reference_numberObject (readonly)

Returns the value of attribute client_reference_number.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def client_reference_number
  @client_reference_number
end

#entry_modeObject (readonly)

Returns the value of attribute entry_mode.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def entry_mode
  @entry_mode
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def organization_id
  @organization_id
end

#organization_nameObject (readonly)

Returns the value of attribute organization_name.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def organization_name
  @organization_name
end

#purchase_id(options = {}) ⇒ Object (readonly)

Returns the value of attribute purchase_id.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def purchase_id
  @purchase_id
end

#term_numberObject (readonly)

Returns the value of attribute term_number.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def term_number
  @term_number
end

#transaction_amountObject (readonly)

Returns the value of attribute transaction_amount.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def transaction_amount
  @transaction_amount
end

#transaction_dateObject (readonly)

Returns the value of attribute transaction_date.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def transaction_date
  @transaction_date
end

#trident_transaction_idObject (readonly)

Returns the value of attribute trident_transaction_id.



6
7
8
# File 'lib/merchant_e_solutions/detail_record.rb', line 6

def trident_transaction_id
  @trident_transaction_id
end

Instance Method Details

#credit_companyObject



38
39
40
41
42
43
44
45
46
47
48
49
# 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_typeObject



51
52
53
54
55
56
57
58
59
# 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 = {}) ⇒ Object



28
29
30
31
# File 'lib/merchant_e_solutions/detail_record.rb', line 28

def reference_number(options={})
  return @reference_number if options[:unchanged]
  cleaned_reference_number
end