Skip to content

Commit 9b86b32

Browse files
feat(api): api update
1 parent 5f0fee3 commit 9b86b32

File tree

4 files changed

+60
-5
lines changed

4 files changed

+60
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-828c91953d2351040fdd4d90a3d9eafd09f9d240c4f6ce0441b7a10c06c1c722.yml
3-
openapi_spec_hash: c82bc88563f80f600e59e22014d4cec4
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-cbce25283cb9c3282e03e08b7ee81395436af7d0eb480ffcbab307b5bf1c92a0.yml
3+
openapi_spec_hash: c286edf46db95dee05eb6f180ac24ab0
44
config_hash: 1f73a949b649ecfe6ec68ba1bb459dc2

src/orb/resources/subscription_changes.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Union, Optional
6+
from datetime import date
67

78
import httpx
89

@@ -90,6 +91,9 @@ def apply(
9091
*,
9192
description: Optional[str] | Omit = omit,
9293
mark_as_paid: Optional[bool] | Omit = omit,
94+
payment_external_id: Optional[str] | Omit = omit,
95+
payment_notes: Optional[str] | Omit = omit,
96+
payment_received_date: Union[str, date, None] | Omit = omit,
9397
previously_collected_amount: Optional[str] | Omit = omit,
9498
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9599
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -111,6 +115,14 @@ def apply(
111115
mark_as_paid: Mark all pending invoices that are payable as paid. If amount is also provided,
112116
mark as paid and credit the difference to the customer's balance.
113117
118+
payment_external_id: An optional external ID to associate with the payment. Only applicable when
119+
mark_as_paid is true.
120+
121+
payment_notes: Optional notes about the payment. Only applicable when mark_as_paid is true.
122+
123+
payment_received_date: A date string to specify the date the payment was received. Only applicable when
124+
mark_as_paid is true. If not provided, defaults to the current date.
125+
114126
previously_collected_amount: Amount already collected to apply to the customer's balance. If mark_as_paid is
115127
also provided, credit the difference to the customer's balance.
116128
@@ -134,6 +146,9 @@ def apply(
134146
{
135147
"description": description,
136148
"mark_as_paid": mark_as_paid,
149+
"payment_external_id": payment_external_id,
150+
"payment_notes": payment_notes,
151+
"payment_received_date": payment_received_date,
137152
"previously_collected_amount": previously_collected_amount,
138153
},
139154
subscription_change_apply_params.SubscriptionChangeApplyParams,
@@ -263,6 +278,9 @@ async def apply(
263278
*,
264279
description: Optional[str] | Omit = omit,
265280
mark_as_paid: Optional[bool] | Omit = omit,
281+
payment_external_id: Optional[str] | Omit = omit,
282+
payment_notes: Optional[str] | Omit = omit,
283+
payment_received_date: Union[str, date, None] | Omit = omit,
266284
previously_collected_amount: Optional[str] | Omit = omit,
267285
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
268286
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -284,6 +302,14 @@ async def apply(
284302
mark_as_paid: Mark all pending invoices that are payable as paid. If amount is also provided,
285303
mark as paid and credit the difference to the customer's balance.
286304
305+
payment_external_id: An optional external ID to associate with the payment. Only applicable when
306+
mark_as_paid is true.
307+
308+
payment_notes: Optional notes about the payment. Only applicable when mark_as_paid is true.
309+
310+
payment_received_date: A date string to specify the date the payment was received. Only applicable when
311+
mark_as_paid is true. If not provided, defaults to the current date.
312+
287313
previously_collected_amount: Amount already collected to apply to the customer's balance. If mark_as_paid is
288314
also provided, credit the difference to the customer's balance.
289315
@@ -307,6 +333,9 @@ async def apply(
307333
{
308334
"description": description,
309335
"mark_as_paid": mark_as_paid,
336+
"payment_external_id": payment_external_id,
337+
"payment_notes": payment_notes,
338+
"payment_received_date": payment_received_date,
310339
"previously_collected_amount": previously_collected_amount,
311340
},
312341
subscription_change_apply_params.SubscriptionChangeApplyParams,

src/orb/types/subscription_change_apply_params.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
6-
from typing_extensions import TypedDict
5+
from typing import Union, Optional
6+
from datetime import date
7+
from typing_extensions import Annotated, TypedDict
8+
9+
from .._utils import PropertyInfo
710

811
__all__ = ["SubscriptionChangeApplyParams"]
912

@@ -19,6 +22,22 @@ class SubscriptionChangeApplyParams(TypedDict, total=False):
1922
customer's balance.
2023
"""
2124

25+
payment_external_id: Optional[str]
26+
"""An optional external ID to associate with the payment.
27+
28+
Only applicable when mark_as_paid is true.
29+
"""
30+
31+
payment_notes: Optional[str]
32+
"""Optional notes about the payment. Only applicable when mark_as_paid is true."""
33+
34+
payment_received_date: Annotated[Union[str, date, None], PropertyInfo(format="iso8601")]
35+
"""A date string to specify the date the payment was received.
36+
37+
Only applicable when mark_as_paid is true. If not provided, defaults to the
38+
current date.
39+
"""
40+
2241
previously_collected_amount: Optional[str]
2342
"""Amount already collected to apply to the customer's balance.
2443

tests/api_resources/test_subscription_changes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
SubscriptionChangeCancelResponse,
1414
SubscriptionChangeRetrieveResponse,
1515
)
16+
from orb._utils import parse_date
1617
from tests.utils import assert_matches_type
1718

1819
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -74,6 +75,9 @@ def test_method_apply_with_all_params(self, client: Orb) -> None:
7475
subscription_change_id="subscription_change_id",
7576
description="description",
7677
mark_as_paid=True,
78+
payment_external_id="payment_external_id",
79+
payment_notes="payment_notes",
80+
payment_received_date=parse_date("2019-12-27"),
7781
previously_collected_amount="previously_collected_amount",
7882
)
7983
assert_matches_type(SubscriptionChangeApplyResponse, subscription_change, path=["response"])
@@ -210,6 +214,9 @@ async def test_method_apply_with_all_params(self, async_client: AsyncOrb) -> Non
210214
subscription_change_id="subscription_change_id",
211215
description="description",
212216
mark_as_paid=True,
217+
payment_external_id="payment_external_id",
218+
payment_notes="payment_notes",
219+
payment_received_date=parse_date("2019-12-27"),
213220
previously_collected_amount="previously_collected_amount",
214221
)
215222
assert_matches_type(SubscriptionChangeApplyResponse, subscription_change, path=["response"])

0 commit comments

Comments
 (0)