@chevre/domain 21.2.0-alpha.8 → 21.2.0-alpha.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/processReserve.ts +2 -1
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchSellers.ts +22 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -54
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +32 -25
- package/lib/chevre/repo/assetTransaction.d.ts +25 -9
- package/lib/chevre/repo/assetTransaction.js +237 -80
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -5
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +15 -19
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -4
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +120 -0
- package/lib/chevre/repo/order.d.ts +52 -2
- package/lib/chevre/repo/order.js +52 -4
- package/lib/chevre/repo/reservation.d.ts +8 -4
- package/lib/chevre/repo/reservation.js +8 -42
- package/lib/chevre/repo/seller.js +19 -19
- package/lib/chevre/repo/task.d.ts +42 -2
- package/lib/chevre/repo/task.js +90 -9
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -54
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.js +10 -25
- package/lib/chevre/service/assetTransaction/refund.js +1 -23
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.js +24 -20
- package/lib/chevre/service/assetTransaction/reserve.d.ts +7 -1
- package/lib/chevre/service/assetTransaction/reserve.js +35 -40
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- package/lib/chevre/service/event.js +3 -1
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +1 -0
- package/lib/chevre/service/offer/event/authorize.js +5 -2
- package/lib/chevre/service/offer/event/factory.d.ts +2 -0
- package/lib/chevre/service/offer/event/factory.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -48
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -5
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.js +60 -10
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +12 -25
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +4 -3
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.d.ts +4 -2
- package/lib/chevre/service/reserve/cancelReservation.js +2 -4
- package/lib/chevre/service/reserve/checkInReservation.d.ts +0 -3
- package/lib/chevre/service/reserve/checkInReservation.js +24 -0
- package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -0
- package/lib/chevre/service/reserve/confirmReservation.js +45 -9
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +20 -20
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +4 -3
- package/lib/chevre/service/reserve/useReservation.js +14 -71
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
- package/lib/chevre/service/reserve.d.ts +2 -1
- package/lib/chevre/service/reserve.js +3 -1
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +101 -0
- package/lib/chevre/service/task/reserve.js +5 -6
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/useReservation.d.ts +7 -0
- package/lib/chevre/service/task/{deleteOrder.js → useReservation.js} +11 -12
- package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +225 -35
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +4 -1
- package/lib/chevre/settings.js +15 -5
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
|
@@ -15,7 +15,6 @@ exports.exportTasksById = exports.cancel = exports.confirm = exports.start = voi
|
|
|
15
15
|
*/
|
|
16
16
|
const moment = require("moment");
|
|
17
17
|
const factory = require("../../factory");
|
|
18
|
-
const settings_1 = require("../../settings");
|
|
19
18
|
const pecorinoapi = require("../../pecorinoapi");
|
|
20
19
|
// import { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
21
20
|
const MoneyTransferService = require("../moneyTransfer");
|
|
@@ -360,27 +359,6 @@ function exportTasksById(params) {
|
|
|
360
359
|
});
|
|
361
360
|
const potentialActions = transaction.potentialActions;
|
|
362
361
|
const taskAttributes = [];
|
|
363
|
-
// 資産取引削除タスクを作成
|
|
364
|
-
const deleteTransactionTask = {
|
|
365
|
-
project: transaction.project,
|
|
366
|
-
name: factory.taskName.DeleteAssetTransaction,
|
|
367
|
-
status: factory.taskStatus.Ready,
|
|
368
|
-
runsAt: moment(transaction.endDate)
|
|
369
|
-
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
370
|
-
.toDate(),
|
|
371
|
-
remainingNumberOfTries: 3,
|
|
372
|
-
numberOfTried: 0,
|
|
373
|
-
executionResults: [],
|
|
374
|
-
data: {
|
|
375
|
-
object: {
|
|
376
|
-
project: transaction.project,
|
|
377
|
-
id: transaction.id,
|
|
378
|
-
transactionNumber: transaction.transactionNumber,
|
|
379
|
-
typeOf: transaction.typeOf
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
taskAttributes.push(deleteTransactionTask);
|
|
384
362
|
// タスク実行日時バッファの指定があれば調整
|
|
385
363
|
let taskRunsAt = new Date();
|
|
386
364
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -430,7 +408,7 @@ function exportTasksById(params) {
|
|
|
430
408
|
default:
|
|
431
409
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
432
410
|
}
|
|
433
|
-
return repos.task.saveMany(taskAttributes);
|
|
411
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
434
412
|
});
|
|
435
413
|
}
|
|
436
414
|
exports.exportTasksById = exportTasksById;
|
|
@@ -126,8 +126,9 @@ function createPayObjectServiceOutput(params) {
|
|
|
126
126
|
if (Array.isArray(movieTickets)) {
|
|
127
127
|
paymentServiceOutput = movieTickets.map((movieTicket) => {
|
|
128
128
|
var _a;
|
|
129
|
+
const amount = movieTicket2amount(transaction, movieTicket);
|
|
129
130
|
const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
|
|
130
|
-
return Object.assign({ identifier: movieTicket.identifier }, (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
131
|
+
return Object.assign(Object.assign({ identifier: movieTicket.identifier }, (typeof (amount === null || amount === void 0 ? void 0 : amount.value) === 'number') ? { amount } : undefined), (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
131
132
|
? {
|
|
132
133
|
serviceOutput: reservation4invoice
|
|
133
134
|
}
|
|
@@ -140,6 +141,21 @@ function createPayObjectServiceOutput(params) {
|
|
|
140
141
|
}
|
|
141
142
|
return paymentServiceOutput;
|
|
142
143
|
}
|
|
144
|
+
function movieTicket2amount(transaction, movieTicket) {
|
|
145
|
+
var _a;
|
|
146
|
+
let amount;
|
|
147
|
+
const accountsReceivables = transaction.object.accountsReceivablesByServiceType;
|
|
148
|
+
if (Array.isArray(accountsReceivables)) {
|
|
149
|
+
const accountsReceivable = (_a = accountsReceivables.find((a) => a.serviceType === movieTicket.serviceType)) === null || _a === void 0 ? void 0 : _a.accountsReceivable;
|
|
150
|
+
if (typeof accountsReceivable === 'number') {
|
|
151
|
+
amount = {
|
|
152
|
+
typeOf: 'MonetaryAmount',
|
|
153
|
+
value: accountsReceivable
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return amount;
|
|
158
|
+
}
|
|
143
159
|
function reservationPriceComponent2invoicePriceComponent(component) {
|
|
144
160
|
var _a;
|
|
145
161
|
const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
|
|
@@ -272,16 +272,22 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId) {
|
|
|
272
272
|
}
|
|
273
273
|
function processAuthorizeMovieTicket(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay) {
|
|
274
274
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
const { accountId,
|
|
275
|
+
const { accountId, payAction, accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, useCheckMovieTicketBeforePay)(repos);
|
|
276
276
|
return saveAuthorizeResult({
|
|
277
277
|
id: transaction.id,
|
|
278
|
-
update:
|
|
278
|
+
update: {
|
|
279
|
+
'object.accountId': accountId,
|
|
280
|
+
'object.paymentMethod.accountId': accountId,
|
|
281
|
+
'object.payAction': payAction,
|
|
282
|
+
// 認証レスポンスより計上金額を保管(2023-05-15~)
|
|
283
|
+
'object.accountsReceivablesByServiceType': accountsReceivablesByServiceType
|
|
284
|
+
}
|
|
279
285
|
})(repos);
|
|
280
286
|
});
|
|
281
287
|
}
|
|
282
288
|
function saveAuthorizeResult(params) {
|
|
283
289
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
284
|
-
return repos.assetTransaction.
|
|
290
|
+
return repos.assetTransaction.findByIdAndUpdateInProgress(params);
|
|
285
291
|
});
|
|
286
292
|
}
|
|
287
293
|
/**
|
|
@@ -393,27 +399,6 @@ function exportTasksById(params) {
|
|
|
393
399
|
});
|
|
394
400
|
const potentialActions = transaction.potentialActions;
|
|
395
401
|
const taskAttributes = [];
|
|
396
|
-
// 資産取引削除タスクを作成
|
|
397
|
-
const deleteTransactionTask = {
|
|
398
|
-
project: transaction.project,
|
|
399
|
-
name: factory.taskName.DeleteAssetTransaction,
|
|
400
|
-
status: factory.taskStatus.Ready,
|
|
401
|
-
runsAt: moment(transaction.endDate)
|
|
402
|
-
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
403
|
-
.toDate(),
|
|
404
|
-
remainingNumberOfTries: 3,
|
|
405
|
-
numberOfTried: 0,
|
|
406
|
-
executionResults: [],
|
|
407
|
-
data: {
|
|
408
|
-
object: {
|
|
409
|
-
project: transaction.project,
|
|
410
|
-
id: transaction.id,
|
|
411
|
-
transactionNumber: transaction.transactionNumber,
|
|
412
|
-
typeOf: transaction.typeOf
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
taskAttributes.push(deleteTransactionTask);
|
|
417
402
|
// タスク実行日時バッファの指定があれば調整
|
|
418
403
|
let taskRunsAt = new Date();
|
|
419
404
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -470,7 +455,7 @@ function exportTasksById(params) {
|
|
|
470
455
|
default:
|
|
471
456
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
472
457
|
}
|
|
473
|
-
return repos.task.saveMany(taskAttributes);
|
|
458
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
474
459
|
});
|
|
475
460
|
}
|
|
476
461
|
exports.exportTasksById = exportTasksById;
|
|
@@ -15,7 +15,6 @@ exports.exportTasksById = exports.cancel = exports.confirm = exports.start = voi
|
|
|
15
15
|
*/
|
|
16
16
|
const moment = require("moment");
|
|
17
17
|
const factory = require("../../factory");
|
|
18
|
-
const settings_1 = require("../../settings");
|
|
19
18
|
const factory_1 = require("./refund/factory");
|
|
20
19
|
const potentialActions_1 = require("./refund/potentialActions");
|
|
21
20
|
/**
|
|
@@ -160,27 +159,6 @@ function exportTasksById(params) {
|
|
|
160
159
|
});
|
|
161
160
|
const potentialActions = transaction.potentialActions;
|
|
162
161
|
const taskAttributes = [];
|
|
163
|
-
// 資産取引削除タスクを作成
|
|
164
|
-
const deleteTransactionTask = {
|
|
165
|
-
project: transaction.project,
|
|
166
|
-
name: factory.taskName.DeleteAssetTransaction,
|
|
167
|
-
status: factory.taskStatus.Ready,
|
|
168
|
-
runsAt: moment(transaction.endDate)
|
|
169
|
-
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
170
|
-
.toDate(),
|
|
171
|
-
remainingNumberOfTries: 3,
|
|
172
|
-
numberOfTried: 0,
|
|
173
|
-
executionResults: [],
|
|
174
|
-
data: {
|
|
175
|
-
object: {
|
|
176
|
-
project: transaction.project,
|
|
177
|
-
id: transaction.id,
|
|
178
|
-
transactionNumber: transaction.transactionNumber,
|
|
179
|
-
typeOf: transaction.typeOf
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
taskAttributes.push(deleteTransactionTask);
|
|
184
162
|
// タスク実行日時バッファの指定があれば調整
|
|
185
163
|
let taskRunsAt = new Date();
|
|
186
164
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -218,7 +196,7 @@ function exportTasksById(params) {
|
|
|
218
196
|
default:
|
|
219
197
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
220
198
|
}
|
|
221
|
-
return repos.task.saveMany(taskAttributes);
|
|
199
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
222
200
|
});
|
|
223
201
|
}
|
|
224
202
|
exports.exportTasksById = exportTasksById;
|
|
@@ -13,10 +13,8 @@ exports.exportTasksById = exports.cancel = exports.confirm = exports.start = voi
|
|
|
13
13
|
/**
|
|
14
14
|
* サービス登録取引サービス
|
|
15
15
|
*/
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const pecorinoapi = require("../../pecorinoapi");
|
|
18
17
|
const factory = require("../../factory");
|
|
19
|
-
const settings_1 = require("../../settings");
|
|
20
18
|
const searchProductOffers_1 = require("../offer/product/searchProductOffers");
|
|
21
19
|
const factory_1 = require("./registerService/factory");
|
|
22
20
|
const potentialActions_1 = require("./registerService/potentialActions");
|
|
@@ -230,27 +228,6 @@ function exportTasksById(params) {
|
|
|
230
228
|
});
|
|
231
229
|
const potentialActions = transaction.potentialActions;
|
|
232
230
|
const taskAttributes = [];
|
|
233
|
-
// 資産取引削除タスクを作成
|
|
234
|
-
const deleteTransactionTask = {
|
|
235
|
-
project: transaction.project,
|
|
236
|
-
name: factory.taskName.DeleteAssetTransaction,
|
|
237
|
-
status: factory.taskStatus.Ready,
|
|
238
|
-
runsAt: moment(transaction.endDate)
|
|
239
|
-
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
240
|
-
.toDate(),
|
|
241
|
-
remainingNumberOfTries: 3,
|
|
242
|
-
numberOfTried: 0,
|
|
243
|
-
executionResults: [],
|
|
244
|
-
data: {
|
|
245
|
-
object: {
|
|
246
|
-
project: transaction.project,
|
|
247
|
-
id: transaction.id,
|
|
248
|
-
transactionNumber: transaction.transactionNumber,
|
|
249
|
-
typeOf: transaction.typeOf
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
taskAttributes.push(deleteTransactionTask);
|
|
254
231
|
const taskRunsAt = new Date();
|
|
255
232
|
switch (transaction.status) {
|
|
256
233
|
case factory.transactionStatusType.Confirmed:
|
|
@@ -301,8 +278,7 @@ function exportTasksById(params) {
|
|
|
301
278
|
default:
|
|
302
279
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
303
280
|
}
|
|
304
|
-
return repos.task.saveMany(taskAttributes);
|
|
305
|
-
// return Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
|
|
281
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
306
282
|
});
|
|
307
283
|
}
|
|
308
284
|
exports.exportTasksById = exportTasksById;
|
|
@@ -4,6 +4,7 @@ type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservat
|
|
|
4
4
|
export { IAcceptedAddOn };
|
|
5
5
|
export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
6
6
|
reservationNumber: string;
|
|
7
|
+
disablePendingReservations: boolean;
|
|
7
8
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve>;
|
|
8
9
|
/**
|
|
9
10
|
* ポイント特典を作成する
|
|
@@ -70,8 +71,11 @@ export declare function createReservation(params: {
|
|
|
70
71
|
}): IObjectSubReservation;
|
|
71
72
|
export declare function createPotentialActions(params: factory.assetTransaction.reserve.IConfirmParams & {
|
|
72
73
|
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
73
|
-
order?: factory.order.IOrder
|
|
74
|
-
}):
|
|
74
|
+
order?: Pick<factory.order.IOrder, 'orderNumber' | 'customer' | 'typeOf'>;
|
|
75
|
+
}): {
|
|
76
|
+
potentialActions: factory.assetTransaction.reserve.IPotentialActions;
|
|
77
|
+
reservationPackage?: factory.action.reserve.IReservationPackageAsObject;
|
|
78
|
+
};
|
|
75
79
|
export declare function createPendingReservationAction(params: {
|
|
76
80
|
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
77
81
|
}): factory.action.cancel.reservation.IAttributes[];
|
|
@@ -12,8 +12,8 @@ function createStartParams(params) {
|
|
|
12
12
|
var _a;
|
|
13
13
|
const reservationNumber = params.reservationNumber;
|
|
14
14
|
const reservationPackage = Object.assign({
|
|
15
|
-
//
|
|
16
|
-
|
|
15
|
+
// project: params.project,
|
|
16
|
+
reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, disablePendingReservations: params.disablePendingReservations, typeOf: factory.reservationType.ReservationPackage }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined);
|
|
17
17
|
return {
|
|
18
18
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
19
19
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -448,6 +448,7 @@ function createPotentialActions(params) {
|
|
|
448
448
|
// 予約アクション属性作成
|
|
449
449
|
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
450
450
|
let reserveActionAttributes = [];
|
|
451
|
+
let reservationPackage;
|
|
451
452
|
if (pendingReservations.length > 0) {
|
|
452
453
|
// ReservationPackageに対応(2022-12-22~)
|
|
453
454
|
let underName;
|
|
@@ -467,7 +468,9 @@ function createPotentialActions(params) {
|
|
|
467
468
|
underName
|
|
468
469
|
}));
|
|
469
470
|
});
|
|
470
|
-
|
|
471
|
+
reservationPackage = Object.assign({ reservationFor, reservationNumber: transaction.object.reservationNumber, reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
|
|
472
|
+
? params.transaction.object.reservationStatus
|
|
473
|
+
: factory.reservationStatusType.ReservationPending,
|
|
471
474
|
// 不要なので廃止(2023-01-19~)
|
|
472
475
|
// subReservation: pendingReservations,
|
|
473
476
|
typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string') ? { underName } : undefined);
|
|
@@ -484,7 +487,10 @@ function createPotentialActions(params) {
|
|
|
484
487
|
}];
|
|
485
488
|
}
|
|
486
489
|
return {
|
|
487
|
-
|
|
490
|
+
potentialActions: {
|
|
491
|
+
reserve: reserveActionAttributes
|
|
492
|
+
},
|
|
493
|
+
reservationPackage
|
|
488
494
|
};
|
|
489
495
|
}
|
|
490
496
|
exports.createPotentialActions = createPotentialActions;
|
|
@@ -503,15 +509,11 @@ function createReservationUnderName(params) {
|
|
|
503
509
|
*/
|
|
504
510
|
function ordre2reservationUnderName(params) {
|
|
505
511
|
return {
|
|
506
|
-
// issuedBy: {
|
|
507
|
-
// typeOf: params.order.seller.typeOf,
|
|
508
|
-
// name: params.order.seller.name
|
|
509
|
-
// },
|
|
510
512
|
underName: createReservationUnderName({ order: params.order })
|
|
511
513
|
};
|
|
512
514
|
}
|
|
513
515
|
function createMoneyTransferActions(params) {
|
|
514
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
515
517
|
const pointAward = (_b = (_a = params.acceptedOffer) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.pointAward;
|
|
516
518
|
const moneyTransfer = [];
|
|
517
519
|
// ポイント特典があれば適用
|
|
@@ -524,30 +526,30 @@ function createMoneyTransferActions(params) {
|
|
|
524
526
|
typeOf: (typeof ((_f = params.reservation.reservedTicket.issuedBy) === null || _f === void 0 ? void 0 : _f.typeOf) === 'string')
|
|
525
527
|
? params.reservation.reservedTicket.issuedBy.typeOf
|
|
526
528
|
: params.transaction.typeOf,
|
|
527
|
-
name: (typeof ((
|
|
529
|
+
name: (typeof ((_g = params.reservation.reservedTicket.issuedBy) === null || _g === void 0 ? void 0 : _g.name) === 'string')
|
|
528
530
|
? params.reservation.reservedTicket.issuedBy.name
|
|
529
531
|
: params.transaction.id
|
|
530
532
|
};
|
|
531
533
|
const toLocation = {
|
|
532
534
|
identifier: pointAwardToLocationIdentifier,
|
|
533
535
|
typeOf: factory.permit.PermitType.Permit,
|
|
534
|
-
issuedThrough: { id: String((
|
|
536
|
+
issuedThrough: { id: String((_j = (_h = pointAward.toLocation) === null || _h === void 0 ? void 0 : _h.issuedThrough) === null || _j === void 0 ? void 0 : _j.id) }
|
|
535
537
|
};
|
|
536
538
|
const recipient = {
|
|
537
|
-
typeOf: (typeof ((
|
|
538
|
-
? (
|
|
539
|
+
typeOf: (typeof ((_k = params.underName) === null || _k === void 0 ? void 0 : _k.typeOf) === 'string')
|
|
540
|
+
? (_l = params.underName) === null || _l === void 0 ? void 0 : _l.typeOf
|
|
539
541
|
: factory.personType.Person,
|
|
540
|
-
id: (typeof ((
|
|
541
|
-
? (
|
|
542
|
+
id: (typeof ((_m = params.underName) === null || _m === void 0 ? void 0 : _m.id) === 'string')
|
|
543
|
+
? (_o = params.underName) === null || _o === void 0 ? void 0 : _o.id
|
|
542
544
|
: '',
|
|
543
|
-
name: String((
|
|
545
|
+
name: String((_p = params.underName) === null || _p === void 0 ? void 0 : _p.name)
|
|
544
546
|
};
|
|
545
547
|
moneyTransfer.push(Object.assign(Object.assign({ project: params.transaction.project, typeOf: factory.actionType.MoneyTransfer, agent: params.transaction.project, recipient, object: {
|
|
546
548
|
typeOf: factory.account.transactionType.Deposit
|
|
547
|
-
}, purpose: Object.assign({ typeOf: params.transaction.typeOf, id: params.transaction.id }, (typeof ((
|
|
549
|
+
}, purpose: Object.assign({ typeOf: params.transaction.typeOf, id: params.transaction.id }, (typeof ((_q = pointAward.purpose) === null || _q === void 0 ? void 0 : _q.identifier) === 'string') ? { identifier: pointAward.purpose.identifier } : undefined), amount: {
|
|
548
550
|
typeOf: 'MonetaryAmount',
|
|
549
|
-
value: (
|
|
550
|
-
currency: (
|
|
551
|
+
value: (_r = pointAward.amount) === null || _r === void 0 ? void 0 : _r.value,
|
|
552
|
+
currency: (_s = pointAward.amount) === null || _s === void 0 ? void 0 : _s.currency
|
|
551
553
|
}, fromLocation: fromLocation, toLocation: toLocation }, (typeof pointAward.description === 'string') ? { description: pointAward.description } : undefined), (pointAward.recipient !== undefined) ? { recipient: pointAward.recipient } : undefined));
|
|
552
554
|
}
|
|
553
555
|
return moneyTransfer;
|
|
@@ -566,7 +568,9 @@ function createPendingReservationAction(params) {
|
|
|
566
568
|
typeOf: factory.reservationType.ReservationPackage,
|
|
567
569
|
reservationNumber: transaction.transactionNumber,
|
|
568
570
|
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
569
|
-
reservationStatus:
|
|
571
|
+
reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
|
|
572
|
+
? params.transaction.object.reservationStatus
|
|
573
|
+
: factory.reservationStatusType.ReservationPending
|
|
570
574
|
};
|
|
571
575
|
cancelActionAttributes = [{
|
|
572
576
|
project: transaction.project,
|
|
@@ -62,6 +62,7 @@ interface IConfirmRepo {
|
|
|
62
62
|
task: TaskRepo;
|
|
63
63
|
}
|
|
64
64
|
export type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
|
|
65
|
+
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
65
66
|
type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
66
67
|
/**
|
|
67
68
|
* 承認アクションを介した場合に検索済のイベント
|
|
@@ -94,7 +95,12 @@ type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail &
|
|
|
94
95
|
/**
|
|
95
96
|
* 取引開始
|
|
96
97
|
*/
|
|
97
|
-
export declare function start(params: IStartParams
|
|
98
|
+
export declare function start(params: IStartParams & {
|
|
99
|
+
disablePendingReservations: boolean;
|
|
100
|
+
}): IStartOperation<{
|
|
101
|
+
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
102
|
+
objectSubReservations: IObjectSubReservation[];
|
|
103
|
+
}>;
|
|
98
104
|
/**
|
|
99
105
|
* 取引確定
|
|
100
106
|
*/
|
|
@@ -63,9 +63,10 @@ function start(params) {
|
|
|
63
63
|
catch (error) {
|
|
64
64
|
throw error;
|
|
65
65
|
}
|
|
66
|
+
let objectSubReservations = [];
|
|
66
67
|
// 指定があれば予約追加
|
|
67
68
|
if (typeof ((_d = params.object.reservationFor) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
|
|
68
|
-
|
|
69
|
+
const addReservationsResult = yield addReservations({
|
|
69
70
|
id: transaction.id,
|
|
70
71
|
object: params.object,
|
|
71
72
|
event,
|
|
@@ -74,8 +75,10 @@ function start(params) {
|
|
|
74
75
|
availableAtOrFrom: { id: (_e = params.availableAtOrFrom) === null || _e === void 0 ? void 0 : _e.id },
|
|
75
76
|
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
|
|
76
77
|
})(repos);
|
|
78
|
+
transaction = addReservationsResult.transaction;
|
|
79
|
+
objectSubReservations = addReservationsResult.objectSubReservations;
|
|
77
80
|
}
|
|
78
|
-
return transaction;
|
|
81
|
+
return { transaction, objectSubReservations };
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
exports.start = start;
|
|
@@ -132,6 +135,20 @@ function addReservations(params) {
|
|
|
132
135
|
})(repos);
|
|
133
136
|
// 予約イベント最適化
|
|
134
137
|
const reservationFor = (0, factory_1.createReservationFor)(event);
|
|
138
|
+
// const minimizedObjectSubReservations: factory.assetTransaction.reserve.IMinimizedObjectSubReservation[] =
|
|
139
|
+
// objectSubReservations.map((r) => {
|
|
140
|
+
// return {
|
|
141
|
+
// id: r.id,
|
|
142
|
+
// typeOf: r.typeOf,
|
|
143
|
+
// reservedTicket: {
|
|
144
|
+
// ticketType: r.reservedTicket.ticketType,
|
|
145
|
+
// ...(typeof r.reservedTicket.ticketedSeat?.typeOf === 'string')
|
|
146
|
+
// ? { ticketedSeat: r.reservedTicket.ticketedSeat }
|
|
147
|
+
// : undefined
|
|
148
|
+
// },
|
|
149
|
+
// ...(Array.isArray(r.subReservation)) ? { subReservation: r.subReservation } : undefined
|
|
150
|
+
// };
|
|
151
|
+
// });
|
|
135
152
|
// 取引に予約追加
|
|
136
153
|
let lockedOfferRateLimitKeys = [];
|
|
137
154
|
try {
|
|
@@ -140,12 +157,11 @@ function addReservations(params) {
|
|
|
140
157
|
typeOf: factory.assetTransactionType.Reserve,
|
|
141
158
|
id: transaction.id,
|
|
142
159
|
object: {
|
|
143
|
-
project: transaction.project,
|
|
144
160
|
acceptedOffer: acceptedOffers4transactionObject,
|
|
145
161
|
reservationFor,
|
|
146
162
|
// subReservationにreservationForを保管しない(2021-10-19~)
|
|
147
|
-
subReservation: objectSubReservations
|
|
148
|
-
|
|
163
|
+
subReservation: objectSubReservations
|
|
164
|
+
// subReservation: minimizedObjectSubReservations
|
|
149
165
|
}
|
|
150
166
|
});
|
|
151
167
|
}
|
|
@@ -164,11 +180,13 @@ function addReservations(params) {
|
|
|
164
180
|
reservations: objectSubReservations,
|
|
165
181
|
transaction: transaction
|
|
166
182
|
})(repos);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
183
|
+
if (transaction.object.disablePendingReservations !== true) {
|
|
184
|
+
// 予約作成(insertManyで実装)
|
|
185
|
+
yield repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
186
|
+
}
|
|
187
|
+
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
170
188
|
yield onReservationsCreated({ event })(repos);
|
|
171
|
-
return transaction;
|
|
189
|
+
return { transaction, objectSubReservations };
|
|
172
190
|
});
|
|
173
191
|
}
|
|
174
192
|
/**
|
|
@@ -680,6 +698,7 @@ function onReservationsCreated(params) {
|
|
|
680
698
|
*/
|
|
681
699
|
function confirm(params) {
|
|
682
700
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
701
|
+
var _a;
|
|
683
702
|
let transaction;
|
|
684
703
|
// 取引存在確認
|
|
685
704
|
if (typeof params.id === 'string') {
|
|
@@ -698,17 +717,14 @@ function confirm(params) {
|
|
|
698
717
|
throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
699
718
|
}
|
|
700
719
|
const order = yield fixOrderAsPurpose(params, transaction)(repos);
|
|
701
|
-
const potentialActions = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction: transaction, order }));
|
|
720
|
+
const { potentialActions, reservationPackage } = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction: transaction, order }));
|
|
702
721
|
// 取引確定
|
|
703
722
|
const result = {};
|
|
704
|
-
yield repos.assetTransaction.confirm({
|
|
705
|
-
typeOf: factory.assetTransactionType.Reserve,
|
|
706
|
-
id: transaction.id,
|
|
707
|
-
result: result,
|
|
708
|
-
potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
723
|
+
yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Reserve, id: transaction.id, result: result, potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
709
724
|
? { reserve: [] }
|
|
710
|
-
: potentialActions
|
|
711
|
-
|
|
725
|
+
: potentialActions }, (typeof ((_a = reservationPackage === null || reservationPackage === void 0 ? void 0 : reservationPackage.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
726
|
+
? { object: { underName: reservationPackage.underName } }
|
|
727
|
+
: undefined));
|
|
712
728
|
if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
713
729
|
// sync対応(2023-01-13~)
|
|
714
730
|
yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
|
|
@@ -732,7 +748,7 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
732
748
|
project: { id: { $eq: transaction.project.id } },
|
|
733
749
|
confirmationNumbers: [payPurposeConfirmationNumber],
|
|
734
750
|
orderNumbers: [payPurposeOrderNumber]
|
|
735
|
-
});
|
|
751
|
+
}, { customer: 1, orderNumber: 1, typeOf: 1 });
|
|
736
752
|
order = orders.shift();
|
|
737
753
|
if (order === undefined) {
|
|
738
754
|
throw new factory.errors.NotFound('Order as purpose');
|
|
@@ -773,27 +789,6 @@ function exportTasksById(params) {
|
|
|
773
789
|
});
|
|
774
790
|
const potentialActions = transaction.potentialActions;
|
|
775
791
|
const taskAttributes = [];
|
|
776
|
-
// 資産取引削除タスクを作成
|
|
777
|
-
const deleteTransactionTask = {
|
|
778
|
-
project: transaction.project,
|
|
779
|
-
name: factory.taskName.DeleteAssetTransaction,
|
|
780
|
-
status: factory.taskStatus.Ready,
|
|
781
|
-
runsAt: moment(transaction.endDate)
|
|
782
|
-
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
783
|
-
.toDate(),
|
|
784
|
-
remainingNumberOfTries: 3,
|
|
785
|
-
numberOfTried: 0,
|
|
786
|
-
executionResults: [],
|
|
787
|
-
data: {
|
|
788
|
-
object: {
|
|
789
|
-
project: transaction.project,
|
|
790
|
-
id: transaction.id,
|
|
791
|
-
transactionNumber: transaction.transactionNumber,
|
|
792
|
-
typeOf: transaction.typeOf
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
taskAttributes.push(deleteTransactionTask);
|
|
797
792
|
switch (transaction.status) {
|
|
798
793
|
case factory.transactionStatusType.Confirmed:
|
|
799
794
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -860,7 +855,7 @@ function exportTasksById(params) {
|
|
|
860
855
|
default:
|
|
861
856
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
862
857
|
}
|
|
863
|
-
return repos.task.saveMany(taskAttributes);
|
|
858
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
864
859
|
});
|
|
865
860
|
}
|
|
866
861
|
exports.exportTasksById = exportTasksById;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../factory';
|
|
5
5
|
import { MongoRepository as AssetTransactionRepo } from '../repo/assetTransaction';
|
|
6
|
-
import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
7
6
|
import { MongoRepository as TaskRepo } from '../repo/task';
|
|
8
7
|
import * as CancelReservationTransactionService from './assetTransaction/cancelReservation';
|
|
9
8
|
import * as MoneyTransferTransactionService from './assetTransaction/moneyTransfer';
|
|
@@ -29,8 +28,13 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
|
|
|
29
28
|
typeOf?: {
|
|
30
29
|
$in: T[];
|
|
31
30
|
};
|
|
31
|
+
id?: string;
|
|
32
|
+
tasksExportAction?: {
|
|
33
|
+
agent: {
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
32
37
|
}): (repos: {
|
|
33
|
-
project: ProjectRepo;
|
|
34
38
|
task: TaskRepo;
|
|
35
39
|
assetTransaction: AssetTransactionRepo;
|
|
36
40
|
}) => Promise<{
|
|
@@ -20,6 +20,7 @@ const PayTransactionService = require("./assetTransaction/pay");
|
|
|
20
20
|
const RefundTransactionService = require("./assetTransaction/refund");
|
|
21
21
|
const RegisterServiceTransactionService = require("./assetTransaction/registerService");
|
|
22
22
|
const ReserveTransactionService = require("./assetTransaction/reserve");
|
|
23
|
+
const settings_1 = require("../settings");
|
|
23
24
|
exports.cancelReservation = CancelReservationTransactionService;
|
|
24
25
|
exports.moneyTransfer = MoneyTransferTransactionService;
|
|
25
26
|
exports.pay = PayTransactionService;
|
|
@@ -31,11 +32,14 @@ exports.reserve = ReserveTransactionService;
|
|
|
31
32
|
*/
|
|
32
33
|
function exportTasks(params) {
|
|
33
34
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
var _a;
|
|
36
|
+
const transaction = yield repos.assetTransaction.startExportTasks(Object.assign({ typeOf: params.typeOf, status: params.status, tasksExportAction: {
|
|
37
|
+
agent: {
|
|
38
|
+
name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
|
|
39
|
+
? params.tasksExportAction.agent.name
|
|
40
|
+
: settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
41
|
+
}
|
|
42
|
+
} }, (typeof params.id === 'string') ? { id: params.id } : undefined));
|
|
39
43
|
if (transaction === null) {
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
@@ -127,7 +127,7 @@ function importFromCOA(params) {
|
|
|
127
127
|
})(repos);
|
|
128
128
|
savedScreeningEventSeriesCount = savedEventsCount;
|
|
129
129
|
try {
|
|
130
|
-
//
|
|
130
|
+
// イベント永続化
|
|
131
131
|
const screeningEvents = yield saveScreeningEvents({
|
|
132
132
|
locationBranchCode: params.locationBranchCode,
|
|
133
133
|
movieTheater: movieTheater,
|
|
@@ -154,6 +154,8 @@ function importFromCOA(params) {
|
|
|
154
154
|
// "message": "ESOCKETTIMEDOUT",
|
|
155
155
|
if (error.name === 'COAServiceError') {
|
|
156
156
|
if (error.message === 'ESOCKETTIMEDOUT') {
|
|
157
|
+
// tslint:disable-next-line:no-console
|
|
158
|
+
console.error('saveScreeningEvents throwed an error', error.name, error.message);
|
|
157
159
|
throwsError = false;
|
|
158
160
|
}
|
|
159
161
|
}
|
|
@@ -12,7 +12,7 @@ function task2lineNotify(params) {
|
|
|
12
12
|
const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
13
13
|
let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
|
|
14
14
|
if (typeof lastError === 'string') {
|
|
15
|
-
lastError = { message: lastError };
|
|
15
|
+
lastError = { message: lastError, name: 'Error' };
|
|
16
16
|
}
|
|
17
17
|
const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
|
|
18
18
|
const content = `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
|
|
@@ -38,7 +38,7 @@ function tasks2lineNotify(params) {
|
|
|
38
38
|
const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
39
39
|
let lastError = lastExecutionResult === null || lastExecutionResult === void 0 ? void 0 : lastExecutionResult.error;
|
|
40
40
|
if (typeof lastError === 'string') {
|
|
41
|
-
lastError = { message: lastError };
|
|
41
|
+
lastError = { message: lastError, name: 'Error' };
|
|
42
42
|
}
|
|
43
43
|
const lastMessage = `${String(lastError === null || lastError === void 0 ? void 0 : lastError.name)} ${String(lastError === null || lastError === void 0 ? void 0 : lastError.message)}`;
|
|
44
44
|
return `project:${(_a = task.project) === null || _a === void 0 ? void 0 : _a.id}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../repo/action';
|
|
3
3
|
import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
4
|
-
export type Operation<T> = (
|
|
4
|
+
export type Operation<T> = (repos: {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
}) => Promise<T>;
|
|
5
7
|
/**
|
|
6
8
|
* Eメールメッセージを送信する
|
|
7
9
|
* https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html
|