checkout_sdk 1.0.0.beta.0 → 1.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/README.md +57 -0
- data/lib/checkout_sdk/abstract_checkout_sdk_builder.rb +25 -4
- data/lib/checkout_sdk/accounts/account_holder.rb +35 -0
- data/lib/checkout_sdk/accounts/accounts.rb +30 -0
- data/lib/checkout_sdk/accounts/accounts_client.rb +65 -0
- data/lib/checkout_sdk/accounts/business_type.rb +15 -0
- data/lib/checkout_sdk/accounts/company.rb +35 -0
- data/lib/checkout_sdk/accounts/contact_details.rb +14 -0
- data/lib/checkout_sdk/accounts/date_of_birth.rb +17 -0
- data/lib/checkout_sdk/accounts/document.rb +17 -0
- data/lib/checkout_sdk/accounts/document_type.rb +14 -0
- data/lib/checkout_sdk/accounts/entity_document.rb +14 -0
- data/lib/checkout_sdk/accounts/entity_email_addresses.rb +11 -0
- data/lib/checkout_sdk/accounts/entity_financial_details.rb +20 -0
- data/lib/checkout_sdk/accounts/entity_financial_documents.rb +14 -0
- data/lib/checkout_sdk/accounts/file_request.rb +8 -0
- data/lib/checkout_sdk/accounts/identification.rb +14 -0
- data/lib/checkout_sdk/accounts/individual.rb +38 -0
- data/lib/checkout_sdk/accounts/instrument_document.rb +14 -0
- data/lib/checkout_sdk/accounts/onboard_entity.rb +23 -0
- data/lib/checkout_sdk/accounts/payment_instrument.rb +50 -0
- data/lib/checkout_sdk/accounts/phone.rb +11 -0
- data/lib/checkout_sdk/accounts/place_of_birth.rb +11 -0
- data/lib/checkout_sdk/accounts/profile.rb +17 -0
- data/lib/checkout_sdk/accounts/representative.rb +35 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_daily.rb +11 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_monthly.rb +15 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_type.rb +11 -0
- data/lib/checkout_sdk/accounts/schedule_frequency_weekly.rb +15 -0
- data/lib/checkout_sdk/accounts/schedule_request.rb +19 -0
- data/lib/checkout_sdk/accounts/update_schedule.rb +17 -0
- data/lib/checkout_sdk/api_client.rb +17 -22
- data/lib/checkout_sdk/apm/apm.rb +0 -1
- data/lib/checkout_sdk/apm/previous/klarna/credit_session_request.rb +19 -21
- data/lib/checkout_sdk/apm/previous/klarna/klarna.rb +13 -15
- data/lib/checkout_sdk/apm/previous/klarna/klarna_client.rb +43 -45
- data/lib/checkout_sdk/apm/previous/klarna/klarna_product.rb +19 -21
- data/lib/checkout_sdk/apm/previous/klarna/order_capture_request.rb +24 -26
- data/lib/checkout_sdk/apm/previous/sepa/sepa_client.rb +25 -27
- data/lib/checkout_sdk/checkout_api.rb +28 -2
- data/lib/checkout_sdk/checkout_configuration.rb +6 -4
- data/lib/checkout_sdk/checkout_oauth_sdk_builder.rb +3 -1
- data/lib/checkout_sdk/checkout_static_keys_sdk_builder.rb +2 -1
- data/lib/checkout_sdk/checkout_utils.rb +28 -4
- data/lib/checkout_sdk/common/account_holder.rb +4 -1
- data/lib/checkout_sdk/common/common.rb +3 -1
- data/lib/checkout_sdk/common/file_request.rb +5 -2
- data/lib/checkout_sdk/common/marketplace_data.rb +14 -0
- data/lib/checkout_sdk/common/payment_source_type.rb +1 -0
- data/lib/checkout_sdk/common/product.rb +17 -0
- data/lib/checkout_sdk/common/shipping_info.rb +29 -0
- data/lib/checkout_sdk/customers/customer_request.rb +2 -2
- data/lib/checkout_sdk/disputes/disputes_client.rb +5 -0
- data/lib/checkout_sdk/disputes/disputes_query_filter.rb +3 -3
- data/lib/checkout_sdk/instruments/base_instruments_client.rb +20 -0
- data/lib/checkout_sdk/instruments/{update/update_instrument_request.rb → create/instrument.rb} +3 -1
- data/lib/checkout_sdk/instruments/create/{instrument_bank_account_request.rb → instrument_bank_account.rb} +1 -1
- data/lib/checkout_sdk/instruments/create/{instrument_token_request.rb → instrument_token.rb} +1 -1
- data/lib/checkout_sdk/instruments/instruments.rb +14 -7
- data/lib/checkout_sdk/instruments/instruments_client.rb +4 -15
- data/lib/checkout_sdk/instruments/previous/create/instrument.rb +26 -0
- data/lib/checkout_sdk/instruments/previous/instruments_client.rb +28 -0
- data/lib/checkout_sdk/instruments/previous/update/update_instrument.rb +25 -0
- data/lib/checkout_sdk/instruments/{create/instrument_request.rb → update/update_instrument.rb} +3 -1
- data/lib/checkout_sdk/instruments/update/{update_instrument_bank_account_request.rb → update_instrument_bank_account.rb} +1 -1
- data/lib/checkout_sdk/instruments/update/{update_instrument_card_request.rb → update_instrument_card.rb} +1 -1
- data/lib/checkout_sdk/instruments/update/{update_instrument_token_request.rb → update_instrument_token.rb} +1 -1
- data/lib/checkout_sdk/oauth_scopes.rb +2 -0
- data/lib/checkout_sdk/oauth_sdk_credentials.rb +5 -13
- data/lib/checkout_sdk/payments/base_payments_client.rb +46 -0
- data/lib/checkout_sdk/payments/billing_information.rb +14 -0
- data/lib/checkout_sdk/payments/billing_plan.rb +17 -0
- data/lib/checkout_sdk/payments/billing_plan_type.rb +14 -0
- data/lib/checkout_sdk/payments/capture_request.rb +4 -0
- data/lib/checkout_sdk/payments/destination/destination.rb +1 -1
- data/lib/checkout_sdk/payments/hosted/hosted_payments_client.rb +25 -0
- data/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb +87 -0
- data/lib/checkout_sdk/payments/links/payment_link.rb +84 -0
- data/lib/checkout_sdk/payments/links/payments_links_client.rb +25 -0
- data/lib/checkout_sdk/payments/payment_request.rb +5 -1
- data/lib/checkout_sdk/payments/payment_type.rb +0 -1
- data/lib/checkout_sdk/payments/payments.rb +92 -23
- data/lib/checkout_sdk/payments/payments_client.rb +1 -36
- data/lib/checkout_sdk/payments/payments_query_filter.rb +17 -0
- data/lib/checkout_sdk/payments/payout_request.rb +1 -1
- data/lib/checkout_sdk/payments/previous/capture_request.rb +19 -0
- data/lib/checkout_sdk/payments/previous/destination/card_destination.rb +38 -0
- data/lib/checkout_sdk/payments/previous/destination/destination.rb +21 -0
- data/lib/checkout_sdk/payments/previous/destination/id_destination.rb +23 -0
- data/lib/checkout_sdk/payments/previous/destination/token_destination.rb +29 -0
- data/lib/checkout_sdk/payments/previous/fund_transfer_type.rb +17 -0
- data/lib/checkout_sdk/payments/previous/payment_request.rb +73 -0
- data/lib/checkout_sdk/payments/previous/payments_client.rb +43 -0
- data/lib/checkout_sdk/payments/previous/payout_request.rb +70 -0
- data/lib/checkout_sdk/payments/previous/source/apm/alipay_source.rb +13 -0
- data/lib/checkout_sdk/payments/previous/source/apm/alma_source.rb +23 -0
- data/lib/checkout_sdk/payments/previous/source/apm/bancontact_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/benefit_pay_source.rb +17 -0
- data/lib/checkout_sdk/payments/previous/source/apm/boleto_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/eps_source.rb +20 -0
- data/lib/checkout_sdk/payments/previous/source/apm/fawry_source.rb +47 -0
- data/lib/checkout_sdk/payments/previous/source/apm/giropay_source.rb +32 -0
- data/lib/checkout_sdk/payments/previous/source/apm/ideal_source.rb +23 -0
- data/lib/checkout_sdk/payments/previous/source/apm/integration_type.rb +12 -0
- data/lib/checkout_sdk/payments/previous/source/apm/klarna_source.rb +56 -0
- data/lib/checkout_sdk/payments/previous/source/apm/knet_source.rb +38 -0
- data/lib/checkout_sdk/payments/previous/source/apm/multi_banco_source.rb +23 -0
- data/lib/checkout_sdk/payments/previous/source/apm/oxxo_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/p24_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/pago_facil_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/paypal_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/poli_source.rb +13 -0
- data/lib/checkout_sdk/payments/previous/source/apm/qpay_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/rapi_pago_source.rb +26 -0
- data/lib/checkout_sdk/payments/previous/source/apm/sofort_source.rb +20 -0
- data/lib/checkout_sdk/payments/previous/source/card_source.rb +41 -0
- data/lib/checkout_sdk/payments/previous/source/customer_source.rb +17 -0
- data/lib/checkout_sdk/payments/previous/source/d_local_source.rb +41 -0
- data/lib/checkout_sdk/payments/previous/source/id_source.rb +20 -0
- data/lib/checkout_sdk/payments/previous/source/network_token_source.rb +47 -0
- data/lib/checkout_sdk/payments/previous/source/payment_source.rb +21 -0
- data/lib/checkout_sdk/payments/previous/source/token_source.rb +26 -0
- data/lib/checkout_sdk/payments/processing_settings.rb +15 -0
- data/lib/checkout_sdk/payments/sender/corporate_sender.rb +1 -1
- data/lib/checkout_sdk/payments/sender/government_sender.rb +1 -1
- data/lib/checkout_sdk/payments/sender/individual_sender.rb +1 -1
- data/lib/checkout_sdk/payments/sender/sender.rb +2 -2
- data/lib/checkout_sdk/payments/source/apm/after_pay_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/alipay_plus_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/alma_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/apm/bancontact_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/benefit_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/eps_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/fawry_product.rb +20 -0
- data/lib/checkout_sdk/payments/source/apm/fawry_source.rb +30 -0
- data/lib/checkout_sdk/payments/source/apm/giropay_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/ideal_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/klarna_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/apm/knet_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/mbway_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/multi_banco_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/p24_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/paypal_source.rb +5 -1
- data/lib/checkout_sdk/payments/source/apm/post_finance_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/qpay_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/sofort_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/stcpay_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/tamara_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/apm/we_chat_pay_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/bank_account_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/card_source.rb +3 -3
- data/lib/checkout_sdk/payments/source/currency_account_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/customer_source.rb +15 -0
- data/lib/checkout_sdk/payments/source/id_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/network_token_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/{payment_request_source.rb → payment_source.rb} +2 -1
- data/lib/checkout_sdk/payments/source/{payout_request_source.rb → payout_source.rb} +3 -3
- data/lib/checkout_sdk/payments/source/provider_token_source.rb +1 -1
- data/lib/checkout_sdk/payments/source/token_source.rb +1 -1
- data/lib/checkout_sdk/payments/three_ds_request.rb +7 -1
- data/lib/checkout_sdk/previous/checkout_api.rb +37 -5
- data/lib/checkout_sdk/previous/checkout_previous_static_keys_sdk_builder.rb +2 -1
- data/lib/checkout_sdk/reports/reports.rb +4 -0
- data/lib/checkout_sdk/reports/reports_client.rb +26 -0
- data/lib/checkout_sdk/reports/reports_query.rb +23 -0
- data/lib/checkout_sdk/sources/mandate_type.rb +12 -0
- data/lib/checkout_sdk/sources/sepa_source_request.rb +20 -0
- data/lib/checkout_sdk/sources/source_data.rb +28 -0
- data/lib/checkout_sdk/sources/source_request.rb +30 -0
- data/lib/checkout_sdk/sources/source_type.rb +11 -0
- data/lib/checkout_sdk/sources/sources.rb +9 -0
- data/lib/checkout_sdk/sources/sources_client.rb +23 -0
- data/lib/checkout_sdk/tokens/card_token_request.rb +2 -2
- data/lib/checkout_sdk/tokens/wallet_token_request.rb +1 -1
- data/lib/checkout_sdk/version.rb +1 -1
- data/lib/checkout_sdk/workflows/create_workflow.rb +20 -0
- data/lib/checkout_sdk/workflows/entity_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/event_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/patch_workflow.rb +14 -0
- data/lib/checkout_sdk/workflows/processing_channel_workflow_condition.rb +15 -0
- data/lib/checkout_sdk/workflows/reflow.rb +11 -0
- data/lib/checkout_sdk/workflows/reflow_by_events.rb +11 -0
- data/lib/checkout_sdk/workflows/reflow_by_subjects.rb +11 -0
- data/lib/checkout_sdk/workflows/webhook_signature.rb +14 -0
- data/lib/checkout_sdk/workflows/webhook_workflow_action.rb +21 -0
- data/lib/checkout_sdk/workflows/workflow_action.rb +19 -0
- data/lib/checkout_sdk/workflows/workflow_action_type.rb +9 -0
- data/lib/checkout_sdk/workflows/workflow_condition.rb +19 -0
- data/lib/checkout_sdk/workflows/workflow_condition_type.rb +11 -0
- data/lib/checkout_sdk/workflows/workflows.rb +18 -0
- data/lib/checkout_sdk/workflows/workflows_client.rb +115 -0
- data/lib/checkout_sdk.rb +6 -0
- metadata +124 -13
- data/lib/checkout_sdk/apm/previous/klarna/klarna_shipping_info.rb +0 -33
- data/lib/checkout_sdk/common/abstract_file_request.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4986ebc42cf3d03320a66dcaaed808ab1bac043d80cfaa6a67ecc4ba3412fab5
|
4
|
+
data.tar.gz: 954c730bb43ea3cb5b48479879ef602d87312dbbf182ae0d03e97b14b4ecdccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ab5a0ca6991b63ce2eac3d8084009d4fe9e465908db604c795e6f7c5f53c0b64fbc6b45fb7d29aeaacb604e49a8f5d0c2d8f04522bf1fe3db7e7139b42a80de
|
7
|
+
data.tar.gz: c19f5b743b9b51c8f375c980d018b30461aeabee0ae4a5d57536374360cb465aad61d355dd70a30d03e39c6f66ec0f1530aa31938991fb1bfd6d632a30cfb744
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -113,6 +113,63 @@ All the API responses that do not fall in the 2** status codes will cause a `Che
|
|
113
113
|
exception
|
114
114
|
encapsulates the `http_metadata` and a map of `error_details`, if available.
|
115
115
|
|
116
|
+
## Custom Http Client
|
117
|
+
|
118
|
+
Ruby SDK supports your own configuration for `http client` using `Faraday::Connection` object, you can pass
|
119
|
+
through the
|
120
|
+
SDK instantiation as follows:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
http_client = Faraday.new do |conn|
|
124
|
+
conn.options.timeout = 10
|
125
|
+
conn.proxy "http://localhost:8080"
|
126
|
+
end
|
127
|
+
|
128
|
+
api = CheckoutSdk.builder
|
129
|
+
.static_keys
|
130
|
+
.with_secret_key('secret_key')
|
131
|
+
.with_public_key('public_key') # optional, only required for operations related with tokens
|
132
|
+
.with_environment(CheckoutSdk::Environment.sandbox)
|
133
|
+
.with_http_client(http_client)
|
134
|
+
.build
|
135
|
+
```
|
136
|
+
|
137
|
+
You don't need to specify the URL for Faraday constructor the SDK grabs the belong URI from `CheckoutSdk::Environment`
|
138
|
+
however if you want to
|
139
|
+
use specific URI's without a proxy you can create the `Environment` object as follows.
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
environment = CheckoutSdk::Environment.new('https://the.base.uri/', # the uri for all CKO operations
|
143
|
+
'https://the.oauth.uri/connect/token', # the uri used for OAUTH authorization, only required for OAuth operations
|
144
|
+
'https://the.files.uri/', # the uri used for Files operations, only required for Accounts module
|
145
|
+
'https://the.transfers.uri/', # the uri used for Transfer operations, only required for Transfers module
|
146
|
+
'https://the.balances.uri/', # the uri used for Balances operations, only required for Balances module
|
147
|
+
false)
|
148
|
+
```
|
149
|
+
|
150
|
+
If you want to provide your own `http client` and wants to use the `upload_file` functionality from `Disputes` or `Accounts` modules, you
|
151
|
+
also need to specify the custom `http client` for `multipart requests`:
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
http_client = Faraday.new do |conn|
|
155
|
+
conn.options.timeout = 10
|
156
|
+
conn.proxy "http://localhost:8080"
|
157
|
+
end
|
158
|
+
|
159
|
+
multipart_client = Faraday.new do |f|
|
160
|
+
f.request :multipart
|
161
|
+
end
|
162
|
+
|
163
|
+
api = CheckoutSdk.builder
|
164
|
+
.static_keys
|
165
|
+
.with_secret_key('secret_key')
|
166
|
+
.with_public_key('public_key') # optional, only required for operations related with tokens
|
167
|
+
.with_environment(CheckoutSdk::Environment.sandbox)
|
168
|
+
.with_http_client(http_client)
|
169
|
+
.with_multipart_http_client(multipart_client)
|
170
|
+
.build
|
171
|
+
```
|
172
|
+
|
116
173
|
## Building from source
|
117
174
|
|
118
175
|
Once you check out the code from GitHub, the project can be built using gem:
|
@@ -5,8 +5,10 @@ module CheckoutSdk
|
|
5
5
|
# @!attribute environment
|
6
6
|
# @return [Environment]
|
7
7
|
# @!attribute http_client
|
8
|
-
# @return [
|
9
|
-
|
8
|
+
# @return [Faraday::Connection]
|
9
|
+
# @!attribute multipart_http_client
|
10
|
+
# @return [Faraday::Connection]
|
11
|
+
attr_accessor :environment, :http_client, :multipart_http_client
|
10
12
|
|
11
13
|
# @param [Environment] environment
|
12
14
|
def with_environment(environment)
|
@@ -14,15 +16,34 @@ module CheckoutSdk
|
|
14
16
|
self
|
15
17
|
end
|
16
18
|
|
19
|
+
# @param [Faraday::Connection] http_client
|
17
20
|
def with_http_client(http_client)
|
18
21
|
@http_client = http_client
|
19
22
|
self
|
20
23
|
end
|
21
24
|
|
25
|
+
# @param [Faraday::Connection] multipart_http_client
|
26
|
+
def with_multipart_http_client(multipart_http_client)
|
27
|
+
@multipart_http_client = multipart_http_client
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
22
31
|
def build
|
23
32
|
with_environment(Environment.sandbox) if environment.nil?
|
24
|
-
|
25
|
-
|
33
|
+
if http_client.nil?
|
34
|
+
@http_client = CheckoutUtils.build_default_client
|
35
|
+
else
|
36
|
+
unless @http_client.instance_of?(Faraday::Connection)
|
37
|
+
raise CheckoutArgumentException, 'http_client must be an instance of Faraday::Connection'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
if multipart_http_client.nil?
|
41
|
+
@multipart_http_client = CheckoutUtils.build_multipart_client
|
42
|
+
else
|
43
|
+
unless @multipart_http_client.instance_of?(Faraday::Connection)
|
44
|
+
raise CheckoutArgumentException, 'multipart_http_client must be an instance of Faraday::Connection'
|
45
|
+
end
|
46
|
+
end
|
26
47
|
end
|
27
48
|
end
|
28
49
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [String] {CheckoutSdk::Common::AccountHolderType}
|
7
|
+
# @!attribute tax_id
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute date_of_birth
|
10
|
+
# @return [DateOfBirth]
|
11
|
+
# @!attribute country_of_birth
|
12
|
+
# @return [String] {CheckoutSdk::Common::Country}
|
13
|
+
# @!attribute residential_status
|
14
|
+
# @return [String]
|
15
|
+
# @!attribute billing_address
|
16
|
+
# @return [CheckoutSdk::Common::Address]
|
17
|
+
# @!attribute phone
|
18
|
+
# @return [Phone]
|
19
|
+
# @!attribute identification
|
20
|
+
# @return [CheckoutSdk::Common::AccountHolderIdentification]
|
21
|
+
# @!attribute email
|
22
|
+
# @return [String]
|
23
|
+
class AccountHolder
|
24
|
+
attr_accessor :type,
|
25
|
+
:tax_id,
|
26
|
+
:date_of_birth,
|
27
|
+
:country_of_birth,
|
28
|
+
:residential_status,
|
29
|
+
:billing_address,
|
30
|
+
:phone,
|
31
|
+
:identification,
|
32
|
+
:email
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'checkout_sdk/accounts/update_schedule'
|
4
|
+
require 'checkout_sdk/accounts/instrument_document'
|
5
|
+
require 'checkout_sdk/accounts/schedule_frequency_type'
|
6
|
+
require 'checkout_sdk/accounts/identification'
|
7
|
+
require 'checkout_sdk/accounts/document'
|
8
|
+
require 'checkout_sdk/accounts/individual'
|
9
|
+
require 'checkout_sdk/accounts/business_type'
|
10
|
+
require 'checkout_sdk/accounts/account_holder'
|
11
|
+
require 'checkout_sdk/accounts/entity_financial_details'
|
12
|
+
require 'checkout_sdk/accounts/file_request'
|
13
|
+
require 'checkout_sdk/accounts/date_of_birth'
|
14
|
+
require 'checkout_sdk/accounts/onboard_entity'
|
15
|
+
require 'checkout_sdk/accounts/representative'
|
16
|
+
require 'checkout_sdk/accounts/place_of_birth'
|
17
|
+
require 'checkout_sdk/accounts/payment_instrument'
|
18
|
+
require 'checkout_sdk/accounts/entity_document'
|
19
|
+
require 'checkout_sdk/accounts/profile'
|
20
|
+
require 'checkout_sdk/accounts/accounts_client'
|
21
|
+
require 'checkout_sdk/accounts/entity_financial_documents'
|
22
|
+
require 'checkout_sdk/accounts/document_type'
|
23
|
+
require 'checkout_sdk/accounts/company'
|
24
|
+
require 'checkout_sdk/accounts/phone'
|
25
|
+
require 'checkout_sdk/accounts/contact_details'
|
26
|
+
require 'checkout_sdk/accounts/entity_email_addresses'
|
27
|
+
require 'checkout_sdk/accounts/schedule_request'
|
28
|
+
require 'checkout_sdk/accounts/schedule_frequency_weekly'
|
29
|
+
require 'checkout_sdk/accounts/schedule_frequency_daily'
|
30
|
+
require 'checkout_sdk/accounts/schedule_frequency_monthly'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
class AccountsClient < Client
|
6
|
+
attr_reader :files_client
|
7
|
+
|
8
|
+
ACCOUNTS = 'accounts'
|
9
|
+
ENTITIES = 'entities'
|
10
|
+
INSTRUMENT = 'instruments'
|
11
|
+
PAYOUT_SCHEDULE = 'payout-schedules'
|
12
|
+
FILES = 'files'
|
13
|
+
private_constant :ACCOUNTS, :ENTITIES, :INSTRUMENT, :PAYOUT_SCHEDULE, :FILES
|
14
|
+
|
15
|
+
# @param [ApiClient] api_client
|
16
|
+
# @param [ApiClient] files_client
|
17
|
+
# @param [CheckoutConfiguration] configuration
|
18
|
+
def initialize(api_client, files_client, configuration)
|
19
|
+
super(api_client, configuration, CheckoutSdk::AuthorizationType::OAUTH)
|
20
|
+
@files_client = files_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param [OnboardEntity] entity_request
|
24
|
+
def create_entity(entity_request)
|
25
|
+
api_client.invoke_post(build_path(ACCOUNTS, ENTITIES), sdk_authorization, entity_request)
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [String] entity_id
|
29
|
+
def get_entity(entity_id)
|
30
|
+
api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id), sdk_authorization)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param [String] entity_id
|
34
|
+
# @param [OnboardEntity] entity_request
|
35
|
+
def update_entity(entity_id, entity_request)
|
36
|
+
api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id), sdk_authorization, entity_request)
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] entity_id
|
40
|
+
# @param [PaymentInstrument] payment_instrument
|
41
|
+
def create_payment_instrument(entity_id, payment_instrument)
|
42
|
+
api_client.invoke_post(build_path(ACCOUNTS, ENTITIES, entity_id, INSTRUMENT), sdk_authorization,
|
43
|
+
payment_instrument)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [String] entity_id
|
47
|
+
# @param [String] currency {CheckoutSdk::Common::Currency}
|
48
|
+
# @param [UpdateSchedule] update_schedule
|
49
|
+
def update_payout_schedule(entity_id, currency, update_schedule)
|
50
|
+
api_client.invoke_put(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), sdk_authorization,
|
51
|
+
{ currency => update_schedule })
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param [String] entity_id
|
55
|
+
def retrieve_payout_schedule(entity_id)
|
56
|
+
api_client.invoke_get(build_path(ACCOUNTS, ENTITIES, entity_id, PAYOUT_SCHEDULE), sdk_authorization)
|
57
|
+
end
|
58
|
+
|
59
|
+
# @param [FileRequest] file_request
|
60
|
+
def upload_file(file_request)
|
61
|
+
files_client.submit_file(FILES, sdk_authorization, file_request)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
module BusinessType
|
6
|
+
GENERAL_PARTNERSHIP = 'general_partnership'
|
7
|
+
LIMITED_PARTNERSHIP = 'limited_partnership'
|
8
|
+
PUBLIC_LIMITED_COMPANY = 'public_limited_company'
|
9
|
+
LIMITED_COMPANY = 'limited_company'
|
10
|
+
PROFESSIONAL_ASSOCIATION = 'professional_association'
|
11
|
+
UNINCORPORATED_ASSOCIATION = 'unincorporated_association'
|
12
|
+
AUTO_ENTREPRENEUR = 'auto_entrepreneur'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute business_registration_number
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute business_type
|
8
|
+
# @return [String] {BusinessType}
|
9
|
+
# @!attribute legal_name
|
10
|
+
# @return [String]
|
11
|
+
# @!attribute trading_name
|
12
|
+
# @return [String]
|
13
|
+
# @!attribute principal_address
|
14
|
+
# @return [CheckoutSdk::Common::Address]
|
15
|
+
# @!attribute registered_address
|
16
|
+
# @return [CheckoutSdk::Common::Address]
|
17
|
+
# @!attribute representatives
|
18
|
+
# @return [Array(Representative)]
|
19
|
+
# @!attribute document
|
20
|
+
# @return [EntityDocument]
|
21
|
+
# @!attribute financial_details
|
22
|
+
# @return [EntityFinancialDetails]
|
23
|
+
class Company
|
24
|
+
attr_accessor :business_registration_number,
|
25
|
+
:business_type,
|
26
|
+
:legal_name,
|
27
|
+
:trading_name,
|
28
|
+
:principal_address,
|
29
|
+
:registered_address,
|
30
|
+
:representatives,
|
31
|
+
:document,
|
32
|
+
:financial_details
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute phone
|
6
|
+
# @return [Phone]
|
7
|
+
# @!attribute email_addresses
|
8
|
+
# @return [EntityEmailAddresses]
|
9
|
+
class ContactDetails
|
10
|
+
attr_accessor :phone,
|
11
|
+
:email_addresses
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute day
|
6
|
+
# @return [Integer]
|
7
|
+
# @!attribute month
|
8
|
+
# @return [Integer]
|
9
|
+
# @!attribute year
|
10
|
+
# @return [Integer]
|
11
|
+
class DateOfBirth
|
12
|
+
attr_accessor :day,
|
13
|
+
:month,
|
14
|
+
:year
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [String] {DocumentType}
|
7
|
+
# @!attribute front
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute back
|
10
|
+
# @return [String]
|
11
|
+
class Document
|
12
|
+
attr_accessor :type,
|
13
|
+
:front,
|
14
|
+
:back
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
module DocumentType
|
6
|
+
PASSPORT = 'passport'
|
7
|
+
NATIONAL_IDENTITY_CARD = 'national_identity_card'
|
8
|
+
DRIVING_LICENSE = 'driving_license'
|
9
|
+
CITIZEN_CARD = 'citizen_card'
|
10
|
+
RESIDENCE_PERMIT = 'residence_permit'
|
11
|
+
ELECTORAL_ID = 'electoral_id'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute annual_processing_volume
|
6
|
+
# @return [Integer]
|
7
|
+
# @!attribute average_transaction_value
|
8
|
+
# @return [Integer]
|
9
|
+
# @!attribute highest_transaction_value
|
10
|
+
# @return [Integer]
|
11
|
+
# @!attribute documents
|
12
|
+
# @return [EntityFinancialDocuments]
|
13
|
+
class EntityFinancialDetails
|
14
|
+
attr_accessor :annual_processing_volume,
|
15
|
+
:average_transaction_value,
|
16
|
+
:highest_transaction_value,
|
17
|
+
:documents
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute bank_statement
|
6
|
+
# @return [EntityDocument]
|
7
|
+
# @!attribute financial_statement
|
8
|
+
# @return [EntityDocument]
|
9
|
+
class EntityFinancialDocuments
|
10
|
+
attr_accessor :bank_statement,
|
11
|
+
:financial_statement
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute national_id_number
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute document
|
8
|
+
# @return [Document]
|
9
|
+
class Identification
|
10
|
+
attr_accessor :national_id_number,
|
11
|
+
:document
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute first_name
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute middle_name
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute last_name
|
10
|
+
# @return [String]
|
11
|
+
# @!attribute legal_name
|
12
|
+
# @return [String]
|
13
|
+
# @!attribute trading_name
|
14
|
+
# @return [String]
|
15
|
+
# @!attribute national_tax_id
|
16
|
+
# @return [String]
|
17
|
+
# @!attribute registered_address
|
18
|
+
# @return [CheckoutSdk::Common::Address]
|
19
|
+
# @!attribute date_of_birth
|
20
|
+
# @return [DateOfBirth]
|
21
|
+
# @!attribute place_of_birth
|
22
|
+
# @return [PlaceOfBirth]
|
23
|
+
# @!attribute identification
|
24
|
+
# @return [Identification]
|
25
|
+
class Individual
|
26
|
+
attr_accessor :first_name,
|
27
|
+
:middle_name,
|
28
|
+
:last_name,
|
29
|
+
:legal_name,
|
30
|
+
:trading_name,
|
31
|
+
:national_tax_id,
|
32
|
+
:registered_address,
|
33
|
+
:date_of_birth,
|
34
|
+
:place_of_birth,
|
35
|
+
:identification
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute reference
|
6
|
+
# @return [String]
|
7
|
+
# @!attribute contact_details
|
8
|
+
# @return [ContactDetails]
|
9
|
+
# @!attribute profile
|
10
|
+
# @return [Profile]
|
11
|
+
# @!attribute company
|
12
|
+
# @return [Company]
|
13
|
+
# @!attribute individual
|
14
|
+
# @return [Individual]
|
15
|
+
class OnboardEntity
|
16
|
+
attr_accessor :reference,
|
17
|
+
:contact_details,
|
18
|
+
:profile,
|
19
|
+
:company,
|
20
|
+
:individual
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute type
|
6
|
+
# @return [String] {CheckoutSdk::Common::InstrumentType}
|
7
|
+
# @!attribute label
|
8
|
+
# @return [String]
|
9
|
+
# @!attribute account_type
|
10
|
+
# @return [String] {CheckoutSdk::Common::AccountType}
|
11
|
+
# @!attribute account_number
|
12
|
+
# @return [String]
|
13
|
+
# @!attribute bank_code
|
14
|
+
# @return [String]
|
15
|
+
# @!attribute branch_code
|
16
|
+
# @return [String]
|
17
|
+
# @!attribute iban
|
18
|
+
# @return [String]
|
19
|
+
# @!attribute bban
|
20
|
+
# @return [String]
|
21
|
+
# @!attribute swift_bic
|
22
|
+
# @return [String]
|
23
|
+
# @!attribute currency
|
24
|
+
# @return [String] {CheckoutSdk::Common::Currency}
|
25
|
+
# @!attribute country
|
26
|
+
# @return [String] {CheckoutSdk::Common::Country}
|
27
|
+
# @!attribute document
|
28
|
+
# @return [InstrumentDocument]
|
29
|
+
# @!attribute bank
|
30
|
+
# @return [BankDetails]
|
31
|
+
# @!attribute account_holder
|
32
|
+
# @return [AccountHolder]
|
33
|
+
class PaymentInstrument
|
34
|
+
attr_accessor :type,
|
35
|
+
:label,
|
36
|
+
:account_type,
|
37
|
+
:account_number,
|
38
|
+
:bank_code,
|
39
|
+
:branch_code,
|
40
|
+
:iban,
|
41
|
+
:bban,
|
42
|
+
:swift_bic,
|
43
|
+
:currency,
|
44
|
+
:country,
|
45
|
+
:document,
|
46
|
+
:bank,
|
47
|
+
:account_holder
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CheckoutSdk
|
4
|
+
module Accounts
|
5
|
+
# @!attribute urls
|
6
|
+
# @return [Array(String)]
|
7
|
+
# @!attribute mccs
|
8
|
+
# @return [Array(String)]
|
9
|
+
# @!attribute default_holding_currency
|
10
|
+
# @return [String] {CheckoutSdk::Common::Currency}
|
11
|
+
class Profile
|
12
|
+
attr_accessor :urls,
|
13
|
+
:mccs,
|
14
|
+
:default_holding_currency
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|