genesis_ruby 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/.kiro/specs/f2025112509-add_managed_recurring_api/.config.kiro +1 -0
- data/.kiro/specs/f2025112509-add_managed_recurring_api/design.md +332 -0
- data/.kiro/specs/f2025112509-add_managed_recurring_api/requirements.md +91 -0
- data/.kiro/specs/f2025112509-add_managed_recurring_api/tasks.md +139 -0
- data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/.config.kiro +1 -0
- data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/design.md +148 -0
- data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/requirements.md +81 -0
- data/.kiro/specs/f2025112603-add_reverify_endpoint_to_payee_account/tasks.md +48 -0
- data/.kiro/specs/f2025112606-add_list_payees_trx_request/.config.kiro +1 -0
- data/.kiro/specs/f2025112606-add_list_payees_trx_request/design.md +112 -0
- data/.kiro/specs/f2025112606-add_list_payees_trx_request/requirements.md +74 -0
- data/.kiro/specs/f2025112606-add_list_payees_trx_request/tasks.md +38 -0
- data/.kiro/specs/f2025112609_update_payee_request_params/design.md +86 -0
- data/.kiro/specs/f2025112609_update_payee_request_params/requirements.md +86 -0
- data/.kiro/specs/f2025112609_update_payee_request_params/tasks.md +40 -0
- data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/.config.kiro +1 -0
- data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/design.md +246 -0
- data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/requirements.md +287 -0
- data/.kiro/specs/f2025112612-add_payee_owner_documents_and_verification_requests/tasks.md +76 -0
- data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/design.md +84 -0
- data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/requirements.md +88 -0
- data/.kiro/specs/f2025112614-add_money_transfer_payout_attributes_to_payout_rq/tasks.md +38 -0
- data/.kiro/steering/product.md +15 -0
- data/.kiro/steering/spec-folder-naming.md +16 -0
- data/.kiro/steering/structure.md +96 -0
- data/.kiro/steering/tech.md +66 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +4 -4
- data/README.md +33 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/non_financial/kyc/address_document_supported_types.rb +81 -0
- data/lib/genesis_ruby/api/constants/non_financial/payee/document_types.rb +57 -0
- data/lib/genesis_ruby/api/constants/non_financial/payee/owner_types.rb +30 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/purpose_of_payments.rb +50 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/sender_account_number_types.rb +50 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/source_of_funds.rb +44 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/money_transfer/types.rb +26 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/statement_response_fields.rb +37 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/mpi_attributes.rb +0 -10
- data/lib/genesis_ruby/api/mixins/requests/financial/money_transfer_payout_attributes.rb +131 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb +87 -5
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/business_attributes.rb +42 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/document_attributes.rb +8 -7
- data/lib/genesis_ruby/api/request.rb +15 -9
- data/lib/genesis_ruby/api/requests/base/non_financial/billing_api/base.rb +108 -0
- data/lib/genesis_ruby/api/requests/base/non_financial/payee/base.rb +54 -0
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +1 -3
- data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +1 -3
- data/lib/genesis_ruby/api/requests/non_financial/billing_api/statement.rb +170 -0
- data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +20 -60
- data/lib/genesis_ruby/api/requests/non_financial/kyc/business/create.rb +45 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/business/document.rb +60 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/business/document_list.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/business/verification.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/address_by_document_proof.rb +92 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/create.rb +4 -1
- data/lib/genesis_ruby/api/requests/non_financial/managed_recurring/cancel.rb +63 -0
- data/lib/genesis_ruby/api/requests/non_financial/managed_recurring/fetch.rb +63 -0
- data/lib/genesis_ruby/api/requests/non_financial/managed_recurring/fetch_all.rb +37 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/account/reverify.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/associate_payee_with_owners.rb +105 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/create.rb +37 -7
- data/lib/genesis_ruby/api/requests/non_financial/payee/create_payee_document.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/dissociate_payee_with_owners.rb +94 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/list.rb +38 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/list_payee_documents.rb +57 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/list_payee_owners.rb +70 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/associate_owner_with_owners.rb +109 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/create.rb +71 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/create_owner_document.rb +63 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/delete.rb +54 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/dissociate_owners.rb +96 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/list_owner_documents.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/list_owners.rb +46 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/retrieve.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/retrieve_owner_document.rb +62 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/owners/update.rb +66 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/retrieve_payee_document.rb +60 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/update.rb +34 -4
- data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/create_payee_verification.rb +58 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/list_payee_verifications.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/retrieve_payee_verification.rb +62 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/retokenize.rb +45 -0
- data/lib/genesis_ruby/api/requests/wpf/create.rb +19 -0
- data/lib/genesis_ruby/api/response.rb +15 -0
- data/lib/genesis_ruby/dependencies.rb +2 -0
- data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +31 -5
- data/lib/genesis_ruby/network/base_network.rb +5 -0
- data/lib/genesis_ruby/network/net_http.rb +16 -4
- data/lib/genesis_ruby/utils/options/api_config.rb +43 -32
- data/lib/genesis_ruby/utils/options/network_adapter_config.rb +1 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +72 -3
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'date'
|
|
4
|
+
require 'genesis_ruby/api/constants/date_time_formats'
|
|
5
|
+
require 'genesis_ruby/api/constants/currencies/iso4217'
|
|
6
|
+
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'
|
|
8
|
+
|
|
9
|
+
module GenesisRuby
|
|
10
|
+
module Api
|
|
11
|
+
module Requests
|
|
12
|
+
module NonFinancial
|
|
13
|
+
module BillingApi
|
|
14
|
+
# 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
|
|
36
|
+
|
|
37
|
+
def initialize(configuration, _builder_interface = nil)
|
|
38
|
+
super configuration
|
|
39
|
+
|
|
40
|
+
self.root_key = 'query'
|
|
41
|
+
self.request_name = 'billingStatements'
|
|
42
|
+
self.request_path = 'billing_statements'
|
|
43
|
+
end
|
|
44
|
+
|
|
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
|
+
protected
|
|
69
|
+
|
|
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
|
|
78
|
+
end
|
|
79
|
+
|
|
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? }
|
|
126
|
+
end
|
|
127
|
+
|
|
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!'
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
@@ -13,11 +13,14 @@ module GenesisRuby
|
|
|
13
13
|
module BillingApi
|
|
14
14
|
# Billing Transactions API allows to programmatically retrieve information about billing transactions
|
|
15
15
|
# using given filters, pagination, and sort parameters.
|
|
16
|
-
class Transactions < Base::
|
|
16
|
+
class Transactions < Base::NonFinancial::BillingApi::Base # rubocop:disable Metrics/ClassLength
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
MAX_UNIQUE_ID_COUNT = 1_000
|
|
19
|
+
MAX_BILLING_STATEMENT_COUNT = 10
|
|
20
|
+
MAX_MERCHANT_TRANSACTION_COUNT = 1_000
|
|
21
|
+
MAX_MASTER_ACCOUNT_NAME_COUNT = 10
|
|
22
|
+
MAX_TRANSACTION_TYPE_COUNT = 10
|
|
23
|
+
MAX_DAYS_DIFFERENCE = 7
|
|
21
24
|
|
|
22
25
|
def initialize(configuration, _builder_interface = nil)
|
|
23
26
|
super configuration
|
|
@@ -40,32 +43,22 @@ module GenesisRuby
|
|
|
40
43
|
ResponseFields.all
|
|
41
44
|
end
|
|
42
45
|
|
|
43
|
-
# List of billing transaction unique IDs. Max number of elements is
|
|
46
|
+
# List of billing transaction unique IDs. Max number of elements is 1000. Primary filter.
|
|
44
47
|
def unique_id
|
|
45
48
|
@unique_id || []
|
|
46
49
|
end
|
|
47
50
|
|
|
48
|
-
# List of billing transaction unique IDs. Max number of elements is
|
|
51
|
+
# List of billing transaction unique IDs. Max number of elements is 1000. Primary filter.
|
|
49
52
|
def unique_id=(value)
|
|
50
53
|
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
|
51
54
|
end
|
|
52
55
|
|
|
53
|
-
# List of
|
|
54
|
-
def billing_statement
|
|
55
|
-
@billing_statement || []
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# List of billing statement names. Max number of elements allowed is 10. Primary filter.
|
|
59
|
-
def billing_statement=(value)
|
|
60
|
-
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# List of merchant transaction IDs. Max number of elements allowed is 10000. Primary filter.
|
|
56
|
+
# List of merchant transaction IDs. Max number of elements allowed is 1000. Primary filter.
|
|
64
57
|
def merchant_transaction_id
|
|
65
58
|
@merchant_transaction_id || []
|
|
66
59
|
end
|
|
67
60
|
|
|
68
|
-
# List of merchant transaction IDs. Max number of elements allowed is
|
|
61
|
+
# List of merchant transaction IDs. Max number of elements allowed is 1000. Primary filter.
|
|
69
62
|
def merchant_transaction_id=(value)
|
|
70
63
|
parse_array_of_strings attribute: __method__, value: value, allow_empty: true
|
|
71
64
|
end
|
|
@@ -96,16 +89,11 @@ module GenesisRuby
|
|
|
96
89
|
|
|
97
90
|
protected
|
|
98
91
|
|
|
99
|
-
# Billing API Authorization Token
|
|
100
|
-
def init_authorization_token
|
|
101
|
-
api_config.bearer_token = configuration.billing_api_token
|
|
102
|
-
end
|
|
103
|
-
|
|
104
92
|
# Billing API Transactions field validations
|
|
105
93
|
def init_field_validations
|
|
106
94
|
super
|
|
107
95
|
|
|
108
|
-
required_fields.push
|
|
96
|
+
required_fields.push :response_fields
|
|
109
97
|
field_values.merge! sort_by_direction: Api::Constants::Transactions::Parameters::NonFinancial::
|
|
110
98
|
SortDirections.all,
|
|
111
99
|
sort_by_field: Api::Constants::Transactions::Parameters::NonFinancial::BillingApi::
|
|
@@ -117,7 +105,7 @@ module GenesisRuby
|
|
|
117
105
|
super
|
|
118
106
|
|
|
119
107
|
validate_filters
|
|
120
|
-
|
|
108
|
+
validate_date_range(:start_date, :end_date, MAX_DAYS_DIFFERENCE) if @start_date || @end_date
|
|
121
109
|
validate_array_fields_size
|
|
122
110
|
end
|
|
123
111
|
|
|
@@ -152,49 +140,21 @@ module GenesisRuby
|
|
|
152
140
|
}
|
|
153
141
|
end
|
|
154
142
|
|
|
155
|
-
# Format given timestamp string to GraphQL suitable argument
|
|
156
|
-
def escape_argument(attribute)
|
|
157
|
-
__send__(attribute).to_s.empty? ? nil : "\"#{__send__(attribute)}\""
|
|
158
|
-
end
|
|
159
|
-
|
|
160
143
|
# Validate Billing API Primary filters
|
|
161
144
|
def validate_filters
|
|
162
|
-
unless start_date.nil? && end_date.nil? && unique_id.empty? && billing_statement.empty? &&
|
|
163
|
-
|
|
164
|
-
return
|
|
165
|
-
end
|
|
145
|
+
return unless start_date.nil? && end_date.nil? && unique_id.empty? && billing_statement.empty? &&
|
|
146
|
+
merchant_transaction_id.empty?
|
|
166
147
|
|
|
167
148
|
raise ParameterError, 'At least one Primary filter is required!'
|
|
168
149
|
end
|
|
169
150
|
|
|
170
|
-
# Validate StartDate and EndDate
|
|
171
|
-
def validate_dates
|
|
172
|
-
message = 'If filter startDate is provided, then endDate should also be provided and vice versa.'
|
|
173
|
-
raise ParameterError, message unless @start_date.is_a?(DateTime) && @end_date.is_a?(DateTime)
|
|
174
|
-
|
|
175
|
-
raise ParameterError, 'EndData must be after StartDate!' if @start_date == @end_date
|
|
176
|
-
|
|
177
|
-
days_diff = @end_date - @start_date
|
|
178
|
-
message = 'Maximum difference between StartDate and EndDate is 7 days'
|
|
179
|
-
raise ParameterError, message unless days_diff >= 0 && days_diff <= 7
|
|
180
|
-
end
|
|
181
|
-
|
|
182
151
|
# Validate Billing API Array field requirements
|
|
183
152
|
def validate_array_fields_size
|
|
184
|
-
validate_array_size :unique_id,
|
|
185
|
-
validate_array_size :billing_statement,
|
|
186
|
-
validate_array_size :merchant_transaction_id,
|
|
187
|
-
validate_array_size :master_account_name,
|
|
188
|
-
validate_array_size :transaction_type,
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
# Validate Max size of the given Array attribute
|
|
192
|
-
def validate_array_size(attribute, size)
|
|
193
|
-
message = format 'Max array length on %{attribute} exceed allowed size of %{size}',
|
|
194
|
-
attribute: attribute,
|
|
195
|
-
size: size
|
|
196
|
-
|
|
197
|
-
raise ParameterError, message if __send__(attribute).length > size
|
|
153
|
+
validate_array_size :unique_id, MAX_UNIQUE_ID_COUNT
|
|
154
|
+
validate_array_size :billing_statement, MAX_BILLING_STATEMENT_COUNT
|
|
155
|
+
validate_array_size :merchant_transaction_id, MAX_MERCHANT_TRANSACTION_COUNT
|
|
156
|
+
validate_array_size :master_account_name, MAX_MASTER_ACCOUNT_NAME_COUNT
|
|
157
|
+
validate_array_size :transaction_type, MAX_TRANSACTION_TYPE_COUNT
|
|
198
158
|
end
|
|
199
159
|
|
|
200
160
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Kyc
|
|
8
|
+
module Business
|
|
9
|
+
# Create a Business record
|
|
10
|
+
class Create < Api::Requests::Base::NonFinancial::Kyc::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :registration_number, :country, :name
|
|
13
|
+
|
|
14
|
+
# Initializes the Create Business Request
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'businesses'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Sets the request field validations
|
|
24
|
+
def init_field_validations
|
|
25
|
+
super
|
|
26
|
+
|
|
27
|
+
required_fields.push *%i[registration_number country]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns the request structure for the Create Business request
|
|
31
|
+
def request_structure
|
|
32
|
+
{
|
|
33
|
+
registration_number: registration_number,
|
|
34
|
+
country: country,
|
|
35
|
+
name: name
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Kyc
|
|
8
|
+
module Business
|
|
9
|
+
# Get a specific document related to the business entity
|
|
10
|
+
class Document < Api::Requests::Base::NonFinancial::Kyc::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :business_id, :id
|
|
13
|
+
|
|
14
|
+
# Initializes the Business Document Request
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'businesses/:business_id/documents/:id'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Override default KYC Network configuration for GET request
|
|
24
|
+
def init_configuration
|
|
25
|
+
super
|
|
26
|
+
|
|
27
|
+
init_get_configuration
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Sets the request field validations
|
|
31
|
+
def init_field_validations
|
|
32
|
+
super
|
|
33
|
+
|
|
34
|
+
required_fields.push *%i[business_id id]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Business Document request structure
|
|
38
|
+
def request_structure
|
|
39
|
+
{}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Override API endpoint with provided business ID and document ID
|
|
43
|
+
def process_request_parameters
|
|
44
|
+
super
|
|
45
|
+
|
|
46
|
+
processed_path = request_path.gsub(':business_id', business_id.to_s)
|
|
47
|
+
.gsub(':id', id.to_s)
|
|
48
|
+
|
|
49
|
+
init_kyc_service_configuration(
|
|
50
|
+
request_path: "api/#{version}/#{processed_path}"
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Kyc
|
|
8
|
+
module Business
|
|
9
|
+
# Get a list of documents related to the business entity
|
|
10
|
+
class DocumentList < Api::Requests::Base::NonFinancial::Kyc::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :business_id
|
|
13
|
+
|
|
14
|
+
# Initializes the Business Document List Request
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'businesses/:business_id/documents'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Override default KYC Network configuration for GET request
|
|
24
|
+
def init_configuration
|
|
25
|
+
super
|
|
26
|
+
|
|
27
|
+
init_get_configuration
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Sets the request field validations
|
|
31
|
+
def init_field_validations
|
|
32
|
+
super
|
|
33
|
+
|
|
34
|
+
required_fields.push *%i[business_id]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Business Document List request structure
|
|
38
|
+
def request_structure
|
|
39
|
+
{}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Override API endpoint with provided business ID
|
|
43
|
+
def process_request_parameters
|
|
44
|
+
super
|
|
45
|
+
|
|
46
|
+
processed_path = request_path.gsub(':business_id', business_id.to_s)
|
|
47
|
+
|
|
48
|
+
init_kyc_service_configuration(
|
|
49
|
+
request_path: "api/#{version}/#{processed_path}"
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Kyc
|
|
8
|
+
module Business
|
|
9
|
+
# Performs verification of a specific Business record based on its ID
|
|
10
|
+
class Verification < Api::Requests::Base::NonFinancial::Kyc::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :business_id
|
|
13
|
+
|
|
14
|
+
# Initializes the Business Verification Request
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'businesses/:business_id/verification'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Sets the request field validations
|
|
24
|
+
def init_field_validations
|
|
25
|
+
super
|
|
26
|
+
|
|
27
|
+
required_fields.push *%i[business_id]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Business Verification request structure
|
|
31
|
+
def request_structure
|
|
32
|
+
{}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Override API endpoint with provided business ID
|
|
36
|
+
def process_request_parameters
|
|
37
|
+
super
|
|
38
|
+
|
|
39
|
+
processed_path = request_path.gsub(':business_id', business_id.to_s)
|
|
40
|
+
|
|
41
|
+
init_kyc_service_configuration(
|
|
42
|
+
request_path: "api/#{version}/#{processed_path}"
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/address_by_document_proof.rb
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'genesis_ruby/api/constants/non_financial/kyc/address_document_supported_types'
|
|
4
|
+
|
|
5
|
+
module GenesisRuby
|
|
6
|
+
module Api
|
|
7
|
+
module Requests
|
|
8
|
+
module NonFinancial
|
|
9
|
+
module Kyc
|
|
10
|
+
module Verifications
|
|
11
|
+
# Address Verification by Document Proof
|
|
12
|
+
# Verification of customer address using a document.
|
|
13
|
+
class AddressByDocumentProof < Api::Requests::Base::NonFinancial::Kyc::Base
|
|
14
|
+
|
|
15
|
+
include Api::Mixins::Requests::NonFinancial::Kyc::DocumentAttributes
|
|
16
|
+
|
|
17
|
+
attr_accessor :reference_id
|
|
18
|
+
attr_reader :backside_proof_required, :with_enhanced_address_verification, :with_async_workflow
|
|
19
|
+
|
|
20
|
+
# Supported types of document that can be verified for address verification
|
|
21
|
+
def document_supported_types=(value)
|
|
22
|
+
parse_array_of_strings attribute: __method__,
|
|
23
|
+
value: value,
|
|
24
|
+
allowed: Api::Constants::NonFinancial::Kyc::AddressDocumentSupportedTypes.all,
|
|
25
|
+
allow_empty: true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Supported types of document that can be verified for address verification
|
|
29
|
+
def document_supported_types
|
|
30
|
+
@document_supported_types || []
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Initializes the Address Verification by Document Proof Request
|
|
34
|
+
def initialize(configuration, _builder_interface = nil)
|
|
35
|
+
super configuration
|
|
36
|
+
|
|
37
|
+
self.request_path = 'verifications/address/by_proof'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# A flag to enable the enhanced address verification
|
|
41
|
+
def with_enhanced_address_verification=(value)
|
|
42
|
+
allowed_options attribute: __method__,
|
|
43
|
+
allowed: [true, false],
|
|
44
|
+
value: value,
|
|
45
|
+
allow_empty: true,
|
|
46
|
+
error_message: 'Accepts only boolean values'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Signifies that both sides of the document are required to verify the address
|
|
50
|
+
def backside_proof_required=(value)
|
|
51
|
+
allowed_options attribute: __method__,
|
|
52
|
+
allowed: [true, false],
|
|
53
|
+
value: value,
|
|
54
|
+
allow_empty: true,
|
|
55
|
+
error_message: 'Accepts only boolean values'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# A flag that controls whether the request is sent synchronously or asynchronously
|
|
59
|
+
def with_async_workflow=(value)
|
|
60
|
+
allowed_options attribute: __method__,
|
|
61
|
+
allowed: [true, false],
|
|
62
|
+
value: value,
|
|
63
|
+
allow_empty: true,
|
|
64
|
+
error_message: 'Accepts only boolean values'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
protected
|
|
68
|
+
|
|
69
|
+
# Set the request field validations
|
|
70
|
+
def init_field_validations
|
|
71
|
+
required_fields.push *%i[reference_id document_supported_types full_address proof]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Returns request structure for the Address Verification by Document Proof
|
|
75
|
+
def request_structure
|
|
76
|
+
{
|
|
77
|
+
reference_id: reference_id,
|
|
78
|
+
document_supported_types: document_supported_types,
|
|
79
|
+
backside_proof_required: backside_proof_required,
|
|
80
|
+
with_enhanced_address_verification: with_enhanced_address_verification,
|
|
81
|
+
with_async_workflow: with_async_workflow,
|
|
82
|
+
document: document_attributes_structure
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'genesis_ruby/api/constants/non_financial/kyc/address_supported_types'
|
|
4
4
|
require 'genesis_ruby/api/constants/non_financial/kyc/languages'
|
|
5
5
|
require 'genesis_ruby/api/constants/non_financial/kyc/verification_modes'
|
|
6
|
+
require 'genesis_ruby/api/mixins/requests/non_financial/kyc/business_attributes'
|
|
6
7
|
|
|
7
8
|
module GenesisRuby
|
|
8
9
|
module Api
|
|
@@ -19,6 +20,7 @@ module GenesisRuby
|
|
|
19
20
|
include Api::Mixins::Requests::NonFinancial::Kyc::FaceAttributes
|
|
20
21
|
include Api::Mixins::Requests::NonFinancial::Kyc::VerificationAttributes
|
|
21
22
|
include Api::Mixins::Requests::NonFinancial::Kyc::VerificationDocumentAttributes
|
|
23
|
+
include Api::Mixins::Requests::NonFinancial::Kyc::BusinessAttributes
|
|
22
24
|
|
|
23
25
|
attr_accessor :language, :address_backside_proof_required, :allow_retry, :verification_mode
|
|
24
26
|
attr_reader :redirect_url, :address_supported_types
|
|
@@ -77,7 +79,8 @@ module GenesisRuby
|
|
|
77
79
|
allow_retry: allow_retry,
|
|
78
80
|
verification_mode: verification_mode,
|
|
79
81
|
background_checks: background_checks_attributes_structure,
|
|
80
|
-
document: verification_document_attributes_structure
|
|
82
|
+
document: verification_document_attributes_structure,
|
|
83
|
+
business: business_attributes_structure
|
|
81
84
|
}
|
|
82
85
|
end
|
|
83
86
|
|