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 @@
{
".": "4.51.0"
".": "4.52.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: 101
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7fca89ba5a0b4997358c25e6cdfb616a1d8b93a6820e25078f3fa5f61110bfe6.yml
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-326205df28a52e9ad57c34d7ed1ec85fadd67f9a041df2882ebaa65f6de09930.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 4.52.0 (2025-01-23)

Full Changelog: [v4.51.0...v4.52.0](https://github.com/orbcorp/orb-node/compare/v4.51.0...v4.52.0)

### Features

* **api:** api update ([#484](https://github.com/orbcorp/orb-node/issues/484)) ([e47c418](https://github.com/orbcorp/orb-node/commit/e47c41801bd4143c786622ce56e15048f9528e13))

## 4.51.0 (2025-01-22)

Full Changelog: [v4.50.0...v4.51.0](https://github.com/orbcorp/orb-node/compare/v4.50.0...v4.51.0)
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Methods:
- <code title="delete /customers/{customer_id}">client.customers.<a href="./src/resources/customers/customers.ts">delete</a>(customerId) -> void</code>
- <code title="get /customers/{customer_id}">client.customers.<a href="./src/resources/customers/customers.ts">fetch</a>(customerId) -> Customer</code>
- <code title="get /customers/external_customer_id/{external_customer_id}">client.customers.<a href="./src/resources/customers/customers.ts">fetchByExternalId</a>(externalCustomerId) -> Customer</code>
- <code title="post /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway">client.customers.<a href="./src/resources/customers/customers.ts">syncPaymentMethodsFromGateway</a>(externalCustomerId) -> void</code>
- <code title="post /customers/{customer_id}/sync_payment_methods_from_gateway">client.customers.<a href="./src/resources/customers/customers.ts">syncPaymentMethodsFromGatewayByExternalCustomerId</a>(customerId) -> void</code>
- <code title="put /customers/external_customer_id/{external_customer_id}">client.customers.<a href="./src/resources/customers/customers.ts">updateByExternalId</a>(id, { ...params }) -> Customer</code>

## Costs
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orb-billing",
"version": "4.51.0",
"version": "4.52.0",
"description": "The official TypeScript library for the Orb API",
"author": "Orb <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
36 changes: 36 additions & 0 deletions src/resources/customers/customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,42 @@ export class Customers extends APIResource {
return this._client.get(`/customers/external_customer_id/${externalCustomerId}`, options);
}

/**
* Sync Orb's payment methods for the customer with their gateway.
*
* This method can be called before taking an action that may cause the customer to
* be charged, ensuring that the most up-to-date payment method is charged.
*
* **Note**: This functionality is currently only available for Stripe.
*/
syncPaymentMethodsFromGateway(
externalCustomerId: string,
options?: Core.RequestOptions,
): Core.APIPromise<void> {
return this._client.post(
`/customers/external_customer_id/${externalCustomerId}/sync_payment_methods_from_gateway`,
{ ...options, headers: { Accept: '*/*', ...options?.headers } },
);
}

/**
* Sync Orb's payment methods for the customer with their gateway.
*
* This method can be called before taking an action that may cause the customer to
* be charged, ensuring that the most up-to-date payment method is charged.
*
* **Note**: This functionality is currently only available for Stripe.
*/
syncPaymentMethodsFromGatewayByExternalCustomerId(
customerId: string,
options?: Core.RequestOptions,
): Core.APIPromise<void> {
return this._client.post(`/customers/${customerId}/sync_payment_methods_from_gateway`, {
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}

/**
* This endpoint is used to update customer details given an `external_customer_id`
* (see [Customer ID Aliases](/events-and-metrics/customer-aliases)). Note that the
Expand Down
10 changes: 6 additions & 4 deletions src/resources/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ export interface Invoice {
discounts: Array<Shared.InvoiceLevelDiscount>;

/**
* When the invoice payment is due.
* When the invoice payment is due. The due date is null if the invoice is not yet
* finalized.
*/
due_date: string;
due_date: string | null;

/**
* If the invoice has a status of `draft`, this will be the time that the invoice
Expand Down Expand Up @@ -1286,9 +1287,10 @@ export interface InvoiceFetchUpcomingResponse {
discounts: Array<Shared.InvoiceLevelDiscount>;

/**
* When the invoice payment is due.
* When the invoice payment is due. The due date is null if the invoice is not yet
* finalized.
*/
due_date: string;
due_date: string | null;

/**
* If the invoice has a status of `draft`, this will be the time that the invoice
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '4.51.0'; // x-release-please-version
export const VERSION = '4.52.0'; // x-release-please-version
40 changes: 40 additions & 0 deletions tests/api-resources/customers/customers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,46 @@ describe('resource customers', () => {
).rejects.toThrow(Orb.NotFoundError);
});

test('syncPaymentMethodsFromGateway', async () => {
const responsePromise = client.customers.syncPaymentMethodsFromGateway('external_customer_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

test('syncPaymentMethodsFromGateway: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.customers.syncPaymentMethodsFromGateway('external_customer_id', {
path: '/_stainless_unknown_path',
}),
).rejects.toThrow(Orb.NotFoundError);
});

test('syncPaymentMethodsFromGatewayByExternalCustomerId', async () => {
const responsePromise = client.customers.syncPaymentMethodsFromGatewayByExternalCustomerId('customer_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

test('syncPaymentMethodsFromGatewayByExternalCustomerId: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.customers.syncPaymentMethodsFromGatewayByExternalCustomerId('customer_id', {
path: '/_stainless_unknown_path',
}),
).rejects.toThrow(Orb.NotFoundError);
});

test('updateByExternalId', async () => {
const responsePromise = client.customers.updateByExternalId('external_customer_id', {});
const rawResponse = await responsePromise.asResponse();
Expand Down
Loading