checkout_sdk 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/checkout_sdk/accounts/accounts.rb +21 -0
- data/lib/checkout_sdk/accounts/additional_document.rb +11 -0
- data/lib/checkout_sdk/accounts/additional_info.rb +17 -0
- data/lib/checkout_sdk/accounts/articles_of_association_type.rb +10 -0
- data/lib/checkout_sdk/accounts/bank_verification.rb +14 -0
- data/lib/checkout_sdk/accounts/bank_verification_type.rb +9 -0
- data/lib/checkout_sdk/accounts/company.rb +7 -1
- data/lib/checkout_sdk/accounts/contact_details.rb +4 -1
- data/lib/checkout_sdk/accounts/date_of_incorporation.rb +14 -0
- data/lib/checkout_sdk/accounts/financial_verification.rb +14 -0
- data/lib/checkout_sdk/accounts/financial_verification_type.rb +9 -0
- data/lib/checkout_sdk/accounts/invitee.rb +11 -0
- data/lib/checkout_sdk/accounts/onboard_entity.rb +13 -4
- data/lib/checkout_sdk/accounts/onboard_sub_entity_documents.rb +31 -4
- data/lib/checkout_sdk/accounts/processing_details.rb +26 -0
- data/lib/checkout_sdk/accounts/proof_of_legality.rb +14 -0
- data/lib/checkout_sdk/accounts/proof_of_legality_type.rb +9 -0
- data/lib/checkout_sdk/accounts/proof_of_principal_address.rb +14 -0
- data/lib/checkout_sdk/accounts/proof_of_principal_address_type.rb +9 -0
- data/lib/checkout_sdk/accounts/shareholder_structure.rb +14 -0
- data/lib/checkout_sdk/accounts/shareholder_structure_type.rb +9 -0
- data/lib/checkout_sdk/api_client.rb +59 -50
- data/lib/checkout_sdk/client.rb +2 -3
- data/lib/checkout_sdk/common/account_change_indicator_type.rb +12 -0
- data/lib/checkout_sdk/common/account_holder.rb +7 -4
- data/lib/checkout_sdk/common/account_password_change_indicator_type.rb +13 -0
- data/lib/checkout_sdk/common/account_type_card_product_type.rb +11 -0
- data/lib/checkout_sdk/common/cardholder_account_age_indicator_type.rb +13 -0
- data/lib/checkout_sdk/common/common.rb +6 -0
- data/lib/checkout_sdk/common/customer_retry.rb +11 -0
- data/lib/checkout_sdk/common/destination.rb +38 -0
- data/lib/checkout_sdk/common/payment_source_type.rb +5 -0
- data/lib/checkout_sdk/error.rb +24 -8
- data/lib/checkout_sdk/payments/exemption.rb +2 -0
- data/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb +18 -4
- data/lib/checkout_sdk/payments/links/payment_link.rb +18 -0
- data/lib/checkout_sdk/payments/partial_authorization.rb +11 -0
- data/lib/checkout_sdk/payments/payment_request.rb +3 -0
- data/lib/checkout_sdk/payments/payments.rb +5 -1
- data/lib/checkout_sdk/payments/sender/government_sender.rb +3 -0
- data/lib/checkout_sdk/payments/sender/individual_sender.rb +3 -0
- data/lib/checkout_sdk/payments/sessions/payment_sessions_request.rb +3 -0
- data/lib/checkout_sdk/payments/source/apm/ach_source.rb +27 -0
- data/lib/checkout_sdk/payments/source/apm/bizum_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/apm/octopus_source.rb +11 -0
- data/lib/checkout_sdk/payments/source/apm/plaid_source.rb +17 -0
- data/lib/checkout_sdk/payments/source/apm/sequra_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/card_source.rb +4 -1
- data/lib/checkout_sdk/payments/source/customer_source.rb +4 -1
- data/lib/checkout_sdk/payments/source/id_source.rb +4 -1
- data/lib/checkout_sdk/payments/source/network_token_source.rb +4 -1
- data/lib/checkout_sdk/payments/source/token_source.rb +4 -1
- data/lib/checkout_sdk/sessions/authentication_method.rb +3 -3
- data/lib/checkout_sdk/sessions/authentication_type.rb +3 -3
- data/lib/checkout_sdk/sessions/card_holder_account_info.rb +39 -3
- data/lib/checkout_sdk/sessions/channel/browser_session.rb +4 -1
- data/lib/checkout_sdk/sessions/channel/channel_data_type.rb +1 -0
- data/lib/checkout_sdk/sessions/channel/merchant_initiated_session.rb +15 -0
- data/lib/checkout_sdk/sessions/channel/request_type.rb +19 -0
- data/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb +2 -2
- data/lib/checkout_sdk/sessions/initial_transaction.rb +23 -0
- data/lib/checkout_sdk/sessions/installment.rb +5 -0
- data/lib/checkout_sdk/sessions/merchant_risk_info.rb +20 -2
- data/lib/checkout_sdk/sessions/optimization.rb +19 -0
- data/lib/checkout_sdk/sessions/optimized_properties.rb +17 -0
- data/lib/checkout_sdk/sessions/pre_order_purchase_indicator_type.rb +10 -0
- data/lib/checkout_sdk/sessions/recurring.rb +5 -0
- data/lib/checkout_sdk/sessions/reorder_items_indicator_type.rb +10 -0
- data/lib/checkout_sdk/sessions/session_request.rb +25 -2
- data/lib/checkout_sdk/sessions/sessions.rb +9 -0
- data/lib/checkout_sdk/sessions/source/card_source.rb +2 -1
- data/lib/checkout_sdk/sessions/three_ds_method_completion_request.rb +3 -1
- data/lib/checkout_sdk/sessions/three_ds_req_auth_method.rb +16 -0
- data/lib/checkout_sdk/sessions/three_ds_requestor_authentication_info.rb +17 -0
- data/lib/checkout_sdk/sessions/transaction_type.rb +3 -3
- data/lib/checkout_sdk/version.rb +1 -1
- metadata +39 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4620b28a6309ae0f37d8d881513f93a41d9c4cc30116719c82954212572f6f8
|
4
|
+
data.tar.gz: 99c680456288fe5acf3bf1fd5fb9cb62188ca380f715b9fb61259ad78024f795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648c9db76507c0aa0e26b307edddb2c0ed615819bf093936cb08fbd204588e6d1398377c9bf6dd84951b82e85c8178c4ca9b3e5f58680960de83c29d163692c7
|
7
|
+
data.tar.gz: ff1713ad04ffd80c8ae5261d1b4f0b0bb8182fb28c0f168fd5ea510d9511df98d2002927cae1d4acc0da66fdb200cc91c3d981d93c693791d169bcc4edd9edf9
|
@@ -36,3 +36,24 @@ require 'checkout_sdk/accounts/payment_instrument_request'
|
|
36
36
|
require 'checkout_sdk/accounts/payment_instruments_query'
|
37
37
|
require 'checkout_sdk/accounts/headers'
|
38
38
|
require 'checkout_sdk/accounts/update_payment_instrument_request'
|
39
|
+
require 'checkout_sdk/accounts/additional_document'
|
40
|
+
require 'checkout_sdk/accounts/additional_info'
|
41
|
+
require 'checkout_sdk/accounts/articles_of_association_type'
|
42
|
+
require 'checkout_sdk/accounts/bank_verification'
|
43
|
+
require 'checkout_sdk/accounts/bank_verification_type'
|
44
|
+
require 'checkout_sdk/accounts/company_verification'
|
45
|
+
require 'checkout_sdk/accounts/company_verification_type'
|
46
|
+
require 'checkout_sdk/accounts/date_of_incorporation'
|
47
|
+
require 'checkout_sdk/accounts/financial_verification'
|
48
|
+
require 'checkout_sdk/accounts/financial_verification_type'
|
49
|
+
require 'checkout_sdk/accounts/invitee'
|
50
|
+
require 'checkout_sdk/accounts/onboard_sub_entity_documents'
|
51
|
+
require 'checkout_sdk/accounts/processing_details'
|
52
|
+
require 'checkout_sdk/accounts/proof_of_legality'
|
53
|
+
require 'checkout_sdk/accounts/proof_of_legality_type'
|
54
|
+
require 'checkout_sdk/accounts/proof_of_principal_address'
|
55
|
+
require 'checkout_sdk/accounts/proof_of_principal_address_type'
|
56
|
+
require 'checkout_sdk/accounts/shareholder_structure'
|
57
|
+
require 'checkout_sdk/accounts/shareholder_structure_type'
|
58
|
+
require 'checkout_sdk/accounts/tax_verification'
|
59
|
+
require 'checkout_sdk/accounts/tax_verification_type'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute field1
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute field2
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute field3
|
10
|
+
# @return [String]
|
11
|
+
class AdditionalInfo
|
12
|
+
attr_accessor :field1,
|
13
|
+
:field2,
|
14
|
+
:field3
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -10,12 +10,16 @@ module CheckoutSdk
|
|
10
10
|
# @return [String]
|
11
11
|
# @!attribute trading_name
|
12
12
|
# @return [String]
|
13
|
+
# @!attribute date_of_incorporation
|
14
|
+
# @return [DateOfIncorporation]
|
15
|
+
# @!attribute regulatory_licence_number
|
16
|
+
# @return [String]
|
13
17
|
# @!attribute principal_address
|
14
18
|
# @return [CheckoutSdk::Common::Address]
|
15
19
|
# @!attribute registered_address
|
16
20
|
# @return [CheckoutSdk::Common::Address]
|
17
21
|
# @!attribute representatives
|
18
|
-
# @return [Array(
|
22
|
+
# @return [Array(EntityRepresentative)]
|
19
23
|
# @!attribute document
|
20
24
|
# @return [EntityDocument]
|
21
25
|
# @!attribute financial_details
|
@@ -25,6 +29,8 @@ module CheckoutSdk
|
|
25
29
|
:business_type,
|
26
30
|
:legal_name,
|
27
31
|
:trading_name,
|
32
|
+
:date_of_incorporation,
|
33
|
+
:regulatory_licence_number,
|
28
34
|
:principal_address,
|
29
35
|
:registered_address,
|
30
36
|
:representatives,
|
@@ -6,9 +6,12 @@ module CheckoutSdk
|
|
6
6
|
# @return [Phone]
|
7
7
|
# @!attribute email_addresses
|
8
8
|
# @return [EntityEmailAddresses]
|
9
|
+
# @!attribute invitee
|
10
|
+
# @return [Invitee]
|
9
11
|
class ContactDetails
|
10
12
|
attr_accessor :phone,
|
11
|
-
:email_addresses
|
13
|
+
:email_addresses,
|
14
|
+
:invitee
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [FinancialVerificationType]
|
7
|
+
# @!attribute front
|
8
|
+
# @return [String]
|
9
|
+
class FinancialVerification
|
10
|
+
attr_reader :type,
|
11
|
+
:front
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -4,23 +4,32 @@ module CheckoutSdk
|
|
4
4
|
module Accounts
|
5
5
|
# @!attribute reference
|
6
6
|
# @return [String]
|
7
|
-
# @!attribute
|
8
|
-
# @return [
|
7
|
+
# @!attribute is_draft
|
8
|
+
# @return [Boolean]
|
9
9
|
# @!attribute profile
|
10
10
|
# @return [Profile]
|
11
|
+
# @!attribute contact_details
|
12
|
+
# @return [ContactDetails]
|
11
13
|
# @!attribute company
|
12
14
|
# @return [Company]
|
15
|
+
# @!attribute processing_details
|
16
|
+
# @return [ProcessingDetails]
|
13
17
|
# @!attribute individual
|
14
18
|
# @return [Individual]
|
15
19
|
# @!attribute documents
|
16
20
|
# @return [OnboardSubEntityDocuments]
|
21
|
+
# @!attribute additional_info
|
22
|
+
# @return [AdditionalInfo]
|
17
23
|
class OnboardEntity
|
18
24
|
attr_accessor :reference,
|
19
|
-
:
|
25
|
+
:is_draft,
|
20
26
|
:profile,
|
27
|
+
:contact_details,
|
21
28
|
:company,
|
29
|
+
:processing_details,
|
22
30
|
:individual,
|
23
|
-
:documents
|
31
|
+
:documents,
|
32
|
+
:additional_info
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -2,16 +2,43 @@
|
|
2
2
|
|
3
3
|
module CheckoutSdk
|
4
4
|
module Accounts
|
5
|
-
# @!attribute
|
6
|
-
# @return [
|
5
|
+
# @!attribute identity_verification
|
6
|
+
# @return [EntityIdentificationDocument]
|
7
7
|
# @!attribute company_verification
|
8
8
|
# @return [CompanyVerification]
|
9
|
+
# @!attribute articles_of_association
|
10
|
+
# @return [ArticlesOfAssociationType]
|
11
|
+
# @!attribute bank_verification
|
12
|
+
# @return [BankVerification]
|
13
|
+
# @!attribute shareholder_structure
|
14
|
+
# @return [ShareholderStructure]
|
15
|
+
# @!attribute proof_of_legality
|
16
|
+
# @return [ProofOfLegality]
|
17
|
+
# @!attribute proof_of_principal_address
|
18
|
+
# @return [ProofOfPrincipalAddress]
|
19
|
+
# @!attribute additional_document1
|
20
|
+
# @return [AdditionalDocument]
|
21
|
+
# @!attribute additional_document2
|
22
|
+
# @return [AdditionalDocument]
|
23
|
+
# @!attribute additional_document3
|
24
|
+
# @return [AdditionalDocument]
|
9
25
|
# @!attribute tax_verification
|
10
26
|
# @return [TaxVerification]
|
27
|
+
# @!attribute financial_verification
|
28
|
+
# @return [FinancialVerification]
|
11
29
|
class OnboardSubEntityDocuments
|
12
|
-
attr_accessor :
|
30
|
+
attr_accessor :identity_verification,
|
13
31
|
:company_verification,
|
14
|
-
:
|
32
|
+
:articles_of_association,
|
33
|
+
:bank_verification,
|
34
|
+
:shareholder_structure,
|
35
|
+
:proof_of_legality,
|
36
|
+
:proof_of_principal_address,
|
37
|
+
:additional_document1,
|
38
|
+
:additional_document2,
|
39
|
+
:additional_document3,
|
40
|
+
:tax_verification,
|
41
|
+
:financial_verification
|
15
42
|
end
|
16
43
|
end
|
17
44
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute settlement_country
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute target_countries
|
8
|
+
# @return [Array(String)]
|
9
|
+
# @!attribute annual_processing_volume
|
10
|
+
# @return [Integer]
|
11
|
+
# @!attribute average_transaction_value
|
12
|
+
# @return [Integer]
|
13
|
+
# @!attribute highest_transaction_value
|
14
|
+
# @return [Integer]
|
15
|
+
# @!attribute currency
|
16
|
+
# @return [CheckoutSdk::Common::Currency]
|
17
|
+
class ProcessingDetails
|
18
|
+
attr_accessor :settlement_country,
|
19
|
+
:target_countries,
|
20
|
+
:annual_processing_volume,
|
21
|
+
:average_transaction_value,
|
22
|
+
:highest_transaction_value,
|
23
|
+
:currency
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [ProofOfPrincipalAddressType]
|
7
|
+
# @!attribute front
|
8
|
+
# @return [String]
|
9
|
+
class ProofOfPrincipalAddress
|
10
|
+
attr_reader :type,
|
11
|
+
:front
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [ShareholderStructureType]
|
7
|
+
# @!attribute front
|
8
|
+
# @return [String]
|
9
|
+
class ShareholderStructure
|
10
|
+
attr_accessor :type,
|
11
|
+
:front
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'csv'
|
4
|
+
|
3
5
|
module CheckoutSdk
|
4
6
|
class ApiClient
|
5
7
|
attr_accessor :client, :multipart_client, :log
|
6
8
|
|
7
|
-
# @param [CheckoutConfiguration] configuration
|
8
|
-
# @param [String] uri
|
9
9
|
def initialize(configuration, uri)
|
10
10
|
@client = configuration.http_client.clone
|
11
11
|
@client.url_prefix = uri
|
@@ -14,42 +14,27 @@ module CheckoutSdk
|
|
14
14
|
@log = configuration.logger
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
# @param [SdkAuthorization] authorization
|
19
|
-
# @param [Object] params
|
20
|
-
def invoke_get(path,
|
21
|
-
authorization,
|
22
|
-
params = nil)
|
17
|
+
def invoke_get(path, authorization, params = nil)
|
23
18
|
invoke(:get, path, authorization, params: params)
|
24
19
|
end
|
25
20
|
|
26
|
-
def invoke_post(path,
|
27
|
-
authorization,
|
28
|
-
request = nil,
|
29
|
-
idempotency_key = nil)
|
21
|
+
def invoke_post(path, authorization, request = nil, idempotency_key = nil)
|
30
22
|
invoke(:post, path, authorization, request, idempotency_key)
|
31
23
|
end
|
32
24
|
|
33
|
-
def invoke_put(path,
|
34
|
-
authorization,
|
35
|
-
request)
|
25
|
+
def invoke_put(path, authorization, request)
|
36
26
|
invoke(:put, path, authorization, request)
|
37
27
|
end
|
38
28
|
|
39
|
-
def invoke_patch(path,
|
40
|
-
authorization,
|
41
|
-
request = nil)
|
29
|
+
def invoke_patch(path, authorization, request = nil)
|
42
30
|
invoke(:patch, path, authorization, request)
|
43
31
|
end
|
44
32
|
|
45
|
-
def invoke_delete(path,
|
46
|
-
authorization)
|
33
|
+
def invoke_delete(path, authorization)
|
47
34
|
invoke(:delete, path, authorization)
|
48
35
|
end
|
49
36
|
|
50
|
-
def submit_file(path,
|
51
|
-
authorization,
|
52
|
-
request)
|
37
|
+
def submit_file(path, authorization, request)
|
53
38
|
upload(path, authorization, request)
|
54
39
|
end
|
55
40
|
|
@@ -58,7 +43,7 @@ module CheckoutSdk
|
|
58
43
|
def invoke(method, path, authorization, body = nil, idempotency_key = nil, params: nil)
|
59
44
|
path = append_params(path, params) unless params.nil?
|
60
45
|
|
61
|
-
headers =
|
46
|
+
headers = default_headers(authorization)
|
62
47
|
headers[:'Content-Type'] = 'application/json'
|
63
48
|
headers[:'Cko-Idempotency-Key'] = idempotency_key unless idempotency_key.nil?
|
64
49
|
|
@@ -71,26 +56,23 @@ module CheckoutSdk
|
|
71
56
|
raise CheckoutApiException, e.response
|
72
57
|
end
|
73
58
|
|
74
|
-
parse_response
|
59
|
+
parse_response(response)
|
75
60
|
end
|
76
61
|
|
77
|
-
def
|
78
|
-
{
|
79
|
-
|
80
|
-
Accept: 'application/json',
|
81
|
-
Authorization: authorization.authorization_header
|
82
|
-
}
|
62
|
+
def default_headers(authorization)
|
63
|
+
{ 'User-Agent': "checkout-sdk-ruby/#{VERSION}", Accept: 'application/json',
|
64
|
+
Authorization: authorization.authorization_header }
|
83
65
|
end
|
84
66
|
|
85
67
|
def append_params(path, input_params)
|
86
68
|
raise CheckoutArgumentException, 'Query parameters were not provided' if input_params.nil?
|
87
69
|
|
88
|
-
if input_params.is_a? String
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
70
|
+
params = if input_params.is_a? String
|
71
|
+
input_params
|
72
|
+
else
|
73
|
+
hash = CheckoutSdk::JsonSerializer.to_custom_hash(input_params)
|
74
|
+
URI.encode_www_form(hash)
|
75
|
+
end
|
94
76
|
|
95
77
|
"#{path}?#{params}"
|
96
78
|
end
|
@@ -103,16 +85,16 @@ module CheckoutSdk
|
|
103
85
|
MIME::Types.type_for(file_request.file).first,
|
104
86
|
File.basename(file_request.file)
|
105
87
|
),
|
106
|
-
:
|
88
|
+
purpose: file_request.purpose
|
107
89
|
}
|
108
90
|
end
|
109
91
|
|
110
92
|
def upload(path, authorization, file_request)
|
111
|
-
headers =
|
93
|
+
headers = default_headers(authorization)
|
112
94
|
|
113
95
|
file = File.open(file_request.file)
|
114
96
|
|
115
|
-
form = build_multipart_request
|
97
|
+
form = build_multipart_request(file_request, file)
|
116
98
|
|
117
99
|
begin
|
118
100
|
@log.info "post: /#{path}"
|
@@ -123,28 +105,55 @@ module CheckoutSdk
|
|
123
105
|
file.close
|
124
106
|
end
|
125
107
|
|
126
|
-
parse_response
|
108
|
+
parse_response(response)
|
127
109
|
end
|
128
110
|
|
129
111
|
def parse_response(response)
|
130
|
-
raise CheckoutApiException, response if response.status < 200 || response.status >=
|
112
|
+
raise CheckoutApiException, response if response.status < 200 || response.status >= 300
|
131
113
|
|
132
114
|
metadata = CheckoutUtils.map_to_http_metadata(response)
|
133
|
-
body =
|
134
|
-
|
135
|
-
|
136
|
-
|
115
|
+
body = parse_body(response)
|
116
|
+
|
117
|
+
if body.is_a?(Array)
|
118
|
+
body = OpenStruct.new(items: body)
|
119
|
+
elsif !body.is_a?(OpenStruct)
|
120
|
+
body = OpenStruct.new(contents: body)
|
121
|
+
end
|
122
|
+
|
123
|
+
body.http_metadata = metadata if body.is_a?(OpenStruct)
|
124
|
+
|
137
125
|
body
|
126
|
+
rescue JSON::ParserError => e
|
127
|
+
raise CheckoutApiException.new(response, "Error parsing JSON: #{e.message}")
|
128
|
+
rescue StandardError => e
|
129
|
+
@log&.error("Unexpected error occurred: #{e.message}")
|
130
|
+
raise
|
138
131
|
end
|
139
132
|
|
140
|
-
def
|
141
|
-
|
133
|
+
def parse_body(response)
|
134
|
+
content_type = response.headers['Content-Type']
|
135
|
+
return OpenStruct.new if response.body.nil? || response.body.empty?
|
142
136
|
|
143
|
-
if
|
144
|
-
JSON.parse(response.body
|
137
|
+
if content_type&.include?('application/json')
|
138
|
+
parsed_value = JSON.parse(response.body)
|
139
|
+
deep_convert_to_ostruct(parsed_value)
|
140
|
+
elsif content_type&.include?('text/csv')
|
141
|
+
csv_data = CSV.parse(response.body, headers: true)
|
142
|
+
OpenStruct.new(csv: csv_data)
|
145
143
|
else
|
146
144
|
OpenStruct.new(contents: response.body)
|
147
145
|
end
|
148
146
|
end
|
147
|
+
|
148
|
+
def deep_convert_to_ostruct(obj)
|
149
|
+
case obj
|
150
|
+
when Hash
|
151
|
+
OpenStruct.new(obj.transform_values { |value| deep_convert_to_ostruct(value) })
|
152
|
+
when Array
|
153
|
+
obj.map { |item| deep_convert_to_ostruct(item) }
|
154
|
+
else
|
155
|
+
obj
|
156
|
+
end
|
157
|
+
end
|
149
158
|
end
|
150
159
|
end
|
data/lib/checkout_sdk/client.rb
CHANGED
@@ -11,7 +11,8 @@ module CheckoutSdk
|
|
11
11
|
attr_reader :api_client,
|
12
12
|
:authorization_type,
|
13
13
|
:configuration
|
14
|
-
|
14
|
+
|
15
|
+
protected
|
15
16
|
|
16
17
|
# @param [CheckoutSdk::ApiClient] api_client
|
17
18
|
# @param [CheckoutConfiguration] configuration
|
@@ -22,8 +23,6 @@ module CheckoutSdk
|
|
22
23
|
@configuration = configuration
|
23
24
|
end
|
24
25
|
|
25
|
-
protected
|
26
|
-
|
27
26
|
# @param [Array] args
|
28
27
|
def build_path(*args)
|
29
28
|
args.join('/')
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Common
|
5
|
+
class AccountChangeIndicatorType
|
6
|
+
THIS_TRANSACTION = 'this_transaction'
|
7
|
+
LESS_THAN_THIRTY_DAYS = 'less_than_thirty_days'
|
8
|
+
THIRTY_TO_SIXTY_DAYS = 'thirty_to_sixty_days'
|
9
|
+
MORE_THAN_SIXTY_DAYS = 'more_than_sixty_days'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -4,7 +4,7 @@ module CheckoutSdk
|
|
4
4
|
module Common
|
5
5
|
# @!attribute type
|
6
6
|
# @return [String] {AccountHolderType}
|
7
|
-
# @!attribute
|
7
|
+
# @!attribute full_name
|
8
8
|
# @return [String]
|
9
9
|
# @!attribute first_name
|
10
10
|
# @return [String]
|
@@ -21,7 +21,7 @@ module CheckoutSdk
|
|
21
21
|
# @!attribute country_of_birth
|
22
22
|
# @return [Country]
|
23
23
|
# @!attribute residential_status
|
24
|
-
# @return [String]
|
24
|
+
# @return [String] {ResidentialStatusType}
|
25
25
|
# @!attribute billing_address
|
26
26
|
# @return [Address]
|
27
27
|
# @!attribute phone
|
@@ -32,9 +32,11 @@ module CheckoutSdk
|
|
32
32
|
# @return [String]
|
33
33
|
# @!attribute gender
|
34
34
|
# @return [String]
|
35
|
+
# @!attribute account_name_inquiry
|
36
|
+
# @return [Boolean]
|
35
37
|
class AccountHolder
|
36
38
|
attr_accessor :type,
|
37
|
-
:
|
39
|
+
:full_name,
|
38
40
|
:first_name,
|
39
41
|
:middle_name,
|
40
42
|
:last_name,
|
@@ -47,7 +49,8 @@ module CheckoutSdk
|
|
47
49
|
:phone,
|
48
50
|
:identification,
|
49
51
|
:email,
|
50
|
-
:gender
|
52
|
+
:gender,
|
53
|
+
:account_name_inquiry
|
51
54
|
end
|
52
55
|
end
|
53
56
|
end
|