webhookHandler<Framework extends keyof frameworks>(tKassa: TKassa<any, any>,framework: Framework,): ReturnType<Record<"http"
| "std/http"
| "Bun.serve"
| "elysia"
| "fastify"
| "hono"
| "express"
| "koa", FrameworkAdapter>[Framework]> extends { response: () => any; } ? (...args: Parameters<(frameworks)[Framework]>) => ReturnType<ReturnType<(frameworks)[Framework]>["response"]> : (...args: Parameters<(frameworks)[Framework]>) => void
Функция, которая помогает зарегистрировать обработчик событий для подходящего вам фреймворка
▶Example 1
Example 1
import { Hono } from "hono"; import { TKassa, webhookHandler, filters } from "t-kassa-api"; const ткасса = new TKassa(process.env.TERMINAL_KEY, process.env.PASSWORD); ткасса.on( filters.and( filters.equal("Status", "SUCCESS"), filters.notNullable("RebillId") ), (context) => { // при этом типы понимают фильтры } ); const app = new Hono(); app.get("/", webhookHandler("hono"));
ReturnType<Record<"http"
| "std/http"
| "Bun.serve"
| "elysia"
| "fastify"
| "hono"
| "express"
| "koa", FrameworkAdapter>[Framework]> extends { response: () => any; } ? (...args: Parameters<(frameworks)[Framework]>) => ReturnType<ReturnType<(frameworks)[Framework]>["response"]> : (...args: Parameters<(frameworks)[Framework]>) => void