mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
[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:
parent
e5f27c9255
commit
b648878245
11
types/stripe/index.d.ts
vendored
11
types/stripe/index.d.ts
vendored
@ -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';
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user