/** * @packageDocumentation * @module api.functional.payments.internal * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ import type { IConnection, Primitive } from "@nestia/fetcher"; import { EncryptedFetcher } from "@nestia/fetcher/lib/EncryptedFetcher"; import typia from "typia"; import type { IPaymentWebhookHistory } from "../../../structures/payments/IPaymentWebhookHistory"; import { NestiaSimulator } from "../../../utils/NestiaSimulator"; /** * * @internal * * @controller PaymentInternalController.webhook * @path POST /payments/internal/webhook * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function webhook( connection: IConnection, input: webhook.Input, ): Promise { return !!connection.simulate ? webhook.simulate( connection, input, ) : EncryptedFetcher.fetch( { ...connection, headers: { ...(connection.headers ?? {}), "Content-Type": "text/plain", }, }, { ...webhook.METADATA, path: webhook.path(), } as const, input, ); } export namespace webhook { export type Input = Primitive; export const METADATA = { method: "POST", path: "/payments/internal/webhook", request: { type: "text/plain", encrypted: true }, response: { type: "text/plain", encrypted: true, }, status: null, } as const; export const path = (): string => { return `/payments/internal/webhook`; } export const simulate = async ( connection: IConnection, input: webhook.Input, ): Promise => { const assert = NestiaSimulator.assert({ method: METADATA.method, host: connection.host, path: path(), contentType: "text/plain", }); assert.body(() => typia.assert(input)); } }