Skip to content

Commit

Permalink
feat(api): add support for adding allocation price to subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jun 19, 2024
1 parent 7b3cdad commit 5751292
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 90
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d9cc087ece8a2eba847035f3cd8ae44d3401046e01761ab6ad7fd6165d93f0c8.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-d08c3c586f46f155358104a907afa8300ce44a25814c1574c0f4344935c1b838.yml
32 changes: 32 additions & 0 deletions src/resources/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3599,6 +3599,11 @@ export namespace SubscriptionPriceIntervalsParams {
*/
start_date: (string & {}) | Shared.BillingCycleRelativeDate;

/**
* The definition of a new allocation price to create and add to the subscription.
*/
allocation_price?: Add.AllocationPrice | null;

/**
* A list of discounts to initialize on the price interval.
*/
Expand Down Expand Up @@ -3667,6 +3672,33 @@ export namespace SubscriptionPriceIntervalsParams {
}

export namespace Add {
/**
* The definition of a new allocation price to create and add to the subscription.
*/
export interface AllocationPrice {
/**
* An amount of the currency to allocate to the customer at the specified cadence.
*/
amount: number;

/**
* The cadence at which to allocate the amount to the customer.
*/
cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual';

/**
* An ISO 4217 currency string or a custom pricing unit identifier in which to bill
* this price.
*/
currency: string;

/**
* Whether the allocated amount should expire at the end of the cadence or roll
* over to the next period.
*/
expires_at_end_of_cadence: boolean;
}

export interface AmountDiscountCreationParams {
/**
* Only available if discount_type is `amount`.
Expand Down
18 changes: 18 additions & 0 deletions tests/api-resources/subscriptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ describe('resource subscriptions', () => {
unit_config: { unit_amount: 'string' },
currency: 'string',
},
allocation_price: {
currency: 'USD',
amount: 0,
cadence: 'monthly',
expires_at_end_of_cadence: true,
},
start_date: '2019-12-27T18:11:19.117Z',
end_date: '2019-12-27T18:11:19.117Z',
fixed_fee_quantity_transitions: [
Expand Down Expand Up @@ -413,6 +419,12 @@ describe('resource subscriptions', () => {
unit_config: { unit_amount: 'string' },
currency: 'string',
},
allocation_price: {
currency: 'USD',
amount: 0,
cadence: 'monthly',
expires_at_end_of_cadence: true,
},
start_date: '2019-12-27T18:11:19.117Z',
end_date: '2019-12-27T18:11:19.117Z',
fixed_fee_quantity_transitions: [
Expand Down Expand Up @@ -445,6 +457,12 @@ describe('resource subscriptions', () => {
unit_config: { unit_amount: 'string' },
currency: 'string',
},
allocation_price: {
currency: 'USD',
amount: 0,
cadence: 'monthly',
expires_at_end_of_cadence: true,
},
start_date: '2019-12-27T18:11:19.117Z',
end_date: '2019-12-27T18:11:19.117Z',
fixed_fee_quantity_transitions: [
Expand Down

0 comments on commit 5751292

Please sign in to comment.