/** * @packageDocumentation * @module api.functional.payments.webhooks * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ import type { IConnection, Primitive } from "@nestia/fetcher"; import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import type { IIamportPayment } from "iamport-server-api/lib/structures/IIamportPayment"; import type { ITossPaymentWebhook } from "toss-payments-server-api/lib/structures/ITossPaymentWebhook"; import typia from "typia"; import { NestiaSimulator } from "../../../utils/NestiaSimulator"; /** * * @danger * * @controller PaymentWebhooksController.iamport * @path POST /payments/webhooks/iamport * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function iamport( connection: IConnection, input: iamport.Input, ): Promise { return !!connection.simulate ? iamport.simulate( connection, input, ) : PlainFetcher.fetch( { ...connection, headers: { ...(connection.headers ?? {}), "Content-Type": "application/json", }, }, { ...iamport.METADATA, path: iamport.path(), } as const, input, ); } export namespace iamport { export type Input = Primitive; export const METADATA = { method: "POST", path: "/payments/webhooks/iamport", request: { type: "application/json", encrypted: false }, response: { type: "application/json", encrypted: false, }, status: null, } as const; export const path = (): string => { return `/payments/webhooks/iamport`; } export const simulate = async ( connection: IConnection, input: iamport.Input, ): Promise => { const assert = NestiaSimulator.assert({ method: METADATA.method, host: connection.host, path: path(), contentType: "application/json", }); assert.body(() => typia.assert(input)); } } /** * * @internal * * @controller PaymentWebhooksController.toss * @path POST /payments/webhooks/toss * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function toss( connection: IConnection, input: toss.Input, ): Promise { return !!connection.simulate ? toss.simulate( connection, input, ) : PlainFetcher.fetch( { ...connection, headers: { ...(connection.headers ?? {}), "Content-Type": "application/json", }, }, { ...toss.METADATA, path: toss.path(), } as const, input, ); } export namespace toss { export type Input = Primitive; export const METADATA = { method: "POST", path: "/payments/webhooks/toss", request: { type: "application/json", encrypted: false }, response: { type: "application/json", encrypted: false, }, status: null, } as const; export const path = (): string => { return `/payments/webhooks/toss`; } export const simulate = async ( connection: IConnection, input: toss.Input, ): Promise => { const assert = NestiaSimulator.assert({ method: METADATA.method, host: connection.host, path: path(), contentType: "application/json", }); assert.body(() => typia.assert(input)); } }