@chevre/domain 24.1.0-alpha.5 → 24.1.0-alpha.50
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/emailMessageBuilder.js +4 -12
- package/lib/chevre/index.d.ts +1 -2
- package/lib/chevre/index.js +1 -3
- package/lib/chevre/repo/acceptedOffer.d.ts +15 -26
- package/lib/chevre/repo/acceptedOffer.js +106 -67
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +30 -0
- package/lib/chevre/repo/acceptedOfferInReserve.js +86 -0
- package/lib/chevre/repo/accountingReport.js +2 -30
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -2
- package/lib/chevre/repo/assetTransaction/reserve.js +4 -50
- package/lib/chevre/repo/event.js +12 -8
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +7 -0
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +74 -0
- package/lib/chevre/repo/factory/reservation/createMongoConditions.d.ts +1 -1
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +171 -362
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +42 -42
- package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/reservation.js +128 -146
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +84 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +2 -1
- package/lib/chevre/repo/order.d.ts +2 -83
- package/lib/chevre/repo/order.js +10 -373
- package/lib/chevre/repo/orderInTransaction.d.ts +56 -6
- package/lib/chevre/repo/orderInTransaction.js +58 -4
- package/lib/chevre/repo/place/hasPOS.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +20 -7
- package/lib/chevre/repo/reservation.js +16 -12
- package/lib/chevre/repo/role.d.ts +1 -15
- package/lib/chevre/repo/role.js +7 -14
- package/lib/chevre/repo/setting/integration.d.ts +27 -0
- package/lib/chevre/repo/setting/integration.js +102 -0
- package/lib/chevre/repo/transaction.d.ts +6 -6
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +11 -0
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +6 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +0 -12
- package/lib/chevre/service/assetTransaction/reserve/start/factory/price.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +1 -1
- package/lib/chevre/service/delivery/factory.d.ts +6 -1
- package/lib/chevre/service/delivery/factory.js +1 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -3
- package/lib/chevre/service/delivery/reservation/factory.js +0 -17
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +2 -4
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +3 -3
- package/lib/chevre/service/notification/notifyByEmail.d.ts +3 -3
- package/lib/chevre/service/notification/notifyByEmail.js +7 -12
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -3
- package/lib/chevre/service/notification/sendEmailMessage.js +5 -4
- package/lib/chevre/service/offer/any.d.ts +7 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +6 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +13 -15
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +16 -2
- package/lib/chevre/service/offer/event/authorize.js +62 -11
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -3
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +15 -15
- package/lib/chevre/service/order/deleteOrder.js +19 -43
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +9 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +6 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +0 -1
- package/lib/chevre/service/order/onOrderUpdated.js +0 -1
- package/lib/chevre/service/order/payOrder.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +4 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -5
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder.d.ts +1 -1
- package/lib/chevre/service/order/returnOrder.js +0 -1
- package/lib/chevre/service/order/sendOrder.js +0 -4
- package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/any/person2username.js +0 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize.js +4 -3
- package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/payCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/refundCreditCard.js +1 -1
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/searchGMOTrade.js +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +8 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -2
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +1 -1
- package/lib/chevre/service/reserve/confirmReservation.js +7 -7
- package/lib/chevre/service/reserve/factory.js +2 -1
- package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
- package/lib/chevre/service/reserve/findByCode.js +1 -1
- package/lib/chevre/service/reserve/findReservations.d.ts +14 -6
- package/lib/chevre/service/reserve/findReservations.js +26 -36
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +4 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +0 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +0 -1
- package/lib/chevre/service/reserve/searchByOrder.js +7 -3
- package/lib/chevre/service/task/acceptCOAOffer.js +6 -3
- package/lib/chevre/service/task/authorizePayment.js +4 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +4 -2
- package/lib/chevre/service/task/checkMovieTicket.js +4 -2
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -3
- package/lib/chevre/service/task/createAccountingReport.js +4 -8
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -2
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -2
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -2
- package/lib/chevre/service/task/invalidatePaymentUrl.js +3 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +3 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +0 -1
- package/lib/chevre/service/task/pay.js +4 -2
- package/lib/chevre/service/task/payment/invalidatePaymentUrlByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/payByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/payByTask.js +6 -7
- package/lib/chevre/service/task/payment/refundByTask.d.ts +1 -1
- package/lib/chevre/service/task/payment/voidPaymentByTask.d.ts +1 -1
- package/lib/chevre/service/task/placeOrder.js +3 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/task/refund.js +4 -2
- package/lib/chevre/service/task/returnReserveTransaction.js +4 -2
- package/lib/chevre/service/task/sendEmailMessage.js +5 -3
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/task/voidPayment.js +4 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
- package/lib/chevre/service/task.d.ts +0 -7
- package/lib/chevre/service/taskHandler.js +1 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +5 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +0 -3
- package/lib/chevre/service/validation/validateOrder.js +3 -78
- package/lib/chevre/settings.d.ts +0 -55
- package/lib/chevre/settings.js +1 -29
- package/lib/chevre/taskSettings.d.ts +0 -22
- package/lib/chevre/taskSettings.js +1 -7
- package/package.json +2 -2
- package/lib/chevre/credentials/customSearch.d.ts +0 -13
- package/lib/chevre/credentials/customSearch.js +0 -16
- package/lib/chevre/credentials/lineNotify.d.ts +0 -17
- package/lib/chevre/credentials/lineNotify.js +0 -20
- package/lib/chevre/credentials/sendGrid.d.ts +0 -24
- package/lib/chevre/credentials/sendGrid.js +0 -18
- package/lib/chevre/credentials.d.ts +0 -20
- package/lib/chevre/credentials.js +0 -42
package/lib/chevre/repo/order.js
CHANGED
|
@@ -31,27 +31,6 @@ class OrderRepo {
|
|
|
31
31
|
if (typeof projectIdEq === 'string') {
|
|
32
32
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
33
33
|
}
|
|
34
|
-
/* istanbul ignore else */
|
|
35
|
-
if (params.identifier !== undefined) {
|
|
36
|
-
/* istanbul ignore else */
|
|
37
|
-
if (Array.isArray(params.identifier.$all)) {
|
|
38
|
-
andConditions.push({
|
|
39
|
-
identifier: {
|
|
40
|
-
$exists: true,
|
|
41
|
-
$all: params.identifier.$all
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/* istanbul ignore else */
|
|
46
|
-
if (Array.isArray(params.identifier.$in)) {
|
|
47
|
-
andConditions.push({
|
|
48
|
-
identifier: {
|
|
49
|
-
$exists: true,
|
|
50
|
-
$in: params.identifier.$in
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
34
|
const providerIdEq = params.provider?.id?.$eq;
|
|
56
35
|
if (typeof providerIdEq === 'string') {
|
|
57
36
|
andConditions.push({ 'seller.id': { $exists: true, $eq: providerIdEq } });
|
|
@@ -129,44 +108,6 @@ class OrderRepo {
|
|
|
129
108
|
});
|
|
130
109
|
}
|
|
131
110
|
}
|
|
132
|
-
if (params.customer.additionalProperty !== undefined && params.customer.additionalProperty !== null) {
|
|
133
|
-
if (Array.isArray(params.customer.additionalProperty.$all)) {
|
|
134
|
-
andConditions.push({
|
|
135
|
-
'customer.additionalProperty': {
|
|
136
|
-
$exists: true,
|
|
137
|
-
$all: params.customer.additionalProperty.$all
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (Array.isArray(params.customer.additionalProperty.$in)) {
|
|
142
|
-
andConditions.push({
|
|
143
|
-
'customer.additionalProperty': {
|
|
144
|
-
$exists: true,
|
|
145
|
-
$in: params.customer.additionalProperty.$in
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (params.customer.memberOf !== undefined && params.customer.memberOf !== null) {
|
|
151
|
-
if (params.customer.memberOf.membershipNumber !== undefined && params.customer.memberOf.membershipNumber !== null) {
|
|
152
|
-
if (typeof params.customer.memberOf.membershipNumber.$eq === 'string') {
|
|
153
|
-
andConditions.push({
|
|
154
|
-
'customer.memberOf.membershipNumber': {
|
|
155
|
-
$exists: true,
|
|
156
|
-
$eq: params.customer.memberOf.membershipNumber.$eq
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
if (Array.isArray(params.customer.memberOf.membershipNumber.$in)) {
|
|
161
|
-
andConditions.push({
|
|
162
|
-
'customer.memberOf.membershipNumber': {
|
|
163
|
-
$exists: true,
|
|
164
|
-
$in: params.customer.memberOf.membershipNumber.$in
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
111
|
if (typeof params.customer.givenName === 'string') {
|
|
171
112
|
if (params.customer.givenName.length > 0) {
|
|
172
113
|
andConditions.push({
|
|
@@ -325,81 +266,20 @@ class OrderRepo {
|
|
|
325
266
|
andConditions.push({ confirmationNumber: { $exists: true, $in: params.confirmationNumbers } });
|
|
326
267
|
}
|
|
327
268
|
}
|
|
328
|
-
const orderedItemSize = params.orderedItem?.$size;
|
|
329
|
-
if (typeof orderedItemSize === 'number') {
|
|
330
|
-
andConditions.push({ orderedItem: { $size: orderedItemSize } });
|
|
331
|
-
}
|
|
332
|
-
const acceptedOffersSize = params.acceptedOffers?.$size;
|
|
333
|
-
if (typeof acceptedOffersSize === 'number') {
|
|
334
|
-
andConditions.push({ acceptedOffers: { $size: acceptedOffersSize } });
|
|
335
|
-
}
|
|
336
269
|
const serialNumberEq = params.acceptedOffers?.serialNumber?.$eq;
|
|
337
270
|
if (typeof serialNumberEq === 'string') {
|
|
338
271
|
andConditions.push({ 'acceptedOffers.serialNumber': { $exists: true, $eq: serialNumberEq } });
|
|
339
272
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
351
|
-
andConditions.push({
|
|
352
|
-
'acceptedOffers.itemOffered.typeOf': {
|
|
353
|
-
$exists: true,
|
|
354
|
-
$in: itemOfferedTypeOfIn
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
const itemOfferedIssuedThroughTypeOfEq = params.acceptedOffers?.itemOffered?.issuedThrough?.typeOf?.$eq;
|
|
359
|
-
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
360
|
-
andConditions.push({
|
|
361
|
-
'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
362
|
-
$exists: true,
|
|
363
|
-
$eq: itemOfferedIssuedThroughTypeOfEq
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
const itemOfferedIssuedThroughIdIn = params.acceptedOffers?.itemOffered?.issuedThrough?.id?.$in;
|
|
368
|
-
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
369
|
-
andConditions.push({
|
|
370
|
-
'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
371
|
-
$exists: true,
|
|
372
|
-
$in: itemOfferedIssuedThroughIdIn
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = params.acceptedOffers?.itemOffered?.programMembershipUsed?.identifier?.$eq;
|
|
377
|
-
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
378
|
-
andConditions.push({
|
|
379
|
-
'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
380
|
-
$exists: true,
|
|
381
|
-
$eq: itemOfferedProgramMembershipUsedIdentifierEq
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = params.acceptedOffers?.itemOffered?.programMembershipUsed?.issuedThrough?.serviceType?.codeValue?.$eq;
|
|
386
|
-
if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
387
|
-
andConditions.push({
|
|
388
|
-
'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
389
|
-
$exists: true,
|
|
390
|
-
$eq: itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
const itemOfferedReservedTicketIdentifierEq = params.acceptedOffers?.itemOffered?.reservedTicket?.identifier?.$eq;
|
|
395
|
-
if (typeof itemOfferedReservedTicketIdentifierEq === 'string') {
|
|
396
|
-
andConditions.push({
|
|
397
|
-
'acceptedOffers.itemOffered.reservedTicket.identifier': {
|
|
398
|
-
$exists: true,
|
|
399
|
-
$eq: itemOfferedReservedTicketIdentifierEq
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
273
|
+
// reservedTicket?.identifierはそもそも注文ドキュメントから廃止(2026-06-03~)
|
|
274
|
+
// const itemOfferedReservedTicketIdentifierEq = params.acceptedOffers?.itemOffered?.reservedTicket?.identifier?.$eq;
|
|
275
|
+
// if (typeof itemOfferedReservedTicketIdentifierEq === 'string') {
|
|
276
|
+
// andConditions.push({
|
|
277
|
+
// 'acceptedOffers.itemOffered.reservedTicket.identifier': {
|
|
278
|
+
// $exists: true,
|
|
279
|
+
// $eq: itemOfferedReservedTicketIdentifierEq
|
|
280
|
+
// }
|
|
281
|
+
// });
|
|
282
|
+
// }
|
|
403
283
|
/* istanbul ignore else */
|
|
404
284
|
if (params.acceptedOffers !== undefined) {
|
|
405
285
|
/* istanbul ignore else */
|
|
@@ -435,25 +315,6 @@ class OrderRepo {
|
|
|
435
315
|
});
|
|
436
316
|
}
|
|
437
317
|
/* istanbul ignore else */
|
|
438
|
-
if (typeof reservationForConditions.name === 'string' && reservationForConditions.name.length > 0) {
|
|
439
|
-
andConditions.push({
|
|
440
|
-
$or: [
|
|
441
|
-
{
|
|
442
|
-
'acceptedOffers.itemOffered.reservationFor.name.ja': {
|
|
443
|
-
$exists: true,
|
|
444
|
-
$regex: new RegExp(reservationForConditions.name)
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
'acceptedOffers.itemOffered.reservationFor.name.en': {
|
|
449
|
-
$exists: true,
|
|
450
|
-
$regex: new RegExp(reservationForConditions.name)
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
]
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
/* istanbul ignore else */
|
|
457
318
|
if (reservationForConditions.location !== undefined) {
|
|
458
319
|
if (Array.isArray(reservationForConditions.location.branchCodes)) {
|
|
459
320
|
if (reservationForConditions.location.branchCodes.length === 1) {
|
|
@@ -608,18 +469,6 @@ class OrderRepo {
|
|
|
608
469
|
}
|
|
609
470
|
});
|
|
610
471
|
}
|
|
611
|
-
/* istanbul ignore else */
|
|
612
|
-
if (params.orderDateFrom instanceof Date) {
|
|
613
|
-
andConditions.push({
|
|
614
|
-
orderDate: { $gte: params.orderDateFrom }
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
/* istanbul ignore else */
|
|
618
|
-
if (params.orderDateThrough instanceof Date) {
|
|
619
|
-
andConditions.push({
|
|
620
|
-
orderDate: { $lte: params.orderDateThrough }
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
472
|
if (params.orderDate !== undefined && params.orderDate !== null) {
|
|
624
473
|
if (params.orderDate.$gte instanceof Date) {
|
|
625
474
|
andConditions.push({
|
|
@@ -632,24 +481,6 @@ class OrderRepo {
|
|
|
632
481
|
});
|
|
633
482
|
}
|
|
634
483
|
}
|
|
635
|
-
if (params.price !== undefined && params.price !== null) {
|
|
636
|
-
if (typeof params.price.$gte === 'number') {
|
|
637
|
-
andConditions.push({
|
|
638
|
-
price: {
|
|
639
|
-
$exists: true,
|
|
640
|
-
$gte: params.price.$gte
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
if (typeof params.price.$lte === 'number') {
|
|
645
|
-
andConditions.push({
|
|
646
|
-
price: {
|
|
647
|
-
$exists: true,
|
|
648
|
-
$lte: params.price.$lte
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
484
|
return andConditions;
|
|
654
485
|
}
|
|
655
486
|
/**
|
|
@@ -1071,199 +902,5 @@ class OrderRepo {
|
|
|
1071
902
|
}
|
|
1072
903
|
return { aggregation: aggregations[0] };
|
|
1073
904
|
}
|
|
1074
|
-
async aggregateOrderOfSeat(params) {
|
|
1075
|
-
const seatNumber = params.acceptedOffers.itemOffered.reservedTicket.ticketedSeat.seatNumber;
|
|
1076
|
-
const screenCode = params.acceptedOffers.itemOffered.reservationFor.location.branchCode;
|
|
1077
|
-
const movieTheaterCode = params.acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode;
|
|
1078
|
-
const customerEmailIn = params.customer?.email?.$in;
|
|
1079
|
-
const matchConditions = {
|
|
1080
|
-
orderDate: {
|
|
1081
|
-
$gte: params.orderDate.$gte,
|
|
1082
|
-
$lte: params.orderDate.$lte
|
|
1083
|
-
},
|
|
1084
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1085
|
-
'project.id': { $eq: params.project.id.$eq },
|
|
1086
|
-
'acceptedOffers.itemOffered.reservationFor.superEvent.location.branchCode': { $exists: true, $eq: movieTheaterCode },
|
|
1087
|
-
'acceptedOffers.itemOffered.reservationFor.location.branchCode': { $exists: true, $eq: screenCode },
|
|
1088
|
-
'acceptedOffers.itemOffered.reservedTicket.ticketedSeat.seatNumber': { $exists: true, $eq: seatNumber },
|
|
1089
|
-
...(Array.isArray(customerEmailIn))
|
|
1090
|
-
? { 'customer.email': { $exists: true, $in: customerEmailIn } }
|
|
1091
|
-
: undefined
|
|
1092
|
-
};
|
|
1093
|
-
const aggregations4email = await this.orderModel.aggregate([
|
|
1094
|
-
{ $match: matchConditions },
|
|
1095
|
-
{
|
|
1096
|
-
$group: {
|
|
1097
|
-
_id: '$customer.email'
|
|
1098
|
-
}
|
|
1099
|
-
},
|
|
1100
|
-
{
|
|
1101
|
-
$count: 'emailCount'
|
|
1102
|
-
}
|
|
1103
|
-
])
|
|
1104
|
-
.exec();
|
|
1105
|
-
const emailCount = (aggregations4email.length > 0) ? aggregations4email[0].emailCount : 0;
|
|
1106
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1107
|
-
{ $match: matchConditions },
|
|
1108
|
-
{
|
|
1109
|
-
$project: {
|
|
1110
|
-
typeOf: '$typeOf',
|
|
1111
|
-
graceTime: {
|
|
1112
|
-
$subtract: [
|
|
1113
|
-
{ $first: '$acceptedOffers.itemOffered.reservationFor.startDate' },
|
|
1114
|
-
'$orderDate'
|
|
1115
|
-
]
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
{
|
|
1120
|
-
$group: {
|
|
1121
|
-
_id: '$typeOf',
|
|
1122
|
-
orderCount: { $sum: 1 },
|
|
1123
|
-
sumGraceTime: { $sum: '$graceTime' }
|
|
1124
|
-
}
|
|
1125
|
-
},
|
|
1126
|
-
{
|
|
1127
|
-
$project: {
|
|
1128
|
-
_id: 0,
|
|
1129
|
-
orderCount: '$orderCount',
|
|
1130
|
-
sumGraceTime: '$sumGraceTime'
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
])
|
|
1134
|
-
.exec();
|
|
1135
|
-
if (aggregations.length === 0) {
|
|
1136
|
-
return {
|
|
1137
|
-
aggregation: {
|
|
1138
|
-
orderCount: 0
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
return {
|
|
1143
|
-
aggregation: {
|
|
1144
|
-
...aggregations[0],
|
|
1145
|
-
emailCount
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
async aggregateOrderOfCustomerByProject(params) {
|
|
1150
|
-
const matchConditions = {
|
|
1151
|
-
orderDate: {
|
|
1152
|
-
$gte: params.orderDate.$gte,
|
|
1153
|
-
$lte: params.orderDate.$lte
|
|
1154
|
-
},
|
|
1155
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1156
|
-
...(typeof params.project?.id.$eq === 'string') ? { 'project.id': { $eq: params.project.id.$eq } } : undefined,
|
|
1157
|
-
'customer.email': { $exists: true, $eq: params.customer.email.$eq }
|
|
1158
|
-
};
|
|
1159
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1160
|
-
{ $match: matchConditions },
|
|
1161
|
-
{
|
|
1162
|
-
$project: {
|
|
1163
|
-
typeOf: '$typeOf',
|
|
1164
|
-
graceTime: {
|
|
1165
|
-
$subtract: [
|
|
1166
|
-
{ $first: '$acceptedOffers.itemOffered.reservationFor.startDate' },
|
|
1167
|
-
'$orderDate'
|
|
1168
|
-
]
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
},
|
|
1172
|
-
{
|
|
1173
|
-
$group: {
|
|
1174
|
-
_id: '$typeOf',
|
|
1175
|
-
orderCount: { $sum: 1 },
|
|
1176
|
-
sumGraceTime: { $sum: '$graceTime' }
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
$project: {
|
|
1181
|
-
_id: 0,
|
|
1182
|
-
orderCount: '$orderCount',
|
|
1183
|
-
sumGraceTime: '$sumGraceTime'
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
])
|
|
1187
|
-
.exec();
|
|
1188
|
-
if (aggregations.length === 0) {
|
|
1189
|
-
return {
|
|
1190
|
-
aggregation: {
|
|
1191
|
-
orderCount: 0
|
|
1192
|
-
}
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
return {
|
|
1196
|
-
aggregation: {
|
|
1197
|
-
...aggregations[0]
|
|
1198
|
-
}
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
async aggregateOrderOfCustomerGlobally(params) {
|
|
1202
|
-
const matchConditions = {
|
|
1203
|
-
orderDate: {
|
|
1204
|
-
$gte: params.orderDate.$gte,
|
|
1205
|
-
$lte: params.orderDate.$lte
|
|
1206
|
-
},
|
|
1207
|
-
typeOf: { $eq: factory_1.factory.order.OrderType.Order },
|
|
1208
|
-
'customer.email': { $exists: true, $eq: params.customer.email.$eq }
|
|
1209
|
-
};
|
|
1210
|
-
const aggregations = await this.orderModel.aggregate([
|
|
1211
|
-
{ $match: matchConditions },
|
|
1212
|
-
{
|
|
1213
|
-
$project: {
|
|
1214
|
-
typeOf: '$typeOf'
|
|
1215
|
-
}
|
|
1216
|
-
},
|
|
1217
|
-
{
|
|
1218
|
-
$group: {
|
|
1219
|
-
_id: '$typeOf',
|
|
1220
|
-
orderCount: { $sum: 1 }
|
|
1221
|
-
}
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
$project: {
|
|
1225
|
-
_id: 0,
|
|
1226
|
-
orderCount: '$orderCount'
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
])
|
|
1230
|
-
.exec();
|
|
1231
|
-
if (aggregations.length === 0) {
|
|
1232
|
-
return {
|
|
1233
|
-
aggregation: {
|
|
1234
|
-
orderCount: 0,
|
|
1235
|
-
aggregateProject: { projectCount: 0 }
|
|
1236
|
-
}
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
const aggregations2 = await this.orderModel.aggregate([
|
|
1240
|
-
{ $match: matchConditions },
|
|
1241
|
-
{
|
|
1242
|
-
$project: {
|
|
1243
|
-
project: '$project'
|
|
1244
|
-
}
|
|
1245
|
-
},
|
|
1246
|
-
{
|
|
1247
|
-
$group: {
|
|
1248
|
-
_id: '$project.id'
|
|
1249
|
-
}
|
|
1250
|
-
},
|
|
1251
|
-
{
|
|
1252
|
-
$count: 'projectCount'
|
|
1253
|
-
},
|
|
1254
|
-
{
|
|
1255
|
-
$project: {
|
|
1256
|
-
aggregateProject: { projectCount: '$projectCount' }
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
])
|
|
1260
|
-
.exec();
|
|
1261
|
-
return {
|
|
1262
|
-
aggregation: {
|
|
1263
|
-
...aggregations[0],
|
|
1264
|
-
...aggregations2[0]
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
905
|
}
|
|
1269
906
|
exports.OrderRepo = OrderRepo;
|
|
@@ -1,38 +1,88 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
|
+
import { AcceptedOfferInReserveRepo } from './acceptedOfferInReserve';
|
|
3
4
|
type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'project'> & {
|
|
4
5
|
typeOf: factory.transactionType.PlaceOrder;
|
|
5
6
|
orderDate: Date;
|
|
6
7
|
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
7
8
|
customer?: factory.order.ICustomer;
|
|
8
9
|
};
|
|
10
|
+
type IAcceptedOffer = factory.order.IAcceptedOffer & {
|
|
11
|
+
/**
|
|
12
|
+
* 受け入れ時に指定必須
|
|
13
|
+
*/
|
|
14
|
+
offeredThrough: factory.offer.IOfferedThrough;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* typeOf: Orderへドキュメント変換時の編集フィールド
|
|
18
|
+
*/
|
|
9
19
|
export type IPlacingOrder = Pick<factory.order.IOrder, 'broker' | 'confirmationNumber' | 'identifier' | 'isGift' | 'name' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf' | 'url'> & {
|
|
20
|
+
/**
|
|
21
|
+
* 上書きしてはいけない
|
|
22
|
+
*/
|
|
10
23
|
acceptedOffers?: never;
|
|
24
|
+
/**
|
|
25
|
+
* 上書きしてはいけない
|
|
26
|
+
*/
|
|
11
27
|
customer?: never;
|
|
12
28
|
};
|
|
29
|
+
export type IMinimizedReservationFor = Pick<factory.order.IEventAsReservationFor, 'endDate' | 'id' | 'startDate' | 'typeOf'> & {
|
|
30
|
+
location: Pick<factory.order.IEventAsReservationFor['location'], 'branchCode' | 'typeOf'>;
|
|
31
|
+
superEvent: Pick<factory.order.ISuperEvent, 'id' | 'typeOf'> & {
|
|
32
|
+
location: Pick<factory.order.ISuperEvent['location'], 'branchCode' | 'typeOf'>;
|
|
33
|
+
workPerformed: Pick<factory.order.ISuperEvent['workPerformed'], 'identifier' | 'typeOf'>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type IMinimizedItemOffered = Pick<factory.order.IEventReservation, 'id' | 'reservationNumber' | 'typeOf'> & {
|
|
37
|
+
/**
|
|
38
|
+
* そもそも注文ドキュメントから廃止なのでoptionalに
|
|
39
|
+
* 2026-06-03~
|
|
40
|
+
*/
|
|
41
|
+
reservedTicket?: Pick<factory.order.IReservedTicket, 'identifier' | 'ticketedSeat' | 'typeOf'>;
|
|
42
|
+
/**
|
|
43
|
+
* 予約番号ごとに、ひとつめのオファーのみreservationForを含むように変更するのでoptionalに
|
|
44
|
+
* 2026-06-04~
|
|
45
|
+
*/
|
|
46
|
+
reservationFor?: IMinimizedReservationFor;
|
|
47
|
+
};
|
|
48
|
+
export type IMinimizedAcceptedOffer = Pick<factory.order.IOptimizedAcceptedOffer, 'id' | 'name' | 'offeredThrough' | 'priceSpecification' | 'serialNumber' | 'typeOf'> & {
|
|
49
|
+
itemOffered: IMinimizedItemOffered;
|
|
50
|
+
};
|
|
13
51
|
/**
|
|
14
52
|
* 取引中注文リポジトリ
|
|
15
53
|
*/
|
|
16
|
-
export declare class OrderInTransactionRepo {
|
|
54
|
+
export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
17
55
|
private readonly orderModel;
|
|
18
56
|
constructor(connection: Connection);
|
|
19
57
|
/**
|
|
20
58
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
59
|
+
* 予約取引から予約ごとの価格仕様も参照する
|
|
21
60
|
*/
|
|
22
|
-
|
|
23
|
-
orderNumber:
|
|
24
|
-
|
|
61
|
+
findAcceptedOffersWithPriceByOrderNumber(params: {
|
|
62
|
+
orderNumber: string;
|
|
63
|
+
project: {
|
|
64
|
+
id: string;
|
|
25
65
|
};
|
|
26
|
-
}): Promise<factory.order.IAcceptedOffer
|
|
66
|
+
}): Promise<(Omit<factory.order.IAcceptedOffer, 'priceSpecification'> & {
|
|
67
|
+
priceSpecification?: factory.order.ITicketPriceSpecification;
|
|
68
|
+
})[]>;
|
|
27
69
|
/**
|
|
28
70
|
* 注文を受注する
|
|
71
|
+
* typeOf: PlaceOrder -> typeOf: Order
|
|
29
72
|
*/
|
|
30
73
|
placeOrder(order: IPlacingOrder): Promise<void>;
|
|
31
74
|
/**
|
|
32
75
|
* 注文documentがなければ作成し、受け入れられたオファーを追加する
|
|
33
76
|
* このメソッドでdocumentが初めて生成される(typeOf:PlaceOrderとして)
|
|
34
77
|
*/
|
|
35
|
-
acceptOffer(params: Pick<IOrderInTransaction, '
|
|
78
|
+
acceptOffer(params: Pick<IOrderInTransaction, 'orderNumber' | 'project'> & {
|
|
79
|
+
acceptedOffers: IMinimizedAcceptedOffer[] | (Omit<IAcceptedOffer, 'priceSpecification'> & {
|
|
80
|
+
/**
|
|
81
|
+
* COA以外では注文ドキュメントにpriceSpecificationが存在しないのでIFを補完
|
|
82
|
+
*/
|
|
83
|
+
priceSpecification?: factory.order.ITicketPriceSpecification;
|
|
84
|
+
})[];
|
|
85
|
+
}): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
36
86
|
/**
|
|
37
87
|
* serialNumberからオファーを除外する
|
|
38
88
|
* ホワイトリストとブラックリスト両方に対応
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderInTransactionRepo = void 0;
|
|
4
|
+
// import { isDeepStrictEqual } from 'util';
|
|
4
5
|
const factory_1 = require("../factory");
|
|
5
6
|
const order_1 = require("./mongoose/schemas/order");
|
|
7
|
+
const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
|
|
8
|
+
// const debug = createDebug('chevre-domain:repo:orderInTransaction');
|
|
6
9
|
/**
|
|
7
10
|
* 取引中注文リポジトリ
|
|
8
11
|
*/
|
|
9
|
-
class OrderInTransactionRepo {
|
|
12
|
+
class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveRepo {
|
|
10
13
|
orderModel;
|
|
11
14
|
constructor(connection) {
|
|
15
|
+
super(connection);
|
|
12
16
|
this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
15
19
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
20
|
+
* 予約取引から予約ごとの価格仕様も参照する
|
|
16
21
|
*/
|
|
17
|
-
async
|
|
22
|
+
async findAcceptedOffersWithPriceByOrderNumber(params) {
|
|
18
23
|
const doc = await this.orderModel.findOne({
|
|
19
|
-
orderNumber: { $eq: params.orderNumber
|
|
24
|
+
orderNumber: { $eq: params.orderNumber },
|
|
20
25
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
|
|
21
26
|
}, { acceptedOffers: 1 })
|
|
22
27
|
.lean()
|
|
@@ -24,10 +29,59 @@ class OrderInTransactionRepo {
|
|
|
24
29
|
if (doc === null) {
|
|
25
30
|
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
26
31
|
}
|
|
27
|
-
|
|
32
|
+
const isCOA = doc.acceptedOffers.at(0)?.offeredThrough?.identifier === factory_1.factory.service.webAPI.Identifier.COA;
|
|
33
|
+
// COAの場合、予約取引は存在しないのでそのまま返す
|
|
34
|
+
if (isCOA) {
|
|
35
|
+
return doc.acceptedOffers;
|
|
36
|
+
}
|
|
37
|
+
// priceSpecificationを予約取引から補完する(2026-05-12~)
|
|
38
|
+
let acceptedOffersByReserveTransaction = [];
|
|
39
|
+
const reservationNumbers = [...new Set(doc.acceptedOffers.map((aceptedOffer) => aceptedOffer.itemOffered.reservationNumber))];
|
|
40
|
+
if (reservationNumbers.length > 0) {
|
|
41
|
+
acceptedOffersByReserveTransaction = await this.findAcceptedOffersByReservationNumbers({ reservationNumbers });
|
|
42
|
+
}
|
|
43
|
+
return doc.acceptedOffers.map((acceptedOffer) => {
|
|
44
|
+
const acceptedOfferByReserve = acceptedOffersByReserveTransaction.find((acceptedOfferByReserveTransaction) => acceptedOfferByReserveTransaction.itemOffered.id === acceptedOffer.itemOffered.id);
|
|
45
|
+
const priceSpecification = acceptedOfferByReserve?.priceSpecification;
|
|
46
|
+
// COA予約でなければ、予約取引の価格は必ず存在するはず(2026-05-20~)
|
|
47
|
+
if (priceSpecification === undefined) {
|
|
48
|
+
throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: priceSpecification undefined. ${acceptedOffer.itemOffered.id}`);
|
|
49
|
+
}
|
|
50
|
+
const itemOffered = acceptedOfferByReserve?.itemOffered;
|
|
51
|
+
// COA予約でなければ、予約取引のitemOfferedは必ず存在するはず(2026-05-25~)
|
|
52
|
+
if (itemOffered === undefined) {
|
|
53
|
+
throw new factory_1.factory.errors.Internal(`findAcceptedOffersWithPriceByOrderNumber: itemOffered undefined. ${acceptedOffer.itemOffered.id}`);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
...acceptedOffer,
|
|
57
|
+
itemOffered,
|
|
58
|
+
priceSpecification
|
|
59
|
+
};
|
|
60
|
+
});
|
|
28
61
|
}
|
|
62
|
+
// /**
|
|
63
|
+
// * 取引進行中の注文からacceptedOffersを検索する
|
|
64
|
+
// */
|
|
65
|
+
// public async findAcceptedOffersByOrderNumber(
|
|
66
|
+
// params: { orderNumber: { $eq: string } }
|
|
67
|
+
// ): Promise<Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'serialNumber'>[]> {
|
|
68
|
+
// const doc = await this.orderModel.findOne<HydratedDocument<Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'serialNumber'>>>(
|
|
69
|
+
// {
|
|
70
|
+
// orderNumber: { $eq: params.orderNumber.$eq },
|
|
71
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder }
|
|
72
|
+
// },
|
|
73
|
+
// { acceptedOffers: 1 }
|
|
74
|
+
// )
|
|
75
|
+
// .lean<Pick<IOrderInTransaction, 'acceptedOffers'>>()
|
|
76
|
+
// .exec();
|
|
77
|
+
// if (doc === null) {
|
|
78
|
+
// throw new factory.errors.NotFound('orderInTransaction');
|
|
79
|
+
// }
|
|
80
|
+
// return doc.acceptedOffers;
|
|
81
|
+
// }
|
|
29
82
|
/**
|
|
30
83
|
* 注文を受注する
|
|
84
|
+
* typeOf: PlaceOrder -> typeOf: Order
|
|
31
85
|
*/
|
|
32
86
|
async placeOrder(order) {
|
|
33
87
|
if (!(order.orderDate instanceof Date)) {
|
|
@@ -67,7 +67,8 @@ class HasPOSRepo {
|
|
|
67
67
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.placeType.MovieTheater);
|
|
68
68
|
}
|
|
69
69
|
const creatingPOS = {
|
|
70
|
-
|
|
70
|
+
// 互換性維持対応としてidを保管
|
|
71
|
+
id: params.branchCode, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
71
72
|
branchCode: params.branchCode,
|
|
72
73
|
name: params.name
|
|
73
74
|
};
|