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,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Payee
|
|
8
|
+
module Owners
|
|
9
|
+
# Update an existing Owner.
|
|
10
|
+
class Update < Base::NonFinancial::Payee::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :owner_unique_id, :owner_name, :owner_country, :owner_date,
|
|
13
|
+
:notification_url, :registration_number, :owner_address
|
|
14
|
+
|
|
15
|
+
# Update Owner initialization
|
|
16
|
+
def initialize(configuration, _builder_interface = nil)
|
|
17
|
+
super configuration
|
|
18
|
+
|
|
19
|
+
self.request_path = 'payee/owners/:owner_unique_id'
|
|
20
|
+
|
|
21
|
+
init_patch_configuration
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
protected
|
|
25
|
+
|
|
26
|
+
# Sets the request field validations
|
|
27
|
+
def init_field_validations
|
|
28
|
+
super
|
|
29
|
+
|
|
30
|
+
required_fields.push *%i[
|
|
31
|
+
owner_unique_id
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
field_values.merge! owner_country: GenesisRuby::Utils::Country::COUNTRIES.keys
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns the request structure
|
|
38
|
+
def request_structure
|
|
39
|
+
{
|
|
40
|
+
owner: {
|
|
41
|
+
name: owner_name,
|
|
42
|
+
country: owner_country,
|
|
43
|
+
date: owner_date,
|
|
44
|
+
notification_url: notification_url,
|
|
45
|
+
registration_number: registration_number,
|
|
46
|
+
address: owner_address
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Override API endpoint configuration
|
|
52
|
+
def process_request_parameters
|
|
53
|
+
super
|
|
54
|
+
|
|
55
|
+
processed_path = request_path.dup.gsub(':owner_unique_id', owner_unique_id.to_s)
|
|
56
|
+
|
|
57
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
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 Payee
|
|
8
|
+
# Retrieve the details of a specific Document for a specific Payee.
|
|
9
|
+
class RetrievePayeeDocument < Base::NonFinancial::Payee::Base
|
|
10
|
+
|
|
11
|
+
attr_accessor :payee_unique_id, :document_unique_id
|
|
12
|
+
|
|
13
|
+
# Retrieve Payee Document initialization
|
|
14
|
+
def initialize(configuration, _builder_interface = nil)
|
|
15
|
+
super configuration
|
|
16
|
+
|
|
17
|
+
self.request_path = 'payee/:payee_unique_id/documents/:document_unique_id'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
# Override default Versioned Network configuration
|
|
23
|
+
def init_configuration
|
|
24
|
+
super
|
|
25
|
+
|
|
26
|
+
init_get_configuration
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Sets the request field validations
|
|
30
|
+
def init_field_validations
|
|
31
|
+
super
|
|
32
|
+
|
|
33
|
+
required_fields.push *%i[
|
|
34
|
+
payee_unique_id
|
|
35
|
+
document_unique_id
|
|
36
|
+
]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Returns the request structure
|
|
40
|
+
def request_structure
|
|
41
|
+
{}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Override API endpoint configuration
|
|
45
|
+
def process_request_parameters
|
|
46
|
+
processed_path = request_path.dup
|
|
47
|
+
.gsub(':payee_unique_id', payee_unique_id.to_s)
|
|
48
|
+
.gsub(':document_unique_id', document_unique_id.to_s)
|
|
49
|
+
|
|
50
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
|
51
|
+
|
|
52
|
+
super
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -8,7 +8,19 @@ module GenesisRuby
|
|
|
8
8
|
# Update Payee
|
|
9
9
|
class Update < Base::Versioned
|
|
10
10
|
|
|
11
|
-
attr_accessor :payee_unique_id, :payee_name, :payee_country
|
|
11
|
+
attr_accessor :payee_unique_id, :payee_name, :payee_country, :payee_notification_url,
|
|
12
|
+
:payee_registration_number, :payee_address_city, :payee_address_street,
|
|
13
|
+
:payee_address_state, :payee_address_country, :payee_address_zip_code
|
|
14
|
+
|
|
15
|
+
# Payee date getter formatted as YYYY-MM-DD
|
|
16
|
+
def payee_date
|
|
17
|
+
@payee_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Payee date setter with date validation
|
|
21
|
+
def payee_date=(value)
|
|
22
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
|
23
|
+
end
|
|
12
24
|
|
|
13
25
|
# Retrieve Payee initialization
|
|
14
26
|
def initialize(configuration, _builder_interface = nil)
|
|
@@ -28,15 +40,20 @@ module GenesisRuby
|
|
|
28
40
|
required_fields.push *%i[
|
|
29
41
|
payee_unique_id
|
|
30
42
|
]
|
|
31
|
-
field_values.merge! payee_country:
|
|
43
|
+
field_values.merge! payee_country: GenesisRuby::Utils::Country::COUNTRIES.keys,
|
|
44
|
+
payee_address_country: GenesisRuby::Utils::Country::COUNTRIES.keys
|
|
32
45
|
end
|
|
33
46
|
|
|
34
47
|
# Returns the request structure
|
|
35
48
|
def request_structure
|
|
36
49
|
{
|
|
37
50
|
payee: {
|
|
38
|
-
name:
|
|
39
|
-
country:
|
|
51
|
+
name: payee_name,
|
|
52
|
+
country: payee_country,
|
|
53
|
+
date: payee_date,
|
|
54
|
+
notification_url: payee_notification_url,
|
|
55
|
+
registration_number: payee_registration_number,
|
|
56
|
+
address: payee_address_structure
|
|
40
57
|
}
|
|
41
58
|
}
|
|
42
59
|
end
|
|
@@ -50,6 +67,19 @@ module GenesisRuby
|
|
|
50
67
|
init_api_service_configuration request_path: processed_path, include_token: false
|
|
51
68
|
end
|
|
52
69
|
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
# Build the nested address structure
|
|
73
|
+
def payee_address_structure
|
|
74
|
+
{
|
|
75
|
+
city: payee_address_city,
|
|
76
|
+
street: payee_address_street,
|
|
77
|
+
state: payee_address_state,
|
|
78
|
+
country: payee_address_country,
|
|
79
|
+
zip_code: payee_address_zip_code
|
|
80
|
+
}
|
|
81
|
+
end
|
|
82
|
+
|
|
53
83
|
end
|
|
54
84
|
end
|
|
55
85
|
end
|
data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/create_payee_verification.rb
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Payee
|
|
8
|
+
module Verifications
|
|
9
|
+
# Create a Verification for a specific Payee.
|
|
10
|
+
class CreatePayeeVerification < Base::NonFinancial::Payee::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :payee_unique_id, :notification_url, :redirect_url, :with_checks_retry
|
|
13
|
+
|
|
14
|
+
# Create Payee Verification initialization
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'payee/:payee_unique_id/verifications'
|
|
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[
|
|
28
|
+
payee_unique_id
|
|
29
|
+
]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns the request structure
|
|
33
|
+
def request_structure
|
|
34
|
+
{
|
|
35
|
+
verification: {
|
|
36
|
+
notification_url: notification_url,
|
|
37
|
+
redirect_url: redirect_url,
|
|
38
|
+
with_checks_retry: with_checks_retry
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Override API endpoint configuration
|
|
44
|
+
def process_request_parameters
|
|
45
|
+
super
|
|
46
|
+
|
|
47
|
+
processed_path = request_path.dup.gsub(':payee_unique_id', payee_unique_id.to_s)
|
|
48
|
+
|
|
49
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/list_payee_verifications.rb
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Payee
|
|
8
|
+
module Verifications
|
|
9
|
+
# Retrieve the details of all Verification records that belongs to specific Payee.
|
|
10
|
+
class ListPayeeVerifications < Base::NonFinancial::Payee::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :payee_unique_id
|
|
13
|
+
|
|
14
|
+
# List Payee Verifications initialization
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'payee/:payee_unique_id/verifications'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Override default Versioned Network configuration
|
|
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[
|
|
35
|
+
payee_unique_id
|
|
36
|
+
]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Returns the request structure
|
|
40
|
+
def request_structure
|
|
41
|
+
{}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Override API endpoint configuration
|
|
45
|
+
def process_request_parameters
|
|
46
|
+
processed_path = request_path.dup.gsub(':payee_unique_id', payee_unique_id.to_s)
|
|
47
|
+
|
|
48
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
|
49
|
+
|
|
50
|
+
super
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/genesis_ruby/api/requests/non_financial/payee/verifications/retrieve_payee_verification.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GenesisRuby
|
|
4
|
+
module Api
|
|
5
|
+
module Requests
|
|
6
|
+
module NonFinancial
|
|
7
|
+
module Payee
|
|
8
|
+
module Verifications
|
|
9
|
+
# Retrieve the details of a specific Verification for a specific Payee.
|
|
10
|
+
class RetrievePayeeVerification < Base::NonFinancial::Payee::Base
|
|
11
|
+
|
|
12
|
+
attr_accessor :payee_unique_id, :verification_unique_id
|
|
13
|
+
|
|
14
|
+
# Retrieve Payee Verification initialization
|
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
|
16
|
+
super configuration
|
|
17
|
+
|
|
18
|
+
self.request_path = 'payee/:payee_unique_id/verifications/:verification_unique_id'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# Override default Versioned Network configuration
|
|
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[
|
|
35
|
+
payee_unique_id
|
|
36
|
+
verification_unique_id
|
|
37
|
+
]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns the request structure
|
|
41
|
+
def request_structure
|
|
42
|
+
{}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Override API endpoint configuration
|
|
46
|
+
def process_request_parameters
|
|
47
|
+
processed_path = request_path.dup
|
|
48
|
+
.gsub(':payee_unique_id', payee_unique_id.to_s)
|
|
49
|
+
.gsub(':verification_unique_id', verification_unique_id.to_s)
|
|
50
|
+
|
|
51
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
|
52
|
+
|
|
53
|
+
super
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
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 Tokenization
|
|
8
|
+
# Retokenization of an existing internal token by attaching a scheme-generated token(DPAN)
|
|
9
|
+
class Retokenize < Base::Versioned
|
|
10
|
+
|
|
11
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
|
12
|
+
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
|
13
|
+
|
|
14
|
+
def initialize(configuration, builder_interface = Builder::XML)
|
|
15
|
+
super configuration, builder_interface
|
|
16
|
+
|
|
17
|
+
self.request_path = 'retokenize'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
# Tokenize field validations
|
|
23
|
+
def init_field_validations
|
|
24
|
+
super
|
|
25
|
+
|
|
26
|
+
required_fields.push *tokenization_required_fields, :token
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# API Request structure
|
|
30
|
+
def request_structure
|
|
31
|
+
{
|
|
32
|
+
retokenize_request: tokenization_attributes_structure.merge(
|
|
33
|
+
{
|
|
34
|
+
token: token
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -95,6 +95,24 @@ module GenesisRuby
|
|
|
95
95
|
error_message: 'Accepts only boolean values'
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
# Signifies whether the scheme tokenized card payments would be enabled on the WPF
|
|
99
|
+
def scheme_tokenized
|
|
100
|
+
@scheme_tokenized ||= false
|
|
101
|
+
|
|
102
|
+
return nil unless @scheme_tokenized
|
|
103
|
+
|
|
104
|
+
@scheme_tokenized
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Signifies whether the scheme tokenized card payments would be enabled on the WPF
|
|
108
|
+
def scheme_tokenized=(value)
|
|
109
|
+
allowed_options attribute: __method__,
|
|
110
|
+
allowed: [true, false],
|
|
111
|
+
value: value,
|
|
112
|
+
allow_empty: true,
|
|
113
|
+
error_message: 'Accepts only boolean values'
|
|
114
|
+
end
|
|
115
|
+
|
|
98
116
|
# A number of minutes determining how long the WPF will be valid. Will be set to 30 minutes by default.
|
|
99
117
|
def lifetime
|
|
100
118
|
@lifetime ||= DEFAULT_LIFETIME
|
|
@@ -173,6 +191,7 @@ module GenesisRuby
|
|
|
173
191
|
risk_params: risk_parameters_structure,
|
|
174
192
|
account_owner: account_owner_attributes_structure,
|
|
175
193
|
pay_later: pay_later,
|
|
194
|
+
scheme_tokenized: scheme_tokenized,
|
|
176
195
|
reminders: pay_later ? reminders_structure : [],
|
|
177
196
|
funding: funding_attributes_structure,
|
|
178
197
|
digital_asset_type: digital_asset_type
|
|
@@ -33,6 +33,9 @@ module GenesisRuby
|
|
|
33
33
|
def parse_response(network)
|
|
34
34
|
@network_context = network
|
|
35
35
|
@response_raw = @network_context.response_body
|
|
36
|
+
|
|
37
|
+
return process_successful_empty_response if successful_empty_response?
|
|
38
|
+
|
|
36
39
|
@response_object = load_parser(@network_context).parse_document(@response_raw)
|
|
37
40
|
|
|
38
41
|
process_response_object
|
|
@@ -89,6 +92,18 @@ module GenesisRuby
|
|
|
89
92
|
@response_object
|
|
90
93
|
end
|
|
91
94
|
|
|
95
|
+
private
|
|
96
|
+
|
|
97
|
+
# Determines if the response is a successful 2xx with empty body (e.g., 204 No Content)
|
|
98
|
+
def successful_empty_response?
|
|
99
|
+
@response_raw.to_s.empty? && @network_context.status.to_i.between?(200, 299)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Process a successful empty response without invoking the parser
|
|
103
|
+
def process_successful_empty_response
|
|
104
|
+
@response_object = {}
|
|
105
|
+
end
|
|
106
|
+
|
|
92
107
|
end
|
|
93
108
|
end
|
|
94
109
|
end
|
|
@@ -28,6 +28,8 @@ require 'genesis_ruby/api/requests/financial/sdd/sale'
|
|
|
28
28
|
require 'genesis_ruby/api/requests/base/graphql'
|
|
29
29
|
require 'genesis_ruby/api/notification'
|
|
30
30
|
require 'genesis_ruby/api/requests/base/non_financial/kyc/base'
|
|
31
|
+
require 'genesis_ruby/api/requests/base/non_financial/billing_api/base'
|
|
32
|
+
require 'genesis_ruby/api/requests/base/non_financial/payee/base'
|
|
31
33
|
|
|
32
34
|
# Load Financial and Non Financial API Requests
|
|
33
35
|
Dir["#{File.dirname(__FILE__)}/api/requests/*financial/**/*.rb"].sort.each { |file| require file }
|
|
@@ -8,7 +8,7 @@ module GenesisRuby
|
|
|
8
8
|
module Network
|
|
9
9
|
module Adapter
|
|
10
10
|
# Net-HTTP Adapter implementation
|
|
11
|
-
class NetHttpAdapter < BaseAdapter
|
|
11
|
+
class NetHttpAdapter < BaseAdapter # rubocop:disable Metrics/ClassLength
|
|
12
12
|
|
|
13
13
|
# HTTP Response Status Code
|
|
14
14
|
def status
|
|
@@ -18,13 +18,13 @@ module GenesisRuby
|
|
|
18
18
|
# Prepare the request from the given data
|
|
19
19
|
def prepare_request(data)
|
|
20
20
|
@request_data = data
|
|
21
|
-
@uri
|
|
21
|
+
@uri = parse_uri
|
|
22
22
|
# Force connection re-creation
|
|
23
|
-
@request
|
|
23
|
+
@request = Net::HTTP.start(@uri.hostname ||= '', ssl_options)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Send the request
|
|
27
|
-
def execute # rubocop:disable Metrics/AbcSize
|
|
27
|
+
def execute # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
28
28
|
raise NetworkError, 'Request is not initialized' unless @request
|
|
29
29
|
|
|
30
30
|
safe_execute do
|
|
@@ -33,6 +33,7 @@ module GenesisRuby
|
|
|
33
33
|
when Api::Request::METHOD_PUT then @response = @request.put path, request_data.body, headers
|
|
34
34
|
when Api::Request::METHOD_GET then @response = @request.get path, headers
|
|
35
35
|
when Api::Request::METHOD_PATCH then @response = @request.patch path, request_data.body, headers
|
|
36
|
+
when Api::Request::METHOD_DELETE then @response = execute_delete
|
|
36
37
|
else raise 'Invalid Request Type!'
|
|
37
38
|
end
|
|
38
39
|
end
|
|
@@ -97,7 +98,7 @@ module GenesisRuby
|
|
|
97
98
|
def headers
|
|
98
99
|
data = common_headers
|
|
99
100
|
|
|
100
|
-
data.merge! payload_headers
|
|
101
|
+
data.merge! payload_headers if include_payload_headers?
|
|
101
102
|
data.merge! request_data.headers if request_data.headers.is_a?(Hash) && !request_data.headers.empty?
|
|
102
103
|
|
|
103
104
|
data
|
|
@@ -119,6 +120,31 @@ module GenesisRuby
|
|
|
119
120
|
}
|
|
120
121
|
end
|
|
121
122
|
|
|
123
|
+
# Check if DELETE request has a body
|
|
124
|
+
def delete_with_body?
|
|
125
|
+
request_data.type == Api::Request::METHOD_DELETE &&
|
|
126
|
+
request_data.body.is_a?(String) && !request_data.body.empty?
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Determine whether payload headers should be included
|
|
130
|
+
def include_payload_headers?
|
|
131
|
+
return false if request_data.type == Api::Request::METHOD_GET
|
|
132
|
+
return delete_with_body? if request_data.type == Api::Request::METHOD_DELETE
|
|
133
|
+
|
|
134
|
+
true
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Execute DELETE request with body support via Net::HTTP::Delete
|
|
138
|
+
def execute_delete
|
|
139
|
+
if delete_with_body?
|
|
140
|
+
delete_request = Net::HTTP::Delete.new(path, headers)
|
|
141
|
+
delete_request.body = request_data.body
|
|
142
|
+
@request.request(delete_request)
|
|
143
|
+
else
|
|
144
|
+
@request.delete path, headers
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
122
148
|
# Safe Request execution
|
|
123
149
|
def safe_execute(&block)
|
|
124
150
|
block.call
|
|
@@ -8,19 +8,31 @@ module GenesisRuby
|
|
|
8
8
|
# Net HTTP Network module
|
|
9
9
|
class NetHttp < BaseNetwork
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# XML Response Type
|
|
12
12
|
def xml?
|
|
13
|
-
response_headers['content-type']
|
|
13
|
+
content_type = response_headers['content-type']
|
|
14
|
+
|
|
15
|
+
return false if content_type.nil?
|
|
16
|
+
|
|
17
|
+
content_type.downcase.include?(BaseNetwork::XML_HEADER)
|
|
14
18
|
end
|
|
15
19
|
|
|
16
20
|
# JSON Response Type
|
|
17
21
|
def json?
|
|
18
|
-
response_headers['content-type']
|
|
22
|
+
content_type = response_headers['content-type']
|
|
23
|
+
|
|
24
|
+
return false if content_type.nil?
|
|
25
|
+
|
|
26
|
+
content_type.downcase.include?(BaseNetwork::JSON_HEADER)
|
|
19
27
|
end
|
|
20
28
|
|
|
21
29
|
# HTML Response Type
|
|
22
30
|
def html?
|
|
23
|
-
response_headers['content-type']
|
|
31
|
+
content_type = response_headers['content-type']
|
|
32
|
+
|
|
33
|
+
return false if content_type.nil?
|
|
34
|
+
|
|
35
|
+
content_type.downcase.include?(BaseNetwork::HTML_HEADER)
|
|
24
36
|
end
|
|
25
37
|
|
|
26
38
|
protected
|