checkout_sdk 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/checkout_sdk/balances/balances.rb +3 -0
- data/lib/checkout_sdk/balances/balances_client.rb +37 -3
- data/lib/checkout_sdk/balances/top_up_bank_details.rb +22 -0
- data/lib/checkout_sdk/balances/top_up_funding_details.rb +53 -0
- data/lib/checkout_sdk/balances/top_up_instructions.rb +34 -0
- data/lib/checkout_sdk/json_serializer.rb +3 -1
- data/lib/checkout_sdk/oauth_scopes.rb +1 -0
- data/lib/checkout_sdk/payments/flow/flow_client.rb +6 -0
- data/lib/checkout_sdk/payments/payments.rb +3 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_billing_descriptor.rb +19 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_presentment_details.rb +17 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_terminal.rb +16 -0
- data/lib/checkout_sdk/payments/setups/payment_setups_client.rb +11 -5
- data/lib/checkout_sdk/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ab7d38f61ed5faeabcf716c00ead8f3863b96ead74abd6c3e2835617d8090c5
|
|
4
|
+
data.tar.gz: 70b87b4515f6084c189956b6e7d9360a4e96686e91a1bdc293207748302b9f21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 15700b0fe9e01a5d21f8a4b88971c729de748f79b8d213a7e695575c492c4d1f61781e43075228695ee429b3d5172cb8475541fb41122acc17a19d82a7319422
|
|
7
|
+
data.tar.gz: 1d271293014b5535cb92b87cb7bff5b3ada0021dca9824560c432e0ece531ecdedfacff7ff8f312fe36eb9a285339d7f1bc04e8c8f51a9be998427b1f65933cb
|
|
@@ -4,4 +4,7 @@ require 'checkout_sdk/balances/balances_query'
|
|
|
4
4
|
require 'checkout_sdk/balances/collateral_breakdown'
|
|
5
5
|
require 'checkout_sdk/balances/balance_values'
|
|
6
6
|
require 'checkout_sdk/balances/currency_account_balance'
|
|
7
|
+
require 'checkout_sdk/balances/top_up_funding_details'
|
|
8
|
+
require 'checkout_sdk/balances/top_up_bank_details'
|
|
9
|
+
require 'checkout_sdk/balances/top_up_instructions'
|
|
7
10
|
require 'checkout_sdk/balances/balances_client'
|
|
@@ -4,7 +4,10 @@ module CheckoutSdk
|
|
|
4
4
|
module Balances
|
|
5
5
|
class BalancesClient < Client
|
|
6
6
|
BALANCES = 'balances'
|
|
7
|
-
|
|
7
|
+
ENTITIES = 'entities'
|
|
8
|
+
CURRENCY_ACCOUNTS = 'currency-accounts'
|
|
9
|
+
TOP_UP_INSTRUCTIONS = 'top-up-instructions'
|
|
10
|
+
private_constant :BALANCES, :ENTITIES, :CURRENCY_ACCOUNTS, :TOP_UP_INSTRUCTIONS
|
|
8
11
|
|
|
9
12
|
# @param [ApiClient] api_client
|
|
10
13
|
# @param [CheckoutConfiguration] configuration
|
|
@@ -12,11 +15,42 @@ module CheckoutSdk
|
|
|
12
15
|
super(api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY_OR_OAUTH)
|
|
13
16
|
end
|
|
14
17
|
|
|
15
|
-
#
|
|
16
|
-
#
|
|
18
|
+
# Retrieves the balances for each sub-account belonging to an entity.
|
|
19
|
+
#
|
|
20
|
+
# @param [String] entity_id the ID of the entity
|
|
21
|
+
# @param [String, BalancesQuery] balances_query a raw query string
|
|
22
|
+
# (e.g. "currency:GBP") or a {BalancesQuery}
|
|
23
|
+
# @return [Hash] the balances response
|
|
17
24
|
def retrieve_entity_balances(entity_id, balances_query)
|
|
18
25
|
api_client.invoke_get(build_path(BALANCES, entity_id), sdk_authorization, balances_query)
|
|
19
26
|
end
|
|
27
|
+
|
|
28
|
+
# Retrieves the bank details required to top up a sub-account, along with the payment
|
|
29
|
+
# reference that attributes an incoming payment to that sub-account.
|
|
30
|
+
#
|
|
31
|
+
# Note: The sub-account is referred to as currency account in the API.
|
|
32
|
+
#
|
|
33
|
+
# The response maps to {TopUpInstructions}, whose `bank_details` is a {TopUpBankDetails}
|
|
34
|
+
# holding up to two {TopUpFundingDetails} rails. Neither rail is guaranteed.
|
|
35
|
+
#
|
|
36
|
+
# @param [String] entity_id the ID of the entity that owns the sub-account, or of an entity
|
|
37
|
+
# above it in your hierarchy; a platform can use its own entity ID to reach the
|
|
38
|
+
# sub-accounts of any entity beneath it
|
|
39
|
+
# @param [String] currency_account_id the ID of the sub-account to retrieve top-up
|
|
40
|
+
# instructions for
|
|
41
|
+
# @return [Hash] the top-up instructions response
|
|
42
|
+
# @raise [CheckoutArgumentException] if either path parameter is nil, empty or blank. Both
|
|
43
|
+
# segments are interpolated straight into the request path, so a blank value would build a
|
|
44
|
+
# malformed URL and be rejected by the API rather than by the SDK.
|
|
45
|
+
def retrieve_top_up_instructions(entity_id, currency_account_id)
|
|
46
|
+
raise CheckoutArgumentException, 'entity_id cannot be blank' if entity_id.to_s.strip.empty?
|
|
47
|
+
raise CheckoutArgumentException, 'currency_account_id cannot be blank' if currency_account_id.to_s.strip.empty?
|
|
48
|
+
|
|
49
|
+
api_client.invoke_get(
|
|
50
|
+
build_path(ENTITIES, entity_id, CURRENCY_ACCOUNTS, currency_account_id, TOP_UP_INSTRUCTIONS),
|
|
51
|
+
sdk_authorization
|
|
52
|
+
)
|
|
53
|
+
end
|
|
20
54
|
end
|
|
21
55
|
end
|
|
22
56
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Balances
|
|
5
|
+
# The bank details for each available funding rail (swagger schema: TopUpBankDetails).
|
|
6
|
+
#
|
|
7
|
+
# Both `domestic` and `international` are optional, and their availability depends on the
|
|
8
|
+
# sub-account's holding currency, jurisdiction, and banking partner. Do not assume that both
|
|
9
|
+
# rails are always available; neither may be present.
|
|
10
|
+
#
|
|
11
|
+
# @!attribute domestic
|
|
12
|
+
# [Optional]
|
|
13
|
+
# @return [TopUpFundingDetails] The bank details for the domestic funding rail.
|
|
14
|
+
# @!attribute international
|
|
15
|
+
# [Optional]
|
|
16
|
+
# @return [TopUpFundingDetails] The bank details for the international funding rail.
|
|
17
|
+
class TopUpBankDetails
|
|
18
|
+
attr_accessor :domestic,
|
|
19
|
+
:international
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Balances
|
|
5
|
+
# The bank details for a single funding rail (swagger schema: TopUpFundingDetails).
|
|
6
|
+
#
|
|
7
|
+
# `beneficiary_account_name` and `bank_name` are the only fields always returned. The
|
|
8
|
+
# remaining fields vary by rail and the receiving bank's jurisdiction, and are omitted when
|
|
9
|
+
# they do not apply.
|
|
10
|
+
#
|
|
11
|
+
# @!attribute beneficiary_account_name
|
|
12
|
+
# [Required]
|
|
13
|
+
# @return [String] The name of the account that receives the funds.
|
|
14
|
+
# @!attribute beneficiary_address
|
|
15
|
+
# [Optional]
|
|
16
|
+
# @return [String] The address of the beneficiary, if the rail requires it.
|
|
17
|
+
# @!attribute bank_name
|
|
18
|
+
# [Required]
|
|
19
|
+
# @return [String] The name of the bank that receives the funds.
|
|
20
|
+
# @!attribute bank_address
|
|
21
|
+
# [Optional]
|
|
22
|
+
# @return [String] The address of the receiving bank, if the rail requires it.
|
|
23
|
+
# @!attribute account_number
|
|
24
|
+
# [Optional]
|
|
25
|
+
# @return [String] The account number of the receiving account.
|
|
26
|
+
# @!attribute sort_code
|
|
27
|
+
# [Optional]
|
|
28
|
+
# @return [String] The sort code of the receiving bank. Returned for United Kingdom
|
|
29
|
+
# domestic transfers.
|
|
30
|
+
# @!attribute routing_number
|
|
31
|
+
# [Optional]
|
|
32
|
+
# @return [String] The routing number of the receiving bank. Returned for United States
|
|
33
|
+
# domestic transfers.
|
|
34
|
+
# @!attribute iban
|
|
35
|
+
# [Optional]
|
|
36
|
+
# @return [String] The International Bank Account Number of the receiving account.
|
|
37
|
+
# @!attribute swift_code
|
|
38
|
+
# [Optional]
|
|
39
|
+
# @return [String] The SWIFT or BIC code of the receiving bank. Returned for
|
|
40
|
+
# international transfers.
|
|
41
|
+
class TopUpFundingDetails
|
|
42
|
+
attr_accessor :beneficiary_account_name,
|
|
43
|
+
:beneficiary_address,
|
|
44
|
+
:bank_name,
|
|
45
|
+
:bank_address,
|
|
46
|
+
:account_number,
|
|
47
|
+
:sort_code,
|
|
48
|
+
:routing_number,
|
|
49
|
+
:iban,
|
|
50
|
+
:swift_code
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Balances
|
|
5
|
+
# The bank details and payment reference used to top up a sub-account
|
|
6
|
+
# (swagger schema: TopUpInstructionsResponse).
|
|
7
|
+
#
|
|
8
|
+
# Returned by
|
|
9
|
+
# GET /entities/{entityId}/currency-accounts/{currencyAccountId}/top-up-instructions.
|
|
10
|
+
#
|
|
11
|
+
# @!attribute currency_account_id
|
|
12
|
+
# [Required]
|
|
13
|
+
# @return [String] The unique identifier of the sub-account that the instructions apply to.
|
|
14
|
+
# @!attribute currency
|
|
15
|
+
# [Required]
|
|
16
|
+
# @return [String] {CheckoutSdk::Common::Currency} The currency that funds must be sent in,
|
|
17
|
+
# as a three-letter ISO 4217 currency code. This is the sub-account's holding currency,
|
|
18
|
+
# returned as `holding_currency` by the Retrieve entity balances endpoint.
|
|
19
|
+
# @!attribute payment_reference
|
|
20
|
+
# [Required]
|
|
21
|
+
# @return [String] The reference that must be quoted on the payment. It is how an incoming
|
|
22
|
+
# payment is attributed to the sub-account. A payment sent without this reference may not
|
|
23
|
+
# be credited.
|
|
24
|
+
# @!attribute bank_details
|
|
25
|
+
# [Required]
|
|
26
|
+
# @return [TopUpBankDetails] The bank details for each available funding rail.
|
|
27
|
+
class TopUpInstructions
|
|
28
|
+
attr_accessor :currency_account_id,
|
|
29
|
+
:currency,
|
|
30
|
+
:payment_reference,
|
|
31
|
+
:bank_details
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -6,7 +6,9 @@ module CheckoutSdk
|
|
|
6
6
|
account_holder_type: 'account-holder-type',
|
|
7
7
|
payment_network: 'payment-network',
|
|
8
8
|
from_: 'from',
|
|
9
|
-
if_match: 'if-match'
|
|
9
|
+
if_match: 'if-match',
|
|
10
|
+
with_currency_account_id: 'withCurrencyAccountId',
|
|
11
|
+
balances_at: 'balancesAt' }.freeze
|
|
10
12
|
|
|
11
13
|
def self.to_custom_hash(object)
|
|
12
14
|
hash = {}
|
|
@@ -36,6 +36,7 @@ module CheckoutSdk
|
|
|
36
36
|
TRANSFERS_VIEW = 'transfers:view'
|
|
37
37
|
BALANCES = 'balances'
|
|
38
38
|
BALANCES_VIEW = 'balances:view'
|
|
39
|
+
BALANCES_TOP_UP_INSTRUCTIONS = 'balances:top-up-instructions'
|
|
39
40
|
MIDDLEWARE = 'middleware'
|
|
40
41
|
MIDDLEWARE_MERCHANTS_SECRET = 'middleware:merchants-secret'
|
|
41
42
|
MIDDLEWARE_MERCHANTS_PUBLIC = 'middleware:merchants-public'
|
|
@@ -32,8 +32,14 @@ module CheckoutSdk
|
|
|
32
32
|
# Use this endpoint to submit payment details and process the payment for an existing session.
|
|
33
33
|
# [Beta]
|
|
34
34
|
#
|
|
35
|
+
# The request accepts `amount_allocations`: the sub-entities the payment is being
|
|
36
|
+
# processed on behalf of, min 1 max 50 items. Each entry maps to
|
|
37
|
+
# {CheckoutSdk::Common::AmountAllocations} (id, amount, reference, commission), where `id`
|
|
38
|
+
# and `amount` are required.
|
|
39
|
+
#
|
|
35
40
|
# @param [String] id - The unique identifier of the Payment Session
|
|
36
41
|
# @param [Hash] submit_payment_session_request
|
|
42
|
+
# @return [Hash] the payment submission response
|
|
37
43
|
def submit_payment_session(id, submit_payment_session_request)
|
|
38
44
|
api_client.invoke_post(
|
|
39
45
|
build_path(PAYMENT_SESSIONS_PATH, id, SUBMIT_PATH),
|
|
@@ -210,6 +210,9 @@ require 'checkout_sdk/payments/setups/account_funding_transaction_identification
|
|
|
210
210
|
require 'checkout_sdk/payments/setups/account_funding_transaction_sender'
|
|
211
211
|
require 'checkout_sdk/payments/setups/account_funding_transaction_recipient'
|
|
212
212
|
require 'checkout_sdk/payments/setups/payment_setup_account_funding_transaction'
|
|
213
|
+
require 'checkout_sdk/payments/setups/payment_setup_billing_descriptor'
|
|
214
|
+
require 'checkout_sdk/payments/setups/payment_setup_presentment_details'
|
|
215
|
+
require 'checkout_sdk/payments/setups/payment_setup_terminal'
|
|
213
216
|
require 'checkout_sdk/payments/setups/blik_payment_method'
|
|
214
217
|
require 'checkout_sdk/payments/setups/bacs_payment_method'
|
|
215
218
|
require 'checkout_sdk/payments/setups/card_present_payment_method'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Payments
|
|
5
|
+
# The billing descriptor for payment.
|
|
6
|
+
#
|
|
7
|
+
# @!attribute name
|
|
8
|
+
# @return [String] A dynamic description of the payment. Max length: 25.
|
|
9
|
+
# @!attribute city
|
|
10
|
+
# @return [String] The city from which the payment was made. Max length: 13.
|
|
11
|
+
# @!attribute reference
|
|
12
|
+
# @return [String] The reference shown on the statement. Max length: 50.
|
|
13
|
+
class PaymentSetupBillingDescriptor
|
|
14
|
+
attr_accessor :name,
|
|
15
|
+
:city,
|
|
16
|
+
:reference
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Payments
|
|
5
|
+
# The amount and currency to present to the customer, when the settlement
|
|
6
|
+
# currency differs from the customer-facing currency.
|
|
7
|
+
#
|
|
8
|
+
# @!attribute amount
|
|
9
|
+
# @return [Integer] The presentment amount, in the minor currency unit.
|
|
10
|
+
# @!attribute currency
|
|
11
|
+
# @return [String] The presentment currency, as a three-letter ISO currency code.
|
|
12
|
+
class PaymentSetupPresentmentDetails
|
|
13
|
+
attr_accessor :amount,
|
|
14
|
+
:currency
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Payments
|
|
5
|
+
# Terminal details.
|
|
6
|
+
#
|
|
7
|
+
# @!attribute id
|
|
8
|
+
# @return [String] Terminal identifier. Length: 8.
|
|
9
|
+
# @!attribute local_date_time
|
|
10
|
+
# @return [String] The local date and time on the terminal, in ISO 8601 format.
|
|
11
|
+
class PaymentSetupTerminal
|
|
12
|
+
attr_accessor :id,
|
|
13
|
+
:local_date_time
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -22,6 +22,9 @@ module CheckoutSdk
|
|
|
22
22
|
# [Beta]
|
|
23
23
|
#
|
|
24
24
|
# @param [Hash] payment_setups_request
|
|
25
|
+
# May include :billing_descriptor {PaymentSetupBillingDescriptor},
|
|
26
|
+
# :presentment_details {PaymentSetupPresentmentDetails} and
|
|
27
|
+
# :terminal {PaymentSetupTerminal}.
|
|
25
28
|
def create_payment_setup(payment_setups_request)
|
|
26
29
|
api_client.invoke_post(
|
|
27
30
|
build_path(PAYMENTS_PATH, SETUPS_PATH),
|
|
@@ -38,6 +41,9 @@ module CheckoutSdk
|
|
|
38
41
|
#
|
|
39
42
|
# @param [String] id - The unique identifier of the Payment Setup to update
|
|
40
43
|
# @param [Hash] payment_setups_request
|
|
44
|
+
# May include :billing_descriptor {PaymentSetupBillingDescriptor},
|
|
45
|
+
# :presentment_details {PaymentSetupPresentmentDetails} and
|
|
46
|
+
# :terminal {PaymentSetupTerminal}.
|
|
41
47
|
def update_payment_setup(id, payment_setups_request)
|
|
42
48
|
api_client.invoke_put(
|
|
43
49
|
build_path(PAYMENTS_PATH, SETUPS_PATH, id),
|
|
@@ -58,15 +64,15 @@ module CheckoutSdk
|
|
|
58
64
|
end
|
|
59
65
|
|
|
60
66
|
# Confirms a Payment Setup to begin processing the payment request with your chosen
|
|
61
|
-
# payment method
|
|
67
|
+
# payment method.
|
|
62
68
|
# [Beta]
|
|
63
69
|
#
|
|
64
70
|
# @param [String] id - The unique identifier of the Payment Setup
|
|
65
|
-
# @param [String]
|
|
66
|
-
#
|
|
67
|
-
def confirm_payment_setup(id,
|
|
71
|
+
# @param [String] payment_method_name - The name of the payment method to process the
|
|
72
|
+
# payment with (for example, "tabby", "klarna", "card")
|
|
73
|
+
def confirm_payment_setup(id, payment_method_name)
|
|
68
74
|
api_client.invoke_post(
|
|
69
|
-
build_path(PAYMENTS_PATH, SETUPS_PATH, id, CONFIRM_PATH,
|
|
75
|
+
build_path(PAYMENTS_PATH, SETUPS_PATH, id, CONFIRM_PATH, payment_method_name),
|
|
70
76
|
sdk_authorization
|
|
71
77
|
)
|
|
72
78
|
end
|
data/lib/checkout_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: checkout_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Checkout
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -250,6 +250,9 @@ files:
|
|
|
250
250
|
- lib/checkout_sdk/balances/balances_query.rb
|
|
251
251
|
- lib/checkout_sdk/balances/collateral_breakdown.rb
|
|
252
252
|
- lib/checkout_sdk/balances/currency_account_balance.rb
|
|
253
|
+
- lib/checkout_sdk/balances/top_up_bank_details.rb
|
|
254
|
+
- lib/checkout_sdk/balances/top_up_funding_details.rb
|
|
255
|
+
- lib/checkout_sdk/balances/top_up_instructions.rb
|
|
253
256
|
- lib/checkout_sdk/checkout_api.rb
|
|
254
257
|
- lib/checkout_sdk/checkout_configuration.rb
|
|
255
258
|
- lib/checkout_sdk/checkout_oauth_sdk_builder.rb
|
|
@@ -564,6 +567,9 @@ files:
|
|
|
564
567
|
- lib/checkout_sdk/payments/setups/card_present_payment_method.rb
|
|
565
568
|
- lib/checkout_sdk/payments/setups/pay_by_bank_payment_method.rb
|
|
566
569
|
- lib/checkout_sdk/payments/setups/payment_setup_account_funding_transaction.rb
|
|
570
|
+
- lib/checkout_sdk/payments/setups/payment_setup_billing_descriptor.rb
|
|
571
|
+
- lib/checkout_sdk/payments/setups/payment_setup_presentment_details.rb
|
|
572
|
+
- lib/checkout_sdk/payments/setups/payment_setup_terminal.rb
|
|
567
573
|
- lib/checkout_sdk/payments/setups/payment_setups_client.rb
|
|
568
574
|
- lib/checkout_sdk/payments/setups/stablecoin_payment_method.rb
|
|
569
575
|
- lib/checkout_sdk/payments/shipping_details.rb
|