@chevre/domain 21.2.0-alpha.5 → 21.2.0-alpha.50
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/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/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 +12 -1
- package/lib/chevre/repo/action.js +9 -29
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +22 -7
- package/lib/chevre/repo/assetTransaction.js +173 -55
- 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/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/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.d.ts +5 -1
- package/lib/chevre/repo/place.js +1 -10
- 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 +38 -2
- package/lib/chevre/repo/task.js +96 -10
- 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/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -5
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +10 -4
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/registerService.js +1 -2
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- 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/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 +6 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +12 -25
- package/lib/chevre/service/payment/movieTicket.d.ts +4 -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/returnPayTransaction.js +1 -5
- 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/moneyTransfer.js +4 -4
- package/lib/chevre/service/transaction/orderProgramMembership.js +2 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +30 -29
- 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 -0
- package/lib/chevre/service/transaction/placeOrderInProgress.js +17 -10
- package/lib/chevre/service/transaction/returnOrder.js +1 -5
- package/lib/chevre/service/transaction.d.ts +6 -0
- package/lib/chevre/service/transaction.js +9 -7
- package/lib/chevre/settings.d.ts +4 -1
- package/lib/chevre/settings.js +11 -4
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
|
@@ -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)({
|
|
@@ -31,13 +31,6 @@ function verifyToken4reservation(params) {
|
|
|
31
31
|
orderNumber: payload.orderNumber,
|
|
32
32
|
reservationId: params.reservationId
|
|
33
33
|
});
|
|
34
|
-
// 注文検索
|
|
35
|
-
// const order: Pick<factory.order.IOrder, 'orderStatus' | 'acceptedOffers'> =
|
|
36
|
-
// await repos.order.findByOrderNumber({
|
|
37
|
-
// orderNumber: payload.orderNumber,
|
|
38
|
-
// inclusion: ['orderStatus', 'acceptedOffers'],
|
|
39
|
-
// exclusion: []
|
|
40
|
-
// });
|
|
41
34
|
// ステータス検証
|
|
42
35
|
switch (order.orderStatus) {
|
|
43
36
|
case factory.orderStatus.OrderDelivered:
|
|
@@ -75,7 +68,7 @@ function useReservation(params) {
|
|
|
75
68
|
// 取得属性最適化(2023-01-30~)
|
|
76
69
|
const reservation = yield repos.reservation.findById({
|
|
77
70
|
id: reservationId,
|
|
78
|
-
inclusion: ['
|
|
71
|
+
inclusion: ['_id', 'issuedThrough', 'project', 'reservationFor', 'reservationNumber', 'reservedTicket', 'typeOf']
|
|
79
72
|
});
|
|
80
73
|
// instrument?.tokenを検証
|
|
81
74
|
const token = (_a = params === null || params === void 0 ? void 0 : params.instrument) === null || _a === void 0 ? void 0 : _a.token;
|
|
@@ -95,7 +95,7 @@ function onRegistered(actionAttributes) {
|
|
|
95
95
|
taskAttributes.push(...orderProgramMembershipTasks);
|
|
96
96
|
}
|
|
97
97
|
// タスク保管
|
|
98
|
-
yield repos.task.saveMany(taskAttributes);
|
|
98
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
exports.onRegistered = onRegistered;
|
|
@@ -219,10 +219,6 @@ function onRefund(refundActionAttributes) {
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
// タスク保管
|
|
222
|
-
|
|
223
|
-
yield repos.task.saveMany(taskAttributes);
|
|
224
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
225
|
-
// return repos.task.save(taskAttribute);
|
|
226
|
-
// }));
|
|
222
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
227
223
|
});
|
|
228
224
|
}
|
|
@@ -17,6 +17,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
|
|
|
17
17
|
const reservation_1 = require("../../repo/reservation");
|
|
18
18
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
19
19
|
const task_1 = require("../../repo/task");
|
|
20
|
+
const transaction_1 = require("../../repo/transaction");
|
|
20
21
|
const EventOfferService = require("../offer/event");
|
|
21
22
|
/**
|
|
22
23
|
* タスク実行関数
|
|
@@ -38,7 +39,8 @@ function call(data) {
|
|
|
38
39
|
stockHolder: stockHolderRepo,
|
|
39
40
|
offerRateLimit: offerRateLimitRepo,
|
|
40
41
|
reservation: reservationRepo,
|
|
41
|
-
task: taskRepo
|
|
42
|
+
task: taskRepo,
|
|
43
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
}
|
|
@@ -16,11 +16,20 @@ export type TaskOperation<T> = (repos: {
|
|
|
16
16
|
task: TaskRepo;
|
|
17
17
|
}) => Promise<T>;
|
|
18
18
|
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
19
|
+
export declare function executeById(params: {
|
|
20
|
+
id: string;
|
|
21
|
+
executor?: {
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
}): IOperation<void>;
|
|
19
25
|
/**
|
|
20
26
|
* タスク名でタスクをひとつ実行する
|
|
21
27
|
*/
|
|
22
28
|
export declare function executeByName<T extends factory.taskName>(params: {
|
|
23
29
|
name: T;
|
|
30
|
+
executor?: {
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
24
33
|
}): IOperation<void>;
|
|
25
34
|
/**
|
|
26
35
|
* タスクを実行する
|
|
@@ -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.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = exports.executeByName = void 0;
|
|
12
|
+
exports.notifyAbortedTasks = exports.abort = exports.retry = exports.execute = exports.executeByName = exports.executeById = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* タスクサービス
|
|
15
15
|
*/
|
|
@@ -18,19 +18,54 @@ const factory = require("../factory");
|
|
|
18
18
|
const task_1 = require("../repo/task");
|
|
19
19
|
const NotificationService = require("./notification");
|
|
20
20
|
const factory_1 = require("./notification/factory");
|
|
21
|
+
const credentials_1 = require("../credentials");
|
|
21
22
|
const settings_1 = require("../settings");
|
|
22
23
|
const debug = createDebug('chevre-domain:service:task');
|
|
24
|
+
const DEFAULT_EXECUTOR_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
|
|
25
|
+
function executeById(params) {
|
|
26
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a;
|
|
28
|
+
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
29
|
+
// 未実行のタスクを取得
|
|
30
|
+
// tslint:disable-next-line:no-null-keyword
|
|
31
|
+
let task = null;
|
|
32
|
+
try {
|
|
33
|
+
task = yield taskRepo.executeById({
|
|
34
|
+
id: params.id,
|
|
35
|
+
executor: {
|
|
36
|
+
name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
42
|
+
/* istanbul ignore next */
|
|
43
|
+
debug('service.task.executeById error:', error);
|
|
44
|
+
}
|
|
45
|
+
// タスクがなければ終了
|
|
46
|
+
if (task !== null) {
|
|
47
|
+
yield execute(task)(settings);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.executeById = executeById;
|
|
23
52
|
/**
|
|
24
53
|
* タスク名でタスクをひとつ実行する
|
|
25
54
|
*/
|
|
26
55
|
function executeByName(params) {
|
|
27
56
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a;
|
|
28
58
|
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
29
59
|
// 未実行のタスクを取得
|
|
30
60
|
// tslint:disable-next-line:no-null-keyword
|
|
31
61
|
let task = null;
|
|
32
62
|
try {
|
|
33
|
-
task = yield taskRepo.executeOneByName(
|
|
63
|
+
task = yield taskRepo.executeOneByName({
|
|
64
|
+
name: params.name,
|
|
65
|
+
executor: {
|
|
66
|
+
name: (typeof ((_a = params.executor) === null || _a === void 0 ? void 0 : _a.name) === 'string') ? params.executor.name : DEFAULT_EXECUTOR_NAME
|
|
67
|
+
}
|
|
68
|
+
});
|
|
34
69
|
}
|
|
35
70
|
catch (error) {
|
|
36
71
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -106,7 +141,9 @@ function abort(params) {
|
|
|
106
141
|
}
|
|
107
142
|
// 開発者へ報告
|
|
108
143
|
const message = (0, factory_1.task2lineNotify)({ task: abortedTask });
|
|
109
|
-
yield NotificationService.report2developers(message.subject, message.content)(
|
|
144
|
+
yield NotificationService.report2developers(message.subject, message.content)({
|
|
145
|
+
accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
|
|
146
|
+
});
|
|
110
147
|
}
|
|
111
148
|
});
|
|
112
149
|
}
|
|
@@ -123,7 +160,9 @@ function notifyAbortedTasks(params) {
|
|
|
123
160
|
if (abortedTasks.length > 0) {
|
|
124
161
|
// 開発者へ報告
|
|
125
162
|
const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
|
|
126
|
-
yield NotificationService.report2developers(message.subject, message.content)(
|
|
163
|
+
yield NotificationService.report2developers(message.subject, message.content)({
|
|
164
|
+
accessToken: credentials_1.credentials.lineNotify.accessTokenAlert
|
|
165
|
+
});
|
|
127
166
|
}
|
|
128
167
|
});
|
|
129
168
|
}
|
|
@@ -545,7 +545,9 @@ function searchAuthorizeActions(params) {
|
|
|
545
545
|
purpose: {
|
|
546
546
|
typeOf: params.transaction.typeOf,
|
|
547
547
|
id: params.transaction.id
|
|
548
|
-
}
|
|
548
|
+
},
|
|
549
|
+
// Completedに絞る(2023-05-16~)
|
|
550
|
+
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
549
551
|
});
|
|
550
552
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
551
553
|
authorizeActions = authorizeActions.filter((a) => {
|
|
@@ -576,9 +578,7 @@ function exportTasksById(params) {
|
|
|
576
578
|
transaction,
|
|
577
579
|
runsAt: taskRunsAt
|
|
578
580
|
});
|
|
579
|
-
|
|
580
|
-
yield repos.task.saveMany(taskAttributes);
|
|
581
|
-
// await Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
|
|
581
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
exports.exportTasksById = exportTasksById;
|
|
@@ -78,7 +78,35 @@ function createTasks(params) {
|
|
|
78
78
|
object: transaction
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
// 確定取引にも決済承認中止タスクを追加(2023-05-03~)
|
|
82
|
+
const voidPaymentTaskAttributes = {
|
|
83
|
+
project: transaction.project,
|
|
84
|
+
name: factory.taskName.VoidPayTransaction,
|
|
85
|
+
status: factory.taskStatus.Ready,
|
|
86
|
+
runsAt: taskRunsAt,
|
|
87
|
+
remainingNumberOfTries: 10,
|
|
88
|
+
numberOfTried: 0,
|
|
89
|
+
executionResults: [],
|
|
90
|
+
data: {
|
|
91
|
+
project: transaction.project,
|
|
92
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// 確定取引にも興行オファー承認中止タスクを追加(2023-05-09~)
|
|
96
|
+
const voidReserveTaskAttributes = {
|
|
97
|
+
project: transaction.project,
|
|
98
|
+
name: factory.taskName.VoidReserveTransaction,
|
|
99
|
+
status: factory.taskStatus.Ready,
|
|
100
|
+
runsAt: taskRunsAt,
|
|
101
|
+
remainingNumberOfTries: 10,
|
|
102
|
+
numberOfTried: 0,
|
|
103
|
+
executionResults: [],
|
|
104
|
+
data: {
|
|
105
|
+
project: transaction.project,
|
|
106
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask, voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
82
110
|
switch (transaction.status) {
|
|
83
111
|
case factory.transactionStatusType.Confirmed:
|
|
84
112
|
const potentialActions = transaction.potentialActions;
|
|
@@ -107,22 +135,8 @@ function createTasks(params) {
|
|
|
107
135
|
};
|
|
108
136
|
taskAttributes.push(placeOrderTaskAttributes);
|
|
109
137
|
break;
|
|
110
|
-
// 期限切れor中止の場合は、タスクリストを作成する
|
|
111
138
|
case factory.transactionStatusType.Canceled:
|
|
112
139
|
case factory.transactionStatusType.Expired:
|
|
113
|
-
const voidReserveTaskAttributes = {
|
|
114
|
-
project: transaction.project,
|
|
115
|
-
name: factory.taskName.VoidReserveTransaction,
|
|
116
|
-
status: factory.taskStatus.Ready,
|
|
117
|
-
runsAt: taskRunsAt,
|
|
118
|
-
remainingNumberOfTries: 10,
|
|
119
|
-
numberOfTried: 0,
|
|
120
|
-
executionResults: [],
|
|
121
|
-
data: {
|
|
122
|
-
project: transaction.project,
|
|
123
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
140
|
const voidRegisterServiceTaskAttributes = {
|
|
127
141
|
project: transaction.project,
|
|
128
142
|
name: factory.taskName.VoidRegisterServiceTransaction,
|
|
@@ -136,19 +150,6 @@ function createTasks(params) {
|
|
|
136
150
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
137
151
|
}
|
|
138
152
|
};
|
|
139
|
-
const voidPaymentTaskAttributes = {
|
|
140
|
-
project: transaction.project,
|
|
141
|
-
name: factory.taskName.VoidPayTransaction,
|
|
142
|
-
status: factory.taskStatus.Ready,
|
|
143
|
-
runsAt: taskRunsAt,
|
|
144
|
-
remainingNumberOfTries: 10,
|
|
145
|
-
numberOfTried: 0,
|
|
146
|
-
executionResults: [],
|
|
147
|
-
data: {
|
|
148
|
-
project: transaction.project,
|
|
149
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
153
|
const voidMoneyTransferTaskAttributes = {
|
|
153
154
|
project: transaction.project,
|
|
154
155
|
name: factory.taskName.VoidMoneyTransferTransaction,
|
|
@@ -162,7 +163,7 @@ function createTasks(params) {
|
|
|
162
163
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
163
164
|
}
|
|
164
165
|
};
|
|
165
|
-
taskAttributes.push(
|
|
166
|
+
taskAttributes.push(voidRegisterServiceTaskAttributes, voidMoneyTransferTaskAttributes);
|
|
166
167
|
break;
|
|
167
168
|
default:
|
|
168
169
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -36,11 +36,7 @@ function exportTasksById(params) {
|
|
|
36
36
|
transaction,
|
|
37
37
|
runsAt: taskRunsAt
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
yield repos.task.saveMany(taskAttributes);
|
|
41
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
42
|
-
// await repos.task.save(taskAttribute);
|
|
43
|
-
// }));
|
|
39
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
44
40
|
});
|
|
45
41
|
}
|
|
46
42
|
exports.exportTasksById = exportTasksById;
|
|
@@ -4,7 +4,7 @@ exports.createStartParams = void 0;
|
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
5
|
function createStartParams(params, passport, seller, broker) {
|
|
6
6
|
var _a, _b, _c, _d;
|
|
7
|
-
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined
|
|
7
|
+
const transactionObject = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ passportToken: (typeof ((_a = params.object.passport) === null || _a === void 0 ? void 0 : _a.token) === 'string') ? params.object.passport.token : undefined }, (passport !== undefined) ? { passport } : undefined), (params.object.clientUser !== undefined && params.object.clientUser !== null)
|
|
8
8
|
? { clientUser: params.object.clientUser }
|
|
9
9
|
: undefined), (typeof ((_b = params.object) === null || _b === void 0 ? void 0 : _b.name) === 'string') ? { name: (_c = params.object) === null || _c === void 0 ? void 0 : _c.name } : undefined), (typeof (broker === null || broker === void 0 ? void 0 : broker.typeOf) === 'string') ? { broker: broker } : undefined), (typeof ((_d = params.object.customer) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { customer: params.object.customer } : undefined);
|
|
10
10
|
if (typeof seller.id !== 'string') {
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
3
3
|
export declare function createMoneyTransferActions(params: {
|
|
4
4
|
order: factory.order.IOrder;
|
|
5
5
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
6
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
6
7
|
}): Promise<factory.action.interact.confirm.moneyTransfer.IAttributes[]>;
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js
CHANGED
|
@@ -15,7 +15,7 @@ const order_1 = require("../../../../factory/order");
|
|
|
15
15
|
function createMoneyTransferActions(params) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const moneyTransferActions = [];
|
|
18
|
-
const authorizeMoneyTransferActions = params.
|
|
18
|
+
const authorizeMoneyTransferActions = params.authorizeActions
|
|
19
19
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
20
20
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
21
21
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
export declare function createRegisterServiceActions(params: {
|
|
3
3
|
order: factory.order.IOrder;
|
|
4
4
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
5
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
5
6
|
}): Promise<factory.action.interact.confirm.registerService.IAttributes[]>;
|
package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js
CHANGED
|
@@ -17,7 +17,7 @@ const order_1 = require("../../../../factory/order");
|
|
|
17
17
|
function createRegisterServiceActions(params) {
|
|
18
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const registerServiceActions = [];
|
|
20
|
-
const authorizeProductOfferActions = params.
|
|
20
|
+
const authorizeProductOfferActions = params.authorizeActions
|
|
21
21
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
22
22
|
.filter((a) => Array.isArray(a.object)
|
|
23
23
|
&& a.object.length > 0
|
|
@@ -7,4 +7,5 @@ export declare function createPotentialActions(params: {
|
|
|
7
7
|
potentialActions?: factory.transaction.placeOrder.IPotentialActionsParams;
|
|
8
8
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
9
9
|
emailMessage?: factory.creativeWork.message.email.ICreativeWork;
|
|
10
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
10
11
|
}): Promise<factory.transaction.placeOrder.IPotentialActions>;
|
|
@@ -3,12 +3,14 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
3
3
|
export type IAuthorizeSeatReservationOffer = factory.action.authorize.offer.seatReservation.IAction<factory.service.webAPI.Identifier>;
|
|
4
4
|
export declare function createReservationAcceptedOffers(params: {
|
|
5
5
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
6
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
6
7
|
}): {
|
|
7
8
|
reservationAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IReservation>[];
|
|
8
9
|
reservationOrderItems: factory.order.IOrderedItem[];
|
|
9
10
|
};
|
|
10
11
|
export declare function createProductItems(params: {
|
|
11
12
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
13
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
12
14
|
}): {
|
|
13
15
|
productAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IPermit>[];
|
|
14
16
|
productOrderItems: factory.order.IOrderedItem[];
|
|
@@ -16,6 +18,7 @@ export declare function createProductItems(params: {
|
|
|
16
18
|
export declare function createMoneyTransferAcceptedOffers(params: {
|
|
17
19
|
transaction: factory.transaction.placeOrder.ITransaction;
|
|
18
20
|
seller: factory.order.ISeller;
|
|
21
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
19
22
|
}): {
|
|
20
23
|
moneyTransferAcceptedOffers: factory.order.IAcceptedOffer<factory.order.IMoneyTransfer>[];
|
|
21
24
|
moneyTransferOrderItems: factory.order.IOrderedItem[];
|
|
@@ -7,7 +7,7 @@ function createReservationAcceptedOffers(params) {
|
|
|
7
7
|
const acceptedOffers = [];
|
|
8
8
|
const orderedItems = [];
|
|
9
9
|
// 座席予約に対する承認アクション取り出す
|
|
10
|
-
const seatReservationAuthorizeActions = params.
|
|
10
|
+
const seatReservationAuthorizeActions = params.authorizeActions
|
|
11
11
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
12
12
|
&& a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
13
13
|
const eventIds = [];
|
|
@@ -85,7 +85,7 @@ function reservationOffers2orderedItem(params) {
|
|
|
85
85
|
function createProductItems(params) {
|
|
86
86
|
const acceptedOffers = [];
|
|
87
87
|
const orderedItems = [];
|
|
88
|
-
const authorizePaymentCardOfferActions = params.
|
|
88
|
+
const authorizePaymentCardOfferActions = params.authorizeActions
|
|
89
89
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
90
90
|
.filter((a) => Array.isArray(a.object)
|
|
91
91
|
&& a.object.length > 0
|
|
@@ -117,7 +117,11 @@ function createProductItems(params) {
|
|
|
117
117
|
exports.createProductItems = createProductItems;
|
|
118
118
|
function createMoneyTransferAcceptedOffers(params) {
|
|
119
119
|
// 通貨転送承認アクション
|
|
120
|
-
const authorizeMoneyTansferActions = params.transaction.object.authorizeActions
|
|
120
|
+
// const authorizeMoneyTansferActions = (<IAuthorizeMoneyTransferOffer[]>params.transaction.object.authorizeActions)
|
|
121
|
+
// .filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
122
|
+
// .filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
123
|
+
// .filter((a) => a.object.itemOffered?.typeOf === factory.actionType.MoneyTransfer);
|
|
124
|
+
const authorizeMoneyTansferActions = params.authorizeActions
|
|
121
125
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
122
126
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
123
127
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
|
@@ -23,7 +23,7 @@ function createOrder(params) {
|
|
|
23
23
|
];
|
|
24
24
|
const orderedItems = [...reservationOrderItems, ...moneyTransferOrderItems, ...productOrderItems];
|
|
25
25
|
// 決済方法をセット
|
|
26
|
-
const { paymentMethods, price } = createPaymentMethods({ transaction: params.transaction });
|
|
26
|
+
const { paymentMethods, price } = createPaymentMethods({ transaction: params.transaction, authorizeActions: params.authorizeActions });
|
|
27
27
|
const discounts = [];
|
|
28
28
|
const name = (typeof params.transaction.object.name === 'string') ? params.transaction.object.name : undefined;
|
|
29
29
|
const broker = (typeof ((_a = params.transaction.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? params.transaction.object.broker : undefined;
|
|
@@ -62,7 +62,7 @@ function createCustomer(params) {
|
|
|
62
62
|
function createPaymentMethods(params) {
|
|
63
63
|
const paymentMethods = [];
|
|
64
64
|
let price = 0;
|
|
65
|
-
const authorizePaymentActions = params.
|
|
65
|
+
const authorizePaymentActions = params.authorizeActions
|
|
66
66
|
.filter((a) => {
|
|
67
67
|
var _a;
|
|
68
68
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import * as factory from '../../../../factory';
|
|
|
2
2
|
/**
|
|
3
3
|
* 座席予約オファー承認に対してムビチケ承認条件が整っているかどうか検証する
|
|
4
4
|
*/
|
|
5
|
-
export declare function validateMovieTicket(paymentMethodType: string, transaction: factory.transaction.placeOrder.ITransaction): void;
|
|
5
|
+
export declare function validateMovieTicket(paymentMethodType: string, transaction: factory.transaction.placeOrder.ITransaction, authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[]): void;
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -10,8 +10,8 @@ const debug = createDebug('cinerino-domain:service:validateMovieTicket');
|
|
|
10
10
|
/**
|
|
11
11
|
* 座席予約オファー承認に対してムビチケ承認条件が整っているかどうか検証する
|
|
12
12
|
*/
|
|
13
|
-
function validateMovieTicket(paymentMethodType, transaction) {
|
|
14
|
-
const authorizeActions = transaction.object.authorizeActions;
|
|
13
|
+
function validateMovieTicket(paymentMethodType, transaction, authorizeActions) {
|
|
14
|
+
// const authorizeActions = transaction.object.authorizeActions;
|
|
15
15
|
const authorizeMovieTicketActions = authorizeActions.filter((a) => {
|
|
16
16
|
var _a, _b, _c;
|
|
17
17
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|