UNPKG

@battle-racing/br-common-lib

Version:

Common library for all Battle Racing Repositorios

29 lines (24 loc) 861 B
import { z } from 'zod'; import { paymentProviderDataSchema, paymentProviderNameSchema, paymentStatusSchema } from './Payment.schema'; export type PaymentProviderName = z.infer<typeof paymentProviderNameSchema>; export type PaymentStatus = z.infer<typeof paymentStatusSchema>; export type PaymentProviderData = z.infer<typeof paymentProviderDataSchema>; /** * @deprecated * TODO: REMOVE THIS INTERFACE, move it to the backend * Strategy interface for payment providers */ export interface PaymentProvider { /** * Confirm and validate a purchase from webhook payload */ confirmPurchase(payload: any, signature?: string): Promise<PaymentProviderData>; /** * Validate webhook signature if provided */ validateWebhookSignature?(payload: any, signature: string): boolean; /** * Get provider name */ getProviderName(): string; }