diff --git a/package.json b/package.json index b92d808..646d08b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fake-toss-payments-server", - "version": "1.4.0", + "version": "2.0.0", "description": "Fake toss-payments server for testing", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -40,7 +40,7 @@ "homepage": "https://github.com/samchon/fake-toss-payments-server", "devDependencies": { "@nestia/e2e": "^0.3.6", - "@nestia/sdk": "^1.6.5", + "@nestia/sdk": "^2.0.1", "@trivago/prettier-plugin-sort-imports": "^4.0.0", "@types/atob": "^2.1.2", "@types/btoa": "^1.2.3", @@ -51,7 +51,7 @@ "@typescript-eslint/parser": "^5.26.0", "cli": "^1.0.1", "copyfiles": "^2.4.1", - "nestia": "^4.4.0", + "nestia": "^4.5.0", "pm2": "^4.5.6", "prettier": "^2.6.2", "rimraf": "^3.0.2", @@ -62,13 +62,13 @@ "typescript-transform-paths": "^3.4.6" }, "dependencies": { - "@nestia/core": "^1.6.5", + "@nestia/core": "^2.0.1", "atob": "^2.1.2", "btoa": "^1.2.1", "serialize-error": "^4.1.0", "source-map-support": "^0.5.19", "tstl": "^2.5.13", - "typia": "^4.2.3", + "typia": "^5.0.2", "uuid": "^9.0.0" }, "keywords": [ diff --git a/packages/api/package.json b/packages/api/package.json index d6ca2c6..d0bf822 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "toss-payments-server-api", - "version": "1.4.0", + "version": "2.0.0", "description": "Toss Payments Server API", "main": "lib/index.js", "typings": "lib/index.d.ts", @@ -15,8 +15,8 @@ }, "homepage": "https://github.com/samchon/fake-toss-payments-server", "dependencies": { - "@nestia/fetcher": "^1.6.5", - "typia": "^4.2.3" + "@nestia/fetcher": "^2.0.1", + "typia": "^5.0.2" }, "keywords": [ "toss", diff --git a/packages/api/swagger.json b/packages/api/swagger.json index 0150373..b9280da 100644 --- a/packages/api/swagger.json +++ b/packages/api/swagger.json @@ -13,7 +13,7 @@ "info": { "title": "Toss Payments API", "description": "Built by [fake-toss-payments-server](https://github.com/samchon/fake-toss-payments-server) with [nestia](https://github.com/samchon/nestia)", - "version": "1.4.0", + "version": "2.0.0", "license": { "name": "MIT" } @@ -112,10 +112,10 @@ { "name": "billingKey", "in": "path", - "description": "대상 정보의 ", "schema": { "type": "string" }, + "description": "대상 정보의 ", "required": true } ], @@ -176,9 +176,9 @@ "text": "ITossBilling.billingKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossBilling.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossBilling.ts", "textSpan": { - "start": 467, + "start": 500, "length": 19 } } @@ -244,10 +244,10 @@ { "name": "billingKey", "in": "path", - "description": "간편 결제에 등록한 수단의 ", "schema": { "type": "string" }, + "description": "간편 결제에 등록한 수단의 ", "required": true } ], @@ -308,9 +308,9 @@ "text": "ITossBilling.billingKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossBilling.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossBilling.ts", "textSpan": { - "start": 467, + "start": 500, "length": 19 } } @@ -462,10 +462,10 @@ { "name": "receiptKey", "in": "path", - "description": "현금 영수증의 ", "schema": { "type": "string" }, + "description": "현금 영수증의 ", "required": true } ], @@ -526,9 +526,9 @@ "text": "ITossCashReceipt.receiptKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossCashReceipt.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossCashReceipt.ts", "textSpan": { - "start": 166, + "start": 199, "length": 19 } } @@ -650,10 +650,10 @@ { "name": "paymentKey", "in": "path", - "description": "대상 가상 계좌 결제 정보의 ", "schema": { "type": "string" }, + "description": "대상 가상 계좌 결제 정보의 ", "required": true } ], @@ -702,9 +702,9 @@ "text": "ITossPayment.paymentKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", "textSpan": { - "start": 2449, + "start": 2480, "length": 19 } } @@ -753,10 +753,10 @@ { "name": "paymentKey", "in": "path", - "description": "결제 정보의 ", "schema": { "type": "string" }, + "description": "결제 정보의 ", "required": true } ], @@ -800,9 +800,9 @@ "text": "ITossPayment.paymentKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", "textSpan": { - "start": 2449, + "start": 2480, "length": 19 } } @@ -840,10 +840,10 @@ { "name": "paymentKey", "in": "path", - "description": "대상 결제의 ", "schema": { "type": "string" }, + "description": "대상 결제의 ", "required": true } ], @@ -904,9 +904,9 @@ "text": "ITossPayment.paymentKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", "textSpan": { - "start": 2449, + "start": 2480, "length": 19 } } @@ -1058,10 +1058,10 @@ { "name": "paymentKey", "in": "path", - "description": "결제 정보의 ", "schema": { "type": "string" }, + "description": "결제 정보의 ", "required": true } ], @@ -1122,9 +1122,9 @@ "text": "ITossPayment.paymentKey", "kind": "linkName", "target": { - "fileName": "D:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", + "fileName": "C:/github/samchon/fake-toss-payments-server/src/api/structures/ITossPayment.ts", "textSpan": { - "start": 2449, + "start": 2480, "length": 19 } } @@ -1277,23 +1277,6 @@ "properties": { "cardNumber": { "description": "카드 번호.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "[0-9]{16}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "[0-9]{16}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1301,23 +1284,6 @@ }, "cardExpirationYear": { "description": "카드 만료 년도 (2 자리).", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "\\d{2}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "\\d{2}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1325,23 +1291,6 @@ }, "cardExpirationMonth": { "description": "카드 만료 월 (2 자리).", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "^(0[1-9]|1[012])$" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "^(0[1-9]|1[012])$", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1355,23 +1304,6 @@ }, "customerBirthday": { "description": "고객의 생년월일.\n\n표기 형식 YYMMDD.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1385,23 +1317,6 @@ }, "customerEmail": { "description": "고객의 이메일.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "email" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "email", - "kind": "text" - } - ] - } - ], "x-typia-required": false, "x-typia-optional": true, "type": "string", @@ -1491,23 +1406,6 @@ }, "cardNumber": { "description": "카드 번호.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "[0-9]{16}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "[0-9]{16}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1515,23 +1413,6 @@ }, "authenticatedAt": { "description": "인증 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1805,23 +1686,6 @@ }, "requestedAt": { "description": "결제 요청 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1829,23 +1693,6 @@ }, "approvedAt": { "description": "결제 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -1917,23 +1764,6 @@ }, "number": { "description": "카드 번호.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "[0-9]{16}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "[0-9]{16}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2002,23 +1832,6 @@ }, "receiptUrl": { "description": "영수증 URL.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "url" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "url", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2093,23 +1906,6 @@ }, "canceledAt": { "description": "취소 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2314,23 +2110,6 @@ }, "requestedAt": { "description": "결제 요청 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2338,23 +2117,6 @@ }, "approvedAt": { "description": "결제 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2567,23 +2329,6 @@ }, "requestedAt": { "description": "결제 요청 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2591,23 +2336,6 @@ }, "approvedAt": { "description": "결제 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2827,23 +2555,6 @@ }, "requestedAt": { "description": "결제 요청 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -2851,23 +2562,6 @@ }, "approvedAt": { "description": "결제 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3086,23 +2780,6 @@ }, "requestedAt": { "description": "결제 요청 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3110,23 +2787,6 @@ }, "approvedAt": { "description": "결제 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3219,23 +2879,6 @@ }, "dueDate": { "description": "입금 기한.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "date" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3289,7 +2932,14 @@ "type": "object", "properties": { "type": { - "$ref": "#/components/schemas/ITossCashReceipt.Type" + "description": "현금 영수증의 종류.", + "x-typia-required": true, + "x-typia-optional": false, + "type": "string", + "enum": [ + "소득공제", + "지출증빙" + ] }, "paymentKey": { "description": "귀속 결제의 {@link ITossPayment.paymentKey }.", @@ -3378,23 +3028,6 @@ }, "approvedAt": { "description": "현금 영수증 승인 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3402,23 +3035,6 @@ }, "canceledAt": { "description": "현금 영수증 취소 일시.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "datetime" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "date-time", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3555,23 +3171,6 @@ }, "cardNumber": { "description": "카드 번호.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "[0-9]{16}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "[0-9]{16}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3579,23 +3178,6 @@ }, "cardExpirationYear": { "description": "카드 만료 년도 (2 자리).", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "\\d{2}" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "\\d{2}", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3603,23 +3185,6 @@ }, "cardExpirationMonth": { "description": "카드 만료 월 (2 자리).", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "^(0[1-9]|1[012])$" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "^(0[1-9]|1[012])$", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", @@ -3663,23 +3228,6 @@ }, "customerBirthday": { "description": "고객의 생년월일.\n\n표기 형식 YYMMDD.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$", - "kind": "text" - } - ] - } - ], "x-typia-required": false, "x-typia-optional": true, "type": "string", @@ -3687,23 +3235,6 @@ }, "customerEmail": { "description": "고객의 이메일.", - "x-typia-metaTags": [ - { - "kind": "format", - "value": "email" - } - ], - "x-typia-jsDocTags": [ - { - "name": "format", - "text": [ - { - "text": "email", - "kind": "text" - } - ] - } - ], "x-typia-required": false, "x-typia-optional": true, "type": "string", @@ -3847,23 +3378,6 @@ }, "accountNumber": { "description": "계좌 번호.", - "x-typia-metaTags": [ - { - "kind": "pattern", - "value": "^[0-9]{0,20}$" - } - ], - "x-typia-jsDocTags": [ - { - "name": "pattern", - "text": [ - { - "text": "^[0-9]{0,20}$", - "kind": "text" - } - ] - } - ], "x-typia-required": true, "x-typia-optional": false, "type": "string", diff --git a/src/api/functional/internal/index.ts b/src/api/functional/internal/index.ts index 59a4c72..069c56b 100644 --- a/src/api/functional/internal/index.ts +++ b/src/api/functional/internal/index.ts @@ -4,13 +4,13 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../utils/NestiaSimulator"; -import type { ITossPaymentWebhook } from "./../../structures/ITossPaymentWebhook"; -import type { ITossPayment } from "./../../structures/ITossPayment"; +import type { ITossPayment } from "../../structures/ITossPayment"; +import type { ITossPaymentWebhook } from "../../structures/ITossPaymentWebhook"; +import { NestiaSimulator } from "../../utils/NestiaSimulator"; /** * 웹훅 이벤트 더미 리스너. @@ -27,7 +27,7 @@ import type { ITossPayment } from "./../../structures/ITossPayment"; * @param input 웹훅 이벤트 정보 * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossInternalController.webhook() + * @controller [object Object] * @path POST /internal/webhook * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -40,7 +40,7 @@ export async function webhook( connection, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -48,21 +48,29 @@ export async function webhook( "Content-Type": "application/json", }, }, - webhook.ENCRYPTED, - webhook.METHOD, - webhook.path(), + { + ...webhook.METADATA, + path: webhook.path(), + } as const, input, ); } export namespace webhook { export type Input = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/internal/webhook"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/internal/webhook", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (): string => { return `/internal/webhook`; @@ -72,9 +80,10 @@ export namespace webhook { input: webhook.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path() + path: path(), + contentType: "application/json", }); assert.body(() => typia.assert(input)); } @@ -96,7 +105,7 @@ export namespace webhook { * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossInternalController.deposit() + * @controller [object Object] * @path GET /internal/:paymentKey/deposit * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -109,38 +118,44 @@ export async function deposit( connection, paymentKey, ) - : Fetcher.fetch( + : PlainFetcher.fetch( connection, - deposit.ENCRYPTED, - deposit.METHOD, - deposit.path(paymentKey), + { + ...deposit.METADATA, + path: deposit.path(paymentKey), + } as const, ); } export namespace deposit { export type Output = Primitive; - export const METHOD = "GET" as const; - export const PATH: string = "/internal/:paymentKey/deposit"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "GET", + path: "/internal/:paymentKey/deposit", + request: null, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (paymentKey: string): string => { return `/internal/${encodeURIComponent(paymentKey ?? "null")}/deposit`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, paymentKey: string, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(paymentKey) + path: path(paymentKey), + contentType: "application/json", }); - assert.param("paymentKey")("string")(() => typia.assert(paymentKey)); + assert.param("paymentKey")(() => typia.assert(paymentKey)); return random( typeof connection.simulate === 'object' && connection.simulate !== null diff --git a/src/api/functional/v1/billing/authorizations/card/index.ts b/src/api/functional/v1/billing/authorizations/card/index.ts index 793fcce..7ad9356 100644 --- a/src/api/functional/v1/billing/authorizations/card/index.ts +++ b/src/api/functional/v1/billing/authorizations/card/index.ts @@ -4,12 +4,12 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../../../utils/NestiaSimulator"; -import type { ITossBilling } from "./../../../../../structures/ITossBilling"; +import type { ITossBilling } from "../../../../../structures/ITossBilling"; +import { NestiaSimulator } from "../../../../../utils/NestiaSimulator"; /** * 간편 결제 카드 등록하기. @@ -28,7 +28,7 @@ import type { ITossBilling } from "./../../../../../structures/ITossBilling"; * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossBillingController.store() + * @controller [object Object] * @path POST /v1/billing/authorizations/card * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -41,7 +41,7 @@ export async function store( connection, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -49,9 +49,10 @@ export async function store( "Content-Type": "application/json", }, }, - store.ENCRYPTED, - store.METHOD, - store.path(), + { + ...store.METADATA, + path: store.path(), + } as const, input, ); } @@ -59,26 +60,34 @@ export namespace store { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/billing/authorizations/card"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/billing/authorizations/card", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (): string => { return `/v1/billing/authorizations/card`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, input: store.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path() + path: path(), + contentType: "application/json", }); assert.body(() => typia.assert(input)); return random( diff --git a/src/api/functional/v1/billing/authorizations/index.ts b/src/api/functional/v1/billing/authorizations/index.ts index 7be546f..b70b4d2 100644 --- a/src/api/functional/v1/billing/authorizations/index.ts +++ b/src/api/functional/v1/billing/authorizations/index.ts @@ -4,12 +4,12 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../../utils/NestiaSimulator"; -import type { ITossBilling } from "./../../../../structures/ITossBilling"; +import type { ITossBilling } from "../../../../structures/ITossBilling"; +import { NestiaSimulator } from "../../../../utils/NestiaSimulator"; export * as card from "./card"; @@ -29,7 +29,7 @@ export * as card from "./card"; * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossBillingController.at() + * @controller [object Object] * @path POST /v1/billing/authorizations/:billingKey * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -44,7 +44,7 @@ export async function at( billingKey, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -52,9 +52,10 @@ export async function at( "Content-Type": "application/json", }, }, - at.ENCRYPTED, - at.METHOD, - at.path(billingKey), + { + ...at.METADATA, + path: at.path(billingKey), + } as const, input, ); } @@ -62,29 +63,37 @@ export namespace at { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/billing/authorizations/:billingKey"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/billing/authorizations/:billingKey", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (billingKey: string): string => { return `/v1/billing/authorizations/${encodeURIComponent(billingKey ?? "null")}`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, billingKey: string, input: at.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(billingKey) + path: path(billingKey), + contentType: "application/json", }); - assert.param("billingKey")("string")(() => typia.assert(billingKey)); + assert.param("billingKey")(() => typia.assert(billingKey)); assert.body(() => typia.assert(input)); return random( typeof connection.simulate === 'object' && diff --git a/src/api/functional/v1/billing/index.ts b/src/api/functional/v1/billing/index.ts index 7c90678..f0c22d1 100644 --- a/src/api/functional/v1/billing/index.ts +++ b/src/api/functional/v1/billing/index.ts @@ -4,13 +4,13 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../utils/NestiaSimulator"; -import type { ITossBilling } from "./../../../structures/ITossBilling"; -import type { ITossPayment } from "./../../../structures/ITossPayment"; +import type { ITossBilling } from "../../../structures/ITossBilling"; +import type { ITossPayment } from "../../../structures/ITossPayment"; +import { NestiaSimulator } from "../../../utils/NestiaSimulator"; export * as authorizations from "./authorizations"; @@ -37,7 +37,7 @@ export * as authorizations from "./authorizations"; * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossBillingController.pay() + * @controller [object Object] * @path POST /v1/billing/:billingKey * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -52,7 +52,7 @@ export async function pay( billingKey, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -60,9 +60,10 @@ export async function pay( "Content-Type": "application/json", }, }, - pay.ENCRYPTED, - pay.METHOD, - pay.path(billingKey), + { + ...pay.METADATA, + path: pay.path(billingKey), + } as const, input, ); } @@ -70,29 +71,37 @@ export namespace pay { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/billing/:billingKey"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/billing/:billingKey", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (billingKey: string): string => { return `/v1/billing/${encodeURIComponent(billingKey ?? "null")}`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, billingKey: string, input: pay.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(billingKey) + path: path(billingKey), + contentType: "application/json", }); - assert.param("billingKey")("string")(() => typia.assert(billingKey)); + assert.param("billingKey")(() => typia.assert(billingKey)); assert.body(() => typia.assert(input)); return random( typeof connection.simulate === 'object' && diff --git a/src/api/functional/v1/cash_receipts/index.ts b/src/api/functional/v1/cash_receipts/index.ts index 1923787..fbda66f 100644 --- a/src/api/functional/v1/cash_receipts/index.ts +++ b/src/api/functional/v1/cash_receipts/index.ts @@ -4,12 +4,12 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../utils/NestiaSimulator"; -import type { ITossCashReceipt } from "./../../../structures/ITossCashReceipt"; +import type { ITossCashReceipt } from "../../../structures/ITossCashReceipt"; +import { NestiaSimulator } from "../../../utils/NestiaSimulator"; /** * 현금 영수증 발행하기. @@ -19,7 +19,7 @@ import type { ITossCashReceipt } from "./../../../structures/ITossCashReceipt"; * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossCashReceiptsController.store() + * @controller [object Object] * @path POST /v1/cash-receipts * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -32,7 +32,7 @@ export async function store( connection, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -40,9 +40,10 @@ export async function store( "Content-Type": "application/json", }, }, - store.ENCRYPTED, - store.METHOD, - store.path(), + { + ...store.METADATA, + path: store.path(), + } as const, input, ); } @@ -50,26 +51,34 @@ export namespace store { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/cash-receipts"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/cash-receipts", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (): string => { return `/v1/cash-receipts`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, input: store.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path() + path: path(), + contentType: "application/json", }); assert.body(() => typia.assert(input)); return random( @@ -90,7 +99,7 @@ export namespace store { * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossCashReceiptsController.cancel() + * @controller [object Object] * @path POST /v1/cash-receipts/:receiptKey/cancel * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -105,7 +114,7 @@ export async function cancel( receiptKey, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -113,9 +122,10 @@ export async function cancel( "Content-Type": "application/json", }, }, - cancel.ENCRYPTED, - cancel.METHOD, - cancel.path(receiptKey), + { + ...cancel.METADATA, + path: cancel.path(receiptKey), + } as const, input, ); } @@ -123,29 +133,37 @@ export namespace cancel { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/cash-receipts/:receiptKey/cancel"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/cash-receipts/:receiptKey/cancel", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (receiptKey: string): string => { return `/v1/cash-receipts/${encodeURIComponent(receiptKey ?? "null")}/cancel`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, receiptKey: string, input: cancel.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(receiptKey) + path: path(receiptKey), + contentType: "application/json", }); - assert.param("receiptKey")("string")(() => typia.assert(receiptKey)); + assert.param("receiptKey")(() => typia.assert(receiptKey)); assert.body(() => typia.assert(input)); return random( typeof connection.simulate === 'object' && diff --git a/src/api/functional/v1/payments/index.ts b/src/api/functional/v1/payments/index.ts index aab0057..368e1d7 100644 --- a/src/api/functional/v1/payments/index.ts +++ b/src/api/functional/v1/payments/index.ts @@ -4,14 +4,14 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../utils/NestiaSimulator"; -import type { ITossPayment } from "./../../../structures/ITossPayment"; -import type { ITossCardPayment } from "./../../../structures/ITossCardPayment"; -import type { ITossPaymentCancel } from "./../../../structures/ITossPaymentCancel"; +import type { ITossCardPayment } from "../../../structures/ITossCardPayment"; +import type { ITossPayment } from "../../../structures/ITossPayment"; +import type { ITossPaymentCancel } from "../../../structures/ITossPaymentCancel"; +import { NestiaSimulator } from "../../../utils/NestiaSimulator"; /** * 결제 정보 조회하기. @@ -31,7 +31,7 @@ import type { ITossPaymentCancel } from "./../../../structures/ITossPaymentCance * @returns 결제 정보 * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossPaymentsController.at() + * @controller [object Object] * @path GET /v1/payments/:paymentKey * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -44,38 +44,44 @@ export async function at( connection, paymentKey, ) - : Fetcher.fetch( + : PlainFetcher.fetch( connection, - at.ENCRYPTED, - at.METHOD, - at.path(paymentKey), + { + ...at.METADATA, + path: at.path(paymentKey), + } as const, ); } export namespace at { export type Output = Primitive; - export const METHOD = "GET" as const; - export const PATH: string = "/v1/payments/:paymentKey"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "GET", + path: "/v1/payments/:paymentKey", + request: null, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (paymentKey: string): string => { return `/v1/payments/${encodeURIComponent(paymentKey ?? "null")}`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, paymentKey: string, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(paymentKey) + path: path(paymentKey), + contentType: "application/json", }); - assert.param("paymentKey")("string")(() => typia.assert(paymentKey)); + assert.param("paymentKey")(() => typia.assert(paymentKey)); return random( typeof connection.simulate === 'object' && connection.simulate !== null @@ -111,7 +117,7 @@ export namespace at { * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossPaymentsController.key_in() + * @controller [object Object] * @path POST /v1/payments/key-in * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -124,7 +130,7 @@ export async function key_in( connection, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -132,9 +138,10 @@ export async function key_in( "Content-Type": "application/json", }, }, - key_in.ENCRYPTED, - key_in.METHOD, - key_in.path(), + { + ...key_in.METADATA, + path: key_in.path(), + } as const, input, ); } @@ -142,26 +149,34 @@ export namespace key_in { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/payments/key-in"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/payments/key-in", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (): string => { return `/v1/payments/key-in`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, input: key_in.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path() + path: path(), + contentType: "application/json", }); assert.body(() => typia.assert(input)); return random( @@ -192,7 +207,7 @@ export namespace key_in { * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossPaymentsController.approve() + * @controller [object Object] * @path POST /v1/payments/:paymentKey * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -207,7 +222,7 @@ export async function approve( paymentKey, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -215,9 +230,10 @@ export async function approve( "Content-Type": "application/json", }, }, - approve.ENCRYPTED, - approve.METHOD, - approve.path(paymentKey), + { + ...approve.METADATA, + path: approve.path(paymentKey), + } as const, input, ); } @@ -225,29 +241,37 @@ export namespace approve { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/payments/:paymentKey"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/payments/:paymentKey", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (paymentKey: string): string => { return `/v1/payments/${encodeURIComponent(paymentKey ?? "null")}`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, paymentKey: string, input: approve.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(paymentKey) + path: path(paymentKey), + contentType: "application/json", }); - assert.param("paymentKey")("string")(() => typia.assert(paymentKey)); + assert.param("paymentKey")(() => typia.assert(paymentKey)); assert.body(() => typia.assert(input)); return random( typeof connection.simulate === 'object' && @@ -272,7 +296,7 @@ export namespace approve { * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossPaymentsController.cancel() + * @controller [object Object] * @path POST /v1/payments/:paymentKey/cancel * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -287,7 +311,7 @@ export async function cancel( paymentKey, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -295,9 +319,10 @@ export async function cancel( "Content-Type": "application/json", }, }, - cancel.ENCRYPTED, - cancel.METHOD, - cancel.path(paymentKey), + { + ...cancel.METADATA, + path: cancel.path(paymentKey), + } as const, input, ); } @@ -305,29 +330,37 @@ export namespace cancel { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/payments/:paymentKey/cancel"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/payments/:paymentKey/cancel", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (paymentKey: string): string => { return `/v1/payments/${encodeURIComponent(paymentKey ?? "null")}/cancel`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, paymentKey: string, input: cancel.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path(paymentKey) + path: path(paymentKey), + contentType: "application/json", }); - assert.param("paymentKey")("string")(() => typia.assert(paymentKey)); + assert.param("paymentKey")(() => typia.assert(paymentKey)); assert.body(() => typia.assert(input)); return random( typeof connection.simulate === 'object' && diff --git a/src/api/functional/v1/virtual_accounts/index.ts b/src/api/functional/v1/virtual_accounts/index.ts index b964bc3..4d717c1 100644 --- a/src/api/functional/v1/virtual_accounts/index.ts +++ b/src/api/functional/v1/virtual_accounts/index.ts @@ -4,12 +4,12 @@ * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ -import { Fetcher } from "@nestia/fetcher"; import type { IConnection, Primitive } from "@nestia/fetcher"; +import { PlainFetcher } from "@nestia/fetcher/lib/PlainFetcher"; import typia from "typia"; -import { NestiaSimulator } from "./../../../utils/NestiaSimulator"; -import type { ITossVirtualAccountPayment } from "./../../../structures/ITossVirtualAccountPayment"; +import type { ITossVirtualAccountPayment } from "../../../structures/ITossVirtualAccountPayment"; +import { NestiaSimulator } from "../../../utils/NestiaSimulator"; /** * 가상 계좌로 결제 신청하기. @@ -35,7 +35,7 @@ import type { ITossVirtualAccountPayment } from "./../../../structures/ITossVirt * @security basic * @author Jeongho Nam - https://github.com/samchon * - * @controller FakeTossVirtualAccountsController.store() + * @controller [object Object] * @path POST /v1/virtual-accounts * @nestia Generated by Nestia - https://github.com/samchon/nestia */ @@ -48,7 +48,7 @@ export async function store( connection, input, ) - : Fetcher.fetch( + : PlainFetcher.fetch( { ...connection, headers: { @@ -56,9 +56,10 @@ export async function store( "Content-Type": "application/json", }, }, - store.ENCRYPTED, - store.METHOD, - store.path(), + { + ...store.METADATA, + path: store.path(), + } as const, input, ); } @@ -66,26 +67,34 @@ export namespace store { export type Input = Primitive; export type Output = Primitive; - export const METHOD = "POST" as const; - export const PATH: string = "/v1/virtual-accounts"; - export const ENCRYPTED: Fetcher.IEncrypted = { - request: false, - response: false, - }; + export const METADATA = { + method: "POST", + path: "/v1/virtual-accounts", + request: { + type: "application/json", + encrypted: false + }, + response: { + type: "application/json", + encrypted: false, + }, + status: null, + } as const; export const path = (): string => { return `/v1/virtual-accounts`; } - export const random = (g?: Partial): Output => - typia.random(g); + export const random = (g?: Partial): Primitive => + typia.random>(g); export const simulate = async ( connection: IConnection, input: store.Input, ): Promise => { const assert = NestiaSimulator.assert({ - method: METHOD, + method: METADATA.method, host: connection.host, - path: path() + path: path(), + contentType: "application/json", }); assert.body(() => typia.assert(input)); return random( diff --git a/src/api/structures/ITossBilling.ts b/src/api/structures/ITossBilling.ts index 04db44f..3b9d99f 100644 --- a/src/api/structures/ITossBilling.ts +++ b/src/api/structures/ITossBilling.ts @@ -1,3 +1,5 @@ +import { tags } from "typia"; + /** * 간편 결제 등록 수단 정보. * @@ -34,17 +36,13 @@ export interface ITossBilling /** * 카드 번호. - * - * @pattern [0-9]{16} */ - cardNumber: string; + cardNumber: string & tags.Pattern<"[0-9]{16}">; /** * 인증 일시. - * - * @format date-time */ - authenticatedAt: string; + authenticatedAt: string & tags.Format<"date-time">; } export namespace ITossBilling { @@ -56,24 +54,18 @@ export namespace ITossBilling { /** * 카드 번호. - * - * @pattern [0-9]{16} */ - cardNumber: string; + cardNumber: string & tags.Pattern<"[0-9]{16}">; /** * 카드 만료 년도 (2 자리). - * - * @pattern \d{2} */ - cardExpirationYear: string; + cardExpirationYear: string & tags.Pattern<"\\d{2}">; /** * 카드 만료 월 (2 자리). - * - * @pattern ^(0[1-9]|1[012])$ */ - cardExpirationMonth: string; + cardExpirationMonth: string & tags.Pattern<"^(0[1-9]|1[012])$">; /** * 카드 비밀번호. @@ -84,10 +76,8 @@ export namespace ITossBilling * 고객의 생년월일. * * 표기 형식 YYMMDD. - * - * @pattern ^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$ */ - customerBirthday: string; + customerBirthday: string & tags.Pattern<"^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$">; /** * 고객의 이름. @@ -96,10 +86,8 @@ export namespace ITossBilling /** * 고객의 이메일. - * - * @format email */ - customerEmail?: string; + customerEmail?: string & tags.Format<"email">; /** * 해외카드로 결제하는 경우 3DS 인증 적용을 위해 사용. diff --git a/src/api/structures/ITossCardPayment.ts b/src/api/structures/ITossCardPayment.ts index 3c928b9..512042a 100644 --- a/src/api/structures/ITossCardPayment.ts +++ b/src/api/structures/ITossCardPayment.ts @@ -1,3 +1,4 @@ +import { tags } from "typia"; import { ITossPayment } from "./ITossPayment"; /** @@ -37,10 +38,8 @@ export namespace ITossCardPayment /** * 카드 번호. - * - * @pattern [0-9]{16} */ - number: string; + number: string & tags.Pattern<"[0-9]{16}">; /** * 할부 개월 수. @@ -85,10 +84,8 @@ export namespace ITossCardPayment /** * 영수증 URL. - * - * @format url */ - receiptUrl: string; + receiptUrl: string & tags.Format<"url">; } /** @@ -114,24 +111,18 @@ export namespace ITossCardPayment /** * 카드 번호. - * - * @pattern [0-9]{16} */ - cardNumber: string; + cardNumber: string & tags.Pattern<"[0-9]{16}">; /** * 카드 만료 년도 (2 자리). - * - * @pattern \d{2} */ - cardExpirationYear: string; + cardExpirationYear: string & tags.Pattern<"\\d{2}">; /** * 카드 만료 월 (2 자리). - * - * @pattern ^(0[1-9]|1[012])$ */ - cardExpirationMonth: string; + cardExpirationMonth: string & tags.Pattern<"^(0[1-9]|1[012])$">; /** * 카드 비밀번호. @@ -171,17 +162,13 @@ export namespace ITossCardPayment * 고객의 생년월일. * * 표기 형식 YYMMDD. - * - * @pattern ^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$ */ - customerBirthday?: string; + customerBirthday?: string & tags.Pattern<"^([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$">; /** * 고객의 이메일. - * - * @format email */ - customerEmail?: string; + customerEmail?: string & tags.Format<"email">; /** * 해외카드로 결제하는 경우 3DS 인증 적용을 위해 사용. diff --git a/src/api/structures/ITossCashReceipt.ts b/src/api/structures/ITossCashReceipt.ts index 6ca7fb0..d85e8ef 100644 --- a/src/api/structures/ITossCashReceipt.ts +++ b/src/api/structures/ITossCashReceipt.ts @@ -1,3 +1,5 @@ +import { tags } from "typia"; + /** * 현금 영수증 정보. * @@ -32,17 +34,13 @@ export interface ITossCashReceipt /** * 현금 영수증 승인 일시. - * - * @format date-time */ - approvedAt: string; + approvedAt: string & tags.Format<"date-time">; /** * 현금 영수증 취소 일시. - * - * @format date-time */ - canceledAt: string | null; + canceledAt: null | (string & tags.Format<"date-time">); /** * 영수증 URL. diff --git a/src/api/structures/ITossPayment.ts b/src/api/structures/ITossPayment.ts index fe01683..65be2bc 100644 --- a/src/api/structures/ITossPayment.ts +++ b/src/api/structures/ITossPayment.ts @@ -1,3 +1,4 @@ +import { tags } from "typia"; import { ITossBilling } from "./ITossBilling"; import { ITossCardPayment } from "./ITossCardPayment"; import { ITossCashReceipt } from "./ITossCashReceipt"; @@ -160,17 +161,13 @@ export namespace ITossPayment /** * 결제 요청 일시. - * - * @format date-time */ - requestedAt: string; + requestedAt: string & tags.Format<"date-time">; /** * 결제 승인 일시. - * - * @format date-time */ - approvedAt: string | null; + approvedAt: null | (string & tags.Format<"date-time">); /** * 결제 취소 내역. diff --git a/src/api/structures/ITossPaymentCancel.ts b/src/api/structures/ITossPaymentCancel.ts index 054df5b..f3c9140 100644 --- a/src/api/structures/ITossPaymentCancel.ts +++ b/src/api/structures/ITossPaymentCancel.ts @@ -1,3 +1,5 @@ +import { tags } from "typia"; + /** * 결제 취소 정보. * @@ -32,10 +34,8 @@ export interface ITossPaymentCancel /** * 취소 일시. - * - * @format date-time */ - canceledAt: string; + canceledAt: string & tags.Format<"date-time">; } export namespace ITossPaymentCancel { @@ -73,10 +73,8 @@ export namespace ITossPaymentCancel /** * 계좌 번호. - * - * @pattern ^[0-9]{0,20}$ */ - accountNumber: string; + accountNumber: string & tags.Pattern<"^[0-9]{0,20}$">; /** * 예금주. diff --git a/src/api/structures/ITossVirtualAccountPayment.ts b/src/api/structures/ITossVirtualAccountPayment.ts index c894a49..c48c1db 100644 --- a/src/api/structures/ITossVirtualAccountPayment.ts +++ b/src/api/structures/ITossVirtualAccountPayment.ts @@ -1,3 +1,4 @@ +import { tags } from "typia"; import { ITossPayment } from "./ITossPayment"; /** @@ -106,10 +107,8 @@ export namespace ITossVirtualAccountPayment /** * 입금 기한. - * - * @format date */ - dueDate: string; + dueDate: string & tags.Format<"date">; /** * 가상 계좌 만료 여부. diff --git a/src/api/utils/NestiaSimulator.ts b/src/api/utils/NestiaSimulator.ts index 49fc224..085ff9f 100644 --- a/src/api/utils/NestiaSimulator.ts +++ b/src/api/utils/NestiaSimulator.ts @@ -7,6 +7,7 @@ export namespace NestiaSimulator { host: string; path: string; method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE"; + contentType: string; } export const assert = (props: IProps) => { @@ -19,17 +20,10 @@ export namespace NestiaSimulator { const param = (props: IProps) => (name: string) => - (type: string) => (task: () => T): void => { validate( (exp) => `URL parameter "${name}" is not ${exp.expected} type.`, - )(props)( - type === "uuid" - ? uuid(task) - : type === "date" - ? date(task) - : task, - ); + )(props)(task); }; const query = @@ -47,20 +41,6 @@ export namespace NestiaSimulator { props, )(task); - const uuid = - (task: () => T) => - () => { - const value = task(); - return typia.assert({ value }).value as T; - }; - - const date = - (task: () => T) => - () => { - const value = task(); - return typia.assert({ value }).value as T; - }; - const validate = (message: (exp: typia.TypeGuardError) => string, path?: string) => (props: IProps) => @@ -73,6 +53,9 @@ export namespace NestiaSimulator { props.method, props.host + props.path, 400, + { + "Content-Type": props.contentType, + }, JSON.stringify({ method: exp.method, path: path ?? exp.path, @@ -85,17 +68,3 @@ export namespace NestiaSimulator { } }; } - -interface IUuid { - /** - * @format uuid - */ - value: string | null; -} - -interface IDate { - /** - * @format date - */ - value: string | null; -} diff --git a/src/controllers/FakeTossBillingController.ts b/src/controllers/FakeTossBillingController.ts index 1e31d20..19e34cd 100644 --- a/src/controllers/FakeTossBillingController.ts +++ b/src/controllers/FakeTossBillingController.ts @@ -71,7 +71,7 @@ export class FakeTossBillingController { @core.TypedRoute.Post("authorizations/:billingKey") public at( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("billingKey", "string") billingKey: string, + @core.TypedParam("billingKey") billingKey: string, @core.TypedBody() input: ITossBilling.ICustomerKey, ): ITossBilling { FakeTossUserAuth.authorize(request); @@ -110,7 +110,7 @@ export class FakeTossBillingController { @core.TypedRoute.Post(":billingKey") public pay( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("billingKey", "string") billingKey: string, + @core.TypedParam("billingKey") billingKey: string, @core.TypedBody() input: ITossBilling.IPaymentStore, ): ITossPayment { FakeTossUserAuth.authorize(request); diff --git a/src/controllers/FakeTossCashReceiptsController.ts b/src/controllers/FakeTossCashReceiptsController.ts index a22f7d4..fcc02c9 100644 --- a/src/controllers/FakeTossCashReceiptsController.ts +++ b/src/controllers/FakeTossCashReceiptsController.ts @@ -81,7 +81,7 @@ export class FakeTossCashReceiptsController { @core.TypedRoute.Post(":receiptKey/cancel") public cancel( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("receiptKey", "string") receiptKey: string, + @core.TypedParam("receiptKey") receiptKey: string, @core.TypedBody() input: ITossCashReceipt.ICancel, ): ITossCashReceipt { // VALIADTE diff --git a/src/controllers/FakeTossInternalController.ts b/src/controllers/FakeTossInternalController.ts index 8f7b8e7..193119e 100644 --- a/src/controllers/FakeTossInternalController.ts +++ b/src/controllers/FakeTossInternalController.ts @@ -54,7 +54,7 @@ export class FakeTossInternalController { @core.TypedRoute.Get(":paymentKey/deposit") public deposit( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("paymentKey", "string") paymentKey: string, + @core.TypedParam("paymentKey") paymentKey: string, ): ITossPayment { FakeTossUserAuth.authorize(request); diff --git a/src/controllers/FakeTossPaymentsController.ts b/src/controllers/FakeTossPaymentsController.ts index 9404373..884c921 100644 --- a/src/controllers/FakeTossPaymentsController.ts +++ b/src/controllers/FakeTossPaymentsController.ts @@ -35,7 +35,7 @@ export class FakeTossPaymentsController { @core.TypedRoute.Get(":paymentKey") public at( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("paymentKey", "string") paymentKey: string, + @core.TypedParam("paymentKey") paymentKey: string, ): ITossPayment { FakeTossUserAuth.authorize(request); return FakeTossStorage.payments.get(paymentKey); @@ -125,7 +125,7 @@ export class FakeTossPaymentsController { @core.TypedRoute.Post(":paymentKey") public approve( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("paymentKey", "string") paymentKey: string, + @core.TypedParam("paymentKey") paymentKey: string, @core.TypedBody() input: ITossPayment.IApproval, ): ITossPayment { FakeTossUserAuth.authorize(request); @@ -160,7 +160,7 @@ export class FakeTossPaymentsController { @core.TypedRoute.Post(":paymentKey/cancel") public cancel( @nest.Request() request: fastify.FastifyRequest, - @core.TypedParam("paymentKey", "string") paymentKey: string, + @core.TypedParam("paymentKey") paymentKey: string, @core.TypedBody() input: ITossPaymentCancel.IStore, ): ITossPayment { FakeTossUserAuth.authorize(request);