Add invoices.finalizeInvoice to Stripe (#36513)

This commit is contained in:
Oleg Vaskevich
2019-07-03 09:58:09 -07:00
committed by Ryan Cavanaugh
parent 9e5612e7f0
commit 63543d82a7
2 changed files with 33 additions and 0 deletions
+25
View File
@@ -3110,6 +3110,16 @@ declare namespace Stripe {
tax_percent?: number;
}
interface IInvoiceFinalizeOptions extends IDataOptions {
/**
* Controls whether Stripe will perform
* [automatic collection](https://stripe.com/docs/billing/invoices/workflow/#auto_advance)
* of the invoice. When `false`, the invoice’s state will not automatically advance
* without an explicit action.
*/
auto_advance: boolean;
}
interface IInvoicePayOptions extends IDataOptionsWithMetadata {
/**
* A payment source to be charged. The source must be the ID of a source
@@ -8385,6 +8395,21 @@ declare namespace Stripe {
update(id: string, data: invoices.IInvoiceUpdateOptions, options: HeaderOptions, response?: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
update(id: string, data: invoices.IInvoiceUpdateOptions, response?: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
/**
* Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if
* you’d like to finalize a draft invoice manually, you can do so using this method.
*
* @returns Returns the invoice object.
*
* @param id The ID of the invoice to pay.
* @param data Additional arguments.
*/
finalizeInvoice(id: string, data: invoices.IInvoiceFinalizeOptions, options: HeaderOptions, response?: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
finalizeInvoice(id: string, data: invoices.IInvoiceFinalizeOptions, response: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
finalizeInvoice(id: string, data: invoices.IInvoiceFinalizeOptions): Promise<invoices.IInvoice>;
finalizeInvoice(id: string, options: HeaderOptions, response?: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
finalizeInvoice(id: string, response?: IResponseFn<invoices.IInvoice>): Promise<invoices.IInvoice>;
/**
* Stripe automatically creates and then attempts to pay invoices for customers on subscriptions. We'll also retry unpaid
* invoices according to your retry settings. However, if you'd like to attempt to collect payment on an invoice out of the
+8
View File
@@ -1246,6 +1246,14 @@ stripe.invoices.pay("in_15fvyXEe31JkLCeQH7QbgZZb", { forgive: true }).then((invo
// asynchronously called
});
stripe.invoices.finalizeInvoice("in_15fvyXEe31JkLCeQH7QbgZZb").then(invoice => {
invoice; // $ExpectType IInvoice
});
stripe.invoices.finalizeInvoice("in_15fvyXEe31JkLCeQH7QbgZZb", { auto_advance: true }).then(invoice => {
invoice; // $ExpectType IInvoice
});
stripe.invoices.list(
{ customer: "cus_5rfJKDJkuxzh5Q", limit: 3 },
(err, invoices) => {