checkout_sdk 2.2.1 → 2.4.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/api_client.rb +37 -10
- data/lib/checkout_sdk/checkout_api.rb +5 -1
- data/lib/checkout_sdk/identities/address_document_verification/address_document_verification_client.rb +32 -3
- data/lib/checkout_sdk/identities/address_document_verification/address_document_verification_request.rb +13 -3
- data/lib/checkout_sdk/identities/face_authentication/face_authentication_attempt_request.rb +13 -2
- data/lib/checkout_sdk/identities/face_authentication/face_authentication_client.rb +12 -4
- data/lib/checkout_sdk/identities/face_authentication/face_authentication_request.rb +19 -0
- data/lib/checkout_sdk/identities/id_document_verification/id_document_verification_client.rb +33 -3
- data/lib/checkout_sdk/identities/id_document_verification/id_document_verification_request.rb +30 -0
- data/lib/checkout_sdk/identities/identities.rb +8 -0
- data/lib/checkout_sdk/identities/identity_verification/identity_verification_attempt_request.rb +13 -3
- data/lib/checkout_sdk/identities/identity_verification/identity_verification_client.rb +12 -4
- data/lib/checkout_sdk/identities/identity_verification/identity_verification_request.rb +25 -4
- data/lib/checkout_sdk/identities/identity_verification/idv_client_information.rb +17 -3
- data/lib/checkout_sdk/identities/identity_verification/idv_declared_data.rb +16 -3
- data/lib/checkout_sdk/identities/identity_verification/idv_identity_client_information.rb +30 -0
- data/lib/checkout_sdk/identities/identity_verification/idv_identity_declared_data.rb +34 -0
- data/lib/checkout_sdk/identities/idv_address.rb +48 -0
- data/lib/checkout_sdk/identities/idv_attempt_assets_query_filter.rb +24 -0
- data/lib/checkout_sdk/identities/idv_attempts_query_filter.rb +24 -0
- data/lib/checkout_sdk/identities/idv_phone_number.rb +27 -0
- data/lib/checkout_sdk/inventory/inventory.rb +9 -0
- data/lib/checkout_sdk/inventory/inventory_adjustment_request.rb +24 -0
- data/lib/checkout_sdk/inventory/inventory_client.rb +149 -0
- data/lib/checkout_sdk/inventory/inventory_money.rb +19 -0
- data/lib/checkout_sdk/inventory/inventory_reservation_item.rb +20 -0
- data/lib/checkout_sdk/inventory/inventory_reservation_request.rb +27 -0
- data/lib/checkout_sdk/inventory/inventory_set_levels_request.rb +22 -0
- data/lib/checkout_sdk/inventory/inventory_set_product_request.rb +139 -0
- data/lib/checkout_sdk/issuing/card_update_headers.rb +32 -0
- data/lib/checkout_sdk/issuing/issuing.rb +1 -0
- data/lib/checkout_sdk/issuing/issuing_client.rb +10 -2
- data/lib/checkout_sdk/issuing/update_card_request.rb +32 -7
- data/lib/checkout_sdk/payments/payments.rb +10 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_accommodation.rb +50 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_accommodation_address.rb +25 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_accommodation_guest.rb +19 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_accommodation_host.rb +16 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_accommodation_room.rb +19 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_airline.rb +42 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_airline_insurance.rb +30 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_airline_passenger.rb +30 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_airline_ticket.rb +28 -0
- data/lib/checkout_sdk/payments/setups/payment_setup_industry.rb +18 -0
- data/lib/checkout_sdk/payments/setups/payment_setups_client.rb +8 -4
- data/lib/checkout_sdk/version.rb +1 -1
- data/lib/checkout_sdk.rb +1 -0
- metadata +27 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Identities
|
|
5
|
+
# The applicant's address.
|
|
6
|
+
#
|
|
7
|
+
# @!attribute address_line1
|
|
8
|
+
# The first line of the address.
|
|
9
|
+
# [Optional]
|
|
10
|
+
# max 250 characters
|
|
11
|
+
# Example: 123 Main Street
|
|
12
|
+
# @return [String]
|
|
13
|
+
# @!attribute address_line2
|
|
14
|
+
# The second line of the address.
|
|
15
|
+
# [Optional]
|
|
16
|
+
# max 250 characters
|
|
17
|
+
# Example: Apt 4B
|
|
18
|
+
# @return [String]
|
|
19
|
+
# @!attribute city
|
|
20
|
+
# The city or town.
|
|
21
|
+
# [Optional]
|
|
22
|
+
# max 50 characters
|
|
23
|
+
# Example: London
|
|
24
|
+
# @return [String]
|
|
25
|
+
# @!attribute state
|
|
26
|
+
# The state, county, or province.
|
|
27
|
+
# [Optional]
|
|
28
|
+
# max 50 characters
|
|
29
|
+
# Example: Greater London
|
|
30
|
+
# @return [String]
|
|
31
|
+
# @!attribute zip
|
|
32
|
+
# The postal or ZIP code.
|
|
33
|
+
# [Optional]
|
|
34
|
+
# max 50 characters
|
|
35
|
+
# Example: SW1A 1AA
|
|
36
|
+
# @return [String]
|
|
37
|
+
# @!attribute country
|
|
38
|
+
# The two-letter ISO country code of the address.
|
|
39
|
+
# [Optional]
|
|
40
|
+
# Standard: ISO 3166-1 alpha-2 country code
|
|
41
|
+
# max 2 characters
|
|
42
|
+
# Example: GB
|
|
43
|
+
# @return [String] a value of {CheckoutSdk::Common::Country}
|
|
44
|
+
class IdvAddress
|
|
45
|
+
attr_accessor :address_line1, :address_line2, :city, :state, :zip, :country
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Identities
|
|
5
|
+
# Pagination for the attempt-assets endpoints.
|
|
6
|
+
#
|
|
7
|
+
# Separate from {IdvAttemptsQueryFilter} because the spec documents the two sets of parameters
|
|
8
|
+
# against different resources: these count assets, those count attempts.
|
|
9
|
+
#
|
|
10
|
+
# @!attribute skip
|
|
11
|
+
# The number of assets to skip.
|
|
12
|
+
# [Optional]
|
|
13
|
+
# Default: 0
|
|
14
|
+
# @return [Integer]
|
|
15
|
+
# @!attribute limit
|
|
16
|
+
# The maximum number of assets to return.
|
|
17
|
+
# [Optional]
|
|
18
|
+
# Default: 10
|
|
19
|
+
# @return [Integer]
|
|
20
|
+
class IdvAttemptAssetsQueryFilter
|
|
21
|
+
attr_accessor :skip, :limit
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Identities
|
|
5
|
+
# Pagination for the list-attempts endpoints.
|
|
6
|
+
#
|
|
7
|
+
# Separate from {IdvAttemptAssetsQueryFilter} because the spec documents the two sets of
|
|
8
|
+
# parameters against different resources: these count attempts, those count assets.
|
|
9
|
+
#
|
|
10
|
+
# @!attribute skip
|
|
11
|
+
# The number of attempts to skip.
|
|
12
|
+
# [Optional]
|
|
13
|
+
# Default: 0
|
|
14
|
+
# @return [Integer]
|
|
15
|
+
# @!attribute limit
|
|
16
|
+
# The maximum number of attempts to return.
|
|
17
|
+
# [Optional]
|
|
18
|
+
# Default: 10
|
|
19
|
+
# @return [Integer]
|
|
20
|
+
class IdvAttemptsQueryFilter
|
|
21
|
+
attr_accessor :skip, :limit
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Identities
|
|
5
|
+
# The applicant's mobile phone number, if sharing the attempt URL via SMS.
|
|
6
|
+
#
|
|
7
|
+
# Named IdvPhoneNumber rather than PhoneNumber because
|
|
8
|
+
# {CheckoutSdk::Issuing::IssuingPhoneNumber} already exists for a different shape, and the two
|
|
9
|
+
# must not be confused.
|
|
10
|
+
#
|
|
11
|
+
# @!attribute country_code
|
|
12
|
+
# The international phone country code. This is a dialling prefix, not an ISO country code.
|
|
13
|
+
# [Required]
|
|
14
|
+
# ^\+(\d+)$
|
|
15
|
+
# Example: +33
|
|
16
|
+
# @return [String]
|
|
17
|
+
# @!attribute number
|
|
18
|
+
# The applicant's mobile number, without the country code.
|
|
19
|
+
# [Required]
|
|
20
|
+
# ^\d{1,14}$
|
|
21
|
+
# Example: 5555550102
|
|
22
|
+
# @return [String]
|
|
23
|
+
class IdvPhoneNumber
|
|
24
|
+
attr_accessor :country_code, :number
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'checkout_sdk/inventory/inventory_money'
|
|
4
|
+
require 'checkout_sdk/inventory/inventory_adjustment_request'
|
|
5
|
+
require 'checkout_sdk/inventory/inventory_reservation_item'
|
|
6
|
+
require 'checkout_sdk/inventory/inventory_reservation_request'
|
|
7
|
+
require 'checkout_sdk/inventory/inventory_set_levels_request'
|
|
8
|
+
require 'checkout_sdk/inventory/inventory_set_product_request'
|
|
9
|
+
require 'checkout_sdk/inventory/inventory_client'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# Request body for POST /inventory/adjustments. Mirrors swagger
|
|
6
|
+
# `InventoryAdjustmentRequest`.
|
|
7
|
+
#
|
|
8
|
+
# @!attribute variant_id
|
|
9
|
+
# @return [String] The identifier of the variant to adjust. The variant must already
|
|
10
|
+
# exist. [Required] max 128 characters.
|
|
11
|
+
# @!attribute delta
|
|
12
|
+
# @return [Integer] The signed change to apply to on_hand. A negative delta that would
|
|
13
|
+
# drive on_hand below zero is rejected with a 409. Per spec, must be non-zero (not a
|
|
14
|
+
# formal schema constraint). [Required]
|
|
15
|
+
# @!attribute reason
|
|
16
|
+
# @return [String] A free-text reason recorded in the ledger. Must not contain personal
|
|
17
|
+
# data. [Required] min 1 character, max 256 characters.
|
|
18
|
+
class InventoryAdjustmentRequest
|
|
19
|
+
attr_accessor :variant_id,
|
|
20
|
+
:delta,
|
|
21
|
+
:reason
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# Client for the Inventory API: stock levels, atomic multi-variant reservations
|
|
6
|
+
# (hold/commit/release), stock adjustments, and per-variant "product knowledge"
|
|
7
|
+
# merchandising metadata for AI agents.
|
|
8
|
+
#
|
|
9
|
+
# All 10 operations require OAuth with the agentic:inventory scope (see
|
|
10
|
+
# {CheckoutSdk::OAuthScopes::AGENTIC_INVENTORY}); unlike most domains in this SDK, there is
|
|
11
|
+
# no ApiSecretKey/ApiPublicKey fallback, so this client always authorizes with
|
|
12
|
+
# {CheckoutSdk::AuthorizationType::OAUTH} (the same pattern already used by
|
|
13
|
+
# {CheckoutSdk::Payments::GooglePayClient}).
|
|
14
|
+
#
|
|
15
|
+
# Responses are returned as Hash (OpenStruct), per this SDK's convention (see e.g.
|
|
16
|
+
# {CheckoutSdk::Balances::BalancesClient}); there are no typed InventoryLevels,
|
|
17
|
+
# InventoryReservation or InventoryProductKnowledge response classes. Error responses
|
|
18
|
+
# (404/409/422) surface as {CheckoutSdk::CheckoutApiException}; this SDK has no per-domain
|
|
19
|
+
# typed error response classes, so `InventoryErrorResponse`'s fields
|
|
20
|
+
# (request_id, error_type, error_codes, variant_id, available) are available generically via
|
|
21
|
+
# `error.error_details`, the same as every other domain.
|
|
22
|
+
#
|
|
23
|
+
# getInventoryProduct, setInventoryProduct and deleteInventoryProduct are marked Beta in the
|
|
24
|
+
# specification.
|
|
25
|
+
class InventoryClient < Client
|
|
26
|
+
INVENTORY = 'inventory'
|
|
27
|
+
ADJUSTMENTS = 'adjustments'
|
|
28
|
+
RESERVATIONS = 'reservations'
|
|
29
|
+
COMMIT = 'commit'
|
|
30
|
+
RELEASE = 'release'
|
|
31
|
+
PRODUCT = 'product'
|
|
32
|
+
private_constant :INVENTORY, :ADJUSTMENTS, :RESERVATIONS, :COMMIT, :RELEASE, :PRODUCT
|
|
33
|
+
|
|
34
|
+
# @param [ApiClient] api_client
|
|
35
|
+
# @param [CheckoutConfiguration] configuration
|
|
36
|
+
def initialize(api_client, configuration)
|
|
37
|
+
super(api_client, configuration, CheckoutSdk::AuthorizationType::OAUTH)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Apply a signed stock adjustment to a variant's on_hand quantity, recording the reason in
|
|
41
|
+
# the ledger. Returns 201, or 200 with a Cache-Control response header on an idempotent
|
|
42
|
+
# replay; both share the InventoryLevels response schema.
|
|
43
|
+
#
|
|
44
|
+
# @param [Hash, InventoryAdjustmentRequest] adjustment_request
|
|
45
|
+
# @param [String, nil] idempotency_key Optional. Cko-Idempotency-Key request header.
|
|
46
|
+
# @return [Hash] the InventoryLevels response
|
|
47
|
+
def adjust_inventory(adjustment_request, idempotency_key = nil)
|
|
48
|
+
api_client.invoke_post(
|
|
49
|
+
build_path(INVENTORY, ADJUSTMENTS),
|
|
50
|
+
sdk_authorization,
|
|
51
|
+
adjustment_request,
|
|
52
|
+
idempotency_key
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Create an atomic multi-variant hold. Returns 201, or 200 with a Cache-Control response
|
|
57
|
+
# header on an idempotent replay; both share the InventoryReservation response schema.
|
|
58
|
+
#
|
|
59
|
+
# @param [Hash, InventoryReservationRequest] reservation_request
|
|
60
|
+
# @param [String, nil] idempotency_key Optional. Cko-Idempotency-Key request header.
|
|
61
|
+
# @return [Hash] the InventoryReservation response
|
|
62
|
+
def create_inventory_reservation(reservation_request, idempotency_key = nil)
|
|
63
|
+
api_client.invoke_post(
|
|
64
|
+
build_path(INVENTORY, RESERVATIONS),
|
|
65
|
+
sdk_authorization,
|
|
66
|
+
reservation_request,
|
|
67
|
+
idempotency_key
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Retrieve a reservation by ID.
|
|
72
|
+
#
|
|
73
|
+
# @param [String] reservation_id
|
|
74
|
+
# @return [Hash] the InventoryReservation response
|
|
75
|
+
def get_inventory_reservation(reservation_id)
|
|
76
|
+
api_client.invoke_get(build_path(INVENTORY, RESERVATIONS, reservation_id), sdk_authorization)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Commit a held reservation, converting the hold into a permanent deduction. Takes no
|
|
80
|
+
# request body.
|
|
81
|
+
#
|
|
82
|
+
# @param [String] reservation_id
|
|
83
|
+
# @return [Hash] the InventoryReservation response
|
|
84
|
+
def commit_inventory_reservation(reservation_id)
|
|
85
|
+
api_client.invoke_post(
|
|
86
|
+
build_path(INVENTORY, RESERVATIONS, reservation_id, COMMIT),
|
|
87
|
+
sdk_authorization
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Release a held reservation, returning the reserved quantity to available stock. Takes
|
|
92
|
+
# no request body.
|
|
93
|
+
#
|
|
94
|
+
# @param [String] reservation_id
|
|
95
|
+
# @return [Hash] the InventoryReservation response
|
|
96
|
+
def release_inventory_reservation(reservation_id)
|
|
97
|
+
api_client.invoke_post(
|
|
98
|
+
build_path(INVENTORY, RESERVATIONS, reservation_id, RELEASE),
|
|
99
|
+
sdk_authorization
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Retrieve the stock levels for a variant.
|
|
104
|
+
#
|
|
105
|
+
# @param [String] variant_id
|
|
106
|
+
# @param [Boolean, nil] expand_product Optional. When true, adds `?expand=product` so the
|
|
107
|
+
# response embeds the variant's InventoryProductKnowledge (when it exists) under
|
|
108
|
+
# `product`.
|
|
109
|
+
# @return [Hash] the InventoryLevels response
|
|
110
|
+
def get_inventory_levels(variant_id, expand_product: false)
|
|
111
|
+
params = { expand: 'product' } if expand_product
|
|
112
|
+
api_client.invoke_get(build_path(INVENTORY, variant_id), sdk_authorization, params)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Create or replace the stock levels for a variant.
|
|
116
|
+
#
|
|
117
|
+
# @param [String] variant_id
|
|
118
|
+
# @param [Hash, InventorySetLevelsRequest] set_levels_request
|
|
119
|
+
# @return [Hash] the InventoryLevels response
|
|
120
|
+
def set_inventory_levels(variant_id, set_levels_request)
|
|
121
|
+
api_client.invoke_put(build_path(INVENTORY, variant_id), sdk_authorization, set_levels_request)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Retrieve the product knowledge (merchandising metadata) for a variant. Beta.
|
|
125
|
+
#
|
|
126
|
+
# @param [String] variant_id
|
|
127
|
+
# @return [Hash] the InventoryProductKnowledge response
|
|
128
|
+
def get_inventory_product(variant_id)
|
|
129
|
+
api_client.invoke_get(build_path(INVENTORY, variant_id, PRODUCT), sdk_authorization)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Create or replace the product knowledge for a variant. Beta.
|
|
133
|
+
#
|
|
134
|
+
# @param [String] variant_id
|
|
135
|
+
# @param [Hash, InventorySetProductRequest] set_product_request
|
|
136
|
+
# @return [Hash] the InventoryProductKnowledge response
|
|
137
|
+
def set_inventory_product(variant_id, set_product_request)
|
|
138
|
+
api_client.invoke_put(build_path(INVENTORY, variant_id, PRODUCT), sdk_authorization, set_product_request)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Delete the product knowledge for a variant. Beta. Returns 204 with no body.
|
|
142
|
+
#
|
|
143
|
+
# @param [String] variant_id
|
|
144
|
+
def delete_inventory_product(variant_id)
|
|
145
|
+
api_client.invoke_delete(build_path(INVENTORY, variant_id, PRODUCT), sdk_authorization)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# A monetary amount in an inventory product's price or sale_price. Mirrors swagger
|
|
6
|
+
# `InventoryMoney`. Used by {InventorySetProductRequest#price} and
|
|
7
|
+
# {InventorySetProductRequest#sale_price}.
|
|
8
|
+
#
|
|
9
|
+
# @!attribute amount
|
|
10
|
+
# @return [Integer] The amount in the currency's minor unit. [Required]
|
|
11
|
+
# @!attribute currency
|
|
12
|
+
# @return [String] The 3-letter ISO 4217 currency code. [Required] min 3 characters,
|
|
13
|
+
# max 3 characters.
|
|
14
|
+
class InventoryMoney
|
|
15
|
+
attr_accessor :amount,
|
|
16
|
+
:currency
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# A single line item within an inventory reservation. Mirrors swagger
|
|
6
|
+
# `InventoryReservationItem`. Used by {InventoryReservationRequest#items} and present in the
|
|
7
|
+
# `InventoryReservation` response's `items` array (returned as a Hash, not deserialized into
|
|
8
|
+
# this class, per this SDK's response convention).
|
|
9
|
+
#
|
|
10
|
+
# @!attribute variant_id
|
|
11
|
+
# @return [String] The identifier of the variant to reserve. The variant must already
|
|
12
|
+
# exist. [Required] max 128 characters.
|
|
13
|
+
# @!attribute quantity
|
|
14
|
+
# @return [Integer] The quantity to reserve. [Required] min 1.
|
|
15
|
+
class InventoryReservationItem
|
|
16
|
+
attr_accessor :variant_id,
|
|
17
|
+
:quantity
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# Request body for POST /inventory/reservations. Mirrors swagger
|
|
6
|
+
# `InventoryReservationRequest`.
|
|
7
|
+
#
|
|
8
|
+
# @!attribute owner_type
|
|
9
|
+
# @return [String] Free-text classification of the reservation's owner (e.g. an agent or
|
|
10
|
+
# order type). [Required] max 64 characters.
|
|
11
|
+
# @!attribute owner_reference
|
|
12
|
+
# @return [String] A reference identifying the specific owner, echoed back on the
|
|
13
|
+
# reservation. [Required] max 256 characters.
|
|
14
|
+
# @!attribute items
|
|
15
|
+
# @return [Array<InventoryReservationItem>] The variants and quantities to hold.
|
|
16
|
+
# [Required] min 1 item, max 45 items. variant_id must be unique within the request.
|
|
17
|
+
# @!attribute ttl_seconds
|
|
18
|
+
# @return [Integer] How long the hold stays active before it expires. [Optional]
|
|
19
|
+
# min 60, max 3600. Default: 900.
|
|
20
|
+
class InventoryReservationRequest
|
|
21
|
+
attr_accessor :owner_type,
|
|
22
|
+
:owner_reference,
|
|
23
|
+
:items,
|
|
24
|
+
:ttl_seconds
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# Request body for PUT /inventory/{variant_id}. Mirrors swagger
|
|
6
|
+
# `InventorySetLevelsRequest`.
|
|
7
|
+
#
|
|
8
|
+
# @!attribute on_hand
|
|
9
|
+
# @return [Integer] The physical stock to set for the variant. [Required] min 0.
|
|
10
|
+
# @!attribute safety_stock
|
|
11
|
+
# @return [Integer] The buffer withheld from sale. [Optional] min 0. Defaults to 0 on
|
|
12
|
+
# create; left unchanged on update if omitted.
|
|
13
|
+
# @!attribute reason
|
|
14
|
+
# @return [String] A free-text reason recorded in the ledger. Must not contain personal
|
|
15
|
+
# data. [Optional] max 256 characters.
|
|
16
|
+
class InventorySetLevelsRequest
|
|
17
|
+
attr_accessor :on_hand,
|
|
18
|
+
:safety_stock,
|
|
19
|
+
:reason
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Inventory
|
|
5
|
+
# Request body for PUT /inventory/{variant_id}/product (Beta). Mirrors swagger
|
|
6
|
+
# `InventorySetProductRequest`, the "product knowledge" merchandising metadata used by AI
|
|
7
|
+
# agents. Shares its optional fields with the `InventoryProductKnowledge` response schema,
|
|
8
|
+
# which this SDK does not model as a class because responses are returned as Hash (see
|
|
9
|
+
# {InventoryClient}).
|
|
10
|
+
#
|
|
11
|
+
# @!attribute title
|
|
12
|
+
# @return [String] The product title. [Required] max 512 characters.
|
|
13
|
+
# @!attribute description
|
|
14
|
+
# @return [String] The product description. [Required] max 4000 characters.
|
|
15
|
+
# @!attribute product_url
|
|
16
|
+
# @return [String] The URL of the product page. [Required] max 2048 characters.
|
|
17
|
+
# @!attribute image_url
|
|
18
|
+
# @return [String] The URL of the primary product image. [Required] max 2048 characters.
|
|
19
|
+
# @!attribute additional_image_urls
|
|
20
|
+
# @return [Array<String>] Additional product image URLs. [Optional]
|
|
21
|
+
# @!attribute video_url
|
|
22
|
+
# @return [String] The URL of a product video. [Optional]
|
|
23
|
+
# @!attribute model_3d_url
|
|
24
|
+
# @return [String] The URL of a 3D model of the product. [Optional]
|
|
25
|
+
# @!attribute sku
|
|
26
|
+
# @return [String] The merchant's SKU for the variant. [Optional] max 128 characters.
|
|
27
|
+
# @!attribute gtin
|
|
28
|
+
# @return [String] The Global Trade Item Number. [Optional]
|
|
29
|
+
# @!attribute mpn
|
|
30
|
+
# @return [String] The Manufacturer Part Number. [Optional]
|
|
31
|
+
# @!attribute brand
|
|
32
|
+
# @return [String] The product's brand. [Optional]
|
|
33
|
+
# @!attribute category
|
|
34
|
+
# @return [String] The product's category. [Optional]
|
|
35
|
+
# @!attribute price
|
|
36
|
+
# @return [InventoryMoney] The product's list price. [Optional] When set together with
|
|
37
|
+
# sale_price, sale_price must share its currency and be less than or equal to it.
|
|
38
|
+
# @!attribute sale_price
|
|
39
|
+
# @return [InventoryMoney] The product's discounted price. [Optional] Must share price's
|
|
40
|
+
# currency and be less than or equal to it.
|
|
41
|
+
# @!attribute sale_price_starts_at
|
|
42
|
+
# @return [Time] When the sale price becomes active. [Optional] Pairs with sale_price.
|
|
43
|
+
# Format: date-time (RFC 3339).
|
|
44
|
+
# @!attribute sale_price_ends_at
|
|
45
|
+
# @return [Time] When the sale price stops being active. [Optional] Pairs with
|
|
46
|
+
# sale_price. Format: date-time (RFC 3339).
|
|
47
|
+
# @!attribute group_id
|
|
48
|
+
# @return [String] Identifies a group of related variants (e.g. the same product in
|
|
49
|
+
# different colors/sizes). [Optional] Per spec (not a formal schema constraint), when
|
|
50
|
+
# set, color and size are both required.
|
|
51
|
+
# @!attribute group_title
|
|
52
|
+
# @return [String] The title shared by the variant group. [Optional]
|
|
53
|
+
# @!attribute color
|
|
54
|
+
# @return [String] The variant's color. [Optional] Required when group_id is set (spec
|
|
55
|
+
# text, not a formal constraint).
|
|
56
|
+
# @!attribute size
|
|
57
|
+
# @return [String] The variant's size. [Optional] Required when group_id is set (spec
|
|
58
|
+
# text, not a formal constraint).
|
|
59
|
+
# @!attribute size_system
|
|
60
|
+
# @return [String] The sizing system the size value uses. [Optional]
|
|
61
|
+
# @!attribute gender
|
|
62
|
+
# @return [String] The target gender for the product. [Optional]
|
|
63
|
+
# @!attribute condition
|
|
64
|
+
# @return [String] The product's condition. [Optional] Enum: "new" "used" "refurbished".
|
|
65
|
+
# Exact lowercase match. Default: "new".
|
|
66
|
+
# @!attribute material
|
|
67
|
+
# @return [String] The product's material. [Optional]
|
|
68
|
+
# @!attribute age_group
|
|
69
|
+
# @return [String] The target age group for the product. [Optional]
|
|
70
|
+
# @!attribute length
|
|
71
|
+
# @return [Float] The product's length. [Optional]
|
|
72
|
+
# @!attribute width
|
|
73
|
+
# @return [Float] The product's width. [Optional]
|
|
74
|
+
# @!attribute height
|
|
75
|
+
# @return [Float] The product's height. [Optional]
|
|
76
|
+
# @!attribute dimension_unit
|
|
77
|
+
# @return [String] The unit used for length, width and height. [Optional]
|
|
78
|
+
# @!attribute weight
|
|
79
|
+
# @return [Float] The product's weight. [Optional]
|
|
80
|
+
# @!attribute weight_unit
|
|
81
|
+
# @return [String] The unit used for weight. [Optional]
|
|
82
|
+
# @!attribute expiration_date
|
|
83
|
+
# @return [Time] The product's expiration date. [Optional] Format: date-time
|
|
84
|
+
# (RFC 3339).
|
|
85
|
+
# @!attribute harmonized_system_code
|
|
86
|
+
# @return [String] The Harmonized System code used for customs. [Optional]
|
|
87
|
+
# @!attribute country_of_origin
|
|
88
|
+
# @return [String] The product's country of origin. [Optional] 2-letter ISO 3166-1
|
|
89
|
+
# alpha-2 code.
|
|
90
|
+
# @!attribute seller_name
|
|
91
|
+
# @return [String] The seller's name. [Optional]
|
|
92
|
+
# @!attribute seller_url
|
|
93
|
+
# @return [String] The seller's URL. [Optional]
|
|
94
|
+
# @!attribute seller_privacy_policy
|
|
95
|
+
# @return [String] The URL of the seller's privacy policy. [Optional]
|
|
96
|
+
# @!attribute seller_tos
|
|
97
|
+
# @return [String] The URL of the seller's terms of service. [Optional]
|
|
98
|
+
class InventorySetProductRequest
|
|
99
|
+
attr_accessor :title,
|
|
100
|
+
:description,
|
|
101
|
+
:product_url,
|
|
102
|
+
:image_url,
|
|
103
|
+
:additional_image_urls,
|
|
104
|
+
:video_url,
|
|
105
|
+
:model_3d_url,
|
|
106
|
+
:sku,
|
|
107
|
+
:gtin,
|
|
108
|
+
:mpn,
|
|
109
|
+
:brand,
|
|
110
|
+
:category,
|
|
111
|
+
:price,
|
|
112
|
+
:sale_price,
|
|
113
|
+
:sale_price_starts_at,
|
|
114
|
+
:sale_price_ends_at,
|
|
115
|
+
:group_id,
|
|
116
|
+
:group_title,
|
|
117
|
+
:color,
|
|
118
|
+
:size,
|
|
119
|
+
:size_system,
|
|
120
|
+
:gender,
|
|
121
|
+
:condition,
|
|
122
|
+
:material,
|
|
123
|
+
:age_group,
|
|
124
|
+
:length,
|
|
125
|
+
:width,
|
|
126
|
+
:height,
|
|
127
|
+
:dimension_unit,
|
|
128
|
+
:weight,
|
|
129
|
+
:weight_unit,
|
|
130
|
+
:expiration_date,
|
|
131
|
+
:harmonized_system_code,
|
|
132
|
+
:country_of_origin,
|
|
133
|
+
:seller_name,
|
|
134
|
+
:seller_url,
|
|
135
|
+
:seller_privacy_policy,
|
|
136
|
+
:seller_tos
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CheckoutSdk
|
|
4
|
+
module Issuing
|
|
5
|
+
# The optional HTTP headers accepted when updating a card's details.
|
|
6
|
+
#
|
|
7
|
+
# Modelled as its own class rather than added to {CheckoutSdk::Common::Headers} because these
|
|
8
|
+
# two headers belong to one endpoint, and Common::Headers is shared by every client.
|
|
9
|
+
#
|
|
10
|
+
# @!attribute return_encrypted_cvv
|
|
11
|
+
# Set to "true" to retrieve the card's encrypted credentials in the response. Requires an
|
|
12
|
+
# RSA public key in the Encryption-Key header, otherwise the API answers 422 with error code
|
|
13
|
+
# encryption_key_required.
|
|
14
|
+
#
|
|
15
|
+
# A String rather than a boolean: the value is emitted verbatim as an HTTP header, and "true"
|
|
16
|
+
# is what the spec shows.
|
|
17
|
+
# [Optional]
|
|
18
|
+
# Maps to HTTP header return-encrypted-cvv.
|
|
19
|
+
# Example: "true"
|
|
20
|
+
# @return [String]
|
|
21
|
+
# @!attribute encryption_key
|
|
22
|
+
# The RSA public key used to encrypt returned credentials. Required when
|
|
23
|
+
# return_encrypted_cvv is set. Provide the public key with the BEGIN PUBLIC KEY and END
|
|
24
|
+
# PUBLIC KEY headers and any newline characters removed, encoded as Base64.
|
|
25
|
+
# [Optional]
|
|
26
|
+
# Maps to HTTP header Encryption-Key.
|
|
27
|
+
# @return [String]
|
|
28
|
+
class CardUpdateHeaders
|
|
29
|
+
attr_accessor :return_encrypted_cvv, :encryption_key
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -9,6 +9,7 @@ require 'checkout_sdk/issuing/oob_authentication_request'
|
|
|
9
9
|
require 'checkout_sdk/issuing/issuing_phone_number'
|
|
10
10
|
require 'checkout_sdk/issuing/issuing_address'
|
|
11
11
|
require 'checkout_sdk/issuing/update_cardholder_request'
|
|
12
|
+
require 'checkout_sdk/issuing/card_update_headers'
|
|
12
13
|
require 'checkout_sdk/issuing/update_card_request'
|
|
13
14
|
|
|
14
15
|
# Simulations
|
|
@@ -85,13 +85,21 @@ module CheckoutSdk
|
|
|
85
85
|
api_client.invoke_get(build_path(ISSUING, CARDS, card_id), sdk_authorization)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# Update the details of an issued card. Only the fields for which you provide values are
|
|
89
|
+
# updated.
|
|
90
|
+
#
|
|
88
91
|
# @param [String] card_id
|
|
89
92
|
# @param [Hash, UpdateCardRequest] update_card_request
|
|
90
|
-
|
|
93
|
+
# @param [CardUpdateHeaders, nil] headers the optional return-encrypted-cvv and
|
|
94
|
+
# Encryption-Key HTTP headers. Setting return_encrypted_cvv without encryption_key returns
|
|
95
|
+
# a 422 with error code encryption_key_required.
|
|
96
|
+
# @return [OpenStruct] the update response, carrying encrypted_cvv when requested
|
|
97
|
+
def update_card(card_id, update_card_request, headers = nil)
|
|
91
98
|
api_client.invoke_patch(
|
|
92
99
|
build_path(ISSUING, CARDS, card_id),
|
|
93
100
|
sdk_authorization,
|
|
94
|
-
update_card_request
|
|
101
|
+
update_card_request,
|
|
102
|
+
headers
|
|
95
103
|
)
|
|
96
104
|
end
|
|
97
105
|
|
|
@@ -5,23 +5,48 @@ module CheckoutSdk
|
|
|
5
5
|
# Request body for PATCH /issuing/cards/{cardId}.
|
|
6
6
|
#
|
|
7
7
|
# @!attribute reference
|
|
8
|
+
# Your reference.
|
|
9
|
+
# [Optional]
|
|
10
|
+
# max 256 characters
|
|
11
|
+
# Example: X-123456-N11
|
|
8
12
|
# @return [String]
|
|
9
13
|
# @!attribute metadata
|
|
14
|
+
# The user's metadata.
|
|
15
|
+
# [Optional]
|
|
10
16
|
# @return [Hash{String => String}]
|
|
11
17
|
# @!attribute expiry_month
|
|
18
|
+
# The card's expiration month.
|
|
19
|
+
# [Optional]
|
|
20
|
+
# min 1, max 12
|
|
21
|
+
# Example: 5
|
|
12
22
|
# @return [Integer]
|
|
13
23
|
# @!attribute expiry_year
|
|
24
|
+
# The card's expiration year.
|
|
25
|
+
# [Optional]
|
|
26
|
+
# min 4 characters, max 4 characters
|
|
27
|
+
# Example: 2025
|
|
14
28
|
# @return [Integer]
|
|
15
|
-
# @!attribute
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
29
|
+
# @!attribute scheduled_activation_date
|
|
30
|
+
# Date scheduling the card's first activation. Only applies to the initial activation of a
|
|
31
|
+
# card. Two formats are supported: date only (yyyy-MM-dd, treated as midnight UTC), or date
|
|
32
|
+
# with round hour (yyyy-MM-ddTHH:mmZ in UTC, or yyyy-MM-ddTHH:mm+HH:mm with offset). Only
|
|
33
|
+
# round hours are allowed when a time is provided (HH:00). The value must be at least the
|
|
34
|
+
# next round hour after the request time.
|
|
35
|
+
#
|
|
36
|
+
# Renamed from activation_date by the 2026-09-02 spec, which also removed the
|
|
37
|
+
# IssuingActivationDate schema this attribute used to cite.
|
|
38
|
+
# [Optional]
|
|
39
|
+
# Example: 2026-06-01T10:00Z
|
|
40
|
+
# @return [String]
|
|
19
41
|
# @!attribute revocation_date
|
|
20
|
-
#
|
|
21
|
-
#
|
|
42
|
+
# Date scheduling the card's automatic revocation.
|
|
43
|
+
# [Optional]
|
|
44
|
+
# Format: yyyy-MM-dd (time is midnight UTC)
|
|
45
|
+
# Example: 2027-03-12
|
|
46
|
+
# @return [String]
|
|
22
47
|
class UpdateCardRequest
|
|
23
48
|
attr_accessor :reference, :metadata, :expiry_month, :expiry_year,
|
|
24
|
-
:
|
|
49
|
+
:scheduled_activation_date, :revocation_date
|
|
25
50
|
end
|
|
26
51
|
end
|
|
27
52
|
end
|