From 8223535354c4d92ae7b384e9d463b301da55dfc8 Mon Sep 17 00:00:00 2001 From: Hunter Tunnicliff Date: Thu, 14 Jun 2018 14:59:50 -0700 Subject: [PATCH] Added union type for Subscription to IInvoice.subscription --- types/stripe/index.d.ts | 13 +++++++------ types/stripe/stripe-tests.ts | 4 ++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 9cf60439c8..41bc3cd48b 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -9,6 +9,7 @@ // Kensuke Hoshikawa // Thomas Bruun // Gal Talmor +// Hunter Tunnicliff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -738,7 +739,7 @@ declare namespace Stripe { * charge if a partial refund was issued), positive integer or zero. */ amount_refunded: number; - + /** * ID of the Connect application that created the charge. [Expandable] */ @@ -1994,7 +1995,7 @@ declare namespace Stripe { /** * The subscription that this invoice was prepared for, if any. */ - subscription: string; + subscription: string | subscriptions.ISubscription; /** * Only set for upcoming invoices that preview prorations. The time used to calculate prorations. @@ -2302,7 +2303,7 @@ declare namespace Stripe { /** * The subscription that this invoice item has been created for, if any. */ - subscription: string; + subscription: string | subscriptions.ISubscription; } interface InvoiceItemCreationOptions extends IDataOptionsWithMetadata { @@ -2389,7 +2390,7 @@ declare namespace Stripe { * currency) representing the total amount for the order. */ amount: number; - + /** * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a 0-decimal * currency) representing the total amount returned for the order thus far. @@ -5033,7 +5034,7 @@ declare namespace Stripe { * String representing the object’s type. Objects of the same type share the same value. */ object: "review"; - + /** * The charge associated with this review. [Expandable] */ @@ -5073,7 +5074,7 @@ declare namespace Stripe { */ name: string; } - } + } class StripeResource { constructor(stripe: Stripe, urlData: any); diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 306ab0442a..ad5f1750fb 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1018,6 +1018,10 @@ stripe.invoices.list({ customer: "cus_5rfJKDJkuxzh5Q", limit: 3 }).then(function // asynchronously called }); +stripe.invoices.retrieve("in_15fvyXEe31JkLCeQH7QbgZZb", { expand: ["subscription"] }).then(function (invoice) { + invoice.subscription +}) + //#endregion //#region Invoice Items tests