fake-iamport-server
Version:
Fake iamport server for testing
679 lines (678 loc) • 63.1 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FakeIamportCertificationsController = void 0;
var __nestia_core_transform_assertGuard = __importStar(require("typia/lib/internal/_assertGuard.js"));
var __nestia_core_transform_jsonStringifyString = __importStar(require("typia/lib/internal/_jsonStringifyString.js"));
var __nestia_core_transform_httpParameterReadString = __importStar(require("typia/lib/internal/_httpParameterReadString.js"));
var __nestia_core_transform_validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
var core_1 = __importDefault(require("@nestia/core"));
var common_1 = require("@nestjs/common");
var tstl_1 = require("tstl");
var uuid_1 = require("uuid");
var FakeIamportUserAuth_1 = require("../decorators/FakeIamportUserAuth");
var FakeIamportResponseProvider_1 = require("../providers/FakeIamportResponseProvider");
var FakeIamportStorage_1 = require("../providers/FakeIamportStorage");
var FakeIamportCertificationsController = /** @class */ (function () {
function FakeIamportCertificationsController() {
}
/**
* 본인인증 정보 열람하기.
*
* `certiciations.at` 은 본인인증 정보를 열람할 때 사용하는 API 함수이다.
*
* 다만 이 API 함수를 통하여 열람한 본인인증 정보 {@link IIamportCertification} 이
* 곧 OTP 인증까지 마쳐 본인인증을 모두 마친 레코드라는 보장은 없다. 본인인증의 완결
* 여부는 오직, {@link IIamportCertification.certified} 값을 직접 검사해봐야만 알
* 수 있기 때문이다.
*
* @param imp_uid 대상 본인인증 정보의 {@link IIamportCertification.imp_uid}
* @returns 본인인증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportCertificationsController.prototype.at = function (_user, imp_uid) {
var certification = FakeIamportStorage_1.FakeIamportStorage.certifications.get(imp_uid);
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(certification);
};
/**
* 본인인증 요청하기.
*
* `certifications.otp.request` 는 아임포트 서버에 본인인증을 요청하는 API 함수이다.
* 이 API 를 호출하면 본인인증 대상자의 핸드폰으로 OTP 문자가 전송되며, 본인인증
* 대상자가 {@link certifications.otp.confirm} 을 통하여 이 OTP 번호를 정확히
* 입력함으로써, 본인인증이 완결된다.
*
* 또한 본인인증 대상자가 자신의 핸드폰으로 전송된 OTP 문자를 입력하기 전에도,
* 여전히해당 본인인증 내역은 {@link certifications.at} 함수를 통하여 조회할 수 있다.
* 다만, 이 때 리턴되는 {@link IIamportCertification} 에서 인증의 완결 여부를
* 지칭하는 {@link IIamportCertification.certified} 값은 `false` 이다.
*
* @param input 본인인증 요청 정보
* @returns 진행 중인 본인인증의 식별자 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportCertificationsController.prototype.request = function (_user, input) {
var birth = new Date("".concat(input.birth.substr(0, 4), "-").concat(input.birth.substr(4, 2), "-").concat(input.birth.substr(6, 2)));
var certication = {
imp_uid: (0, uuid_1.v4)(),
merchant_uid: input.merchant_uid || null,
name: input.name,
gender: String(Number(input.gender_digit) % 2),
birth: birth.getTime() / 1000,
birthday: input.birth,
foreigner: false,
phone: input.phone.split("-").join(""),
carrier: input.carrier,
certified: false,
certified_at: 0,
unique_key: (0, uuid_1.v4)(),
unique_in_site: (0, uuid_1.v4)(),
pg_tid: (0, uuid_1.v4)(),
pg_provider: "some-provider",
origin: "fake-iamport",
__otp: (0, tstl_1.randint)(0, 9999).toString().padStart(4, "0"),
};
FakeIamportStorage_1.FakeIamportStorage.certifications.set(certication.imp_uid, certication);
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success({
imp_uid: certication.imp_uid,
});
};
/**
* 본인인증 시 발급된 OTP 코드 입력하기.
*
* `certifications.otp.confirm` 는 {@link certifications.otp.request} 를 통하여
* 발급된 본인인증 건에 대하여, 본인인증 대상자의 휴대폰으로 전송된 OTP 번호를
* 검증하고, 입력한 OTP 번호가 맞거든 해당 본인인증 건을 승인하여 완료 처리해주는
* API 함수이다.
*
* 이처럼 본인인증을 완료하거든, 해당 본인인증 건 {@link IIamportCertification} 의
* {@link IIamportCertification.certified} 값이 비로소 `true` 로 변경되어,
* 비로소 완결된다.
*
* @param imp_uid 대상 본인인증 정보의 {@link IIamportCertification.imp_uid}
* @param input OTP 코드
* @returns 인증 완료된 본인인증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportCertificationsController.prototype.confirm = function (_user, imp_uid, input) {
var certification = FakeIamportStorage_1.FakeIamportStorage.certifications.get(imp_uid);
if (certification.certified === true)
throw new common_1.UnprocessableEntityException("Already certified.");
else if (certification.__otp !== input.otp)
throw new common_1.ForbiddenException("Wrong OTP value.");
certification.certified = true;
certification.certified_at = Date.now() / 1000;
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(certification);
};
/**
* 본인인증 정보 삭제하기.
*
* @param imp_uid 대상 본인인증 정보의 {@link IIamportCertification.imp_uid}
* @returns 삭제된 본인인증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportCertificationsController.prototype.erase = function (_user, imp_uid) {
var certification = FakeIamportStorage_1.FakeIamportStorage.certifications.get(imp_uid);
FakeIamportStorage_1.FakeIamportStorage.certifications.erase(imp_uid);
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(certification);
};
__decorate([
core_1.default.TypedRoute.Get(":imp_uid", { type: "assert", assert: (function () { var _io0 = function (input) { return "number" === typeof input.code && !Number.isNaN(input.code) && "string" === typeof input.message && ("object" === typeof input.response && null !== input.response && _io1(input.response)); }; var _io1 = function (input) { return "string" === typeof input.imp_uid && (null === input.merchant_uid || "string" === typeof input.merchant_uid) && "string" === typeof input.name && "string" === typeof input.gender && ("number" === typeof input.birth && !Number.isNaN(input.birth)) && ("string" === typeof input.birthday && RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birthday)) && "boolean" === typeof input.foreigner && "string" === typeof input.phone && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier) && "boolean" === typeof input.certified && ("number" === typeof input.certified_at && !Number.isNaN(input.certified_at)) && "string" === typeof input.unique_key && "string" === typeof input.unique_in_site && "string" === typeof input.pg_tid && "string" === typeof input.pg_provider && "string" === typeof input.origin && (undefined === input.__otp || "string" === typeof input.__otp); }; var _ao0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("number" === typeof input.code && !Number.isNaN(input.code) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".code",
expected: "number",
value: input.code
}, _errorFactory)) && ("string" === typeof input.message || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".message",
expected: "string",
value: input.message
}, _errorFactory)) && (("object" === typeof input.response && null !== input.response || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".response",
expected: "IIamportCertification",
value: input.response
}, _errorFactory)) && _ao1(input.response, _path + ".response", true && _exceptionable) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".response",
expected: "IIamportCertification",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("string" === typeof input.imp_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".imp_uid",
expected: "string",
value: input.imp_uid
}, _errorFactory)) && (null === input.merchant_uid || "string" === typeof input.merchant_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".merchant_uid",
expected: "(null | string)",
value: input.merchant_uid
}, _errorFactory)) && ("string" === typeof input.name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".name",
expected: "string",
value: input.name
}, _errorFactory)) && ("string" === typeof input.gender || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".gender",
expected: "string",
value: input.gender
}, _errorFactory)) && ("number" === typeof input.birth && !Number.isNaN(input.birth) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".birth",
expected: "number",
value: input.birth
}, _errorFactory)) && ("string" === typeof input.birthday && (RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birthday) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".birthday",
expected: "string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">",
value: input.birthday
}, _errorFactory)) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".birthday",
expected: "(string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">)",
value: input.birthday
}, _errorFactory)) && ("boolean" === typeof input.foreigner || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".foreigner",
expected: "boolean",
value: input.foreigner
}, _errorFactory)) && ("string" === typeof input.phone || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".phone",
expected: "string",
value: input.phone
}, _errorFactory)) && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".carrier",
expected: "(\"KT\" | \"LGT\" | \"SKT\")",
value: input.carrier
}, _errorFactory)) && ("boolean" === typeof input.certified || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".certified",
expected: "boolean",
value: input.certified
}, _errorFactory)) && ("number" === typeof input.certified_at && !Number.isNaN(input.certified_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".certified_at",
expected: "number",
value: input.certified_at
}, _errorFactory)) && ("string" === typeof input.unique_key || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".unique_key",
expected: "string",
value: input.unique_key
}, _errorFactory)) && ("string" === typeof input.unique_in_site || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".unique_in_site",
expected: "string",
value: input.unique_in_site
}, _errorFactory)) && ("string" === typeof input.pg_tid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".pg_tid",
expected: "string",
value: input.pg_tid
}, _errorFactory)) && ("string" === typeof input.pg_provider || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".pg_provider",
expected: "string",
value: input.pg_provider
}, _errorFactory)) && ("string" === typeof input.origin || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".origin",
expected: "string",
value: input.origin
}, _errorFactory)) && (undefined === input.__otp || "string" === typeof input.__otp || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".__otp",
expected: "(string | undefined)",
value: input.__otp
}, _errorFactory));
}; var _so0 = function (input) { return "{\"code\":".concat(input.code, ",\"message\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.message), ",\"response\":").concat(_so1(input.response), "}"); }; var _so1 = function (input) { return "{".concat(undefined === input.__otp ? "" : "\"__otp\":".concat(undefined !== input.__otp ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.__otp) : undefined, ","), "\"imp_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.imp_uid), ",\"merchant_uid\":").concat(null !== input.merchant_uid ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.merchant_uid) : "null", ",\"name\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.name), ",\"gender\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.gender), ",\"birth\":").concat(input.birth, ",\"birthday\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.birthday), ",\"foreigner\":").concat(input.foreigner, ",\"phone\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.phone), ",\"carrier\":").concat("\"" + input.carrier + "\"", ",\"certified\":").concat(input.certified, ",\"certified_at\":").concat(input.certified_at, ",\"unique_key\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.unique_key), ",\"unique_in_site\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.unique_in_site), ",\"pg_tid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_tid), ",\"pg_provider\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_provider), ",\"origin\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.origin), "}"); }; var __is = function (input) { return "object" === typeof input && null !== input && _io0(input); }; var _errorFactory; var __assert = function (input, errorFactory) {
if (false === __is(input)) {
_errorFactory = errorFactory;
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("object" === typeof input && null !== input || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Get",
path: _path + "",
expected: "IIamportResponse<IIamportCertification>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Get",
path: _path + "",
expected: "IIamportResponse<IIamportCertification>",
value: input
}, _errorFactory);
})(input, "$input", true);
}
return input;
}; var __stringify = function (input) { return _so0(input); }; return function (input, errorFactory) {
__assert(input, errorFactory);
return __stringify(input);
}; })() }),
__param(0, (0, FakeIamportUserAuth_1.FakeIamportUserAuth)()),
__param(1, core_1.default.TypedParam("imp_uid", function (input) {
var assert = (function () { var __is = function (input) { return "string" === typeof input; }; var _errorFactory; return function (input, errorFactory) {
if (false === __is(input)) {
_errorFactory = errorFactory;
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return "string" === typeof input || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedParam",
path: _path + "",
expected: "string",
value: input
}, _errorFactory);
})(input, "$input", true);
}
return input;
}; })();
var value = __nestia_core_transform_httpParameterReadString._httpParameterReadString(input);
return assert(value);
})),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", Object)
], FakeIamportCertificationsController.prototype, "at", null);
__decorate([
core_1.default.TypedRoute.Post("otp/request", { type: "assert", assert: (function () { var _io0 = function (input) { return "number" === typeof input.code && !Number.isNaN(input.code) && "string" === typeof input.message && ("object" === typeof input.response && null !== input.response && _io1(input.response)); }; var _io1 = function (input) { return "string" === typeof input.imp_uid; }; var _ao0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("number" === typeof input.code && !Number.isNaN(input.code) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".code",
expected: "number",
value: input.code
}, _errorFactory)) && ("string" === typeof input.message || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".message",
expected: "string",
value: input.message
}, _errorFactory)) && (("object" === typeof input.response && null !== input.response || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".response",
expected: "IIamportCertification.IAccessor",
value: input.response
}, _errorFactory)) && _ao1(input.response, _path + ".response", true && _exceptionable) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".response",
expected: "IIamportCertification.IAccessor",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return "string" === typeof input.imp_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".imp_uid",
expected: "string",
value: input.imp_uid
}, _errorFactory);
}; var _so0 = function (input) { return "{\"code\":".concat(input.code, ",\"message\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.message), ",\"response\":").concat(_so1(input.response), "}"); }; var _so1 = function (input) { return "{\"imp_uid\":".concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.imp_uid), "}"); }; var __is = function (input) { return "object" === typeof input && null !== input && _io0(input); }; var _errorFactory; var __assert = function (input, errorFactory) {
if (false === __is(input)) {
_errorFactory = errorFactory;
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("object" === typeof input && null !== input || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportCertification.IAccessor>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportCertification.IAccessor>",
value: input
}, _errorFactory);
})(input, "$input", true);
}
return input;
}; var __stringify = function (input) { return _so0(input); }; return function (input, errorFactory) {
__assert(input, errorFactory);
return __stringify(input);
}; })() }),
__param(0, (0, FakeIamportUserAuth_1.FakeIamportUserAuth)()),
__param(1, core_1.default.TypedBody({ type: "validate", validate: (function () { var _io0 = function (input) { return "string" === typeof input.name && "string" === typeof input.phone && ("string" === typeof input.birth && RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birth)) && "string" === typeof input.gender_digit && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier) && (undefined === input.is_mvno || "boolean" === typeof input.is_mvno) && (undefined === input.commpany || "string" === typeof input.commpany) && (undefined === input.merchant_uid || "string" === typeof input.merchant_uid) && (undefined === input.pg || "string" === typeof input.pg); }; var _vo0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ["string" === typeof input.name || _report(_exceptionable, {
path: _path + ".name",
expected: "string",
value: input.name
}), "string" === typeof input.phone || _report(_exceptionable, {
path: _path + ".phone",
expected: "string",
value: input.phone
}), "string" === typeof input.birth && (RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birth) || _report(_exceptionable, {
path: _path + ".birth",
expected: "string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">",
value: input.birth
})) || _report(_exceptionable, {
path: _path + ".birth",
expected: "(string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">)",
value: input.birth
}), "string" === typeof input.gender_digit || _report(_exceptionable, {
path: _path + ".gender_digit",
expected: "string",
value: input.gender_digit
}), "SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier || _report(_exceptionable, {
path: _path + ".carrier",
expected: "(\"KT\" | \"LGT\" | \"SKT\")",
value: input.carrier
}), undefined === input.is_mvno || "boolean" === typeof input.is_mvno || _report(_exceptionable, {
path: _path + ".is_mvno",
expected: "(boolean | undefined)",
value: input.is_mvno
}), undefined === input.commpany || "string" === typeof input.commpany || _report(_exceptionable, {
path: _path + ".commpany",
expected: "(string | undefined)",
value: input.commpany
}), undefined === input.merchant_uid || "string" === typeof input.merchant_uid || _report(_exceptionable, {
path: _path + ".merchant_uid",
expected: "(string | undefined)",
value: input.merchant_uid
}), undefined === input.pg || "string" === typeof input.pg || _report(_exceptionable, {
path: _path + ".pg",
expected: "(string | undefined)",
value: input.pg
})].every(function (flag) { return flag; });
}; var __is = function (input) { return "object" === typeof input && null !== input && _io0(input); }; var errors; var _report; return function (input) {
if (false === __is(input)) {
errors = [];
_report = __nestia_core_transform_validateReport._validateReport(errors);
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("object" === typeof input && null !== input || _report(true, {
path: _path + "",
expected: "IIamportCertification.ICreate",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IIamportCertification.ICreate",
value: input
});
})(input, "$input", true);
var success = 0 === errors.length;
return success ? {
success: success,
data: input
} : {
success: success,
errors: errors,
data: input
};
}
return {
success: true,
data: input
};
}; })() })),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Object)
], FakeIamportCertificationsController.prototype, "request", null);
__decorate([
core_1.default.TypedRoute.Post("otp/confirm/:imp_uid", { type: "assert", assert: (function () { var _io0 = function (input) { return "number" === typeof input.code && !Number.isNaN(input.code) && "string" === typeof input.message && ("object" === typeof input.response && null !== input.response && _io1(input.response)); }; var _io1 = function (input) { return "string" === typeof input.imp_uid && (null === input.merchant_uid || "string" === typeof input.merchant_uid) && "string" === typeof input.name && "string" === typeof input.gender && ("number" === typeof input.birth && !Number.isNaN(input.birth)) && ("string" === typeof input.birthday && RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birthday)) && "boolean" === typeof input.foreigner && "string" === typeof input.phone && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier) && "boolean" === typeof input.certified && ("number" === typeof input.certified_at && !Number.isNaN(input.certified_at)) && "string" === typeof input.unique_key && "string" === typeof input.unique_in_site && "string" === typeof input.pg_tid && "string" === typeof input.pg_provider && "string" === typeof input.origin && (undefined === input.__otp || "string" === typeof input.__otp); }; var _ao0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("number" === typeof input.code && !Number.isNaN(input.code) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".code",
expected: "number",
value: input.code
}, _errorFactory)) && ("string" === typeof input.message || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".message",
expected: "string",
value: input.message
}, _errorFactory)) && (("object" === typeof input.response && null !== input.response || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".response",
expected: "IIamportCertification",
value: input.response
}, _errorFactory)) && _ao1(input.response, _path + ".response", true && _exceptionable) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".response",
expected: "IIamportCertification",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("string" === typeof input.imp_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".imp_uid",
expected: "string",
value: input.imp_uid
}, _errorFactory)) && (null === input.merchant_uid || "string" === typeof input.merchant_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".merchant_uid",
expected: "(null | string)",
value: input.merchant_uid
}, _errorFactory)) && ("string" === typeof input.name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".name",
expected: "string",
value: input.name
}, _errorFactory)) && ("string" === typeof input.gender || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".gender",
expected: "string",
value: input.gender
}, _errorFactory)) && ("number" === typeof input.birth && !Number.isNaN(input.birth) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".birth",
expected: "number",
value: input.birth
}, _errorFactory)) && ("string" === typeof input.birthday && (RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birthday) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".birthday",
expected: "string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">",
value: input.birthday
}, _errorFactory)) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".birthday",
expected: "(string & Pattern<\"^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$\">)",
value: input.birthday
}, _errorFactory)) && ("boolean" === typeof input.foreigner || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".foreigner",
expected: "boolean",
value: input.foreigner
}, _errorFactory)) && ("string" === typeof input.phone || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".phone",
expected: "string",
value: input.phone
}, _errorFactory)) && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".carrier",
expected: "(\"KT\" | \"LGT\" | \"SKT\")",
value: input.carrier
}, _errorFactory)) && ("boolean" === typeof input.certified || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".certified",
expected: "boolean",
value: input.certified
}, _errorFactory)) && ("number" === typeof input.certified_at && !Number.isNaN(input.certified_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".certified_at",
expected: "number",
value: input.certified_at
}, _errorFactory)) && ("string" === typeof input.unique_key || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".unique_key",
expected: "string",
value: input.unique_key
}, _errorFactory)) && ("string" === typeof input.unique_in_site || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".unique_in_site",
expected: "string",
value: input.unique_in_site
}, _errorFactory)) && ("string" === typeof input.pg_tid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".pg_tid",
expected: "string",
value: input.pg_tid
}, _errorFactory)) && ("string" === typeof input.pg_provider || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".pg_provider",
expected: "string",
value: input.pg_provider
}, _errorFactory)) && ("string" === typeof input.origin || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".origin",
expected: "string",
value: input.origin
}, _errorFactory)) && (undefined === input.__otp || "string" === typeof input.__otp || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".__otp",
expected: "(string | undefined)",
value: input.__otp
}, _errorFactory));
}; var _so0 = function (input) { return "{\"code\":".concat(input.code, ",\"message\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.message), ",\"response\":").concat(_so1(input.response), "}"); }; var _so1 = function (input) { return "{".concat(undefined === input.__otp ? "" : "\"__otp\":".concat(undefined !== input.__otp ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.__otp) : undefined, ","), "\"imp_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.imp_uid), ",\"merchant_uid\":").concat(null !== input.merchant_uid ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.merchant_uid) : "null", ",\"name\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.name), ",\"gender\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.gender), ",\"birth\":").concat(input.birth, ",\"birthday\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.birthday), ",\"foreigner\":").concat(input.foreigner, ",\"phone\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.phone), ",\"carrier\":").concat("\"" + input.carrier + "\"", ",\"certified\":").concat(input.certified, ",\"certified_at\":").concat(input.certified_at, ",\"unique_key\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.unique_key), ",\"unique_in_site\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.unique_in_site), ",\"pg_tid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_tid), ",\"pg_provider\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_provider), ",\"origin\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.origin), "}"); }; var __is = function (input) { return "object" === typeof input && null !== input && _io0(input); }; var _errorFactory; var __assert = function (input, errorFactory) {
if (false === __is(input)) {
_errorFactory = errorFactory;
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("object" === typeof input && null !== input || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportCertification>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportCertification>",
value: input
}, _errorFactory);
})(input, "$input", true);
}
return input;
}; var __stringify = function (input) { return _so0(input); }; return function (input, errorFactory) {
__assert(input, errorFactory);
return __stringify(input);
}; })() }),
__param(0, (0, FakeIamportUserAuth_1.FakeIamportUserAuth)()),
__param(1, core_1.default.TypedParam("imp_uid", function (input) {
var assert = (function () { var __is = function (input) { return "string" === typeof input; }; var _errorFactory; return function (input, errorFactory) {
if (false === __is(input)) {
_errorFactory = errorFactory;
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return "string" === typeof input || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedParam",
path: _path + "",
expected: "string",
value: input
}, _errorFactory);
})(input, "$input", true);
}
return input;
}; })();
var value = __nestia_core_transform_httpParameterReadString._httpParameterReadString(input);
return assert(value);
})),
__param(2, core_1.default.TypedBody({ type: "validate", validate: (function () { var _io0 = function (input) { return "string" === typeof input.otp; }; var _vo0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ["string" === typeof input.otp || _report(_exceptionable, {
path: _path + ".otp",
expected: "string",
value: input.otp
})].every(function (flag) { return flag; });
}; var __is = function (input) { return "object" === typeof input && null !== input && _io0(input); }; var errors; var _report; return function (input) {
if (false === __is(input)) {
errors = [];
_report = __nestia_core_transform_validateReport._validateReport(errors);
(function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("object" === typeof input && null !== input || _report(true, {
path: _path + "",
expected: "IIamportCertification.IConfirm",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IIamportCertification.IConfirm",
value: input
});
})(input, "$input", true);
var success = 0 === errors.length;
return success ? {
success: success,
data: input
} : {
success: success,
errors: errors,
data: input
};
}
return {
success: true,
data: input
};
}; })() })),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String, Object]),
__metadata("design:returntype", Object)
], FakeIamportCertificationsController.prototype, "confirm", null);
__decorate([
core_1.default.TypedRoute.Delete(":imp_uid", { type: "assert", assert: (function () { var _io0 = function (input) { return "number" === typeof input.code && !Number.isNaN(input.code) && "string" === typeof input.message && ("object" === typeof input.response && null !== input.response && _io1(input.response)); }; var _io1 = function (input) { return "string" === typeof input.imp_uid && (null === input.merchant_uid || "string" === typeof input.merchant_uid) && "string" === typeof input.name && "string" === typeof input.gender && ("number" === typeof input.birth && !Number.isNaN(input.birth)) && ("string" === typeof input.birthday && RegExp("^([0-9]{4})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$").test(input.birthday)) && "boolean" === typeof input.foreigner && "string" === typeof input.phone && ("SKT" === input.carrier || "KT" === input.carrier || "LGT" === input.carrier) && "boolean" === typeof input.certified && ("number" === typeof input.certified_at && !Number.isNaN(input.certified_at)) && "string" === typeof input.unique_key && "string" === typeof input.unique_in_site && "string" === typeof input.pg_tid && "string" === typeof input.pg_provider && "string" === typeof input.origin && (undefined === input.__otp || "string" === typeof input.__otp); }; var _ao0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("number" === typeof input.code && !Number.isNaN(input.code) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".code",
expected: "number",
value: input.code
}, _errorFactory)) && ("string" === typeof input.message || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".message",
expected: "string",
value: input.message
}, _errorFactory)) && (("object" === typeof input.response && null !== input.response || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",