[stripe] Add missing properties on StripeError (#39016)

* Remove seemingly unintentional property on StripeError

It looks like this was supposed to contain a property name after the readonly keywork, bu instead StripeError now has a property named readonly.

* Add missing properties to StripeError

All properties except statusCode were added in version 7.10.0: https://github.com/stripe/stripe-node/pull/699

* Update stripe version number
This commit is contained in:
Thomas Bruun 2019-10-14 19:54:12 +02:00 committed by Andrew Branch
parent e5f27c9255
commit b648878245
2 changed files with 33 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for stripe 6.32
// Type definitions for stripe 7.10
// Project: https://github.com/stripe/stripe-node/
// Definitions by: William Johnston <https://github.com/wjohnsto>
// Peter Harris <https://github.com/codeanimal>
@ -13900,9 +13900,16 @@ declare namespace Stripe {
};
readonly requestId: string;
readonly detail?: any;
readonly: number;
readonly params?: string;
readonly type: string;
readonly statusCode?: number;
readonly charge?: string;
readonly decline_code?: string;
readonly payment_intent?: paymentIntents.IPaymentIntent;
readonly payment_method?: paymentMethods.IPaymentMethod;
readonly setup_intent?: setupIntents.ISetupIntent;
readonly source?: sources.ISource;
}
class StripeCardError extends StripeError {
readonly type: 'StripeCardError';

View File

@ -2065,6 +2065,30 @@ stripe.charges
if (err instanceof Stripe.errors.StripeCardError) {
const type = err.type;
}
if (err instanceof Stripe.errors.StripeError) {
if (err.charge) {
const charge: string = err.charge;
}
if (err.payment_intent) {
const payment_intent: Stripe.paymentIntents.IPaymentIntent = err.payment_intent;
}
if (err.payment_method) {
const payment_method: Stripe.paymentMethods.IPaymentMethod = err.payment_method;
}
if (err.setup_intent) {
const setup_intent: Stripe.setupIntents.ISetupIntent = err.setup_intent;
}
if (err.source) {
const source: Stripe.sources.ISource = err.source;
}
if (err.decline_code) {
const decline_code: string = err.decline_code;
}
if (err.statusCode) {
const statusCode: number = err.statusCode;
}
}
});
//#endregion Errors