Skip to content

Commit

Permalink
Merge pull request #969 from stripe/remi/codegen-18be41c
Browse files Browse the repository at this point in the history
Multiple API changes
  • Loading branch information
remi-stripe authored Jul 29, 2020
2 parents 454169c + 8d7762b commit 86d8e04
Show file tree
Hide file tree
Showing 14 changed files with 317 additions and 69 deletions.
8 changes: 4 additions & 4 deletions types/2020-03-02/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,8 @@ declare module 'stripe' {
expand?: Array<string>;

/**
* A list of items the customer is purchasing. Use this parameter to pass one-time or recurring [prices](https://stripe.com/docs/api/prices).
* One-time prices in `subscription` mode will be on the initial invoice only.
* A list of items the customer is purchasing. Use this parameter to pass one-time or recurring [Prices](https://stripe.com/docs/api/prices).
* One-time Prices in `subscription` mode will be on the initial invoice only.
*
* There is a maximum of 100 line items, however it is recommended to
* consolidate line items if there are more than a few dozen.
Expand Down Expand Up @@ -741,12 +741,12 @@ declare module 'stripe' {
name?: string;

/**
* The ID of the price or plan object. One of `price`, `price_data` or `amount` is required.
* The ID of the [Price](https://stripe.com/docs/api/prices) or [Plan](https://stripe.com/docs/api/plans) object. One of `price`, `price_data` or `amount` is required.
*/
price?: string;

/**
* Data used to generate a new price object inline. One of `price`, `price_data` or `amount` is required.
* Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price`, `price_data` or `amount` is required.
*/
price_data?: LineItem.PriceData;

Expand Down
17 changes: 17 additions & 0 deletions types/2020-03-02/CreditNoteLineItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ declare module 'stripe' {
*/
discount_amount: number;

/**
* The amount of discount calculated per discount for this line item
*/
discount_amounts?: Array<CreditNoteLineItem.DiscountAmount>;

/**
* ID of the invoice line item being credited
*/
Expand Down Expand Up @@ -72,6 +77,18 @@ declare module 'stripe' {
}

namespace CreditNoteLineItem {
interface DiscountAmount {
/**
* The amount, in %s, of the discount.
*/
amount: number;

/**
* The discount that was applied to get this discount amount.
*/
discount: string | Stripe.Discount | Stripe.DeletedDiscount;
}

interface TaxAmount {
/**
* The amount, in %s, of the tax.
Expand Down
17 changes: 17 additions & 0 deletions types/2020-03-02/CreditNotes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ declare module 'stripe' {
*/
discount_amount: number;

/**
* The aggregate amounts calculated per discount for all line items.
*/
discount_amounts?: Array<CreditNote.DiscountAmount>;

/**
* ID of the invoice.
*/
Expand Down Expand Up @@ -130,6 +135,18 @@ declare module 'stripe' {
}

namespace CreditNote {
interface DiscountAmount {
/**
* The amount, in %s, of the discount.
*/
amount: number;

/**
* The discount that was applied to get this discount amount.
*/
discount: string | Stripe.Discount | Stripe.DeletedDiscount;
}

type Reason =
| 'duplicate'
| 'fraudulent'
Expand Down
30 changes: 30 additions & 0 deletions types/2020-03-02/Discounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ declare module 'stripe' {
* The Discount object.
*/
interface Discount {
/**
* The ID of the discount object. Discounts cannot be fetched by ID. Use `expand[]=discounts` in API calls to expand discount IDs in an array.
*/
id?: string;

/**
* String representing the object's type. Objects of the same type share the same value.
*/
Expand All @@ -29,6 +34,16 @@ declare module 'stripe' {
*/
end: number | null;

/**
* The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
*/
invoice?: string | null;

/**
* The invoice item `id` (or invoice line item `id` for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
*/
invoice_item?: string | null;

/**
* Date that the coupon was applied.
*/
Expand All @@ -44,6 +59,11 @@ declare module 'stripe' {
* The DeletedDiscount object.
*/
interface DeletedDiscount {
/**
* The ID of the discount object. Discounts cannot be fetched by ID. Use `expand[]=discounts` in API calls to expand discount IDs in an array.
*/
id?: string;

/**
* String representing the object's type. Objects of the same type share the same value.
*/
Expand All @@ -66,6 +86,16 @@ declare module 'stripe' {
*/
deleted: true;

/**
* The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
*/
invoice?: string | null;

/**
* The invoice item `id` (or invoice line item `id` for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
*/
invoice_item?: string | null;

/**
* Date that the coupon was applied.
*/
Expand Down
43 changes: 41 additions & 2 deletions types/2020-03-02/InvoiceItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ declare module 'stripe' {
*/
discountable: boolean;

/**
* The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
*/
discounts?: Array<string | Stripe.Discount> | null;

/**
* The ID of the invoice this invoice item belongs to.
*/
Expand Down Expand Up @@ -175,6 +180,11 @@ declare module 'stripe' {
*/
discountable?: boolean;

/**
* The coupons to redeem into discounts for the invoice item or invoice line item.
*/
discounts?: Array<InvoiceItemCreateParams.Discount> | null;

/**
* Specifies which fields in the response should be expanded.
*/
Expand All @@ -201,7 +211,7 @@ declare module 'stripe' {
price?: string;

/**
* Data used to generate a new price object inline.
* Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
*/
price_data?: InvoiceItemCreateParams.PriceData;

Expand Down Expand Up @@ -232,6 +242,18 @@ declare module 'stripe' {
}

namespace InvoiceItemCreateParams {
interface Discount {
/**
* ID of the coupon to create a new discount for.
*/
coupon?: string;

/**
* ID of an existing discount on the object (or one of its ancestors) to reuse.
*/
discount?: string;
}

interface Period {
/**
* The end of the period, which must be greater than or equal to the start.
Expand Down Expand Up @@ -290,6 +312,11 @@ declare module 'stripe' {
*/
discountable?: boolean;

/**
* The coupons & existing discounts which apply to the invoice item or invoice line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
*/
discounts?: Array<InvoiceItemUpdateParams.Discount> | null;

/**
* Specifies which fields in the response should be expanded.
*/
Expand All @@ -311,7 +338,7 @@ declare module 'stripe' {
price?: string;

/**
* Data used to generate a new price object inline.
* Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
*/
price_data?: InvoiceItemUpdateParams.PriceData;

Expand All @@ -337,6 +364,18 @@ declare module 'stripe' {
}

namespace InvoiceItemUpdateParams {
interface Discount {
/**
* ID of the coupon to create a new discount for.
*/
coupon?: string;

/**
* ID of an existing discount on the object (or one of its ancestors) to reuse.
*/
discount?: string;
}

interface Period {
/**
* The end of the period, which must be greater than or equal to the start.
Expand Down
57 changes: 55 additions & 2 deletions types/2020-03-02/InvoiceLineItems.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@ declare module 'stripe' {
*/
description: string | null;

/**
* The amount of discount calculated per discount for this line item.
*/
discount_amounts?: Array<InvoiceLineItem.DiscountAmount> | null;

/**
* If true, discounts will apply to this line item. Always false for prorations.
*/
discountable: boolean;

/**
* The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
*/
discounts?: Array<string | Stripe.Discount> | null;

/**
* The ID of the [invoice item](https://stripe.com/docs/api/invoiceitems) associated with this line item if any.
*/
Expand Down Expand Up @@ -104,6 +114,18 @@ declare module 'stripe' {
}

namespace InvoiceLineItem {
interface DiscountAmount {
/**
* The amount, in %s, of the discount.
*/
amount: number;

/**
* The discount that was applied to get this discount amount.
*/
discount: string | Stripe.Discount | Stripe.DeletedDiscount;
}

interface Period {
/**
* End of the line item's billing period
Expand Down Expand Up @@ -154,6 +176,8 @@ declare module 'stripe' {
*/
customer?: string;

discounts?: Array<InvoiceLineItemListUpcomingParams.Discount> | null;

/**
* Specifies which fields in the response should be expanded.
*/
Expand Down Expand Up @@ -249,6 +273,18 @@ declare module 'stripe' {
}

namespace InvoiceLineItemListUpcomingParams {
interface Discount {
/**
* ID of the coupon to create a new discount for.
*/
coupon?: string;

/**
* ID of an existing discount on the object (or one of its ancestors) to reuse.
*/
discount?: string;
}

interface InvoiceItem {
/**
* The integer amount in **%s** of previewed invoice item.
Expand All @@ -270,6 +306,11 @@ declare module 'stripe' {
*/
discountable?: boolean;

/**
* The coupons to redeem into discounts for the invoice item in the preview.
*/
discounts?: Array<InvoiceItem.Discount> | null;

/**
* The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice.
*/
Expand All @@ -291,7 +332,7 @@ declare module 'stripe' {
price?: string;

/**
* Data used to generate a new price object inline.
* Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
*/
price_data?: InvoiceItem.PriceData;

Expand All @@ -314,6 +355,18 @@ declare module 'stripe' {
}

namespace InvoiceItem {
interface Discount {
/**
* ID of the coupon to create a new discount for.
*/
coupon?: string;

/**
* ID of an existing discount on the object (or one of its ancestors) to reuse.
*/
discount?: string;
}

interface Period {
/**
* The end of the period, which must be greater than or equal to the start.
Expand Down Expand Up @@ -388,7 +441,7 @@ declare module 'stripe' {
price?: string;

/**
* Data used to generate a new price object inline.
* Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
*/
price_data?: SubscriptionItem.PriceData;

Expand Down
Loading

0 comments on commit 86d8e04

Please sign in to comment.