checkout-intents 0.5.0__tar.gz → 0.6.0__tar.gz

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 (92) hide show
  1. checkout_intents-0.6.0/.release-please-manifest.json +3 -0
  2. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/CHANGELOG.md +13 -0
  3. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/PKG-INFO +1 -1
  4. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/api.md +1 -0
  5. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/pyproject.toml +1 -1
  6. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_version.py +1 -1
  7. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/resources/checkout_intents.py +121 -0
  8. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/__init__.py +1 -0
  9. checkout_intents-0.6.0/src/checkout_intents/types/checkout_intent_purchase_params.py +25 -0
  10. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/api_resources/test_checkout_intents.py +226 -0
  11. checkout_intents-0.5.0/.release-please-manifest.json +0 -3
  12. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/.gitignore +0 -0
  13. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/CONTRIBUTING.md +0 -0
  14. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/LICENSE +0 -0
  15. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/README.md +0 -0
  16. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/SECURITY.md +0 -0
  17. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/bin/check-release-environment +0 -0
  18. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/bin/publish-pypi +0 -0
  19. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/examples/.keep +0 -0
  20. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/examples/complete-checkout-intent.py +0 -0
  21. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/examples/error-handling.py +0 -0
  22. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/noxfile.py +0 -0
  23. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/release-please-config.json +0 -0
  24. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/requirements-dev.lock +0 -0
  25. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/requirements.lock +0 -0
  26. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/__init__.py +0 -0
  27. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_base_client.py +0 -0
  28. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_client.py +0 -0
  29. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_compat.py +0 -0
  30. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_constants.py +0 -0
  31. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_exceptions.py +0 -0
  32. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_files.py +0 -0
  33. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_models.py +0 -0
  34. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_qs.py +0 -0
  35. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_resource.py +0 -0
  36. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_response.py +0 -0
  37. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_streaming.py +0 -0
  38. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_types.py +0 -0
  39. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/__init__.py +0 -0
  40. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_compat.py +0 -0
  41. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_datetime_parse.py +0 -0
  42. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_logs.py +0 -0
  43. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_proxy.py +0 -0
  44. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_reflection.py +0 -0
  45. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_resources_proxy.py +0 -0
  46. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_streams.py +0 -0
  47. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_sync.py +0 -0
  48. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_transform.py +0 -0
  49. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_typing.py +0 -0
  50. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/_utils/_utils.py +0 -0
  51. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/lib/.keep +0 -0
  52. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/pagination.py +0 -0
  53. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/py.typed +0 -0
  54. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/resources/__init__.py +0 -0
  55. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/resources/brands.py +0 -0
  56. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/base_checkout_intent.py +0 -0
  57. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/brand_retrieve_response.py +0 -0
  58. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/buyer.py +0 -0
  59. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/buyer_param.py +0 -0
  60. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/checkout_intent.py +0 -0
  61. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/checkout_intent_add_payment_params.py +0 -0
  62. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/checkout_intent_confirm_params.py +0 -0
  63. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/checkout_intent_create_params.py +0 -0
  64. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/checkout_intent_list_params.py +0 -0
  65. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/money.py +0 -0
  66. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/offer.py +0 -0
  67. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/payment_method.py +0 -0
  68. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/payment_method_param.py +0 -0
  69. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/variant_selection.py +0 -0
  70. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/src/checkout_intents/types/variant_selection_param.py +0 -0
  71. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/__init__.py +0 -0
  72. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/api_resources/__init__.py +0 -0
  73. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/api_resources/test_brands.py +0 -0
  74. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/conftest.py +0 -0
  75. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/sample_file.txt +0 -0
  76. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_client.py +0 -0
  77. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_deepcopy.py +0 -0
  78. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_environment_inference.py +0 -0
  79. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_extract_files.py +0 -0
  80. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_files.py +0 -0
  81. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_models.py +0 -0
  82. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_polling.py +0 -0
  83. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_qs.py +0 -0
  84. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_required_args.py +0 -0
  85. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_response.py +0 -0
  86. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_streaming.py +0 -0
  87. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_transform.py +0 -0
  88. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_utils/test_datetime_parse.py +0 -0
  89. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_utils/test_proxy.py +0 -0
  90. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/test_utils/test_typing.py +0 -0
  91. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/tests/utils.py +0 -0
  92. {checkout_intents-0.5.0 → checkout_intents-0.6.0}/uv.lock +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.6.0"
3
+ }
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0 (2025-12-22)
4
+
5
+ Full Changelog: [v0.5.0...v0.6.0](https://github.com/rye-com/checkout-intents-python/compare/v0.5.0...v0.6.0)
6
+
7
+ ### Features
8
+
9
+ * Include `/purchase` endpoint in our SDKs + docs ([7744f80](https://github.com/rye-com/checkout-intents-python/commit/7744f80e20bc5399d9b29e0bfb11d6b8f9997e38))
10
+
11
+
12
+ ### Chores
13
+
14
+ * include polling helpers in raw resp classes ([67b0e3c](https://github.com/rye-com/checkout-intents-python/commit/67b0e3c1899a3d5415b126466fd5f525f61f2529))
15
+
3
16
  ## 0.5.0 (2025-12-19)
4
17
 
5
18
  Full Changelog: [v0.4.0...v0.5.0](https://github.com/rye-com/checkout-intents-python/compare/v0.4.0...v0.5.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: checkout-intents
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: The official Python library for the Checkout Intents API
5
5
  Project-URL: Homepage, https://github.com/rye-com/checkout-intents-python
6
6
  Project-URL: Repository, https://github.com/rye-com/checkout-intents-python
@@ -21,6 +21,7 @@ Methods:
21
21
  - <code title="get /api/v1/checkout-intents">client.checkout_intents.<a href="./src/checkout_intents/resources/checkout_intents.py">list</a>(\*\*<a href="src/checkout_intents/types/checkout_intent_list_params.py">params</a>) -> <a href="./src/checkout_intents/types/checkout_intent.py">SyncCursorPagination[CheckoutIntent]</a></code>
22
22
  - <code title="post /api/v1/checkout-intents/{id}/payment">client.checkout_intents.<a href="./src/checkout_intents/resources/checkout_intents.py">add_payment</a>(id, \*\*<a href="src/checkout_intents/types/checkout_intent_add_payment_params.py">params</a>) -> <a href="./src/checkout_intents/types/checkout_intent.py">CheckoutIntent</a></code>
23
23
  - <code title="post /api/v1/checkout-intents/{id}/confirm">client.checkout_intents.<a href="./src/checkout_intents/resources/checkout_intents.py">confirm</a>(id, \*\*<a href="src/checkout_intents/types/checkout_intent_confirm_params.py">params</a>) -> <a href="./src/checkout_intents/types/checkout_intent.py">CheckoutIntent</a></code>
24
+ - <code title="post /api/v1/checkout-intents/purchase">client.checkout_intents.<a href="./src/checkout_intents/resources/checkout_intents.py">purchase</a>(\*\*<a href="src/checkout_intents/types/checkout_intent_purchase_params.py">params</a>) -> <a href="./src/checkout_intents/types/checkout_intent.py">CheckoutIntent</a></code>
24
25
 
25
26
  # Brands
26
27
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "checkout-intents"
3
- version = "0.5.0"
3
+ version = "0.6.0"
4
4
  description = "The official Python library for the Checkout Intents API"
5
5
  dynamic = ["readme"]
6
6
  license = "MIT"
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "checkout_intents"
4
- __version__ = "0.5.0" # x-release-please-version
4
+ __version__ = "0.6.0" # x-release-please-version
@@ -12,6 +12,7 @@ from ..types import (
12
12
  checkout_intent_list_params,
13
13
  checkout_intent_create_params,
14
14
  checkout_intent_confirm_params,
15
+ checkout_intent_purchase_params,
15
16
  checkout_intent_add_payment_params,
16
17
  )
17
18
  from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
@@ -287,6 +288,58 @@ class CheckoutIntentsResource(SyncAPIResource):
287
288
  ),
288
289
  )
289
290
 
291
+ def purchase(
292
+ self,
293
+ *,
294
+ buyer: BuyerParam,
295
+ product_url: str,
296
+ quantity: float,
297
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
298
+ payment_method: PaymentMethodParam,
299
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300
+ # The extra values given here take precedence over values defined on the client or passed to this method.
301
+ extra_headers: Headers | None = None,
302
+ extra_query: Query | None = None,
303
+ extra_body: Body | None = None,
304
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
305
+ ) -> CheckoutIntent:
306
+ """
307
+ Create a checkout intent and immediately trigger the purchase workflow.
308
+
309
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
310
+ The workflow handles offer retrieval, payment authorization, and order placement
311
+ asynchronously. Poll the GET endpoint to check status.
312
+
313
+ Args:
314
+ extra_headers: Send extra headers
315
+
316
+ extra_query: Add additional query parameters to the request
317
+
318
+ extra_body: Add additional JSON properties to the request
319
+
320
+ timeout: Override the client-level default timeout for this request, in seconds
321
+ """
322
+ return cast(
323
+ CheckoutIntent,
324
+ self._post(
325
+ f"/api/v1/checkout-intents/purchase",
326
+ body=maybe_transform(
327
+ {
328
+ "buyer": buyer,
329
+ "payment_method": payment_method,
330
+ "product_url": product_url,
331
+ "quantity": quantity,
332
+ "variant_selections": variant_selections,
333
+ },
334
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
335
+ ),
336
+ options=make_request_options(
337
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
338
+ ),
339
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
340
+ ),
341
+ )
342
+
290
343
  def _poll_until(
291
344
  self,
292
345
  id: str,
@@ -890,6 +943,58 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
890
943
  ),
891
944
  )
892
945
 
946
+ async def purchase(
947
+ self,
948
+ *,
949
+ buyer: BuyerParam,
950
+ product_url: str,
951
+ quantity: float,
952
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
953
+ payment_method: PaymentMethodParam,
954
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
955
+ # The extra values given here take precedence over values defined on the client or passed to this method.
956
+ extra_headers: Headers | None = None,
957
+ extra_query: Query | None = None,
958
+ extra_body: Body | None = None,
959
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
960
+ ) -> CheckoutIntent:
961
+ """
962
+ Create a checkout intent and immediately trigger the purchase workflow.
963
+
964
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
965
+ The workflow handles offer retrieval, payment authorization, and order placement
966
+ asynchronously. Poll the GET endpoint to check status.
967
+
968
+ Args:
969
+ extra_headers: Send extra headers
970
+
971
+ extra_query: Add additional query parameters to the request
972
+
973
+ extra_body: Add additional JSON properties to the request
974
+
975
+ timeout: Override the client-level default timeout for this request, in seconds
976
+ """
977
+ return cast(
978
+ CheckoutIntent,
979
+ await self._post(
980
+ f"/api/v1/checkout-intents/purchase",
981
+ body=await async_maybe_transform(
982
+ {
983
+ "buyer": buyer,
984
+ "payment_method": payment_method,
985
+ "product_url": product_url,
986
+ "quantity": quantity,
987
+ "variant_selections": variant_selections,
988
+ },
989
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
990
+ ),
991
+ options=make_request_options(
992
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
993
+ ),
994
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
995
+ ),
996
+ )
997
+
893
998
  async def _poll_until(
894
999
  self,
895
1000
  id: str,
@@ -1250,6 +1355,7 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
1250
1355
  )
1251
1356
 
1252
1357
 
1358
+
1253
1359
  class CheckoutIntentsResourceWithRawResponse:
1254
1360
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1255
1361
  self._checkout_intents = checkout_intents
@@ -1269,6 +1375,9 @@ class CheckoutIntentsResourceWithRawResponse:
1269
1375
  self.confirm = to_raw_response_wrapper(
1270
1376
  checkout_intents.confirm,
1271
1377
  )
1378
+ self.purchase = to_raw_response_wrapper(
1379
+ checkout_intents.purchase,
1380
+ )
1272
1381
  self.poll_until_completed = to_raw_response_wrapper(
1273
1382
  checkout_intents.poll_until_completed,
1274
1383
  )
@@ -1283,6 +1392,7 @@ class CheckoutIntentsResourceWithRawResponse:
1283
1392
  )
1284
1393
 
1285
1394
 
1395
+
1286
1396
  class AsyncCheckoutIntentsResourceWithRawResponse:
1287
1397
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1288
1398
  self._checkout_intents = checkout_intents
@@ -1302,6 +1412,9 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1302
1412
  self.confirm = async_to_raw_response_wrapper(
1303
1413
  checkout_intents.confirm,
1304
1414
  )
1415
+ self.purchase = async_to_raw_response_wrapper(
1416
+ checkout_intents.purchase,
1417
+ )
1305
1418
  self.poll_until_completed = async_to_raw_response_wrapper(
1306
1419
  checkout_intents.poll_until_completed,
1307
1420
  )
@@ -1316,6 +1429,7 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1316
1429
  )
1317
1430
 
1318
1431
 
1432
+
1319
1433
  class CheckoutIntentsResourceWithStreamingResponse:
1320
1434
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1321
1435
  self._checkout_intents = checkout_intents
@@ -1335,6 +1449,9 @@ class CheckoutIntentsResourceWithStreamingResponse:
1335
1449
  self.confirm = to_streamed_response_wrapper(
1336
1450
  checkout_intents.confirm,
1337
1451
  )
1452
+ self.purchase = to_streamed_response_wrapper(
1453
+ checkout_intents.purchase,
1454
+ )
1338
1455
  self.poll_until_completed = to_streamed_response_wrapper(
1339
1456
  checkout_intents.poll_until_completed,
1340
1457
  )
@@ -1349,6 +1466,7 @@ class CheckoutIntentsResourceWithStreamingResponse:
1349
1466
  )
1350
1467
 
1351
1468
 
1469
+
1352
1470
  class AsyncCheckoutIntentsResourceWithStreamingResponse:
1353
1471
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1354
1472
  self._checkout_intents = checkout_intents
@@ -1368,6 +1486,9 @@ class AsyncCheckoutIntentsResourceWithStreamingResponse:
1368
1486
  self.confirm = async_to_streamed_response_wrapper(
1369
1487
  checkout_intents.confirm,
1370
1488
  )
1489
+ self.purchase = async_to_streamed_response_wrapper(
1490
+ checkout_intents.purchase,
1491
+ )
1371
1492
  self.poll_until_completed = async_to_streamed_response_wrapper(
1372
1493
  checkout_intents.poll_until_completed,
1373
1494
  )
@@ -16,4 +16,5 @@ from .variant_selection_param import VariantSelectionParam as VariantSelectionPa
16
16
  from .checkout_intent_list_params import CheckoutIntentListParams as CheckoutIntentListParams
17
17
  from .checkout_intent_create_params import CheckoutIntentCreateParams as CheckoutIntentCreateParams
18
18
  from .checkout_intent_confirm_params import CheckoutIntentConfirmParams as CheckoutIntentConfirmParams
19
+ from .checkout_intent_purchase_params import CheckoutIntentPurchaseParams as CheckoutIntentPurchaseParams
19
20
  from .checkout_intent_add_payment_params import CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams
@@ -0,0 +1,25 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+ from typing_extensions import Required, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+ from .buyer_param import BuyerParam
10
+ from .payment_method_param import PaymentMethodParam
11
+ from .variant_selection_param import VariantSelectionParam
12
+
13
+ __all__ = ["CheckoutIntentPurchaseParams"]
14
+
15
+
16
+ class CheckoutIntentPurchaseParams(TypedDict, total=False):
17
+ buyer: Required[BuyerParam]
18
+
19
+ payment_method: Required[Annotated[PaymentMethodParam, PropertyInfo(alias="paymentMethod")]]
20
+
21
+ product_url: Required[Annotated[str, PropertyInfo(alias="productUrl")]]
22
+
23
+ quantity: Required[float]
24
+
25
+ variant_selections: Annotated[Iterable[VariantSelectionParam], PropertyInfo(alias="variantSelections")]
@@ -340,6 +340,119 @@ class TestCheckoutIntents:
340
340
  },
341
341
  )
342
342
 
343
+ @pytest.mark.skip(reason="Prism tests are disabled")
344
+ @parametrize
345
+ def test_method_purchase(self, client: CheckoutIntents) -> None:
346
+ checkout_intent = client.checkout_intents.purchase(
347
+ buyer={
348
+ "address1": "123 Main St",
349
+ "city": "New York",
350
+ "country": "US",
351
+ "email": "john.doe@example.com",
352
+ "first_name": "John",
353
+ "last_name": "Doe",
354
+ "phone": "1234567890",
355
+ "postal_code": "10001",
356
+ "province": "NY",
357
+ },
358
+ payment_method={
359
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
360
+ "type": "stripe_token",
361
+ },
362
+ product_url="productUrl",
363
+ quantity=1,
364
+ )
365
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
366
+
367
+ @pytest.mark.skip(reason="Prism tests are disabled")
368
+ @parametrize
369
+ def test_method_purchase_with_all_params(self, client: CheckoutIntents) -> None:
370
+ checkout_intent = client.checkout_intents.purchase(
371
+ buyer={
372
+ "address1": "123 Main St",
373
+ "city": "New York",
374
+ "country": "US",
375
+ "email": "john.doe@example.com",
376
+ "first_name": "John",
377
+ "last_name": "Doe",
378
+ "phone": "1234567890",
379
+ "postal_code": "10001",
380
+ "province": "NY",
381
+ "address2": "Apt 1",
382
+ },
383
+ payment_method={
384
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
385
+ "type": "stripe_token",
386
+ },
387
+ product_url="productUrl",
388
+ quantity=1,
389
+ variant_selections=[
390
+ {
391
+ "label": "Size, Color, etc.",
392
+ "value": "Small, Red, XS, L, etc.",
393
+ }
394
+ ],
395
+ )
396
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
397
+
398
+ @pytest.mark.skip(reason="Prism tests are disabled")
399
+ @parametrize
400
+ def test_raw_response_purchase(self, client: CheckoutIntents) -> None:
401
+ response = client.checkout_intents.with_raw_response.purchase(
402
+ buyer={
403
+ "address1": "123 Main St",
404
+ "city": "New York",
405
+ "country": "US",
406
+ "email": "john.doe@example.com",
407
+ "first_name": "John",
408
+ "last_name": "Doe",
409
+ "phone": "1234567890",
410
+ "postal_code": "10001",
411
+ "province": "NY",
412
+ },
413
+ payment_method={
414
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
415
+ "type": "stripe_token",
416
+ },
417
+ product_url="productUrl",
418
+ quantity=1,
419
+ )
420
+
421
+ assert response.is_closed is True
422
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
423
+ checkout_intent = response.parse()
424
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
425
+
426
+ @pytest.mark.skip(reason="Prism tests are disabled")
427
+ @parametrize
428
+ def test_streaming_response_purchase(self, client: CheckoutIntents) -> None:
429
+ with client.checkout_intents.with_streaming_response.purchase(
430
+ buyer={
431
+ "address1": "123 Main St",
432
+ "city": "New York",
433
+ "country": "US",
434
+ "email": "john.doe@example.com",
435
+ "first_name": "John",
436
+ "last_name": "Doe",
437
+ "phone": "1234567890",
438
+ "postal_code": "10001",
439
+ "province": "NY",
440
+ },
441
+ payment_method={
442
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
443
+ "type": "stripe_token",
444
+ },
445
+ product_url="productUrl",
446
+ quantity=1,
447
+ ) as response:
448
+ assert not response.is_closed
449
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
450
+
451
+ checkout_intent = response.parse()
452
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
453
+
454
+ assert cast(Any, response.is_closed) is True
455
+
343
456
 
344
457
  class TestAsyncCheckoutIntents:
345
458
  parametrize = pytest.mark.parametrize(
@@ -665,3 +778,116 @@ class TestAsyncCheckoutIntents:
665
778
  "type": "stripe_token",
666
779
  },
667
780
  )
781
+
782
+ @pytest.mark.skip(reason="Prism tests are disabled")
783
+ @parametrize
784
+ async def test_method_purchase(self, async_client: AsyncCheckoutIntents) -> None:
785
+ checkout_intent = await async_client.checkout_intents.purchase(
786
+ buyer={
787
+ "address1": "123 Main St",
788
+ "city": "New York",
789
+ "country": "US",
790
+ "email": "john.doe@example.com",
791
+ "first_name": "John",
792
+ "last_name": "Doe",
793
+ "phone": "1234567890",
794
+ "postal_code": "10001",
795
+ "province": "NY",
796
+ },
797
+ payment_method={
798
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
799
+ "type": "stripe_token",
800
+ },
801
+ product_url="productUrl",
802
+ quantity=1,
803
+ )
804
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
805
+
806
+ @pytest.mark.skip(reason="Prism tests are disabled")
807
+ @parametrize
808
+ async def test_method_purchase_with_all_params(self, async_client: AsyncCheckoutIntents) -> None:
809
+ checkout_intent = await async_client.checkout_intents.purchase(
810
+ buyer={
811
+ "address1": "123 Main St",
812
+ "city": "New York",
813
+ "country": "US",
814
+ "email": "john.doe@example.com",
815
+ "first_name": "John",
816
+ "last_name": "Doe",
817
+ "phone": "1234567890",
818
+ "postal_code": "10001",
819
+ "province": "NY",
820
+ "address2": "Apt 1",
821
+ },
822
+ payment_method={
823
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
824
+ "type": "stripe_token",
825
+ },
826
+ product_url="productUrl",
827
+ quantity=1,
828
+ variant_selections=[
829
+ {
830
+ "label": "Size, Color, etc.",
831
+ "value": "Small, Red, XS, L, etc.",
832
+ }
833
+ ],
834
+ )
835
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
836
+
837
+ @pytest.mark.skip(reason="Prism tests are disabled")
838
+ @parametrize
839
+ async def test_raw_response_purchase(self, async_client: AsyncCheckoutIntents) -> None:
840
+ response = await async_client.checkout_intents.with_raw_response.purchase(
841
+ buyer={
842
+ "address1": "123 Main St",
843
+ "city": "New York",
844
+ "country": "US",
845
+ "email": "john.doe@example.com",
846
+ "first_name": "John",
847
+ "last_name": "Doe",
848
+ "phone": "1234567890",
849
+ "postal_code": "10001",
850
+ "province": "NY",
851
+ },
852
+ payment_method={
853
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
854
+ "type": "stripe_token",
855
+ },
856
+ product_url="productUrl",
857
+ quantity=1,
858
+ )
859
+
860
+ assert response.is_closed is True
861
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
862
+ checkout_intent = await response.parse()
863
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
864
+
865
+ @pytest.mark.skip(reason="Prism tests are disabled")
866
+ @parametrize
867
+ async def test_streaming_response_purchase(self, async_client: AsyncCheckoutIntents) -> None:
868
+ async with async_client.checkout_intents.with_streaming_response.purchase(
869
+ buyer={
870
+ "address1": "123 Main St",
871
+ "city": "New York",
872
+ "country": "US",
873
+ "email": "john.doe@example.com",
874
+ "first_name": "John",
875
+ "last_name": "Doe",
876
+ "phone": "1234567890",
877
+ "postal_code": "10001",
878
+ "province": "NY",
879
+ },
880
+ payment_method={
881
+ "stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
882
+ "type": "stripe_token",
883
+ },
884
+ product_url="productUrl",
885
+ quantity=1,
886
+ ) as response:
887
+ assert not response.is_closed
888
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
889
+
890
+ checkout_intent = await response.parse()
891
+ assert_matches_type(CheckoutIntent, checkout_intent, path=["response"])
892
+
893
+ assert cast(Any, response.is_closed) is True
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.5.0"
3
- }