Class: CanadaPayment::EFT::CPA005::Debit::Segment
- Inherits:
-
Object
- Object
- CanadaPayment::EFT::CPA005::Debit::Segment
- Includes:
- Helper
- Defined in:
- lib/canada_payment/eft/cpa005/debit/segment.rb
Constant Summary collapse
- DEFAULT_TRANSACTION_CODE =
450
Instance Attribute Summary collapse
-
#account_number ⇒ Object
Returns the value of attribute account_number.
-
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
-
#client_long_name ⇒ Object
Returns the value of attribute client_long_name.
-
#client_number ⇒ Object
Returns the value of attribute client_number.
-
#client_short_name ⇒ Object
Returns the value of attribute client_short_name.
-
#client_sundry_info ⇒ Object
Returns the value of attribute client_sundry_info.
-
#customer_name ⇒ Object
Returns the value of attribute customer_name.
-
#customer_number ⇒ Object
Returns the value of attribute customer_number.
-
#institution ⇒ Object
Returns the value of attribute institution.
-
#operating_subsidiary ⇒ Object
Returns the value of attribute operating_subsidiary.
-
#payment_date ⇒ Object
Returns the value of attribute payment_date.
-
#transaction_code ⇒ Object
Returns the value of attribute transaction_code.
-
#transit ⇒ Object
Returns the value of attribute transit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(transaction_code: nil, amount_cents:, payment_date:, institution:, transit:, account_number:, client_short_name:, client_long_name:, client_sundry_info: nil, client_number:, operating_subsidiary: nil, customer_name:, customer_number:) ⇒ Segment
constructor
A new instance of Segment.
- #to_s ⇒ Object (also: #output)
Methods included from Helper
#char_padded, #ensure_length, #padded_date, #space_padded, #zero_padded
Constructor Details
#initialize(transaction_code: nil, amount_cents:, payment_date:, institution:, transit:, account_number:, client_short_name:, client_long_name:, client_sundry_info: nil, client_number:, operating_subsidiary: nil, customer_name:, customer_number:) ⇒ Segment
Returns a new instance of Segment.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 20 def initialize(transaction_code: nil, amount_cents:, payment_date:, institution:, transit:, account_number:, client_short_name:, client_long_name:, client_sundry_info: nil, client_number:, operating_subsidiary: nil, customer_name:, customer_number:) @transaction_code = transaction_code || DEFAULT_TRANSACTION_CODE @amount_cents = amount_cents @payment_date = payment_date @institution = institution @transit = transit @account_number = account_number @client_short_name = client_short_name @client_long_name = client_long_name @client_sundry_info = client_sundry_info @client_number = client_number = @customer_name = customer_name @customer_number = customer_number end |
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def account_number @account_number end |
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def amount_cents @amount_cents end |
#client_long_name ⇒ Object
Returns the value of attribute client_long_name.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def client_long_name @client_long_name end |
#client_number ⇒ Object
Returns the value of attribute client_number.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def client_number @client_number end |
#client_short_name ⇒ Object
Returns the value of attribute client_short_name.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def client_short_name @client_short_name end |
#client_sundry_info ⇒ Object
Returns the value of attribute client_sundry_info.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def client_sundry_info @client_sundry_info end |
#customer_name ⇒ Object
Returns the value of attribute customer_name.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def customer_name @customer_name end |
#customer_number ⇒ Object
Returns the value of attribute customer_number.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def customer_number @customer_number end |
#institution ⇒ Object
Returns the value of attribute institution.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def institution @institution end |
#operating_subsidiary ⇒ Object
Returns the value of attribute operating_subsidiary.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def end |
#payment_date ⇒ Object
Returns the value of attribute payment_date.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def payment_date @payment_date end |
#transaction_code ⇒ Object
Returns the value of attribute transaction_code.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def transaction_code @transaction_code end |
#transit ⇒ Object
Returns the value of attribute transit.
6 7 8 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 6 def transit @transit end |
Class Method Details
.blank_values ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 71 def self.blank_values ' ' * 3 + '0' * 10 + '0' * 6 + '0' * 9 + ' ' * 12 + '0' * 22 + '0' * 3 + ' ' * 15 + ' ' * 30 + ' ' * 30 + ' ' * 10 + ' ' * 19 + '0' * 9 + ' ' * 12 + ' ' * 15 + ' ' * 22 + ' ' * 2 + ' ' * 11 end |
Instance Method Details
#to_s ⇒ Object Also known as: output
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/canada_payment/eft/cpa005/debit/segment.rb', line 48 def to_s formatted_transaction_code + formatted_amount + padded_date(@payment_date, 6) + zero_padded(@institution, 4) + zero_padded(@transit, 5) + space_padded(@account_number, 12) + "0" * 22 + "0" * 3 + space_padded(@client_short_name, 15) + space_padded(@customer_name, 30) + space_padded(@client_long_name, 30) + client_number_with_subsidiary + space_padded(@customer_number, 19) + "0" * 9 + " " * 12 + space_padded(@client_sundry_info, 15) + " " * 22 + " " * 2 + " " * 11 end |