Skip to content

Commit 6b4583e

Browse files
feat(api): api update
1 parent 1bb4db8 commit 6b4583e

File tree

5 files changed

+56
-12
lines changed

5 files changed

+56
-12
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: 139
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0186c0310e2a9f40302cc35f4248fca335b7ec8069502f684ba6f2fa37793033.yml
3-
openapi_spec_hash: 4fb1d2837ad3794864a7d59d393d6ff6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5bb582f84f0b4cf7bef84833fefd48a5f2734dc25805da2028fd8a6f1198da07.yml
3+
openapi_spec_hash: ced0e30dc67faa2414df511819408f12
44
config_hash: 3279841440b02d4e8303c961d6983492

src/orb/resources/invoices.py

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def create(
6868
currency: str,
6969
invoice_date: Union[str, datetime],
7070
line_items: Iterable[invoice_create_params.LineItem],
71+
auto_collection: Optional[bool] | Omit = omit,
7172
customer_id: Optional[str] | Omit = omit,
7273
discount: Optional[Discount] | Omit = omit,
7374
due_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
@@ -94,6 +95,10 @@ def create(
9495
invoice_date: Optional invoice date to set. Must be in the past, if not set, `invoice_date` is
9596
set to the current time in the customer's timezone.
9697
98+
auto_collection: Determines whether this invoice will automatically attempt to charge a saved
99+
payment method, if any. If not specified, the invoice inherits the customer's
100+
auto_collection setting.
101+
97102
customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and
98103
`external_customer_id` are required.
99104
@@ -139,6 +144,7 @@ def create(
139144
"currency": currency,
140145
"invoice_date": invoice_date,
141146
"line_items": line_items,
147+
"auto_collection": auto_collection,
142148
"customer_id": customer_id,
143149
"discount": discount,
144150
"due_date": due_date,
@@ -164,6 +170,7 @@ def update(
164170
self,
165171
invoice_id: str,
166172
*,
173+
auto_collection: Optional[bool] | Omit = omit,
167174
due_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
168175
invoice_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
169176
metadata: Optional[Dict[str, Optional[str]]] | Omit = omit,
@@ -177,15 +184,20 @@ def update(
177184
idempotency_key: str | None = None,
178185
) -> Invoice:
179186
"""
180-
This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, and
181-
`invoice_date` properties on an invoice. If you pass null for the metadata
182-
value, it will clear any existing metadata for that invoice.
187+
This endpoint allows you to update the `metadata`, `net_terms`, `due_date`,
188+
`invoice_date`, and `auto_collection` properties on an invoice. If you pass null
189+
for the metadata value, it will clear any existing metadata for that invoice.
183190
184191
`metadata` can be modified regardless of invoice state. `net_terms`, `due_date`,
185-
and `invoice_date` can only be modified if the invoice is in a `draft` state.
186-
`invoice_date` can only be modified for non-subscription invoices.
192+
`invoice_date`, and `auto_collection` can only be modified if the invoice is in
193+
a `draft` state. `invoice_date` can only be modified for non-subscription
194+
invoices.
187195
188196
Args:
197+
auto_collection: Determines whether this invoice will automatically attempt to charge a saved
198+
payment method, if any. Can only be modified on draft invoices. If not
199+
specified, the invoice's existing setting is unchanged.
200+
189201
due_date: An optional custom due date for the invoice. If not set, the due date will be
190202
calculated based on the `net_terms` value.
191203
@@ -217,6 +229,7 @@ def update(
217229
f"/invoices/{invoice_id}",
218230
body=maybe_transform(
219231
{
232+
"auto_collection": auto_collection,
220233
"due_date": due_date,
221234
"invoice_date": invoice_date,
222235
"metadata": metadata,
@@ -852,6 +865,7 @@ async def create(
852865
currency: str,
853866
invoice_date: Union[str, datetime],
854867
line_items: Iterable[invoice_create_params.LineItem],
868+
auto_collection: Optional[bool] | Omit = omit,
855869
customer_id: Optional[str] | Omit = omit,
856870
discount: Optional[Discount] | Omit = omit,
857871
due_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
@@ -878,6 +892,10 @@ async def create(
878892
invoice_date: Optional invoice date to set. Must be in the past, if not set, `invoice_date` is
879893
set to the current time in the customer's timezone.
880894
895+
auto_collection: Determines whether this invoice will automatically attempt to charge a saved
896+
payment method, if any. If not specified, the invoice inherits the customer's
897+
auto_collection setting.
898+
881899
customer_id: The id of the `Customer` to create this invoice for. One of `customer_id` and
882900
`external_customer_id` are required.
883901
@@ -923,6 +941,7 @@ async def create(
923941
"currency": currency,
924942
"invoice_date": invoice_date,
925943
"line_items": line_items,
944+
"auto_collection": auto_collection,
926945
"customer_id": customer_id,
927946
"discount": discount,
928947
"due_date": due_date,
@@ -948,6 +967,7 @@ async def update(
948967
self,
949968
invoice_id: str,
950969
*,
970+
auto_collection: Optional[bool] | Omit = omit,
951971
due_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
952972
invoice_date: Union[Union[str, date], Union[str, datetime], None] | Omit = omit,
953973
metadata: Optional[Dict[str, Optional[str]]] | Omit = omit,
@@ -961,15 +981,20 @@ async def update(
961981
idempotency_key: str | None = None,
962982
) -> Invoice:
963983
"""
964-
This endpoint allows you to update the `metadata`, `net_terms`, `due_date`, and
965-
`invoice_date` properties on an invoice. If you pass null for the metadata
966-
value, it will clear any existing metadata for that invoice.
984+
This endpoint allows you to update the `metadata`, `net_terms`, `due_date`,
985+
`invoice_date`, and `auto_collection` properties on an invoice. If you pass null
986+
for the metadata value, it will clear any existing metadata for that invoice.
967987
968988
`metadata` can be modified regardless of invoice state. `net_terms`, `due_date`,
969-
and `invoice_date` can only be modified if the invoice is in a `draft` state.
970-
`invoice_date` can only be modified for non-subscription invoices.
989+
`invoice_date`, and `auto_collection` can only be modified if the invoice is in
990+
a `draft` state. `invoice_date` can only be modified for non-subscription
991+
invoices.
971992
972993
Args:
994+
auto_collection: Determines whether this invoice will automatically attempt to charge a saved
995+
payment method, if any. Can only be modified on draft invoices. If not
996+
specified, the invoice's existing setting is unchanged.
997+
973998
due_date: An optional custom due date for the invoice. If not set, the due date will be
974999
calculated based on the `net_terms` value.
9751000
@@ -1001,6 +1026,7 @@ async def update(
10011026
f"/invoices/{invoice_id}",
10021027
body=await async_maybe_transform(
10031028
{
1029+
"auto_collection": auto_collection,
10041030
"due_date": due_date,
10051031
"invoice_date": invoice_date,
10061032
"metadata": metadata,

src/orb/types/invoice_create_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class InvoiceCreateParams(TypedDict, total=False):
2929

3030
line_items: Required[Iterable[LineItem]]
3131

32+
auto_collection: Optional[bool]
33+
"""
34+
Determines whether this invoice will automatically attempt to charge a saved
35+
payment method, if any. If not specified, the invoice inherits the customer's
36+
auto_collection setting.
37+
"""
38+
3239
customer_id: Optional[str]
3340
"""The id of the `Customer` to create this invoice for.
3441

src/orb/types/invoice_update_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212

1313

1414
class InvoiceUpdateParams(TypedDict, total=False):
15+
auto_collection: Optional[bool]
16+
"""
17+
Determines whether this invoice will automatically attempt to charge a saved
18+
payment method, if any. Can only be modified on draft invoices. If not
19+
specified, the invoice's existing setting is unchanged.
20+
"""
21+
1522
due_date: Annotated[Union[Union[str, date], Union[str, datetime], None], PropertyInfo(format="iso8601")]
1623
"""An optional custom due date for the invoice.
1724

tests/api_resources/test_invoices.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
6262
},
6363
}
6464
],
65+
auto_collection=True,
6566
customer_id="4khy3nwzktxv7",
6667
discount={
6768
"discount_type": "percentage",
@@ -144,6 +145,7 @@ def test_method_update(self, client: Orb) -> None:
144145
def test_method_update_with_all_params(self, client: Orb) -> None:
145146
invoice = client.invoices.update(
146147
invoice_id="invoice_id",
148+
auto_collection=True,
147149
due_date=parse_date("2023-09-22"),
148150
invoice_date=parse_date("2023-09-22"),
149151
metadata={"foo": "string"},
@@ -663,6 +665,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
663665
},
664666
}
665667
],
668+
auto_collection=True,
666669
customer_id="4khy3nwzktxv7",
667670
discount={
668671
"discount_type": "percentage",
@@ -745,6 +748,7 @@ async def test_method_update(self, async_client: AsyncOrb) -> None:
745748
async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> None:
746749
invoice = await async_client.invoices.update(
747750
invoice_id="invoice_id",
751+
auto_collection=True,
748752
due_date=parse_date("2023-09-22"),
749753
invoice_date=parse_date("2023-09-22"),
750754
metadata={"foo": "string"},

0 commit comments

Comments
 (0)