stableops 0.7.2__tar.gz → 0.12.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 (28) hide show
  1. {stableops-0.7.2 → stableops-0.12.0}/PKG-INFO +8 -6
  2. {stableops-0.7.2 → stableops-0.12.0}/README.md +4 -2
  3. {stableops-0.7.2 → stableops-0.12.0}/README.zh-CN.md +3 -3
  4. {stableops-0.7.2 → stableops-0.12.0}/pyproject.toml +4 -4
  5. {stableops-0.7.2 → stableops-0.12.0}/stableops/__init__.py +45 -1
  6. {stableops-0.7.2 → stableops-0.12.0}/stableops/client.py +44 -0
  7. {stableops-0.7.2 → stableops-0.12.0}/stableops/http.py +1 -1
  8. stableops-0.12.0/stableops/merchant_subscriptions.py +1019 -0
  9. {stableops-0.7.2 → stableops-0.12.0}/stableops/types.py +196 -0
  10. stableops-0.12.0/tests/test_merchant_subscriptions.py +301 -0
  11. {stableops-0.7.2 → stableops-0.12.0}/.github/workflows/publish.yml +0 -0
  12. {stableops-0.7.2 → stableops-0.12.0}/.gitignore +0 -0
  13. {stableops-0.7.2 → stableops-0.12.0}/.pylintrc +0 -0
  14. {stableops-0.7.2 → stableops-0.12.0}/LICENSE +0 -0
  15. {stableops-0.7.2 → stableops-0.12.0}/examples/README.md +0 -0
  16. {stableops-0.7.2 → stableops-0.12.0}/examples/async_example.py +0 -0
  17. {stableops-0.7.2 → stableops-0.12.0}/examples/create_order.py +0 -0
  18. {stableops-0.7.2 → stableops-0.12.0}/examples/webhook_handler.py +0 -0
  19. {stableops-0.7.2 → stableops-0.12.0}/stableops/addresses.py +0 -0
  20. {stableops-0.7.2 → stableops-0.12.0}/stableops/checkout_sessions.py +0 -0
  21. {stableops-0.7.2 → stableops-0.12.0}/stableops/errors.py +0 -0
  22. {stableops-0.7.2 → stableops-0.12.0}/stableops/payment_orders.py +0 -0
  23. {stableops-0.7.2 → stableops-0.12.0}/stableops/webhooks.py +0 -0
  24. {stableops-0.7.2 → stableops-0.12.0}/tests/test_addresses.py +0 -0
  25. {stableops-0.7.2 → stableops-0.12.0}/tests/test_checkout_sessions.py +0 -0
  26. {stableops-0.7.2 → stableops-0.12.0}/tests/test_payment_orders.py +0 -0
  27. {stableops-0.7.2 → stableops-0.12.0}/tests/test_types.py +0 -0
  28. {stableops-0.7.2 → stableops-0.12.0}/tests/test_webhooks.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stableops
3
- Version: 0.7.2
3
+ Version: 0.12.0
4
4
  Summary: Official Python SDK for StableOps - Stablecoin payment infrastructure
5
5
  Project-URL: Homepage, https://stableops.dev
6
- Project-URL: Documentation, https://docs.stableops.dev
7
- Project-URL: Repository, https://github.com/stableops/stableops
8
- Project-URL: Bug Tracker, https://github.com/stableops/stableops/issues
6
+ Project-URL: Documentation, https://stableops.dev/docs
7
+ Project-URL: Repository, https://github.com/StableOps/stableops-api-python-sdk
8
+ Project-URL: Bug Tracker, https://github.com/StableOps/stableops-api-python-sdk/issues
9
9
  Author-email: StableOps <hello@stableops.dev>
10
10
  License: Apache-2.0
11
11
  License-File: LICENSE
@@ -47,11 +47,13 @@ confirmation tracking. StableOps watches supported chains, matches transfers,
47
47
  tracks confirmations, checks reorgs, and delivers webhook events to your app.
48
48
 
49
49
  This SDK is for server-side Python applications that create payment orders and
50
- checkout sessions, manage webhook endpoints, and verify webhook signatures.
50
+ checkout sessions, manage merchant subscriptions, manage webhook endpoints, and
51
+ verify webhook signatures.
51
52
 
52
53
  ## Features
53
54
 
54
- - Type-safe client (Pydantic v2 models) for payment orders, checkout sessions, and webhooks.
55
+ - Type-safe client (Pydantic v2 models) for payment orders, checkout sessions,
56
+ merchant subscriptions, and webhooks.
55
57
  - Sync (`StableOps`) and async (`AsyncStableOps`) clients with an identical API.
56
58
  - Built-in request retries and explicit idempotency for write operations.
57
59
  - Constant-time webhook signature verification.
@@ -10,11 +10,13 @@ confirmation tracking. StableOps watches supported chains, matches transfers,
10
10
  tracks confirmations, checks reorgs, and delivers webhook events to your app.
11
11
 
12
12
  This SDK is for server-side Python applications that create payment orders and
13
- checkout sessions, manage webhook endpoints, and verify webhook signatures.
13
+ checkout sessions, manage merchant subscriptions, manage webhook endpoints, and
14
+ verify webhook signatures.
14
15
 
15
16
  ## Features
16
17
 
17
- - Type-safe client (Pydantic v2 models) for payment orders, checkout sessions, and webhooks.
18
+ - Type-safe client (Pydantic v2 models) for payment orders, checkout sessions,
19
+ merchant subscriptions, and webhooks.
18
20
  - Sync (`StableOps`) and async (`AsyncStableOps`) clients with an identical API.
19
21
  - Built-in request retries and explicit idempotency for write operations.
20
22
  - Constant-time webhook signature verification.
@@ -8,12 +8,12 @@ StableOps 把链上稳定币转账封装成熟悉的支付原语:支付订单
8
8
  Webhook、自动重试与确认数跟踪。StableOps 负责扫描支持的链、匹配转账、跟踪确认数、
9
9
  校验 reorg,并把 Webhook 事件投递到你的应用。
10
10
 
11
- 本 SDK 面向服务端 Python 应用:创建支付订单与 Checkout Session、管理 Webhook 端点、
12
- 校验 Webhook 签名。
11
+ 本 SDK 面向服务端 Python 应用:创建支付订单与 Checkout Session、管理商户订阅、
12
+ 管理 Webhook 端点、校验 Webhook 签名。
13
13
 
14
14
  ## 特性
15
15
 
16
- - 类型安全客户端(Pydantic v2 模型),覆盖支付订单、Checkout Session、Webhook。
16
+ - 类型安全客户端(Pydantic v2 模型),覆盖支付订单、Checkout Session、商户订阅、Webhook。
17
17
  - 同步(`StableOps`)与异步(`AsyncStableOps`)客户端,API 一致。
18
18
  - 内置请求重试,写操作显式幂等。
19
19
  - 常数时间的 Webhook 签名校验。
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "stableops"
7
- version = "0.7.2"
7
+ version = "0.12.0"
8
8
  description = "Official Python SDK for StableOps - Stablecoin payment infrastructure"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -45,9 +45,9 @@ dev = [
45
45
 
46
46
  [project.urls]
47
47
  Homepage = "https://stableops.dev"
48
- Documentation = "https://docs.stableops.dev"
49
- Repository = "https://github.com/stableops/stableops"
50
- "Bug Tracker" = "https://github.com/stableops/stableops/issues"
48
+ Documentation = "https://stableops.dev/docs"
49
+ Repository = "https://github.com/StableOps/stableops-api-python-sdk"
50
+ "Bug Tracker" = "https://github.com/StableOps/stableops-api-python-sdk/issues"
51
51
 
52
52
  [tool.hatch.build.targets.wheel]
53
53
  packages = ["stableops"]
@@ -18,19 +18,41 @@ from stableops.errors import StableOpsError
18
18
  from stableops.types import (
19
19
  AcceptedAssetInput,
20
20
  AmountMode,
21
+ CancelEndUserSubscriptionInput,
22
+ ChangeEndUserSubscriptionPlanInput,
21
23
  CheckoutSession,
22
24
  CheckoutSessionStatus,
23
25
  CreateCheckoutSessionInput,
26
+ CreateEndUserSubscriptionInput,
27
+ CreateInvoiceCheckoutSessionInput,
28
+ CreateMerchantPlanInput,
24
29
  CreatePaymentOrderInput,
30
+ CreatePortalSessionInput,
25
31
  CreateWebhookEndpointInput,
32
+ EndUserInvoice,
33
+ EndUserInvoiceKind,
34
+ EndUserInvoiceStatus,
35
+ EndUserSubscription,
36
+ EndUserSubscriptionStatus,
37
+ MerchantBillingSettings,
38
+ MerchantInvoiceCheckoutSession,
39
+ MerchantInvoicePaymentStatus,
40
+ MerchantPlan,
41
+ MerchantPlanInterval,
42
+ MerchantSubscriptionChangePlanResult,
43
+ MerchantSubscriptionCreateResult,
26
44
  PaymentOrder,
27
45
  PaymentOrderDetail,
28
46
  PaymentOrderInstruction,
29
47
  PaymentOrderStatus,
30
48
  PaymentOrderTimelineEntry,
49
+ PayMerchantInvoiceResponse,
50
+ PortalSession,
31
51
  ReplayDeadLetterItem,
32
52
  ReplayDeadLettersResult,
33
53
  ReplayDeliveryResult,
54
+ UpdateMerchantBillingSettingsInput,
55
+ UpdateMerchantPlanInput,
34
56
  UpdateWebhookEndpointInput,
35
57
  WebhookDelivery,
36
58
  WebhookDeliveryStatus,
@@ -45,7 +67,7 @@ from stableops.webhooks import (
45
67
  verify_webhook_signature,
46
68
  )
47
69
 
48
- __version__ = "0.7.0"
70
+ __version__ = "0.12.0"
49
71
 
50
72
  __all__ = [
51
73
  # Client
@@ -56,19 +78,41 @@ __all__ = [
56
78
  # Types
57
79
  "AcceptedAssetInput",
58
80
  "AmountMode",
81
+ "CancelEndUserSubscriptionInput",
82
+ "ChangeEndUserSubscriptionPlanInput",
59
83
  "CheckoutSession",
60
84
  "CheckoutSessionStatus",
61
85
  "CreateCheckoutSessionInput",
86
+ "CreateEndUserSubscriptionInput",
87
+ "CreateInvoiceCheckoutSessionInput",
88
+ "CreateMerchantPlanInput",
62
89
  "CreatePaymentOrderInput",
90
+ "CreatePortalSessionInput",
63
91
  "CreateWebhookEndpointInput",
92
+ "EndUserInvoice",
93
+ "EndUserInvoiceKind",
94
+ "EndUserInvoiceStatus",
95
+ "EndUserSubscription",
96
+ "EndUserSubscriptionStatus",
97
+ "MerchantBillingSettings",
98
+ "MerchantInvoiceCheckoutSession",
99
+ "MerchantInvoicePaymentStatus",
100
+ "MerchantPlan",
101
+ "MerchantPlanInterval",
102
+ "MerchantSubscriptionChangePlanResult",
103
+ "MerchantSubscriptionCreateResult",
64
104
  "PaymentOrder",
65
105
  "PaymentOrderDetail",
66
106
  "PaymentOrderInstruction",
67
107
  "PaymentOrderStatus",
68
108
  "PaymentOrderTimelineEntry",
109
+ "PayMerchantInvoiceResponse",
110
+ "PortalSession",
69
111
  "ReplayDeadLetterItem",
70
112
  "ReplayDeadLettersResult",
71
113
  "ReplayDeliveryResult",
114
+ "UpdateMerchantBillingSettingsInput",
115
+ "UpdateMerchantPlanInput",
72
116
  "UpdateWebhookEndpointInput",
73
117
  "WebhookDelivery",
74
118
  "WebhookDeliveryStatus",
@@ -5,6 +5,12 @@ from typing import Any, Optional
5
5
  from stableops.addresses import AddressesApi, AsyncAddressesApi
6
6
  from stableops.checkout_sessions import AsyncCheckoutSessionsApi, CheckoutSessionsApi
7
7
  from stableops.http import AsyncHttpClient, DebugOption, HttpClient
8
+ from stableops.merchant_subscriptions import (
9
+ AsyncMerchantPortalApi,
10
+ AsyncMerchantSubscriptionsApi,
11
+ MerchantPortalApi,
12
+ MerchantSubscriptionsApi,
13
+ )
8
14
  from stableops.payment_orders import AsyncPaymentOrdersApi, PaymentOrdersApi
9
15
  from stableops.webhooks import AsyncWebhooksApi, WebhooksApi
10
16
 
@@ -54,12 +60,31 @@ class StableOps:
54
60
  max_retries=max_retries,
55
61
  debug=debug,
56
62
  )
63
+ self._base_url = base_url
64
+ self._timeout = timeout
65
+ self._max_retries = max_retries
66
+ self._debug = debug
67
+ self._checkout_base_url = checkout_base_url
57
68
 
58
69
  self.addresses = AddressesApi(self._http)
70
+ self.merchant_subscriptions = MerchantSubscriptionsApi(self._http)
59
71
  self.payment_orders = PaymentOrdersApi(self._http)
60
72
  self.checkout_sessions = CheckoutSessionsApi(self._http, checkout_base_url)
61
73
  self.webhooks = WebhooksApi(self._http)
62
74
 
75
+ def portal(self, portal_token: str) -> MerchantPortalApi:
76
+ """Create an end-user portal client using a portal session token."""
77
+ return MerchantPortalApi(
78
+ HttpClient(
79
+ api_key=portal_token,
80
+ base_url=self._base_url,
81
+ timeout=self._timeout,
82
+ max_retries=self._max_retries,
83
+ debug=self._debug,
84
+ ),
85
+ checkout_base_url=self._checkout_base_url,
86
+ )
87
+
63
88
  def close(self) -> None:
64
89
  """Close HTTP client."""
65
90
  self._http.close()
@@ -118,12 +143,31 @@ class AsyncStableOps:
118
143
  max_retries=max_retries,
119
144
  debug=debug,
120
145
  )
146
+ self._base_url = base_url
147
+ self._timeout = timeout
148
+ self._max_retries = max_retries
149
+ self._debug = debug
150
+ self._checkout_base_url = checkout_base_url
121
151
 
122
152
  self.addresses = AsyncAddressesApi(self._http)
153
+ self.merchant_subscriptions = AsyncMerchantSubscriptionsApi(self._http)
123
154
  self.payment_orders = AsyncPaymentOrdersApi(self._http)
124
155
  self.checkout_sessions = AsyncCheckoutSessionsApi(self._http, checkout_base_url)
125
156
  self.webhooks = AsyncWebhooksApi(self._http)
126
157
 
158
+ def portal(self, portal_token: str) -> AsyncMerchantPortalApi:
159
+ """Create an async end-user portal client using a portal session token."""
160
+ return AsyncMerchantPortalApi(
161
+ AsyncHttpClient(
162
+ api_key=portal_token,
163
+ base_url=self._base_url,
164
+ timeout=self._timeout,
165
+ max_retries=self._max_retries,
166
+ debug=self._debug,
167
+ ),
168
+ checkout_base_url=self._checkout_base_url,
169
+ )
170
+
127
171
  async def close(self) -> None:
128
172
  """Close HTTP client."""
129
173
  await self._http.close()
@@ -25,7 +25,7 @@ DEFAULT_MAX_RETRIES = 2
25
25
  DEFAULT_BASE_DELAY = 0.2
26
26
  DEFAULT_MAX_DELAY = 5.0
27
27
 
28
- HttpMethod = Literal["GET", "POST", "PATCH", "DELETE"]
28
+ HttpMethod = Literal["GET", "POST", "PUT", "PATCH", "DELETE"]
29
29
 
30
30
  # debug 钩子签名:接收一个 dict 事件(init / request / response / error)。
31
31
  # 传 True 走 logging.getLogger("stableops") .debug;也可传任意可调用对象自行处理。