@chevre/domain 21.4.0-alpha.14 → 21.4.0-alpha.16
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/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/migrateReservationProvider.ts +107 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -3
- package/lib/chevre/repo/order.d.ts +3 -0
- package/lib/chevre/repo/order.js +5 -5
- package/lib/chevre/repo/reservation.d.ts +33 -20
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -38
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +6 -21
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +12 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -1
- package/package.json +3 -3
|
@@ -23,22 +23,15 @@ function cancelPendingReservation(actionAttributes) {
|
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
var _a;
|
|
25
25
|
const now = new Date();
|
|
26
|
-
|
|
26
|
+
const canceledReservations = [];
|
|
27
27
|
const { reserveTransaction } = yield cancelPengindIfNotYet(actionAttributes, now)(repos);
|
|
28
28
|
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
29
29
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
30
30
|
// Pendingが存在しない場合は検索しても無駄(2023-06-05~)
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
typeOf: factory.reservationType.EventReservation
|
|
36
|
-
});
|
|
37
|
-
canceledReservations = canceledReservations.map((r) => {
|
|
38
|
-
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
39
|
-
delete r._id;
|
|
40
|
-
return r;
|
|
41
|
-
});
|
|
33
|
+
// 完全廃止(2023-07-19~)
|
|
34
|
+
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
37
|
yield (0, onReservationCanceled_1.onReservationCanceled)(canceledReservations, false, {
|
|
@@ -48,7 +41,7 @@ function cancelPendingReservation(actionAttributes) {
|
|
|
48
41
|
});
|
|
49
42
|
}
|
|
50
43
|
exports.cancelPendingReservation = cancelPendingReservation;
|
|
51
|
-
function cancelPengindIfNotYet(params,
|
|
44
|
+
function cancelPengindIfNotYet(params, __) {
|
|
52
45
|
// tslint:disable-next-line:max-func-body-length
|
|
53
46
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
47
|
const actionAttributes = params;
|
|
@@ -83,7 +76,7 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
83
76
|
// アクション開始
|
|
84
77
|
const action = yield repos.action.start(actionAttributes);
|
|
85
78
|
const actionObject = actionAttributes.object;
|
|
86
|
-
let cancelResult;
|
|
79
|
+
// let cancelResult: ICancelResult | undefined;
|
|
87
80
|
try {
|
|
88
81
|
if (reserveTransaction !== undefined) {
|
|
89
82
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
@@ -126,12 +119,8 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
126
119
|
// disablePendingReservationsの場合は処理不要(2023-06-05~)
|
|
127
120
|
}
|
|
128
121
|
else {
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
reservationNumber: actionObject.reservationNumber,
|
|
132
|
-
previousReservationStatus: actionObject.reservationStatus,
|
|
133
|
-
modifiedTime: now
|
|
134
|
-
});
|
|
122
|
+
// 完全廃止(2023-07-19~)
|
|
123
|
+
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
135
124
|
}
|
|
136
125
|
}
|
|
137
126
|
else {
|
|
@@ -152,17 +141,15 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
152
141
|
throw error;
|
|
153
142
|
}
|
|
154
143
|
// アクション完了
|
|
155
|
-
const actionResult =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
} : undefined
|
|
144
|
+
const actionResult = {
|
|
145
|
+
// ...(cancelResult !== undefined) ? {
|
|
146
|
+
// cancelResult: {
|
|
147
|
+
// matchedCount: cancelResult.matchedCount,
|
|
148
|
+
// modifiedCount: cancelResult.modifiedCount
|
|
149
|
+
// }
|
|
150
|
+
// } : undefined
|
|
164
151
|
// canceledReservationId: canceledReservation?.id
|
|
165
|
-
|
|
152
|
+
};
|
|
166
153
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
167
154
|
}
|
|
168
155
|
return { reserveTransaction };
|
|
@@ -51,7 +51,7 @@ exports.confirmReservation = confirmReservation;
|
|
|
51
51
|
function reserveIfNotYet(params, options) {
|
|
52
52
|
// tslint:disable-next-line:max-func-body-length
|
|
53
53
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
var _a;
|
|
54
|
+
var _a, _b;
|
|
55
55
|
const reservationPackage = params.object;
|
|
56
56
|
// 冪等性を担保(2023-05-31~)
|
|
57
57
|
debug('searching completed reserveAction... byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
@@ -97,50 +97,32 @@ function reserveIfNotYet(params, options) {
|
|
|
97
97
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
98
98
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
99
99
|
const subReservations = reserveTransaction.object.subReservation;
|
|
100
|
-
|
|
100
|
+
const issuedThrough = reserveTransaction.object.issuedThrough;
|
|
101
|
+
if (Array.isArray(subReservations)
|
|
102
|
+
&& typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) === 'string'
|
|
103
|
+
&& typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') {
|
|
101
104
|
// confirmManyに変更(2023-06-13~)
|
|
102
105
|
const confirmManyIfNotExistResult = yield repos.reservation.confirmManyIfNotExist({
|
|
106
|
+
provider: (typeof ((_b = reserveTransaction.object.provider) === null || _b === void 0 ? void 0 : _b.id) === 'string')
|
|
107
|
+
? reserveTransaction.object.provider
|
|
108
|
+
: { id: reserveTransaction.agent.id, typeOf: factory.organizationType.Corporation },
|
|
103
109
|
subReservation: subReservations,
|
|
110
|
+
issuedThrough,
|
|
104
111
|
reservationFor,
|
|
105
112
|
underName,
|
|
106
|
-
broker: reserveTransaction.object.broker
|
|
107
|
-
issuedThrough: reserveTransaction.object.issuedThrough
|
|
113
|
+
broker: reserveTransaction.object.broker
|
|
108
114
|
});
|
|
109
115
|
debug('confirmManyIfNotExistResult:', confirmManyIfNotExistResult, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
110
|
-
// await Promise.all(subReservations.map(async (subReservation) => {
|
|
111
|
-
// await repos.reservation.confirmByIdIfNotExist({
|
|
112
|
-
// reservation: subReservation,
|
|
113
|
-
// reservationFor,
|
|
114
|
-
// underName,
|
|
115
|
-
// broker: reserveTransaction.object.broker,
|
|
116
|
-
// issuedThrough: reserveTransaction.object.issuedThrough
|
|
117
|
-
// });
|
|
118
|
-
// }));
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
else {
|
|
122
|
-
//
|
|
123
|
-
|
|
124
|
-
reservationNumber: reservationPackage.reservationNumber,
|
|
125
|
-
previousReservationStatus: reservationPackage.reservationStatus,
|
|
126
|
-
underName,
|
|
127
|
-
broker: reserveTransaction.object.broker,
|
|
128
|
-
issuedThrough: reserveTransaction.object.issuedThrough
|
|
129
|
-
});
|
|
119
|
+
// 完全廃止(2023-07-19~)
|
|
120
|
+
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
130
121
|
}
|
|
131
122
|
}
|
|
132
123
|
else {
|
|
133
124
|
// 廃止(2023-01-18)
|
|
134
125
|
throw new factory.errors.Forbidden(`${reservationPackage.typeOf} not acceptable`);
|
|
135
|
-
// 予約を確定状態に変更する
|
|
136
|
-
// await repos.reservation.confirm<factory.reservationType.EventReservation>({
|
|
137
|
-
// id: reservation.id,
|
|
138
|
-
// previousReservationStatus: reservation.reservationStatus,
|
|
139
|
-
// underName: reservation.underName
|
|
140
|
-
// });
|
|
141
|
-
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
142
|
-
// delete (<any>reservation)._id;
|
|
143
|
-
// confirmedReservations.push(reservation);
|
|
144
126
|
}
|
|
145
127
|
}
|
|
146
128
|
catch (error) {
|
|
@@ -27,7 +27,8 @@ function verifyToken4reservation(params) {
|
|
|
27
27
|
// reservationIdを含む注文の存在を確認するだけでよい(2023-01-31~)
|
|
28
28
|
const order = yield repos.order.findByOrderNumberAndReservationId({
|
|
29
29
|
orderNumber: payload.orderNumber,
|
|
30
|
-
reservationId: params.reservationId
|
|
30
|
+
reservationId: params.reservationId,
|
|
31
|
+
seller: params.seller
|
|
31
32
|
});
|
|
32
33
|
// ステータス検証
|
|
33
34
|
switch (order.orderStatus) {
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.160.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.316.0-alpha.0",
|
|
13
|
+
"@cinerino/sdk": "3.160.0-alpha.5",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.4.0-alpha.
|
|
120
|
+
"version": "21.4.0-alpha.16"
|
|
121
121
|
}
|