fake-iamport-server
Version:
Fake iamport server for testing
565 lines • 41.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.FakeIamportReceiptsController = void 0;
var __nestia_core_transform_isFormatUri = __importStar(require("typia/lib/internal/_isFormatUri.js"));
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 uuid_1 = require("uuid");
var FakeIamportUserAuth_1 = require("../decorators/FakeIamportUserAuth");
var FakeIamportResponseProvider_1 = require("../providers/FakeIamportResponseProvider");
var FakeIamportStorage_1 = require("../providers/FakeIamportStorage");
var FakeIamportReceiptsController = /** @class */ (function () {
function FakeIamportReceiptsController() {
}
/**
* 현금 영수증 조회하기.
*
* @param imp_uid 귀속 결제의 {@link IIamportPayment.imp_uid}
* @returns 현금 영수증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportReceiptsController.prototype.at = function (_user, imp_uid) {
var receipt = FakeIamportStorage_1.FakeIamportStorage.receipts.get(imp_uid);
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(receipt);
};
/**
* 현금 영수증 발행하기.
*
* @param imp_uid 귀속 결제의 {@link IIamportPayment.imp_uid}
* @param input 현금 영수증 입력 정보
* @returns 현금 영수증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportReceiptsController.prototype.create = function (_user, imp_uid, input) {
var payment = FakeIamportStorage_1.FakeIamportStorage.payments.get(imp_uid);
if (!payment.paid_at)
throw new common_1.UnprocessableEntityException("Not paid yet.");
else if (FakeIamportStorage_1.FakeIamportStorage.receipts.has(imp_uid) === true) {
var oldbie = FakeIamportStorage_1.FakeIamportStorage.receipts.get(imp_uid);
if (oldbie.cancelled_at === null)
throw new common_1.UnprocessableEntityException("Already issued.");
}
var receipt = {
imp_uid: imp_uid,
receipt_uid: (0, uuid_1.v4)(),
apply_num: (0, uuid_1.v4)(),
type: input.type || "person",
amount: payment.amount,
vat: payment.amount * 0.1,
receipt_url: "https://github.com/samchon/fake-iamport-server",
applied_at: Date.now() / 1000,
cancelled_at: 0,
};
FakeIamportStorage_1.FakeIamportStorage.receipts.set(imp_uid, receipt);
payment.cash_receipt_issue = true;
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(receipt);
};
/**
* 현금 영수증 취소하기.
*
* @param imp_uid 귀속 결제의 {@link IIamportPayment.imp_uid}
* @returns 취소된 현금 영수증 정보
*
* @security bearer
* @author Samchon
*/
FakeIamportReceiptsController.prototype.erase = function (_user, imp_uid) {
var payment = FakeIamportStorage_1.FakeIamportStorage.payments.get(imp_uid);
var receipt = FakeIamportStorage_1.FakeIamportStorage.receipts.get(imp_uid);
if (receipt.cancelled_at !== null)
throw new common_1.UnprocessableEntityException("Already cancelled.");
payment.cash_receipt_issue = false;
receipt.cancelled_at = Date.now() / 1000;
return FakeIamportResponseProvider_1.FakeIamportResponseProvider.success(receipt);
};
__decorate([
core_1.default.TypedRoute.Get({ 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 && "string" === typeof input.receipt_uid && "string" === typeof input.apply_num && ("person" === input.type || "company" === input.type) && ("number" === typeof input.amount && !Number.isNaN(input.amount)) && ("number" === typeof input.vat && !Number.isNaN(input.vat)) && ("string" === typeof input.receipt_url && __nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at)); }; 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: "IIamportReceipt",
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: "IIamportReceipt",
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)) && ("string" === typeof input.receipt_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".receipt_uid",
expected: "string",
value: input.receipt_uid
}, _errorFactory)) && ("string" === typeof input.apply_num || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".apply_num",
expected: "string",
value: input.apply_num
}, _errorFactory)) && ("person" === input.type || "company" === input.type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".type",
expected: "(\"company\" | \"person\")",
value: input.type
}, _errorFactory)) && ("number" === typeof input.amount && !Number.isNaN(input.amount) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".amount",
expected: "number",
value: input.amount
}, _errorFactory)) && ("number" === typeof input.vat && !Number.isNaN(input.vat) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".vat",
expected: "number",
value: input.vat
}, _errorFactory)) && ("string" === typeof input.receipt_url && (__nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".receipt_url",
expected: "string & Format<\"uri\">",
value: input.receipt_url
}, _errorFactory)) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".receipt_url",
expected: "(string & Format<\"uri\">)",
value: input.receipt_url
}, _errorFactory)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".applied_at",
expected: "number",
value: input.applied_at
}, _errorFactory)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Get",
path: _path + ".cancelled_at",
expected: "number",
value: input.cancelled_at
}, _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), ",\"receipt_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_uid), ",\"apply_num\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.apply_num), ",\"type\":").concat("\"" + input.type + "\"", ",\"amount\":").concat(input.amount, ",\"vat\":").concat(input.vat, ",\"receipt_url\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_url), ",\"applied_at\":").concat(input.applied_at, ",\"cancelled_at\":").concat(input.cancelled_at, "}"); }; 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<IIamportReceipt>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Get",
path: _path + "",
expected: "IIamportResponse<IIamportReceipt>",
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)
], FakeIamportReceiptsController.prototype, "at", null);
__decorate([
core_1.default.TypedRoute.Post({ 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 && "string" === typeof input.receipt_uid && "string" === typeof input.apply_num && ("person" === input.type || "company" === input.type) && ("number" === typeof input.amount && !Number.isNaN(input.amount)) && ("number" === typeof input.vat && !Number.isNaN(input.vat)) && ("string" === typeof input.receipt_url && __nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at)); }; 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: "IIamportReceipt",
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: "IIamportReceipt",
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)) && ("string" === typeof input.receipt_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".receipt_uid",
expected: "string",
value: input.receipt_uid
}, _errorFactory)) && ("string" === typeof input.apply_num || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".apply_num",
expected: "string",
value: input.apply_num
}, _errorFactory)) && ("person" === input.type || "company" === input.type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".type",
expected: "(\"company\" | \"person\")",
value: input.type
}, _errorFactory)) && ("number" === typeof input.amount && !Number.isNaN(input.amount) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".amount",
expected: "number",
value: input.amount
}, _errorFactory)) && ("number" === typeof input.vat && !Number.isNaN(input.vat) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".vat",
expected: "number",
value: input.vat
}, _errorFactory)) && ("string" === typeof input.receipt_url && (__nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".receipt_url",
expected: "string & Format<\"uri\">",
value: input.receipt_url
}, _errorFactory)) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".receipt_url",
expected: "(string & Format<\"uri\">)",
value: input.receipt_url
}, _errorFactory)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".applied_at",
expected: "number",
value: input.applied_at
}, _errorFactory)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Post",
path: _path + ".cancelled_at",
expected: "number",
value: input.cancelled_at
}, _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), ",\"receipt_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_uid), ",\"apply_num\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.apply_num), ",\"type\":").concat("\"" + input.type + "\"", ",\"amount\":").concat(input.amount, ",\"vat\":").concat(input.vat, ",\"receipt_url\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_url), ",\"applied_at\":").concat(input.applied_at, ",\"cancelled_at\":").concat(input.cancelled_at, "}"); }; 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<IIamportReceipt>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Post",
path: _path + "",
expected: "IIamportResponse<IIamportReceipt>",
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.imp_uid && "string" === typeof input.identifier && (undefined === input.identifier_type || "phone" === input.identifier_type || "person" === input.identifier_type || "business" === input.identifier_type || "taxcard" === input.identifier_type) && (undefined === input.type || "person" === input.type || "company" === input.type) && (undefined === input.buyer_name || "string" === typeof input.buyer_name) && (undefined === input.buyer_email || "string" === typeof input.buyer_email) && (undefined === input.buyer_tel || "string" === typeof input.buyer_tel) && (undefined === input.tax_free || "number" === typeof input.tax_free); }; var _vo0 = function (input, _path, _exceptionable) {
if (_exceptionable === void 0) { _exceptionable = true; }
return ["string" === typeof input.imp_uid || _report(_exceptionable, {
path: _path + ".imp_uid",
expected: "string",
value: input.imp_uid
}), "string" === typeof input.identifier || _report(_exceptionable, {
path: _path + ".identifier",
expected: "string",
value: input.identifier
}), undefined === input.identifier_type || "phone" === input.identifier_type || "person" === input.identifier_type || "business" === input.identifier_type || "taxcard" === input.identifier_type || _report(_exceptionable, {
path: _path + ".identifier_type",
expected: "(\"business\" | \"person\" | \"phone\" | \"taxcard\" | undefined)",
value: input.identifier_type
}), undefined === input.type || "person" === input.type || "company" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "(\"company\" | \"person\" | undefined)",
value: input.type
}), undefined === input.buyer_name || "string" === typeof input.buyer_name || _report(_exceptionable, {
path: _path + ".buyer_name",
expected: "(string | undefined)",
value: input.buyer_name
}), undefined === input.buyer_email || "string" === typeof input.buyer_email || _report(_exceptionable, {
path: _path + ".buyer_email",
expected: "(string | undefined)",
value: input.buyer_email
}), undefined === input.buyer_tel || "string" === typeof input.buyer_tel || _report(_exceptionable, {
path: _path + ".buyer_tel",
expected: "(string | undefined)",
value: input.buyer_tel
}), undefined === input.tax_free || "number" === typeof input.tax_free || _report(_exceptionable, {
path: _path + ".tax_free",
expected: "(number | undefined)",
value: input.tax_free
})].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: "IIamportReceipt.ICreate",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IIamportReceipt.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)
], FakeIamportReceiptsController.prototype, "create", null);
__decorate([
core_1.default.TypedRoute.Delete({ 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 && "string" === typeof input.receipt_uid && "string" === typeof input.apply_num && ("person" === input.type || "company" === input.type) && ("number" === typeof input.amount && !Number.isNaN(input.amount)) && ("number" === typeof input.vat && !Number.isNaN(input.vat)) && ("string" === typeof input.receipt_url && __nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at)); }; 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: "IIamportReceipt",
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: "IIamportReceipt",
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.Delete",
path: _path + ".imp_uid",
expected: "string",
value: input.imp_uid
}, _errorFactory)) && ("string" === typeof input.receipt_uid || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".receipt_uid",
expected: "string",
value: input.receipt_uid
}, _errorFactory)) && ("string" === typeof input.apply_num || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".apply_num",
expected: "string",
value: input.apply_num
}, _errorFactory)) && ("person" === input.type || "company" === input.type || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".type",
expected: "(\"company\" | \"person\")",
value: input.type
}, _errorFactory)) && ("number" === typeof input.amount && !Number.isNaN(input.amount) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".amount",
expected: "number",
value: input.amount
}, _errorFactory)) && ("number" === typeof input.vat && !Number.isNaN(input.vat) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".vat",
expected: "number",
value: input.vat
}, _errorFactory)) && ("string" === typeof input.receipt_url && (__nestia_core_transform_isFormatUri._isFormatUri(input.receipt_url) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".receipt_url",
expected: "string & Format<\"uri\">",
value: input.receipt_url
}, _errorFactory)) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".receipt_url",
expected: "(string & Format<\"uri\">)",
value: input.receipt_url
}, _errorFactory)) && ("number" === typeof input.applied_at && !Number.isNaN(input.applied_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".applied_at",
expected: "number",
value: input.applied_at
}, _errorFactory)) && ("number" === typeof input.cancelled_at && !Number.isNaN(input.cancelled_at) || __nestia_core_transform_assertGuard._assertGuard(_exceptionable, {
method: "core.TypedRoute.Delete",
path: _path + ".cancelled_at",
expected: "number",
value: input.cancelled_at
}, _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), ",\"receipt_uid\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_uid), ",\"apply_num\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.apply_num), ",\"type\":").concat("\"" + input.type + "\"", ",\"amount\":").concat(input.amount, ",\"vat\":").concat(input.vat, ",\"receipt_url\":").concat(__nestia_core_transform_jsonStringifyString._jsonStringifyString(input.receipt_url), ",\"applied_at\":").concat(input.applied_at, ",\"cancelled_at\":").concat(input.cancelled_at, "}"); }; 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.Delete",
path: _path + "",
expected: "IIamportResponse<IIamportReceipt>",
value: input
}, _errorFactory)) && _ao0(input, _path + "", true) || __nestia_core_transform_assertGuard._assertGuard(true, {
method: "core.TypedRoute.Delete",
path: _path + "",
expected: "IIamportResponse<IIamportReceipt>",
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", void 0)
], FakeIamportReceiptsController.prototype, "erase", null);
FakeIamportReceiptsController = __decorate([
(0, common_1.Controller)("receipts/:imp_uid")
], FakeIamportReceiptsController);
return FakeIamportReceiptsController;
}());
exports.FakeIamportReceiptsController = FakeIamportReceiptsController;
//# sourceMappingURL=FakeIamportReceiptsController.js.map