@chevre/domain 21.4.0-alpha.9 → 21.5.0-alpha.0
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/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
- package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
- package/example/src/chevre/importEventsFromCOA.ts +5 -4
- package/example/src/chevre/migrateEventOrganizer.ts +18 -5
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
- package/example/src/chevre/migrateReservationProvider.ts +119 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchActions.ts +1 -1
- package/example/src/chevre/searchPermissions.ts +7 -15
- 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.d.ts +24 -0
- package/lib/chevre/repo/event.js +43 -1
- package/lib/chevre/repo/member.d.ts +92 -5
- package/lib/chevre/repo/member.js +125 -97
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/member.js +22 -8
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/paymentServiceProvider.d.ts +5 -0
- package/lib/chevre/repo/paymentServiceProvider.js +11 -0
- package/lib/chevre/repo/place.d.ts +68 -16
- package/lib/chevre/repo/place.js +121 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/productOffer.d.ts +5 -0
- package/lib/chevre/repo/productOffer.js +16 -0
- package/lib/chevre/repo/project.d.ts +5 -3
- package/lib/chevre/repo/project.js +48 -8
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/role.d.ts +0 -4
- package/lib/chevre/repo/role.js +0 -46
- package/lib/chevre/repo/seller.d.ts +14 -2
- package/lib/chevre/repo/seller.js +13 -8
- package/lib/chevre/repo/stockHolder.d.ts +2 -77
- package/lib/chevre/repo/stockHolder.js +200 -476
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/aggregation/project.js +5 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +10 -2
- package/lib/chevre/service/assetTransaction/registerService.js +7 -3
- 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 +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +11 -0
- package/lib/chevre/service/event/createEvent.js +112 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +8 -4
- package/lib/chevre/service/iam.d.ts +5 -0
- package/lib/chevre/service/iam.js +7 -19
- package/lib/chevre/service/moneyTransfer.js +6 -2
- package/lib/chevre/service/notification.js +5 -1
- 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/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +5 -1
- package/lib/chevre/service/payment/paymentCard.js +6 -4
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +14 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/onResourceUpdated.js +128 -39
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +6 -2
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +7 -7
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/searchHoldReservations.ts +0 -38
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
|
@@ -14,6 +14,7 @@ const order_1 = require("../../factory/order");
|
|
|
14
14
|
const factory_1 = require("../delivery/factory");
|
|
15
15
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
+
// tslint:disable-next-line:max-func-body-length
|
|
17
18
|
function returnOrder(params) {
|
|
18
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
const orderNumber = params.object.orderNumber;
|
|
@@ -21,7 +22,12 @@ function returnOrder(params) {
|
|
|
21
22
|
? params.object.dateReturned
|
|
22
23
|
: new Date();
|
|
23
24
|
const returner = params.agent;
|
|
24
|
-
let order = yield repos.order.findByOrderNumber({
|
|
25
|
+
let order = yield repos.order.findByOrderNumber({
|
|
26
|
+
orderNumber,
|
|
27
|
+
project: { id: params.project.id },
|
|
28
|
+
inclusion: [],
|
|
29
|
+
exclusion: []
|
|
30
|
+
});
|
|
25
31
|
// プロジェクト条件検証
|
|
26
32
|
if (order.project.id !== params.project.id) {
|
|
27
33
|
throw new factory.errors.NotFound('Order');
|
|
@@ -59,6 +65,7 @@ function returnOrder(params) {
|
|
|
59
65
|
returnedOwnershipInfos = yield processReturnOrder(order, dateReturned)({ ownershipInfo: repos.ownershipInfo });
|
|
60
66
|
// 注文ステータス変更
|
|
61
67
|
order = yield repos.order.returnOrder({
|
|
68
|
+
project: { id: order.project.id },
|
|
62
69
|
orderNumber,
|
|
63
70
|
dateReturned,
|
|
64
71
|
returner
|
|
@@ -31,7 +31,12 @@ function sendOrder(params) {
|
|
|
31
31
|
orderNumber
|
|
32
32
|
})({ transaction: repos.transaction });
|
|
33
33
|
// 注文取得
|
|
34
|
-
let order = yield repos.order.findByOrderNumber({
|
|
34
|
+
let order = yield repos.order.findByOrderNumber({
|
|
35
|
+
orderNumber,
|
|
36
|
+
project: { id: params.project.id },
|
|
37
|
+
inclusion: [],
|
|
38
|
+
exclusion: []
|
|
39
|
+
});
|
|
35
40
|
// プロジェクト条件検証
|
|
36
41
|
if (order.project.id !== params.project.id) {
|
|
37
42
|
throw new factory.errors.NotFound('Order');
|
|
@@ -69,6 +74,7 @@ function sendOrder(params) {
|
|
|
69
74
|
return repos.ownershipInfo.createIfNotExistByIdentifier(ownershipInfo);
|
|
70
75
|
})));
|
|
71
76
|
order = yield repos.order.changeStatus({
|
|
77
|
+
project: { id: order.project.id },
|
|
72
78
|
orderNumber,
|
|
73
79
|
orderStatus: factory.orderStatus.OrderDelivered,
|
|
74
80
|
previousOrderStatus: factory.orderStatus.OrderProcessing
|
|
@@ -98,6 +104,7 @@ function sendOrder(params) {
|
|
|
98
104
|
// すでにOrderReturnedだった場合、OrderDelivered->OrderReturnedの処理自体は成功しているので、後処理を続行する
|
|
99
105
|
const currentOrder = yield repos.order.findByOrderNumber({
|
|
100
106
|
orderNumber: params.object.orderNumber,
|
|
107
|
+
project: { id: params.project.id },
|
|
101
108
|
inclusion: ['orderStatus'],
|
|
102
109
|
exclusion: []
|
|
103
110
|
});
|
|
@@ -28,7 +28,11 @@ const debug = createDebug('chevre-domain:service:payment');
|
|
|
28
28
|
function authorize(params, paymentServiceId, searchTrade4accountId) {
|
|
29
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
var _a, _b, _c, _d;
|
|
31
|
-
const project = yield repos.project.findById({
|
|
31
|
+
const project = yield repos.project.findById({
|
|
32
|
+
id: params.project.id,
|
|
33
|
+
inclusion: ['settings'],
|
|
34
|
+
exclusion: []
|
|
35
|
+
});
|
|
32
36
|
// CreditCard系統の決済方法タイプは動的
|
|
33
37
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
34
38
|
if (typeof paymentMethodType !== 'string') {
|
|
@@ -23,7 +23,11 @@ const accountTransactionIdentifier_1 = require("../../factory/accountTransaction
|
|
|
23
23
|
function authorize(params, paymentServiceId) {
|
|
24
24
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
var _a;
|
|
26
|
-
const project = yield repos.project.findById({
|
|
26
|
+
const project = yield repos.project.findById({
|
|
27
|
+
id: params.project.id,
|
|
28
|
+
inclusion: ['_id', 'typeOf'],
|
|
29
|
+
exclusion: []
|
|
30
|
+
});
|
|
27
31
|
const transactionNumber = params.transactionNumber;
|
|
28
32
|
if (typeof transactionNumber !== 'string') {
|
|
29
33
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
@@ -75,9 +79,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
75
79
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
76
80
|
}
|
|
77
81
|
// プロダクトから通貨区分を取得
|
|
78
|
-
const paymentCatdProduct = yield repos.product.findById({
|
|
79
|
-
id: paymentServiceId
|
|
80
|
-
});
|
|
82
|
+
const paymentCatdProduct = yield repos.product.findById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
81
83
|
const currency = (_e = (_d = paymentCatdProduct.serviceOutput) === null || _d === void 0 ? void 0 : _d.amount) === null || _e === void 0 ? void 0 : _e.currency;
|
|
82
84
|
if (typeof currency !== 'string') {
|
|
83
85
|
throw new factory.errors.NotFound('product.serviceOutput.amount.currency');
|
|
@@ -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,34 @@ 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
|
-
|
|
125
|
-
|
|
126
|
-
underName,
|
|
127
|
-
broker: reserveTransaction.object.broker,
|
|
128
|
-
issuedThrough: reserveTransaction.object.issuedThrough
|
|
129
|
-
});
|
|
119
|
+
// 旧予約取引に対して本処理が走る可能性がなくはないが、
|
|
120
|
+
// それらについては実質Confirmedの予約はすでに存在するはずなので、何もしない
|
|
121
|
+
// 完全廃止(2023-07-19~)
|
|
122
|
+
// throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
130
123
|
}
|
|
131
124
|
}
|
|
132
125
|
else {
|
|
133
126
|
// 廃止(2023-01-18)
|
|
134
127
|
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
128
|
}
|
|
145
129
|
}
|
|
146
130
|
catch (error) {
|
|
@@ -26,8 +26,10 @@ function verifyToken4reservation(params) {
|
|
|
26
26
|
case factory.order.OrderType.Order:
|
|
27
27
|
// reservationIdを含む注文の存在を確認するだけでよい(2023-01-31~)
|
|
28
28
|
const order = yield repos.order.findByOrderNumberAndReservationId({
|
|
29
|
+
project: { id: params.project.id },
|
|
29
30
|
orderNumber: payload.orderNumber,
|
|
30
|
-
reservationId: params.reservationId
|
|
31
|
+
reservationId: params.reservationId,
|
|
32
|
+
seller: params.seller
|
|
31
33
|
});
|
|
32
34
|
// ステータス検証
|
|
33
35
|
switch (order.orderStatus) {
|
|
@@ -4,4 +4,4 @@ export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
|
4
4
|
/**
|
|
5
5
|
* タスク実行関数
|
|
6
6
|
*/
|
|
7
|
-
export declare function call(data: factory.task.
|
|
7
|
+
export declare function call(data: factory.task.createEvent.IData): IOperation<void>;
|
|
@@ -10,14 +10,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const action_1 = require("../../repo/action");
|
|
14
|
+
const event_1 = require("../../repo/event");
|
|
13
15
|
const place_1 = require("../../repo/place");
|
|
16
|
+
const task_1 = require("../../repo/task");
|
|
17
|
+
const EventService = require("../event");
|
|
14
18
|
/**
|
|
15
19
|
* タスク実行関数
|
|
16
20
|
*/
|
|
17
21
|
function call(data) {
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield EventService.createEvent(data)({
|
|
24
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
25
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
26
|
+
place: new place_1.MongoRepository(settings.connection),
|
|
27
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
28
|
+
});
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
31
|
exports.call = call;
|
|
@@ -12,10 +12,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const accountTitle_1 = require("../../repo/accountTitle");
|
|
15
|
+
const action_1 = require("../../repo/action");
|
|
15
16
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
16
17
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
18
|
+
const event_1 = require("../../repo/event");
|
|
19
|
+
const member_1 = require("../../repo/member");
|
|
20
|
+
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
17
21
|
const place_1 = require("../../repo/place");
|
|
18
22
|
const product_1 = require("../../repo/product");
|
|
23
|
+
const productOffer_1 = require("../../repo/productOffer");
|
|
19
24
|
const task_1 = require("../../repo/task");
|
|
20
25
|
const settings_1 = require("../../settings");
|
|
21
26
|
const informResources = settings_1.settings.onResourceUpdated.informResource;
|
|
@@ -26,10 +31,15 @@ function call(data) {
|
|
|
26
31
|
return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
27
32
|
yield onResourceUpdated(data)({
|
|
28
33
|
accountTitle: new accountTitle_1.MongoRepository(connectionSettings.connection),
|
|
34
|
+
action: new action_1.MongoRepository(connectionSettings.connection),
|
|
29
35
|
categoryCode: new categoryCode_1.MongoRepository(connectionSettings.connection),
|
|
30
36
|
creativeWork: new creativeWork_1.MongoRepository(connectionSettings.connection),
|
|
37
|
+
event: new event_1.MongoRepository(connectionSettings.connection),
|
|
38
|
+
member: new member_1.MongoRepository(connectionSettings.connection),
|
|
39
|
+
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(connectionSettings.connection),
|
|
31
40
|
place: new place_1.MongoRepository(connectionSettings.connection),
|
|
32
41
|
product: new product_1.MongoRepository(connectionSettings.connection),
|
|
42
|
+
productOffer: new productOffer_1.MongoRepository(connectionSettings.connection),
|
|
33
43
|
task: new task_1.MongoRepository(connectionSettings.connection)
|
|
34
44
|
});
|
|
35
45
|
});
|
|
@@ -37,38 +47,65 @@ function call(data) {
|
|
|
37
47
|
exports.call = call;
|
|
38
48
|
function onResourceUpdated(params) {
|
|
39
49
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
|
|
50
|
+
const isDeleted = params.isDeleted === true;
|
|
51
|
+
if (isDeleted) {
|
|
41
52
|
switch (params.typeOf) {
|
|
42
|
-
case factory.
|
|
43
|
-
yield
|
|
53
|
+
case factory.organizationType.Corporation:
|
|
54
|
+
yield deleteResourcesBySeller({
|
|
44
55
|
project: { id: params.project.id },
|
|
45
|
-
ids: params.id
|
|
46
|
-
typeOf: params.typeOf
|
|
47
|
-
})(repos);
|
|
48
|
-
break;
|
|
49
|
-
case factory.product.ProductType.EventService:
|
|
50
|
-
yield createInformProductTasks({
|
|
51
|
-
project: { id: params.project.id },
|
|
52
|
-
ids: params.id,
|
|
53
|
-
typeOf: params.typeOf
|
|
54
|
-
})(repos);
|
|
55
|
-
break;
|
|
56
|
-
case 'CategoryCode':
|
|
57
|
-
yield createInformCategoryCodeTasks({
|
|
58
|
-
project: { id: params.project.id },
|
|
59
|
-
ids: params.id,
|
|
60
|
-
typeOf: params.typeOf
|
|
56
|
+
ids: params.id
|
|
61
57
|
})(repos);
|
|
62
58
|
break;
|
|
59
|
+
default:
|
|
60
|
+
// no op
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (params.useInform === true) {
|
|
65
|
+
switch (params.typeOf) {
|
|
66
|
+
case factory.creativeWorkType.Movie:
|
|
67
|
+
yield createInformMovieTasks({
|
|
68
|
+
project: { id: params.project.id },
|
|
69
|
+
ids: params.id,
|
|
70
|
+
typeOf: params.typeOf
|
|
71
|
+
})(repos);
|
|
72
|
+
break;
|
|
73
|
+
case factory.product.ProductType.EventService:
|
|
74
|
+
yield createInformProductTasks({
|
|
75
|
+
project: { id: params.project.id },
|
|
76
|
+
ids: params.id,
|
|
77
|
+
typeOf: params.typeOf
|
|
78
|
+
})(repos);
|
|
79
|
+
break;
|
|
80
|
+
case 'CategoryCode':
|
|
81
|
+
yield createInformCategoryCodeTasks({
|
|
82
|
+
project: { id: params.project.id },
|
|
83
|
+
ids: params.id,
|
|
84
|
+
typeOf: params.typeOf
|
|
85
|
+
})(repos);
|
|
86
|
+
break;
|
|
87
|
+
case factory.placeType.MovieTheater:
|
|
88
|
+
yield createInformMovieTheaterTasks({
|
|
89
|
+
project: { id: params.project.id },
|
|
90
|
+
ids: params.id,
|
|
91
|
+
typeOf: params.typeOf
|
|
92
|
+
})(repos);
|
|
93
|
+
break;
|
|
94
|
+
case 'AccountTitle':
|
|
95
|
+
yield createInformAccountTitleTasks({
|
|
96
|
+
project: { id: params.project.id },
|
|
97
|
+
ids: params.id,
|
|
98
|
+
typeOf: params.typeOf
|
|
99
|
+
})(repos);
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
// no op
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
switch (params.typeOf) {
|
|
106
|
+
// 施設名称を同期する(2023-06-29~)
|
|
63
107
|
case factory.placeType.MovieTheater:
|
|
64
|
-
yield
|
|
65
|
-
project: { id: params.project.id },
|
|
66
|
-
ids: params.id,
|
|
67
|
-
typeOf: params.typeOf
|
|
68
|
-
})(repos);
|
|
69
|
-
break;
|
|
70
|
-
case 'AccountTitle':
|
|
71
|
-
yield createInformAccountTitleTasks({
|
|
108
|
+
yield syncMovieTheater({
|
|
72
109
|
project: { id: params.project.id },
|
|
73
110
|
ids: params.id,
|
|
74
111
|
typeOf: params.typeOf
|
|
@@ -78,18 +115,6 @@ function onResourceUpdated(params) {
|
|
|
78
115
|
// no op
|
|
79
116
|
}
|
|
80
117
|
}
|
|
81
|
-
switch (params.typeOf) {
|
|
82
|
-
// 施設名称を同期する(2023-06-29~)
|
|
83
|
-
case factory.placeType.MovieTheater:
|
|
84
|
-
yield syncMovieTheater({
|
|
85
|
-
project: { id: params.project.id },
|
|
86
|
-
ids: params.id,
|
|
87
|
-
typeOf: params.typeOf
|
|
88
|
-
})(repos);
|
|
89
|
-
break;
|
|
90
|
-
default:
|
|
91
|
-
// no op
|
|
92
|
-
}
|
|
93
118
|
});
|
|
94
119
|
}
|
|
95
120
|
function createInformMovieTasks(params) {
|
|
@@ -394,3 +419,67 @@ function syncMovieTheater(params) {
|
|
|
394
419
|
});
|
|
395
420
|
});
|
|
396
421
|
}
|
|
422
|
+
function deleteResourcesBySeller(params) {
|
|
423
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
if (params.ids.length !== 1) {
|
|
425
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
426
|
+
}
|
|
427
|
+
for (const sellerId of params.ids) {
|
|
428
|
+
const deleteActionAttributes = {
|
|
429
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
430
|
+
object: { id: sellerId, typeOf: factory.organizationType.Corporation },
|
|
431
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
432
|
+
typeOf: factory.actionType.DeleteAction
|
|
433
|
+
};
|
|
434
|
+
let deleteResult;
|
|
435
|
+
const action = yield repos.action.start(deleteActionAttributes);
|
|
436
|
+
try {
|
|
437
|
+
// メンバー削除
|
|
438
|
+
const deleteMemberResult = yield repos.member.deleteManyByMemberOfId({
|
|
439
|
+
project: { id: params.project.id },
|
|
440
|
+
member: {
|
|
441
|
+
memberOf: {
|
|
442
|
+
id: { $eq: sellerId },
|
|
443
|
+
typeOf: { $eq: factory.organizationType.Corporation }
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
// 提供決済サービス削除
|
|
448
|
+
const deletePaymentServiceProviderResult = yield repos.paymentServiceProvider.deleteManyByProviderId({
|
|
449
|
+
project: { id: params.project.id },
|
|
450
|
+
id: sellerId
|
|
451
|
+
});
|
|
452
|
+
// プロダクトオファー削除
|
|
453
|
+
const deleteProductOfferResult = yield repos.productOffer.deleteManyBySellerId({
|
|
454
|
+
project: { id: params.project.id },
|
|
455
|
+
seller: { id: sellerId }
|
|
456
|
+
});
|
|
457
|
+
// イベント削除
|
|
458
|
+
const deleteEventResult = yield repos.event.deleteManyByOrganizerId({
|
|
459
|
+
project: { id: params.project.id },
|
|
460
|
+
organizer: { id: sellerId }
|
|
461
|
+
});
|
|
462
|
+
// 施設削除
|
|
463
|
+
const deletePlaceResult = yield repos.place.deleteManyByParentOrganizationId({
|
|
464
|
+
project: { id: params.project.id },
|
|
465
|
+
parentOrganization: { id: sellerId }
|
|
466
|
+
});
|
|
467
|
+
deleteResult = {
|
|
468
|
+
deleteMemberResult, deletePaymentServiceProviderResult, deleteProductOfferResult,
|
|
469
|
+
deleteEventResult, deletePlaceResult
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
catch (error) {
|
|
473
|
+
try {
|
|
474
|
+
const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
|
|
475
|
+
yield repos.action.giveUp({ typeOf: deleteActionAttributes.typeOf, id: action.id, error: actionError });
|
|
476
|
+
}
|
|
477
|
+
catch (_) {
|
|
478
|
+
// no op
|
|
479
|
+
}
|
|
480
|
+
throw error;
|
|
481
|
+
}
|
|
482
|
+
yield repos.action.complete({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
@@ -34,7 +34,11 @@ function findCreditCard(params) {
|
|
|
34
34
|
// throw new factory.errors.NotFound('CreditCard');
|
|
35
35
|
// }
|
|
36
36
|
var _a;
|
|
37
|
-
const project = yield repos.project.findById({
|
|
37
|
+
const project = yield repos.project.findById({
|
|
38
|
+
id: params.project.id,
|
|
39
|
+
inclusion: ['settings'],
|
|
40
|
+
exclusion: []
|
|
41
|
+
});
|
|
38
42
|
// const userPoolId: string = params.iss;
|
|
39
43
|
// checkUseMyCreditCards(project);
|
|
40
44
|
let memberId = params.customer.id;
|
|
@@ -112,7 +116,7 @@ function getCreditCardPaymentServiceChannel(params) {
|
|
|
112
116
|
throw new factory.errors.NotFound('PaymentService');
|
|
113
117
|
}
|
|
114
118
|
// IDで検索いないとavailableChannelを取得できない
|
|
115
|
-
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) });
|
|
119
|
+
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) }, ['availableChannel'], []);
|
|
116
120
|
const availableChannel = paymentService === null || paymentService === void 0 ? void 0 : paymentService.availableChannel;
|
|
117
121
|
if (typeof (availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.serviceUrl) !== 'string') {
|
|
118
122
|
throw new factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -39,8 +39,6 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
39
39
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
40
40
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
41
41
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
42
|
-
export declare const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment;
|
|
43
|
-
export declare const USE_NEW_STOCK_HOLDER_REPO_IDS: string[];
|
|
44
42
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
45
43
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
46
44
|
/**
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.
|
|
3
|
+
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -65,12 +65,12 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
65
65
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
66
66
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
67
67
|
: moment('2023-08-31T15:00:00Z');
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
// export const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
|
|
69
|
+
// ? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
|
|
70
|
+
// : moment('2024-11-30T15:00:00Z');
|
|
71
|
+
// export const USE_NEW_STOCK_HOLDER_REPO_IDS: string[] = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
72
|
+
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
73
|
+
// : [];
|
|
74
74
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
75
75
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
76
76
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.318.0",
|
|
13
|
+
"@cinerino/sdk": "3.162.0-alpha.6",
|
|
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.
|
|
120
|
+
"version": "21.5.0-alpha.0"
|
|
121
121
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
-
|
|
9
|
-
const orderRepo = new chevre.repository.Order(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const order = await orderRepo.findByOrderNumberAndReservationId({
|
|
12
|
-
orderNumber: 'CIN9-4783801-1618274',
|
|
13
|
-
reservationId: '139787058570943-0'
|
|
14
|
-
});
|
|
15
|
-
console.log('order found', order);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
main()
|
|
19
|
-
.then()
|
|
20
|
-
.catch(console.error);
|