Skip to content

Commit 931c0f4

Browse files
feat(api): api update
1 parent c5ab3b4 commit 931c0f4

File tree

11 files changed

+91
-17
lines changed

11 files changed

+91
-17
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-6b1440d47f0b1b1b92f2e40f9ad5efd301d90f66e2e05c5a932902608935aa64.yml
3-
openapi_spec_hash: 14f386604d0d87d9459352b8a7b84eff
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ebac75191b7fecb0dc03df5b9eeb62d99811905552ddc2a2bd5a7a77dbfe00d3.yml
3+
openapi_spec_hash: 1b96488643f8c4bc07ea184aa2505ca7
44
config_hash: c01c1191b1cd696c7ca855ff6d28a8df

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Methods:
408408
- <code title="post /invoices/summary/{invoice_id}/issue">client.invoices.<a href="./src/orb/resources/invoices.py">issue_summary</a>(invoice_id, \*\*<a href="src/orb/types/invoice_issue_summary_params.py">params</a>) -> <a href="./src/orb/types/invoice_issue_summary_response.py">InvoiceIssueSummaryResponse</a></code>
409409
- <code title="get /invoices/summary">client.invoices.<a href="./src/orb/resources/invoices.py">list_summary</a>(\*\*<a href="src/orb/types/invoice_list_summary_params.py">params</a>) -> <a href="./src/orb/types/invoice_list_summary_response.py">SyncPage[InvoiceListSummaryResponse]</a></code>
410410
- <code title="post /invoices/{invoice_id}/mark_paid">client.invoices.<a href="./src/orb/resources/invoices.py">mark_paid</a>(invoice_id, \*\*<a href="src/orb/types/invoice_mark_paid_params.py">params</a>) -> <a href="./src/orb/types/shared/invoice.py">Invoice</a></code>
411-
- <code title="post /invoices/{invoice_id}/pay">client.invoices.<a href="./src/orb/resources/invoices.py">pay</a>(invoice_id) -> <a href="./src/orb/types/shared/invoice.py">Invoice</a></code>
411+
- <code title="post /invoices/{invoice_id}/pay">client.invoices.<a href="./src/orb/resources/invoices.py">pay</a>(invoice_id, \*\*<a href="src/orb/types/invoice_pay_params.py">params</a>) -> <a href="./src/orb/types/shared/invoice.py">Invoice</a></code>
412412
- <code title="post /invoices/{invoice_id}/void">client.invoices.<a href="./src/orb/resources/invoices.py">void</a>(invoice_id) -> <a href="./src/orb/types/shared/invoice.py">Invoice</a></code>
413413

414414
# Items

src/orb/resources/invoices.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from .. import _legacy_response
1212
from ..types import (
13+
invoice_pay_params,
1314
invoice_list_params,
1415
invoice_issue_params,
1516
invoice_create_params,
@@ -743,6 +744,7 @@ def pay(
743744
self,
744745
invoice_id: str,
745746
*,
747+
shared_payment_token_id: str,
746748
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
747749
# The extra values given here take precedence over values defined on the client or passed to this method.
748750
extra_headers: Headers | None = None,
@@ -751,11 +753,16 @@ def pay(
751753
timeout: float | httpx.Timeout | None | NotGiven = not_given,
752754
idempotency_key: str | None = None,
753755
) -> Invoice:
754-
"""
755-
This endpoint collects payment for an invoice using the customer's default
756-
payment method. This action can only be taken on invoices with status "issued".
756+
"""This endpoint collects payment for an invoice.
757+
758+
By default, it uses the
759+
customer's default payment method. Optionally, a shared payment token (SPT) can
760+
be provided to pay using agent-granted credentials instead. This action can only
761+
be taken on invoices with status "issued".
757762
758763
Args:
764+
shared_payment_token_id: The ID of a shared payment token granted by an agent to use for this payment.
765+
759766
extra_headers: Send extra headers
760767
761768
extra_query: Add additional query parameters to the request
@@ -770,6 +777,9 @@ def pay(
770777
raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}")
771778
return self._post(
772779
f"/invoices/{invoice_id}/pay",
780+
body=maybe_transform(
781+
{"shared_payment_token_id": shared_payment_token_id}, invoice_pay_params.InvoicePayParams
782+
),
773783
options=make_request_options(
774784
extra_headers=extra_headers,
775785
extra_query=extra_query,
@@ -1542,6 +1552,7 @@ async def pay(
15421552
self,
15431553
invoice_id: str,
15441554
*,
1555+
shared_payment_token_id: str,
15451556
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
15461557
# The extra values given here take precedence over values defined on the client or passed to this method.
15471558
extra_headers: Headers | None = None,
@@ -1550,11 +1561,16 @@ async def pay(
15501561
timeout: float | httpx.Timeout | None | NotGiven = not_given,
15511562
idempotency_key: str | None = None,
15521563
) -> Invoice:
1553-
"""
1554-
This endpoint collects payment for an invoice using the customer's default
1555-
payment method. This action can only be taken on invoices with status "issued".
1564+
"""This endpoint collects payment for an invoice.
1565+
1566+
By default, it uses the
1567+
customer's default payment method. Optionally, a shared payment token (SPT) can
1568+
be provided to pay using agent-granted credentials instead. This action can only
1569+
be taken on invoices with status "issued".
15561570
15571571
Args:
1572+
shared_payment_token_id: The ID of a shared payment token granted by an agent to use for this payment.
1573+
15581574
extra_headers: Send extra headers
15591575
15601576
extra_query: Add additional query parameters to the request
@@ -1569,6 +1585,9 @@ async def pay(
15691585
raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}")
15701586
return await self._post(
15711587
f"/invoices/{invoice_id}/pay",
1588+
body=await async_maybe_transform(
1589+
{"shared_payment_token_id": shared_payment_token_id}, invoice_pay_params.InvoicePayParams
1590+
),
15721591
options=make_request_options(
15731592
extra_headers=extra_headers,
15741593
extra_query=extra_query,

src/orb/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
from .alert_list_params import AlertListParams as AlertListParams
151151
from .price_list_params import PriceListParams as PriceListParams
152152
from .coupon_list_params import CouponListParams as CouponListParams
153+
from .invoice_pay_params import InvoicePayParams as InvoicePayParams
153154
from .item_create_params import ItemCreateParams as ItemCreateParams
154155
from .item_update_params import ItemUpdateParams as ItemUpdateParams
155156
from .metric_list_params import MetricListParams as MetricListParams

src/orb/types/customer.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ class PaymentConfigurationPaymentProvider(BaseModel):
4444
provider_type: Literal["stripe"]
4545
"""The payment provider to configure."""
4646

47+
default_shared_payment_token: Optional[str] = None
48+
"""
49+
The ID of a shared payment token granted by an agent to use as the default
50+
payment instrument for this customer. When set, auto-collection will use this
51+
token instead of the customer's default payment method.
52+
"""
53+
4754
excluded_payment_method_types: Optional[List[str]] = None
4855
"""List of Stripe payment method types to exclude for this customer.
4956

src/orb/types/customer_create_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ class PaymentConfigurationPaymentProvider(TypedDict, total=False):
277277
provider_type: Required[Literal["stripe"]]
278278
"""The payment provider to configure."""
279279

280+
default_shared_payment_token: Optional[str]
281+
"""
282+
The ID of a shared payment token granted by an agent to use as the default
283+
payment instrument for this customer. When set, auto-collection will use this
284+
token instead of the customer's default payment method.
285+
"""
286+
280287
excluded_payment_method_types: SequenceNotStr[str]
281288
"""List of Stripe payment method types to exclude for this customer.
282289

src/orb/types/customer_update_by_external_id_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ class PaymentConfigurationPaymentProvider(TypedDict, total=False):
274274
provider_type: Required[Literal["stripe"]]
275275
"""The payment provider to configure."""
276276

277+
default_shared_payment_token: Optional[str]
278+
"""
279+
The ID of a shared payment token granted by an agent to use as the default
280+
payment instrument for this customer. When set, auto-collection will use this
281+
token instead of the customer's default payment method.
282+
"""
283+
277284
excluded_payment_method_types: SequenceNotStr[str]
278285
"""List of Stripe payment method types to exclude for this customer.
279286

src/orb/types/customer_update_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ class PaymentConfigurationPaymentProvider(TypedDict, total=False):
274274
provider_type: Required[Literal["stripe"]]
275275
"""The payment provider to configure."""
276276

277+
default_shared_payment_token: Optional[str]
278+
"""
279+
The ID of a shared payment token granted by an agent to use as the default
280+
payment instrument for this customer. When set, auto-collection will use this
281+
token instead of the customer's default payment method.
282+
"""
283+
277284
excluded_payment_method_types: SequenceNotStr[str]
278285
"""List of Stripe payment method types to exclude for this customer.
279286
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Required, TypedDict
6+
7+
__all__ = ["InvoicePayParams"]
8+
9+
10+
class InvoicePayParams(TypedDict, total=False):
11+
shared_payment_token_id: Required[str]
12+
"""The ID of a shared payment token granted by an agent to use for this payment."""

tests/api_resources/test_customers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
6666
"payment_providers": [
6767
{
6868
"provider_type": "stripe",
69+
"default_shared_payment_token": "default_shared_payment_token",
6970
"excluded_payment_method_types": ["string"],
7071
}
7172
]
@@ -167,6 +168,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None:
167168
"payment_providers": [
168169
{
169170
"provider_type": "stripe",
171+
"default_shared_payment_token": "default_shared_payment_token",
170172
"excluded_payment_method_types": ["string"],
171173
}
172174
]
@@ -499,6 +501,7 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None
499501
"payment_providers": [
500502
{
501503
"provider_type": "stripe",
504+
"default_shared_payment_token": "default_shared_payment_token",
502505
"excluded_payment_method_types": ["string"],
503506
}
504507
]
@@ -610,6 +613,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
610613
"payment_providers": [
611614
{
612615
"provider_type": "stripe",
616+
"default_shared_payment_token": "default_shared_payment_token",
613617
"excluded_payment_method_types": ["string"],
614618
}
615619
]
@@ -711,6 +715,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No
711715
"payment_providers": [
712716
{
713717
"provider_type": "stripe",
718+
"default_shared_payment_token": "default_shared_payment_token",
714719
"excluded_payment_method_types": ["string"],
715720
}
716721
]
@@ -1055,6 +1060,7 @@ async def test_method_update_by_external_id_with_all_params(self, async_client:
10551060
"payment_providers": [
10561061
{
10571062
"provider_type": "stripe",
1063+
"default_shared_payment_token": "default_shared_payment_token",
10581064
"excluded_payment_method_types": ["string"],
10591065
}
10601066
]

0 commit comments

Comments
 (0)