fake-iamport-server
Version:
Fake iamport server for testing
627 lines • 53.5 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.FakeIamportSubscribeCustomersController = 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_isFormatEmail = __importStar(require("typia/lib/internal/_isFormatEmail.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 uuid_1 = require("uuid");
var FakeIamportUserAuth_1 = require("../../decorators/FakeIamportUserAuth");
var FakeIamportResponseProvider_1 = require("../../providers/FakeIamportResponseProvider");
var FakeIamportStorage_1 = require("../../providers/FakeIamportStorage");
var AdvancedRandomGenerator_1 = require("../../utils/AdvancedRandomGenerator");
var FakeIamportSubscribeCustomersController = /** @class */ (function () {
function FakeIamportSubscribeCustomersController() {
}
/**
* 간편 결제 카드 정보 조회하기.
*
* `subscribe.customers.at` 은 고객이 {@link create} 나 혹은 아임포트가 제공하는
* 간편 결제 카드 등록 창을 이용하여 저장한 간편 결제 카드 정보를 조회하는 API
* 함수이다.
*
* @param customer_uid 고객 (간편 결제 카드) 식별자 키
* @returns 간편 결제 카드 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportSubscribeCustomersController.prototype.at = function (_user, customer_uid) {
// GET SUBSCRIPTION RECORD
var subscription = FakeIamportStorage_1.FakeIamportStorage.subscriptions.get(customer_uid);
// RETURNS
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(subscription);
};
/**
* 간편 결제 카드 등록하기.
*
* `subscribe.customers.stoer` 는 고객이 자신의 카드를 서버에 등록해두고, 매번 결제가
* 필요할 때마다 카드 정보를 반복 입력하는 일 없이, 간편하게 결제를 진행하고자 할 때
* 사용하는 API 함수이다.
*
* 참고로 `subscribe.customers.create` 는 클라이언트 어플리케이션이 아임포트가 제공하는
* 간편 결제 카드 등록 창을 사용하는 경우, 귀하의 백엔드 서버가 이를 실 서비스에서 호출하는
* 일은 없을 것이다. 다만, 고객이 간편 결제 카드를 등록하는 상황을 시뮬레이션하기 위하여,
* 테스트 자동화 프로그램 수준에서 사용될 수는 있다.
*
* @param customer_uid 고객 (간편 결제 카드) 식별자 키
* @param input 카드 입력 정보
* @returns 간편 결제 카드 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportSubscribeCustomersController.prototype.create = function (_user, customer_uid, input) {
// ENROLLMENT
var subscription = {
customer_uid: customer_uid,
pg_provider: "pg-of-somewhere",
pg_id: (0, uuid_1.v4)(),
card_type: "card",
card_code: (0, uuid_1.v4)(),
card_name: AdvancedRandomGenerator_1.AdvancedRandomGenerator.name(),
card_number: input.card_number,
customer_name: AdvancedRandomGenerator_1.AdvancedRandomGenerator.name(),
customer_tel: AdvancedRandomGenerator_1.AdvancedRandomGenerator.mobile(),
customer_addr: "address-of-somewhere",
customer_email: AdvancedRandomGenerator_1.AdvancedRandomGenerator.alphabets(8) + "@samchon.org",
customer_postcode: "11122",
inserted: 1,
updated: 0,
};
FakeIamportStorage_1.FakeIamportStorage.subscriptions.set(customer_uid, subscription);
// RETURNS
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(subscription);
};
/**
* 간편 결제 카드 삭제하기.
*
* 간편 결제를 위하여 등록한 카드를 제거한다.
*
* @param customer_uid 고객 (간편 결제 카드) 식별자 키
* @returns 삭제된 간편 결제 카드 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportSubscribeCustomersController.prototype.erase = function (_user, customer_uid) {
// ERASE RECORD
var subscription = FakeIamportStorage_1.FakeIamportStorage.subscriptions.get(customer_uid);
FakeIamportStorage_1.FakeIamportStorage.subscriptions.erase(customer_uid);
// RETURNS
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(subscription);
};
__decorate([
core_1.default.TypedRoute.Get(":customer_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.pg_provider && "string" === typeof input.pg_id && "string" === typeof input.card_name && "string" === typeof input.card_code && "string" === typeof input.card_number && "string" === typeof input.card_type && (null === input.customer_name || "string" === typeof input.customer_name) && (null === input.customer_tel || "string" === typeof input.customer_tel) && (null === input.customer_email || "string" === typeof input.customer_email) && (null === input.customer_addr || "string" === typeof input.customer_addr) && (null === input.customer_postcode || "string" === typeof input.customer_postcode) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted)) && ("number" === typeof input.updated && !Number.isNaN(input.updated)) && "string" === typeof input.customer_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.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: "IIamportSubscription",
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: "IIamportSubscription",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("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.pg_id || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".pg_id",
expected: "string",
value: input.pg_id
}, _errorFactory)) && ("string" === typeof input.card_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".card_name",
expected: "string",
value: input.card_name
}, _errorFactory)) && ("string" === typeof input.card_code || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".card_code",
expected: "string",
value: input.card_code
}, _errorFactory)) && ("string" === typeof input.card_number || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".card_number",
expected: "string",
value: input.card_number
}, _errorFactory)) && ("string" === typeof input.card_type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".card_type",
expected: "string",
value: input.card_type
}, _errorFactory)) && (null === input.customer_name || "string" === typeof input.customer_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_name",
expected: "(null | string)",
value: input.customer_name
}, _errorFactory)) && (null === input.customer_tel || "string" === typeof input.customer_tel || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_tel",
expected: "(null | string)",
value: input.customer_tel
}, _errorFactory)) && (null === input.customer_email || "string" === typeof input.customer_email || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_email",
expected: "(null | string)",
value: input.customer_email
}, _errorFactory)) && (null === input.customer_addr || "string" === typeof input.customer_addr || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_addr",
expected: "(null | string)",
value: input.customer_addr
}, _errorFactory)) && (null === input.customer_postcode || "string" === typeof input.customer_postcode || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_postcode",
expected: "(null | string)",
value: input.customer_postcode
}, _errorFactory)) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".inserted",
expected: "number",
value: input.inserted
}, _errorFactory)) && ("number" === typeof input.updated && !Number.isNaN(input.updated) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".updated",
expected: "number",
value: input.updated
}, _errorFactory)) && ("string" === typeof input.customer_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".customer_uid",
expected: "string",
value: input.customer_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 "{\"pg_provider\":".concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_provider), ",\"pg_id\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_id), ",\"card_name\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_name), ",\"card_code\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_code), ",\"card_number\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_number), ",\"card_type\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_type), ",\"customer_name\":").concat(null !== input.customer_name ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_name) : "null", ",\"customer_tel\":").concat(null !== input.customer_tel ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_tel) : "null", ",\"customer_email\":").concat(null !== input.customer_email ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_email) : "null", ",\"customer_addr\":").concat(null !== input.customer_addr ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_addr) : "null", ",\"customer_postcode\":").concat(null !== input.customer_postcode ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_postcode) : "null", ",\"inserted\":").concat(input.inserted, ",\"updated\":").concat(input.updated, ",\"customer_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_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.Get",
path: _path + "",
expected: "IIamportResponse<IIamportSubscription>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Get",
path: _path + "",
expected: "IIamportResponse<IIamportSubscription>",
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("customer_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)
], FakeIamportSubscribeCustomersController.prototype, "at", null);
__decorate([
core_1.default.TypedRoute.Post(":customer_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.pg_provider && "string" === typeof input.pg_id && "string" === typeof input.card_name && "string" === typeof input.card_code && "string" === typeof input.card_number && "string" === typeof input.card_type && (null === input.customer_name || "string" === typeof input.customer_name) && (null === input.customer_tel || "string" === typeof input.customer_tel) && (null === input.customer_email || "string" === typeof input.customer_email) && (null === input.customer_addr || "string" === typeof input.customer_addr) && (null === input.customer_postcode || "string" === typeof input.customer_postcode) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted)) && ("number" === typeof input.updated && !Number.isNaN(input.updated)) && "string" === typeof input.customer_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: "IIamportSubscription",
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: "IIamportSubscription",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("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.pg_id || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".pg_id",
expected: "string",
value: input.pg_id
}, _errorFactory)) && ("string" === typeof input.card_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".card_name",
expected: "string",
value: input.card_name
}, _errorFactory)) && ("string" === typeof input.card_code || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".card_code",
expected: "string",
value: input.card_code
}, _errorFactory)) && ("string" === typeof input.card_number || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".card_number",
expected: "string",
value: input.card_number
}, _errorFactory)) && ("string" === typeof input.card_type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".card_type",
expected: "string",
value: input.card_type
}, _errorFactory)) && (null === input.customer_name || "string" === typeof input.customer_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_name",
expected: "(null | string)",
value: input.customer_name
}, _errorFactory)) && (null === input.customer_tel || "string" === typeof input.customer_tel || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_tel",
expected: "(null | string)",
value: input.customer_tel
}, _errorFactory)) && (null === input.customer_email || "string" === typeof input.customer_email || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_email",
expected: "(null | string)",
value: input.customer_email
}, _errorFactory)) && (null === input.customer_addr || "string" === typeof input.customer_addr || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_addr",
expected: "(null | string)",
value: input.customer_addr
}, _errorFactory)) && (null === input.customer_postcode || "string" === typeof input.customer_postcode || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_postcode",
expected: "(null | string)",
value: input.customer_postcode
}, _errorFactory)) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".inserted",
expected: "number",
value: input.inserted
}, _errorFactory)) && ("number" === typeof input.updated && !Number.isNaN(input.updated) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".updated",
expected: "number",
value: input.updated
}, _errorFactory)) && ("string" === typeof input.customer_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".customer_uid",
expected: "string",
value: input.customer_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 "{\"pg_provider\":".concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_provider), ",\"pg_id\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_id), ",\"card_name\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_name), ",\"card_code\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_code), ",\"card_number\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_number), ",\"card_type\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_type), ",\"customer_name\":").concat(null !== input.customer_name ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_name) : "null", ",\"customer_tel\":").concat(null !== input.customer_tel ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_tel) : "null", ",\"customer_email\":").concat(null !== input.customer_email ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_email) : "null", ",\"customer_addr\":").concat(null !== input.customer_addr ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_addr) : "null", ",\"customer_postcode\":").concat(null !== input.customer_postcode ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_postcode) : "null", ",\"inserted\":").concat(input.inserted, ",\"updated\":").concat(input.updated, ",\"customer_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_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<IIamportSubscription>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportSubscription>",
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("customer_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.card_number && RegExp("\\d{4}-\\d{4}-\\d{4}-\\d{4}").test(input.card_number) && ("string" === typeof input.expiry && RegExp("^([0-9]{4})-(0[1-9]|1[012])$").test(input.expiry)) && ("string" === typeof input.birth && RegExp("^(([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))|(\\d{10})$").test(input.birth)) && (undefined === input.pwd_2digit || "string" === typeof input.pwd_2digit && RegExp("\\d{2}").test(input.pwd_2digit)) && (undefined === input.cvc || "string" === typeof input.cvc && RegExp("\\d{2}").test(input.cvc)) && (undefined === input.customer_name || "string" === typeof input.customer_name) && (undefined === input.customer_tel || "string" === typeof input.customer_tel) && (undefined === input.customer_email || "string" === typeof input.customer_email && __nestia_core_transform_isFormatEmail._isFormatEmail(input.customer_email)) && (undefined === input.customr_addr || "string" === typeof input.customr_addr) && (undefined === input.customer_postcode || "string" === typeof input.customer_postcode) && "string" === typeof input.customer_uid; }; var _vo0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ["string" === typeof input.card_number && (RegExp("\\d{4}-\\d{4}-\\d{4}-\\d{4}").test(input.card_number) || _report(_exceptionable, {
path: _path + ".card_number",
expected: "string & Pattern<\"\\\\d{4}-\\\\d{4}-\\\\d{4}-\\\\d{4}\">",
value: input.card_number
})) || _report(_exceptionable, {
path: _path + ".card_number",
expected: "(string & Pattern<\"\\\\d{4}-\\\\d{4}-\\\\d{4}-\\\\d{4}\">)",
value: input.card_number
}), "string" === typeof input.expiry && (RegExp("^([0-9]{4})-(0[1-9]|1[012])$").test(input.expiry) || _report(_exceptionable, {
path: _path + ".expiry",
expected: "string & Pattern<\"^([0-9]{4})-(0[1-9]|1[012])$\">",
value: input.expiry
})) || _report(_exceptionable, {
path: _path + ".expiry",
expected: "(string & Pattern<\"^([0-9]{4})-(0[1-9]|1[012])$\">)",
value: input.expiry
}), "string" === typeof input.birth && (RegExp("^(([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))|(\\d{10})$").test(input.birth) || _report(_exceptionable, {
path: _path + ".birth",
expected: "string & Pattern<\"^(([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))|(\\\\d{10})$\">",
value: input.birth
})) || _report(_exceptionable, {
path: _path + ".birth",
expected: "(string & Pattern<\"^(([0-9]{2})(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]))|(\\\\d{10})$\">)",
value: input.birth
}), undefined === input.pwd_2digit || "string" === typeof input.pwd_2digit && (RegExp("\\d{2}").test(input.pwd_2digit) || _report(_exceptionable, {
path: _path + ".pwd_2digit",
expected: "string & Pattern<\"\\\\d{2}\">",
value: input.pwd_2digit
})) || _report(_exceptionable, {
path: _path + ".pwd_2digit",
expected: "((string & Pattern<\"\\\\d{2}\">) | undefined)",
value: input.pwd_2digit
}), undefined === input.cvc || "string" === typeof input.cvc && (RegExp("\\d{2}").test(input.cvc) || _report(_exceptionable, {
path: _path + ".cvc",
expected: "string & Pattern<\"\\\\d{2}\">",
value: input.cvc
})) || _report(_exceptionable, {
path: _path + ".cvc",
expected: "((string & Pattern<\"\\\\d{2}\">) | undefined)",
value: input.cvc
}), undefined === input.customer_name || "string" === typeof input.customer_name || _report(_exceptionable, {
path: _path + ".customer_name",
expected: "(string | undefined)",
value: input.customer_name
}), undefined === input.customer_tel || "string" === typeof input.customer_tel || _report(_exceptionable, {
path: _path + ".customer_tel",
expected: "(string | undefined)",
value: input.customer_tel
}), undefined === input.customer_email || "string" === typeof input.customer_email && (__nestia_core_transform_isFormatEmail._isFormatEmail(input.customer_email) || _report(_exceptionable, {
path: _path + ".customer_email",
expected: "string & Format<\"email\">",
value: input.customer_email
})) || _report(_exceptionable, {
path: _path + ".customer_email",
expected: "((string & Format<\"email\">) | undefined)",
value: input.customer_email
}), undefined === input.customr_addr || "string" === typeof input.customr_addr || _report(_exceptionable, {
path: _path + ".customr_addr",
expected: "(string | undefined)",
value: input.customr_addr
}), undefined === input.customer_postcode || "string" === typeof input.customer_postcode || _report(_exceptionable, {
path: _path + ".customer_postcode",
expected: "(string | undefined)",
value: input.customer_postcode
}), "string" === typeof input.customer_uid || _report(_exceptionable, {
path: _path + ".customer_uid",
expected: "string",
value: input.customer_uid
})].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: "IIamportSubscription.ICreate",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IIamportSubscription.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, String, Object]),
__metadata("design:returntype", Object)
], FakeIamportSubscribeCustomersController.prototype, "create", null);
__decorate([
core_1.default.TypedRoute.Delete(":customer_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.pg_provider && "string" === typeof input.pg_id && "string" === typeof input.card_name && "string" === typeof input.card_code && "string" === typeof input.card_number && "string" === typeof input.card_type && (null === input.customer_name || "string" === typeof input.customer_name) && (null === input.customer_tel || "string" === typeof input.customer_tel) && (null === input.customer_email || "string" === typeof input.customer_email) && (null === input.customer_addr || "string" === typeof input.customer_addr) && (null === input.customer_postcode || "string" === typeof input.customer_postcode) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted)) && ("number" === typeof input.updated && !Number.isNaN(input.updated)) && "string" === typeof input.customer_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.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",
path: _path + ".response",
expected: "IIamportSubscription",
value: input.response
}, _errorFactory)) && _ao1(input.response, _path + ".response", true && _exceptionable) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".response",
expected: "IIamportSubscription",
value: input.response
}, _errorFactory));
}; var _ao1 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ("string" === typeof input.pg_provider || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".pg_provider",
expected: "string",
value: input.pg_provider
}, _errorFactory)) && ("string" === typeof input.pg_id || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".pg_id",
expected: "string",
value: input.pg_id
}, _errorFactory)) && ("string" === typeof input.card_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".card_name",
expected: "string",
value: input.card_name
}, _errorFactory)) && ("string" === typeof input.card_code || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".card_code",
expected: "string",
value: input.card_code
}, _errorFactory)) && ("string" === typeof input.card_number || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".card_number",
expected: "string",
value: input.card_number
}, _errorFactory)) && ("string" === typeof input.card_type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".card_type",
expected: "string",
value: input.card_type
}, _errorFactory)) && (null === input.customer_name || "string" === typeof input.customer_name || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_name",
expected: "(null | string)",
value: input.customer_name
}, _errorFactory)) && (null === input.customer_tel || "string" === typeof input.customer_tel || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_tel",
expected: "(null | string)",
value: input.customer_tel
}, _errorFactory)) && (null === input.customer_email || "string" === typeof input.customer_email || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_email",
expected: "(null | string)",
value: input.customer_email
}, _errorFactory)) && (null === input.customer_addr || "string" === typeof input.customer_addr || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_addr",
expected: "(null | string)",
value: input.customer_addr
}, _errorFactory)) && (null === input.customer_postcode || "string" === typeof input.customer_postcode || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_postcode",
expected: "(null | string)",
value: input.customer_postcode
}, _errorFactory)) && ("number" === typeof input.inserted && !Number.isNaN(input.inserted) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".inserted",
expected: "number",
value: input.inserted
}, _errorFactory)) && ("number" === typeof input.updated && !Number.isNaN(input.updated) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".updated",
expected: "number",
value: input.updated
}, _errorFactory)) && ("string" === typeof input.customer_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".customer_uid",
expected: "string",
value: input.customer_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 "{\"pg_provider\":".concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_provider), ",\"pg_id\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.pg_id), ",\"card_name\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_name), ",\"card_code\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_code), ",\"card_number\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_number), ",\"card_type\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.card_type), ",\"customer_name\":").concat(null !== input.customer_name ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_name) : "null", ",\"customer_tel\":").concat(null !== input.customer_tel ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_tel) : "null", ",\"customer_email\":").concat(null !== input.customer_email ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_email) : "null", ",\"customer_addr\":").concat(null !== input.customer_addr ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_addr) : "null", ",\"customer_postcode\":").concat(null !== input.customer_postcode ? __nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_postcode) : "null", ",\"inserted\":").concat(input.inserted, ",\"updated\":").concat(input.updated, ",\"customer_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.customer_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._assert