checkout-intents 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +16 -0
  4. data/README.md +358 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/checkout_intents/client.rb +100 -0
  7. data/lib/checkout_intents/errors.rb +228 -0
  8. data/lib/checkout_intents/file_part.rb +58 -0
  9. data/lib/checkout_intents/internal/cursor_pagination.rb +125 -0
  10. data/lib/checkout_intents/internal/transport/base_client.rb +577 -0
  11. data/lib/checkout_intents/internal/transport/pooled_net_requester.rb +210 -0
  12. data/lib/checkout_intents/internal/type/array_of.rb +168 -0
  13. data/lib/checkout_intents/internal/type/base_model.rb +536 -0
  14. data/lib/checkout_intents/internal/type/base_page.rb +55 -0
  15. data/lib/checkout_intents/internal/type/boolean.rb +77 -0
  16. data/lib/checkout_intents/internal/type/converter.rb +327 -0
  17. data/lib/checkout_intents/internal/type/enum.rb +131 -0
  18. data/lib/checkout_intents/internal/type/file_input.rb +111 -0
  19. data/lib/checkout_intents/internal/type/hash_of.rb +188 -0
  20. data/lib/checkout_intents/internal/type/request_parameters.rb +42 -0
  21. data/lib/checkout_intents/internal/type/union.rb +258 -0
  22. data/lib/checkout_intents/internal/type/unknown.rb +81 -0
  23. data/lib/checkout_intents/internal/util.rb +920 -0
  24. data/lib/checkout_intents/internal.rb +20 -0
  25. data/lib/checkout_intents/models/base_checkout_intent.rb +76 -0
  26. data/lib/checkout_intents/models/betas/checkout_session_create_params.rb +148 -0
  27. data/lib/checkout_intents/models/brand_retrieve_params.rb +14 -0
  28. data/lib/checkout_intents/models/brand_retrieve_response.rb +52 -0
  29. data/lib/checkout_intents/models/buyer.rb +69 -0
  30. data/lib/checkout_intents/models/checkout_intent.rb +230 -0
  31. data/lib/checkout_intents/models/checkout_intent_add_payment_params.rb +20 -0
  32. data/lib/checkout_intents/models/checkout_intent_confirm_params.rb +20 -0
  33. data/lib/checkout_intents/models/checkout_intent_create_params.rb +68 -0
  34. data/lib/checkout_intents/models/checkout_intent_list_params.rb +58 -0
  35. data/lib/checkout_intents/models/checkout_intent_purchase_params.rb +74 -0
  36. data/lib/checkout_intents/models/checkout_intent_retrieve_params.rb +14 -0
  37. data/lib/checkout_intents/models/checkout_session.rb +23 -0
  38. data/lib/checkout_intents/models/money.rb +21 -0
  39. data/lib/checkout_intents/models/offer.rb +113 -0
  40. data/lib/checkout_intents/models/payment_method.rb +120 -0
  41. data/lib/checkout_intents/models/variant_selection.rb +33 -0
  42. data/lib/checkout_intents/models.rb +76 -0
  43. data/lib/checkout_intents/request_options.rb +78 -0
  44. data/lib/checkout_intents/resources/betas/checkout_sessions.rb +54 -0
  45. data/lib/checkout_intents/resources/betas.rb +18 -0
  46. data/lib/checkout_intents/resources/brands.rb +37 -0
  47. data/lib/checkout_intents/resources/checkout_intents.rb +173 -0
  48. data/lib/checkout_intents/version.rb +5 -0
  49. data/lib/checkout_intents.rb +77 -0
  50. data/manifest.yaml +17 -0
  51. data/rbi/checkout_intents/client.rbi +74 -0
  52. data/rbi/checkout_intents/errors.rbi +205 -0
  53. data/rbi/checkout_intents/file_part.rbi +37 -0
  54. data/rbi/checkout_intents/internal/cursor_pagination.rbi +74 -0
  55. data/rbi/checkout_intents/internal/transport/base_client.rbi +309 -0
  56. data/rbi/checkout_intents/internal/transport/pooled_net_requester.rbi +84 -0
  57. data/rbi/checkout_intents/internal/type/array_of.rbi +108 -0
  58. data/rbi/checkout_intents/internal/type/base_model.rbi +314 -0
  59. data/rbi/checkout_intents/internal/type/base_page.rbi +43 -0
  60. data/rbi/checkout_intents/internal/type/boolean.rbi +58 -0
  61. data/rbi/checkout_intents/internal/type/converter.rbi +225 -0
  62. data/rbi/checkout_intents/internal/type/enum.rbi +82 -0
  63. data/rbi/checkout_intents/internal/type/file_input.rbi +59 -0
  64. data/rbi/checkout_intents/internal/type/hash_of.rbi +108 -0
  65. data/rbi/checkout_intents/internal/type/request_parameters.rbi +31 -0
  66. data/rbi/checkout_intents/internal/type/union.rbi +134 -0
  67. data/rbi/checkout_intents/internal/type/unknown.rbi +58 -0
  68. data/rbi/checkout_intents/internal/util.rbi +487 -0
  69. data/rbi/checkout_intents/internal.rbi +18 -0
  70. data/rbi/checkout_intents/models/base_checkout_intent.rbi +142 -0
  71. data/rbi/checkout_intents/models/betas/checkout_session_create_params.rbi +281 -0
  72. data/rbi/checkout_intents/models/brand_retrieve_params.rbi +32 -0
  73. data/rbi/checkout_intents/models/brand_retrieve_response.rbi +109 -0
  74. data/rbi/checkout_intents/models/buyer.rbi +92 -0
  75. data/rbi/checkout_intents/models/checkout_intent.rbi +653 -0
  76. data/rbi/checkout_intents/models/checkout_intent_add_payment_params.rbi +59 -0
  77. data/rbi/checkout_intents/models/checkout_intent_confirm_params.rbi +59 -0
  78. data/rbi/checkout_intents/models/checkout_intent_create_params.rbi +141 -0
  79. data/rbi/checkout_intents/models/checkout_intent_list_params.rbi +146 -0
  80. data/rbi/checkout_intents/models/checkout_intent_purchase_params.rbi +165 -0
  81. data/rbi/checkout_intents/models/checkout_intent_retrieve_params.rbi +32 -0
  82. data/rbi/checkout_intents/models/checkout_session.rbi +36 -0
  83. data/rbi/checkout_intents/models/money.rbi +32 -0
  84. data/rbi/checkout_intents/models/offer.rbi +225 -0
  85. data/rbi/checkout_intents/models/payment_method.rbi +292 -0
  86. data/rbi/checkout_intents/models/variant_selection.rbi +55 -0
  87. data/rbi/checkout_intents/models.rbi +40 -0
  88. data/rbi/checkout_intents/request_options.rbi +64 -0
  89. data/rbi/checkout_intents/resources/betas/checkout_sessions.rbi +47 -0
  90. data/rbi/checkout_intents/resources/betas.rbi +15 -0
  91. data/rbi/checkout_intents/resources/brands.rbi +29 -0
  92. data/rbi/checkout_intents/resources/checkout_intents.rbi +165 -0
  93. data/rbi/checkout_intents/version.rbi +5 -0
  94. data/sig/checkout_intents/client.rbs +36 -0
  95. data/sig/checkout_intents/errors.rbs +117 -0
  96. data/sig/checkout_intents/file_part.rbs +21 -0
  97. data/sig/checkout_intents/internal/cursor_pagination.rbs +48 -0
  98. data/sig/checkout_intents/internal/transport/base_client.rbs +133 -0
  99. data/sig/checkout_intents/internal/transport/pooled_net_requester.rbs +48 -0
  100. data/sig/checkout_intents/internal/type/array_of.rbs +48 -0
  101. data/sig/checkout_intents/internal/type/base_model.rbs +104 -0
  102. data/sig/checkout_intents/internal/type/base_page.rbs +24 -0
  103. data/sig/checkout_intents/internal/type/boolean.rbs +26 -0
  104. data/sig/checkout_intents/internal/type/converter.rbs +79 -0
  105. data/sig/checkout_intents/internal/type/enum.rbs +32 -0
  106. data/sig/checkout_intents/internal/type/file_input.rbs +25 -0
  107. data/sig/checkout_intents/internal/type/hash_of.rbs +48 -0
  108. data/sig/checkout_intents/internal/type/request_parameters.rbs +20 -0
  109. data/sig/checkout_intents/internal/type/union.rbs +52 -0
  110. data/sig/checkout_intents/internal/type/unknown.rbs +26 -0
  111. data/sig/checkout_intents/internal/util.rbs +185 -0
  112. data/sig/checkout_intents/internal.rbs +10 -0
  113. data/sig/checkout_intents/models/base_checkout_intent.rbs +88 -0
  114. data/sig/checkout_intents/models/betas/checkout_session_create_params.rbs +172 -0
  115. data/sig/checkout_intents/models/brand_retrieve_params.rbs +15 -0
  116. data/sig/checkout_intents/models/brand_retrieve_response.rbs +43 -0
  117. data/sig/checkout_intents/models/buyer.rbs +67 -0
  118. data/sig/checkout_intents/models/checkout_intent.rbs +324 -0
  119. data/sig/checkout_intents/models/checkout_intent_add_payment_params.rbs +24 -0
  120. data/sig/checkout_intents/models/checkout_intent_confirm_params.rbs +24 -0
  121. data/sig/checkout_intents/models/checkout_intent_create_params.rbs +84 -0
  122. data/sig/checkout_intents/models/checkout_intent_list_params.rbs +77 -0
  123. data/sig/checkout_intents/models/checkout_intent_purchase_params.rbs +89 -0
  124. data/sig/checkout_intents/models/checkout_intent_retrieve_params.rbs +15 -0
  125. data/sig/checkout_intents/models/checkout_session.rbs +13 -0
  126. data/sig/checkout_intents/models/money.rbs +15 -0
  127. data/sig/checkout_intents/models/offer.rbs +135 -0
  128. data/sig/checkout_intents/models/payment_method.rbs +127 -0
  129. data/sig/checkout_intents/models/variant_selection.rbs +30 -0
  130. data/sig/checkout_intents/models.rbs +33 -0
  131. data/sig/checkout_intents/request_options.rbs +36 -0
  132. data/sig/checkout_intents/resources/betas/checkout_sessions.rbs +19 -0
  133. data/sig/checkout_intents/resources/betas.rbs +9 -0
  134. data/sig/checkout_intents/resources/brands.rbs +12 -0
  135. data/sig/checkout_intents/resources/checkout_intents.rbs +54 -0
  136. data/sig/checkout_intents/version.rbs +3 -0
  137. metadata +194 -0
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ # @see CheckoutIntents::Resources::CheckoutIntents#create
6
+ class CheckoutIntentCreateParams < CheckoutIntents::Internal::Type::BaseModel
7
+ extend CheckoutIntents::Internal::Type::RequestParameters::Converter
8
+ include CheckoutIntents::Internal::Type::RequestParameters
9
+
10
+ # @!attribute buyer
11
+ #
12
+ # @return [CheckoutIntents::Models::Buyer]
13
+ required :buyer, -> { CheckoutIntents::Buyer }
14
+
15
+ # @!attribute product_url
16
+ #
17
+ # @return [String]
18
+ required :product_url, String, api_name: :productUrl
19
+
20
+ # @!attribute quantity
21
+ #
22
+ # @return [Float]
23
+ required :quantity, Float
24
+
25
+ # @!attribute constraints
26
+ #
27
+ # @return [CheckoutIntents::Models::CheckoutIntentCreateParams::Constraints, nil]
28
+ optional :constraints, -> { CheckoutIntents::CheckoutIntentCreateParams::Constraints }
29
+
30
+ # @!attribute promo_codes
31
+ #
32
+ # @return [Array<String>, nil]
33
+ optional :promo_codes, CheckoutIntents::Internal::Type::ArrayOf[String], api_name: :promoCodes
34
+
35
+ # @!attribute variant_selections
36
+ #
37
+ # @return [Array<CheckoutIntents::Models::VariantSelection>, nil]
38
+ optional :variant_selections,
39
+ -> { CheckoutIntents::Internal::Type::ArrayOf[CheckoutIntents::VariantSelection] },
40
+ api_name: :variantSelections
41
+
42
+ # @!method initialize(buyer:, product_url:, quantity:, constraints: nil, promo_codes: nil, variant_selections: nil, request_options: {})
43
+ # @param buyer [CheckoutIntents::Models::Buyer]
44
+ # @param product_url [String]
45
+ # @param quantity [Float]
46
+ # @param constraints [CheckoutIntents::Models::CheckoutIntentCreateParams::Constraints]
47
+ # @param promo_codes [Array<String>]
48
+ # @param variant_selections [Array<CheckoutIntents::Models::VariantSelection>]
49
+ # @param request_options [CheckoutIntents::RequestOptions, Hash{Symbol=>Object}]
50
+
51
+ class Constraints < CheckoutIntents::Internal::Type::BaseModel
52
+ # @!attribute max_shipping_price
53
+ #
54
+ # @return [Integer, nil]
55
+ optional :max_shipping_price, Integer, api_name: :maxShippingPrice
56
+
57
+ # @!attribute max_total_price
58
+ #
59
+ # @return [Integer, nil]
60
+ optional :max_total_price, Integer, api_name: :maxTotalPrice
61
+
62
+ # @!method initialize(max_shipping_price: nil, max_total_price: nil)
63
+ # @param max_shipping_price [Integer]
64
+ # @param max_total_price [Integer]
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ # @see CheckoutIntents::Resources::CheckoutIntents#list
6
+ class CheckoutIntentListParams < CheckoutIntents::Internal::Type::BaseModel
7
+ extend CheckoutIntents::Internal::Type::RequestParameters::Converter
8
+ include CheckoutIntents::Internal::Type::RequestParameters
9
+
10
+ # @!attribute id
11
+ #
12
+ # @return [Array<String>, nil]
13
+ optional :id, CheckoutIntents::Internal::Type::ArrayOf[String]
14
+
15
+ # @!attribute after
16
+ #
17
+ # @return [String, nil]
18
+ optional :after, String
19
+
20
+ # @!attribute before
21
+ #
22
+ # @return [String, nil]
23
+ optional :before, String
24
+
25
+ # @!attribute limit
26
+ #
27
+ # @return [Float, nil]
28
+ optional :limit, Float
29
+
30
+ # @!attribute state
31
+ #
32
+ # @return [Array<Symbol, CheckoutIntents::Models::CheckoutIntentListParams::State>, nil]
33
+ optional :state,
34
+ -> { CheckoutIntents::Internal::Type::ArrayOf[enum: CheckoutIntents::CheckoutIntentListParams::State] }
35
+
36
+ # @!method initialize(id: nil, after: nil, before: nil, limit: nil, state: nil, request_options: {})
37
+ # @param id [Array<String>]
38
+ # @param after [String]
39
+ # @param before [String]
40
+ # @param limit [Float]
41
+ # @param state [Array<Symbol, CheckoutIntents::Models::CheckoutIntentListParams::State>]
42
+ # @param request_options [CheckoutIntents::RequestOptions, Hash{Symbol=>Object}]
43
+
44
+ module State
45
+ extend CheckoutIntents::Internal::Type::Enum
46
+
47
+ RETRIEVING_OFFER = :retrieving_offer
48
+ AWAITING_CONFIRMATION = :awaiting_confirmation
49
+ PLACING_ORDER = :placing_order
50
+ COMPLETED = :completed
51
+ FAILED = :failed
52
+
53
+ # @!method self.values
54
+ # @return [Array<Symbol>]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ # @see CheckoutIntents::Resources::CheckoutIntents#purchase
6
+ class CheckoutIntentPurchaseParams < CheckoutIntents::Internal::Type::BaseModel
7
+ extend CheckoutIntents::Internal::Type::RequestParameters::Converter
8
+ include CheckoutIntents::Internal::Type::RequestParameters
9
+
10
+ # @!attribute buyer
11
+ #
12
+ # @return [CheckoutIntents::Models::Buyer]
13
+ required :buyer, -> { CheckoutIntents::Buyer }
14
+
15
+ # @!attribute payment_method
16
+ #
17
+ # @return [CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod, CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod, CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod]
18
+ required :payment_method, union: -> { CheckoutIntents::PaymentMethod }, api_name: :paymentMethod
19
+
20
+ # @!attribute product_url
21
+ #
22
+ # @return [String]
23
+ required :product_url, String, api_name: :productUrl
24
+
25
+ # @!attribute quantity
26
+ #
27
+ # @return [Float]
28
+ required :quantity, Float
29
+
30
+ # @!attribute constraints
31
+ #
32
+ # @return [CheckoutIntents::Models::CheckoutIntentPurchaseParams::Constraints, nil]
33
+ optional :constraints, -> { CheckoutIntents::CheckoutIntentPurchaseParams::Constraints }
34
+
35
+ # @!attribute promo_codes
36
+ #
37
+ # @return [Array<String>, nil]
38
+ optional :promo_codes, CheckoutIntents::Internal::Type::ArrayOf[String], api_name: :promoCodes
39
+
40
+ # @!attribute variant_selections
41
+ #
42
+ # @return [Array<CheckoutIntents::Models::VariantSelection>, nil]
43
+ optional :variant_selections,
44
+ -> { CheckoutIntents::Internal::Type::ArrayOf[CheckoutIntents::VariantSelection] },
45
+ api_name: :variantSelections
46
+
47
+ # @!method initialize(buyer:, payment_method:, product_url:, quantity:, constraints: nil, promo_codes: nil, variant_selections: nil, request_options: {})
48
+ # @param buyer [CheckoutIntents::Models::Buyer]
49
+ # @param payment_method [CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod, CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod, CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod]
50
+ # @param product_url [String]
51
+ # @param quantity [Float]
52
+ # @param constraints [CheckoutIntents::Models::CheckoutIntentPurchaseParams::Constraints]
53
+ # @param promo_codes [Array<String>]
54
+ # @param variant_selections [Array<CheckoutIntents::Models::VariantSelection>]
55
+ # @param request_options [CheckoutIntents::RequestOptions, Hash{Symbol=>Object}]
56
+
57
+ class Constraints < CheckoutIntents::Internal::Type::BaseModel
58
+ # @!attribute max_shipping_price
59
+ #
60
+ # @return [Integer, nil]
61
+ optional :max_shipping_price, Integer, api_name: :maxShippingPrice
62
+
63
+ # @!attribute max_total_price
64
+ #
65
+ # @return [Integer, nil]
66
+ optional :max_total_price, Integer, api_name: :maxTotalPrice
67
+
68
+ # @!method initialize(max_shipping_price: nil, max_total_price: nil)
69
+ # @param max_shipping_price [Integer]
70
+ # @param max_total_price [Integer]
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ # @see CheckoutIntents::Resources::CheckoutIntents#retrieve
6
+ class CheckoutIntentRetrieveParams < CheckoutIntents::Internal::Type::BaseModel
7
+ extend CheckoutIntents::Internal::Type::RequestParameters::Converter
8
+ include CheckoutIntents::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [CheckoutIntents::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ class CheckoutSession < CheckoutIntents::Internal::Type::BaseModel
6
+ # @!attribute url
7
+ # URL to send your user to for checkout. This URL is valid for 4 hours.
8
+ #
9
+ # @return [String]
10
+ required :url, String
11
+
12
+ # @!method initialize(url:)
13
+ # A checkout session represents a hosted checkout form that shoppers can use to
14
+ # complete their purchases.
15
+ #
16
+ # Checkout sessions provide a pre-built UI for collecting payment and shipping
17
+ # information, allowing you to quickly integrate checkout functionality without
18
+ # building your own forms.
19
+ #
20
+ # @param url [String] URL to send your user to for checkout. This URL is valid for 4 hours.
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ class Money < CheckoutIntents::Internal::Type::BaseModel
6
+ # @!attribute amount_subunits
7
+ #
8
+ # @return [Float]
9
+ required :amount_subunits, Float, api_name: :amountSubunits
10
+
11
+ # @!attribute currency_code
12
+ #
13
+ # @return [String]
14
+ required :currency_code, String, api_name: :currencyCode
15
+
16
+ # @!method initialize(amount_subunits:, currency_code:)
17
+ # @param amount_subunits [Float]
18
+ # @param currency_code [String]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ class Offer < CheckoutIntents::Internal::Type::BaseModel
6
+ # @!attribute cost
7
+ #
8
+ # @return [CheckoutIntents::Models::Offer::Cost]
9
+ required :cost, -> { CheckoutIntents::Offer::Cost }
10
+
11
+ # @!attribute shipping
12
+ #
13
+ # @return [CheckoutIntents::Models::Offer::Shipping]
14
+ required :shipping, -> { CheckoutIntents::Offer::Shipping }
15
+
16
+ # @!attribute applied_promo_codes
17
+ #
18
+ # @return [Array<String>, nil]
19
+ optional :applied_promo_codes,
20
+ CheckoutIntents::Internal::Type::ArrayOf[String],
21
+ api_name: :appliedPromoCodes
22
+
23
+ # @!method initialize(cost:, shipping:, applied_promo_codes: nil)
24
+ # @param cost [CheckoutIntents::Models::Offer::Cost]
25
+ # @param shipping [CheckoutIntents::Models::Offer::Shipping]
26
+ # @param applied_promo_codes [Array<String>]
27
+
28
+ # @see CheckoutIntents::Models::Offer#cost
29
+ class Cost < CheckoutIntents::Internal::Type::BaseModel
30
+ # @!attribute subtotal
31
+ #
32
+ # @return [CheckoutIntents::Models::Money]
33
+ required :subtotal, -> { CheckoutIntents::Money }
34
+
35
+ # @!attribute total
36
+ #
37
+ # @return [CheckoutIntents::Models::Money]
38
+ required :total, -> { CheckoutIntents::Money }
39
+
40
+ # @!attribute discount
41
+ #
42
+ # @return [CheckoutIntents::Models::Money, nil]
43
+ optional :discount, -> { CheckoutIntents::Money }
44
+
45
+ # @!attribute shipping
46
+ #
47
+ # @return [CheckoutIntents::Models::Money, nil]
48
+ optional :shipping, -> { CheckoutIntents::Money }
49
+
50
+ # @!attribute surcharge
51
+ #
52
+ # @return [CheckoutIntents::Models::Money, nil]
53
+ optional :surcharge, -> { CheckoutIntents::Money }
54
+
55
+ # @!attribute tax
56
+ #
57
+ # @return [CheckoutIntents::Models::Money, nil]
58
+ optional :tax, -> { CheckoutIntents::Money }
59
+
60
+ # @!method initialize(subtotal:, total:, discount: nil, shipping: nil, surcharge: nil, tax: nil)
61
+ # @param subtotal [CheckoutIntents::Models::Money]
62
+ # @param total [CheckoutIntents::Models::Money]
63
+ # @param discount [CheckoutIntents::Models::Money]
64
+ # @param shipping [CheckoutIntents::Models::Money]
65
+ # @param surcharge [CheckoutIntents::Models::Money]
66
+ # @param tax [CheckoutIntents::Models::Money]
67
+ end
68
+
69
+ # @see CheckoutIntents::Models::Offer#shipping
70
+ class Shipping < CheckoutIntents::Internal::Type::BaseModel
71
+ # @!attribute available_options
72
+ #
73
+ # @return [Array<CheckoutIntents::Models::Offer::Shipping::AvailableOption>]
74
+ required :available_options,
75
+ -> {
76
+ CheckoutIntents::Internal::Type::ArrayOf[CheckoutIntents::Offer::Shipping::AvailableOption]
77
+ },
78
+ api_name: :availableOptions
79
+
80
+ # @!attribute selected_option_id
81
+ #
82
+ # @return [String, nil]
83
+ optional :selected_option_id, String, api_name: :selectedOptionId
84
+
85
+ # @!method initialize(available_options:, selected_option_id: nil)
86
+ # @param available_options [Array<CheckoutIntents::Models::Offer::Shipping::AvailableOption>]
87
+ # @param selected_option_id [String]
88
+
89
+ class AvailableOption < CheckoutIntents::Internal::Type::BaseModel
90
+ # @!attribute id
91
+ #
92
+ # @return [String]
93
+ required :id, String
94
+
95
+ # @!attribute cost
96
+ #
97
+ # @return [CheckoutIntents::Models::Money]
98
+ required :cost, -> { CheckoutIntents::Money }
99
+
100
+ # @!attribute discount
101
+ #
102
+ # @return [CheckoutIntents::Models::Money, nil]
103
+ optional :discount, -> { CheckoutIntents::Money }
104
+
105
+ # @!method initialize(id:, cost:, discount: nil)
106
+ # @param id [String]
107
+ # @param cost [CheckoutIntents::Models::Money]
108
+ # @param discount [CheckoutIntents::Models::Money]
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ module PaymentMethod
6
+ extend CheckoutIntents::Internal::Type::Union
7
+
8
+ variant -> { CheckoutIntents::PaymentMethod::StripeTokenPaymentMethod }
9
+
10
+ variant -> { CheckoutIntents::PaymentMethod::BasisTheoryPaymentMethod }
11
+
12
+ variant -> { CheckoutIntents::PaymentMethod::NekudaPaymentMethod }
13
+
14
+ class StripeTokenPaymentMethod < CheckoutIntents::Internal::Type::BaseModel
15
+ # @!attribute stripe_token
16
+ #
17
+ # @return [String]
18
+ required :stripe_token, String, api_name: :stripeToken
19
+
20
+ # @!attribute type
21
+ #
22
+ # @return [Symbol, CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod::Type]
23
+ required :type, enum: -> { CheckoutIntents::PaymentMethod::StripeTokenPaymentMethod::Type }
24
+
25
+ # @!method initialize(stripe_token:, type:)
26
+ # @param stripe_token [String]
27
+ # @param type [Symbol, CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod::Type]
28
+
29
+ # @see CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod#type
30
+ module Type
31
+ extend CheckoutIntents::Internal::Type::Enum
32
+
33
+ STRIPE_TOKEN = :stripe_token
34
+
35
+ # @!method self.values
36
+ # @return [Array<Symbol>]
37
+ end
38
+ end
39
+
40
+ class BasisTheoryPaymentMethod < CheckoutIntents::Internal::Type::BaseModel
41
+ # @!attribute basis_theory_token
42
+ #
43
+ # @return [String]
44
+ required :basis_theory_token, String, api_name: :basisTheoryToken
45
+
46
+ # @!attribute type
47
+ #
48
+ # @return [Symbol, CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod::Type]
49
+ required :type, enum: -> { CheckoutIntents::PaymentMethod::BasisTheoryPaymentMethod::Type }
50
+
51
+ # @!method initialize(basis_theory_token:, type:)
52
+ # @param basis_theory_token [String]
53
+ # @param type [Symbol, CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod::Type]
54
+
55
+ # @see CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod#type
56
+ module Type
57
+ extend CheckoutIntents::Internal::Type::Enum
58
+
59
+ BASIS_THEORY_TOKEN = :basis_theory_token
60
+
61
+ # @!method self.values
62
+ # @return [Array<Symbol>]
63
+ end
64
+ end
65
+
66
+ class NekudaPaymentMethod < CheckoutIntents::Internal::Type::BaseModel
67
+ # @!attribute nekuda_user_id
68
+ #
69
+ # @return [String]
70
+ required :nekuda_user_id, String, api_name: :nekudaUserId
71
+
72
+ # @!attribute type
73
+ #
74
+ # @return [Symbol, CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod::Type]
75
+ required :type, enum: -> { CheckoutIntents::PaymentMethod::NekudaPaymentMethod::Type }
76
+
77
+ # @!attribute nekuda_mandate_data
78
+ # Construct a type with a set of properties K of type T
79
+ #
80
+ # @return [Hash{Symbol=>String, Float}, nil]
81
+ optional :nekuda_mandate_data,
82
+ -> {
83
+ CheckoutIntents::Internal::Type::HashOf[union: CheckoutIntents::PaymentMethod::NekudaPaymentMethod::NekudaMandateData]
84
+ },
85
+ api_name: :nekudaMandateData
86
+
87
+ # @!method initialize(nekuda_user_id:, type:, nekuda_mandate_data: nil)
88
+ # @param nekuda_user_id [String]
89
+ #
90
+ # @param type [Symbol, CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod::Type]
91
+ #
92
+ # @param nekuda_mandate_data [Hash{Symbol=>String, Float}] Construct a type with a set of properties K of type T
93
+
94
+ # @see CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod#type
95
+ module Type
96
+ extend CheckoutIntents::Internal::Type::Enum
97
+
98
+ NEKUDA_TOKEN = :nekuda_token
99
+
100
+ # @!method self.values
101
+ # @return [Array<Symbol>]
102
+ end
103
+
104
+ module NekudaMandateData
105
+ extend CheckoutIntents::Internal::Type::Union
106
+
107
+ variant String
108
+
109
+ variant Float
110
+
111
+ # @!method self.variants
112
+ # @return [Array(String, Float)]
113
+ end
114
+ end
115
+
116
+ # @!method self.variants
117
+ # @return [Array(CheckoutIntents::Models::PaymentMethod::StripeTokenPaymentMethod, CheckoutIntents::Models::PaymentMethod::BasisTheoryPaymentMethod, CheckoutIntents::Models::PaymentMethod::NekudaPaymentMethod)]
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ module Models
5
+ class VariantSelection < CheckoutIntents::Internal::Type::BaseModel
6
+ # @!attribute label
7
+ #
8
+ # @return [String]
9
+ required :label, String
10
+
11
+ # @!attribute value
12
+ #
13
+ # @return [String, Float]
14
+ required :value, union: -> { CheckoutIntents::VariantSelection::Value }
15
+
16
+ # @!method initialize(label:, value:)
17
+ # @param label [String]
18
+ # @param value [String, Float]
19
+
20
+ # @see CheckoutIntents::Models::VariantSelection#value
21
+ module Value
22
+ extend CheckoutIntents::Internal::Type::Union
23
+
24
+ variant String
25
+
26
+ variant Float
27
+
28
+ # @!method self.variants
29
+ # @return [Array(String, Float)]
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ [
5
+ CheckoutIntents::Internal::Type::BaseModel,
6
+ *CheckoutIntents::Internal::Type::BaseModel.subclasses
7
+ ].each do |cls|
8
+ cls.define_sorbet_constant!(:OrHash) { T.type_alias { T.any(cls, CheckoutIntents::Internal::AnyHash) } }
9
+ end
10
+
11
+ CheckoutIntents::Internal::Util.walk_namespaces(CheckoutIntents::Models).each do |mod|
12
+ case mod
13
+ in CheckoutIntents::Internal::Type::Enum | CheckoutIntents::Internal::Type::Union
14
+ mod.constants.each do |name|
15
+ case mod.const_get(name)
16
+ in true | false
17
+ mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
18
+ mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
19
+ in Integer
20
+ mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
21
+ mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
22
+ in Float
23
+ mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
24
+ mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
25
+ in Symbol
26
+ mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
27
+ mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
28
+ else
29
+ end
30
+ end
31
+ else
32
+ end
33
+ end
34
+
35
+ CheckoutIntents::Internal::Util.walk_namespaces(CheckoutIntents::Models)
36
+ .lazy
37
+ .grep(CheckoutIntents::Internal::Type::Union)
38
+ .each do |mod|
39
+ const = :Variants
40
+ next if mod.sorbet_constant_defined?(const)
41
+
42
+ mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
43
+ end
44
+
45
+ BaseCheckoutIntent = CheckoutIntents::Models::BaseCheckoutIntent
46
+
47
+ Betas = CheckoutIntents::Models::Betas
48
+
49
+ BrandRetrieveParams = CheckoutIntents::Models::BrandRetrieveParams
50
+
51
+ Buyer = CheckoutIntents::Models::Buyer
52
+
53
+ CheckoutIntent = CheckoutIntents::Models::CheckoutIntent
54
+
55
+ CheckoutIntentAddPaymentParams = CheckoutIntents::Models::CheckoutIntentAddPaymentParams
56
+
57
+ CheckoutIntentConfirmParams = CheckoutIntents::Models::CheckoutIntentConfirmParams
58
+
59
+ CheckoutIntentCreateParams = CheckoutIntents::Models::CheckoutIntentCreateParams
60
+
61
+ CheckoutIntentListParams = CheckoutIntents::Models::CheckoutIntentListParams
62
+
63
+ CheckoutIntentPurchaseParams = CheckoutIntents::Models::CheckoutIntentPurchaseParams
64
+
65
+ CheckoutIntentRetrieveParams = CheckoutIntents::Models::CheckoutIntentRetrieveParams
66
+
67
+ CheckoutSession = CheckoutIntents::Models::CheckoutSession
68
+
69
+ Money = CheckoutIntents::Models::Money
70
+
71
+ Offer = CheckoutIntents::Models::Offer
72
+
73
+ PaymentMethod = CheckoutIntents::Models::PaymentMethod
74
+
75
+ VariantSelection = CheckoutIntents::Models::VariantSelection
76
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CheckoutIntents
4
+ # Specify HTTP behaviour to use for a specific request. These options supplement
5
+ # or override those provided at the client level.
6
+ #
7
+ # When making a request, you can pass an actual {RequestOptions} instance, or
8
+ # simply pass a Hash with symbol keys matching the attributes on this class.
9
+ class RequestOptions < CheckoutIntents::Internal::Type::BaseModel
10
+ # @api private
11
+ #
12
+ # @param opts [CheckoutIntents::RequestOptions, Hash{Symbol=>Object}]
13
+ #
14
+ # @raise [ArgumentError]
15
+ def self.validate!(opts)
16
+ case opts
17
+ in CheckoutIntents::RequestOptions | Hash
18
+ opts.to_h.each_key do |k|
19
+ unless fields.include?(k)
20
+ raise ArgumentError.new("Request `opts` keys must be one of #{fields.keys}, got #{k.inspect}")
21
+ end
22
+ end
23
+ else
24
+ raise ArgumentError.new("Request `opts` must be a Hash or RequestOptions, got #{opts.inspect}")
25
+ end
26
+ end
27
+
28
+ # @!attribute idempotency_key
29
+ # Idempotency key to send with request and all associated retries. Will only be
30
+ # sent for write requests.
31
+ #
32
+ # @return [String, nil]
33
+ optional :idempotency_key, String
34
+
35
+ # @!attribute extra_query
36
+ # Extra query params to send with the request. These are `.merge`’d into any
37
+ # `query` given at the client level.
38
+ #
39
+ # @return [Hash{String=>Array<String>, String, nil}, nil]
40
+ optional :extra_query,
41
+ CheckoutIntents::Internal::Type::HashOf[CheckoutIntents::Internal::Type::ArrayOf[String]]
42
+
43
+ # @!attribute extra_headers
44
+ # Extra headers to send with the request. These are `.merged`’d into any
45
+ # `extra_headers` given at the client level.
46
+ #
47
+ # @return [Hash{String=>String, nil}, nil]
48
+ optional :extra_headers, CheckoutIntents::Internal::Type::HashOf[String, nil?: true]
49
+
50
+ # @!attribute extra_body
51
+ # Extra data to send with the request. These are deep merged into any data
52
+ # generated as part of the normal request.
53
+ #
54
+ # @return [Object, nil]
55
+ optional :extra_body, CheckoutIntents::Internal::Type::HashOf[CheckoutIntents::Internal::Type::Unknown]
56
+
57
+ # @!attribute max_retries
58
+ # Maximum number of retries to attempt after a failed initial request.
59
+ #
60
+ # @return [Integer, nil]
61
+ optional :max_retries, Integer
62
+
63
+ # @!attribute timeout
64
+ # Request timeout in seconds.
65
+ #
66
+ # @return [Float, nil]
67
+ optional :timeout, Float
68
+
69
+ # @!method initialize(values = {})
70
+ # Returns a new instance of RequestOptions.
71
+ #
72
+ # @param values [Hash{Symbol=>Object}]
73
+
74
+ define_sorbet_constant!(:OrHash) do
75
+ T.type_alias { T.any(CheckoutIntents::RequestOptions, CheckoutIntents::Internal::AnyHash) }
76
+ end
77
+ end
78
+ end