genesis_ruby 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +169 -1
  4. data/VERSION +1 -1
  5. data/lib/genesis_ruby/api/constants/non_financial/alternatives/alipay/merchant_types.rb +26 -0
  6. data/lib/genesis_ruby/api/constants/non_financial/alternatives/alipay/site_types.rb +26 -0
  7. data/lib/genesis_ruby/api/constants/non_financial/kyc/bank_account_types.rb +24 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/foreign_retailer_indicators.rb +24 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/funding/person_types.rb +26 -0
  10. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/purpose_of_payments.rb +46 -19
  11. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/sender_account_number_types.rb +14 -17
  12. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/source_of_funds.rb +9 -18
  13. data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/types.rb +31 -4
  14. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/enhanced_statement_response_fields.rb +39 -0
  15. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields.rb +2 -0
  16. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_order_by_fields.rb +31 -0
  17. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_response_fields.rb +14 -13
  18. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/{processing_type.rb → scopes.rb} +4 -3
  19. data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment.rb +117 -0
  20. data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment_values.rb +267 -0
  21. data/lib/genesis_ruby/api/constants/transactions/parameters/wallets/e_wallet/payment_types.rb +46 -0
  22. data/lib/genesis_ruby/api/constants/transactions.rb +9 -0
  23. data/lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb +3 -1
  24. data/lib/genesis_ruby/api/mixins/requests/financial/cards/credential_on_file_transaction_link_attributes.rb +83 -0
  25. data/lib/genesis_ruby/api/mixins/requests/financial/commercial_card_attributes.rb +143 -0
  26. data/lib/genesis_ruby/api/mixins/requests/financial/funding_attributes.rb +32 -3
  27. data/lib/genesis_ruby/api/mixins/requests/financial/marketplace_data_attributes.rb +179 -0
  28. data/lib/genesis_ruby/api/mixins/requests/financial/money_transfer_payout_attributes.rb +49 -46
  29. data/lib/genesis_ruby/api/mixins/requests/financial/order_attributes.rb +36 -0
  30. data/lib/genesis_ruby/api/mixins/requests/financial/purpose_of_payment_attributes.rb +14 -4
  31. data/lib/genesis_ruby/api/mixins/requests/financial/refund/bank_attributes.rb +41 -0
  32. data/lib/genesis_ruby/api/mixins/requests/financial/refund/beneficiary_attributes.rb +31 -0
  33. data/lib/genesis_ruby/api/mixins/requests/financial/refund/travel_ticket_attributes.rb +52 -0
  34. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/force_threeds_attributes.rb +29 -0
  35. data/lib/genesis_ruby/api/mixins/requests/non_financial/alternatives/alipay/site_information_attributes.rb +57 -0
  36. data/lib/genesis_ruby/api/mixins/requests/non_financial/date_time_from_to_attributes.rb +102 -0
  37. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/background_checks_attributes.rb +31 -10
  38. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/verification_document_attributes.rb +49 -7
  39. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/verification_instructions_attributes.rb +90 -0
  40. data/lib/genesis_ruby/api/mixins/requests/non_financial/reconcile_order_attributes.rb +30 -0
  41. data/lib/genesis_ruby/api/mixins/requests/non_financial/scope_attributes.rb +29 -0
  42. data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +12 -0
  43. data/lib/genesis_ruby/api/mixins/requests/scheme_tokenized_attributes.rb +35 -0
  44. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +1 -12
  45. data/lib/genesis_ruby/api/requests/base/graphql.rb +7 -0
  46. data/lib/genesis_ruby/api/requests/base/non_financial/billing_api/abstract_statement.rb +226 -0
  47. data/lib/genesis_ruby/api/requests/base/non_financial/billing_api/base.rb +39 -37
  48. data/lib/genesis_ruby/api/requests/base/non_financial/reconcile/base.rb +45 -0
  49. data/lib/genesis_ruby/api/requests/financial/async_refund.rb +41 -0
  50. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +43 -24
  51. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +13 -1
  52. data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +21 -5
  53. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +42 -23
  54. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +13 -1
  55. data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +5 -1
  56. data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +6 -2
  57. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/my_bank.rb +1 -1
  58. data/lib/genesis_ruby/api/requests/financial/refund.rb +20 -35
  59. data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +6 -1
  60. data/lib/genesis_ruby/api/requests/financial/wallets/e_wallet.rb +72 -0
  61. data/lib/genesis_ruby/api/requests/non_financial/alternatives/alipay/register_merchant.rb +147 -0
  62. data/lib/genesis_ruby/api/requests/non_financial/billing_api/enhanced_statement.rb +46 -0
  63. data/lib/genesis_ruby/api/requests/non_financial/billing_api/statement.rb +12 -137
  64. data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +4 -2
  65. data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/date_range.rb +10 -19
  66. data/lib/genesis_ruby/api/requests/non_financial/fraud/rdr/date_range.rb +91 -0
  67. data/lib/genesis_ruby/api/requests/non_financial/fraud/rdr/transaction.rb +54 -0
  68. data/lib/genesis_ruby/api/requests/non_financial/fraud/retrieval/date_range.rb +10 -19
  69. data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/bank_account.rb +76 -0
  70. data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/create.rb +31 -4
  71. data/lib/genesis_ruby/api/requests/non_financial/payment_authorizations/date_range.rb +124 -0
  72. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb +8 -15
  73. data/lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb +12 -18
  74. data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +29 -4
  75. data/lib/genesis_ruby/api/requests/non_financial/reconcile/order.rb +40 -0
  76. data/lib/genesis_ruby/api/requests/non_financial/reconcile/transaction.rb +1 -15
  77. data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +3 -1
  78. data/lib/genesis_ruby/api/requests/non_financial/tokenization/tokenize.rb +3 -1
  79. data/lib/genesis_ruby/api/requests/wpf/create.rb +4 -0
  80. data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +11 -4
  81. data/lib/genesis_ruby/api/requests/wpf/reconcile_by_date.rb +62 -0
  82. data/lib/genesis_ruby/api/requests/wpf/reconcile_by_order.rb +38 -0
  83. data/lib/genesis_ruby/builders/graphql.rb +95 -40
  84. data/lib/genesis_ruby/dependencies.rb +2 -0
  85. data/lib/genesis_ruby/utils/money/format.rb +2 -1
  86. data/lib/genesis_ruby/utils/transactions/financial_types.rb +3 -2
  87. data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +2 -1
  88. data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
  89. data/lib/genesis_ruby/version.rb +1 -1
  90. metadata +40 -35
  91. data/.kiro/specs/f2025112509-add_managed_recurring_api/.config.kiro +0 -1
  92. data/.kiro/specs/f2025112509-add_managed_recurring_api/design.md +0 -332
  93. data/.kiro/specs/f2025112509-add_managed_recurring_api/requirements.md +0 -91
  94. data/.kiro/specs/f2025112509-add_managed_recurring_api/tasks.md +0 -139
  95. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/.config.kiro +0 -1
  96. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/design.md +0 -148
  97. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/requirements.md +0 -81
  98. data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/tasks.md +0 -48
  99. data/.kiro/specs/f2025112606-add_list_payees_trx_request/.config.kiro +0 -1
  100. data/.kiro/specs/f2025112606-add_list_payees_trx_request/design.md +0 -112
  101. data/.kiro/specs/f2025112606-add_list_payees_trx_request/requirements.md +0 -74
  102. data/.kiro/specs/f2025112606-add_list_payees_trx_request/tasks.md +0 -38
  103. data/.kiro/specs/f2025112609_update_payee_request_params/design.md +0 -86
  104. data/.kiro/specs/f2025112609_update_payee_request_params/requirements.md +0 -86
  105. data/.kiro/specs/f2025112609_update_payee_request_params/tasks.md +0 -40
  106. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/.config.kiro +0 -1
  107. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/design.md +0 -246
  108. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/requirements.md +0 -287
  109. data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/tasks.md +0 -76
  110. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/design.md +0 -84
  111. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/requirements.md +0 -88
  112. data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/tasks.md +0 -38
  113. data/.kiro/steering/product.md +0 -15
  114. data/.kiro/steering/spec-folder-naming.md +0 -16
  115. data/.kiro/steering/structure.md +0 -96
  116. data/.kiro/steering/tech.md +0 -66
  117. data/Gemfile +0 -6
  118. data/Gemfile.lock +0 -176
  119. data/Rakefile +0 -24
  120. data/genesis_ruby.gemspec +0 -47
  121. data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed.rb +0 -24
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
4
- require 'genesis_ruby/api/constants/date_time_formats'
5
- require 'genesis_ruby/api/constants/currencies/iso4217'
6
3
  require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_response_fields'
7
- require 'genesis_ruby/api/requests/base/non_financial/billing_api/base'
4
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_order_by_fields'
5
+ require 'genesis_ruby/api/requests/base/non_financial/billing_api/abstract_statement'
8
6
 
9
7
  module GenesisRuby
10
8
  module Api
@@ -12,27 +10,7 @@ module GenesisRuby
12
10
  module NonFinancial
13
11
  module BillingApi
14
12
  # Billing Statements API request
15
- class Statement < Base::NonFinancial::BillingApi::Base # rubocop:disable Metrics/ClassLength
16
-
17
- MAX_COUNT_BILLING_STATEMENT = 1_000
18
- MAX_DAYS_DIFFERENCE = 7
19
-
20
- # Allowed values for the +status+ filter
21
- STATUSES = %w(open pending paid bounced).freeze
22
-
23
- # Allowed values for the +sort_by_field+ parameter
24
- ORDER_BY_FIELDS = %w(billingStatement creationDate startDate endDate valueDate
25
- currency status masterAccountName).freeze
26
-
27
- attr_accessor :payment_method, :status
28
- attr_reader :currency
29
-
30
- # Cursor for the next page of results
31
- attr_writer :next
32
-
33
- def currency=(value)
34
- @currency = value.to_s.empty? ? nil : value.to_s.upcase
35
- end
13
+ class Statement < Base::NonFinancial::BillingApi::AbstractStatement
36
14
 
37
15
  def initialize(configuration, _builder_interface = nil)
38
16
  super configuration
@@ -42,124 +20,21 @@ module GenesisRuby
42
20
  self.request_path = 'billing_statements'
43
21
  end
44
22
 
45
- # List of requested response fields
46
- def response_fields
47
- @response_fields || []
48
- end
49
-
50
- # Sets response fields validated against StatementResponseFields
51
- def response_fields=(value)
52
- parse_array_of_strings attribute: __method__,
53
- value: value,
54
- allowed: Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::
55
- StatementResponseFields.all
56
- end
57
-
58
- # Returns the creation date formatted as YYYY-MM-DD
59
- def creation_date
60
- @creation_date&.strftime(Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601)
61
- end
62
-
63
- # Sets the creation date filter
64
- def creation_date=(value)
65
- parse_date attribute: __method__, value: value, allow_empty: true
66
- end
67
-
68
23
  protected
69
24
 
70
- # Adds response_fields to the list of required fields
71
- def init_field_validations
72
- super
73
-
74
- required_fields.push :response_fields
75
- field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase),
76
- status: STATUSES,
77
- sort_by_field: ORDER_BY_FIELDS
25
+ # GraphQL query name
26
+ def request_name
27
+ 'billingStatements'
78
28
  end
79
29
 
80
- # Validates all request requirements including filters and date ranges
81
- def check_requirements
82
- super
83
-
84
- validate_filters
85
- validate_date_range(:start_date, :end_date, MAX_DAYS_DIFFERENCE) if @start_date || @end_date
86
- if @start_date_from || @start_date_to
87
- validate_date_range(:start_date_from, :start_date_to, MAX_DAYS_DIFFERENCE)
88
- end
89
- validate_date_range(:end_date_from, :end_date_to, MAX_DAYS_DIFFERENCE) if @end_date_from || @end_date_to
90
- validate_array_size :billing_statement, MAX_COUNT_BILLING_STATEMENT
91
- end
92
-
93
- # Builds the GraphQL query filters hash
94
- def query_filters # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
95
- filters = {
96
- startDate: escape_argument(:start_date),
97
- endDate: escape_argument(:end_date),
98
- startDateFrom: escape_argument(:start_date_from),
99
- startDateTo: escape_argument(:start_date_to),
100
- endDateFrom: escape_argument(:end_date_from),
101
- endDateTo: escape_argument(:end_date_to),
102
- billingStatement: billing_statement.empty? ? nil : billing_statement,
103
- currency: escape_string(currency),
104
- status: status,
105
- paymentMethod: escape_string(payment_method),
106
- creationDate: escape_string(creation_date)
107
- }
108
-
109
- { filter: filters, **paging_and_sort }
110
- end
111
-
112
- # Builds the GraphQL response fields structure including paging metadata
113
- def query_response_fields
114
- {
115
- items: format_response_fields,
116
- paging: %w(count perPage after before)
117
- }
118
- end
119
-
120
- # Merges sort and cursor-based paging into a single hash, omitting empty values
121
- def paging_and_sort
122
- result = {}
123
- result[:sort] = { byDirection: sort_by_direction, byField: sort_by_field }.compact
124
- result[:paging] = cursor_paging
125
- result.reject { |_, v| v.empty? }
30
+ # Allowed top-level response fields for billingStatements
31
+ def allowed_response_fields
32
+ Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::StatementResponseFields
126
33
  end
127
34
 
128
- # Builds the cursor-based paging hash
129
- def cursor_paging
130
- paging = {}
131
- paging[:perPage] = per_page if per_page
132
- paging[:next] = "\"#{@next}\"" if @next
133
- paging
134
- end
135
-
136
- # Maps response field names to their expanded GraphQL representations
137
- def format_response_fields
138
- response_fields.map { |field| complex_field(field) }
139
- end
140
-
141
- # Expands summary and details fields into their full GraphQL sub-selections
142
- def complex_field(field)
143
- case field
144
- when 'summary'
145
- 'summary { grossVolume debit credit fees taxes netReserves adjustments ' \
146
- 'netSettlementAmount paymentFxConversionFee paymentAmount paymentCurrency }'
147
- when 'details'
148
- 'details { transactionTypesBreakdown { category transactionType count amount } }'
149
- else
150
- field
151
- end
152
- end
153
-
154
- # Raises an error when no filter attributes are set
155
- def validate_filters # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
156
- return unless start_date.nil? && end_date.nil? &&
157
- start_date_from.nil? && start_date_to.nil? &&
158
- end_date_from.nil? && end_date_to.nil? &&
159
- billing_statement.empty? && currency.nil? &&
160
- status.nil? && payment_method.nil? && creation_date.nil?
161
-
162
- raise ParameterError, 'At least one filter is required!'
35
+ # Allowed order-by fields for billingStatements
36
+ def allowed_order_by_fields
37
+ Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::StatementOrderByFields
163
38
  end
164
39
 
165
40
  end
@@ -15,6 +15,8 @@ module GenesisRuby
15
15
  # using given filters, pagination, and sort parameters.
16
16
  class Transactions < Base::NonFinancial::BillingApi::Base # rubocop:disable Metrics/ClassLength
17
17
 
18
+ include Api::Mixins::Requests::NonFinancial::DateAttributes
19
+
18
20
  MAX_UNIQUE_ID_COUNT = 1_000
19
21
  MAX_BILLING_STATEMENT_COUNT = 10
20
22
  MAX_MERCHANT_TRANSACTION_COUNT = 1_000
@@ -113,8 +115,8 @@ module GenesisRuby
113
115
  def query_filters # rubocop:disable Metrics/MethodLength
114
116
  {
115
117
  filter: {
116
- startDate: escape_argument(:start_date),
117
- endDate: escape_argument(:end_date),
118
+ startDate: start_date,
119
+ endDate: end_date,
118
120
  uniqueId: unique_id,
119
121
  billingStatement: billing_statement,
120
122
  merchantTransactionId: merchant_transaction_id,
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
4
- require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/scopes'
5
4
 
6
5
  module GenesisRuby
7
6
  module Api
@@ -15,8 +14,7 @@ module GenesisRuby
15
14
 
16
15
  include Api::Mixins::Requests::NonFinancial::DateAttributes
17
16
  include Api::Mixins::Requests::NonFinancial::PagingAttributes
18
-
19
- attr_accessor :externally_processed, :processing_type
17
+ include Api::Mixins::Requests::NonFinancial::ScopeAttributes
20
18
 
21
19
  # Start of the requested date range
22
20
  def start_date
@@ -51,26 +49,19 @@ module GenesisRuby
51
49
  def init_field_validations
52
50
  super
53
51
 
54
- constant_values = {
55
- externally_processed: Constants::Transactions::Parameters::NonFinancial::ExternallyProcessed.all,
56
- processing_type: Constants::Transactions::Parameters::NonFinancial::ProcessingType.all
57
- }
58
-
59
- required_fields.push *%i[start_date]
60
- field_values.merge! constant_values
52
+ required_fields.push *%i[start_date scope]
61
53
  end
62
54
 
63
55
  # API Request structure
64
- def populate_structure # rubocop:disable Metrics/MethodLength
56
+ def populate_structure
65
57
  @tree_structure = {
66
58
  chargeback_request: {
67
- start_date: start_date,
68
- end_date: end_date,
69
- import_date: import_date,
70
- page: page,
71
- per_page: per_page,
72
- externally_processed: externally_processed,
73
- processing_type: processing_type
59
+ start_date: start_date,
60
+ end_date: end_date,
61
+ import_date: import_date,
62
+ page: page,
63
+ per_page: per_page,
64
+ scope: scope
74
65
  }
75
66
  }
76
67
  end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/scopes'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Requests
8
+ module NonFinancial
9
+ module Fraud
10
+ module Rdr
11
+ # Date range based Rapid Dispute Resolution retrieval allows you to fetch information for all
12
+ # rapid dispute resolutions for a given merchant within a given date range.
13
+ #
14
+ # Uses the current scope parameter contract. The deprecated processing_type / externally_processed
15
+ # filters are intentionally not supported and never emitted.
16
+ class DateRange < Api::Request
17
+
18
+ include Api::Mixins::Requests::NonFinancial::DateAttributes
19
+ include Api::Mixins::Requests::NonFinancial::PagingAttributes
20
+ include Api::Mixins::Requests::NonFinancial::ScopeAttributes
21
+
22
+ # Start of the requested date range
23
+ def start_date
24
+ @start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
25
+ end
26
+
27
+ # End of the requested date range
28
+ def end_date
29
+ @end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
30
+ end
31
+
32
+ # Date of import in the system
33
+ def import_date
34
+ @import_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
35
+ end
36
+
37
+ # Date of import in the system
38
+ def import_date=(value)
39
+ parse_date attribute: __method__, value: value, allow_empty: true
40
+ end
41
+
42
+ protected
43
+
44
+ # Set Gateway API configuration
45
+ def init_configuration
46
+ init_xml_configuration
47
+ init_api_gateway_configuration request_path: 'rapid_dispute_resolutions/by_date', include_token: false
48
+ @api_config.parser_skip_root_node = false
49
+ end
50
+
51
+ # Field Validations
52
+ def init_field_validations
53
+ super
54
+
55
+ required_fields.push *%i[scope]
56
+ end
57
+
58
+ # Rapid Dispute Resolution custom field validations
59
+ def check_requirements
60
+ unless @start_date.nil? ^ @import_date.nil?
61
+ raise ParameterError, 'Either start_date or import_date field has to be set, not both.'
62
+ end
63
+
64
+ if @start_date && @end_date && @start_date > @end_date
65
+ raise ParameterError, 'start_date cannot be later than end_date.'
66
+ end
67
+
68
+ super
69
+ end
70
+
71
+ # API Request structure
72
+ def populate_structure
73
+ @tree_structure = {
74
+ rapid_dispute_resolution_request: {
75
+ start_date: start_date,
76
+ end_date: end_date,
77
+ import_date: import_date,
78
+ page: page,
79
+ per_page: per_page,
80
+ scope: scope
81
+ }
82
+ }
83
+ end
84
+
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Requests
6
+ module NonFinancial
7
+ module Fraud
8
+ module Rdr
9
+ # Retrieve a single Rapid Dispute Resolution or a list of them by ARN or by passing the
10
+ # unique ID of the original transaction
11
+ class Transaction < Api::Request
12
+
13
+ include Api::Mixins::Requests::NonFinancial::ModeAttributes
14
+
15
+ attr_accessor :arn, :original_transaction_unique_id
16
+
17
+ protected
18
+
19
+ # Set Gateway API configuration
20
+ def init_configuration
21
+ init_xml_configuration
22
+ init_api_gateway_configuration request_path: 'rapid_dispute_resolutions', include_token: false
23
+ end
24
+
25
+ # Rapid Dispute Resolution custom field validations
26
+ def check_requirements
27
+ unless arn.to_s.empty? ^ original_transaction_unique_id.to_s.empty?
28
+ raise(
29
+ ParameterError,
30
+ 'Either arn or original_transaction_unique_id field has to be set, not both.'
31
+ )
32
+ end
33
+
34
+ super
35
+ end
36
+
37
+ # API Request structure
38
+ def populate_structure
39
+ @tree_structure = {
40
+ rapid_dispute_resolution_request: {
41
+ arn: arn,
42
+ original_transaction_unique_id: original_transaction_unique_id,
43
+ mode: mode
44
+ }
45
+ }
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
4
- require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/scopes'
5
4
 
6
5
  module GenesisRuby
7
6
  module Api
@@ -15,8 +14,7 @@ module GenesisRuby
15
14
 
16
15
  include Api::Mixins::Requests::NonFinancial::DateAttributes
17
16
  include Api::Mixins::Requests::NonFinancial::PagingAttributes
18
-
19
- attr_accessor :externally_processed, :processing_type
17
+ include Api::Mixins::Requests::NonFinancial::ScopeAttributes
20
18
 
21
19
  # Start of the requested date range
22
20
  def start_date
@@ -50,26 +48,19 @@ module GenesisRuby
50
48
  def init_field_validations
51
49
  super
52
50
 
53
- constant_values = {
54
- externally_processed: Constants::Transactions::Parameters::NonFinancial::ExternallyProcessed.all,
55
- processing_type: Constants::Transactions::Parameters::NonFinancial::ProcessingType.all
56
- }
57
-
58
- required_fields.push *%i[start_date]
59
- field_values.merge! constant_values
51
+ required_fields.push *%i[start_date scope]
60
52
  end
61
53
 
62
54
  # API Request structure
63
- def populate_structure # rubocop:disable Metrics/MethodLength
55
+ def populate_structure
64
56
  @tree_structure = {
65
57
  retrieval_request_request: {
66
- start_date: start_date,
67
- end_date: end_date,
68
- import_date: import_date,
69
- page: page,
70
- per_page: per_page,
71
- externally_processed: externally_processed,
72
- processing_type: processing_type
58
+ start_date: start_date,
59
+ end_date: end_date,
60
+ import_date: import_date,
61
+ page: page,
62
+ per_page: per_page,
63
+ scope: scope
73
64
  }
74
65
  }
75
66
  end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'genesis_ruby/api/constants/non_financial/kyc/bank_account_types'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Requests
8
+ module NonFinancial
9
+ module Kyc
10
+ module Verifications
11
+ # Bank Account Verification checks that a bank account, identified by its account number and sort code,
12
+ # belongs to the named holder and whether the declared account type matches the bank's record
13
+ class BankAccount < Api::Requests::Base::NonFinancial::Kyc::Base
14
+
15
+ attr_accessor :bank_account_name
16
+ attr_reader :bank_account_number, :bank_account_type, :sort_code, :reference_id
17
+
18
+ # Initializes the Bank Account Verification request
19
+ def initialize(configuration, _builder_interface = nil)
20
+ super configuration
21
+
22
+ self.request_path = 'bank_account_verification'
23
+ end
24
+
25
+ # The account type related to the account number. Allowed: Business or Personal
26
+ def bank_account_type=(value)
27
+ allowed_options attribute: __method__,
28
+ allowed: Api::Constants::NonFinancial::Kyc::BankAccountTypes.all,
29
+ value: value,
30
+ allow_empty: true
31
+ end
32
+
33
+ # The number of the bank account, max 8 characters
34
+ def bank_account_number=(value)
35
+ limited_string attribute: __method__, value: value, max: 8
36
+ end
37
+
38
+ # The identifier of the bank for the related account, max 6 characters
39
+ def sort_code=(value)
40
+ limited_string attribute: __method__, value: value, max: 6
41
+ end
42
+
43
+ # Unique value to identify the performed verification, max 32 characters
44
+ def reference_id=(value)
45
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value, max: 32
46
+ end
47
+
48
+ protected
49
+
50
+ # Sets the request field validations
51
+ def init_field_validations
52
+ super
53
+
54
+ required_fields.push *%i[bank_account_name bank_account_number bank_account_type sort_code]
55
+
56
+ field_values.merge! bank_account_type: Api::Constants::NonFinancial::Kyc::BankAccountTypes.all
57
+ end
58
+
59
+ # Bank Account Verification request structure
60
+ def request_structure
61
+ {
62
+ bank_account_name: bank_account_name,
63
+ bank_account_number: bank_account_number,
64
+ bank_account_type: bank_account_type,
65
+ sort_code: sort_code,
66
+ reference_id: reference_id
67
+ }
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -21,9 +21,10 @@ module GenesisRuby
21
21
  include Api::Mixins::Requests::NonFinancial::Kyc::VerificationAttributes
22
22
  include Api::Mixins::Requests::NonFinancial::Kyc::VerificationDocumentAttributes
23
23
  include Api::Mixins::Requests::NonFinancial::Kyc::BusinessAttributes
24
+ include Api::Mixins::Requests::NonFinancial::Kyc::VerificationInstructionsAttributes
24
25
 
25
26
  attr_accessor :language, :address_backside_proof_required, :allow_retry, :verification_mode
26
- attr_reader :redirect_url, :address_supported_types
27
+ attr_reader :redirect_url, :address_supported_types, :show_consent, :show_privacy_policy
27
28
 
28
29
  # Initializes the Create Verification Request
29
30
  def initialize(configuration, _builder_interface = nil)
@@ -49,6 +50,24 @@ module GenesisRuby
49
50
  allow_empty: true
50
51
  end
51
52
 
53
+ # Signifies whether consent message to be shown on the verification page
54
+ def show_consent=(value)
55
+ allowed_options attribute: __method__,
56
+ allowed: [true, false],
57
+ value: value,
58
+ allow_empty: true,
59
+ error_message: 'Accepts only boolean values'
60
+ end
61
+
62
+ # Signifies whether privacy policy to be shown on the verification page
63
+ def show_privacy_policy=(value)
64
+ allowed_options attribute: __method__,
65
+ allowed: [true, false],
66
+ value: value,
67
+ allow_empty: true,
68
+ error_message: 'Accepts only boolean values'
69
+ end
70
+
52
71
  protected
53
72
 
54
73
  def init_field_validations
@@ -60,10 +79,12 @@ module GenesisRuby
60
79
  allow_retry: [true, false],
61
80
  verification_mode: Api::Constants::NonFinancial::Kyc::VerificationModes.all
62
81
  )
82
+
83
+ field_value_dependencies.merge! business_incorporation_date: %i[business_name]
63
84
  end
64
85
 
65
86
  # Returns request structure for the Create verification
66
- def request_structure # rubocop:disable Metrics/MethodLength
87
+ def request_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
67
88
  {
68
89
  email: email,
69
90
  country: country,
@@ -78,9 +99,15 @@ module GenesisRuby
78
99
  expiry_date: expiry_date,
79
100
  allow_retry: allow_retry,
80
101
  verification_mode: verification_mode,
81
- background_checks: background_checks_attributes_structure,
102
+ background_checks: background_checks_attributes_structure.merge(
103
+ {
104
+ business: business_attributes_structure
105
+ }
106
+ ),
82
107
  document: verification_document_attributes_structure,
83
- business: business_attributes_structure
108
+ show_consent: show_consent,
109
+ show_privacy_policy: show_privacy_policy,
110
+ verification_instructions: verification_instructions_attributes_structure
84
111
  }
85
112
  end
86
113