Stripe: Update Invoice properties to match version 2019-03-14 (#34597)

* Change application_fee to application_fee_amount

On API version 2019-03-14, the application_fee parameter on invoice API methods and the application_fee field on the invoice object have both been renamed to application_fee_amount.

Documentation: https://stripe.com/docs/api/invoices/object#invoice_object-application_fee_amount

* Break lines on column 100

* Add created property

Version 2019-03-14: The date property has been renamed to created.
https://stripe.com/docs/api/invoices/object#invoice_object-created

* Add custom_fields

https://stripe.com/docs/api/invoices/object#invoice_object-custom_fields

Add custom fields type definition

https://stripe.com/docs/api/invoices/object#invoice_object-custom_fields

* Customer is expandable

https://stripe.com/docs/api/invoices/object#invoice_object-customer

* Add default_source

https://stripe.com/docs/api/invoices/object#invoice_object-default_source

* Add footer property to invoice

https://stripe.com/docs/api/invoices/object#invoice_object-footer

* Add status and status_transitions

https://stripe.com/docs/api/invoices/object#invoice_object-status

* Add threshold_reason property

https://stripe.com/docs/api/invoices/object#invoice_object-threshold_reason

* Remove unnecessary qualifiers

* Update tests to use latest stripe api version

* Revert "Update tests to use latest stripe api version"

This reverts commit 83fbc3b90475328d458ceb99b7ca64d9d89e8542.

* Instead of replacing application_fee, add the new name

* Add a @deprecated message on old property
This commit is contained in:
Raúl Acuña
2019-04-25 17:57:31 -07:00
committed by Pranav Senthilnathan
parent 32cd2e644a
commit 046f80013c
+122 -9
View File
@@ -1971,9 +1971,20 @@ declare namespace Stripe {
/**
* The fee in cents that will be applied to the invoice and transferred to the application owner's
* Stripe account when the invoice is paid.
*
* @deprecated Stripe API Version 2019-03-14 changed the name of this property
* @see application_fee_amount
*/
application_fee: number;
/**
* The fee in pence that will be applied to the invoice and transferred to the application owner’s
* Stripe account when the invoice is paid.
*
* @since Stripe API Version 2019-03-14
*/
application_fee_amount: number;
/**
* Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any
* payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt
@@ -1997,12 +2008,24 @@ declare namespace Stripe {
auto_advance: boolean;
/**
* Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
* Either `charge_automatically`, or `send_invoice`. When charging automatically,
* Stripe will attempt to pay this invoice using the default source attached to the
* customer. When sending an invoice, Stripe will email this invoice to the customer
* with payment instructions.
*/
billing: "charge_automatically" | "send_invoice";
/**
* Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to creating or updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached.
* Indicates the reason why the invoice was created. `subscription_cycle` indicates an
* invoice created by a subscription advancing into a new period.
* `subscription_create` indicates an invoice created due to creating a subscription.
* `subscription_update` indicates an invoice created due to creating or updating a
* subscription. `subscription` is set for all old invoices to indicate either a change
* to a subscription or a period advancement. `manual` is set for all invoices
* unrelated to a subscription (for example: created via the invoice editor). The
* `upcoming` value is reserved for simulated invoices per the upcoming invoice
* endpoint. `subscription_threshold` indicates an invoice created due to a billing
* threshold being reached.
*/
billing_reason: "subscription_cycle" | "subscription_create" | "subscription_update" | "subscription" | "manual" | "upcoming" | "subscription_threshold";
@@ -2017,27 +2040,46 @@ declare namespace Stripe {
*/
closed: boolean;
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number;
/**
* Three-letter ISO currency code, in lowercase. Must be a supported currency.
*/
currency: string;
customer: string;
/**
* Custom fields displayed on the invoice.
*/
custom_fields: ICustomField[];
customer: string | customers.ICustomer;
/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
date: number;
/**
* ID of the default payment source for the invoice. It must belong to the customer
* associated with the invoice and be in a chargeable state. If not set, defaults to
* the subscription’s default source, if any, or to the customer’s default source.
*/
default_source: string;
/**
* An arbitrary string attached to the object. Often useful for displaying to users.
* Referenced as ‘memo’ in the Dashboard.
*/
description: string;
discount: coupons.IDiscount | null;
/**
* The date on which payment for this invoice is due. This value will be null for invoices where billing=charge_automatically.
* The date on which payment for this invoice is due. This value will be `null` for
* invoices where `billing=charge_automatically`.
*/
due_date: number | null;
@@ -2055,19 +2097,27 @@ declare namespace Stripe {
forgiven: boolean;
/**
* The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been frozen yet, this will be null.
* Footer displayed on the invoice.
*/
footer: string;
/**
* The URL for the hosted invoice page, which allows customers to view and pay an
* invoice. If the invoice has not been finalized yet, this will be null.
*/
hosted_invoice_url: string | null;
/**
* The link to download the PDF for the invoice. If the invoice has not been frozen yet, this will be null.
* The link to download the PDF for the invoice. If the invoice has not been finalized
* yet, this will be null.
*/
invoice_pdf: string | null;
/**
* The individual line items that make up the invoice.
*
* lines is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
* `lines` is sorted as follows: invoice items in reverse chronological order, followed
* by the subscription, if any.
*/
lines: IList<IInvoiceLineItem>;
@@ -2124,9 +2174,14 @@ declare namespace Stripe {
statement_descriptor: string;
/**
* The status of the invoice, one of draft, open, paid, uncollectible, or void.
* The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`.
*/
status: string;
status: "draft" | "open" | "paid" | "uncollectible" | "void";
/**
* Contains the timestamps when an invoice was finalized, paid, marked uncollectible, or voided
*/
status_transitions: IStatusTransitions;
/**
* The subscription that this invoice was prepared for, if any.
@@ -2156,6 +2211,12 @@ declare namespace Stripe {
*/
tax_percent: number | null;
/**
* If `billing_reason` is set to `subscription_threshold` this returns more information
* on which threshold rules triggered the invoice.
*/
threshold_reason: IThresholdReason;
/**
* Total after discount
*/
@@ -2535,6 +2596,58 @@ declare namespace Stripe {
*/
end: number;
}
interface ICustomField {
/**
* The name of the custom field.
*/
name: string;
/**
* The value of the custom field.
*/
value: string;
}
interface IStatusTransitions {
/**
* The time that the invoice draft was finalized.
*/
finalized_at: number;
/**
* The time that the invoice was marked uncollectible.
*/
marked_uncollectible_at: number;
/**
* The time that the invoice was paid.
*/
paid_at: number;
/**
* The time that the invoice was voided.
*/
voided_at: number;
}
interface IThresholdReason {
/**
* The total invoice amount threshold boundary if it triggered the threshold invoice.
*/
amount_gte: number;
/**
* Indicates which line items triggered a threshold invoice.
*/
item_reasons: IItemReason[];
}
interface IItemReason {
/**
* The IDs of the line items that triggered the threshold invoice.
*/
line_item_ids: string[];
/**
* The quantity threshold boundary that applied to the given line item.
*/
usage_gte: number;
}
}
namespace invoiceItems {