@chevre/domain 21.2.0-alpha.6 → 21.2.0-alpha.60
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/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/deleteTasksByName.ts +2 -1
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -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/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- 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/account.js +0 -4
- package/lib/chevre/repo/accountTitle.js +0 -4
- package/lib/chevre/repo/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -58
- package/lib/chevre/repo/accountingReport.js +0 -4
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +32 -29
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +23 -8
- package/lib/chevre/repo/assetTransaction.js +207 -68
- package/lib/chevre/repo/categoryCode.js +0 -4
- package/lib/chevre/repo/code.js +0 -4
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -9
- 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/creativeWork.js +0 -4
- package/lib/chevre/repo/customer.js +0 -4
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +0 -4
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/event.js +0 -4
- package/lib/chevre/repo/member.js +0 -4
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
- 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 +3 -1
- 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 +62 -3
- 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 +1 -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/offer.js +0 -5
- package/lib/chevre/repo/offerCatalog.js +0 -4
- package/lib/chevre/repo/offerItemCondition.d.ts +39 -0
- package/lib/chevre/repo/offerItemCondition.js +112 -0
- package/lib/chevre/repo/order.d.ts +25 -0
- package/lib/chevre/repo/order.js +5 -4
- package/lib/chevre/repo/ownershipInfo.js +0 -4
- package/lib/chevre/repo/permit.js +0 -4
- package/lib/chevre/repo/place.js +0 -4
- package/lib/chevre/repo/priceSpecification.js +0 -4
- package/lib/chevre/repo/product.js +0 -4
- package/lib/chevre/repo/project.js +0 -4
- package/lib/chevre/repo/reservation.js +0 -4
- package/lib/chevre/repo/role.js +0 -4
- package/lib/chevre/repo/seller.js +0 -4
- package/lib/chevre/repo/serviceOutput.js +0 -4
- package/lib/chevre/repo/stockHolder.js +30 -0
- package/lib/chevre/repo/task.d.ts +41 -2
- package/lib/chevre/repo/task.js +97 -12
- package/lib/chevre/repo/telemetry.js +0 -4
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -58
- package/lib/chevre/repo/trip.js +0 -4
- 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 +23 -25
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +23 -21
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.js +32 -24
- package/lib/chevre/service/assetTransaction/refund.js +23 -21
- package/lib/chevre/service/assetTransaction/registerService.js +23 -22
- package/lib/chevre/service/assetTransaction/reserve.js +23 -21
- 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/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.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +25 -36
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -1
- 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.js +0 -2
- 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.js +1 -8
- 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/returnPayTransaction.js +2 -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 +226 -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/orderProgramMembership.js +2 -1
- 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 +1 -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.js +1 -5
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +6 -1
- package/lib/chevre/settings.js +17 -5
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
|
@@ -13,13 +13,11 @@ exports.exportTasksById = exports.startAndConfirm = exports.confirm = exports.st
|
|
|
13
13
|
/**
|
|
14
14
|
* 予約取消取引サービス
|
|
15
15
|
*/
|
|
16
|
-
const createDebug = require("debug");
|
|
17
16
|
const moment = require("moment");
|
|
18
17
|
const mongoose = require("mongoose");
|
|
19
18
|
const factory = require("../../factory");
|
|
20
19
|
const settings_1 = require("../../settings");
|
|
21
20
|
const factory_1 = require("./cancelReservation/factory");
|
|
22
|
-
const debug = createDebug('chevre-domain:service');
|
|
23
21
|
function validateStartParams(params) {
|
|
24
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
23
|
var _a, _b;
|
|
@@ -169,27 +167,29 @@ function exportTasksById(params) {
|
|
|
169
167
|
});
|
|
170
168
|
const potentialActions = transaction.potentialActions;
|
|
171
169
|
const taskAttributes = [];
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
170
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
171
|
+
// 資産取引削除タスクを作成
|
|
172
|
+
const deleteTransactionTask = {
|
|
173
|
+
project: transaction.project,
|
|
174
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
175
|
+
status: factory.taskStatus.Ready,
|
|
176
|
+
runsAt: moment(transaction.endDate)
|
|
177
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
178
|
+
.toDate(),
|
|
179
|
+
remainingNumberOfTries: 3,
|
|
180
|
+
numberOfTried: 0,
|
|
181
|
+
executionResults: [],
|
|
182
|
+
data: {
|
|
183
|
+
object: {
|
|
184
|
+
project: transaction.project,
|
|
185
|
+
id: transaction.id,
|
|
186
|
+
transactionNumber: transaction.transactionNumber,
|
|
187
|
+
typeOf: transaction.typeOf
|
|
188
|
+
}
|
|
189
189
|
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
};
|
|
191
|
+
taskAttributes.push(deleteTransactionTask);
|
|
192
|
+
}
|
|
193
193
|
switch (transaction.status) {
|
|
194
194
|
case factory.transactionStatusType.Confirmed:
|
|
195
195
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -235,9 +235,7 @@ function exportTasksById(params) {
|
|
|
235
235
|
default:
|
|
236
236
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
237
237
|
}
|
|
238
|
-
|
|
239
|
-
return repos.task.saveMany(taskAttributes);
|
|
240
|
-
// return Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
|
|
238
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
241
239
|
});
|
|
242
240
|
}
|
|
243
241
|
exports.exportTasksById = exportTasksById;
|
|
@@ -360,27 +360,29 @@ function exportTasksById(params) {
|
|
|
360
360
|
});
|
|
361
361
|
const potentialActions = transaction.potentialActions;
|
|
362
362
|
const taskAttributes = [];
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
363
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
364
|
+
// 資産取引削除タスクを作成
|
|
365
|
+
const deleteTransactionTask = {
|
|
366
|
+
project: transaction.project,
|
|
367
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
368
|
+
status: factory.taskStatus.Ready,
|
|
369
|
+
runsAt: moment(transaction.endDate)
|
|
370
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
371
|
+
.toDate(),
|
|
372
|
+
remainingNumberOfTries: 3,
|
|
373
|
+
numberOfTried: 0,
|
|
374
|
+
executionResults: [],
|
|
375
|
+
data: {
|
|
376
|
+
object: {
|
|
377
|
+
project: transaction.project,
|
|
378
|
+
id: transaction.id,
|
|
379
|
+
transactionNumber: transaction.transactionNumber,
|
|
380
|
+
typeOf: transaction.typeOf
|
|
381
|
+
}
|
|
380
382
|
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
383
|
+
};
|
|
384
|
+
taskAttributes.push(deleteTransactionTask);
|
|
385
|
+
}
|
|
384
386
|
// タスク実行日時バッファの指定があれば調整
|
|
385
387
|
let taskRunsAt = new Date();
|
|
386
388
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -430,7 +432,7 @@ function exportTasksById(params) {
|
|
|
430
432
|
default:
|
|
431
433
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
432
434
|
}
|
|
433
|
-
return repos.task.saveMany(taskAttributes);
|
|
435
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
434
436
|
});
|
|
435
437
|
}
|
|
436
438
|
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,29 @@ function exportTasksById(params) {
|
|
|
393
399
|
});
|
|
394
400
|
const potentialActions = transaction.potentialActions;
|
|
395
401
|
const taskAttributes = [];
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
402
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
403
|
+
// 資産取引削除タスクを作成
|
|
404
|
+
const deleteTransactionTask = {
|
|
405
|
+
project: transaction.project,
|
|
406
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
407
|
+
status: factory.taskStatus.Ready,
|
|
408
|
+
runsAt: moment(transaction.endDate)
|
|
409
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
410
|
+
.toDate(),
|
|
411
|
+
remainingNumberOfTries: 3,
|
|
412
|
+
numberOfTried: 0,
|
|
413
|
+
executionResults: [],
|
|
414
|
+
data: {
|
|
415
|
+
object: {
|
|
416
|
+
project: transaction.project,
|
|
417
|
+
id: transaction.id,
|
|
418
|
+
transactionNumber: transaction.transactionNumber,
|
|
419
|
+
typeOf: transaction.typeOf
|
|
420
|
+
}
|
|
413
421
|
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
422
|
+
};
|
|
423
|
+
taskAttributes.push(deleteTransactionTask);
|
|
424
|
+
}
|
|
417
425
|
// タスク実行日時バッファの指定があれば調整
|
|
418
426
|
let taskRunsAt = new Date();
|
|
419
427
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -470,7 +478,7 @@ function exportTasksById(params) {
|
|
|
470
478
|
default:
|
|
471
479
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
472
480
|
}
|
|
473
|
-
return repos.task.saveMany(taskAttributes);
|
|
481
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
474
482
|
});
|
|
475
483
|
}
|
|
476
484
|
exports.exportTasksById = exportTasksById;
|
|
@@ -160,27 +160,29 @@ function exportTasksById(params) {
|
|
|
160
160
|
});
|
|
161
161
|
const potentialActions = transaction.potentialActions;
|
|
162
162
|
const taskAttributes = [];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
163
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
164
|
+
// 資産取引削除タスクを作成
|
|
165
|
+
const deleteTransactionTask = {
|
|
166
|
+
project: transaction.project,
|
|
167
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
168
|
+
status: factory.taskStatus.Ready,
|
|
169
|
+
runsAt: moment(transaction.endDate)
|
|
170
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
171
|
+
.toDate(),
|
|
172
|
+
remainingNumberOfTries: 3,
|
|
173
|
+
numberOfTried: 0,
|
|
174
|
+
executionResults: [],
|
|
175
|
+
data: {
|
|
176
|
+
object: {
|
|
177
|
+
project: transaction.project,
|
|
178
|
+
id: transaction.id,
|
|
179
|
+
transactionNumber: transaction.transactionNumber,
|
|
180
|
+
typeOf: transaction.typeOf
|
|
181
|
+
}
|
|
180
182
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
};
|
|
184
|
+
taskAttributes.push(deleteTransactionTask);
|
|
185
|
+
}
|
|
184
186
|
// タスク実行日時バッファの指定があれば調整
|
|
185
187
|
let taskRunsAt = new Date();
|
|
186
188
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -218,7 +220,7 @@ function exportTasksById(params) {
|
|
|
218
220
|
default:
|
|
219
221
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
220
222
|
}
|
|
221
|
-
return repos.task.saveMany(taskAttributes);
|
|
223
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
226
|
exports.exportTasksById = exportTasksById;
|
|
@@ -230,27 +230,29 @@ function exportTasksById(params) {
|
|
|
230
230
|
});
|
|
231
231
|
const potentialActions = transaction.potentialActions;
|
|
232
232
|
const taskAttributes = [];
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
233
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
234
|
+
// 資産取引削除タスクを作成
|
|
235
|
+
const deleteTransactionTask = {
|
|
236
|
+
project: transaction.project,
|
|
237
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
238
|
+
status: factory.taskStatus.Ready,
|
|
239
|
+
runsAt: moment(transaction.endDate)
|
|
240
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
241
|
+
.toDate(),
|
|
242
|
+
remainingNumberOfTries: 3,
|
|
243
|
+
numberOfTried: 0,
|
|
244
|
+
executionResults: [],
|
|
245
|
+
data: {
|
|
246
|
+
object: {
|
|
247
|
+
project: transaction.project,
|
|
248
|
+
id: transaction.id,
|
|
249
|
+
transactionNumber: transaction.transactionNumber,
|
|
250
|
+
typeOf: transaction.typeOf
|
|
251
|
+
}
|
|
250
252
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
};
|
|
254
|
+
taskAttributes.push(deleteTransactionTask);
|
|
255
|
+
}
|
|
254
256
|
const taskRunsAt = new Date();
|
|
255
257
|
switch (transaction.status) {
|
|
256
258
|
case factory.transactionStatusType.Confirmed:
|
|
@@ -301,8 +303,7 @@ function exportTasksById(params) {
|
|
|
301
303
|
default:
|
|
302
304
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
303
305
|
}
|
|
304
|
-
return repos.task.saveMany(taskAttributes);
|
|
305
|
-
// return Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
|
|
306
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
309
|
exports.exportTasksById = exportTasksById;
|
|
@@ -773,27 +773,29 @@ function exportTasksById(params) {
|
|
|
773
773
|
});
|
|
774
774
|
const potentialActions = transaction.potentialActions;
|
|
775
775
|
const taskAttributes = [];
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
776
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
777
|
+
// 資産取引削除タスクを作成
|
|
778
|
+
const deleteTransactionTask = {
|
|
779
|
+
project: transaction.project,
|
|
780
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
781
|
+
status: factory.taskStatus.Ready,
|
|
782
|
+
runsAt: moment(transaction.endDate)
|
|
783
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
784
|
+
.toDate(),
|
|
785
|
+
remainingNumberOfTries: 3,
|
|
786
|
+
numberOfTried: 0,
|
|
787
|
+
executionResults: [],
|
|
788
|
+
data: {
|
|
789
|
+
object: {
|
|
790
|
+
project: transaction.project,
|
|
791
|
+
id: transaction.id,
|
|
792
|
+
transactionNumber: transaction.transactionNumber,
|
|
793
|
+
typeOf: transaction.typeOf
|
|
794
|
+
}
|
|
793
795
|
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
|
|
796
|
+
};
|
|
797
|
+
taskAttributes.push(deleteTransactionTask);
|
|
798
|
+
}
|
|
797
799
|
switch (transaction.status) {
|
|
798
800
|
case factory.transactionStatusType.Confirmed:
|
|
799
801
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -860,7 +862,7 @@ function exportTasksById(params) {
|
|
|
860
862
|
default:
|
|
861
863
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
862
864
|
}
|
|
863
|
-
return repos.task.saveMany(taskAttributes);
|
|
865
|
+
return repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
864
866
|
});
|
|
865
867
|
}
|
|
866
868
|
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
|
|
@@ -111,15 +111,11 @@ exports.sendEmailMessage = sendEmailMessage;
|
|
|
111
111
|
* https://notify-bot.line.me/doc/ja/
|
|
112
112
|
*/
|
|
113
113
|
function report2developers(subject, content, imageThumbnail, imageFullsize) {
|
|
114
|
-
return () => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
115
115
|
const LINE_NOTIFY_URL = credentials_1.credentials.lineNotify.url;
|
|
116
|
-
const LINE_NOTIFY_ACCESS_TOKEN = credentials_1.credentials.lineNotify.accessToken;
|
|
117
116
|
if (LINE_NOTIFY_URL === undefined) {
|
|
118
117
|
throw new Error('Environment variable LINE_NOTIFY_URL not set');
|
|
119
118
|
}
|
|
120
|
-
if (LINE_NOTIFY_ACCESS_TOKEN === undefined) {
|
|
121
|
-
throw new Error('Environment variable LINE_NOTIFY_ACCESS_TOKEN not set');
|
|
122
|
-
}
|
|
123
119
|
const message = `--------
|
|
124
120
|
${subject}
|
|
125
121
|
--------
|
|
@@ -130,7 +126,7 @@ ${content}`;
|
|
|
130
126
|
var _a;
|
|
131
127
|
request.post({
|
|
132
128
|
url: LINE_NOTIFY_URL,
|
|
133
|
-
auth: { bearer:
|
|
129
|
+
auth: { bearer: repos.accessToken },
|
|
134
130
|
form: formData,
|
|
135
131
|
json: true,
|
|
136
132
|
timeout: (_a = settings_1.settings.webhook) === null || _a === void 0 ? void 0 : _a.timeout
|
|
@@ -154,6 +150,45 @@ ${content}`;
|
|
|
154
150
|
exports.report2developers = report2developers;
|
|
155
151
|
const USERNAME_ARGUMENT_REQUIRED_MESSAGE = 'Missing required key \'Username\' in params';
|
|
156
152
|
function triggerWebhook(params) {
|
|
153
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
// retryableにする(2023-05-12~)
|
|
155
|
+
let retry = true;
|
|
156
|
+
let numberOfTry = 0;
|
|
157
|
+
while (numberOfTry >= 0) {
|
|
158
|
+
try {
|
|
159
|
+
numberOfTry += 1;
|
|
160
|
+
if (numberOfTry > settings_1.TRIGGER_WEBHOOK_MAX_RETRY_COUNT) {
|
|
161
|
+
retry = false;
|
|
162
|
+
}
|
|
163
|
+
// retryInterval
|
|
164
|
+
if (numberOfTry > 1) {
|
|
165
|
+
yield sleep(settings_1.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS * (numberOfTry - 1));
|
|
166
|
+
}
|
|
167
|
+
yield processInformAction(params)(repos);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
if (retry) {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
exports.triggerWebhook = triggerWebhook;
|
|
182
|
+
function sleep(waitTime) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
return new Promise((resolve) => {
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
resolve();
|
|
187
|
+
}, waitTime);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function processInformAction(params) {
|
|
157
192
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
158
193
|
var _a, _b;
|
|
159
194
|
// アクション開始
|
|
@@ -219,4 +254,3 @@ function triggerWebhook(params) {
|
|
|
219
254
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
220
255
|
});
|
|
221
256
|
}
|
|
222
|
-
exports.triggerWebhook = triggerWebhook;
|
|
@@ -5,6 +5,7 @@ import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/o
|
|
|
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
|
+
import { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
8
9
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
9
10
|
interface IVoidTransactionRepos {
|
|
10
11
|
action: ActionRepo;
|
|
@@ -13,6 +14,7 @@ interface IVoidTransactionRepos {
|
|
|
13
14
|
offerRateLimit: OfferRateLimitRepo;
|
|
14
15
|
reservation: ReservationRepo;
|
|
15
16
|
task: TaskRepo;
|
|
17
|
+
transaction: TransactionRepo;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* イベントオファー承認取消(タスクから実行)
|