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[0]
  @organization_name = row[1]
  @term_number = row[2]
  @batch_number = row[3]
  @batch_date = parse_date(row[4])
  @transaction_date = parse_date(row[5])
  @card_code = row[6]
  @card_number = row[7]
  @reference_number = row[8]
  @purchase_id = row[9]
  @auth_code = row[10]
  @entry_mode = row[11]
  @transaction_amount = row[12]
  @trident_transaction_id = row[13]
  @client_reference_number = row[14]
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_idObject (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

#reference_numberObject (readonly)

Returns the value of attribute reference_number.



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

def reference_number
  @reference_number
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



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/merchant_e_solutions/detail_record.rb', line 28

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



41
42
43
44
45
46
47
48
49
# File 'lib/merchant_e_solutions/detail_record.rb', line 41

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