Merge pull request #31498 from SimonSchick/feat/stripe-errors

feat(stripe): add errors
This commit is contained in:
Nathan Shively-Sanders
2018-12-18 14:15:50 -08:00
committed by GitHub
3 changed files with 421 additions and 478 deletions
+141 -108
View File
@@ -1,4 +1,4 @@
// Type definitions for stripe 6.0.0
// Type definitions for stripe 6.18
// Project: https://github.com/stripe/stripe-node/
// Definitions by: William Johnston <https://github.com/wjohnsto>
// Peter Harris <https://github.com/codeanimal>
@@ -13,6 +13,7 @@
// Tyler Jones <https://github.com/squirly>
// Troy Zarger <https://github.com/tzarger>
// Ifiok Jr. <https://github.com/ifiokjr>
// Simon Schick <https://github.com/SimonSchick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -76,8 +77,6 @@ declare class Stripe {
usageRecords: Stripe.resources.UsageRecords;
usageRecordSummarys: Stripe.resources.UsageRecordSummarys;
setHost(host: string): void;
setHost(host: string, port: string|number): void;
setHost(host: string, port: string|number, protocol: string): void;
@@ -161,8 +160,8 @@ declare namespace Stripe {
* standing. Nested fields are separated by "." (for example,
* "legal_entity.first_name").
*/
fields_needed: Array<string>;
}
fields_needed: string[];
};
}
interface IAccountCreationOptions extends IAccountUpdateOptions {
@@ -262,7 +261,7 @@ declare namespace Stripe {
* Information about the holder of this account, i.e. the user receiving funds
* from this account
*/
legal_entity?: {}; //TODO: Implement this type definition.
legal_entity?: {}; // TODO: Implement this type definition.
/**
* A set of key/value pairs that you can attach to an account object. It can be
@@ -356,7 +355,7 @@ declare namespace Stripe {
* ‘tuesday’, etc. Required and available only if interval is weekly.
*/
weekly_anchor?: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
}
};
/**
* The text that appears on the bank account statement for payouts.
@@ -421,7 +420,7 @@ declare namespace Stripe {
* required.
*/
routing_number?: string;
}
};
}
interface IExternalAccountCreationOptions extends IDataOptionsWithMetadata {
@@ -449,11 +448,11 @@ declare namespace Stripe {
}
interface IBankAccountListOptions extends IListOptions {
object: "bank_account"
object: "bank_account";
}
interface ICardListOptions extends IListOptions {
object: "card"
object: "card";
}
interface IRejectReason {
@@ -541,7 +540,7 @@ declare namespace Stripe {
/**
* Value is "fee_refund"
*/
object:string;
object: string;
/**
* Amount, in cents/pence.
@@ -597,7 +596,7 @@ declare namespace Stripe {
* via the transfers API. The available balance for each currency and payment
* type can be found in the source_types property.
*/
available: Array<ISourceType>;
available: ISourceType[];
livemode: boolean;
@@ -606,7 +605,7 @@ declare namespace Stripe {
* cycle. The pending balance for each currency and payment type can be
* found in the source_types property
*/
pending: Array<ISourceType>;
pending: ISourceType[];
}
interface ISourceType {
@@ -617,7 +616,7 @@ declare namespace Stripe {
bitcoin_receiver?: number;
customer_bank_account?: number;
alipay_account?: number;
}
};
}
interface IBalanceTransaction extends IResourceObject {
@@ -735,7 +734,6 @@ declare namespace Stripe {
}
namespace charges {
/**
* To charge a credit or a debit card, you create a charge object. You can retrieve and refund individual
* charges as well as list all charges. Charges are identified by a unique random ID.
@@ -860,7 +858,7 @@ declare namespace Stripe {
* Details about whether the payment was accepted, and why. See
* understanding declines for details. [Expandable]
*/
outcome?: charges.IOutcome;
outcome?: IOutcome;
/**
* true if the charge succeeded, or was successfully authorized for later capture.
@@ -1093,7 +1091,7 @@ declare namespace Stripe {
* the user_report to fraudulent. Stripe will use the information you send to improve our fraud detection algorithm
*/
user_report?: "fraudulent" | "safe";
}
};
/**
* This is the email address that the receipt for this charge will be sent to.
@@ -1124,7 +1122,7 @@ declare namespace Stripe {
* "all", "alipay_account", "bitcoin_receiver", or "card".
*/
object: "all" | "alipay_account" | "bitcoin_receiver" | "card";
}
};
}
interface IOutcome {
@@ -1520,11 +1518,11 @@ declare namespace Stripe {
}
interface IBankAccountSourceListOptions extends IListOptions {
object: "bank_account"
object: "bank_account";
}
interface ICardSourceListOptions extends IListOptions {
object: "card"
object: "card";
}
}
@@ -1551,7 +1549,7 @@ declare namespace Stripe {
* List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your
* Stripe account as a result of this dispute.
*/
balance_transactions: Array<balance.IBalanceTransaction>;
balance_transactions: balance.IBalanceTransaction[];
/**
* ID of the charge that was disputed. [Expandable]
@@ -1777,7 +1775,7 @@ declare namespace Stripe {
/**
* Evidence to upload to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review.
*/
evidence?: disputes.IDisputeEvidence;
evidence?: IDisputeEvidence;
}
}
@@ -1807,9 +1805,6 @@ declare namespace Stripe {
*/
object: IObject;
/**
*
*/
previous_attributes?: {};
};
@@ -1888,7 +1883,7 @@ declare namespace Stripe {
data: string | Buffer;
name: string;
type: string | "application/octet-stream";
}
};
}
interface IFileUploadListOptions extends IListOptionsCreated {
@@ -2213,7 +2208,7 @@ declare namespace Stripe {
/**
* Extra information about a charge for the customer’s credit card statement.
*/
statement_descriptor?: string
statement_descriptor?: string;
/**
* The ID of the subscription to invoice. If not set, the created invoice will include all pending invoice items for
@@ -2252,7 +2247,7 @@ declare namespace Stripe {
/**
* Extra information about a charge for the customer’s credit card statement.
*/
statement_descriptor?: string
statement_descriptor?: string;
/**
* The percent tax rate applied to the invoice, represented as a decimal number.
@@ -2261,11 +2256,11 @@ declare namespace Stripe {
}
interface IInvoicePayOptions extends IDataOptionsWithMetadata {
/**
/**
* A payment source to be charged. The source must be the ID of a source
* belonging to the customer associated with the invoice being paid.
*/
source?: sources.ISourceCreationOptions;
source?: sources.ISourceCreationOptions;
}
interface IInvoiceListOptions extends IListOptions {
@@ -2377,7 +2372,7 @@ declare namespace Stripe {
/**
* If null, the invoice item is pending and will be included in the upcoming invoice.
*/
*/
invoice: string | null;
livemode: boolean;
metadata: IMetadata;
@@ -2530,7 +2525,7 @@ declare namespace Stripe {
/**
* List of items constituting the order.
*/
items: Array<IOrderItem>;
items: IOrderItem[];
livemode: boolean;
metadata: IMetadata;
@@ -2551,7 +2546,7 @@ declare namespace Stripe {
* A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or
* when paying it.
*/
shipping_methods: Array<IShippingMethod>;
shipping_methods: IShippingMethod[];
status: OrderStatus;
@@ -2634,7 +2629,7 @@ declare namespace Stripe {
/**
* List of items constituting the order.
*/
items?: Array<IOrderItemCreationHash>;
items?: IOrderItemCreationHash[];
/**
* Shipping address for the order. Required if any of the SKUs are for products that have shippable set to true.
@@ -2699,7 +2694,7 @@ declare namespace Stripe {
/**
* Only return orders with the given IDs
*/
ids?: Array<string>;
ids?: string[];
/**
* Only return orders that have the given status. One of "created", "paid", "fulfilled", or "refunded".
@@ -2733,7 +2728,7 @@ declare namespace Stripe {
* or it can be a dictionary with the following options:
*/
returned?: IDateFilter;
}
};
}
interface IOrderItemCreationHash {
@@ -3076,7 +3071,7 @@ declare namespace Stripe {
/**
* Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
*/
tiers: plans.ITier[] | null;
tiers: ITier[] | null;
/**
* Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.
@@ -3086,7 +3081,7 @@ declare namespace Stripe {
/**
* Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`.
*/
transform_usage: plans.ITransformUsage | null;
transform_usage: ITransformUsage | null;
/**
* Default number of trial days when subscribing a customer to this plan using `trial_from_plan=true`.
@@ -3162,7 +3157,7 @@ declare namespace Stripe {
/**
* Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
*/
tiers?: plans.ITier[];
tiers?: ITier[];
/**
* Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.
@@ -3172,7 +3167,7 @@ declare namespace Stripe {
/**
* Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`.
*/
transform_usage?: plans.ITransformUsage;
transform_usage?: ITransformUsage;
/**
* Default number of trial days when subscribing a customer to this plan using `trial_from_plan=true`.
@@ -3241,7 +3236,7 @@ declare namespace Stripe {
/**
* A list of up to 5 attributes that each SKU can provide values for (e.g. ["color", "size"]).
*/
attributes: Array<string>;
attributes: string[];
/**
* A short one-line description of the product, meant to be displayable to the customer.
@@ -3256,7 +3251,7 @@ declare namespace Stripe {
/**
* An array of connect application identifiers that cannot purchase this product.
*/
deactivated_on: Array<string>;
deactivated_on: string[];
/**
* The product’s description, meant to be displayable to the customer.
@@ -3266,7 +3261,7 @@ declare namespace Stripe {
/**
* A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
*/
images: Array<string>;
images: string[];
livemode: boolean;
metadata: IMetadata;
@@ -3336,7 +3331,7 @@ declare namespace Stripe {
* A list of up to 5 alphanumeric attributes that each SKU can provide values for (e.g. ["color", "size"]).
* Applicable to both service and good types.
*/
attributes?: Array<string>;
attributes?: string[];
/**
* A short one-line description of the product, meant to be displayable to the customer. May only be set if type=good.
@@ -3347,7 +3342,7 @@ declare namespace Stripe {
* An array of Connect application names or identifiers that should not be able to order the SKUs for this product.
* May only be set if type=good.
*/
deactivate_on?: Array<string>;
deactivate_on?: string[];
/**
* The product’s description, meant to be displayable to the customer. May only be set if type=good.
@@ -3357,7 +3352,7 @@ declare namespace Stripe {
/**
* A list of up to 8 URLs of images for this product, meant to be displayable to the customer. May only be set if type=good.
*/
images?: Array<string>;
images?: string[];
/**
* The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own
@@ -3400,7 +3395,7 @@ declare namespace Stripe {
* An array of Connect application names or identifiers that should not be able to order the SKUs for this product. This can be unset
* by updating the value to null and then saving.
*/
deactivate_on?: Array<string>;
deactivate_on?: string[];
/**
* The product’s description, meant to be displayable to the customer.
@@ -3411,7 +3406,7 @@ declare namespace Stripe {
* A list of up to 8 URLs of images for this product, meant to be displayable to the customer. This can be unset by updating the value to
* null and then saving.
*/
images?: Array<string>;
images?: string[];
/**
* The product’s name, meant to be displayable to the customer.
@@ -3452,7 +3447,7 @@ declare namespace Stripe {
/**
* Only return products with the given IDs.
*/
ids?: Array<string>;
ids?: string[];
/**
* Only return products that can be shipped (i.e., physical, not digital products).
@@ -3494,8 +3489,8 @@ declare namespace Stripe {
namespace recipientCards { }
namespace recipients {
// tslint:disable-next-line:no-empty-interface
interface IRecipient extends IResourceObject {
}
}
@@ -3642,7 +3637,7 @@ declare namespace Stripe {
/**
* Only return SKUs with the given IDs.
*/
ids?: Array<string>;
ids?: string[];
/**
* Only return SKUs that are either in stock or out of stock (e.g. pass false to list all SKUs that are out of stock).
@@ -3684,6 +3679,7 @@ declare namespace Stripe {
* If, for example, a product’s attributes are ["size", "gender"],
* a valid SKU has the following dictionary of attributes: {"size": "Medium", "gender": "Unisex"}.
*/
// tslint:disable-next-line:no-empty-interface
interface ISkuAttributes {}
}
@@ -3723,7 +3719,7 @@ declare namespace Stripe {
interface IEphemeralKey extends IResourceObject {
object: "ephemeral_key";
associated_objects: Array<IAssociatedObject>
associated_objects: IAssociatedObject[];
created: number;
expires: number;
livemode: boolean;
@@ -3816,7 +3812,7 @@ declare namespace Stripe {
* The personal_id_number for PII in string form.
*/
personal_id_number: string;
}
};
}
}
@@ -4929,7 +4925,7 @@ declare namespace Stripe {
/**
* Quantity for this item.
*/
quantity?: number
quantity?: number;
}
interface ISubscriptionUpdateItem {
@@ -4963,7 +4959,7 @@ declare namespace Stripe {
/**
* Quantity for this item.
*/
quantity?: number
quantity?: number;
}
}
@@ -5240,13 +5236,13 @@ declare namespace Stripe {
/**
* Currencies that can be accepted in the specified country (for payments).
*/
supported_payment_currencies: Array<string>;
supported_payment_currencies: string[];
/**
* Payment methods available in the specified country. You will need to enable bitcoin and ACH payments on your account for those methods to
* appear in this list. The stripe payment method refers to charging through your platform.
*/
supported_payment_methods: Array<string>;
supported_payment_methods: string[];
/**
* Lists the types of verification data needed to keep an account open. Includes 'minimum' fields, which every account must eventually
@@ -5254,14 +5250,14 @@ declare namespace Stripe {
*/
verification_fields: {
individual: {
minimum: Array<string>;
additional: Array<string>;
minimum: string[];
additional: string[];
},
company: {
minimum: Array<string>;
additional: Array<string>;
minimum: string[];
additional: string[];
}
}
};
}
}
@@ -5348,8 +5344,8 @@ declare namespace Stripe {
* starting after summary starting_after. Each entry in the array is a separate summary object.
* If no more summaries are available, the resulting array is empty.
*/
interface IUsageRecordSummarys extends IList<IUsageRecordSummarysItem>{
object: 'list'
interface IUsageRecordSummarys extends IList<IUsageRecordSummarysItem> {
object: 'list';
}
interface IUsageRecordSummarysItem {
@@ -5362,7 +5358,7 @@ declare namespace Stripe {
total_usage: number;
}
interface IUsageRecordSummarysListOptions extends IListOptions{
interface IUsageRecordSummarysListOptions extends IListOptions {
/**
* Only summary items for the given subscription item.
*/
@@ -5375,6 +5371,7 @@ declare namespace Stripe {
}
}
// tslint:disable-next-line:no-unnecessary-class
class StripeResource {
constructor(stripe: Stripe, urlData: any);
}
@@ -5620,7 +5617,6 @@ declare namespace Stripe {
retrieve(refundId: string, options: HeaderOptions, response?: IResponseFn<applicationFees.IApplicationFeeRefund>): Promise<applicationFees.IApplicationFeeRefund>;
retrieve(refundId: string, response?: IResponseFn<applicationFees.IApplicationFeeRefund>): Promise<applicationFees.IApplicationFeeRefund>;
/**
* Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left
* unchanged.
@@ -5670,17 +5666,16 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<bitcoinReceivers.IBitcoinReceiver>): Promise<bitcoinReceivers.IBitcoinReceiver>;
retrieve(id: string, response?: IResponseFn<bitcoinReceivers.IBitcoinReceiver>): Promise<bitcoinReceivers.IBitcoinReceiver>;
/**
* Returns a list of your receivers. Receivers are returned sorted by creation date, with the most recently created receivers appearing first.
*/
list(data: bitcoinReceivers.IBitcoinReceiverListOptions, options: HeaderOptions, response?: IResponseFn<IList<bitcoinReceivers.IBitcoinReceiver>>): Promise<IList<bitcoinReceivers.IBitcoinReceiver>>;
list(data: bitcoinReceivers.IBitcoinReceiverListOptions, response?: IResponseFn<IList<bitcoinReceivers.IBitcoinReceiver>>): Promise<IList<bitcoinReceivers.IBitcoinReceiver>>;
//update(id: string): void; // This does seem to be a method in the library (https://github.com/stripe/stripe-node/blob/master/lib/resources/BitcoinReceivers.js#L12), but isn't in the API documentation.
// update(id: string): void; // This does seem to be a method in the library (https://github.com/stripe/stripe-node/blob/master/lib/resources/BitcoinReceivers.js#L12), but isn't in the API documentation.
setMetadata(): void; //TODO: Implement placeholder method
getMetadata(): void; //TODO: Implement placeholder method
setMetadata(): void; // TODO: Implement placeholder method
getMetadata(): void; // TODO: Implement placeholder method
}
class Charges extends StripeResource {
@@ -5713,7 +5708,6 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<charges.ICharge>): Promise<charges.ICharge>;
retrieve(id: string, response?: IResponseFn<charges.ICharge>): Promise<charges.ICharge>;
/**
* Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
* This request accepts only the description, metadata, receipt_emailand fraud_details as arguments.
@@ -5848,7 +5842,6 @@ declare namespace Stripe {
retrieve?(id: string, options: HeaderOptions, response?: IResponseFn<refunds.IRefund>): Promise<refunds.IRefund>;
retrieve?(id: string, response?: IResponseFn<refunds.IRefund>): Promise<refunds.IRefund>;
/**
* Updates the specified refund by setting the values of the parameters passed.
* Any parameters not provided will be left unchanged.
@@ -5896,7 +5889,6 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<coupons.ICoupon>): Promise<coupons.ICoupon>;
retrieve(id: string, response?: IResponseFn<coupons.ICoupon>): Promise<coupons.ICoupon>;
/**
* Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
*
@@ -6084,8 +6076,6 @@ declare namespace Stripe {
del(id: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
del(id: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
/**
* When you create a new credit card, you must specify a customer or recipient to create it on. If the card's owner has no default card,
* then the new card will become the default. However, if the owner already has a default then it will not change. To change the default,
@@ -6165,7 +6155,6 @@ declare namespace Stripe {
listCards(customerId: string, options: HeaderOptions, response?: IResponseFn<IList<cards.ICard>>): Promise<IList<cards.ICard>>;
listCards(customerId: string, response?: IResponseFn<IList<cards.ICard>>): Promise<IList<cards.ICard>>;
/**
* When adding a card to a customer, the parameter name is source. When
* adding to an account, the parameter name is external_account. The
@@ -6279,7 +6268,6 @@ declare namespace Stripe {
deleteSource(customerId: string, sourceId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
deleteSource(customerId: string, sourceId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
/**
* A customer's bank account must first be verified before it can be charged. Stripe supports instant verification using Plaid for many of
* the most popular banks. If your customer's bank is not supported or you do not wish to integrate with Plaid, you must manually verify
@@ -6293,7 +6281,6 @@ declare namespace Stripe {
verifySource(customerId: string, sourceId: string, data: bankAccounts.IBankAccountVerifyOptions, options: HeaderOptions): Promise<bankAccounts.IBankAccount>;
verifySource(customerId: string, sourceId: string, data: bankAccounts.IBankAccountVerifyOptions): Promise<bankAccounts.IBankAccount>;
/**
* Creates a new subscription on an existing customer.
*
@@ -6386,7 +6373,6 @@ declare namespace Stripe {
listSubscriptions(customerId: string, options: HeaderOptions, response?: IResponseFn<IList<subscriptions.ISubscription>>): Promise<IList<subscriptions.ISubscription>>;
listSubscriptions(customerId: string, response?: IResponseFn<IList<subscriptions.ISubscription>>): Promise<IList<subscriptions.ISubscription>>;
/**
* Removes the currently applied discount on a customer.
*
@@ -6395,8 +6381,8 @@ declare namespace Stripe {
*
* @param customerId The ID of the customer.
*/
deleteDiscount(customerId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteDiscount(customerId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteDiscount(customerId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
deleteDiscount(customerId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
/**
* Removes the currently applied discount on a subscription.
@@ -6407,8 +6393,8 @@ declare namespace Stripe {
* @param customerId The ID of the customer.
* @param subscriptionId The ID of the subscription.
*/
deleteSubscriptionDiscount(customerId: string, subscriptionId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteSubscriptionDiscount(customerId: string, subscriptionId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteSubscriptionDiscount(customerId: string, subscriptionId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
deleteSubscriptionDiscount(customerId: string, subscriptionId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
}
class SubscriptionsBase extends StripeResource {
@@ -6496,8 +6482,8 @@ declare namespace Stripe {
*
* @param subscriptionId The ID of the subscription.
*/
deleteDiscount(subscriptionId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteDiscount(subscriptionId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;;
deleteDiscount(subscriptionId: string, options: HeaderOptions, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
deleteDiscount(subscriptionId: string, response?: IResponseFn<IDeleteConfirmation>): Promise<IDeleteConfirmation>;
}
class Subscriptions extends SubscriptionsBase {
@@ -6591,7 +6577,6 @@ declare namespace Stripe {
retrieve(disputeId: string, options: HeaderOptions, response?: IResponseFn<disputes.IDispute>): Promise<disputes.IDispute>;
retrieve(disputeId: string, response?: IResponseFn<disputes.IDispute>): Promise<disputes.IDispute>;
/**
* When you get a dispute, contacting your customer is always the best first step. If that doesn't work, you can submit evidence in
* order to help us resolve the dispute in your favor. You can do this in your dashboard, but if you prefer, you can use the API to
@@ -6623,8 +6608,8 @@ declare namespace Stripe {
list(options: HeaderOptions, response?: IResponseFn<IList<disputes.IDispute>>): Promise<IList<disputes.IDispute>>;
list(response?: IResponseFn<IList<disputes.IDispute>>): Promise<IList<disputes.IDispute>>;
setMetadata(): void; //TODO: Implement placeholder method
getMetadata(): void; //TODO: Implement placeholder method
setMetadata(): void; // TODO: Implement placeholder method
getMetadata(): void; // TODO: Implement placeholder method
}
class Events extends StripeResource {
@@ -6637,7 +6622,6 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<events.IEvent>): Promise<events.IEvent>;
retrieve(id: string, response?: IResponseFn<events.IEvent>): Promise<events.IEvent>;
/**
* List events, going back up to 30 days.
*/
@@ -6933,7 +6917,7 @@ declare namespace Stripe {
/**
* Only return plans for the given product.
*/
product?: string
product?: string;
}
/**
@@ -6956,7 +6940,7 @@ declare namespace Stripe {
* @deprecated
*/
retrieve(id: string): void;
//options: IDataOptions
// options: IDataOptions
/**
* @deprecated
*/
@@ -6983,7 +6967,7 @@ declare namespace Stripe {
* @deprecated
*/
retrieve(id: string): void;
//options: IDataOptions
// options: IDataOptions
/**
* @deprecated
*/
@@ -7015,7 +6999,6 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<refunds.IRefund>): Promise<refunds.IRefund>;
retrieve(id: string, response?: IResponseFn<refunds.IRefund>): Promise<refunds.IRefund>;
/**
* Updates the specified refund by setting the values of the parameters passed.
* Any parameters not provided will be left unchanged.
@@ -7068,7 +7051,6 @@ declare namespace Stripe {
retrieve(tokenId: string, data: IDataOptions, response?: IResponseFn<tokens.IToken>): Promise<tokens.IToken>;
retrieve(tokenId: string, options: HeaderOptions, response?: IResponseFn<tokens.IToken>): Promise<tokens.IToken>;
retrieve(tokenId: string, response?: IResponseFn<tokens.IToken>): Promise<tokens.IToken>;
}
class Transfers extends StripeResource {
@@ -7094,7 +7076,6 @@ declare namespace Stripe {
retrieve(id: string, options: HeaderOptions, response?: IResponseFn<transfers.ITransfer>): Promise<transfers.ITransfer>;
retrieve(id: string, response?: IResponseFn<transfers.ITransfer>): Promise<transfers.ITransfer>;
/**
* Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left
* unchanged.
@@ -7116,8 +7097,8 @@ declare namespace Stripe {
cancel(id: string, options: HeaderOptions, response?: IResponseFn<transfers.ITransfer>): Promise<transfers.ITransfer>;
cancel(id: string, response?: IResponseFn<transfers.ITransfer>): Promise<transfers.ITransfer>;
listTransactions(options: HeaderOptions, response?: IResponseFn<IList<charges.ICharge>>): Promise<IList<charges.ICharge>>; //TODO: Not sure if this should be a list of balance transactions or charges.
listTransactions(response?: IResponseFn<IList<charges.ICharge>>): Promise<IList<charges.ICharge>>; //TODO: Not sure if this should be a list of balance transactions or charges.
listTransactions(options: HeaderOptions, response?: IResponseFn<IList<charges.ICharge>>): Promise<IList<charges.ICharge>>; // TODO: Not sure if this should be a list of balance transactions or charges.
listTransactions(response?: IResponseFn<IList<charges.ICharge>>): Promise<IList<charges.ICharge>>; // TODO: Not sure if this should be a list of balance transactions or charges.
/**
* When you create a new reversal, you must specify a transfer to create it on.
@@ -7176,8 +7157,8 @@ declare namespace Stripe {
listReversals(transferId: string, options: HeaderOptions, response?: IResponseFn<IList<transferReversals.IReversal>>): Promise<IList<transferReversals.IReversal>>;
listReversals(transferId: string, response?: IResponseFn<IList<transferReversals.IReversal>>): Promise<IList<transferReversals.IReversal>>;
setMetadata(): void; //TODO: Implement placeholder method
getMetadata(): void; //TODO: Implement placeholder method
setMetadata(): void; // TODO: Implement placeholder method
getMetadata(): void; // TODO: Implement placeholder method
}
class TransferReversals extends StripeResource {
@@ -7364,7 +7345,7 @@ declare namespace Stripe {
}
class WebHooks {
constructEvent<T>(requestBody: any, signature: string | string[], endpointSecret: string, tolerance?: number): webhooks.StripeWebhookEvent<T>;
constructEvent(requestBody: any, signature: string | string[], endpointSecret: string, tolerance?: number): webhooks.StripeWebhookEvent<any>;
}
class EphemeralKeys {
@@ -7380,9 +7361,7 @@ declare namespace Stripe {
id: string;
}
interface IResponseFn<R> {
(err: IStripeError, value: R): void;
}
type IResponseFn<R> = (err: IStripeError, value: R) => void;
interface IDeleteConfirmation {
id: string;
@@ -7415,7 +7394,7 @@ declare namespace Stripe {
* Return values where the created field is before or equal to this timestamp.
*/
lte?: string;
}
};
/**
* A set of key/value pairs that you can attach to an object. It can be useful for storing
@@ -7491,7 +7470,6 @@ declare namespace Stripe {
tracking_number?: string;
}
interface IList<T> {
/**
* Value is 'list'
@@ -7501,7 +7479,7 @@ declare namespace Stripe {
/**
* An array containing the actual response elements, paginated by any request parameters.
*/
data: Array<T>;
data: T[];
/**
* Whether or not there are more elements available after this set. If false, this set comprises the end of the list.
@@ -7549,8 +7527,8 @@ declare namespace Stripe {
}
interface IDataOptions {
expand?: Array<string>;
include?: Array<string>;
expand?: string[];
include?: string[];
}
interface IDataOptionsWithMetadata extends IDataOptions {
@@ -7598,6 +7576,61 @@ declare namespace Stripe {
*/
type HeaderOptions = IHeaderOptions | string;
/**
* Contains all stripe error classes
*/
namespace errors {
class _Error extends Error {
readonly message: string;
}
namespace _Error {
}
type RawType = 'card_error' | 'invalid_request_error' | 'api_error' | 'idempotency_error';
abstract class StripeError extends _Error implements IStripeError {
static populate(type: RawType): StripeError;
readonly rawType: RawType;
readonly code?: string;
readonly raw: any;
readonly headers: {
[key: string]: string;
};
readonly requestId: string;
readonly detail?: any;
readonly: number;
readonly params?: string;
readonly type: string;
}
class StripeCardError extends StripeError {
readonly type: 'StripeCardError';
}
class StripeInvalidRequestError extends StripeError {
readonly type: 'StripeInvalidRequestError';
}
class StripeAPIError extends StripeError {
readonly type: 'StripeAPIError';
}
class StripeAuthenticationError extends StripeError {
readonly type: 'StripeAuthenticationError';
}
class StripePermissionError extends StripeError {
readonly type: 'StripePermissionError';
}
class StripeRateLimitError extends StripeError {
readonly type: 'StripeRateLimitError';
}
class StripeConnectionError extends StripeError {
readonly type: 'StripeConnectionError';
}
class StripeSignatureVerificationError extends StripeError {
readonly type: 'StripeSignatureVerificationError';
}
class StripeIdempotencyError extends StripeError {
readonly type: 'StripeIdempotencyError';
}
}
/**
* Stripe uses conventional HTTP response codes to indicate success or failure of an API request.
* In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that
File diff suppressed because it is too large Load Diff
+1 -73
View File
@@ -1,80 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-angle-bracket-type-assertion": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"unified-signatures": false
}
}