@sahabaplus/moyasar
Version:
A comprehensive TypeScript SDK for integrating with the Moyasar payment gateway
36 lines • 1.21 kB
TypeScript
import type { WebhookPayload } from "./types";
export declare class WebhookUtils {
/**
* Verify webhook payload signature
*/
static verifyWebhookSignature(payload: {
secret_token: string;
}, options: {
secret_token: string;
}): Promise<boolean>;
/**
* Parse webhook payload safely
*/
static parseWebhookPayload(rawPayload: string | Buffer): WebhookPayload;
/**
* Validate webhook payload
*/
static validateWebhookPayload(payload: unknown): string[];
/**
* Extract signature from headers (common patterns)
*/
static extractSignatureFromHeaders(headers: Record<string, string | string[]>): string | null;
/**
* Create a consistent payload string for signature verification
*/
static createSignaturePayload(payload: WebhookPayload, timestamp?: number): string;
/**
* Get webhook event categories
*/
static getEventCategory(event: string): "payment" | "unknown";
/**
* Check if webhook should be retried based on response
*/
static shouldRetryWebhook(statusCode: number, retryCount: number, maxRetries?: number): boolean;
}
//# sourceMappingURL=utils.d.ts.map