@chevre/domain 21.8.0-alpha.8 → 21.8.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/countOffers.ts +32 -0
- package/example/src/chevre/findItemListElementByCatalogId.ts +30 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/optimizeCatalogs.ts +54 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/pushIncludedInDataCatalog.ts +47 -0
- package/example/src/chevre/searchAggregateOffers.ts +48 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -1
- package/example/src/chevre/searchEvents.ts +9 -7
- package/example/src/chevre/searchOfferCatalogs.ts +7 -3
- package/example/src/chevre/searchOffers.ts +5 -2
- package/example/src/chevre/searchOffersByCatalog.ts +15 -9
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
- package/example/src/chevre/searchOrders.ts +9 -7
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +85 -0
- package/lib/chevre/emailMessageBuilder.js +6 -5
- package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
- package/lib/chevre/repo/aggregateOffer.js +562 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +189 -0
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +10 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +87 -51
- package/lib/chevre/repo/offer.js +513 -283
- package/lib/chevre/repo/offerCatalog.d.ts +32 -3
- package/lib/chevre/repo/offerCatalog.js +97 -10
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +58 -26
- package/lib/chevre/repo/task.d.ts +6 -2
- package/lib/chevre/repo/task.js +58 -4
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +16 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.js +58 -0
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +111 -35
- package/lib/chevre/service/offer/event/authorize.js +39 -35
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +3 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +48 -17
- package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
- package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
- package/lib/chevre/service/offer/factory.d.ts +12 -4
- package/lib/chevre/service/offer/factory.js +9 -11
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +10 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +51 -12
- package/lib/chevre/service/offer/product.d.ts +2 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/lib/chevre/service/offer.d.ts +1 -0
- package/lib/chevre/service/offer.js +7 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +20 -42
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +52 -9
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -24
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.d.ts +8 -0
- package/lib/chevre/service/reserve/checkInReservation.js +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +5 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +78 -0
- package/lib/chevre/service/task/onResourceUpdated.js +12 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +3 -3
- package/lib/chevre/settings.js +4 -12
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -149
- package/lib/chevre/repo/mongoose/schemas/offer.js +0 -210
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js
CHANGED
|
@@ -12,15 +12,17 @@ const debug = createDebug('cinerino-domain:service:validateMovieTicket');
|
|
|
12
12
|
*/
|
|
13
13
|
function validateMovieTicket(paymentMethodType, transaction, authorizeActions) {
|
|
14
14
|
const authorizeMovieTicketActions = authorizeActions.filter((a) => {
|
|
15
|
-
var _a, _b
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
17
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
18
|
+
: a.result;
|
|
16
19
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
17
|
-
&& (
|
|
18
|
-
&& (
|
|
20
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
21
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
19
22
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
20
|
-
&& ((
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
23
|
+
&& ((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.paymentMethodAsObject) === null || _b === void 0 ? void 0 : _b.typeOf) === paymentMethodType;
|
|
24
|
+
// && a.result?.paymentMethod === paymentMethodType
|
|
25
|
+
});
|
|
24
26
|
const seatReservationAuthorizeActions = authorizeActions.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
25
27
|
&& a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
26
28
|
// 予約によって必要とされるMovieTicket
|
|
@@ -149,10 +151,10 @@ function authorizeSeatReservationActions2requiredMovieTickets(params) {
|
|
|
149
151
|
appliesToMovieTickets4paymentMethod = appliesToMovieTickets4reservation.filter((a) => {
|
|
150
152
|
return a.serviceOutput.typeOf === paymentMethodType;
|
|
151
153
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
// Arrayでない場合を廃止(2022-08-01~)
|
|
155
|
-
throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
|
|
154
|
+
// Array以外への考慮自体を廃止(2023-09-01~)
|
|
155
|
+
// } else if (typeof appliesToMovieTickets4reservation?.identifier === 'string') {
|
|
156
|
+
// // Arrayでない場合を廃止(2022-08-01~)
|
|
157
|
+
// throw new factory.errors.NotImplemented('appliesToMovieTickets.typeOf as string not implemented');
|
|
156
158
|
}
|
|
157
159
|
if (Array.isArray(appliesToMovieTickets4paymentMethod) && appliesToMovieTickets4paymentMethod.length > 0) {
|
|
158
160
|
appliesToMovieTickets4paymentMethod.forEach((appliesToMovieTicket) => {
|
|
@@ -40,10 +40,13 @@ function validateTransaction(transaction, authorizeActions) {
|
|
|
40
40
|
exports.validateTransaction = validateTransaction;
|
|
41
41
|
function findMovieTicketPaymentMethodTypesFromTransaction(authorizeActions) {
|
|
42
42
|
const authorizeMovieTicketPaymentActions = authorizeActions.filter((a) => {
|
|
43
|
-
var _a
|
|
43
|
+
var _a;
|
|
44
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
45
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
46
|
+
: a.result;
|
|
44
47
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
45
|
-
&& (
|
|
46
|
-
&& (
|
|
48
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
49
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.issuedThrough.typeOf) === factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
47
50
|
});
|
|
48
51
|
const seatReservationAuthorizeActions = authorizeActions.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
49
52
|
&& a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation);
|
|
@@ -67,7 +70,13 @@ function findMovieTicketPaymentMethodTypesFromTransaction(authorizeActions) {
|
|
|
67
70
|
});
|
|
68
71
|
const paymentMethodTypes = [
|
|
69
72
|
// 決済方法区分は必ず存在するはず(2023-08-15~)
|
|
70
|
-
...authorizeMovieTicketPaymentActions.map((a) => {
|
|
73
|
+
...authorizeMovieTicketPaymentActions.map((a) => {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
76
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
77
|
+
: a.result;
|
|
78
|
+
return String((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.paymentMethodAsObject) === null || _b === void 0 ? void 0 : _b.typeOf);
|
|
79
|
+
}),
|
|
71
80
|
// ...authorizeMovieTicketPaymentActions.map((a) => String(a.result?.paymentMethod)),
|
|
72
81
|
...requiredMovieTicketPaymentMethodTypes
|
|
73
82
|
];
|
|
@@ -90,17 +99,20 @@ function validatePrice(transaction, authorizeActions) {
|
|
|
90
99
|
const authorizePaymentActions = authorizeActions
|
|
91
100
|
.filter((a) => {
|
|
92
101
|
var _a;
|
|
102
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
103
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
104
|
+
: a.result;
|
|
93
105
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
94
|
-
&& (
|
|
106
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment;
|
|
95
107
|
});
|
|
96
|
-
// priceByAgent += authorizePaymentActions
|
|
97
|
-
// .filter((a) => a.result?.totalPaymentDue?.currency === factory.priceCurrency.JPY)
|
|
98
|
-
// .reduce((a, b) => a + (<IAuthorizeAnyPaymentResult>b.result).amount, 0);
|
|
99
108
|
priceByAgent += authorizePaymentActions
|
|
100
109
|
.reduce((a, b) => {
|
|
101
110
|
var _a, _b;
|
|
102
|
-
const
|
|
103
|
-
? b.result.
|
|
111
|
+
const resultAsInvoice = (Array.isArray(b.result))
|
|
112
|
+
? (_a = b.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
113
|
+
: b.result;
|
|
114
|
+
const jpyAmount = (((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === factory.priceCurrency.JPY)
|
|
115
|
+
? resultAsInvoice.totalPaymentDue.value
|
|
104
116
|
: 0;
|
|
105
117
|
return a + jpyAmount;
|
|
106
118
|
}, 0);
|
|
@@ -125,11 +137,20 @@ function validatePaymentUrl(transaction, authorizeActions) {
|
|
|
125
137
|
const authorizePaymentActions = authorizeActions
|
|
126
138
|
.filter((a) => {
|
|
127
139
|
var _a;
|
|
140
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
141
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
142
|
+
: a.result;
|
|
128
143
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
129
|
-
&& (
|
|
144
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment;
|
|
130
145
|
});
|
|
131
146
|
// 決済承認を確認
|
|
132
|
-
const authorizePaymentAction4paymentUrlExists = authorizePaymentActions.some((a) => {
|
|
147
|
+
const authorizePaymentAction4paymentUrlExists = authorizePaymentActions.some((a) => {
|
|
148
|
+
var _a;
|
|
149
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
150
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
151
|
+
: a.result;
|
|
152
|
+
return (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.paymentMethodId) === paymentMethodId;
|
|
153
|
+
});
|
|
133
154
|
if (!authorizePaymentAction4paymentUrlExists) {
|
|
134
155
|
throw new factory.errors.Argument('Transaction', 'Payment for published payment URL required');
|
|
135
156
|
}
|
|
@@ -142,11 +163,14 @@ function validateMonetaryAmount(authorizeActions) {
|
|
|
142
163
|
const authorizeMonetaryAmountActions = authorizeActions
|
|
143
164
|
.filter((a) => {
|
|
144
165
|
var _a, _b;
|
|
166
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
167
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
168
|
+
: a.result;
|
|
145
169
|
return a.actionStatus === factory.actionStatusType.CompletedActionStatus
|
|
146
|
-
&& (
|
|
170
|
+
&& (resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.typeOf) === factory.action.authorize.paymentMethod.any.ResultType.Payment
|
|
147
171
|
// JPY以外の通貨に対して承認可能なのはPaymentServiceType.PaymentCardのみ
|
|
148
|
-
&&
|
|
149
|
-
&& ((_b =
|
|
172
|
+
&& resultAsInvoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.PaymentCard
|
|
173
|
+
&& ((_b = resultAsInvoice.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) !== factory.priceCurrency.JPY;
|
|
150
174
|
});
|
|
151
175
|
const requiredMonetaryAmountByCurrencyType = [];
|
|
152
176
|
authorizeActions
|
|
@@ -163,7 +187,13 @@ function validateMonetaryAmount(authorizeActions) {
|
|
|
163
187
|
}
|
|
164
188
|
}, 0);
|
|
165
189
|
const requiredCurrencyTypes = [...new Set(requiredMonetaryAmountByCurrencyType.map((m) => m.currency))];
|
|
166
|
-
const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map((
|
|
190
|
+
const authorizedCurrencyTypes = [...new Set(authorizeMonetaryAmountActions.map((a) => {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
193
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
194
|
+
: a.result;
|
|
195
|
+
return (_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency;
|
|
196
|
+
}))];
|
|
167
197
|
if (requiredCurrencyTypes.length !== authorizedCurrencyTypes.length) {
|
|
168
198
|
throw new factory.errors.Argument('Transaction', 'MonetaryAmount account types not matched');
|
|
169
199
|
}
|
|
@@ -172,7 +202,13 @@ function validateMonetaryAmount(authorizeActions) {
|
|
|
172
202
|
.filter((m) => m.currency === currencyType)
|
|
173
203
|
.reduce((a, b) => a + b.value, 0);
|
|
174
204
|
const authorizedMonetaryAmount = authorizeMonetaryAmountActions
|
|
175
|
-
.filter((a) => {
|
|
205
|
+
.filter((a) => {
|
|
206
|
+
var _a, _b;
|
|
207
|
+
const resultAsInvoice = (Array.isArray(a.result))
|
|
208
|
+
? (_a = a.result) === null || _a === void 0 ? void 0 : _a.find((resultObject) => resultObject.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
|
|
209
|
+
: a.result;
|
|
210
|
+
return ((_b = resultAsInvoice === null || resultAsInvoice === void 0 ? void 0 : resultAsInvoice.totalPaymentDue) === null || _b === void 0 ? void 0 : _b.currency) === currencyType;
|
|
211
|
+
})
|
|
176
212
|
.reduce((a, b) => a + b.object.amount, 0);
|
|
177
213
|
return requiredMonetaryAmount === authorizedMonetaryAmount;
|
|
178
214
|
});
|
|
@@ -22,6 +22,7 @@ const validation_1 = require("./placeOrderInProgress/validation");
|
|
|
22
22
|
const validateSeller_1 = require("./placeOrderInProgress/validation/validateSeller");
|
|
23
23
|
const validation_2 = require("./validation");
|
|
24
24
|
const errorHandler_1 = require("../../errorHandler");
|
|
25
|
+
const settings_1 = require("../../settings");
|
|
25
26
|
exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
26
27
|
/**
|
|
27
28
|
* 取引開始
|
|
@@ -226,7 +227,9 @@ function createResult(params) {
|
|
|
226
227
|
orderNumber: params.orderNumber,
|
|
227
228
|
transaction: transaction,
|
|
228
229
|
orderDate: params.result.order.orderDate,
|
|
229
|
-
|
|
230
|
+
// OrderPaymentDueオプションを追加(2023-08-25~)
|
|
231
|
+
// 注文作成時のステータスとなる
|
|
232
|
+
orderStatus: (settings_1.USE_ORDER_PAYMENT_DUE_ON_PLACED) ? factory.orderStatus.OrderPaymentDue : factory.orderStatus.OrderProcessing,
|
|
230
233
|
isGift: false,
|
|
231
234
|
authorizeActions: params.authorizeActions
|
|
232
235
|
});
|
|
@@ -138,18 +138,19 @@ function createReturnPaymentMethodIssuedThroughMovieTicketActions(params) {
|
|
|
138
138
|
const order = params.order;
|
|
139
139
|
const returnFeesMovieTicketByTransaction = params.transaction.object.returnPolicy.returnFeesMovieTicket;
|
|
140
140
|
return Promise.all(params.order.paymentMethods
|
|
141
|
-
.filter((
|
|
142
|
-
return
|
|
141
|
+
.filter((invoice) => {
|
|
142
|
+
return invoice.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
143
143
|
})
|
|
144
144
|
// 決済カード着券取消有無設定を適用
|
|
145
|
-
.filter((
|
|
145
|
+
.filter((invoice) => {
|
|
146
146
|
// デフォルトで実行する
|
|
147
147
|
let returnPaymentMethod = true;
|
|
148
|
-
const movieTicketIdentifier =
|
|
148
|
+
const movieTicketIdentifier = invoice.accountId;
|
|
149
149
|
const returnFeesMovieTicketSettingsByIdentifier = returnFeesMovieTicketByTransaction === null || returnFeesMovieTicketByTransaction === void 0 ? void 0 : returnFeesMovieTicketByTransaction.filter((r) => {
|
|
150
|
-
var _a;
|
|
150
|
+
var _a, _b;
|
|
151
151
|
return r.identifier === String(movieTicketIdentifier)
|
|
152
|
-
&&
|
|
152
|
+
// && r.serviceOutput?.typeOf === invoice.typeOf;
|
|
153
|
+
&& ((_a = r.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === ((_b = invoice.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier);
|
|
153
154
|
});
|
|
154
155
|
// 設定がなければスルー
|
|
155
156
|
if (Array.isArray(returnFeesMovieTicketSettingsByIdentifier) && returnFeesMovieTicketSettingsByIdentifier.length > 0) {
|
|
@@ -356,7 +356,11 @@ function isSellerReturnPolicyApplicable(params) {
|
|
|
356
356
|
if (Array.isArray(applicablePaymentMethod)) {
|
|
357
357
|
const everyOrderApplicable = params.orders.every((order) => {
|
|
358
358
|
// 全決済方法区分がapplicablePaymentMethodに含まれれば適用
|
|
359
|
-
return order.paymentMethods.every((
|
|
359
|
+
return order.paymentMethods.every((invoice) => {
|
|
360
|
+
var _a;
|
|
361
|
+
return typeof ((_a = invoice.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier) === 'string'
|
|
362
|
+
&& applicablePaymentMethod.includes(invoice.paymentMethod.identifier);
|
|
363
|
+
});
|
|
360
364
|
});
|
|
361
365
|
// 全注文について確認ができれば適用
|
|
362
366
|
if (everyOrderApplicable) {
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -36,13 +36,13 @@ export type ISettings = factory.project.ISettings & {
|
|
|
36
36
|
};
|
|
37
37
|
export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
38
38
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
39
|
-
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
40
39
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
41
40
|
export declare const USE_ADVANCE_BOOKING_REQUIREMENT: boolean;
|
|
42
41
|
export declare const USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT: boolean;
|
|
43
42
|
export declare const USE_DELETE_EVENT_BY_ORDER: boolean;
|
|
44
|
-
export declare const
|
|
45
|
-
export declare const
|
|
43
|
+
export declare const USE_ORDER_PAYMENT_DUE_ON_PLACED: boolean;
|
|
44
|
+
export declare const USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY: boolean;
|
|
45
|
+
export declare const USE_OPTIMIZE_TICKET_OFFER: boolean;
|
|
46
46
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
47
47
|
/**
|
|
48
48
|
* グローバル設定
|
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.
|
|
3
|
+
exports.settings = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = 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')
|
|
@@ -60,23 +60,15 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSA
|
|
|
60
60
|
exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
61
61
|
exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
|
|
62
62
|
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
63
|
-
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
64
63
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
65
64
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
66
65
|
: moment('2023-08-31T15:00:00Z');
|
|
67
|
-
// export const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
|
|
68
|
-
// ? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
|
|
69
|
-
// : moment('2024-11-30T15:00:00Z');
|
|
70
|
-
// export const USE_NEW_STOCK_HOLDER_REPO_IDS: string[] = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
71
|
-
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
72
|
-
// : [];
|
|
73
66
|
exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
|
|
74
67
|
exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
|
|
75
68
|
exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1';
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
78
|
-
|
|
79
|
-
: 0;
|
|
69
|
+
exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = process.env.USE_ORDER_PAYMENT_DUE_ON_PLACED === '1';
|
|
70
|
+
exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = process.env.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY === '1';
|
|
71
|
+
exports.USE_OPTIMIZE_TICKET_OFFER = process.env.USE_OPTIMIZE_TICKET_OFFER === '1';
|
|
80
72
|
exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
|
|
81
73
|
? Number(process.env.MONGO_MAX_TIME_MS)
|
|
82
74
|
// tslint:disable-next-line:no-magic-numbers
|
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.329.0",
|
|
13
|
+
"@cinerino/sdk": "3.167.0-alpha.9",
|
|
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.8.0
|
|
120
|
+
"version": "21.8.0"
|
|
121
121
|
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
// const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const actionRepo = new chevre.repository.Action(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = actionRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
typeOf: { $eq: chevre.factory.actionType.AuthorizeAction },
|
|
19
|
-
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
20
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment },
|
|
21
|
-
'result.typeOf': { $exists: true, $eq: chevre.factory.action.authorize.paymentMethod.any.ResultType.Payment },
|
|
22
|
-
startDate: {
|
|
23
|
-
$gte: moment('2022-08-16T00:00:00Z')
|
|
24
|
-
.toDate()
|
|
25
|
-
// $lte: moment('2023-08-01T00:00:00Z')
|
|
26
|
-
// .toDate()
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
_id: 1,
|
|
31
|
-
typeOf: 1,
|
|
32
|
-
result: 1,
|
|
33
|
-
project: 1,
|
|
34
|
-
startDate: 1,
|
|
35
|
-
actionStatus: 1
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
console.log('actions found');
|
|
39
|
-
|
|
40
|
-
let i = 0;
|
|
41
|
-
let updateCount = 0;
|
|
42
|
-
await cursor.eachAsync(async (doc) => {
|
|
43
|
-
i += 1;
|
|
44
|
-
const action: Pick<
|
|
45
|
-
chevre.factory.action.authorize.paymentMethod.any.IAction,
|
|
46
|
-
'id' | 'project' | 'result' | 'typeOf' | 'startDate' | 'actionStatus'
|
|
47
|
-
> = doc.toObject();
|
|
48
|
-
|
|
49
|
-
const oldPaymentMethodType = (<any>action).result?.paymentMethod;
|
|
50
|
-
const paymentMethodType = action.result?.paymentMethodAsObject?.typeOf;
|
|
51
|
-
const alreadyMigrated = typeof paymentMethodType === 'string' && oldPaymentMethodType === paymentMethodType;
|
|
52
|
-
|
|
53
|
-
if (alreadyMigrated) {
|
|
54
|
-
console.log('already exist...', action.project.id, action.id, action.startDate, paymentMethodType, i);
|
|
55
|
-
} else {
|
|
56
|
-
if (typeof oldPaymentMethodType !== 'string') {
|
|
57
|
-
console.error('updating action...', action.project.id, action.id, action.startDate, oldPaymentMethodType, i, updateCount);
|
|
58
|
-
throw new Error('oldPaymentMethodType undefined');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const newPaymentMethodAsObject: chevre.factory.action.authorize.paymentMethod.any.IResultPaymentMethod = {
|
|
62
|
-
typeOf: oldPaymentMethodType
|
|
63
|
-
};
|
|
64
|
-
console.log(
|
|
65
|
-
'updating action...', action.project.id, action.id, action.startDate, newPaymentMethodAsObject.typeOf, i, updateCount);
|
|
66
|
-
await actionRepo.updateById({
|
|
67
|
-
id: action.id,
|
|
68
|
-
update: {
|
|
69
|
-
'result.paymentMethodAsObject': newPaymentMethodAsObject
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
updateCount += 1;
|
|
73
|
-
console.log('updated.', action.project.id, action.id, action.startDate, newPaymentMethodAsObject.typeOf, i, updateCount);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
console.log(i, 'actions checked');
|
|
78
|
-
console.log(updateCount, 'actions updated');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
main()
|
|
82
|
-
.then()
|
|
83
|
-
.catch(console.error);
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
-
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = eventRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// 'project.id': { $eq: project.id },
|
|
20
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
21
|
-
typeOf: {
|
|
22
|
-
$in: [
|
|
23
|
-
// chevre.factory.eventType.ScreeningEvent,
|
|
24
|
-
chevre.factory.eventType.ScreeningEventSeries
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
organizer: { $exists: true },
|
|
28
|
-
startDate: {
|
|
29
|
-
$gte: moment()
|
|
30
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
31
|
-
.add(-3, 'months')
|
|
32
|
-
.toDate()
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
_id: 1,
|
|
37
|
-
project: 1,
|
|
38
|
-
location: 1,
|
|
39
|
-
superEvent: 1,
|
|
40
|
-
startDate: 1,
|
|
41
|
-
typeOf: 1,
|
|
42
|
-
organizer: 1
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
console.log('events found');
|
|
46
|
-
|
|
47
|
-
let i = 0;
|
|
48
|
-
let updateCount = 0;
|
|
49
|
-
let invalidOrganizerCount = 0;
|
|
50
|
-
await cursor.eachAsync(async (doc) => {
|
|
51
|
-
i += 1;
|
|
52
|
-
const event: Pick<
|
|
53
|
-
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEvent>,
|
|
54
|
-
'id' | 'project' | 'location' | 'startDate' | 'typeOf' | 'organizer' | 'superEvent'
|
|
55
|
-
> | Pick<
|
|
56
|
-
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEventSeries>,
|
|
57
|
-
'id' | 'project' | 'location' | 'startDate' | 'typeOf' | 'organizer'
|
|
58
|
-
> = doc.toObject();
|
|
59
|
-
|
|
60
|
-
const organizerId = event.organizer?.id;
|
|
61
|
-
|
|
62
|
-
let movieTheaterId: string;
|
|
63
|
-
let movieTheaterBranchCode: string;
|
|
64
|
-
if (event.typeOf === chevre.factory.eventType.ScreeningEventSeries) {
|
|
65
|
-
movieTheaterId = event.location.id;
|
|
66
|
-
movieTheaterBranchCode = event.location.branchCode;
|
|
67
|
-
} else {
|
|
68
|
-
movieTheaterId = event.superEvent.location.id;
|
|
69
|
-
movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
70
|
-
}
|
|
71
|
-
const movieTheaters = <Pick<
|
|
72
|
-
chevre.factory.place.movieTheater.IPlaceWithoutScreeningRoom,
|
|
73
|
-
'parentOrganization' | 'branchCode'
|
|
74
|
-
>[]>
|
|
75
|
-
await placeRepo.searchMovieTheaters(
|
|
76
|
-
{
|
|
77
|
-
limit: 1,
|
|
78
|
-
page: 1,
|
|
79
|
-
project: { id: { $eq: event.project.id } },
|
|
80
|
-
id: { $eq: movieTheaterId }
|
|
81
|
-
},
|
|
82
|
-
['parentOrganization', 'branchCode'],
|
|
83
|
-
[]
|
|
84
|
-
);
|
|
85
|
-
const movieTheater = movieTheaters.shift();
|
|
86
|
-
const sellerId = movieTheater?.parentOrganization?.id;
|
|
87
|
-
console.log(
|
|
88
|
-
'movieTheater found',
|
|
89
|
-
event.project.id, event.id, event.startDate, 'sellerId:', sellerId,
|
|
90
|
-
'movieTheaterId:', movieTheaterId,
|
|
91
|
-
'movieTheaterBranchCode:', movieTheaterBranchCode,
|
|
92
|
-
i
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const alreadyMigrated = typeof organizerId === 'string';
|
|
96
|
-
|
|
97
|
-
if (alreadyMigrated) {
|
|
98
|
-
console.log('already exist...', event.project.id, event.id, event.startDate, organizerId, i);
|
|
99
|
-
if (organizerId === sellerId) {
|
|
100
|
-
console.log('organizerId is valid', event.project.id, event.id, event.startDate, organizerId, i);
|
|
101
|
-
} else {
|
|
102
|
-
invalidOrganizerCount += 1;
|
|
103
|
-
|
|
104
|
-
// organizerを修正する
|
|
105
|
-
if (typeof sellerId !== 'string') {
|
|
106
|
-
throw new Error('movieTheater not found');
|
|
107
|
-
}
|
|
108
|
-
const fixedOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
109
|
-
id: sellerId
|
|
110
|
-
};
|
|
111
|
-
console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
112
|
-
await eventRepo.updatePartiallyById({
|
|
113
|
-
project: { id: event.project.id },
|
|
114
|
-
id: event.id,
|
|
115
|
-
attributes: <any>{
|
|
116
|
-
typeOf: event.typeOf,
|
|
117
|
-
organizer: fixedOrganizer
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
updateCount += 1;
|
|
121
|
-
console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
throw new Error('organizer not found');
|
|
125
|
-
// if (typeof sellerId !== 'string') {
|
|
126
|
-
// throw new Error('movieTheater not found');
|
|
127
|
-
// }
|
|
128
|
-
// if (typeof sellerId === 'string') {
|
|
129
|
-
// const newOrganizer: chevre.factory.event.screeningEventSeries.IOrganizer = {
|
|
130
|
-
// id: sellerId
|
|
131
|
-
// };
|
|
132
|
-
// console.log('updating event...', event.project.id, event.id, event.startDate, i);
|
|
133
|
-
// await eventRepo.updatePartiallyById({
|
|
134
|
-
// project: { id: event.project.id },
|
|
135
|
-
// id: event.id,
|
|
136
|
-
// attributes: <any>{
|
|
137
|
-
// typeOf: event.typeOf,
|
|
138
|
-
// organizer: newOrganizer
|
|
139
|
-
// }
|
|
140
|
-
// });
|
|
141
|
-
// updateCount += 1;
|
|
142
|
-
// console.log('updated.', event.project.id, event.id, event.startDate, i);
|
|
143
|
-
// }
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
console.log(i, 'events checked');
|
|
148
|
-
console.log(updateCount, 'events updated');
|
|
149
|
-
console.log(invalidOrganizerCount, 'invalid');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
main()
|
|
153
|
-
.then()
|
|
154
|
-
.catch(console.error);
|