UNPKG

@chevre/domain

Version:

Chevre Domain Library for Node.js

42 lines (41 loc) 2.3 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fixOrderAsNeeded = fixOrderAsNeeded; const factory = require("../../../factory"); const publishConfirmationNumberIfNotExist_1 = require("../../transaction/placeOrder/publishConfirmationNumberIfNotExist"); const publishOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/publishOrderNumberIfNotExist"); function fixOrderAsNeeded(params) { return (repos) => __awaiter(this, void 0, void 0, function* () { const orderDate = new Date(); // publish always(2025-02-12~) // MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~) // let confirmationNumber: string | undefined; let confirmationNumber; // if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) { confirmationNumber = yield (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({ id: params.purpose.id, status: { $in: [factory.transactionStatusType.InProgress] }, object: { orderDate } })({ confirmationNumber: repos.confirmationNumber, transaction: repos.transaction }); // } // publish orderNumber(2025-02-14~) const orderNumber = yield (0, publishOrderNumberIfNotExist_1.publishOrderNumberIfNotExist)({ project: { id: params.project.id }, id: params.purpose.id, object: { orderDate } })(repos); return { confirmationNumber, orderNumber }; }); }