@chevre/domain 22.2.0-alpha.8 → 22.2.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/createProject.ts +19 -0
- package/example/src/chevre/findValidAuthorization.ts +1 -2
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +1 -1
- package/example/src/chevre/{migrateMovieTheaterAdditionalProperties.ts → migrateRoomAdditionalProperties.ts} +17 -17
- package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +119 -0
- package/example/src/chevre/playAroundTicket.ts +3 -2
- package/example/src/chevre/processAction.ts +3 -1
- package/example/src/chevre/projectFields.ts +42 -0
- package/example/src/chevre/{projectEventFieldsById.ts → projectFieldsById.ts} +7 -12
- package/example/src/chevre/searchActionsByPurpose.ts +38 -0
- package/example/src/chevre/searchProjects.ts +9 -4
- package/example/src/chevre/searchSellersByAggregate.ts +3 -3
- package/example/src/chevre/searchTransactions.ts +1 -1
- package/example/src/chevre/unsetUnnecessaryFields.ts +2 -41
- package/lib/chevre/repo/accountTitle.d.ts +9 -3
- package/lib/chevre/repo/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/action.d.ts +110 -47
- package/lib/chevre/repo/action.js +170 -133
- package/lib/chevre/repo/aggregateReservation.d.ts +1 -14
- package/lib/chevre/repo/assetTransaction.d.ts +134 -7
- package/lib/chevre/repo/assetTransaction.js +2 -2
- package/lib/chevre/repo/categoryCode.d.ts +14 -2
- package/lib/chevre/repo/categoryCode.js +47 -19
- package/lib/chevre/repo/comment.d.ts +5 -1
- package/lib/chevre/repo/creativeWork.d.ts +14 -2
- package/lib/chevre/repo/customer.d.ts +5 -1
- package/lib/chevre/repo/customerType.d.ts +1 -1
- package/lib/chevre/repo/event.d.ts +49 -2
- package/lib/chevre/repo/member.d.ts +5 -1
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +22 -2
- package/lib/chevre/repo/message.d.ts +1 -15
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -5
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +12 -12
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +7 -3
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +22 -24
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +9 -3
- package/lib/chevre/repo/mongoose/schemas/customerType.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +19 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +23 -3
- package/lib/chevre/repo/mongoose/schemas/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/note.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/note.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +10 -3
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +13 -4
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +16 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -13
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/productModel.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -5
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +9 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +22 -24
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +7 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ticket.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -2
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +8 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +3 -3
- package/lib/chevre/repo/offer.d.ts +13 -4
- package/lib/chevre/repo/offerCatalog.d.ts +15 -2
- package/lib/chevre/repo/order.d.ts +13 -1
- package/lib/chevre/repo/ownershipInfo.d.ts +15 -3
- package/lib/chevre/repo/ownershipInfo.js +40 -11
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +108 -58
- package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
- package/lib/chevre/repo/place/movieTheater.d.ts +54 -2
- package/lib/chevre/repo/priceSpecification.d.ts +42 -1
- package/lib/chevre/repo/product.d.ts +8 -3
- package/lib/chevre/repo/product.js +67 -33
- package/lib/chevre/repo/productModel.d.ts +1 -22
- package/lib/chevre/repo/project.d.ts +25 -5
- package/lib/chevre/repo/project.js +69 -28
- package/lib/chevre/repo/reservation.d.ts +35 -3
- package/lib/chevre/repo/reservation.js +1 -1
- package/lib/chevre/repo/role.d.ts +2 -9
- package/lib/chevre/repo/role.js +20 -10
- package/lib/chevre/repo/seller.d.ts +64 -14
- package/lib/chevre/repo/seller.js +61 -27
- package/lib/chevre/repo/task.d.ts +64 -3
- package/lib/chevre/repo/telemetry.d.ts +3 -2
- package/lib/chevre/repo/ticket.d.ts +4 -20
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/repo/transaction.d.ts +30 -14
- package/lib/chevre/repo/transaction.js +106 -77
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/aggregation/project.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -3
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +3 -3
- package/lib/chevre/service/assetTransaction/registerService.js +4 -6
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +9 -11
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
- package/lib/chevre/service/code.d.ts +0 -4
- package/lib/chevre/service/code.js +22 -18
- package/lib/chevre/service/event.js +4 -4
- package/lib/chevre/service/moneyTransfer.js +3 -5
- package/lib/chevre/service/notification.js +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +16 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -2
- package/lib/chevre/service/offer/event/authorize.js +3 -2
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +41 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -3
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +10 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -6
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
- package/lib/chevre/service/offer/product.d.ts +4 -2
- package/lib/chevre/service/offer/product.js +12 -12
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -3
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
- package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -4
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +21 -26
- package/lib/chevre/service/payment/any.d.ts +3 -1
- package/lib/chevre/service/payment/any.js +21 -13
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +12 -5
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/faceToFace.d.ts +2 -2
- package/lib/chevre/service/payment/faceToFace.js +28 -10
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/authorize.js +8 -3
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +12 -4
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +2 -2
- package/lib/chevre/service/payment/paymentCard.js +29 -16
- package/lib/chevre/service/payment.d.ts +1 -1
- package/lib/chevre/service/report/telemetry.js +2 -2
- package/lib/chevre/service/reserve/cancelReservation.js +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +16 -4
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +2 -2
- package/lib/chevre/service/transaction.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/findTransactionById.ts +0 -23
- package/example/src/chevre/findTransactionInProgressById.ts +0 -23
- package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +0 -154
- package/example/src/chevre/projectReservationFields.ts +0 -31
- package/example/src/chevre/searchActions.ts +0 -40
- package/example/src/chevre/searchProducts.ts +0 -28
|
@@ -15,6 +15,23 @@ const transaction_1 = require("../eventEmitter/transaction");
|
|
|
15
15
|
const factory = require("../factory");
|
|
16
16
|
const settings_1 = require("../settings");
|
|
17
17
|
const transaction_2 = require("./mongoose/schemas/transaction");
|
|
18
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
19
|
+
'project',
|
|
20
|
+
'status',
|
|
21
|
+
'typeOf',
|
|
22
|
+
'agent',
|
|
23
|
+
'recipient',
|
|
24
|
+
'seller',
|
|
25
|
+
'error',
|
|
26
|
+
'result',
|
|
27
|
+
'object',
|
|
28
|
+
'expires',
|
|
29
|
+
'startDate',
|
|
30
|
+
'endDate',
|
|
31
|
+
'tasksExportAction',
|
|
32
|
+
'potentialActions',
|
|
33
|
+
'instrument'
|
|
34
|
+
];
|
|
18
35
|
/**
|
|
19
36
|
* 取引リポジトリ
|
|
20
37
|
*/
|
|
@@ -263,8 +280,6 @@ class TransactionRepo {
|
|
|
263
280
|
throw new factory.errors.NotImplemented(`${typeOf} not implemented`);
|
|
264
281
|
}
|
|
265
282
|
// reimplemnt with insertMany(2024-05-30~)
|
|
266
|
-
// const transaction = await this.transactionModel.create<AnyKeys<factory.transaction.ITransaction<T>>>(creatingTransaction)
|
|
267
|
-
// .then((doc: HydratedDocument<factory.transaction.ITransaction<T>>) => doc.toObject());
|
|
268
283
|
const result = yield this.transactionModel.insertMany(creatingTransaction, { rawResult: true });
|
|
269
284
|
const id = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
270
285
|
if (typeof id !== 'string') {
|
|
@@ -278,59 +293,73 @@ class TransactionRepo {
|
|
|
278
293
|
/**
|
|
279
294
|
* 特定取引検索
|
|
280
295
|
*/
|
|
281
|
-
|
|
282
|
-
// exclusion?: IKeyOfProjection<T>[] // discontinue(2024-06-17~)
|
|
296
|
+
projectFieldsById(params, inclusion // make required(2024-05-31~)
|
|
283
297
|
) {
|
|
284
298
|
return __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
let
|
|
299
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
286
300
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
287
|
-
|
|
288
|
-
projection[field] = 1;
|
|
289
|
-
});
|
|
301
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => inclusion.includes(key));
|
|
290
302
|
}
|
|
291
303
|
else {
|
|
292
|
-
|
|
293
|
-
__v: 0,
|
|
294
|
-
createdAt: 0,
|
|
295
|
-
updatedAt: 0
|
|
296
|
-
};
|
|
297
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) { // discontinue(2024-06-17~)
|
|
298
|
-
// exclusion.forEach((field) => {
|
|
299
|
-
// projection[field] = 0;
|
|
300
|
-
// });
|
|
301
|
-
// }
|
|
304
|
+
throw new factory.errors.NotImplemented('inclusion must be specified'); // 2024-08-26~
|
|
302
305
|
}
|
|
306
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
307
|
+
// let projection: { [key in (IKeyOfProjection<T> | '__v' | 'createdAt' | 'updatedAt')]?: AnyExpression } = {};
|
|
308
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
309
|
+
// inclusion.forEach((field) => {
|
|
310
|
+
// projection[field] = 1;
|
|
311
|
+
// });
|
|
312
|
+
// } else {
|
|
313
|
+
// projection = {
|
|
314
|
+
// __v: 0,
|
|
315
|
+
// createdAt: 0,
|
|
316
|
+
// updatedAt: 0
|
|
317
|
+
// };
|
|
318
|
+
// }
|
|
303
319
|
const doc = yield this.transactionModel.findOne({
|
|
304
320
|
_id: { $eq: params.id },
|
|
305
321
|
typeOf: { $eq: params.typeOf }
|
|
306
|
-
})
|
|
307
|
-
.
|
|
322
|
+
}, projection)
|
|
323
|
+
.lean() // 2024-08-26~
|
|
308
324
|
.exec();
|
|
309
325
|
if (doc === null) {
|
|
310
326
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
311
327
|
}
|
|
312
|
-
return doc
|
|
328
|
+
return doc;
|
|
313
329
|
});
|
|
314
330
|
}
|
|
315
331
|
/**
|
|
316
332
|
* 進行中の取引を取得する
|
|
317
333
|
*/
|
|
318
|
-
|
|
334
|
+
projectFieldsInProgressById(params, inclusion // make required(2024-05-29~)
|
|
319
335
|
) {
|
|
320
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
-
let
|
|
337
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
322
338
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
323
|
-
|
|
324
|
-
projection[field] = 1;
|
|
325
|
-
});
|
|
339
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => inclusion.includes(key));
|
|
326
340
|
}
|
|
327
341
|
else {
|
|
328
|
-
//
|
|
329
|
-
projection = Object.assign({ __v: 0, createdAt: 0, updatedAt: 0, tasksExportAction: 0 }, {
|
|
330
|
-
tasksExportedAt: 0,
|
|
331
|
-
tasksExportationStatus: 0
|
|
332
|
-
});
|
|
342
|
+
throw new factory.errors.NotImplemented('inclusion must be specified'); // 2024-08-26~
|
|
333
343
|
}
|
|
344
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
345
|
+
// let projection: { [key in (IKeyOfProjection<T> | '__v' | 'createdAt' | 'updatedAt')]?: ProjectionElementType } = {};
|
|
346
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
347
|
+
// inclusion.forEach((field) => {
|
|
348
|
+
// projection[field] = 1;
|
|
349
|
+
// });
|
|
350
|
+
// } else {
|
|
351
|
+
// // minimize(2024-05-29~)
|
|
352
|
+
// projection = {
|
|
353
|
+
// __v: 0,
|
|
354
|
+
// createdAt: 0,
|
|
355
|
+
// updatedAt: 0,
|
|
356
|
+
// tasksExportAction: 0,
|
|
357
|
+
// ...{
|
|
358
|
+
// tasksExportedAt: 0,
|
|
359
|
+
// tasksExportationStatus: 0
|
|
360
|
+
// }
|
|
361
|
+
// };
|
|
362
|
+
// }
|
|
334
363
|
const filter = {
|
|
335
364
|
_id: { $eq: params.id },
|
|
336
365
|
typeOf: { $eq: params.typeOf },
|
|
@@ -339,11 +368,12 @@ class TransactionRepo {
|
|
|
339
368
|
expires: { $gt: new Date() }
|
|
340
369
|
};
|
|
341
370
|
const doc = yield this.transactionModel.findOne(filter, projection)
|
|
371
|
+
.lean() // 2024-08-26~
|
|
342
372
|
.exec();
|
|
343
373
|
if (doc === null) {
|
|
344
374
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
345
375
|
}
|
|
346
|
-
return doc
|
|
376
|
+
return doc;
|
|
347
377
|
});
|
|
348
378
|
}
|
|
349
379
|
/**
|
|
@@ -356,11 +386,12 @@ class TransactionRepo {
|
|
|
356
386
|
typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
357
387
|
status: { $eq: factory.transactionStatusType.InProgress }
|
|
358
388
|
}, { 'object.paymentMethods': 1 })
|
|
389
|
+
.lean() // 2024-08-26~
|
|
359
390
|
.exec();
|
|
360
391
|
if (doc === null) {
|
|
361
392
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
362
393
|
}
|
|
363
|
-
return doc.
|
|
394
|
+
return doc.object.paymentMethods;
|
|
364
395
|
});
|
|
365
396
|
}
|
|
366
397
|
/**
|
|
@@ -373,11 +404,12 @@ class TransactionRepo {
|
|
|
373
404
|
typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
374
405
|
status: { $eq: factory.transactionStatusType.InProgress }
|
|
375
406
|
}, { 'object.orderNumber': 1 })
|
|
407
|
+
.lean() // 2024-08-26~
|
|
376
408
|
.exec();
|
|
377
409
|
if (doc === null) {
|
|
378
410
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
379
411
|
}
|
|
380
|
-
return doc.
|
|
412
|
+
return doc.object.orderNumber;
|
|
381
413
|
});
|
|
382
414
|
}
|
|
383
415
|
/**
|
|
@@ -390,11 +422,12 @@ class TransactionRepo {
|
|
|
390
422
|
typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
391
423
|
status: { $in: params.status.$in }
|
|
392
424
|
}, { 'object.confirmationNumber': 1 })
|
|
425
|
+
.lean() // 2024-08-26~
|
|
393
426
|
.exec();
|
|
394
427
|
if (doc === null) {
|
|
395
428
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
396
429
|
}
|
|
397
|
-
return doc.
|
|
430
|
+
return doc.object.confirmationNumber;
|
|
398
431
|
});
|
|
399
432
|
}
|
|
400
433
|
/**
|
|
@@ -412,6 +445,7 @@ class TransactionRepo {
|
|
|
412
445
|
}, {
|
|
413
446
|
projection: { _id: 1 }
|
|
414
447
|
})
|
|
448
|
+
.lean()
|
|
415
449
|
.exec();
|
|
416
450
|
if (doc === null) {
|
|
417
451
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
@@ -434,6 +468,7 @@ class TransactionRepo {
|
|
|
434
468
|
}, {
|
|
435
469
|
projection: { _id: 1 }
|
|
436
470
|
})
|
|
471
|
+
.lean()
|
|
437
472
|
.exec();
|
|
438
473
|
if (doc === null) {
|
|
439
474
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
@@ -456,6 +491,7 @@ class TransactionRepo {
|
|
|
456
491
|
}, {
|
|
457
492
|
projection: { _id: 1 }
|
|
458
493
|
})
|
|
494
|
+
.lean()
|
|
459
495
|
.exec();
|
|
460
496
|
if (doc === null) {
|
|
461
497
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
@@ -481,10 +517,11 @@ class TransactionRepo {
|
|
|
481
517
|
new: true,
|
|
482
518
|
projection: { _id: 1 }
|
|
483
519
|
})
|
|
520
|
+
.lean()
|
|
484
521
|
.exec();
|
|
485
522
|
// NotFoundであれば取引状態確認
|
|
486
523
|
if (doc === null) {
|
|
487
|
-
const { status } = yield this.
|
|
524
|
+
const { status } = yield this.projectFieldsById({ typeOf: params.typeOf, id: params.id }, ['status']);
|
|
488
525
|
if (status === factory.transactionStatusType.Confirmed) {
|
|
489
526
|
// すでに確定済の場合スルー
|
|
490
527
|
}
|
|
@@ -529,14 +566,19 @@ class TransactionRepo {
|
|
|
529
566
|
'tasksExportAction.agent': { name: params.tasksExportAction.agent.name },
|
|
530
567
|
'tasksExportAction.startDate': new Date()
|
|
531
568
|
// tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting // discontinue(2024-06-20~)
|
|
532
|
-
}, {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
569
|
+
}, {
|
|
570
|
+
new: true,
|
|
571
|
+
projection: {
|
|
572
|
+
// _id: 1,
|
|
573
|
+
_id: 0,
|
|
574
|
+
id: { $toString: '$_id' },
|
|
575
|
+
typeOf: 1
|
|
576
|
+
}
|
|
536
577
|
})
|
|
578
|
+
.lean() // 2024-08-26~
|
|
537
579
|
.exec()
|
|
538
580
|
// tslint:disable-next-line:no-null-keyword
|
|
539
|
-
.then((doc) => (doc === null) ? null : doc
|
|
581
|
+
.then((doc) => (doc === null) ? null : doc);
|
|
540
582
|
});
|
|
541
583
|
}
|
|
542
584
|
reexportTasksByExportAction(params) {
|
|
@@ -697,10 +739,11 @@ class TransactionRepo {
|
|
|
697
739
|
new: true,
|
|
698
740
|
projection: { _id: 1 }
|
|
699
741
|
})
|
|
742
|
+
.lean()
|
|
700
743
|
.exec();
|
|
701
744
|
// NotFoundであれば取引状態確認
|
|
702
745
|
if (doc === null) {
|
|
703
|
-
const { status } = yield this.
|
|
746
|
+
const { status } = yield this.projectFieldsById(params, ['status']);
|
|
704
747
|
if (status === factory.transactionStatusType.Canceled) {
|
|
705
748
|
// すでに中止済の場合スルー
|
|
706
749
|
}
|
|
@@ -732,28 +775,28 @@ class TransactionRepo {
|
|
|
732
775
|
/**
|
|
733
776
|
* 取引を検索する
|
|
734
777
|
*/
|
|
735
|
-
|
|
778
|
+
projectFields(params) {
|
|
736
779
|
var _a;
|
|
737
780
|
return __awaiter(this, void 0, void 0, function* () {
|
|
781
|
+
const { inclusion } = params;
|
|
738
782
|
const conditions = TransactionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
739
|
-
let
|
|
740
|
-
if (Array.isArray(
|
|
741
|
-
|
|
742
|
-
projection[field] = 1;
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
else {
|
|
746
|
-
projection = {
|
|
747
|
-
__v: 0,
|
|
748
|
-
createdAt: 0,
|
|
749
|
-
updatedAt: 0
|
|
750
|
-
};
|
|
751
|
-
// if (Array.isArray(params.exclusion) && params.exclusion.length > 0) { // discontinue(2024-06-17~)
|
|
752
|
-
// params.exclusion.forEach((field) => {
|
|
753
|
-
// projection[field] = 0;
|
|
754
|
-
// });
|
|
755
|
-
// }
|
|
783
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
784
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
785
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => inclusion.includes(key));
|
|
756
786
|
}
|
|
787
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
788
|
+
// let projection: { [key in (IKeyOfProjection<T> | '__v' | 'createdAt' | 'updatedAt')]?: AnyExpression } = {};
|
|
789
|
+
// if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
790
|
+
// params.inclusion.forEach((field) => {
|
|
791
|
+
// projection[field] = 1;
|
|
792
|
+
// });
|
|
793
|
+
// } else {
|
|
794
|
+
// projection = {
|
|
795
|
+
// __v: 0,
|
|
796
|
+
// createdAt: 0,
|
|
797
|
+
// updatedAt: 0
|
|
798
|
+
// };
|
|
799
|
+
// }
|
|
757
800
|
const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
758
801
|
.select(projection);
|
|
759
802
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
@@ -769,8 +812,8 @@ class TransactionRepo {
|
|
|
769
812
|
// const explainResult = await (<any>query).explain();
|
|
770
813
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
771
814
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
772
|
-
.
|
|
773
|
-
.
|
|
815
|
+
.lean() // 2024-08-26~
|
|
816
|
+
.exec();
|
|
774
817
|
});
|
|
775
818
|
}
|
|
776
819
|
/**
|
|
@@ -785,21 +828,7 @@ class TransactionRepo {
|
|
|
785
828
|
// new: true,
|
|
786
829
|
projection: { _id: 1 }
|
|
787
830
|
})
|
|
788
|
-
.
|
|
789
|
-
.then((doc) => {
|
|
790
|
-
if (doc === null) {
|
|
791
|
-
throw new factory.errors.ArgumentNull(this.transactionModel.modelName);
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
findByIdAndUpdate4migrate(params) {
|
|
797
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
798
|
-
yield this.transactionModel.findOneAndUpdate({
|
|
799
|
-
_id: { $eq: params.id }
|
|
800
|
-
}, params.update, {
|
|
801
|
-
projection: { _id: 1 }
|
|
802
|
-
})
|
|
831
|
+
.lean()
|
|
803
832
|
.exec()
|
|
804
833
|
.then((doc) => {
|
|
805
834
|
if (doc === null) {
|
|
@@ -165,7 +165,7 @@ function calculateOfferCount(params) {
|
|
|
165
165
|
try {
|
|
166
166
|
const eventOffers = params.event.offers;
|
|
167
167
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
168
|
-
const eventService = (yield repos.product.
|
|
168
|
+
const eventService = (yield repos.product.projectFields({
|
|
169
169
|
limit: 1,
|
|
170
170
|
page: 1,
|
|
171
171
|
id: { $eq: eventOffers.itemOffered.id }
|
|
@@ -23,7 +23,7 @@ function findEventOffers(params) {
|
|
|
23
23
|
// 興行設定があれば興行のカタログを参照する
|
|
24
24
|
const eventOffers = params.event.offers;
|
|
25
25
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
26
|
-
const eventService = (yield repos.product.
|
|
26
|
+
const eventService = (yield repos.product.projectFields({
|
|
27
27
|
limit: 1,
|
|
28
28
|
page: 1,
|
|
29
29
|
id: { $eq: eventOffers.itemOffered.id }
|
|
@@ -34,7 +34,7 @@ export declare function startAndConfirm(params: factory.assetTransaction.cancelR
|
|
|
34
34
|
seller: {
|
|
35
35
|
id?: string;
|
|
36
36
|
};
|
|
37
|
-
}): IStartOperation<factory.assetTransaction.cancelReservation.ITransaction
|
|
37
|
+
}): IStartOperation<Pick<factory.assetTransaction.cancelReservation.ITransaction, 'id'>>;
|
|
38
38
|
/**
|
|
39
39
|
* 取引タスク出力
|
|
40
40
|
*/
|
|
@@ -85,7 +85,7 @@ function start(params) {
|
|
|
85
85
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
86
86
|
const project = yield repos.project.findById({
|
|
87
87
|
id: params.project.id,
|
|
88
|
-
inclusion: ['
|
|
88
|
+
inclusion: ['typeOf'],
|
|
89
89
|
exclusion: []
|
|
90
90
|
});
|
|
91
91
|
const { reserveTransaction, reservations } = yield validateStartParams(params)(repos);
|
|
@@ -141,7 +141,7 @@ function startAndConfirm(params) {
|
|
|
141
141
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
142
142
|
const project = yield repos.project.findById({
|
|
143
143
|
id: params.project.id,
|
|
144
|
-
inclusion: ['
|
|
144
|
+
inclusion: ['typeOf'],
|
|
145
145
|
exclusion: []
|
|
146
146
|
});
|
|
147
147
|
const { reserveTransaction, reservations } = yield validateStartParams(params)(repos);
|
|
@@ -28,7 +28,7 @@ function start(params) {
|
|
|
28
28
|
var _a;
|
|
29
29
|
const issuedThroughId = fixIssuedThroughId(params);
|
|
30
30
|
// location.issuedThroughIdからプロダクトをfixする
|
|
31
|
-
const products = yield repos.product.
|
|
31
|
+
const products = yield repos.product.projectFields({
|
|
32
32
|
limit: 1,
|
|
33
33
|
page: 1,
|
|
34
34
|
project: { id: { $eq: params.project.id } },
|
|
@@ -6,6 +6,6 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
amount: number;
|
|
9
|
-
paymentService?: factory.service.paymentService.IService | factory.product.IProduct
|
|
9
|
+
paymentService?: Pick<factory.service.paymentService.IService, 'availableChannel' | 'id' | 'serviceOutput' | 'serviceType'> | Pick<factory.product.IProduct, 'availableChannel' | 'id' | 'serviceOutput' | 'serviceType'>;
|
|
10
10
|
location?: factory.action.trade.pay.ILocation;
|
|
11
11
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Pay>;
|
|
@@ -268,7 +268,7 @@ function fixPaymentService(params) {
|
|
|
268
268
|
break;
|
|
269
269
|
// PaymentCardの場合、プロダクト検索
|
|
270
270
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
271
|
-
paymentService = (yield repos.product.
|
|
271
|
+
paymentService = (yield repos.product.projectFields({
|
|
272
272
|
limit: 1,
|
|
273
273
|
page: 1,
|
|
274
274
|
project: { id: { $eq: params.project.id } },
|
|
@@ -280,13 +280,13 @@ function fixPaymentService(params) {
|
|
|
280
280
|
}
|
|
281
281
|
break;
|
|
282
282
|
default:
|
|
283
|
-
paymentService = (yield repos.paymentService.
|
|
283
|
+
paymentService = (yield repos.paymentService.projectFields({
|
|
284
284
|
limit: 1,
|
|
285
285
|
page: 1,
|
|
286
286
|
project: { id: { $eq: params.project.id } },
|
|
287
287
|
typeOf: { $eq: paymentServiceType },
|
|
288
288
|
id: { $eq: getPaymentServiceId(params) }
|
|
289
|
-
}, [], [])).shift();
|
|
289
|
+
}, ['availableChannel', 'serviceOutput', 'serviceType'], [])).shift();
|
|
290
290
|
if (paymentService === undefined) {
|
|
291
291
|
throw new factory.errors.NotFound('PaymentService');
|
|
292
292
|
}
|
|
@@ -6,5 +6,5 @@ export declare function createStartParams(params: factory.assetTransaction.refun
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
payAction: factory.action.trade.pay.IAction;
|
|
9
|
-
paymentService?: factory.product.IProduct | factory.service.paymentService.IService
|
|
9
|
+
paymentService?: factory.product.IProduct | Pick<factory.service.paymentService.IService, 'availableChannel' | 'id' | 'typeOf' | 'serviceOutput'>;
|
|
10
10
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Refund>;
|
|
@@ -86,7 +86,7 @@ function fixPaymentService(params) {
|
|
|
86
86
|
break;
|
|
87
87
|
// PaymentCardの場合、プロダクト検索
|
|
88
88
|
case factory.service.paymentService.PaymentServiceType.PaymentCard:
|
|
89
|
-
paymentService = (yield repos.product.
|
|
89
|
+
paymentService = (yield repos.product.projectFields({
|
|
90
90
|
limit: 1,
|
|
91
91
|
page: 1,
|
|
92
92
|
project: { id: { $eq: params.payAction.project.id } },
|
|
@@ -98,13 +98,13 @@ function fixPaymentService(params) {
|
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
default:
|
|
101
|
-
paymentService = (yield repos.paymentService.
|
|
101
|
+
paymentService = (yield repos.paymentService.projectFields({
|
|
102
102
|
limit: 1,
|
|
103
103
|
page: 1,
|
|
104
104
|
project: { id: { $eq: params.payAction.project.id } },
|
|
105
105
|
typeOf: { $eq: params.paymentServiceType },
|
|
106
106
|
id: { $eq: paymentServiceId }
|
|
107
|
-
}, [], [])).shift();
|
|
107
|
+
}, ['availableChannel', 'serviceOutput', 'typeOf'], [])).shift();
|
|
108
108
|
if (paymentService === undefined) {
|
|
109
109
|
throw new factory.errors.NotFound('PaymentService');
|
|
110
110
|
}
|
|
@@ -27,7 +27,7 @@ function start(params) {
|
|
|
27
27
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
const project = yield repos.project.findById({
|
|
29
29
|
id: params.project.id,
|
|
30
|
-
inclusion: ['
|
|
30
|
+
inclusion: ['typeOf'],
|
|
31
31
|
exclusion: []
|
|
32
32
|
});
|
|
33
33
|
// objectはオファー
|
|
@@ -44,8 +44,7 @@ function start(params) {
|
|
|
44
44
|
throw new factory.errors.ArgumentNull('object.itemOffered.id');
|
|
45
45
|
}
|
|
46
46
|
// プロダクト確認
|
|
47
|
-
|
|
48
|
-
const product = (yield repos.product.searchProducts({
|
|
47
|
+
const product = (yield repos.product.projectFields({
|
|
49
48
|
limit: 1,
|
|
50
49
|
page: 1,
|
|
51
50
|
id: { $eq: productId }
|
|
@@ -138,12 +137,11 @@ function createTransactionObject(params) {
|
|
|
138
137
|
function createPermitService(params) {
|
|
139
138
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
140
139
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
141
|
-
|
|
142
|
-
const product = (yield repos.product.searchProducts({
|
|
140
|
+
const product = (yield repos.product.projectFields({
|
|
143
141
|
limit: 1,
|
|
144
142
|
page: 1,
|
|
145
143
|
id: { $eq: params.issuedThrough.id }
|
|
146
|
-
}, [], [])).shift();
|
|
144
|
+
}, ['availableChannel'], [])).shift();
|
|
147
145
|
if (product === undefined) {
|
|
148
146
|
throw new factory.errors.NotFound('Product');
|
|
149
147
|
}
|
|
@@ -294,12 +294,12 @@ function validateProgramMembershipUsed(params) {
|
|
|
294
294
|
if (typeof issuedThroughId !== 'string' || issuedThroughId === '') {
|
|
295
295
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
296
296
|
}
|
|
297
|
-
permitIssuedThrough = (yield repos.product.
|
|
297
|
+
permitIssuedThrough = (yield repos.product.projectFields({
|
|
298
298
|
limit: 1,
|
|
299
299
|
page: 1,
|
|
300
300
|
id: { $eq: issuedThroughId },
|
|
301
301
|
typeOf: { $eq: factory.product.ProductType.MembershipService }
|
|
302
|
-
}, ['
|
|
302
|
+
}, ['typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
303
303
|
if (permitIssuedThrough === undefined) {
|
|
304
304
|
throw new factory.errors.NotFound(factory.product.ProductType.MembershipService);
|
|
305
305
|
}
|
|
@@ -309,12 +309,12 @@ function validateProgramMembershipUsed(params) {
|
|
|
309
309
|
if (typeof issuedThroughId !== 'string' || issuedThroughId === '') {
|
|
310
310
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
311
311
|
}
|
|
312
|
-
permitIssuedThrough = (yield repos.paymentService.
|
|
312
|
+
permitIssuedThrough = (yield repos.paymentService.projectFields({
|
|
313
313
|
limit: 1,
|
|
314
314
|
page: 1,
|
|
315
315
|
id: { $eq: issuedThroughId },
|
|
316
316
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
317
|
-
}, ['
|
|
317
|
+
}, ['typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
318
318
|
if (permitIssuedThrough === undefined) {
|
|
319
319
|
throw new factory.errors.NotFound(factory.service.paymentService.PaymentServiceType.CreditCard);
|
|
320
320
|
}
|
|
@@ -331,10 +331,10 @@ function validateProgramMembershipUsed(params) {
|
|
|
331
331
|
switch (permitIssuedThrough.typeOf) {
|
|
332
332
|
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
333
333
|
// 適用メンバーシップ条件有のオファーであれば、問答無用に受け入れる
|
|
334
|
-
const eligibleMembershipType = (_g = (_f = params.availableOffer.eligibleMembershipType) === null || _f === void 0 ? void 0 : _f
|
|
334
|
+
const eligibleMembershipType = (_g = (_f = params.availableOffer.eligibleMembershipType) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.codeValue;
|
|
335
335
|
if (typeof eligibleMembershipType === 'string') {
|
|
336
336
|
programMembershipUsed = {
|
|
337
|
-
typeOf: factory.
|
|
337
|
+
typeOf: factory.programMembership.ProgramMembershipType.ProgramMembership,
|
|
338
338
|
identifier: programMembershipUsedIdentifier,
|
|
339
339
|
issuedThrough: {
|
|
340
340
|
serviceType: { codeValue: eligibleMembershipType },
|
|
@@ -355,7 +355,7 @@ function validateProgramMembershipUsed(params) {
|
|
|
355
355
|
}
|
|
356
356
|
if (typeof (issuedThroughServiceType === null || issuedThroughServiceType === void 0 ? void 0 : issuedThroughServiceType.codeValue) === 'string') {
|
|
357
357
|
programMembershipUsed = {
|
|
358
|
-
typeOf: factory.
|
|
358
|
+
typeOf: factory.programMembership.ProgramMembershipType.ProgramMembership,
|
|
359
359
|
identifier: programMembershipUsedIdentifier,
|
|
360
360
|
issuedThrough: {
|
|
361
361
|
id: permitIssuedThrough.id,
|
|
@@ -390,7 +390,7 @@ function validateProgramMembershipUsed(params) {
|
|
|
390
390
|
}
|
|
391
391
|
if (((_h = permitIssuedThrough.serviceType) === null || _h === void 0 ? void 0 : _h.typeOf) === 'CategoryCode') {
|
|
392
392
|
programMembershipUsed = {
|
|
393
|
-
typeOf:
|
|
393
|
+
typeOf: factory.programMembership.ProgramMembershipType.ProgramMembership,
|
|
394
394
|
identifier: programMembershipUsedIdentifier,
|
|
395
395
|
issuedThrough: {
|
|
396
396
|
id: permitIssuedThrough.id,
|
|
@@ -410,9 +410,7 @@ function validateProgramMembershipUsed(params) {
|
|
|
410
410
|
function createPermitService(params) {
|
|
411
411
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
412
412
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
413
|
-
|
|
414
|
-
// await repos.product.findProductById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
415
|
-
const product = (yield repos.product.searchProducts({
|
|
413
|
+
const product = (yield repos.product.projectFields({
|
|
416
414
|
limit: 1,
|
|
417
415
|
page: 1,
|
|
418
416
|
id: { $eq: params.issuedThrough.id }
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createReservation = exports.createAdditionalTicketText = exports.createAdditionalProperty = void 0;
|
|
4
|
+
const createDebug = require("debug");
|
|
4
5
|
const moment = require("moment");
|
|
5
6
|
const util = require("util");
|
|
6
7
|
const factory = require("../../../../../factory");
|
|
7
8
|
const price_1 = require("./price");
|
|
9
|
+
const debug = createDebug('chevre-domain:service:assetTransaction');
|
|
8
10
|
function createTicketIdentifier(params) {
|
|
9
11
|
var _a, _b, _c, _d;
|
|
10
12
|
// チケット識別子の規定値を作成
|
|
@@ -193,11 +195,12 @@ function validateEligibleSubReservation(params) {
|
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
function validateEligibleMembershipType(params) {
|
|
198
|
+
debug('validateEligibleMembershipType: validating...', JSON.stringify(params.programMembershipUsed), JSON.stringify(params.availableOffer.eligibleMembershipType));
|
|
196
199
|
const programMembershipUsed = params.programMembershipUsed;
|
|
197
200
|
// 使用メンバーシップがeligibleMembershipに含まれればよい
|
|
198
201
|
const eligibleMembershipType = params.availableOffer.eligibleMembershipType;
|
|
199
202
|
if (Array.isArray(eligibleMembershipType)) {
|
|
200
|
-
if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) !== factory.
|
|
203
|
+
if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) !== factory.programMembership.ProgramMembershipType.ProgramMembership) {
|
|
201
204
|
throw new factory.errors.Argument('programMembershipUsed', 'programMembership required');
|
|
202
205
|
}
|
|
203
206
|
const { identifier, issuedThrough } = programMembershipUsed;
|
|
@@ -405,9 +405,7 @@ function getAcceptedSeatNumbersAndSeatSections(params) {
|
|
|
405
405
|
function createPermitService(params) {
|
|
406
406
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
407
407
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
408
|
-
|
|
409
|
-
// await repos.product.findProductById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
410
|
-
const product = (yield repos.product.searchProducts({
|
|
408
|
+
const product = (yield repos.product.projectFields({
|
|
411
409
|
limit: 1,
|
|
412
410
|
page: 1,
|
|
413
411
|
id: { $eq: params.issuedThrough.id }
|