Skip to content

Commit

Permalink
Codegen for openapi v163
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe committed Jul 7, 2022
1 parent d7ccbbb commit 79d89ec
Show file tree
Hide file tree
Showing 14 changed files with 712 additions and 43 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v162
v163
86 changes: 50 additions & 36 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,56 @@ describe('PaymentLink', function() {
});
});

describe('Price', function() {
it('create method', async function() {
const price = await stripe.prices.create({
unit_amount: 2000,
currency: 'usd',
currency_options: {
uah: {unit_amount: 5000},
eur: {unit_amount: 1800},
},
recurring: {interval: 'month'},
product: 'prod_xxxxxxxxxxxxx',
});
expect(price).not.to.be.null;
});

it('list method', async function() {
const prices = await stripe.prices.list({limit: 3});
expect(prices).not.to.be.null;
});

it('create method', async function() {
const price = await stripe.prices.create({
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
product: 'prod_xxxxxxxxxxxxx',
});
expect(price).not.to.be.null;
});

it('retrieve method', async function() {
const price = await stripe.prices.retrieve('price_xxxxxxxxxxxxx');
expect(price).not.to.be.null;
});

it('update method', async function() {
const price = await stripe.prices.update('price_xxxxxxxxxxxxx', {
metadata: {order_id: '6735'},
});
expect(price).not.to.be.null;
});

it('search method', async function() {
const prices = await stripe.prices.search({
query: "active:'true' AND metadata['order_id']:'6735'",
});
expect(prices).not.to.be.null;
});
});

describe('SetupAttempt', function() {
it('list method', async function() {
const setupAttempts = await stripe.setupAttempts.list({
Expand Down Expand Up @@ -2005,42 +2055,6 @@ describe('Plan', function() {
});
});

describe('Price', function() {
it('list method', async function() {
const prices = await stripe.prices.list({limit: 3});
expect(prices).not.to.be.null;
});

it('create method', async function() {
const price = await stripe.prices.create({
unit_amount: 2000,
currency: 'usd',
recurring: {interval: 'month'},
product: 'prod_xxxxxxxxxxxxx',
});
expect(price).not.to.be.null;
});

it('retrieve method', async function() {
const price = await stripe.prices.retrieve('price_xxxxxxxxxxxxx');
expect(price).not.to.be.null;
});

it('update method', async function() {
const price = await stripe.prices.update('price_xxxxxxxxxxxxx', {
metadata: {order_id: '6735'},
});
expect(price).not.to.be.null;
});

it('search method', async function() {
const prices = await stripe.prices.search({
query: "active:'true' AND metadata['order_id']:'6735'",
});
expect(prices).not.to.be.null;
});
});

describe('Product', function() {
it('list method', async function() {
const products = await stripe.products.list({limit: 3});
Expand Down
42 changes: 36 additions & 6 deletions types/2020-08-27/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,33 +303,33 @@ declare module 'stripe' {

interface CustomerDetails {
/**
* The customer's address at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022.
* The customer's address after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022.
*/
address: Stripe.Address | null;

/**
* The email associated with the Customer, if one exists, on the Checkout Session at the time of checkout or at time of session expiry.
* The email associated with the Customer, if one exists, on the Checkout Session after a completed Checkout Session or at time of session expiry.
* Otherwise, if the customer has consented to promotional content, this value is the most recent valid email provided by the customer on the Checkout form.
*/
email: string | null;

/**
* The customer's name at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022.
* The customer's name after a completed Checkout Session. Note: This property is populated only for sessions on or after March 30, 2022.
*/
name: string | null;

/**
* The customer's phone number at the time of checkout
* The customer's phone number after a completed Checkout Session.
*/
phone: string | null;

/**
* The customer's tax exempt status at time of checkout.
* The customer's tax exempt status after a completed Checkout Session.
*/
tax_exempt: CustomerDetails.TaxExempt | null;

/**
* The customer's tax IDs at time of checkout.
* The customer's tax IDs after a completed Checkout Session.
*/
tax_ids: Array<CustomerDetails.TaxId> | null;
}
Expand Down Expand Up @@ -1283,6 +1283,11 @@ declare module 'stripe' {
*/
consent_collection?: SessionCreateParams.ConsentCollection;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency?: string;

/**
* ID of an existing Customer, if one exists. In `payment` mode, the customer's most recent card
* payment method will be used to prefill the email, name, card details, and billing address
Expand Down Expand Up @@ -2792,6 +2797,31 @@ declare module 'stripe' {
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string;

/**
* Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: FixedAmount.CurrencyOptions;
};
}

namespace FixedAmount {
interface CurrencyOptions {
/**
* A non-negative integer in cents representing how much to charge.
*/
amount: number;

/**
* Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
*/
tax_behavior?: CurrencyOptions.TaxBehavior;
}

namespace CurrencyOptions {
type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
}
}

type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
Expand Down
44 changes: 44 additions & 0 deletions types/2020-08-27/Coupons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ declare module 'stripe' {
*/
currency: string | null;

/**
* Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: Coupon.CurrencyOptions;
};

deleted?: void;

/**
Expand Down Expand Up @@ -94,6 +101,13 @@ declare module 'stripe' {
products: Array<string>;
}

interface CurrencyOptions {
/**
* Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
*/
amount_off: number;
}

type Duration = 'forever' | 'once' | 'repeating';
}

Expand Down Expand Up @@ -133,6 +147,13 @@ declare module 'stripe' {
*/
currency?: string;

/**
* Coupons defined in each available currency option (only supported if `amount_off` is passed). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: CouponCreateParams.CurrencyOptions;
};

/**
* Specifies how long the discount will be in effect if used on a subscription. Can be `forever`, `once`, or `repeating`. Defaults to `once`.
*/
Expand Down Expand Up @@ -187,6 +208,13 @@ declare module 'stripe' {
products?: Array<string>;
}

interface CurrencyOptions {
/**
* A positive integer representing the amount to subtract from an invoice total.
*/
amount_off: number;
}

type Duration = 'forever' | 'once' | 'repeating';
}

Expand All @@ -198,6 +226,13 @@ declare module 'stripe' {
}

interface CouponUpdateParams {
/**
* Coupons defined in each available currency option (only supported if the coupon is amount-based). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: CouponUpdateParams.CurrencyOptions;
};

/**
* Specifies which fields in the response should be expanded.
*/
Expand All @@ -214,6 +249,15 @@ declare module 'stripe' {
name?: string;
}

namespace CouponUpdateParams {
interface CurrencyOptions {
/**
* A positive integer representing the amount to subtract from an invoice total.
*/
amount_off: number;
}
}

interface CouponListParams extends PaginationParams {
/**
* A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/InvoiceLineItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ declare module 'stripe' {
*/
coupon?: string;

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

/**
* The identifier of the customer whose upcoming invoice you'd like to retrieve.
*/
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 @@ -1768,6 +1768,11 @@ declare module 'stripe' {
*/
coupon?: string;

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

/**
* The identifier of the customer whose upcoming invoice you'd like to retrieve.
*/
Expand Down
50 changes: 50 additions & 0 deletions types/2020-08-27/Orders.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,31 @@ declare module 'stripe' {
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string;

/**
* Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: FixedAmount.CurrencyOptions;
};
}

namespace FixedAmount {
interface CurrencyOptions {
/**
* A non-negative integer in cents representing how much to charge.
*/
amount: number;

/**
* Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
*/
tax_behavior?: CurrencyOptions.TaxBehavior;
}

namespace CurrencyOptions {
type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
}
}

type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
Expand Down Expand Up @@ -2865,6 +2890,31 @@ declare module 'stripe' {
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
*/
currency: string;

/**
* Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
*/
currency_options?: {
[key: string]: FixedAmount.CurrencyOptions;
};
}

namespace FixedAmount {
interface CurrencyOptions {
/**
* A non-negative integer in cents representing how much to charge.
*/
amount: number;

/**
* Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
*/
tax_behavior?: CurrencyOptions.TaxBehavior;
}

namespace CurrencyOptions {
type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
}
}

type TaxBehavior = 'exclusive' | 'inclusive' | 'unspecified';
Expand Down
5 changes: 5 additions & 0 deletions types/2020-08-27/PaymentLinks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,11 @@ declare module 'stripe' {
*/
consent_collection?: PaymentLinkCreateParams.ConsentCollection;

/**
* Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies) and supported by each line item's price.
*/
currency?: string;

/**
* Configures whether [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link create a [Customer](https://stripe.com/docs/api/customers).
*/
Expand Down
Loading

0 comments on commit 79d89ec

Please sign in to comment.