tufy 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/tufy/build_account_segment.rb +30 -56
  4. data/lib/tufy/build_address_segment.rb +7 -10
  5. data/lib/tufy/build_contact_number_segment.rb +6 -7
  6. data/lib/tufy/build_email_address_segment.rb +3 -4
  7. data/lib/tufy/build_field.rb +18 -0
  8. data/lib/tufy/build_header_segment.rb +1 -1
  9. data/lib/tufy/build_id_segment.rb +6 -7
  10. data/lib/tufy/build_name_segment.rb +10 -19
  11. data/lib/tufy/build_segment.rb +1 -11
  12. data/lib/tufy/fields/account/build_account_number_field.rb +26 -0
  13. data/lib/tufy/fields/account/build_account_status_field.rb +26 -0
  14. data/lib/tufy/fields/account/build_account_type_field.rb +25 -0
  15. data/lib/tufy/fields/account/build_cash_advance_balance_field.rb +26 -0
  16. data/lib/tufy/fields/account/build_closed_date_field.rb +26 -0
  17. data/lib/tufy/fields/account/build_consumer_or_commercial_field.rb +26 -0
  18. data/lib/tufy/fields/account/build_credit_limit_or_loan_amount_field.rb +26 -0
  19. data/lib/tufy/fields/account/build_currency_code_field.rb +25 -0
  20. data/lib/tufy/fields/account/build_expiry_date_field.rb +26 -0
  21. data/lib/tufy/fields/account/build_fresh_cash_advance_field.rb +26 -0
  22. data/lib/tufy/fields/account/build_installment_amount_field.rb +26 -0
  23. data/lib/tufy/fields/account/build_interest_and_fees_field.rb +26 -0
  24. data/lib/tufy/fields/account/build_legal_action_field.rb +26 -0
  25. data/lib/tufy/fields/account/build_number_of_days_past_due_field.rb +26 -0
  26. data/lib/tufy/fields/account/build_number_of_installments_field.rb +26 -0
  27. data/lib/tufy/fields/account/build_opened_date_field.rb +26 -0
  28. data/lib/tufy/fields/account/build_outstanding_balance_field.rb +26 -0
  29. data/lib/tufy/fields/account/build_partial_payment_field.rb +26 -0
  30. data/lib/tufy/fields/account/build_past_due_amount_field.rb +26 -0
  31. data/lib/tufy/fields/account/build_payment_amount_field.rb +26 -0
  32. data/lib/tufy/fields/account/build_payment_frequency_field.rb +26 -0
  33. data/lib/tufy/fields/account/build_reported_date_field.rb +26 -0
  34. data/lib/tufy/fields/account/build_restructured_account_number_field.rb +26 -0
  35. data/lib/tufy/fields/account/build_shared_by_field.rb +26 -0
  36. data/lib/tufy/fields/account/build_unbilled_balance_field.rb +26 -0
  37. data/lib/tufy/fields/account/build_user_id_field.rb +26 -0
  38. data/lib/tufy/fields/address/build_address_1_field.rb +26 -0
  39. data/lib/tufy/fields/address/build_address_2_field.rb +26 -0
  40. data/lib/tufy/fields/address/build_address_type_field.rb +26 -0
  41. data/lib/tufy/fields/contact_number/build_contact_number_field.rb +26 -0
  42. data/lib/tufy/fields/contact_number/build_contact_number_format_field.rb +26 -0
  43. data/lib/tufy/fields/email_address/build_email_address_field.rb +26 -0
  44. data/lib/tufy/fields/id/build_id_number_field.rb +26 -0
  45. data/lib/tufy/fields/id/build_id_type_field.rb +26 -0
  46. data/lib/tufy/fields/name/build_ac_holder_type_field.rb +26 -0
  47. data/lib/tufy/fields/name/build_civil_status_field.rb +26 -0
  48. data/lib/tufy/fields/name/build_date_of_birth_field.rb +26 -0
  49. data/lib/tufy/fields/name/build_first_name_field.rb +26 -0
  50. data/lib/tufy/fields/name/build_gender_field.rb +26 -0
  51. data/lib/tufy/fields/name/build_last_name_field.rb +26 -0
  52. data/lib/tufy/version.rb +1 -1
  53. data/lib/tufy.rb +41 -2
  54. metadata +43 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70647cdbae7d81d058c2ff8b915ca8ab4ead7080
4
- data.tar.gz: 4efb1cd799d6c62e3e32fe3e09fe9c01546a0ee1
3
+ metadata.gz: 85277ebf80f7eb975685b79ec9d93f7fbac84f6f
4
+ data.tar.gz: b0b8adb6a122515fd16db831090f9a5aed3ece16
5
5
  SHA512:
6
- metadata.gz: 34cf815ab6b5f162dbce26d3fdc4832df81dc2cc31eb5da0b6a265f712095cfb1fae8d64f4cf2b85d19be4056163416a5aeb05e592fea843b178ca067f919390
7
- data.tar.gz: 36b3c627366498c20c1c91ab7e2cc5d32718ce810c6769d2a397c5f34e09b28a86691d64bfc1a8be66cc6faf4526f64542081b391f22d9bf46f2ccef8a1fe38b
6
+ metadata.gz: 1cacdad2cfbbf9d655aa1d5a989da9141ec41553aea754d6f187460b0205c326571a5d38fc26e5121de6df23d91d38a08369123fa81d6b41a69ead1d800d5b56
7
+ data.tar.gz: 0a9d08fec6f99172ac2c7bad7697a7241caad8b9e3bd18b4e0a44b62949b2f2446b11e253908d639a814f52e2f3411ed57bc1ba38fe25cc8e6efa32b0f4ef755
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.0.7
2
+
3
+ - Refactor each BuildSegment actions to be LightService::Organizers
4
+
1
5
  # v0.0.6
2
6
 
3
7
  - Added Tufy.transform_raw_data_array and refactor Tufy.transform
@@ -7,8 +7,7 @@ module Tufy
7
7
  :account_number,
8
8
  :restructured_account_number,
9
9
  :user_id,
10
- :account_status,
11
- :account_type,
10
+ :account_status, :account_type,
12
11
  :currency_code,
13
12
  :opened_date,
14
13
  :payment_amount,
@@ -50,61 +49,36 @@ module Tufy
50
49
  private
51
50
 
52
51
  def self.transform(ctx)
53
- raw_data = ctx[:raw_data]
52
+ result = with(ctx).reduce(
53
+ Fields::Account::BuildAccountNumberField,
54
+ Fields::Account::BuildRestructuredAccountNumberField,
55
+ Fields::Account::BuildUserIdField,
56
+ Fields::Account::BuildAccountStatusField,
57
+ Fields::Account::BuildAccountTypeField,
58
+ Fields::Account::BuildCurrencyCodeField,
59
+ Fields::Account::BuildOpenedDateField,
60
+ Fields::Account::BuildPaymentAmountField,
61
+ Fields::Account::BuildClosedDateField,
62
+ Fields::Account::BuildReportedDateField,
63
+ Fields::Account::BuildCreditLimitOrLoanAmountField,
64
+ Fields::Account::BuildSharedByField,
65
+ Fields::Account::BuildOutstandingBalanceField,
66
+ Fields::Account::BuildInterestAndFeesField,
67
+ Fields::Account::BuildUnbilledBalanceField,
68
+ Fields::Account::BuildCashAdvanceBalanceField,
69
+ Fields::Account::BuildNumberOfDaysPastDueField,
70
+ Fields::Account::BuildPastDueAmountField,
71
+ Fields::Account::BuildInstallmentAmountField,
72
+ Fields::Account::BuildNumberOfInstallmentsField,
73
+ Fields::Account::BuildPaymentFrequencyField,
74
+ Fields::Account::BuildExpiryDateField,
75
+ Fields::Account::BuildConsumerOrCommercialField,
76
+ Fields::Account::BuildLegalActionField,
77
+ Fields::Account::BuildPartialPaymentField,
78
+ Fields::Account::BuildFreshCashAdvanceField,
79
+ )
54
80
 
55
- Constants::SEGMENT_TAG +
56
- Constants::ACCOUNT_NUMBER_TAG +
57
- FormatStrings::F2TS % raw_data[:account_number].to_s.size + raw_data[:account_number].to_s +
58
- Constants::RESTRUCTURED_ACCOUNT_NUMBER_TAG +
59
- FormatStrings::F2TS % raw_data[:restructured_account_number].to_s.size + raw_data[:restructured_account_number].to_s +
60
- Constants::USER_ID_TAG +
61
- FormatStrings::F2TS % raw_data[:user_id].size + raw_data[:user_id] +
62
- Constants::ACCOUNT_STATUS_TAG +
63
- FormatStrings::F2TS % raw_data[:account_status].size + raw_data[:account_status] +
64
- Constants::ACCOUNT_TYPE_TAG +
65
- FormatStrings::F2TS % raw_data[:account_type].size + raw_data[:account_type] +
66
- Constants::CURRENCY_CODE_TAG +
67
- FormatStrings::F2TS % raw_data[:currency_code].size + raw_data[:currency_code] +
68
- Constants::OPENED_DATE_TAG +
69
- FormatStrings::F2TS % transform_date(raw_data[:opened_date]).size + transform_date(raw_data[:opened_date]) +
70
- Constants::PAYMENT_AMOUNT_TAG +
71
- FormatStrings::F2TS % raw_data[:payment_amount].to_i.to_s.size + raw_data[:payment_amount].to_i.to_s +
72
- Constants::CLOSED_DATE_TAG +
73
- FormatStrings::F2TS % transform_date(raw_data[:closed_date]).size + transform_date(raw_data[:closed_date]) +
74
- Constants::REPORTED_DATE_TAG +
75
- FormatStrings::F2TS % transform_date(DateTime.now).size + transform_date(DateTime.now) +
76
- Constants::CREDIT_LIMIT_OR_LOAN_AMOUNT_TAG +
77
- FormatStrings::F2TS % raw_data[:credit_limit_or_loan_amount].to_i.to_s.size + raw_data[:credit_limit_or_loan_amount].to_i.to_s +
78
- Constants::SHARED_BY_TAG +
79
- FormatStrings::F2TS % raw_data[:shared_by].size + raw_data[:shared_by] +
80
- Constants::OUTSTANDING_BALANCE_TAG +
81
- FormatStrings::F2TS % raw_data[:outstanding_balance].to_i.to_s.size + raw_data[:outstanding_balance].to_i.to_s +
82
- Constants::INTEREST_AND_FEES_TAG +
83
- FormatStrings::F2TS % raw_data[:interest_and_fees].to_i.to_s.size + raw_data[:interest_and_fees].to_i.to_s +
84
- Constants::UNBILLED_BALANCE_TAG +
85
- FormatStrings::F2TS % raw_data[:unbilled_balance].to_i.to_s.size + raw_data[:unbilled_balance].to_i.to_s +
86
- Constants::CASH_ADVANCE_BALANCE_TAG +
87
- FormatStrings::F2TS % raw_data[:cash_advance_balance].to_i.to_s.size + raw_data[:cash_advance_balance].to_i.to_s +
88
- Constants::NUMBER_OF_DAYS_PAST_DUE_TAG +
89
- FormatStrings::F2TS % (FormatStrings::F3TS % raw_data[:number_of_days_past_due]).size + FormatStrings::F3TS % raw_data[:number_of_days_past_due] +
90
- Constants::PAST_DUE_AMOUNT_TAG +
91
- FormatStrings::F2TS % raw_data[:past_due_amount].to_i.to_s.size + raw_data[:past_due_amount].to_i.to_s +
92
- Constants::INSTALLMENT_AMOUNT_TAG +
93
- FormatStrings::F2TS % raw_data[:installment_amount].to_i.to_s.size + raw_data[:installment_amount].to_i.to_s +
94
- Constants::NUMBER_OF_INSTALLMENTS_TAG +
95
- FormatStrings::F2TS % raw_data[:number_of_installments].to_i.to_s.size + raw_data[:number_of_installments].to_i.to_s +
96
- Constants::PAYMENT_FREQUENCY_TAG +
97
- FormatStrings::F2TS % raw_data[:payment_frequency].size + raw_data[:payment_frequency] +
98
- Constants::EXPIRY_DATE_TAG +
99
- FormatStrings::F2TS % transform_date(raw_data[:expiry_date]).size + transform_date(raw_data[:expiry_date]) +
100
- Constants::CONSUMER_OR_COMMERCIAL_TAG +
101
- FormatStrings::F2TS % raw_data[:consumer_or_commercial].size + raw_data[:consumer_or_commercial] +
102
- Constants::LEGAL_ACTION_TAG +
103
- FormatStrings::F2TS % raw_data[:legal_action].size + raw_data[:legal_action] +
104
- Constants::PARTIAL_PAYMENT_TAG +
105
- FormatStrings::F2TS % raw_data[:partial_payment].size + raw_data[:partial_payment] +
106
- Constants::FRESH_CASH_ADVANCE_TAG +
107
- FormatStrings::F2TS % raw_data[:fresh_cash_advance].size + raw_data[:fresh_cash_advance]
81
+ Constants::SEGMENT_TAG + result[:transformed_data]
108
82
  end
109
83
 
110
84
  module Constants
@@ -19,16 +19,13 @@ module Tufy
19
19
  def self.transform(ctx)
20
20
  raw_data = ctx[:raw_data]
21
21
 
22
- Constants::SEGMENT_TAG + # Segment Tag (Required)
23
- Constants::ADDRESS_LINE_1_TAG +
24
- FormatStrings::F2TS % remove_special_characters(raw_data[:address_line_1]).size +
25
- remove_special_characters(raw_data[:address_line_1]) + # Address Line 1 (Required)
26
- Constants::ADDRESS_LINE_2_TAG +
27
- FormatStrings::F2TS % remove_special_characters(raw_data[:address_line_2]).size +
28
- remove_special_characters(raw_data[:address_line_2]) + # Address Line 2 (Required)
29
- Constants::ADDRESS_TYPE_TAG +
30
- FormatStrings::F2TS % raw_data[:address_type].size +
31
- raw_data[:address_type] # Address Type (Required)
22
+ result = with(ctx).reduce(
23
+ Fields::Address::BuildAddress1Field,
24
+ Fields::Address::BuildAddress2Field,
25
+ Fields::Address::BuildAddressTypeField,
26
+ )
27
+
28
+ Constants::SEGMENT_TAG + result[:transformed_data]
32
29
  end
33
30
 
34
31
  module Constants
@@ -18,13 +18,12 @@ module Tufy
18
18
  def self.transform(ctx)
19
19
  raw_data = ctx[:raw_data]
20
20
 
21
- Constants::SEGMENT_TAG + # Segment Tag (Required)
22
- Constants::CONTACT_NUMBER_TAG +
23
- FormatStrings::F2TS % remove_special_characters(raw_data[:contact_number]).size +
24
- remove_special_characters(raw_data[:contact_number]) + # Contact Number (Required)
25
- Constants::CONTACT_NUMBER_FORMAT_TAG +
26
- FormatStrings::F2TS % raw_data[:contact_number_format].size +
27
- raw_data[:contact_number_format] # Contact Number Format (Required)
21
+ result = with(ctx).reduce(
22
+ Fields::ContactNumber::BuildContactNumberField,
23
+ Fields::ContactNumber::BuildContactNumberFormatField,
24
+ )
25
+
26
+ Constants::SEGMENT_TAG + result[:transformed_data]
28
27
  end
29
28
 
30
29
  module Constants
@@ -17,10 +17,9 @@ module Tufy
17
17
  def self.transform(ctx)
18
18
  raw_data = ctx[:raw_data]
19
19
 
20
- Constants::SEGMENT_TAG + # Segment Tag (Required)
21
- Constants::EMAIL_ADDRESS_TAG +
22
- FormatStrings::F2TS % raw_data[:email_address].size +
23
- raw_data[:email_address] # Email Address (Required)
20
+ result = Fields::EmailAddress::BuildEmailAddressField.execute(ctx)
21
+
22
+ Constants::SEGMENT_TAG + result[:transformed_data]
24
23
  end
25
24
 
26
25
  module Constants
@@ -0,0 +1,18 @@
1
+ module Tufy
2
+ class BuildField
3
+ include LightService::Action
4
+
5
+ protected
6
+
7
+ def self.transform_date(date)
8
+ # TODO: Remove conditional
9
+ # after data-integrity issues
10
+ # have been resolved
11
+ date ? date.strftime("%d%m%Y") : "00000000"
12
+ end
13
+
14
+ def self.remove_special_characters(string)
15
+ string.gsub(/[^0-9A-Za-z]/, '')
16
+ end
17
+ end
18
+ end
@@ -21,7 +21,7 @@ module Tufy
21
21
  "#{FormatStrings::F25TS % Time.now.to_i.to_s}" + # Member Reference Number (Required)
22
22
  "#{FormatStrings::F26TS % ctx.header_data[:processor_name].upcase}" + # Member Processor Name (Required)
23
23
  "#{FormatStrings::F10TS % ctx.header_data[:user_id].upcase}" + # User ID (Required)
24
- "#{transform_date(Date.today)}" + # Reported Date (Required)
24
+ "#{BuildField.transform_date(Date.today)}" + # Reported Date (Required)
25
25
  Constants::FILLER # Filler (Required)
26
26
  end
27
27
 
@@ -24,13 +24,12 @@ module Tufy
24
24
  def self.transform(ctx)
25
25
  raw_data = ctx[:raw_data]
26
26
 
27
- Constants::SEGMENT_TAG + # Segment Tag (Required)
28
- Constants::ID_NUMBER_TAG +
29
- FormatStrings::F2TS % remove_special_characters(raw_data[:id_number]).size +
30
- remove_special_characters(raw_data[:id_number]) + # ID Number (Required)
31
- Constants::ID_TYPE_TAG +
32
- FormatStrings::F2TS % raw_data[:id_type].size +
33
- raw_data[:id_type] # ID Type (Required)
27
+ result = with(ctx).reduce(
28
+ Fields::Id::BuildIdNumberField,
29
+ Fields::Id::BuildIdTypeField,
30
+ )
31
+
32
+ Constants::SEGMENT_TAG + result[:transformed_data]
34
33
  end
35
34
 
36
35
  def self.id_type_exists?(id_type)
@@ -22,25 +22,16 @@ module Tufy
22
22
  def self.transform(ctx)
23
23
  raw_data = ctx[:raw_data]
24
24
 
25
- Constants::SEGMENT_TAG + # Segment Tag (Required)
26
- Constants::FIRST_NAME_TAG +
27
- FormatStrings::F2TS % raw_data[:first_name].size +
28
- raw_data[:first_name] + # First Name (Required)
29
- Constants::LAST_NAME_TAG +
30
- FormatStrings::F2TS % raw_data[:last_name].size +
31
- raw_data[:last_name] + # Last Name (Required)
32
- Constants::CIVIL_STATUS_TAG +
33
- FormatStrings::F2TS % raw_data[:civil_status].size +
34
- raw_data[:civil_status] + # Civil Status (Required)
35
- Constants::DATE_OF_BIRTH_TAG +
36
- FormatStrings::F2TS % transform_date(raw_data[:date_of_birth]).size +
37
- transform_date(raw_data[:date_of_birth]) + # Date of Birth (Required)
38
- Constants::GENDER_TAG +
39
- FormatStrings::F2TS % raw_data[:gender].size +
40
- raw_data[:gender] + # Gender (Required)
41
- Constants::AC_HOLDER_TYPE_TAG +
42
- FormatStrings::F2TS % raw_data[:ac_holder_type].size +
43
- raw_data[:ac_holder_type] # A/C Holder Type
25
+ result = with(ctx).reduce(
26
+ Fields::Name::BuildFirstNameField,
27
+ Fields::Name::BuildLastNameField,
28
+ Fields::Name::BuildCivilStatusField,
29
+ Fields::Name::BuildDateOfBirthField,
30
+ Fields::Name::BuildGenderField,
31
+ Fields::Name::BuildAcHolderTypeField,
32
+ )
33
+
34
+ Constants::SEGMENT_TAG + result[:transformed_data]
44
35
  end
45
36
 
46
37
  module Constants
@@ -1,6 +1,7 @@
1
1
  module Tufy
2
2
  class BuildSegment
3
3
  include LightService::Action
4
+ include LightService::Organizer
4
5
 
5
6
  protected
6
7
 
@@ -9,16 +10,5 @@ module Tufy
9
10
  raise Tufy::Errors::RequiredDataMissing, required_key.to_s unless raw_data.key? required_key
10
11
  end
11
12
  end
12
-
13
- def self.transform_date(date)
14
- # TODO: Remove conditional
15
- # after data-integrity issues
16
- # have been resolved
17
- date ? date.strftime("%d%m%Y") : "00000000"
18
- end
19
-
20
- def self.remove_special_characters(string)
21
- string.gsub(/[^0-9A-Za-z]/, '')
22
- end
23
13
  end
24
14
  end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildAccountNumberField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::ACCOUNT_NUMBER_TAG +
20
+ FormatStrings::F2TS % raw_data[:account_number].to_s.size +
21
+ raw_data[:account_number].to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildAccountStatusField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::ACCOUNT_STATUS_TAG +
20
+ FormatStrings::F2TS % raw_data[:account_status].size +
21
+ raw_data[:account_status]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildAccountTypeField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::ACCOUNT_TYPE_TAG +
20
+ FormatStrings::F2TS % raw_data[:account_type].size + raw_data[:account_type]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildCashAdvanceBalanceField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::CASH_ADVANCE_BALANCE_TAG +
20
+ FormatStrings::F2TS % raw_data[:cash_advance_balance].to_i.to_s.size +
21
+ raw_data[:cash_advance_balance].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildClosedDateField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::CLOSED_DATE_TAG +
20
+ FormatStrings::F2TS % transform_date(raw_data[:closed_date]).size +
21
+ transform_date(raw_data[:closed_date])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildConsumerOrCommercialField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::CONSUMER_OR_COMMERCIAL_TAG +
20
+ FormatStrings::F2TS % raw_data[:consumer_or_commercial].size +
21
+ raw_data[:consumer_or_commercial]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildCreditLimitOrLoanAmountField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::CREDIT_LIMIT_OR_LOAN_AMOUNT_TAG +
20
+ FormatStrings::F2TS % raw_data[:credit_limit_or_loan_amount].to_i.to_s.size +
21
+ raw_data[:credit_limit_or_loan_amount].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildCurrencyCodeField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::CURRENCY_CODE_TAG +
20
+ FormatStrings::F2TS % raw_data[:currency_code].size + raw_data[:currency_code]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildExpiryDateField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::EXPIRY_DATE_TAG +
20
+ FormatStrings::F2TS % transform_date(raw_data[:expiry_date]).size +
21
+ transform_date(raw_data[:expiry_date])
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildFreshCashAdvanceField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::FRESH_CASH_ADVANCE_TAG +
20
+ FormatStrings::F2TS % raw_data[:fresh_cash_advance].size +
21
+ raw_data[:fresh_cash_advance]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildInstallmentAmountField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::INSTALLMENT_AMOUNT_TAG +
20
+ FormatStrings::F2TS % raw_data[:installment_amount].to_i.to_s.size +
21
+ raw_data[:installment_amount].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildInterestAndFeesField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::INTEREST_AND_FEES_TAG +
20
+ FormatStrings::F2TS % raw_data[:interest_and_fees].to_i.to_s.size +
21
+ raw_data[:interest_and_fees].to_i.to_s
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module Tufy
2
+ module Fields
3
+ module Account
4
+ class BuildLegalActionField < BuildField
5
+ expects :raw_data
6
+ promises :transformed_data
7
+
8
+ executed do |ctx|
9
+ ctx.transformed_data =
10
+ ctx.transformed_data +
11
+ transform(ctx).upcase
12
+ end
13
+
14
+ private
15
+
16
+ def self.transform(ctx)
17
+ raw_data = ctx.raw_data
18
+
19
+ BuildAccountSegment::Constants::LEGAL_ACTION_TAG +
20
+ FormatStrings::F2TS % raw_data[:legal_action].size +
21
+ raw_data[:legal_action]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end