@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
|
@@ -106,11 +106,12 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
106
106
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
var _a, _b;
|
|
108
108
|
let accountId;
|
|
109
|
-
let checkResult;
|
|
110
109
|
let payAction;
|
|
110
|
+
let accountsReceivablesByServiceType = [];
|
|
111
111
|
try {
|
|
112
112
|
// MovieTicket決済の場合、認証
|
|
113
|
-
|
|
113
|
+
const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckMovieTicketBeforePay)(repos);
|
|
114
|
+
accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
|
|
114
115
|
const paymentMethod = transaction.object.paymentMethod;
|
|
115
116
|
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.typeOf);
|
|
116
117
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
@@ -141,7 +142,7 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
141
142
|
catch (error) {
|
|
142
143
|
throw (0, errorHandler_1.handleMvtkReserveError)(error);
|
|
143
144
|
}
|
|
144
|
-
return { accountId,
|
|
145
|
+
return { accountId, payAction, accountsReceivablesByServiceType };
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
exports.authorize = authorize;
|
|
@@ -77,10 +77,6 @@ function onRegistered(actionAttributes, __) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// タスク保管
|
|
80
|
-
|
|
81
|
-
yield repos.task.saveMany(taskAttributes);
|
|
82
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
83
|
-
// return repos.task.save(taskAttribute);
|
|
84
|
-
// }));
|
|
80
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
85
81
|
});
|
|
86
82
|
}
|
|
@@ -148,19 +148,15 @@ export interface ISellerFlowTransactionResult {
|
|
|
148
148
|
/**
|
|
149
149
|
* イベントまでの合計残り時間(ミリ秒)
|
|
150
150
|
*/
|
|
151
|
-
totalTimeLeftUntilEventInMilliseconds: number;
|
|
152
151
|
/**
|
|
153
152
|
* イベントまでの最大残り時間(ミリ秒)
|
|
154
153
|
*/
|
|
155
|
-
maxTimeLeftUntilEventInMilliseconds: number;
|
|
156
154
|
/**
|
|
157
155
|
* イベントまでの最小残り時間(ミリ秒)
|
|
158
156
|
*/
|
|
159
|
-
minTimeLeftUntilEventInMilliseconds: number;
|
|
160
157
|
/**
|
|
161
158
|
* イベントまでの平均残り時間(ミリ秒)
|
|
162
159
|
*/
|
|
163
|
-
averageTimeLeftUntilEventInMilliseconds: number;
|
|
164
160
|
/**
|
|
165
161
|
* 取引の合計金額(yen)
|
|
166
162
|
*/
|
|
@@ -180,15 +176,12 @@ export interface ISellerFlowTransactionResult {
|
|
|
180
176
|
/**
|
|
181
177
|
* アクション数合計値(成立取引)
|
|
182
178
|
*/
|
|
183
|
-
totalNumberOfActionsOnConfirmed: number;
|
|
184
179
|
/**
|
|
185
180
|
* 最大アクション数(成立取引)
|
|
186
181
|
*/
|
|
187
|
-
maxNumberOfActionsOnConfirmed: number;
|
|
188
182
|
/**
|
|
189
183
|
* 最小アクション数(成立取引)
|
|
190
184
|
*/
|
|
191
|
-
minNumberOfActionsOnConfirmed: number;
|
|
192
185
|
/**
|
|
193
186
|
* 注文アイテム数合計値
|
|
194
187
|
*/
|
|
@@ -205,10 +198,6 @@ export interface ISellerFlowTransactionResult {
|
|
|
205
198
|
* 平均注文アイテム数
|
|
206
199
|
*/
|
|
207
200
|
averageNumberOfOrderItems: number;
|
|
208
|
-
/**
|
|
209
|
-
* 平均アクション数(成立取引)
|
|
210
|
-
*/
|
|
211
|
-
averageNumberOfActionsOnConfirmed: number;
|
|
212
201
|
}
|
|
213
202
|
/**
|
|
214
203
|
* 販売者が対象のフローデータ
|
|
@@ -247,17 +247,12 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
247
247
|
const maxRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.max(a, b), 0);
|
|
248
248
|
const minRequiredTimeInMilliseconds = requiredTimesConfirmed.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? requiredTimesConfirmed[0] : 0);
|
|
249
249
|
const averageRequiredTimeInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalRequiredTimeInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
250
|
-
//
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
257
|
-
const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
|
|
258
|
-
const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
|
|
259
|
-
const minTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
|
|
260
|
-
const averageTimeLeftUntilEventInMilliseconds = (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
250
|
+
// const totalTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => a + b, 0);
|
|
251
|
+
// const maxTimeLeftUntilEventInMilliseconds = timesLeftUntilEvent.reduce((a, b) => Math.max(a, b), 0);
|
|
252
|
+
// const minTimeLeftUntilEventInMilliseconds =
|
|
253
|
+
// timesLeftUntilEvent.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? timesLeftUntilEvent[0] : 0);
|
|
254
|
+
// const averageTimeLeftUntilEventInMilliseconds =
|
|
255
|
+
// (numberOfTransactionsConfirmed > 0) ? totalTimeLeftUntilEventInMilliseconds / numberOfTransactionsConfirmed : 0;
|
|
261
256
|
// 金額算出
|
|
262
257
|
const amounts = confirmedTransactions.map((transaction) => transaction.result.order.price);
|
|
263
258
|
const totalAmount = amounts.reduce((a, b) => a + b, 0);
|
|
@@ -265,11 +260,13 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
265
260
|
const minAmount = amounts.reduce((a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? amounts[0] : 0);
|
|
266
261
|
const averageAmount = (numberOfTransactionsConfirmed > 0) ? totalAmount / numberOfTransactionsConfirmed : 0;
|
|
267
262
|
// アクション数集計
|
|
268
|
-
const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
|
|
269
|
-
const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
|
|
270
|
-
const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
|
|
271
|
-
const minNumberOfActions = numbersOfActions.reduce(
|
|
272
|
-
|
|
263
|
+
// const numbersOfActions = confirmedTransactions.map((t) => t.object.authorizeActions.length);
|
|
264
|
+
// const totalNumberOfActions = numbersOfActions.reduce((a, b) => a + b, 0);
|
|
265
|
+
// const maxNumberOfActions = numbersOfActions.reduce((a, b) => Math.max(a, b), 0);
|
|
266
|
+
// const minNumberOfActions = numbersOfActions.reduce(
|
|
267
|
+
// (a, b) => Math.min(a, b), (numberOfTransactionsConfirmed > 0) ? numbersOfActions[0] : 0
|
|
268
|
+
// );
|
|
269
|
+
// const averageNumberOfActions = (numberOfTransactionsConfirmed > 0) ? totalNumberOfActions / numberOfTransactionsConfirmed : 0;
|
|
273
270
|
// 期限切れ取引数
|
|
274
271
|
const numberOfTransactionsExpired = expiredTransactions.length;
|
|
275
272
|
const expiredTransactionIds = expiredTransactions.map((transaction) => transaction.id);
|
|
@@ -284,18 +281,18 @@ function createSellerFlowTransactionResult(measuredFrom, measuredThrough, seller
|
|
|
284
281
|
maxRequiredTimeInMilliseconds: maxRequiredTimeInMilliseconds,
|
|
285
282
|
minRequiredTimeInMilliseconds: minRequiredTimeInMilliseconds,
|
|
286
283
|
averageRequiredTimeInMilliseconds: parseFloat(averageRequiredTimeInMilliseconds.toFixed(1)),
|
|
287
|
-
totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
|
|
288
|
-
maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
|
|
289
|
-
minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
|
|
290
|
-
averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
|
|
284
|
+
// totalTimeLeftUntilEventInMilliseconds: totalTimeLeftUntilEventInMilliseconds,
|
|
285
|
+
// maxTimeLeftUntilEventInMilliseconds: maxTimeLeftUntilEventInMilliseconds,
|
|
286
|
+
// minTimeLeftUntilEventInMilliseconds: minTimeLeftUntilEventInMilliseconds,
|
|
287
|
+
// averageTimeLeftUntilEventInMilliseconds: averageTimeLeftUntilEventInMilliseconds,
|
|
291
288
|
totalAmount: totalAmount,
|
|
292
289
|
maxAmount: maxAmount,
|
|
293
290
|
minAmount: minAmount,
|
|
294
291
|
averageAmount: parseFloat(averageAmount.toFixed(1)),
|
|
295
|
-
totalNumberOfActionsOnConfirmed: totalNumberOfActions,
|
|
296
|
-
maxNumberOfActionsOnConfirmed: maxNumberOfActions,
|
|
297
|
-
minNumberOfActionsOnConfirmed: minNumberOfActions,
|
|
298
|
-
averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
|
|
292
|
+
// totalNumberOfActionsOnConfirmed: totalNumberOfActions,
|
|
293
|
+
// maxNumberOfActionsOnConfirmed: maxNumberOfActions,
|
|
294
|
+
// minNumberOfActionsOnConfirmed: minNumberOfActions,
|
|
295
|
+
// averageNumberOfActionsOnConfirmed: parseFloat(averageNumberOfActions.toFixed(1)),
|
|
299
296
|
// tslint:disable-next-line:no-suspicious-comment
|
|
300
297
|
totalNumberOfOrderItems: 0,
|
|
301
298
|
// tslint:disable-next-line:no-suspicious-comment
|
|
@@ -5,7 +5,6 @@ import { RedisRepository as OfferRateLimitRepo } from '../../repo/rateLimit/offe
|
|
|
5
5
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
6
6
|
import { StockHolderRepository as StockHolderRepo } from '../../repo/stockHolder';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
|
-
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
9
8
|
/**
|
|
10
9
|
* 進行中の予約をキャンセルする
|
|
11
10
|
*/
|
|
@@ -29,7 +28,10 @@ declare function cancelReservation(actionAttributesList: factory.action.cancel.r
|
|
|
29
28
|
assetTransaction: AssetTransactionRepo;
|
|
30
29
|
}) => Promise<void>;
|
|
31
30
|
declare function processUnlockOfferRateLimit(params: {
|
|
32
|
-
reservation:
|
|
31
|
+
reservation: {
|
|
32
|
+
reservationNumber: string;
|
|
33
|
+
reservedTicket: factory.assetTransaction.reserve.IObjectSubReservationReservedTicket;
|
|
34
|
+
};
|
|
33
35
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
34
36
|
}): (repos: {
|
|
35
37
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -73,7 +73,7 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
73
73
|
})(repos);
|
|
74
74
|
yield processUnlockOfferRateLimit({
|
|
75
75
|
reservation: {
|
|
76
|
-
reservationNumber:
|
|
76
|
+
reservationNumber: reserveTransaction.object.reservationNumber,
|
|
77
77
|
reservedTicket: cancelingSubReservation.reservedTicket
|
|
78
78
|
},
|
|
79
79
|
reservationFor
|
|
@@ -144,7 +144,6 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
144
144
|
// canceledReservationId: canceledReservation?.id
|
|
145
145
|
);
|
|
146
146
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
147
|
-
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
148
147
|
if (actionObject.typeOf === factory.reservationType.ReservationPackage) {
|
|
149
148
|
// 最新のconfirmedReservationsを検索
|
|
150
149
|
canceledReservations = yield repos.reservation.search({
|
|
@@ -215,7 +214,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
215
214
|
})(repos);
|
|
216
215
|
yield processUnlockOfferRateLimit({
|
|
217
216
|
reservation: {
|
|
218
|
-
reservationNumber:
|
|
217
|
+
reservationNumber: reserveTransaction.object.reservationNumber,
|
|
219
218
|
reservedTicket: cancelingSubReservation.reservedTicket
|
|
220
219
|
},
|
|
221
220
|
reservationFor
|
|
@@ -297,7 +296,6 @@ function cancelReservation(actionAttributesList) {
|
|
|
297
296
|
// canceledReservationId: canceledReservation?.id
|
|
298
297
|
);
|
|
299
298
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
300
|
-
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
301
299
|
let canceledReservations = [];
|
|
302
300
|
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
303
301
|
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import * as factory from '../../factory';
|
|
2
3
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
4
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
5
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
11
|
};
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.checkInRerservation = void 0;
|
|
14
|
+
// import { confirmReservation } from './confirmReservation';
|
|
13
15
|
const onReservationCheckedIn_1 = require("./potentialActions/onReservationCheckedIn");
|
|
14
16
|
function checkInRerservation(params) {
|
|
15
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17,6 +19,28 @@ function checkInRerservation(params) {
|
|
|
17
19
|
// 発券処理(Array対応)
|
|
18
20
|
let checkedInReservationIds;
|
|
19
21
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
22
|
+
// confirmReservationが間に合わない可能性を考慮する(2023-05-30~)
|
|
23
|
+
// const reserveTransactions = await repos.assetTransaction.search<factory.assetTransactionType.Reserve>({
|
|
24
|
+
// typeOf: factory.assetTransactionType.Reserve,
|
|
25
|
+
// object: {
|
|
26
|
+
// reservations: {
|
|
27
|
+
// id: { $in: params.object.ids }
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
|
+
// });
|
|
31
|
+
// await Promise.all(reserveTransactions.map(async (reserveTransaction) => {
|
|
32
|
+
// await confirmReservation([{
|
|
33
|
+
// project: reserveTransaction.project,
|
|
34
|
+
// typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
|
|
35
|
+
// // result: {},
|
|
36
|
+
// object: reservationPackage,
|
|
37
|
+
// agent: reserveTransaction.project,
|
|
38
|
+
// potentialActions: {
|
|
39
|
+
// moneyTransfer: moneyTransferActions
|
|
40
|
+
// },
|
|
41
|
+
// purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
42
|
+
// }])(repos);
|
|
43
|
+
// }))
|
|
20
44
|
yield repos.reservation.checkInIfNot({ id: { $in: params.object.ids }, now });
|
|
21
45
|
checkedInReservationIds = params.object.ids;
|
|
22
46
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../factory';
|
|
5
5
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
6
|
+
import { MongoRepository as AssetTrasactionRepo } from '../../repo/assetTransaction';
|
|
6
7
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
7
8
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
9
|
/**
|
|
@@ -10,6 +11,7 @@ import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
|
10
11
|
*/
|
|
11
12
|
export declare function confirmReservation(actionAttributesList: factory.action.reserve.IAttributes[]): (repos: {
|
|
12
13
|
action: ActionRepo;
|
|
14
|
+
assetTransaction: AssetTrasactionRepo;
|
|
13
15
|
reservation: ReservationRepo;
|
|
14
16
|
task: TaskRepo;
|
|
15
17
|
}) => Promise<void>;
|
|
@@ -24,21 +24,57 @@ function confirmReservation(actionAttributesList) {
|
|
|
24
24
|
let confirmedReservations = [];
|
|
25
25
|
if (actionAttributesList.length > 0) {
|
|
26
26
|
yield Promise.all(actionAttributesList.map((actionAttributes) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const reservationPackage = actionAttributes.object;
|
|
28
29
|
const action = yield repos.action.start(actionAttributes);
|
|
29
30
|
try {
|
|
31
|
+
const reserveTransactions = yield repos.assetTransaction.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
typeOf: factory.assetTransactionType.Reserve,
|
|
35
|
+
transactionNumber: { $eq: reservationPackage.reservationNumber }
|
|
36
|
+
});
|
|
37
|
+
const reserveTransaction = reserveTransactions.shift();
|
|
38
|
+
if (reserveTransaction === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.assetTransactionType.Reserve);
|
|
40
|
+
}
|
|
41
|
+
let underName;
|
|
42
|
+
// 予約取引に保管されたunderNameを使用する(2023-05-30~)
|
|
43
|
+
if (typeof ((_a = reserveTransaction.object.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
44
|
+
underName = reserveTransaction.object.underName;
|
|
45
|
+
}
|
|
46
|
+
else if (typeof ((_b = reservationPackage.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') {
|
|
47
|
+
underName = reservationPackage.underName;
|
|
48
|
+
}
|
|
30
49
|
// ReservationPackageに対応(2022-12-22~)
|
|
31
|
-
if (
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
50
|
+
if (reservationPackage.typeOf === factory.reservationType.ReservationPackage) {
|
|
51
|
+
// Pendingの予約が存在しないバージョンに対応する(2023-05-29~)
|
|
52
|
+
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
53
|
+
const reservationFor = reserveTransaction.object.reservationFor;
|
|
54
|
+
const subReservations = reserveTransaction.object.subReservation;
|
|
55
|
+
if (Array.isArray(subReservations)
|
|
56
|
+
&& typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) === 'string') {
|
|
57
|
+
yield Promise.all(subReservations.map((subReservation) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
yield repos.reservation.confirmByIdIfNotExist({
|
|
59
|
+
reservation: subReservation,
|
|
60
|
+
reservationFor,
|
|
61
|
+
underName
|
|
62
|
+
});
|
|
63
|
+
})));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// 予約を確定状態に変更する
|
|
68
|
+
yield repos.reservation.confirmByReservationNumber({
|
|
69
|
+
reservationNumber: reservationPackage.reservationNumber,
|
|
70
|
+
previousReservationStatus: reservationPackage.reservationStatus,
|
|
71
|
+
underName
|
|
72
|
+
});
|
|
73
|
+
}
|
|
38
74
|
}
|
|
39
75
|
else {
|
|
40
76
|
// 廃止(2023-01-18)
|
|
41
|
-
throw new factory.errors.Forbidden(`${
|
|
77
|
+
throw new factory.errors.Forbidden(`${reservationPackage.typeOf} not acceptable`);
|
|
42
78
|
// 予約を確定状態に変更する
|
|
43
79
|
// await repos.reservation.confirm<factory.reservationType.EventReservation>({
|
|
44
80
|
// id: reservation.id,
|
|
@@ -4,9 +4,6 @@ type IEventReservation = factory.reservation.IReservation<factory.reservationTyp
|
|
|
4
4
|
/**
|
|
5
5
|
* 予約取消後のアクション
|
|
6
6
|
*/
|
|
7
|
-
export declare function onReservationCanceledByAction(actionAttributes: factory.action.cancel.reservation.IAttributes): (repos: {
|
|
8
|
-
task: TaskRepo;
|
|
9
|
-
}) => Promise<void>;
|
|
10
7
|
export declare function onReservationCanceled(canceledReservations: IEventReservation[], useInformReservation: boolean): (repos: {
|
|
11
8
|
task: TaskRepo;
|
|
12
9
|
}) => Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.onReservationCanceled =
|
|
12
|
+
exports.onReservationCanceled = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 予約取消時アクション
|
|
15
15
|
*/
|
|
@@ -19,26 +19,26 @@ const settings_1 = require("../../../settings");
|
|
|
19
19
|
const offer_1 = require("../../offer");
|
|
20
20
|
const factory_1 = require("../factory");
|
|
21
21
|
const informReservations = settings_1.settings.onReservationStatusChanged.informReservation;
|
|
22
|
-
const INFORM_TASK_DELAY_IN_SECONDS = 30;
|
|
23
22
|
/**
|
|
24
23
|
* 予約取消後のアクション
|
|
25
24
|
*/
|
|
26
|
-
function onReservationCanceledByAction(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
25
|
+
// export function onReservationCanceledByAction(
|
|
26
|
+
// actionAttributes: factory.action.cancel.reservation.IAttributes
|
|
27
|
+
// ) {
|
|
28
|
+
// return async (repos: {
|
|
29
|
+
// task: TaskRepo;
|
|
30
|
+
// }) => {
|
|
31
|
+
// const potentialActions = actionAttributes.potentialActions;
|
|
32
|
+
// const taskAttributes: factory.task.IAttributes<factory.taskName>[] = [];
|
|
33
|
+
// if (potentialActions !== undefined) {
|
|
34
|
+
// // no op
|
|
35
|
+
// }
|
|
36
|
+
// // タスク保管
|
|
37
|
+
// if (taskAttributes.length > 0) {
|
|
38
|
+
// await repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
39
|
+
// }
|
|
40
|
+
// };
|
|
41
|
+
// }
|
|
42
42
|
function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
43
43
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
44
44
|
if (Array.isArray(canceledReservations) && canceledReservations.length > 0) {
|
|
@@ -50,7 +50,7 @@ function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
|
50
50
|
if (Array.isArray(informReservations)) {
|
|
51
51
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
52
52
|
const informTaskRunsAt = moment(now)
|
|
53
|
-
.add(
|
|
53
|
+
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
54
54
|
.toDate();
|
|
55
55
|
const reservations4inform = canceledReservations.map((r) => {
|
|
56
56
|
return {
|
|
@@ -91,7 +91,7 @@ function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
|
91
91
|
}
|
|
92
92
|
// タスク保管
|
|
93
93
|
if (taskAttributes.length > 0) {
|
|
94
|
-
yield repos.task.saveMany(taskAttributes);
|
|
94
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
95
95
|
}
|
|
96
96
|
// 冗長な作成を避ける
|
|
97
97
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
@@ -19,7 +19,6 @@ const settings_1 = require("../../../settings");
|
|
|
19
19
|
const offer_1 = require("../../offer");
|
|
20
20
|
const factory_1 = require("../factory");
|
|
21
21
|
const informReservations = settings_1.settings.onReservationStatusChanged.informReservation;
|
|
22
|
-
const INFORM_TASK_DELAY_IN_SECONDS = 30;
|
|
23
22
|
// tslint:disable-next-line:max-func-body-length
|
|
24
23
|
function onReservationCheckedIn(params) {
|
|
25
24
|
// tslint:disable-next-line:max-func-body-length
|
|
@@ -31,7 +30,7 @@ function onReservationCheckedIn(params) {
|
|
|
31
30
|
if (Array.isArray(informReservations)) {
|
|
32
31
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
33
32
|
const informTaskRunsAt = moment(params.now)
|
|
34
|
-
.add(
|
|
33
|
+
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
35
34
|
.toDate();
|
|
36
35
|
informReservations.forEach((informReservation) => {
|
|
37
36
|
var _a;
|
|
@@ -107,7 +106,7 @@ function onReservationCheckedIn(params) {
|
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
108
|
if (tasks.length > 0) {
|
|
110
|
-
yield repos.task.saveMany(tasks);
|
|
109
|
+
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
111
110
|
}
|
|
112
111
|
// 冗長な作成を避ける
|
|
113
112
|
const reservationForIds = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.ids;
|
|
@@ -57,38 +57,9 @@ function onReservationConfirmedByAction(actionAttributes
|
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
// inform galobally
|
|
61
|
-
// if (Array.isArray(informReservations)) {
|
|
62
|
-
// const reservation4inform: IReservation4informConfirmed = maskUnderName(confirmedReservation);
|
|
63
|
-
// taskAttributes.push(...informReservations.map<ITriggerWebhookTaskAttributes>((informReservation) => {
|
|
64
|
-
// const informUrl: string = String(informReservation.recipient?.url);
|
|
65
|
-
// const informReservationAttributes: InformReservationActionattributes = {
|
|
66
|
-
// agent: confirmedReservation.project,
|
|
67
|
-
// object: [reservation4inform],
|
|
68
|
-
// project: confirmedReservation.project,
|
|
69
|
-
// recipient: {
|
|
70
|
-
// id: '',
|
|
71
|
-
// name: informUrl,
|
|
72
|
-
// typeOf: factory.creativeWorkType.WebApplication,
|
|
73
|
-
// url: informUrl
|
|
74
|
-
// },
|
|
75
|
-
// typeOf: factory.actionType.InformAction
|
|
76
|
-
// };
|
|
77
|
-
// return {
|
|
78
|
-
// project: actionAttributes.project,
|
|
79
|
-
// name: factory.taskName.TriggerWebhook,
|
|
80
|
-
// status: factory.taskStatus.Ready,
|
|
81
|
-
// runsAt: now,
|
|
82
|
-
// remainingNumberOfTries: NUM_TRY_INFORM_RESERVATION,
|
|
83
|
-
// numberOfTried: 0,
|
|
84
|
-
// executionResults: [],
|
|
85
|
-
// data: informReservationAttributes
|
|
86
|
-
// };
|
|
87
|
-
// }));
|
|
88
|
-
// }
|
|
89
60
|
// タスク保管
|
|
90
61
|
if (taskAttributes.length > 0) {
|
|
91
|
-
yield repos.task.saveMany(taskAttributes);
|
|
62
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
92
63
|
}
|
|
93
64
|
});
|
|
94
65
|
}
|
|
@@ -142,7 +113,7 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
142
113
|
}
|
|
143
114
|
// タスク保管
|
|
144
115
|
if (taskAttributes.length > 0) {
|
|
145
|
-
yield repos.task.saveMany(taskAttributes);
|
|
116
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
146
117
|
}
|
|
147
118
|
}
|
|
148
119
|
});
|
|
@@ -19,7 +19,6 @@ const settings_1 = require("../../../settings");
|
|
|
19
19
|
const offer_1 = require("../../offer");
|
|
20
20
|
const factory_1 = require("../factory");
|
|
21
21
|
const informReservations = settings_1.settings.onReservationStatusChanged.informReservation;
|
|
22
|
-
const INFORM_TASK_DELAY_IN_SECONDS = 30;
|
|
23
22
|
/**
|
|
24
23
|
* 予約使用
|
|
25
24
|
*/
|
|
@@ -32,7 +31,7 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
32
31
|
if (Array.isArray(informReservations)) {
|
|
33
32
|
// やや遅延させる(確定通知が未達の可能性を考慮して)
|
|
34
33
|
const informTaskRunsAt = moment(now)
|
|
35
|
-
.add(
|
|
34
|
+
.add(settings_1.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS, 'seconds')
|
|
36
35
|
.toDate();
|
|
37
36
|
const reservation4inform = {
|
|
38
37
|
typeOf: attendedReservation.typeOf,
|
|
@@ -97,7 +96,7 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
if (tasks.length > 0) {
|
|
100
|
-
yield repos.task.saveMany(tasks);
|
|
99
|
+
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
101
100
|
}
|
|
102
101
|
// 冗長な作成を避ける
|
|
103
102
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 予約サービス
|
|
3
|
-
*/
|
|
4
1
|
import * as factory from '../../factory';
|
|
5
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
6
3
|
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
@@ -11,6 +8,9 @@ import { IUseReservationAction } from './potentialActions/onReservationUsed';
|
|
|
11
8
|
* 予約使用
|
|
12
9
|
*/
|
|
13
10
|
export declare function useReservation(params: {
|
|
11
|
+
project: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
14
|
agent: factory.action.consume.use.reservation.IAgent;
|
|
15
15
|
object: {
|
|
16
16
|
/**
|
|
@@ -24,6 +24,7 @@ export declare function useReservation(params: {
|
|
|
24
24
|
location?: {
|
|
25
25
|
identifier?: string;
|
|
26
26
|
};
|
|
27
|
+
verifyToken: boolean;
|
|
27
28
|
}): (repos: {
|
|
28
29
|
action: ActionRepo;
|
|
29
30
|
order: OrderRepo;
|