Skip to content

Commit

Permalink
Codegen for openapi v168
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe committed Jul 20, 2022
1 parent b2e6a9a commit 190184b
Show file tree
Hide file tree
Showing 8 changed files with 276 additions and 33 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v166
v168
1 change: 1 addition & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
Products: require('./resources/Products'),
PromotionCodes: require('./resources/PromotionCodes'),
Quotes: require('./resources/Quotes'),
QuotePhases: require('./resources/QuotePhases'),
Refunds: require('./resources/Refunds'),
Reviews: require('./resources/Reviews'),
SetupAttempts: require('./resources/SetupAttempts'),
Expand Down
27 changes: 27 additions & 0 deletions lib/resources/QuotePhases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'quote_phases',

retrieve: stripeMethod({
method: 'GET',
path: '/{quotePhase}',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),

listLineItems: stripeMethod({
method: 'GET',
path: '/{quotePhase}/line_items',
methodType: 'list',
}),
});
12 changes: 12 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ declare module 'stripe' {
*/
currency: string | null;

/**
* The default three-letter [ISO code for the currency](https://stripe.com/docs/currencies) that the customer will be charged in for billing purposes.
*/
default_currency?: string | null;

/**
* ID of the default payment source for the customer.
*
Expand Down Expand Up @@ -72,6 +77,13 @@ declare module 'stripe' {
*/
email: string | null;

/**
* The current multi-currency balances, if any, being stored on the customer.If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices.They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized.
*/
invoice_credit_balance?: {
[key: string]: number;
};

/**
* The prefix for the customer used to generate unique invoice numbers.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,11 @@ declare module 'stripe' {
*/
collection_method?: InvoiceCreateParams.CollectionMethod;

/**
* The currency to create this invoice in. Defaults to that of `customer` if not specified.
*/
currency?: string;

/**
* A list of up to 4 custom fields to be displayed on the invoice.
*/
Expand Down
226 changes: 226 additions & 0 deletions types/2020-08-27/QuotePhases.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
// File generated from our OpenAPI spec

declare module 'stripe' {
namespace Stripe {
/**
* The QuotePhase object.
*/
interface QuotePhase {
/**
* Unique identifier for the object.
*/
id: string;

/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: 'quote_phase';

/**
* Total before any discounts or taxes are applied.
*/
amount_subtotal: number;

/**
* Total after discounts and taxes are applied.
*/
amount_total: number;

/**
* If set to `new`, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
*/
billing_cycle_anchor: 'reset' | null;

/**
* Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions.
*/
collection_method: QuotePhase.CollectionMethod | null;

/**
* The default tax rates to apply to the subscription during this phase of the quote.
*/
default_tax_rates?: Array<string | Stripe.TaxRate>;

/**
* The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts.
*/
discounts: Array<string | Stripe.Discount>;

/**
* The end of this phase of the quote
*/
end_date: number | null;

/**
* The invoice settings applicable during this phase.
*/
invoice_settings: QuotePhase.InvoiceSettings | null;

/**
* Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`.
*/
iterations: number | null;

/**
* A list of items the customer is being quoted for.
*/
line_items?: ApiList<Stripe.LineItem>;

/**
* If the quote will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`.
*/
proration_behavior: QuotePhase.ProrationBehavior;

total_details: QuotePhase.TotalDetails;

/**
* If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees.
*/
trial: boolean | null;

/**
* When the trial ends within the phase.
*/
trial_end: number | null;
}

namespace QuotePhase {
type CollectionMethod = 'charge_automatically' | 'send_invoice';

interface InvoiceSettings {
/**
* Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
*/
days_until_due: number | null;
}

type ProrationBehavior = 'always_invoice' | 'create_prorations' | 'none';

interface TotalDetails {
/**
* This is the sum of all the discounts.
*/
amount_discount: number;

/**
* This is the sum of all the shipping amounts.
*/
amount_shipping: number | null;

/**
* This is the sum of all the tax amounts.
*/
amount_tax: number;

breakdown?: TotalDetails.Breakdown;
}

namespace TotalDetails {
interface Breakdown {
/**
* The aggregated discounts.
*/
discounts: Array<Breakdown.Discount>;

/**
* The aggregated tax amounts by rate.
*/
taxes: Array<Breakdown.Tax>;
}

namespace Breakdown {
interface Discount {
/**
* The amount discounted.
*/
amount: number;

/**
* A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes).
* It contains information about when the discount began, when it will end, and what it is applied to.
*
* Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts).
*/
discount: Stripe.Discount;
}

interface Tax {
/**
* Amount of tax applied for this rate.
*/
amount: number;

/**
* Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
*
* Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates).
*/
rate: Stripe.TaxRate;
}
}
}
}

interface QuotePhaseRetrieveParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface QuotePhaseListParams extends PaginationParams {
/**
* The ID of the quote whose phases will be retrieved.
*/
quote: string;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

interface QuotePhaseListLineItemsParams extends PaginationParams {
/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

class QuotePhasesResource {
/**
* Retrieves the quote phase with the given ID.
*/
retrieve(
id: string,
params?: QuotePhaseRetrieveParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.QuotePhase>>;
retrieve(
id: string,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.QuotePhase>>;

/**
* Returns a list of quote phases.
*/
list(
params: QuotePhaseListParams,
options?: RequestOptions
): ApiListPromise<Stripe.QuotePhase>;

/**
* When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
*/
listLineItems(
id: string,
params?: QuotePhaseListLineItemsParams,
options?: RequestOptions
): ApiListPromise<Stripe.LineItem>;
listLineItems(
id: string,
options?: RequestOptions
): ApiListPromise<Stripe.LineItem>;
}
}
}
34 changes: 2 additions & 32 deletions types/2020-08-27/SubscriptionSchedules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1699,8 +1699,6 @@ declare module 'stripe' {
interface Add {
discounts?: Array<Add.Discount>;

metadata?: Stripe.MetadataParam;

price: string;

quantity?: number;
Expand Down Expand Up @@ -1728,26 +1726,13 @@ declare module 'stripe' {

none?: Trial.None;

/**
* Details of a different price, quantity, or both, to bill your customer for during a paid trial.
*/
paid?: Trial.Paid;

type: Trial.Type;
type: 'free';
}

namespace Trial {
interface Free {}

interface None {}

interface Paid {
price?: string;

quantity?: number;
}

type Type = 'free' | 'none' | 'paid';
}
}

Expand All @@ -1758,8 +1743,6 @@ declare module 'stripe' {
interface Set {
discounts?: Array<Set.Discount>;

metadata?: Stripe.MetadataParam;

price: string;

quantity?: number;
Expand Down Expand Up @@ -1787,26 +1770,13 @@ declare module 'stripe' {

none?: Trial.None;

/**
* Details of a different price, quantity, or both, to bill your customer for during a paid trial.
*/
paid?: Trial.Paid;

type: Trial.Type;
type: 'free';
}

namespace Trial {
interface Free {}

interface None {}

interface Paid {
price?: string;

quantity?: number;
}

type Type = 'free' | 'none' | 'paid';
}
}

Expand Down
2 changes: 2 additions & 0 deletions types/2020-08-27; server_side_confirmation_beta=v1/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
///<reference path='./Prices.d.ts' />
///<reference path='./Products.d.ts' />
///<reference path='./PromotionCodes.d.ts' />
///<reference path='./QuotePhases.d.ts' />
///<reference path='./Quotes.d.ts' />
///<reference path='./Radar/EarlyFraudWarnings.d.ts' />
///<reference path='./Radar/ValueListItems.d.ts' />
Expand Down Expand Up @@ -179,6 +180,7 @@ declare module 'stripe' {
products: Stripe.ProductsResource;
promotionCodes: Stripe.PromotionCodesResource;
quotes: Stripe.QuotesResource;
quotePhases: Stripe.QuotePhasesResource;
refunds: Stripe.RefundsResource;
reviews: Stripe.ReviewsResource;
setupAttempts: Stripe.SetupAttemptsResource;
Expand Down

0 comments on commit 190184b

Please sign in to comment.