Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.15.0"
".": "2.16.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 96
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-1345a8e288e34d5477b0e189877225f83939a59078c22fbb5367712e376c5d19.yml
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-bf3e71b33372f4a9307f4b6cb689ea46b3cf583ecc5d79eee9601cd0b0467c9a.yml
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 2.16.0 (2024-11-15)

Full Changelog: [v2.15.0...v2.16.0](https://github.com/orbcorp/orb-python/compare/v2.15.0...v2.16.0)

### Features

* **api:** api update ([#430](https://github.com/orbcorp/orb-python/issues/430)) ([5457ac2](https://github.com/orbcorp/orb-python/commit/5457ac24adc55caee65382214e0cbf9739e963f3))


### Chores

* rebuild project due to codegen change ([#427](https://github.com/orbcorp/orb-python/issues/427)) ([bf7c315](https://github.com/orbcorp/orb-python/commit/bf7c315a84c6b959369bfc1f255f9353ad5c3c6f))
* rebuild project due to codegen change ([#429](https://github.com/orbcorp/orb-python/issues/429)) ([2bfa0a2](https://github.com/orbcorp/orb-python/commit/2bfa0a206c28724761471ed98d5c619d33a2506b))

## 2.15.0 (2024-11-06)

Full Changelog: [v2.14.0...v2.15.0](https://github.com/orbcorp/orb-python/compare/v2.14.0...v2.15.0)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import os
from orb import Orb

client = Orb(
# This is the default and can be omitted
api_key=os.environ.get("ORB_API_KEY"),
api_key=os.environ.get("ORB_API_KEY"), # This is the default and can be omitted
)

customer = client.customers.create(
Expand All @@ -52,8 +51,7 @@ import asyncio
from orb import AsyncOrb

client = AsyncOrb(
# This is the default and can be omitted
api_key=os.environ.get("ORB_API_KEY"),
api_key=os.environ.get("ORB_API_KEY"), # This is the default and can be omitted
)


Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Methods:
- <code title="get /invoices/upcoming">client.invoices.<a href="./src/orb/resources/invoices.py">fetch_upcoming</a>(\*\*<a href="src/orb/types/invoice_fetch_upcoming_params.py">params</a>) -> <a href="./src/orb/types/invoice_fetch_upcoming_response.py">InvoiceFetchUpcomingResponse</a></code>
- <code title="post /invoices/{invoice_id}/issue">client.invoices.<a href="./src/orb/resources/invoices.py">issue</a>(invoice_id) -> <a href="./src/orb/types/invoice.py">Invoice</a></code>
- <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/invoice.py">Invoice</a></code>
- <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.py">Invoice</a></code>
- <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/invoice.py">Invoice</a></code>

# Items
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "orb-billing"
version = "2.15.0"
version = "2.16.0"
description = "The official Python library for the orb API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 5 additions & 0 deletions src/orb/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ async def _async_transform_recursive(
# Iterable[T]
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
):
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
# intended as an iterable, so we don't transform it.
if isinstance(data, dict):
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

Expand Down
2 changes: 1 addition & 1 deletion src/orb/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "orb"
__version__ = "2.15.0" # x-release-please-version
__version__ = "2.16.0" # x-release-please-version
94 changes: 94 additions & 0 deletions src/orb/resources/invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,47 @@ def mark_paid(
cast_to=Invoice,
)

def pay(
self,
invoice_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Invoice:
"""
This endpoint collects payment for an invoice using the customer's default
payment method. This action can only be taken on invoices with status "issued".

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not invoice_id:
raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}")
return self._post(
f"/invoices/{invoice_id}/pay",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=Invoice,
)

def void(
self,
invoice_id: str,
Expand Down Expand Up @@ -917,6 +958,47 @@ async def mark_paid(
cast_to=Invoice,
)

async def pay(
self,
invoice_id: str,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
idempotency_key: str | None = None,
) -> Invoice:
"""
This endpoint collects payment for an invoice using the customer's default
payment method. This action can only be taken on invoices with status "issued".

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

idempotency_key: Specify a custom idempotency key for this request
"""
if not invoice_id:
raise ValueError(f"Expected a non-empty value for `invoice_id` but received {invoice_id!r}")
return await self._post(
f"/invoices/{invoice_id}/pay",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
idempotency_key=idempotency_key,
),
cast_to=Invoice,
)

async def void(
self,
invoice_id: str,
Expand Down Expand Up @@ -990,6 +1072,9 @@ def __init__(self, invoices: Invoices) -> None:
self.mark_paid = _legacy_response.to_raw_response_wrapper(
invoices.mark_paid,
)
self.pay = _legacy_response.to_raw_response_wrapper(
invoices.pay,
)
self.void = _legacy_response.to_raw_response_wrapper(
invoices.void,
)
Expand Down Expand Up @@ -1020,6 +1105,9 @@ def __init__(self, invoices: AsyncInvoices) -> None:
self.mark_paid = _legacy_response.async_to_raw_response_wrapper(
invoices.mark_paid,
)
self.pay = _legacy_response.async_to_raw_response_wrapper(
invoices.pay,
)
self.void = _legacy_response.async_to_raw_response_wrapper(
invoices.void,
)
Expand Down Expand Up @@ -1050,6 +1138,9 @@ def __init__(self, invoices: Invoices) -> None:
self.mark_paid = to_streamed_response_wrapper(
invoices.mark_paid,
)
self.pay = to_streamed_response_wrapper(
invoices.pay,
)
self.void = to_streamed_response_wrapper(
invoices.void,
)
Expand Down Expand Up @@ -1080,6 +1171,9 @@ def __init__(self, invoices: AsyncInvoices) -> None:
self.mark_paid = async_to_streamed_response_wrapper(
invoices.mark_paid,
)
self.pay = async_to_streamed_response_wrapper(
invoices.pay,
)
self.void = async_to_streamed_response_wrapper(
invoices.void,
)
24 changes: 24 additions & 0 deletions src/orb/types/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"LineItemTaxAmount",
"Maximum",
"Minimum",
"PaymentAttempt",
"ShippingAddress",
"Subscription",
]
Expand Down Expand Up @@ -743,6 +744,26 @@ class Minimum(BaseModel):
"""Minimum amount applied"""


class PaymentAttempt(BaseModel):
id: str
"""The ID of the payment attempt."""

amount: str
"""The amount of the payment attempt."""

created_at: datetime
"""The time at which the payment attempt was created."""

payment_provider: Optional[Literal["stripe"]] = None
"""The payment provider that attempted to collect the payment."""

payment_provider_id: Optional[str] = None
"""The ID of the payment attempt in the payment provider."""

succeeded: bool
"""Whether the payment attempt succeeded."""


class ShippingAddress(BaseModel):
city: Optional[str] = None

Expand Down Expand Up @@ -970,6 +991,9 @@ class Invoice(BaseModel):
was paid.
"""

payment_attempts: List[PaymentAttempt]
"""A list of payment attempts associated with the invoice"""

payment_failed_at: Optional[datetime] = None
"""
If payment was attempted on this invoice but failed, this will be the time of
Expand Down
24 changes: 24 additions & 0 deletions src/orb/types/invoice_fetch_upcoming_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"LineItemTaxAmount",
"Maximum",
"Minimum",
"PaymentAttempt",
"ShippingAddress",
"Subscription",
]
Expand Down Expand Up @@ -743,6 +744,26 @@ class Minimum(BaseModel):
"""Minimum amount applied"""


class PaymentAttempt(BaseModel):
id: str
"""The ID of the payment attempt."""

amount: str
"""The amount of the payment attempt."""

created_at: datetime
"""The time at which the payment attempt was created."""

payment_provider: Optional[Literal["stripe"]] = None
"""The payment provider that attempted to collect the payment."""

payment_provider_id: Optional[str] = None
"""The ID of the payment attempt in the payment provider."""

succeeded: bool
"""Whether the payment attempt succeeded."""


class ShippingAddress(BaseModel):
city: Optional[str] = None

Expand Down Expand Up @@ -967,6 +988,9 @@ class InvoiceFetchUpcomingResponse(BaseModel):
was paid.
"""

payment_attempts: List[PaymentAttempt]
"""A list of payment attempts associated with the invoice"""

payment_failed_at: Optional[datetime] = None
"""
If payment was attempted on this invoice but failed, this will be the time of
Expand Down
Loading
Loading