gmt-python-sdk 0.6.0__tar.gz → 0.7.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 (95) hide show
  1. gmt_python_sdk-0.7.0/.release-please-manifest.json +3 -0
  2. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/CHANGELOG.md +8 -0
  3. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/PKG-INFO +1 -1
  4. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/api.md +2 -0
  5. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/pyproject.toml +1 -1
  6. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_version.py +1 -1
  7. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/purchases.py +89 -0
  8. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/__init__.py +1 -0
  9. gmt_python_sdk-0.7.0/src/gmt/types/purchase_refund_response.py +141 -0
  10. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/test_purchases.py +69 -0
  11. gmt_python_sdk-0.6.0/.release-please-manifest.json +0 -3
  12. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/.gitignore +0 -0
  13. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/CONTRIBUTING.md +0 -0
  14. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/LICENSE +0 -0
  15. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/README.md +0 -0
  16. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/SECURITY.md +0 -0
  17. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/bin/check-release-environment +0 -0
  18. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/bin/publish-pypi +0 -0
  19. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/examples/.keep +0 -0
  20. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/noxfile.py +0 -0
  21. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/release-please-config.json +0 -0
  22. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/requirements-dev.lock +0 -0
  23. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/requirements.lock +0 -0
  24. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/__init__.py +0 -0
  25. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_base_client.py +0 -0
  26. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_client.py +0 -0
  27. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_compat.py +0 -0
  28. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_constants.py +0 -0
  29. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_exceptions.py +0 -0
  30. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_files.py +0 -0
  31. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_models.py +0 -0
  32. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_qs.py +0 -0
  33. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_resource.py +0 -0
  34. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_response.py +0 -0
  35. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_streaming.py +0 -0
  36. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_types.py +0 -0
  37. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/__init__.py +0 -0
  38. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_compat.py +0 -0
  39. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_datetime_parse.py +0 -0
  40. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_logs.py +0 -0
  41. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_proxy.py +0 -0
  42. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_reflection.py +0 -0
  43. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_resources_proxy.py +0 -0
  44. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_streams.py +0 -0
  45. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_sync.py +0 -0
  46. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_transform.py +0 -0
  47. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_typing.py +0 -0
  48. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/_utils/_utils.py +0 -0
  49. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/lib/.keep +0 -0
  50. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/pagination.py +0 -0
  51. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/py.typed +0 -0
  52. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/__init__.py +0 -0
  53. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/accounts.py +0 -0
  54. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/profile.py +0 -0
  55. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/service.py +0 -0
  56. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/resources/webhooks.py +0 -0
  57. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/account_list_countries_params.py +0 -0
  58. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/account_list_countries_response.py +0 -0
  59. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/account_list_params.py +0 -0
  60. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/account_list_response.py +0 -0
  61. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/account_retrieve_response.py +0 -0
  62. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/profile_retrieve_response.py +0 -0
  63. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_create_params.py +0 -0
  64. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_create_response.py +0 -0
  65. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_list_params.py +0 -0
  66. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_list_response.py +0 -0
  67. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_request_verification_code_params.py +0 -0
  68. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_request_verification_code_response.py +0 -0
  69. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/purchase_retrieve_response.py +0 -0
  70. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/service_get_server_time_response.py +0 -0
  71. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/service_health_check_response.py +0 -0
  72. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/webhook_test_params.py +0 -0
  73. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/src/gmt/types/webhook_test_response.py +0 -0
  74. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/__init__.py +0 -0
  75. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/__init__.py +0 -0
  76. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/test_accounts.py +0 -0
  77. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/test_profile.py +0 -0
  78. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/test_service.py +0 -0
  79. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/api_resources/test_webhooks.py +0 -0
  80. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/conftest.py +0 -0
  81. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/sample_file.txt +0 -0
  82. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_client.py +0 -0
  83. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_deepcopy.py +0 -0
  84. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_extract_files.py +0 -0
  85. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_files.py +0 -0
  86. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_models.py +0 -0
  87. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_qs.py +0 -0
  88. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_required_args.py +0 -0
  89. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_response.py +0 -0
  90. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_streaming.py +0 -0
  91. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_transform.py +0 -0
  92. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_utils/test_datetime_parse.py +0 -0
  93. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_utils/test_proxy.py +0 -0
  94. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/test_utils/test_typing.py +0 -0
  95. {gmt_python_sdk-0.6.0 → gmt_python_sdk-0.7.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.7.0"
3
+ }
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0 (2025-12-08)
4
+
5
+ Full Changelog: [v0.6.0...v0.7.0](https://github.com/cameo6/gmt-python-sdk/compare/v0.6.0...v0.7.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** add refund repository ([d8db552](https://github.com/cameo6/gmt-python-sdk/commit/d8db552d131f6c5ef561b525a88ddb640367f381))
10
+
3
11
  ## 0.6.0 (2025-12-08)
4
12
 
5
13
  Full Changelog: [v0.5.0...v0.6.0](https://github.com/cameo6/gmt-python-sdk/compare/v0.5.0...v0.6.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gmt-python-sdk
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: The official Python library for the gmt API
5
5
  Project-URL: Homepage, https://github.com/cameo6/gmt-python-sdk
6
6
  Project-URL: Repository, https://github.com/cameo6/gmt-python-sdk
@@ -46,6 +46,7 @@ from gmt.types import (
46
46
  PurchaseCreateResponse,
47
47
  PurchaseRetrieveResponse,
48
48
  PurchaseListResponse,
49
+ PurchaseRefundResponse,
49
50
  PurchaseRequestVerificationCodeResponse,
50
51
  )
51
52
  ```
@@ -55,6 +56,7 @@ Methods:
55
56
  - <code title="post /v1/purchases/">client.purchases.<a href="./src/gmt/resources/purchases.py">create</a>(\*\*<a href="src/gmt/types/purchase_create_params.py">params</a>) -> <a href="./src/gmt/types/purchase_create_response.py">PurchaseCreateResponse</a></code>
56
57
  - <code title="get /v1/purchases/{purchase_id}">client.purchases.<a href="./src/gmt/resources/purchases.py">retrieve</a>(purchase_id) -> <a href="./src/gmt/types/purchase_retrieve_response.py">PurchaseRetrieveResponse</a></code>
57
58
  - <code title="get /v1/purchases/">client.purchases.<a href="./src/gmt/resources/purchases.py">list</a>(\*\*<a href="src/gmt/types/purchase_list_params.py">params</a>) -> <a href="./src/gmt/types/purchase_list_response.py">SyncPageNumber[PurchaseListResponse]</a></code>
59
+ - <code title="post /v1/purchases/{purchase_id}/refund">client.purchases.<a href="./src/gmt/resources/purchases.py">refund</a>(purchase_id) -> <a href="./src/gmt/types/purchase_refund_response.py">PurchaseRefundResponse</a></code>
58
60
  - <code title="post /v1/purchases/{purchase_id}/request-code">client.purchases.<a href="./src/gmt/resources/purchases.py">request_verification_code</a>(purchase_id, \*\*<a href="src/gmt/types/purchase_request_verification_code_params.py">params</a>) -> <a href="./src/gmt/types/purchase_request_verification_code_response.py">PurchaseRequestVerificationCodeResponse</a></code>
59
61
 
60
62
  # Webhooks
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gmt-python-sdk"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "The official Python library for the gmt API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "gmt"
4
- __version__ = "0.6.0" # x-release-please-version
4
+ __version__ = "0.7.0" # x-release-please-version
@@ -21,6 +21,7 @@ from ..pagination import SyncPageNumber, AsyncPageNumber
21
21
  from .._base_client import AsyncPaginator, make_request_options
22
22
  from ..types.purchase_list_response import PurchaseListResponse
23
23
  from ..types.purchase_create_response import PurchaseCreateResponse
24
+ from ..types.purchase_refund_response import PurchaseRefundResponse
24
25
  from ..types.purchase_retrieve_response import PurchaseRetrieveResponse
25
26
  from ..types.purchase_request_verification_code_response import PurchaseRequestVerificationCodeResponse
26
27
 
@@ -207,6 +208,44 @@ class PurchasesResource(SyncAPIResource):
207
208
  model=PurchaseListResponse,
208
209
  )
209
210
 
211
+ def refund(
212
+ self,
213
+ purchase_id: int,
214
+ *,
215
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
216
+ # The extra values given here take precedence over values defined on the client or passed to this method.
217
+ extra_headers: Headers | None = None,
218
+ extra_query: Query | None = None,
219
+ extra_body: Body | None = None,
220
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
221
+ ) -> PurchaseRefundResponse:
222
+ """
223
+ Refunds a purchase if verification code was not received within 20 minutes.
224
+
225
+ **Requirements:**
226
+
227
+ - Status `PENDING`, code not received
228
+ - At least 20 minutes since purchase creation
229
+
230
+ Args:
231
+ purchase_id: Unique purchase identifier.
232
+
233
+ extra_headers: Send extra headers
234
+
235
+ extra_query: Add additional query parameters to the request
236
+
237
+ extra_body: Add additional JSON properties to the request
238
+
239
+ timeout: Override the client-level default timeout for this request, in seconds
240
+ """
241
+ return self._post(
242
+ f"/v1/purchases/{purchase_id}/refund",
243
+ options=make_request_options(
244
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
245
+ ),
246
+ cast_to=PurchaseRefundResponse,
247
+ )
248
+
210
249
  def request_verification_code(
211
250
  self,
212
251
  purchase_id: int,
@@ -454,6 +493,44 @@ class AsyncPurchasesResource(AsyncAPIResource):
454
493
  model=PurchaseListResponse,
455
494
  )
456
495
 
496
+ async def refund(
497
+ self,
498
+ purchase_id: int,
499
+ *,
500
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
501
+ # The extra values given here take precedence over values defined on the client or passed to this method.
502
+ extra_headers: Headers | None = None,
503
+ extra_query: Query | None = None,
504
+ extra_body: Body | None = None,
505
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
506
+ ) -> PurchaseRefundResponse:
507
+ """
508
+ Refunds a purchase if verification code was not received within 20 minutes.
509
+
510
+ **Requirements:**
511
+
512
+ - Status `PENDING`, code not received
513
+ - At least 20 minutes since purchase creation
514
+
515
+ Args:
516
+ purchase_id: Unique purchase identifier.
517
+
518
+ extra_headers: Send extra headers
519
+
520
+ extra_query: Add additional query parameters to the request
521
+
522
+ extra_body: Add additional JSON properties to the request
523
+
524
+ timeout: Override the client-level default timeout for this request, in seconds
525
+ """
526
+ return await self._post(
527
+ f"/v1/purchases/{purchase_id}/refund",
528
+ options=make_request_options(
529
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
530
+ ),
531
+ cast_to=PurchaseRefundResponse,
532
+ )
533
+
457
534
  async def request_verification_code(
458
535
  self,
459
536
  purchase_id: int,
@@ -532,6 +609,9 @@ class PurchasesResourceWithRawResponse:
532
609
  self.list = to_raw_response_wrapper(
533
610
  purchases.list,
534
611
  )
612
+ self.refund = to_raw_response_wrapper(
613
+ purchases.refund,
614
+ )
535
615
  self.request_verification_code = to_raw_response_wrapper(
536
616
  purchases.request_verification_code,
537
617
  )
@@ -550,6 +630,9 @@ class AsyncPurchasesResourceWithRawResponse:
550
630
  self.list = async_to_raw_response_wrapper(
551
631
  purchases.list,
552
632
  )
633
+ self.refund = async_to_raw_response_wrapper(
634
+ purchases.refund,
635
+ )
553
636
  self.request_verification_code = async_to_raw_response_wrapper(
554
637
  purchases.request_verification_code,
555
638
  )
@@ -568,6 +651,9 @@ class PurchasesResourceWithStreamingResponse:
568
651
  self.list = to_streamed_response_wrapper(
569
652
  purchases.list,
570
653
  )
654
+ self.refund = to_streamed_response_wrapper(
655
+ purchases.refund,
656
+ )
571
657
  self.request_verification_code = to_streamed_response_wrapper(
572
658
  purchases.request_verification_code,
573
659
  )
@@ -586,6 +672,9 @@ class AsyncPurchasesResourceWithStreamingResponse:
586
672
  self.list = async_to_streamed_response_wrapper(
587
673
  purchases.list,
588
674
  )
675
+ self.refund = async_to_streamed_response_wrapper(
676
+ purchases.refund,
677
+ )
589
678
  self.request_verification_code = async_to_streamed_response_wrapper(
590
679
  purchases.request_verification_code,
591
680
  )
@@ -10,6 +10,7 @@ from .webhook_test_response import WebhookTestResponse as WebhookTestResponse
10
10
  from .purchase_create_params import PurchaseCreateParams as PurchaseCreateParams
11
11
  from .purchase_list_response import PurchaseListResponse as PurchaseListResponse
12
12
  from .purchase_create_response import PurchaseCreateResponse as PurchaseCreateResponse
13
+ from .purchase_refund_response import PurchaseRefundResponse as PurchaseRefundResponse
13
14
  from .account_retrieve_response import AccountRetrieveResponse as AccountRetrieveResponse
14
15
  from .profile_retrieve_response import ProfileRetrieveResponse as ProfileRetrieveResponse
15
16
  from .purchase_retrieve_response import PurchaseRetrieveResponse as PurchaseRetrieveResponse
@@ -0,0 +1,141 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from typing_extensions import Literal
5
+
6
+ from .._models import BaseModel
7
+
8
+ __all__ = [
9
+ "PurchaseRefundResponse",
10
+ "Purchase",
11
+ "PurchaseDisplayName",
12
+ "PurchasePrice",
13
+ "PurchaseVerification",
14
+ "Refund",
15
+ "RefundAmount",
16
+ ]
17
+
18
+
19
+ class PurchaseDisplayName(BaseModel):
20
+ en: str
21
+ """Name in English."""
22
+
23
+ ru: str
24
+ """Name in Russian."""
25
+
26
+
27
+ class PurchasePrice(BaseModel):
28
+ amount: str
29
+ """Monetary amount as a string with up to 2 decimal places."""
30
+
31
+ currency_code: str
32
+ """ISO 4217 currency code."""
33
+
34
+
35
+ class PurchaseVerification(BaseModel):
36
+ code: str
37
+ """Verification code for account."""
38
+
39
+ password: str
40
+ """Account password."""
41
+
42
+ received_at: str
43
+ """
44
+ **Code Retrieval Timestamp.** Marks when verification code was successfully
45
+ fetched from the provider (not when purchase was created).
46
+
47
+ **Example timeline.**
48
+
49
+ - `created_at`: `2024-11-19T10:00:00Z` (purchase created)
50
+ - `received_at`: `2024-11-19T10:05:02Z` (code requested 5 minutes later)
51
+
52
+ **Note.** These timestamps may be identical if code is requested immediately
53
+ after purchase.
54
+ """
55
+
56
+
57
+ class Purchase(BaseModel):
58
+ id: int
59
+ """Unique purchase identifier."""
60
+
61
+ country_code: str
62
+ """ISO 3166-1 alpha-2 country code."""
63
+
64
+ created_at: str
65
+ """Purchase creation time in ISO 8601 format (UTC)."""
66
+
67
+ display_name: PurchaseDisplayName
68
+
69
+ phone_number: str
70
+ """
71
+ **E.164 International Format.** Phone number with country code prefix (e.g.,
72
+ `+12025550123` for US, `+79991234567` for Russia).
73
+
74
+ **Usage.** This is your Telegram account login. Use it with `verification.code`
75
+ and `verification.password` to access the account.
76
+ """
77
+
78
+ price: PurchasePrice
79
+ """
80
+ **Final Price After Discount.** The actual amount deducted from your balance,
81
+ with your personal discount already applied.
82
+
83
+ **To see pricing breakdown before purchase.** Check
84
+ `GET /accounts/:country_code` which shows both discounted price and original
85
+ `base_price`.
86
+
87
+ **Discount eligibility.** Based on your total successful purchase count. Higher
88
+ volume = bigger discounts.
89
+ """
90
+
91
+ status: Literal["PENDING", "SUCCESS", "ERROR", "REFUND"]
92
+ """
93
+ **Purchase Status Lifecycle.** `PENDING` (initial) → `SUCCESS` (after code
94
+ request) or `ERROR` (provider failure). Any status can transition to `REFUND`
95
+ via admin action.
96
+
97
+ **Important.** Status is immutable once set to `SUCCESS`, `ERROR`, or `REFUND`.
98
+
99
+ **Filter options**
100
+
101
+ - `PENDING` - code not requested.
102
+ - `SUCCESS` - code ready.
103
+ - `ERROR` - provider failed.
104
+ - `REFUND` - money returned.
105
+ """
106
+
107
+ verification: Optional[PurchaseVerification] = None
108
+ """
109
+ **Verification Credentials.** Login credentials for the purchased Telegram
110
+ account. Initially `null` after purchase creation.
111
+
112
+ **Availability.** Populated after calling `POST /purchases/:id/request-code`.
113
+ Once received, credentials are permanent and cannot be re-requested.
114
+
115
+ **Security.** Verification data is only visible to the purchase owner.
116
+ """
117
+
118
+
119
+ class RefundAmount(BaseModel):
120
+ amount: str
121
+ """Monetary amount as a string with up to 2 decimal places."""
122
+
123
+ currency_code: str
124
+ """ISO 4217 currency code."""
125
+
126
+
127
+ class Refund(BaseModel):
128
+ amount: RefundAmount
129
+ """Refunded amount (full purchase price)"""
130
+
131
+ reason: str
132
+ """Refund reason"""
133
+
134
+ refunded_at: str
135
+ """Refund timestamp in ISO 8601 format"""
136
+
137
+
138
+ class PurchaseRefundResponse(BaseModel):
139
+ purchase: Purchase
140
+
141
+ refund: Refund
@@ -11,6 +11,7 @@ from gmt import Gmt, AsyncGmt
11
11
  from gmt.types import (
12
12
  PurchaseListResponse,
13
13
  PurchaseCreateResponse,
14
+ PurchaseRefundResponse,
14
15
  PurchaseRetrieveResponse,
15
16
  PurchaseRequestVerificationCodeResponse,
16
17
  )
@@ -138,6 +139,40 @@ class TestPurchases:
138
139
 
139
140
  assert cast(Any, response.is_closed) is True
140
141
 
142
+ @pytest.mark.skip(reason="Prism tests are disabled")
143
+ @parametrize
144
+ def test_method_refund(self, client: Gmt) -> None:
145
+ purchase = client.purchases.refund(
146
+ 12345,
147
+ )
148
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
149
+
150
+ @pytest.mark.skip(reason="Prism tests are disabled")
151
+ @parametrize
152
+ def test_raw_response_refund(self, client: Gmt) -> None:
153
+ response = client.purchases.with_raw_response.refund(
154
+ 12345,
155
+ )
156
+
157
+ assert response.is_closed is True
158
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
159
+ purchase = response.parse()
160
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
161
+
162
+ @pytest.mark.skip(reason="Prism tests are disabled")
163
+ @parametrize
164
+ def test_streaming_response_refund(self, client: Gmt) -> None:
165
+ with client.purchases.with_streaming_response.refund(
166
+ 12345,
167
+ ) as response:
168
+ assert not response.is_closed
169
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
170
+
171
+ purchase = response.parse()
172
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
173
+
174
+ assert cast(Any, response.is_closed) is True
175
+
141
176
  @pytest.mark.skip(reason="Prism tests are disabled")
142
177
  @parametrize
143
178
  def test_method_request_verification_code(self, client: Gmt) -> None:
@@ -302,6 +337,40 @@ class TestAsyncPurchases:
302
337
 
303
338
  assert cast(Any, response.is_closed) is True
304
339
 
340
+ @pytest.mark.skip(reason="Prism tests are disabled")
341
+ @parametrize
342
+ async def test_method_refund(self, async_client: AsyncGmt) -> None:
343
+ purchase = await async_client.purchases.refund(
344
+ 12345,
345
+ )
346
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
347
+
348
+ @pytest.mark.skip(reason="Prism tests are disabled")
349
+ @parametrize
350
+ async def test_raw_response_refund(self, async_client: AsyncGmt) -> None:
351
+ response = await async_client.purchases.with_raw_response.refund(
352
+ 12345,
353
+ )
354
+
355
+ assert response.is_closed is True
356
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
357
+ purchase = await response.parse()
358
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
359
+
360
+ @pytest.mark.skip(reason="Prism tests are disabled")
361
+ @parametrize
362
+ async def test_streaming_response_refund(self, async_client: AsyncGmt) -> None:
363
+ async with async_client.purchases.with_streaming_response.refund(
364
+ 12345,
365
+ ) as response:
366
+ assert not response.is_closed
367
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
368
+
369
+ purchase = await response.parse()
370
+ assert_matches_type(PurchaseRefundResponse, purchase, path=["response"])
371
+
372
+ assert cast(Any, response.is_closed) is True
373
+
305
374
  @pytest.mark.skip(reason="Prism tests are disabled")
306
375
  @parametrize
307
376
  async def test_method_request_verification_code(self, async_client: AsyncGmt) -> None:
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.6.0"
3
- }
File without changes
File without changes