@chevre/domain 24.0.0-alpha.0 → 24.0.0-alpha.2
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/lib/chevre/repo/acceptedPaymentMethod.js +1 -1
- package/lib/chevre/repo/additionalProperty.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +1 -1
- package/lib/chevre/repo/confirmationNumber.js +2 -4
- package/lib/chevre/repo/creativeWork.js +1 -1
- package/lib/chevre/repo/eventOffer.js +1 -1
- package/lib/chevre/repo/eventSeries.js +1 -1
- package/lib/chevre/repo/identity.js +1 -2
- package/lib/chevre/repo/issuer.js +2 -4
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/note.js +1 -1
- package/lib/chevre/repo/noteAboutOrder.js +1 -1
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
- package/lib/chevre/repo/offerItemCondition.js +1 -1
- package/lib/chevre/repo/order.js +1 -1
- package/lib/chevre/repo/orderInTransaction.js +1 -2
- package/lib/chevre/repo/orderNumber.js +2 -4
- package/lib/chevre/repo/place/movieTheater.js +1 -1
- package/lib/chevre/repo/place/seat.js +1 -1
- package/lib/chevre/repo/product.js +1 -1
- package/lib/chevre/repo/productOffer.js +1 -1
- package/lib/chevre/repo/project.js +1 -1
- package/lib/chevre/repo/reservation.js +1 -1
- package/lib/chevre/repo/role.js +1 -2
- package/lib/chevre/repo/seller.js +1 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +2 -4
- package/lib/chevre/repo/transactionNumber.js +2 -4
- package/lib/chevre/repo/trip.js +1 -2
- package/lib/chevre/service/account.js +14 -21
- package/lib/chevre/service/accountTransaction/deposit.js +2 -8
- package/lib/chevre/service/accountTransaction/transfer.js +2 -8
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -8
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +24 -32
- package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +2 -4
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -23
- package/lib/chevre/service/assetTransaction/pay/check.js +6 -11
- package/lib/chevre/service/assetTransaction/pay/confirm.js +1 -2
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +13 -20
- package/lib/chevre/service/assetTransaction/registerService.js +1 -7
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +2 -4
- package/lib/chevre/service/assetTransaction/reserveCOA.js +2 -4
- package/lib/chevre/service/delivery/product/factory.js +1 -2
- package/lib/chevre/service/delivery/reservation/factory.js +1 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +1 -0
- package/lib/chevre/service/event.js +0 -1
- package/lib/chevre/service/moneyTransfer.js +2 -2
- package/lib/chevre/service/notification/factory.js +1 -1
- package/lib/chevre/service/notification/notifyByEmail.js +50 -56
- package/lib/chevre/service/notification/sendEmailMessage.js +2 -3
- package/lib/chevre/service/notification/triggerWebhook.js +32 -37
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +1 -2
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +1 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +47 -54
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +7 -13
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated.js +1 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -2
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/payment/any/fixOrderAsNeeded.js +1 -2
- package/lib/chevre/service/payment/any.js +1 -2
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -2
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -2
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3dsResult2recipe.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCardResult2recipe.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/authorize.js +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +4 -6
- package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -2
- package/lib/chevre/service/payment/paymentCard.js +2 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +3 -6
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
- package/lib/chevre/service/task/pay.js +1 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +11 -19
- package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -4
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -2
- package/lib/chevre/service/transaction/returnOrder/preStart/getReturnPolicyByProject.js +1 -1
- package/package.json +5 -14
|
@@ -95,7 +95,7 @@ class AcceptedPaymentMethodRepo {
|
|
|
95
95
|
}
|
|
96
96
|
async findAcceptedPaymentMethods(params, inclusion) {
|
|
97
97
|
const conditions = AcceptedPaymentMethodRepo.CREATE_MONGO_CONDITIONS(params);
|
|
98
|
-
let positiveProjectionFields
|
|
98
|
+
let positiveProjectionFields;
|
|
99
99
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
100
100
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
101
101
|
}
|
|
@@ -84,7 +84,7 @@ class AdditionalPropertyRepo {
|
|
|
84
84
|
*/
|
|
85
85
|
async projectFields(params, inclusion) {
|
|
86
86
|
const conditions = AdditionalPropertyRepo.CREATE_MONGO_CONDITIONS(params);
|
|
87
|
-
let positiveProjectionFields
|
|
87
|
+
let positiveProjectionFields;
|
|
88
88
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
89
89
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
90
90
|
}
|
|
@@ -443,7 +443,7 @@ class AggregateOfferRepo {
|
|
|
443
443
|
else if (negativeProjectionFields.length > 0) {
|
|
444
444
|
negativeProjectionFields.forEach((field) => {
|
|
445
445
|
if (typeof projectStage[field] === 'string') {
|
|
446
|
-
delete projectStage[field];
|
|
446
|
+
delete projectStage[field]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
447
447
|
}
|
|
448
448
|
});
|
|
449
449
|
}
|
|
@@ -61,16 +61,14 @@ class ConfirmationNumberRepo {
|
|
|
61
61
|
* 発行する
|
|
62
62
|
*/
|
|
63
63
|
async publish(params) {
|
|
64
|
-
let dataFeedExpires;
|
|
65
64
|
const dataFeedIdentifier = ConfirmationNumberRepo.createDataFeedIdentifier({ orderDate: params.orderDate });
|
|
66
|
-
let incrReply;
|
|
67
65
|
// support publishByMongo(2025-05-23~)
|
|
68
66
|
// const useMongoBySettings = await this.useMongoBySettings(params);
|
|
69
67
|
// データ保管期間はとりあえず2 months
|
|
70
|
-
dataFeedExpires = (0, moment_timezone_1.default)(params.orderDate)
|
|
68
|
+
const dataFeedExpires = (0, moment_timezone_1.default)(params.orderDate)
|
|
71
69
|
.add(2, 'months')
|
|
72
70
|
.toDate();
|
|
73
|
-
incrReply = await this.counterRepo.incrementByMongo({
|
|
71
|
+
const incrReply = await this.counterRepo.incrementByMongo({
|
|
74
72
|
identifier: dataFeedIdentifier,
|
|
75
73
|
includedInDataCatalog: { identifier: transactionNumber_1.DataCatalogIdentifier.confirmationNumber },
|
|
76
74
|
expires: dataFeedExpires
|
|
@@ -253,7 +253,7 @@ class CreativeWorkRepo {
|
|
|
253
253
|
*/
|
|
254
254
|
async projectFields(params, inclusion) {
|
|
255
255
|
const conditions = CreativeWorkRepo.CREATE_MONGO_CONDITIONS(params);
|
|
256
|
-
let positiveProjectionFields
|
|
256
|
+
let positiveProjectionFields;
|
|
257
257
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
258
258
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
259
259
|
}
|
|
@@ -96,7 +96,7 @@ class EventOfferRepo {
|
|
|
96
96
|
}
|
|
97
97
|
async findEventOffers(params, inclusion) {
|
|
98
98
|
const conditions = EventOfferRepo.CREATE_MONGO_CONDITIONS(params);
|
|
99
|
-
let positiveProjectionFields
|
|
99
|
+
let positiveProjectionFields;
|
|
100
100
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
101
101
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
102
102
|
}
|
|
@@ -481,7 +481,7 @@ class EventSeriesRepo {
|
|
|
481
481
|
*/
|
|
482
482
|
async projectEventSeriesFields(params, inclusion) {
|
|
483
483
|
const conditions = EventSeriesRepo.CREATE_MONGO_CONDITIONS(params);
|
|
484
|
-
let projection
|
|
484
|
+
let projection;
|
|
485
485
|
const positiveProjectionFields = (Array.isArray(inclusion))
|
|
486
486
|
? inclusion.filter((key) => key !== 'id' && key !== '_id')
|
|
487
487
|
: [];
|
|
@@ -148,7 +148,6 @@ class IdentityRepo {
|
|
|
148
148
|
.cursor();
|
|
149
149
|
}
|
|
150
150
|
async updateIssuedBy2array(params) {
|
|
151
|
-
let doc;
|
|
152
151
|
const { id, issuedBy } = params;
|
|
153
152
|
const filter = {
|
|
154
153
|
_id: { $eq: id }
|
|
@@ -163,7 +162,7 @@ class IdentityRepo {
|
|
|
163
162
|
new: true,
|
|
164
163
|
projection: { _id: 1, id: { $toString: '$_id' } }
|
|
165
164
|
};
|
|
166
|
-
doc = await this.identityModel.findOneAndUpdate(filter, update, options)
|
|
165
|
+
const doc = await this.identityModel.findOneAndUpdate(filter, update, options)
|
|
167
166
|
.lean()
|
|
168
167
|
.exec();
|
|
169
168
|
if (doc === null) {
|
|
@@ -75,12 +75,10 @@ class IssuerRepo {
|
|
|
75
75
|
return { id: savedId };
|
|
76
76
|
}
|
|
77
77
|
async renameIssuerIdentifier(params) {
|
|
78
|
-
let savedId;
|
|
79
|
-
let doc;
|
|
80
78
|
const { id, ...updateFields } = params;
|
|
81
|
-
doc = await this.issuerModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $set: updateFields }, { upsert: false, new: true, projection: { _id: 1 } })
|
|
79
|
+
const doc = await this.issuerModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $set: updateFields }, { upsert: false, new: true, projection: { _id: 1 } })
|
|
82
80
|
.exec();
|
|
83
|
-
savedId = params.id;
|
|
81
|
+
const savedId = params.id;
|
|
84
82
|
if (doc === null) {
|
|
85
83
|
throw new factory.errors.NotFound(this.issuerModel.modelName);
|
|
86
84
|
}
|
|
@@ -78,7 +78,7 @@ class MessageRepo {
|
|
|
78
78
|
*/
|
|
79
79
|
async projectFields(params, inclusion) {
|
|
80
80
|
const conditions = MessageRepo.CREATE_MONGO_CONDITIONS(params);
|
|
81
|
-
let positiveProjectionFields
|
|
81
|
+
let positiveProjectionFields;
|
|
82
82
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
83
83
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
84
84
|
}
|
package/lib/chevre/repo/note.js
CHANGED
|
@@ -99,7 +99,7 @@ class NoteRepo {
|
|
|
99
99
|
}
|
|
100
100
|
async findNotes(params, inclusion) {
|
|
101
101
|
const conditions = NoteRepo.CREATE_MONGO_CONDITIONS(params);
|
|
102
|
-
let positiveProjectionFields
|
|
102
|
+
let positiveProjectionFields;
|
|
103
103
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
104
104
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
105
105
|
}
|
|
@@ -95,7 +95,7 @@ class NoteAboutOrderRepo {
|
|
|
95
95
|
*/
|
|
96
96
|
async findOrderNotes(params, inclusion) {
|
|
97
97
|
const conditions = NoteAboutOrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
98
|
-
let positiveProjectionFields
|
|
98
|
+
let positiveProjectionFields;
|
|
99
99
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
100
100
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
101
101
|
}
|
|
@@ -113,7 +113,7 @@ class OfferRepo {
|
|
|
113
113
|
// idは除外しない(2023-12-14~)
|
|
114
114
|
if (field !== 'id') {
|
|
115
115
|
if (typeof projectStage[field] === 'string') {
|
|
116
|
-
delete projectStage[field];
|
|
116
|
+
delete projectStage[field]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
});
|
|
@@ -74,7 +74,7 @@ class OfferItemConditionRepo {
|
|
|
74
74
|
// ? Object.values(projection)
|
|
75
75
|
// .some((value) => value !== 0)
|
|
76
76
|
// : false;
|
|
77
|
-
let positiveProjectionFields
|
|
77
|
+
let positiveProjectionFields;
|
|
78
78
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
79
79
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
80
80
|
}
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -988,7 +988,7 @@ class OrderRepo {
|
|
|
988
988
|
async projectFields(params, options) {
|
|
989
989
|
const { inclusion } = options;
|
|
990
990
|
const conditions = OrderRepo.CREATE_MONGO_CONDITIONS(params);
|
|
991
|
-
let projectStage
|
|
991
|
+
let projectStage;
|
|
992
992
|
const positiveProjectionFields = (Array.isArray(inclusion))
|
|
993
993
|
? inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key))
|
|
994
994
|
: [];
|
|
@@ -56,10 +56,9 @@ class OrderInTransactionRepo {
|
|
|
56
56
|
if (!(order.orderDate instanceof Date)) {
|
|
57
57
|
throw new factory.errors.Argument('orderDate', 'must be Date');
|
|
58
58
|
}
|
|
59
|
-
let setFields;
|
|
60
59
|
// acceptedOffersを上書きしない
|
|
61
60
|
// const { acceptedOffers, ...orderWithoutAcceptedOffers } = order;
|
|
62
|
-
setFields = order;
|
|
61
|
+
const setFields = order;
|
|
63
62
|
// typeOf:PlaceOrderのドキュメントが存在すれば、typeOf:Orderに変更する
|
|
64
63
|
await this.orderModel.updateOne({
|
|
65
64
|
orderNumber: { $eq: order.orderNumber },
|
|
@@ -68,13 +68,11 @@ class OrderNumberRepo {
|
|
|
68
68
|
.toString();
|
|
69
69
|
const projectPrefix = params.project.alternateName
|
|
70
70
|
.toUpperCase();
|
|
71
|
-
let dataFeedExpires;
|
|
72
71
|
const dataFeedIdentifier = `${projectPrefix}:${timestamp}`;
|
|
73
|
-
|
|
74
|
-
dataFeedExpires = (0, moment_timezone_1.default)(params.orderDate)
|
|
72
|
+
const dataFeedExpires = (0, moment_timezone_1.default)(params.orderDate)
|
|
75
73
|
.add(1, 'minute') // ミリ秒でカウントしていくので、注文日時後1分で十分
|
|
76
74
|
.toDate();
|
|
77
|
-
incrReply = await this.counterRepo.incrementByMongo({
|
|
75
|
+
const incrReply = await this.counterRepo.incrementByMongo({
|
|
78
76
|
identifier: dataFeedIdentifier,
|
|
79
77
|
includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.orderNumber },
|
|
80
78
|
expires: dataFeedExpires
|
|
@@ -240,7 +240,7 @@ class MovieTheaterRepo {
|
|
|
240
240
|
*/
|
|
241
241
|
async projectFields(params, inclusion) {
|
|
242
242
|
const conditions = MovieTheaterRepo.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
243
|
-
let positiveProjectionFields
|
|
243
|
+
let positiveProjectionFields;
|
|
244
244
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
245
245
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
246
246
|
}
|
|
@@ -84,7 +84,7 @@ class SeatRepo {
|
|
|
84
84
|
Object.keys(params)
|
|
85
85
|
.forEach((field) => {
|
|
86
86
|
if (typeof projectStage[field] === 'string') {
|
|
87
|
-
delete projectStage[field];
|
|
87
|
+
delete projectStage[field]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
return projectStage;
|
|
@@ -175,7 +175,7 @@ class ProductRepo {
|
|
|
175
175
|
*/
|
|
176
176
|
async projectFields(conditions, inclusion) {
|
|
177
177
|
const andConditions = ProductRepo.CREATE_MONGO_CONDITIONS(conditions);
|
|
178
|
-
let positiveProjectionFields
|
|
178
|
+
let positiveProjectionFields;
|
|
179
179
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
180
180
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
181
181
|
}
|
|
@@ -97,7 +97,7 @@ class ProductOfferRepo {
|
|
|
97
97
|
}
|
|
98
98
|
async findProductOffers(params, inclusion) {
|
|
99
99
|
const conditions = ProductOfferRepo.CREATE_MONGO_CONDITIONS(params);
|
|
100
|
-
let positiveProjectionFields
|
|
100
|
+
let positiveProjectionFields;
|
|
101
101
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
102
102
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
103
103
|
}
|
|
@@ -91,7 +91,7 @@ class ProjectRepo {
|
|
|
91
91
|
*/
|
|
92
92
|
async projectFields(conditions, inclusion) {
|
|
93
93
|
const andConditions = ProjectRepo.CREATE_MONGO_CONDITIONS(conditions);
|
|
94
|
-
let positiveProjectionFields
|
|
94
|
+
let positiveProjectionFields;
|
|
95
95
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
96
96
|
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
97
97
|
}
|
|
@@ -789,7 +789,7 @@ class ReservationRepo {
|
|
|
789
789
|
*/
|
|
790
790
|
async projectFields(params, inclusion) {
|
|
791
791
|
const conditions = ReservationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
792
|
-
let projection
|
|
792
|
+
let projection;
|
|
793
793
|
if (inclusion !== undefined && inclusion !== null) {
|
|
794
794
|
projection = {
|
|
795
795
|
_id: 0, // hide _id(2024-08-08~)
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -177,7 +177,6 @@ class RoleRepo {
|
|
|
177
177
|
.exec();
|
|
178
178
|
}
|
|
179
179
|
async create(params) {
|
|
180
|
-
let savedId;
|
|
181
180
|
const { member, memberOf, permissions, roleName } = params;
|
|
182
181
|
const creatingRole = {
|
|
183
182
|
member, memberOf, permissions, roleName,
|
|
@@ -188,7 +187,7 @@ class RoleRepo {
|
|
|
188
187
|
if (typeof insertedId !== 'string') {
|
|
189
188
|
throw new factory.errors.Internal(`role not saved unexpectedly. result:${JSON.stringify(result)}`);
|
|
190
189
|
}
|
|
191
|
-
savedId = insertedId;
|
|
190
|
+
const savedId = insertedId;
|
|
192
191
|
return { id: savedId };
|
|
193
192
|
}
|
|
194
193
|
}
|
|
@@ -201,7 +201,7 @@ class SellerRepo {
|
|
|
201
201
|
if (exclusion.length > 0) {
|
|
202
202
|
exclusion.forEach((field) => {
|
|
203
203
|
if (typeof projectStage[field] === 'string' || typeof projectStage[field] === 'object') {
|
|
204
|
-
delete projectStage[field];
|
|
204
|
+
delete projectStage[field]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
@@ -53,13 +53,11 @@ class ServiceOutputIdentifierRepo {
|
|
|
53
53
|
const timestamp = (0, moment_timezone_1.default)(params.startDate)
|
|
54
54
|
.valueOf()
|
|
55
55
|
.toString();
|
|
56
|
-
let dataFeedExpires;
|
|
57
56
|
const dataFeedIdentifier = timestamp;
|
|
58
|
-
|
|
59
|
-
dataFeedExpires = (0, moment_timezone_1.default)(params.startDate)
|
|
57
|
+
const dataFeedExpires = (0, moment_timezone_1.default)(params.startDate)
|
|
60
58
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
61
59
|
.toDate();
|
|
62
|
-
incrReply = await this.counterRepo.incrementByMongo({
|
|
60
|
+
const incrReply = await this.counterRepo.incrementByMongo({
|
|
63
61
|
identifier: dataFeedIdentifier,
|
|
64
62
|
includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.serviceOutputIdentifier },
|
|
65
63
|
expires: dataFeedExpires
|
|
@@ -51,13 +51,11 @@ class TransactionNumberRepo {
|
|
|
51
51
|
const timestamp = (0, moment_timezone_1.default)(params.startDate)
|
|
52
52
|
.valueOf()
|
|
53
53
|
.toString();
|
|
54
|
-
let dataFeedExpires;
|
|
55
54
|
const dataFeedIdentifier = timestamp;
|
|
56
|
-
|
|
57
|
-
dataFeedExpires = (0, moment_timezone_1.default)(params.startDate)
|
|
55
|
+
const dataFeedExpires = (0, moment_timezone_1.default)(params.startDate)
|
|
58
56
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
59
57
|
.toDate();
|
|
60
|
-
incrReply = await this.counterRepo.incrementByMongo({
|
|
58
|
+
const incrReply = await this.counterRepo.incrementByMongo({
|
|
61
59
|
identifier: dataFeedIdentifier,
|
|
62
60
|
includedInDataCatalog: { identifier: transactionNumber_2.DataCatalogIdentifier.transactionNumber },
|
|
63
61
|
expires: dataFeedExpires
|
package/lib/chevre/repo/trip.js
CHANGED
|
@@ -88,9 +88,8 @@ class TripRepo {
|
|
|
88
88
|
return docs.map((doc) => doc.toObject());
|
|
89
89
|
}
|
|
90
90
|
async updatePartiallyById(params) {
|
|
91
|
-
let doc;
|
|
92
91
|
const { typeOf, ...updateFields } = params.attributes;
|
|
93
|
-
doc = await this.tripModel.findOneAndUpdate({
|
|
92
|
+
const doc = await this.tripModel.findOneAndUpdate({
|
|
94
93
|
_id: params.id,
|
|
95
94
|
typeOf: params.attributes.typeOf
|
|
96
95
|
}, {
|
|
@@ -75,27 +75,20 @@ function open(params) {
|
|
|
75
75
|
function transferMoney(actionAttributes) {
|
|
76
76
|
return async (repos) => {
|
|
77
77
|
const action = actionAttributes;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
amount: (typeof action.amount === 'number') ? action.amount : Number(action.amount.value),
|
|
93
|
-
transactionId: action.purpose.id
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
78
|
+
const fromAccountNumber = (typeof action.fromLocation.accountNumber === 'string')
|
|
79
|
+
? action.fromLocation.accountNumber
|
|
80
|
+
/* istanbul ignore next */
|
|
81
|
+
: undefined;
|
|
82
|
+
const toAccountNumber = (typeof action.toLocation.accountNumber === 'string')
|
|
83
|
+
? action.toLocation.accountNumber
|
|
84
|
+
/* istanbul ignore next */
|
|
85
|
+
: undefined;
|
|
86
|
+
await repos.account.settleTransaction({
|
|
87
|
+
fromAccountNumber: fromAccountNumber,
|
|
88
|
+
toAccountNumber: toAccountNumber,
|
|
89
|
+
amount: (typeof action.amount === 'number') ? action.amount : Number(action.amount.value),
|
|
90
|
+
transactionId: action.purpose.id
|
|
91
|
+
});
|
|
99
92
|
};
|
|
100
93
|
}
|
|
101
94
|
/**
|
|
@@ -60,14 +60,8 @@ function start(params) {
|
|
|
60
60
|
...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
|
|
61
61
|
};
|
|
62
62
|
// 取引作成
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
66
|
-
transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
63
|
+
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
64
|
+
const transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
71
65
|
const pendingTransaction = {
|
|
72
66
|
typeOf: transaction.typeOf,
|
|
73
67
|
id: transaction.id,
|
|
@@ -82,14 +82,8 @@ function start(params) {
|
|
|
82
82
|
...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
|
|
83
83
|
};
|
|
84
84
|
// 取引作成
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
88
|
-
transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
85
|
+
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
86
|
+
const transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
93
87
|
const pendingTransaction = {
|
|
94
88
|
typeOf: transaction.typeOf,
|
|
95
89
|
id: transaction.id,
|
|
@@ -67,14 +67,8 @@ function start(params) {
|
|
|
67
67
|
...(typeof params.identifier === 'string' && params.identifier.length > 0) ? { identifier: params.identifier } : undefined
|
|
68
68
|
};
|
|
69
69
|
// 取引作成
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
73
|
-
transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
70
|
+
// 取引識別子が指定されていれば、進行中取引のユニークネスを保証する
|
|
71
|
+
const transaction = await repos.accountTransaction.startByIdentifier(startParams);
|
|
78
72
|
const pendingTransaction = {
|
|
79
73
|
typeOf: transaction.typeOf,
|
|
80
74
|
id: transaction.id,
|
|
@@ -192,37 +192,32 @@ function aggregateOfferByEvent(params) {
|
|
|
192
192
|
function calculateOfferCount(params) {
|
|
193
193
|
return async (repos) => {
|
|
194
194
|
let offerCount = 0;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
const eventOffers = params.event.offers;
|
|
196
|
+
if (typeof eventOffers?.itemOffered?.id === 'string') {
|
|
197
|
+
const eventService = (await repos.product.projectFields({
|
|
198
|
+
limit: 1,
|
|
199
|
+
page: 1,
|
|
200
|
+
id: { $eq: eventOffers.itemOffered.id }
|
|
201
|
+
}, ['hasOfferCatalog']
|
|
202
|
+
// []
|
|
203
|
+
)).shift();
|
|
204
|
+
if (eventService === undefined) {
|
|
205
|
+
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
206
|
+
}
|
|
207
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
208
|
+
const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.itemListElement.at(0)?.id;
|
|
209
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
210
|
+
const catalogs = await repos.offerCatalog.projectFields({
|
|
199
211
|
limit: 1,
|
|
200
212
|
page: 1,
|
|
201
|
-
id: { $
|
|
202
|
-
}, ['
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
207
|
-
}
|
|
208
|
-
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
209
|
-
const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.itemListElement.at(0)?.id;
|
|
210
|
-
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
211
|
-
const catalogs = await repos.offerCatalog.projectFields({
|
|
212
|
-
limit: 1,
|
|
213
|
-
page: 1,
|
|
214
|
-
id: { $in: [firstCatalogIdOfProduct] }
|
|
215
|
-
}, ['numberOfItems']);
|
|
216
|
-
const numberOfItems = catalogs.shift()?.numberOfItems;
|
|
217
|
-
if (typeof numberOfItems === 'number') {
|
|
218
|
-
offerCount = numberOfItems;
|
|
219
|
-
}
|
|
213
|
+
id: { $in: [firstCatalogIdOfProduct] }
|
|
214
|
+
}, ['numberOfItems']);
|
|
215
|
+
const numberOfItems = catalogs.shift()?.numberOfItems;
|
|
216
|
+
if (typeof numberOfItems === 'number') {
|
|
217
|
+
offerCount = numberOfItems;
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
220
|
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
throw error;
|
|
225
|
-
}
|
|
226
221
|
return { offerCount };
|
|
227
222
|
};
|
|
228
223
|
}
|
|
@@ -231,11 +226,8 @@ function aggregateReservationByEvent(params) {
|
|
|
231
226
|
// 収容人数を集計
|
|
232
227
|
let maximumAttendeeCapacity;
|
|
233
228
|
let remainingAttendeeCapacity;
|
|
234
|
-
let attendeeCount;
|
|
235
|
-
let checkInCount;
|
|
236
|
-
let reservationCount;
|
|
237
229
|
const reservationType = factory.reservationType.EventReservation;
|
|
238
|
-
reservationCount = await repos.reservation.count({
|
|
230
|
+
const reservationCount = await repos.reservation.count({
|
|
239
231
|
typeOf: reservationType,
|
|
240
232
|
reservationFor: { id: { $eq: params.event.id } },
|
|
241
233
|
reservationStatuses: [factory.reservationStatusType.ReservationConfirmed]
|
|
@@ -275,12 +267,12 @@ function aggregateReservationByEvent(params) {
|
|
|
275
267
|
remainingAttendeeCapacity = 0;
|
|
276
268
|
}
|
|
277
269
|
}
|
|
278
|
-
attendeeCount = await repos.reservation.count({
|
|
270
|
+
const attendeeCount = await repos.reservation.count({
|
|
279
271
|
typeOf: reservationType,
|
|
280
272
|
reservationFor: { id: { $eq: params.event.id } },
|
|
281
273
|
attended: true
|
|
282
274
|
});
|
|
283
|
-
checkInCount = await repos.reservation.count({
|
|
275
|
+
const checkInCount = await repos.reservation.count({
|
|
284
276
|
typeOf: reservationType,
|
|
285
277
|
reservationFor: { id: { $eq: params.event.id } },
|
|
286
278
|
checkedIn: true
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.confirm = confirm;
|
|
4
4
|
function confirm(params) {
|
|
5
5
|
return async (repos) => {
|
|
6
|
-
let stateReserveArgs;
|
|
7
|
-
let stateReserveResult;
|
|
8
6
|
let delReserveArgs;
|
|
9
|
-
stateReserveArgs = params.object;
|
|
10
|
-
stateReserveResult = await repos.reserveService.stateReserve(stateReserveArgs);
|
|
7
|
+
const stateReserveArgs = params.object;
|
|
8
|
+
const stateReserveResult = await repos.reserveService.stateReserve(stateReserveArgs);
|
|
11
9
|
if (stateReserveResult !== null) {
|
|
12
10
|
delReserveArgs = {
|
|
13
11
|
theaterCode: stateReserveArgs.theaterCode,
|
|
@@ -95,29 +95,8 @@ function start(params) {
|
|
|
95
95
|
expires: params.expires
|
|
96
96
|
};
|
|
97
97
|
// 取引開始
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
transaction = await repos.assetTransaction.start(startParams);
|
|
101
|
-
// const pendingTransaction = await authorizeAccount({ transaction })(repos);
|
|
102
|
-
await authorizeAccount({ transaction })(repos);
|
|
103
|
-
// 更新不要(2023-02-20~)
|
|
104
|
-
// await repos.assetTransaction.findByIdAndUpdate<factory.assetTransactionType.MoneyTransfer>({
|
|
105
|
-
// id: transaction.id,
|
|
106
|
-
// update: {
|
|
107
|
-
// 'object.pendingTransaction': {
|
|
108
|
-
// typeOf: pendingTransaction.typeOf,
|
|
109
|
-
// id: pendingTransaction.id,
|
|
110
|
-
// transactionNumber: pendingTransaction.transactionNumber,
|
|
111
|
-
// ...(typeof pendingTransaction.identifier === 'string')
|
|
112
|
-
// ? { identifier: pendingTransaction.identifier }
|
|
113
|
-
// : undefined
|
|
114
|
-
// }
|
|
115
|
-
// }
|
|
116
|
-
// });
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
98
|
+
const transaction = await repos.assetTransaction.start(startParams);
|
|
99
|
+
await authorizeAccount({ transaction })(repos);
|
|
121
100
|
return transaction;
|
|
122
101
|
};
|
|
123
102
|
}
|
|
@@ -33,17 +33,12 @@ function check(params) {
|
|
|
33
33
|
return async (repos, settings) => {
|
|
34
34
|
let action;
|
|
35
35
|
const paymentServiceType = params.object[0]?.typeOf;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
throw error;
|
|
36
|
+
switch (paymentServiceType) {
|
|
37
|
+
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
38
|
+
action = await MovieTicketPayment.checkMovieTicket(params)(repos, settings);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
throw new factory.errors.NotImplemented(`Payment service '${paymentServiceType}' not implemented`);
|
|
47
42
|
}
|
|
48
43
|
return action;
|
|
49
44
|
};
|
|
@@ -61,7 +61,6 @@ function confirm(params) {
|
|
|
61
61
|
|| typeof orderNumber !== 'string' || orderNumber.length === 0) {
|
|
62
62
|
throw new factory.errors.ArgumentNull('potentialActions.pay.purpose');
|
|
63
63
|
}
|
|
64
|
-
let potentialActions;
|
|
65
64
|
// 注文検証
|
|
66
65
|
const existingOrders = await repos.order.projectFields({
|
|
67
66
|
limit: 1,
|
|
@@ -77,7 +76,7 @@ function confirm(params) {
|
|
|
77
76
|
object: { paymentMethod: { paymentMethodId: transaction.transactionNumber } },
|
|
78
77
|
purpose: { confirmationNumber, orderNumber, typeOf: factory.order.OrderType.Order }
|
|
79
78
|
};
|
|
80
|
-
potentialActions = { pay: [payActionData4order] };
|
|
79
|
+
const potentialActions = { pay: [payActionData4order] };
|
|
81
80
|
await repos.assetTransaction.confirm({
|
|
82
81
|
typeOf: factory.assetTransactionType.Pay,
|
|
83
82
|
id: transaction.id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 決済取引サービス
|
|
3
3
|
*/
|
|
4
|
-
import * as GMO from '@motionpicture/gmo-service';
|
|
4
|
+
import type * as GMO from '@motionpicture/gmo-service';
|
|
5
5
|
import { Settings } from '../../../settings';
|
|
6
6
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
7
7
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|