mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-06 10:10:08 +00:00
Added stripe.webhooks.generateTestHeaderString (#40292)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
087ed675db
commit
cd9b92d298
32
types/stripe/index.d.ts
vendored
32
types/stripe/index.d.ts
vendored
@@ -13888,6 +13888,38 @@ declare namespace Stripe {
|
||||
endpointSecret: string,
|
||||
tolerance?: number,
|
||||
): events.IEvent;
|
||||
|
||||
/**
|
||||
* Generates a header to be used for webhook mocking
|
||||
*/
|
||||
generateTestHeaderString(options: IWebHookGenerateTestHeaderStringOptions): string;
|
||||
}
|
||||
|
||||
interface IWebHookGenerateTestHeaderStringOptions {
|
||||
/**
|
||||
* Timestamp of the header. Defaults to Date.now()
|
||||
*/
|
||||
timestamp?: number;
|
||||
|
||||
/**
|
||||
* JSON stringified payload object, containing the 'id' and 'object' parameters
|
||||
*/
|
||||
payload?: string;
|
||||
|
||||
/**
|
||||
* Stripe webhook secret 'whsec_...'
|
||||
*/
|
||||
secret?: string;
|
||||
|
||||
/**
|
||||
* Version of API to hit. Defaults to 'v1'.
|
||||
*/
|
||||
scheme?: string;
|
||||
|
||||
/**
|
||||
* Computed webhook signature
|
||||
*/
|
||||
signature?: string;
|
||||
}
|
||||
|
||||
class EphemeralKeys {
|
||||
|
||||
@@ -1488,6 +1488,11 @@ const event: Stripe.events.IEvent = stripe.webhooks.constructEvent(
|
||||
webhookSecret,
|
||||
);
|
||||
|
||||
const header: string = stripe.webhooks.generateTestHeaderString({
|
||||
payload: JSON.stringify(event),
|
||||
secret: webhookSecret,
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Coupons tests
|
||||
|
||||
Reference in New Issue
Block a user