fake-toss-payments-server
Version:
Fake toss-payments server for testing
73 lines (68 loc) • 2.36 kB
text/typescript
/**
* @packageDocumentation
* @module api.functional.v1.billing.authorizations.card
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
//================================================================
import type { IConnection } from "@nestia/fetcher";
import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher";
import type { ITossBilling } from "../../../../../structures/ITossBilling";
/**
* 간편 결제 카드 등록하기.
*
* `billing.authorizations.card.create` 는 고객이 자신의 신록 카드를 서버에 등록해두고,
* 매번 결제가 필요할 때마다 카드 정보를 반복 입력하는 일 없이 간편하게 결제를
* 진행하고자 할 때, 호출되는 API 함수이다.
*
* 참고로 `billing.authorizations.card.create` 는 클라이언트 어플리케이션이 토스
* 페이먼츠가 제공하는 간편 결제 카드 등록 창을 사용하는 경우, 귀하의 백엔드 서버가 이를
* 실 서비스에서 호출하는 일은 없을 것이다. 다만, 고객이 간편 결제 카드를 등록하는
* 상황을 시뮬레이션하기 위하여, 테스트 자동화 프로그램 수준에서 사용될 수는 있다.
*
* @param input 간편 결제 카드 등록 정보
* @returns 간편 결제 카드 정보
* @security basic
* @author Samchon
*
* @controller FakeTossBillingController.create
* @path POST /v1/billing/authorizations/card
* @nestia Generated by Nestia - https://github.com/samchon/nestia
*/
export async function create(
connection: IConnection,
input: ITossBilling.ICreate,
): Promise<create.Output> {
return PlainFetcher.fetch(
{
...connection,
headers: {
...connection.headers,
"Content-Type": "application/json",
},
},
{
...create.METADATA,
template: create.METADATA.path,
path: create.path(),
},
input,
);
}
export namespace create {
export type Input = ITossBilling.ICreate;
export type Output = ITossBilling;
export const METADATA = {
method: "POST",
path: "/v1/billing/authorizations/card",
request: {
type: "application/json",
encrypted: false,
},
response: {
type: "application/json",
encrypted: false,
},
status: 201,
} as const;
export const path = () => "/v1/billing/authorizations/card";
}