@chevre/domain 25.2.0-alpha.5 → 25.2.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/eventEmitter/task.d.ts +2 -1
- package/lib/chevre/factory/customerTelephone2COATelNum.d.ts +3 -0
- package/lib/chevre/factory/customerTelephone2COATelNum.js +22 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +15 -0
- package/lib/chevre/repo/action/acceptPay.js +47 -19
- package/lib/chevre/repo/action/actionProcess.js +57 -57
- package/lib/chevre/repo/action.d.ts +16 -9
- package/lib/chevre/repo/action.js +99 -180
- package/lib/chevre/repo/aggregateOffer.d.ts +3 -14
- package/lib/chevre/repo/aggregateOffer.js +16 -125
- package/lib/chevre/repo/asyncAction.d.ts +64 -0
- package/lib/chevre/repo/asyncAction.js +178 -0
- package/lib/chevre/repo/concurrentLock.d.ts +3 -1
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- package/lib/chevre/repo/credentials.d.ts +2 -1
- package/lib/chevre/repo/customerType.d.ts +2 -3
- package/lib/chevre/repo/event.d.ts +10 -11
- package/lib/chevre/repo/eventOffer.d.ts +4 -5
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +2 -3
- package/lib/chevre/repo/eventSeries.d.ts +4 -5
- package/lib/chevre/repo/message.d.ts +1 -1
- package/lib/chevre/repo/message.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +67 -66
- package/lib/chevre/repo/mongoose/schemas/asyncAction.d.ts +11 -0
- package/lib/chevre/repo/mongoose/schemas/asyncAction.js +89 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
- package/lib/chevre/repo/note.d.ts +3 -4
- package/lib/chevre/repo/noteAboutOrder.d.ts +2 -3
- package/lib/chevre/repo/offer/offerInCatalogReadOnly.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +2 -2
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +59 -11
- package/lib/chevre/repo/offerCatalog.d.ts +2 -3
- package/lib/chevre/repo/offerCatalogItem.d.ts +2 -3
- package/lib/chevre/repo/order.d.ts +2 -0
- package/lib/chevre/repo/order.js +14 -14
- package/lib/chevre/repo/orderInTransaction.d.ts +68 -1
- package/lib/chevre/repo/orderInTransaction.js +181 -3
- package/lib/chevre/repo/passport.d.ts +2 -1
- package/lib/chevre/repo/person.d.ts +0 -15
- package/lib/chevre/repo/person.js +122 -108
- package/lib/chevre/repo/place/entranceGate.d.ts +4 -5
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -4
- package/lib/chevre/repo/place/screeningRoom.d.ts +4 -5
- package/lib/chevre/repo/place/seat.d.ts +4 -5
- package/lib/chevre/repo/place/section.d.ts +3 -4
- package/lib/chevre/repo/priceSpecification.d.ts +4 -4
- package/lib/chevre/repo/product.d.ts +3 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -1
- package/lib/chevre/repo/rateLimit/offer.js +0 -12
- package/lib/chevre/repo/reservation.d.ts +2 -3
- package/lib/chevre/repo/sellerMakesOffer.d.ts +3 -4
- package/lib/chevre/repo/stockHolder.d.ts +1 -1
- package/lib/chevre/repo/stockHolder.js +0 -146
- package/lib/chevre/repo/transaction/placeOrder.d.ts +2 -45
- package/lib/chevre/repo/transaction/placeOrder.js +43 -83
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/repo/transactionNumberCounter.js +0 -34
- package/lib/chevre/repo/transactionProcess.d.ts +2 -1
- package/lib/chevre/repo/transactionProcess.js +0 -13
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/asyncAction.d.ts +16 -0
- package/lib/chevre/service/asyncAction.js +36 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.d.ts +15 -0
- package/lib/chevre/service/asyncActionHandler/onOperationFailed.js +42 -0
- package/lib/chevre/service/asyncActionHandler.d.ts +13 -0
- package/lib/chevre/service/asyncActionHandler.js +89 -0
- package/lib/chevre/service/notification/factory.d.ts +2 -4
- package/lib/chevre/service/notification/factory.js +26 -24
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.d.ts +11 -5
- package/lib/chevre/service/notification/notifyAbortedTasksByEmail.js +11 -3
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +93 -75
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +10 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +15 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +0 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +4 -0
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +22 -9
- package/lib/chevre/service/order/deleteOrder.d.ts +5 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +19 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +1 -7
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +5 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +95 -33
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +2 -6
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +13 -58
- package/lib/chevre/service/order/placeOrder/factory.js +3 -21
- package/lib/chevre/service/order/placeOrder.d.ts +4 -5
- package/lib/chevre/service/order/placeOrder.js +20 -31
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +1 -2
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
- package/lib/chevre/service/payment/any/authorize.js +13 -37
- package/lib/chevre/service/payment/any/factory.d.ts +7 -7
- package/lib/chevre/service/payment/any/factory.js +19 -22
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +3 -1
- package/lib/chevre/service/payment/any/findAcceptAction.js +14 -6
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +4 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +4 -18
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
- package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
- package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +17 -8
- package/lib/chevre/service/reserve/searchByOrder.js +2 -6
- package/lib/chevre/service/reserve.d.ts +2 -2
- package/lib/chevre/service/reserve.js +3 -3
- package/lib/chevre/service/task/aggregateOffers.d.ts +2 -2
- package/lib/chevre/service/task/aggregateOffers.js +2 -1
- package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/cancelReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -7
- package/lib/chevre/service/task/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -3
- package/lib/chevre/service/task/onEventChanged.d.ts +2 -2
- package/lib/chevre/service/task/onEventChanged.js +2 -1
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +4 -1
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated.js +2 -1
- package/lib/chevre/service/task/placeOrder.d.ts +2 -2
- package/lib/chevre/service/task/placeOrder.js +6 -3
- package/lib/chevre/service/task/publishPaymentUrl.js +7 -3
- package/lib/chevre/service/task/refund.d.ts +2 -2
- package/lib/chevre/service/task/refund.js +4 -10
- package/lib/chevre/service/task/reserve.d.ts +2 -2
- package/lib/chevre/service/task/reserve.js +2 -1
- package/lib/chevre/service/task/returnOrder.d.ts +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -1
- package/lib/chevre/service/task/sendOrder.d.ts +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -1
- package/lib/chevre/service/task/voidPayTransaction.js +3 -7
- package/lib/chevre/service/task/voidPayment.d.ts +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.js +1 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +36 -37
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.d.ts +15 -0
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +51 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.d.ts +23 -0
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +64 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +35 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +15 -11
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +11 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +53 -32
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +33 -78
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -86
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service.d.ts +4 -0
- package/lib/chevre/service.js +12 -1
- package/lib/chevre/taskSettings.d.ts +1 -3
- package/package.json +8 -11
- package/lib/chevre/service/order/findConfirmedPlaceOrder.d.ts +0 -13
- package/lib/chevre/service/order/findConfirmedPlaceOrder.js +0 -32
- package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
- package/lib/chevre/service/reserve/findReservations.js +0 -61
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Connection, FilterQuery } from 'mongoose';
|
|
1
|
+
import { Connection, FilterQuery, mongo } from 'mongoose';
|
|
3
2
|
import { factory } from '../factory';
|
|
4
3
|
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty' | 'relatedOffer'> & {
|
|
5
4
|
numberOfItems?: number;
|
|
@@ -42,7 +41,7 @@ export declare class OfferCatalogItemRepo {
|
|
|
42
41
|
*/
|
|
43
42
|
productType: factory.product.ProductType;
|
|
44
43
|
}): Promise<{
|
|
45
|
-
bulkWriteResult?: BulkWriteResult;
|
|
44
|
+
bulkWriteResult?: mongo.BulkWriteResult;
|
|
46
45
|
modifiedCatalogs?: {
|
|
47
46
|
id: string;
|
|
48
47
|
}[];
|
|
@@ -135,6 +135,7 @@ export declare class OrderRepo {
|
|
|
135
135
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
|
|
136
136
|
acceptedOffers?: factory.order.IAcceptedOffer[];
|
|
137
137
|
identifier?: string;
|
|
138
|
+
paymentMethodId?: string;
|
|
138
139
|
} & {
|
|
139
140
|
_id: import("mongoose").Types.ObjectId;
|
|
140
141
|
} & {
|
|
@@ -142,6 +143,7 @@ export declare class OrderRepo {
|
|
|
142
143
|
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
|
|
143
144
|
acceptedOffers?: factory.order.IAcceptedOffer[];
|
|
144
145
|
identifier?: string;
|
|
146
|
+
paymentMethodId?: string;
|
|
145
147
|
} & {
|
|
146
148
|
_id: import("mongoose").Types.ObjectId;
|
|
147
149
|
} & {
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -848,24 +848,24 @@ class OrderRepo {
|
|
|
848
848
|
})
|
|
849
849
|
.exec();
|
|
850
850
|
}
|
|
851
|
-
// public async
|
|
852
|
-
//
|
|
853
|
-
//
|
|
854
|
-
// identifier: string;
|
|
851
|
+
// public async savePaymentMethodId4migaration(params: {
|
|
852
|
+
// id: string;
|
|
853
|
+
// paymentMethod: IPaymentMethodByPaymentUrl;
|
|
855
854
|
// }) {
|
|
856
|
-
// const {
|
|
857
|
-
//
|
|
855
|
+
// const { paymentMethodId } = params.paymentMethod;
|
|
856
|
+
// if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
857
|
+
// throw new factory.errors.ArgumentNull('paymentMethod.paymentMethodId');
|
|
858
|
+
// }
|
|
859
|
+
// // 注文ドキュメントにも保管する(2026-07-12~)
|
|
860
|
+
// return this.orderModel.findOneAndUpdate(
|
|
858
861
|
// {
|
|
859
|
-
//
|
|
860
|
-
//
|
|
861
|
-
// typeOf: { $eq: factory.order.OrderType.Order }
|
|
862
|
+
// identifier: { $eq: params.id },
|
|
863
|
+
// paymentMethodId: { $exists: false }
|
|
862
864
|
// },
|
|
863
|
-
// {
|
|
864
|
-
//
|
|
865
|
-
// ...(typeof identifier === 'string') ? { identifier } : undefined
|
|
866
|
-
// }
|
|
867
|
-
// }
|
|
865
|
+
// { $set: { paymentMethodId } },
|
|
866
|
+
// { projection: { _id: 1 } }
|
|
868
867
|
// )
|
|
868
|
+
// .lean()
|
|
869
869
|
// .exec();
|
|
870
870
|
// }
|
|
871
871
|
async aggregateOrder(params) {
|
|
@@ -11,14 +11,25 @@ export type IOrderInTransaction = Pick<factory.order.IOrder, 'orderNumber' | 'pr
|
|
|
11
11
|
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
12
12
|
customer?: factory.order.ICustomer;
|
|
13
13
|
seller?: factory.order.ISeller;
|
|
14
|
+
confirmationNumber?: string;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* typeOf: Orderへドキュメント変換時の編集フィールド
|
|
17
18
|
*/
|
|
18
|
-
export type IPlacingOrder = Pick<factory.order.IOrder, '
|
|
19
|
+
export type IPlacingOrder = Pick<factory.order.IOrder, 'orderDate' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'typeOf'> & {
|
|
19
20
|
url?: never;
|
|
20
21
|
identifier?: never;
|
|
21
22
|
name?: never;
|
|
23
|
+
/**
|
|
24
|
+
* 上書きしてはいけない
|
|
25
|
+
* 注文取引進行中にセット済であり上書きしてはいけない
|
|
26
|
+
*/
|
|
27
|
+
orderNumber?: never;
|
|
28
|
+
/**
|
|
29
|
+
* 上書きしてはいけない
|
|
30
|
+
* 注文取引進行中にセット済であり上書きしてはいけない
|
|
31
|
+
*/
|
|
32
|
+
confirmationNumber?: never;
|
|
22
33
|
/**
|
|
23
34
|
* 上書きしてはいけない
|
|
24
35
|
*/
|
|
@@ -56,11 +67,19 @@ export type IMinimizedAcceptedOffer = Pick<factory.order.IOptimizedAcceptedOffer
|
|
|
56
67
|
priceSpecification?: never;
|
|
57
68
|
name?: never;
|
|
58
69
|
};
|
|
70
|
+
export interface IPaymentMethodByPaymentUrl {
|
|
71
|
+
/**
|
|
72
|
+
* 決済採用時に発行済の決済方法ID
|
|
73
|
+
* 決済承認時に指定が可能
|
|
74
|
+
*/
|
|
75
|
+
paymentMethodId: string;
|
|
76
|
+
}
|
|
59
77
|
/**
|
|
60
78
|
* 取引中注文リポジトリ
|
|
61
79
|
*/
|
|
62
80
|
export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
63
81
|
private readonly orderModel;
|
|
82
|
+
private readonly transactionModel;
|
|
64
83
|
constructor(connection: Connection);
|
|
65
84
|
createPlaceOrderIfNotExists(params: Pick<IOrderInTransaction, 'orderNumber' | 'project' | 'identifier' | 'broker' | 'seller' | 'customer'>): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
|
|
66
85
|
/**
|
|
@@ -94,6 +113,11 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
94
113
|
project: {
|
|
95
114
|
id: string;
|
|
96
115
|
};
|
|
116
|
+
}, options: {
|
|
117
|
+
/**
|
|
118
|
+
* 注文取引タイプのドキュメントのみを参照対象にするかどうか
|
|
119
|
+
*/
|
|
120
|
+
onlyPlaceOrder: boolean;
|
|
97
121
|
}): Promise<(Pick<factory.order.IAcceptedOffer, 'id' | 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'typeOf'> & {
|
|
98
122
|
priceSpecification?: factory.order.ITicketPriceSpecification;
|
|
99
123
|
})[]>;
|
|
@@ -127,6 +151,49 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
127
151
|
setCustomerByIdentifier(params: Pick<IOrderInTransaction, 'project' | 'identifier'> & {
|
|
128
152
|
customer: factory.order.ICustomer;
|
|
129
153
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
154
|
+
/**
|
|
155
|
+
* 確認番号を参照する
|
|
156
|
+
*/
|
|
157
|
+
findConfirmationNumberByIdentifier(params: {
|
|
158
|
+
identifier: string;
|
|
159
|
+
}): Promise<string | undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* 注文ドキュメントに確認番号を保管する
|
|
162
|
+
* 確認番号未発行の場合のみ保管される
|
|
163
|
+
*/
|
|
164
|
+
saveConfirmationNumberIfNotExist(params: {
|
|
165
|
+
identifier: string;
|
|
166
|
+
confirmationNumber: string;
|
|
167
|
+
}, options: {
|
|
168
|
+
/**
|
|
169
|
+
* 注文取引タイプのドキュメントのみを参照対象にするかどうか
|
|
170
|
+
*/
|
|
171
|
+
onlyPlaceOrder: boolean;
|
|
172
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
173
|
+
/**
|
|
174
|
+
* 特定の進行中取引の決済方法IDを保管する
|
|
175
|
+
* transactionsへの保管としてひとまず定義(2026-07-11~)
|
|
176
|
+
*/
|
|
177
|
+
savePaymentMethodId(params: {
|
|
178
|
+
id: string;
|
|
179
|
+
paymentMethod: IPaymentMethodByPaymentUrl;
|
|
180
|
+
}, options: {
|
|
181
|
+
savePaymentMethodIdInTransaction: boolean;
|
|
182
|
+
}): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* 進行中取引に保管された採用済決済方法を検索する
|
|
185
|
+
* 注文ドキュメントから参照する(2026-07-13~)
|
|
186
|
+
*/
|
|
187
|
+
findInProgressPaymentMethodId(params: {
|
|
188
|
+
id: string;
|
|
189
|
+
}): Promise<string | undefined>;
|
|
190
|
+
/**
|
|
191
|
+
* 保管された採用済決済方法を検索する
|
|
192
|
+
* 注文ドキュメントから参照する(2026-07-13~)
|
|
193
|
+
*/
|
|
194
|
+
findPaymentMethodId(params: {
|
|
195
|
+
id: string;
|
|
196
|
+
}): Promise<string | undefined>;
|
|
130
197
|
deleteByIdentifier(params: {
|
|
131
198
|
identifier: string;
|
|
132
199
|
}): Promise<import("mongodb").DeleteResult>;
|
|
@@ -5,6 +5,7 @@ exports.OrderInTransactionRepo = void 0;
|
|
|
5
5
|
const errorHandler_1 = require("../errorHandler");
|
|
6
6
|
const factory_1 = require("../factory");
|
|
7
7
|
const order_1 = require("./mongoose/schemas/order");
|
|
8
|
+
const transaction_1 = require("./mongoose/schemas/transaction");
|
|
8
9
|
const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
|
|
9
10
|
// const debug = createDebug('chevre-domain:repo:orderInTransaction');
|
|
10
11
|
/**
|
|
@@ -12,9 +13,11 @@ const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
|
|
|
12
13
|
*/
|
|
13
14
|
class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveRepo {
|
|
14
15
|
orderModel;
|
|
16
|
+
transactionModel;
|
|
15
17
|
constructor(connection) {
|
|
16
18
|
super(connection);
|
|
17
19
|
this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
|
|
20
|
+
this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
|
|
18
21
|
}
|
|
19
22
|
async createPlaceOrderIfNotExists(params) {
|
|
20
23
|
const { orderNumber, project, identifier, broker, seller, customer } = params;
|
|
@@ -93,10 +96,12 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
93
96
|
* 取引進行中の注文からacceptedOffersを検索する
|
|
94
97
|
* 予約取引から予約ごとの価格仕様も参照する
|
|
95
98
|
*/
|
|
96
|
-
async findAcceptedOffersWithPriceByIdentifier(params) {
|
|
99
|
+
async findAcceptedOffersWithPriceByIdentifier(params, options) {
|
|
100
|
+
const onlyPlaceOrder = options.onlyPlaceOrder === true;
|
|
97
101
|
const doc = await this.orderModel.findOne({
|
|
98
102
|
identifier: { $eq: params.identifier },
|
|
99
|
-
|
|
103
|
+
'project.id': { $eq: params.project.id },
|
|
104
|
+
...((onlyPlaceOrder) && { typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder } })
|
|
100
105
|
}, { acceptedOffers: 1 })
|
|
101
106
|
.lean()
|
|
102
107
|
.exec();
|
|
@@ -142,7 +147,8 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
142
147
|
if (!(order.orderDate instanceof Date)) {
|
|
143
148
|
throw new factory_1.factory.errors.Argument('orderDate', 'must be Date');
|
|
144
149
|
}
|
|
145
|
-
const setFields = order;
|
|
150
|
+
const { confirmationNumber: _confirmationNumber, orderNumber: _orderNumber, ...setFields } = order;
|
|
151
|
+
// const setFields: AnyKeys<factory.order.IOrder> = order;
|
|
146
152
|
// typeOf:PlaceOrderのドキュメントが存在すれば、typeOf:Orderに変更する
|
|
147
153
|
await this.orderModel.updateOne({
|
|
148
154
|
identifier: { $eq: identifier },
|
|
@@ -241,6 +247,178 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
|
|
|
241
247
|
}
|
|
242
248
|
return result;
|
|
243
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* 確認番号を参照する
|
|
252
|
+
*/
|
|
253
|
+
async findConfirmationNumberByIdentifier(params) {
|
|
254
|
+
const { identifier } = params;
|
|
255
|
+
const doc = await this.orderModel.findOne({
|
|
256
|
+
identifier: { $eq: identifier },
|
|
257
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder }, // 取引確定の冪等性確保のためtypeOfを検証しない
|
|
258
|
+
}, { confirmationNumber: 1 })
|
|
259
|
+
.lean()
|
|
260
|
+
.exec();
|
|
261
|
+
if (doc === null) {
|
|
262
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
263
|
+
}
|
|
264
|
+
return doc.confirmationNumber;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* 注文ドキュメントに確認番号を保管する
|
|
268
|
+
* 確認番号未発行の場合のみ保管される
|
|
269
|
+
*/
|
|
270
|
+
async saveConfirmationNumberIfNotExist(params, options) {
|
|
271
|
+
const { identifier, confirmationNumber } = params;
|
|
272
|
+
const onlyPlaceOrder = options.onlyPlaceOrder === true;
|
|
273
|
+
if (typeof confirmationNumber !== 'string' || confirmationNumber === '') {
|
|
274
|
+
throw new factory_1.factory.errors.ArgumentNull('confirmationNumber');
|
|
275
|
+
}
|
|
276
|
+
return this.orderModel.updateOne({
|
|
277
|
+
identifier: { $eq: identifier },
|
|
278
|
+
confirmationNumber: { $exists: false },
|
|
279
|
+
...((onlyPlaceOrder) && { typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder } })
|
|
280
|
+
}, { $set: { confirmationNumber } })
|
|
281
|
+
.exec();
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* 特定の進行中取引の決済方法IDを保管する
|
|
285
|
+
* transactionsへの保管としてひとまず定義(2026-07-11~)
|
|
286
|
+
*/
|
|
287
|
+
async savePaymentMethodId(params, options) {
|
|
288
|
+
const { savePaymentMethodIdInTransaction } = options;
|
|
289
|
+
const { paymentMethodId } = params.paymentMethod;
|
|
290
|
+
if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
291
|
+
throw new factory_1.factory.errors.ArgumentNull('paymentMethod.paymentMethodId');
|
|
292
|
+
}
|
|
293
|
+
if (savePaymentMethodIdInTransaction) {
|
|
294
|
+
await this.transactionModel.findOneAndUpdate({
|
|
295
|
+
_id: { $eq: params.id },
|
|
296
|
+
status: { $eq: factory_1.factory.transactionStatusType.InProgress }
|
|
297
|
+
}, {
|
|
298
|
+
$set: { 'object.paymentMethods': { paymentMethodId } }
|
|
299
|
+
}, {
|
|
300
|
+
projection: { _id: 1 }
|
|
301
|
+
})
|
|
302
|
+
.lean()
|
|
303
|
+
.exec()
|
|
304
|
+
.then((doc) => {
|
|
305
|
+
if (doc === null) {
|
|
306
|
+
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
// 注文ドキュメントにも保管する(2026-07-12~)
|
|
311
|
+
await this.orderModel.findOneAndUpdate({
|
|
312
|
+
identifier: { $eq: params.id },
|
|
313
|
+
paymentMethodId: { $exists: false },
|
|
314
|
+
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
|
|
315
|
+
}, { $set: { paymentMethodId } }, { projection: { _id: 1 } })
|
|
316
|
+
.lean()
|
|
317
|
+
.exec()
|
|
318
|
+
.then((doc) => {
|
|
319
|
+
if (doc === null) {
|
|
320
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* 進行中取引に保管された採用済決済方法を検索する
|
|
326
|
+
* 注文ドキュメントから参照する(2026-07-13~)
|
|
327
|
+
*/
|
|
328
|
+
async findInProgressPaymentMethodId(params) {
|
|
329
|
+
// const doc = await this.transactionModel.findOne(
|
|
330
|
+
// {
|
|
331
|
+
// _id: { $eq: params.id },
|
|
332
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
333
|
+
// status: { $eq: factory.transactionStatusType.InProgress }
|
|
334
|
+
// },
|
|
335
|
+
// {
|
|
336
|
+
// 'object.paymentMethods': 1,
|
|
337
|
+
// _id: 0
|
|
338
|
+
// }
|
|
339
|
+
// )
|
|
340
|
+
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'paymentMethods'> }>()
|
|
341
|
+
// .exec();
|
|
342
|
+
// if (doc === null) {
|
|
343
|
+
// throw new factory.errors.NotFound(
|
|
344
|
+
// this.transactionModel.modelName,
|
|
345
|
+
// `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
|
|
346
|
+
// );
|
|
347
|
+
// }
|
|
348
|
+
// return (typeof doc.object.paymentMethods?.paymentMethodId === 'string') ? doc.object.paymentMethods.paymentMethodId : undefined;
|
|
349
|
+
const doc = await this.orderModel.findOne({
|
|
350
|
+
identifier: { $eq: params.id },
|
|
351
|
+
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
|
|
352
|
+
}, {
|
|
353
|
+
paymentMethodId: 1,
|
|
354
|
+
_id: 0
|
|
355
|
+
})
|
|
356
|
+
.lean()
|
|
357
|
+
.exec();
|
|
358
|
+
if (doc === null) {
|
|
359
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
360
|
+
}
|
|
361
|
+
return (typeof doc.paymentMethodId === 'string') ? doc.paymentMethodId : undefined;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* 保管された採用済決済方法を検索する
|
|
365
|
+
* 注文ドキュメントから参照する(2026-07-13~)
|
|
366
|
+
*/
|
|
367
|
+
async findPaymentMethodId(params) {
|
|
368
|
+
// const doc = await this.transactionModel.findOne(
|
|
369
|
+
// {
|
|
370
|
+
// _id: { $eq: params.id },
|
|
371
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder }
|
|
372
|
+
// },
|
|
373
|
+
// {
|
|
374
|
+
// 'object.paymentMethods': 1,
|
|
375
|
+
// _id: 0
|
|
376
|
+
// }
|
|
377
|
+
// )
|
|
378
|
+
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'paymentMethods'> }>()
|
|
379
|
+
// .exec();
|
|
380
|
+
// if (doc === null) {
|
|
381
|
+
// throw new factory.errors.NotFound(
|
|
382
|
+
// this.transactionModel.modelName,
|
|
383
|
+
// `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
|
|
384
|
+
// );
|
|
385
|
+
// }
|
|
386
|
+
// const paymentMethodId = doc.object.paymentMethods?.paymentMethodId;
|
|
387
|
+
// if (typeof paymentMethodId === 'string') {
|
|
388
|
+
// // 注文ドキュメントにも発行済の場合、同一性を検証(2026-07-12~)
|
|
389
|
+
// const orderDoc = await this.orderModel.findOne(
|
|
390
|
+
// { identifier: { $eq: params.id } },
|
|
391
|
+
// {
|
|
392
|
+
// paymentMethodId: 1,
|
|
393
|
+
// _id: 0
|
|
394
|
+
// }
|
|
395
|
+
// )
|
|
396
|
+
// .lean<Pick<IDocType, 'paymentMethodId'>>()
|
|
397
|
+
// .exec();
|
|
398
|
+
// if (orderDoc === null) {
|
|
399
|
+
// throw new factory.errors.NotFound('orderInTransaction');
|
|
400
|
+
// }
|
|
401
|
+
// const paymentMethodIdByOrder = orderDoc.paymentMethodId;
|
|
402
|
+
// if (typeof paymentMethodIdByOrder === 'string') {
|
|
403
|
+
// // console.log('paymentMethodId matched?', JSON.stringify(doc), JSON.stringify(orderDoc));
|
|
404
|
+
// if (paymentMethodId !== paymentMethodIdByOrder) {
|
|
405
|
+
// throw new factory.errors.Internal('paymentMethodId not matched unexpectedly');
|
|
406
|
+
// }
|
|
407
|
+
// }
|
|
408
|
+
// }
|
|
409
|
+
// return (typeof paymentMethodId === 'string') ? paymentMethodId : undefined;
|
|
410
|
+
const doc = await this.orderModel.findOne({ identifier: { $eq: params.id } }, {
|
|
411
|
+
paymentMethodId: 1,
|
|
412
|
+
_id: 0
|
|
413
|
+
})
|
|
414
|
+
.lean()
|
|
415
|
+
.exec();
|
|
416
|
+
if (doc === null) {
|
|
417
|
+
throw new factory_1.factory.errors.NotFound('orderInTransaction');
|
|
418
|
+
}
|
|
419
|
+
const paymentMethodId = doc.paymentMethodId;
|
|
420
|
+
return (typeof paymentMethodId === 'string') ? paymentMethodId : undefined;
|
|
421
|
+
}
|
|
244
422
|
async deleteByIdentifier(params) {
|
|
245
423
|
return this.orderModel.deleteOne({
|
|
246
424
|
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JwtPayload } from 'jsonwebtoken';
|
|
2
|
-
import type {
|
|
2
|
+
import type { createClient } from 'redis';
|
|
3
3
|
import { factory } from '../factory';
|
|
4
4
|
import { IPassportValidator } from '../factory/transaction';
|
|
5
5
|
export type IVerifiedPassport = factory.waiter.passport.IPassport & {
|
|
@@ -20,6 +20,7 @@ interface IOptions {
|
|
|
20
20
|
secret: string;
|
|
21
21
|
passportValidator?: IPassportValidator;
|
|
22
22
|
}
|
|
23
|
+
type RedisClientType = ReturnType<typeof createClient>;
|
|
23
24
|
/**
|
|
24
25
|
* 取引許可証リポジトリ
|
|
25
26
|
*/
|
|
@@ -21,20 +21,12 @@ export declare class PersonRepo {
|
|
|
21
21
|
userPoolId?: string;
|
|
22
22
|
attributes?: AttributeType[];
|
|
23
23
|
}): factory.person.IPerson;
|
|
24
|
-
static PROFILE2ATTRIBUTE(params: factory.person.IProfile): AttributeType[];
|
|
25
24
|
/**
|
|
26
25
|
* 管理者権限でユーザー属性を取得する
|
|
27
26
|
*/
|
|
28
27
|
getUserAttributes(params: {
|
|
29
28
|
username: string;
|
|
30
29
|
}): Promise<factory.person.IProfile>;
|
|
31
|
-
/**
|
|
32
|
-
* 管理者権限でプロフィール更新
|
|
33
|
-
*/
|
|
34
|
-
updateProfile(params: {
|
|
35
|
-
username: string;
|
|
36
|
-
profile: factory.person.IProfile;
|
|
37
|
-
}): Promise<void>;
|
|
38
30
|
/**
|
|
39
31
|
* 管理者権限でsubでユーザーを検索する
|
|
40
32
|
*/
|
|
@@ -45,13 +37,6 @@ export declare class PersonRepo {
|
|
|
45
37
|
* アクセストークンでユーザー属性を取得する
|
|
46
38
|
*/
|
|
47
39
|
getUserAttributesByAccessToken(accessToken: string): Promise<factory.person.IProfile>;
|
|
48
|
-
/**
|
|
49
|
-
* 会員プロフィール更新
|
|
50
|
-
*/
|
|
51
|
-
updateProfileByAccessToken(params: {
|
|
52
|
-
accessToken: string;
|
|
53
|
-
profile: factory.person.IProfile;
|
|
54
|
-
}): Promise<void>;
|
|
55
40
|
/**
|
|
56
41
|
* 削除
|
|
57
42
|
*/
|