@chevre/domain 25.2.0-alpha.4 → 25.2.0-alpha.41
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/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 +2 -3
- package/lib/chevre/repo/creativeWork.d.ts +2 -3
- 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/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/unitPriceInCatalog.d.ts +4 -0
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +40 -0
- 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/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/product.d.ts +3 -4
- 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.js +0 -13
- 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/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 +17 -14
- 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/changeOffers.js +1 -1
- 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.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 +17 -13
- 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 +112 -91
- 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/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
|
@@ -186,22 +186,6 @@ class PlaceOrderRepo {
|
|
|
186
186
|
.lean()
|
|
187
187
|
.exec();
|
|
188
188
|
}
|
|
189
|
-
/**
|
|
190
|
-
* 進行中取引に保管された採用済決済方法を検索する
|
|
191
|
-
*/
|
|
192
|
-
async findInProgressPaymentMethodId(params) {
|
|
193
|
-
const doc = await this.transactionModel.findOne({
|
|
194
|
-
_id: { $eq: params.id },
|
|
195
|
-
typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
|
|
196
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress }
|
|
197
|
-
}, { 'object.paymentMethods': 1 })
|
|
198
|
-
.lean() // 2024-08-26~
|
|
199
|
-
.exec();
|
|
200
|
-
if (doc === null) {
|
|
201
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
202
|
-
}
|
|
203
|
-
return doc.object.paymentMethods;
|
|
204
|
-
}
|
|
205
189
|
// /**
|
|
206
190
|
// * 取引の注文番号を検索する
|
|
207
191
|
// */
|
|
@@ -226,22 +210,31 @@ class PlaceOrderRepo {
|
|
|
226
210
|
// }
|
|
227
211
|
// return doc.object.orderNumber;
|
|
228
212
|
// }
|
|
229
|
-
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
async findInProgressConfirmationNumberById(params
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
213
|
+
// /**
|
|
214
|
+
// * 取引の確認番号を検索する
|
|
215
|
+
// */
|
|
216
|
+
// public async findInProgressConfirmationNumberById(params: {
|
|
217
|
+
// id: string;
|
|
218
|
+
// status: { $in: factory.transactionStatusType[] };
|
|
219
|
+
// }): Promise<string | undefined> {
|
|
220
|
+
// const doc = await this.transactionModel.findOne(
|
|
221
|
+
// {
|
|
222
|
+
// _id: { $eq: params.id },
|
|
223
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
224
|
+
// status: { $in: params.status.$in }
|
|
225
|
+
// },
|
|
226
|
+
// { 'object.confirmationNumber': 1 }
|
|
227
|
+
// )
|
|
228
|
+
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'confirmationNumber'> }>() // 2024-08-26~
|
|
229
|
+
// .exec();
|
|
230
|
+
// if (doc === null) {
|
|
231
|
+
// throw new factory.errors.NotFound(
|
|
232
|
+
// this.transactionModel.modelName,
|
|
233
|
+
// `${factory.transactionType.PlaceOrder} ${params.status.$in.join(' or ')} not found`
|
|
234
|
+
// );
|
|
235
|
+
// }
|
|
236
|
+
// return doc.object.confirmationNumber;
|
|
237
|
+
// }
|
|
245
238
|
/**
|
|
246
239
|
* 取引期限変更
|
|
247
240
|
*/
|
|
@@ -263,47 +256,6 @@ class PlaceOrderRepo {
|
|
|
263
256
|
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
264
257
|
}
|
|
265
258
|
}
|
|
266
|
-
/**
|
|
267
|
-
* 取引オブジェクトを更新
|
|
268
|
-
* 注文名称など
|
|
269
|
-
*/
|
|
270
|
-
async updateObject(params) {
|
|
271
|
-
const doc = await this.transactionModel.findOneAndUpdate({
|
|
272
|
-
_id: { $eq: params.id },
|
|
273
|
-
typeOf: { $eq: params.typeOf },
|
|
274
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress }
|
|
275
|
-
}, {
|
|
276
|
-
$set: {
|
|
277
|
-
...(typeof params.object?.name === 'string') ? { 'object.name': params.object.name } : undefined
|
|
278
|
-
}
|
|
279
|
-
}, {
|
|
280
|
-
projection: { _id: 1 }
|
|
281
|
-
})
|
|
282
|
-
.lean()
|
|
283
|
-
.exec();
|
|
284
|
-
if (doc === null) {
|
|
285
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* 特定の進行中取引を更新する(汎用)
|
|
290
|
-
*/
|
|
291
|
-
async findByIdAndUpdateInProgress(params) {
|
|
292
|
-
await this.transactionModel.findOneAndUpdate({
|
|
293
|
-
_id: { $eq: params.id },
|
|
294
|
-
status: { $eq: factory_1.factory.transactionStatusType.InProgress }
|
|
295
|
-
}, params.update, {
|
|
296
|
-
// new: true,
|
|
297
|
-
projection: { _id: 1 }
|
|
298
|
-
})
|
|
299
|
-
.lean()
|
|
300
|
-
.exec()
|
|
301
|
-
.then((doc) => {
|
|
302
|
-
if (doc === null) {
|
|
303
|
-
throw new factory_1.factory.errors.ArgumentNull(this.transactionModel.modelName);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
259
|
/**
|
|
308
260
|
* 進行中取引のobjectに注文番号を保管する
|
|
309
261
|
*/
|
|
@@ -316,15 +268,22 @@ class PlaceOrderRepo {
|
|
|
316
268
|
.exec();
|
|
317
269
|
return { modifiedCount: result.modifiedCount };
|
|
318
270
|
}
|
|
319
|
-
async saveConfirmationNumberIfNotExist(params
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
271
|
+
// public async saveConfirmationNumberIfNotExist(params: {
|
|
272
|
+
// id: string;
|
|
273
|
+
// status: { $in: factory.transactionStatusType[] };
|
|
274
|
+
// confirmationNumber: string;
|
|
275
|
+
// }): Promise<void> {
|
|
276
|
+
// await this.transactionModel.updateOne(
|
|
277
|
+
// {
|
|
278
|
+
// _id: { $eq: params.id },
|
|
279
|
+
// // status: { $eq: factory.transactionStatusType.InProgress },
|
|
280
|
+
// status: { $in: params.status.$in },
|
|
281
|
+
// 'object.confirmationNumber': { $exists: false }
|
|
282
|
+
// },
|
|
283
|
+
// { $set: { 'object.confirmationNumber': params.confirmationNumber } }
|
|
284
|
+
// )
|
|
285
|
+
// .exec();
|
|
286
|
+
// }
|
|
328
287
|
/**
|
|
329
288
|
* 進行中の注文取引を取得する
|
|
330
289
|
*/
|
|
@@ -441,8 +400,9 @@ class PlaceOrderRepo {
|
|
|
441
400
|
endDate,
|
|
442
401
|
'object.orderDate': params.object.orderDate, // add(2026-06-15~)
|
|
443
402
|
'object.orderNumber': params.object.orderNumber, // add(2026-06-27~)
|
|
403
|
+
'object.confirmationNumber': params.object.confirmationNumber, // add(2026-07-08~)
|
|
444
404
|
result: params.result, // resultを更新
|
|
445
|
-
potentialActions: params.potentialActions //
|
|
405
|
+
...((params.potentialActions !== undefined) && { potentialActions: params.potentialActions }) // support undefined(2026-07-17~)
|
|
446
406
|
}, {
|
|
447
407
|
new: true,
|
|
448
408
|
projection: { _id: 1 }
|
|
@@ -144,7 +144,7 @@ export declare class TransactionRepo {
|
|
|
144
144
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
145
145
|
status: factory.transactionStatusType;
|
|
146
146
|
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
147
|
-
potentialActions?:
|
|
147
|
+
potentialActions?: undefined;
|
|
148
148
|
} & {
|
|
149
149
|
_id: import("mongoose").Types.ObjectId;
|
|
150
150
|
} & {
|
|
@@ -182,7 +182,7 @@ export declare class TransactionRepo {
|
|
|
182
182
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
183
183
|
status: factory.transactionStatusType;
|
|
184
184
|
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
185
|
-
potentialActions?:
|
|
185
|
+
potentialActions?: undefined;
|
|
186
186
|
} & {
|
|
187
187
|
_id: import("mongoose").Types.ObjectId;
|
|
188
188
|
} & {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionNumberCounterRepo = void 0;
|
|
4
|
-
// import { RedisClientType } from 'redis';
|
|
5
4
|
const errorHandler_1 = require("../errorHandler");
|
|
6
5
|
const factory_1 = require("../factory");
|
|
7
6
|
const transactionNumber_1 = require("./mongoose/schemas/transactionNumber");
|
|
@@ -10,44 +9,11 @@ const MAX_RETRY_INCREMENT = 1;
|
|
|
10
9
|
* 取引番号カウンターリポジトリ
|
|
11
10
|
*/
|
|
12
11
|
class TransactionNumberCounterRepo {
|
|
13
|
-
// private readonly redisClient: RedisClientType;
|
|
14
12
|
transactionNumberModel;
|
|
15
13
|
constructor(params) {
|
|
16
14
|
const { connection } = params;
|
|
17
|
-
// this.redisClient = redisClient;
|
|
18
15
|
this.transactionNumberModel = connection.model(transactionNumber_1.modelName, (0, transactionNumber_1.createSchema)());
|
|
19
16
|
}
|
|
20
|
-
// public async incrementByRedis(params: {
|
|
21
|
-
// identifier: string;
|
|
22
|
-
// includedInDataCatalog: {
|
|
23
|
-
// identifier: DataCatalogIdentifier;
|
|
24
|
-
// };
|
|
25
|
-
// expires: Date;
|
|
26
|
-
// }): Promise<number> {
|
|
27
|
-
// // const now = moment();
|
|
28
|
-
// const { expires } = params;
|
|
29
|
-
// const key = `${params.includedInDataCatalog.identifier}:${params.identifier}`;
|
|
30
|
-
// // const TTL = moment(expires)
|
|
31
|
-
// // .diff(now, 'seconds');
|
|
32
|
-
// const [incrReply, expireAtReply] = await this.redisClient.multi()
|
|
33
|
-
// .incr(key)
|
|
34
|
-
// // .expire(key, TTL)
|
|
35
|
-
// .expireAt(key, expires)
|
|
36
|
-
// .exec();
|
|
37
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
38
|
-
// /* istanbul ignore else: please write tests */
|
|
39
|
-
// if (typeof incrReply !== 'number') {
|
|
40
|
-
// // 基本的にありえないフロー
|
|
41
|
-
// throw new factory.errors.Internal('transaction number not incremented unexpectedly');
|
|
42
|
-
// }
|
|
43
|
-
// // expireAtReplyの検証も追加する(2023-04-19~)
|
|
44
|
-
// const expiredSet = expireAtReply === 1 || <any>expireAtReply === true;
|
|
45
|
-
// if (!expiredSet) {
|
|
46
|
-
// // 基本的にありえないフロー
|
|
47
|
-
// throw new factory.errors.Internal('transaction number expiration not set unexpectedly');
|
|
48
|
-
// }
|
|
49
|
-
// return incrReply;
|
|
50
|
-
// }
|
|
51
17
|
async incrementByMongo(params) {
|
|
52
18
|
const now = new Date();
|
|
53
19
|
const dataFeedExpires = params.expires;
|
|
@@ -16,10 +16,8 @@ const DEFAULT_LOCK_EXPIRES = 120;
|
|
|
16
16
|
class TransactionProcessRepo {
|
|
17
17
|
concurrentLockRepo;
|
|
18
18
|
options;
|
|
19
|
-
// private readonly redisClient: RedisClientType;
|
|
20
19
|
constructor(redisClient, options) {
|
|
21
20
|
this.concurrentLockRepo = new concurrentLock_1.ConcurrentLockRepo({ redisClient });
|
|
22
|
-
// this.redisClient = redisClient;
|
|
23
21
|
this.options = options;
|
|
24
22
|
}
|
|
25
23
|
static CREATE_REDIS_KEY(params) {
|
|
@@ -44,16 +42,6 @@ class TransactionProcessRepo {
|
|
|
44
42
|
catch (_error) {
|
|
45
43
|
throw new factory_1.factory.errors.AlreadyInUse(params.typeOf, [], 'Another transaction process in progress');
|
|
46
44
|
}
|
|
47
|
-
// const results = await this.redisClient.multi()
|
|
48
|
-
// .setNX(key, '1')
|
|
49
|
-
// .expire(key, ttl)
|
|
50
|
-
// .exec();
|
|
51
|
-
// debug('locked,', params.id, results);
|
|
52
|
-
// if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
|
|
53
|
-
// return;
|
|
54
|
-
// } else {
|
|
55
|
-
// throw new factory.errors.AlreadyInUse(params.typeOf, [], 'Another transaction process in progress');
|
|
56
|
-
// }
|
|
57
45
|
}
|
|
58
46
|
async unlock(params) {
|
|
59
47
|
const key = TransactionProcessRepo.CREATE_REDIS_KEY(params);
|
|
@@ -62,7 +50,6 @@ class TransactionProcessRepo {
|
|
|
62
50
|
about: { identifier: key, typeOf: 'Thing' },
|
|
63
51
|
audience: { identifier: '1', typeOf: 'Audience' }
|
|
64
52
|
});
|
|
65
|
-
// await this.redisClient.del([key]);
|
|
66
53
|
}
|
|
67
54
|
}
|
|
68
55
|
exports.TransactionProcessRepo = TransactionProcessRepo;
|
|
@@ -167,7 +167,7 @@ function publishPaymentUrl(params, options) {
|
|
|
167
167
|
}
|
|
168
168
|
const actionResult = {
|
|
169
169
|
paymentMethodId: result.paymentMethodId,
|
|
170
|
-
paymentUrl: result.paymentUrl
|
|
170
|
+
// paymentUrl: result.paymentUrl // result.paymentUrlは廃止(2026-07-14~)
|
|
171
171
|
};
|
|
172
172
|
await repos.acceptPayAction.completeWithVoid({ typeOf: actionAttributes.typeOf, id: action.id, result: actionResult, recipe });
|
|
173
173
|
return result;
|
|
@@ -20,7 +20,7 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
|
|
|
20
20
|
*/
|
|
21
21
|
id: string;
|
|
22
22
|
}[];
|
|
23
|
-
instrument: factory.action.trade.pay.
|
|
23
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
24
24
|
}, options: {
|
|
25
25
|
checkedAction: {
|
|
26
26
|
id: string;
|
|
@@ -82,7 +82,8 @@ function createStartParams(params, options) {
|
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
default:
|
|
85
|
-
|
|
85
|
+
// no op
|
|
86
|
+
throw new factory_1.factory.errors.NotImplemented(`paymentServiceType: ${params.paymentServiceType} not implemented`);
|
|
86
87
|
}
|
|
87
88
|
// const informPaymentParams = createInformPaymentParams({
|
|
88
89
|
// paymentService: <factory.service.paymentService.IService | undefined>params.paymentService
|
|
@@ -122,12 +123,10 @@ function createStartParams(params, options) {
|
|
|
122
123
|
: paymentMethodType,
|
|
123
124
|
amount: paymentMethodAmount, // MonetaryAmount対応(2023-08-14~)
|
|
124
125
|
identifier: paymentMethodType, // 追加(2023-08-29~)
|
|
126
|
+
totalPaymentDue,
|
|
125
127
|
...(typeof params.object.paymentMethod?.description === 'string')
|
|
126
128
|
? { description: params.object.paymentMethod?.description }
|
|
127
129
|
: undefined,
|
|
128
|
-
...(totalPaymentDue !== undefined)
|
|
129
|
-
? { totalPaymentDue: totalPaymentDue }
|
|
130
|
-
: undefined,
|
|
131
130
|
...(typeof accountId === 'string') ? { accountId: accountId } : undefined,
|
|
132
131
|
...(typeof params.object.paymentMethod?.method === 'string')
|
|
133
132
|
? { method: params.object.paymentMethod?.method }
|
|
@@ -44,7 +44,7 @@ export { IPaymentAgencyTransaction };
|
|
|
44
44
|
* 取引開始
|
|
45
45
|
*/
|
|
46
46
|
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
47
|
-
instrument: factory.action.trade.pay.
|
|
47
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
48
48
|
}, options: {
|
|
49
49
|
pendingPaymentAgencyTransaction?: IPaymentAgencyTransaction;
|
|
50
50
|
/**
|
|
@@ -5,11 +5,9 @@ export interface ILineNotifyMessage {
|
|
|
5
5
|
subject: string;
|
|
6
6
|
content: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function task2lineNotify(params: {
|
|
9
|
-
task: factory.task.ITask<factory.taskName>;
|
|
10
|
-
}): ILineNotifyMessage;
|
|
11
8
|
export declare function tasks2lineNotify(params: {
|
|
12
|
-
tasks: factory.task.ITask<factory.taskName>[];
|
|
9
|
+
tasks: Pick<factory.task.ITask<factory.taskName>, 'id' | 'executionResults' | 'project' | 'name' | 'runsAt'>[];
|
|
10
|
+
limit: number;
|
|
13
11
|
}): ILineNotifyMessage;
|
|
14
12
|
export declare function createSendEmailMessageRecipe(params: {
|
|
15
13
|
mailData?: MailData;
|
|
@@ -4,37 +4,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ABORT_REPORT_SUBJECT = void 0;
|
|
7
|
-
exports.task2lineNotify = task2lineNotify;
|
|
8
7
|
exports.tasks2lineNotify = tasks2lineNotify;
|
|
9
8
|
exports.createSendEmailMessageRecipe = createSendEmailMessageRecipe;
|
|
10
9
|
const moment_1 = __importDefault(require("moment"));
|
|
11
10
|
const factory_1 = require("../../factory");
|
|
12
11
|
exports.ABORT_REPORT_SUBJECT = 'tasks aborted';
|
|
13
|
-
function task2lineNotify(params
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
// function task2lineNotify(params: {
|
|
13
|
+
// task: factory.task.ITask<factory.taskName>;
|
|
14
|
+
// }): ILineNotifyMessage {
|
|
15
|
+
// const task = params.task;
|
|
16
|
+
// const lastExecutionResult = (task.executionResults.length > 0) ? task.executionResults.slice(-1)[0] : undefined;
|
|
17
|
+
// let lastError = lastExecutionResult?.error;
|
|
18
|
+
// if (typeof lastError === 'string') {
|
|
19
|
+
// lastError = { message: lastError, name: 'Error' };
|
|
20
|
+
// }
|
|
21
|
+
// const lastMessage = `${String(lastError?.name)} ${String(lastError?.message)}`;
|
|
22
|
+
// const content = `project:${task.project?.id}
|
|
23
|
+
// id:${task.id}
|
|
24
|
+
// name:${task.name}
|
|
25
|
+
// runsAt:${moment(task.runsAt)
|
|
26
|
+
// .toISOString()}
|
|
27
|
+
// lastTriedAt:${moment((task.lastTriedAt as Date))
|
|
28
|
+
// .toISOString()}
|
|
29
|
+
// numberOfTried:${task.numberOfTried}
|
|
30
|
+
// lastMessage:${lastMessage}`;
|
|
31
|
+
// return {
|
|
32
|
+
// subject: ABORT_REPORT_SUBJECT,
|
|
33
|
+
// content: content
|
|
34
|
+
// };
|
|
35
|
+
// }
|
|
35
36
|
const MAX_LAST_MESSAGE_LENGTH = 60;
|
|
36
37
|
function tasks2lineNotify(params) {
|
|
37
|
-
const
|
|
38
|
+
const abortedTasksCount = (params.tasks.length >= params.limit) ? `over ${params.tasks.length}` : params.tasks.length;
|
|
39
|
+
const subject = `${abortedTasksCount} ${exports.ABORT_REPORT_SUBJECT}`;
|
|
38
40
|
let content;
|
|
39
41
|
// あまりに通知タスク数が多いケースに対応
|
|
40
42
|
if (params.tasks.length > 10) {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { TaskRepo } from '../../repo/task';
|
|
2
2
|
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
3
|
+
interface INotifyAbortedTasksRepos {
|
|
4
|
+
task: TaskRepo;
|
|
5
|
+
integrationSetting: IntegrationSettingRepo;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* 中止されたタスクリストをEメールで通知する
|
|
5
9
|
* add(2025-03-13~)
|
|
6
10
|
*/
|
|
7
11
|
declare function notifyAbortedTasksByEmail(params: {
|
|
8
12
|
dateAbortedGte: Date;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
dateAbortedLte: Date;
|
|
14
|
+
/**
|
|
15
|
+
* 中止タスクがあまりに多いと性能に影響するので、現実的にタスク数を制限する
|
|
16
|
+
*/
|
|
17
|
+
limit: number;
|
|
18
|
+
}): (repos: INotifyAbortedTasksRepos) => Promise<void>;
|
|
19
|
+
export { notifyAbortedTasksByEmail, INotifyAbortedTasksRepos };
|
|
@@ -17,16 +17,24 @@ function notifyAbortedTasksByEmail(params) {
|
|
|
17
17
|
return async (repos) => {
|
|
18
18
|
const abortedTasksWithoutReport = await repos.integrationSetting.getByKey('abortedTasksWithoutReport');
|
|
19
19
|
const abortedTasks = await repos.task.projectFields({
|
|
20
|
+
limit: params.limit,
|
|
21
|
+
page: 1,
|
|
20
22
|
status: { $eq: factory_1.factory.taskStatus.Aborted },
|
|
21
|
-
dateAborted: {
|
|
23
|
+
dateAborted: {
|
|
24
|
+
$gte: params.dateAbortedGte,
|
|
25
|
+
$lte: params.dateAbortedLte,
|
|
26
|
+
},
|
|
22
27
|
// 中止を報告しないタスク以外にフィルター
|
|
23
28
|
...(abortedTasksWithoutReport.length > 0)
|
|
24
29
|
? { name: { $nin: abortedTasksWithoutReport } }
|
|
25
30
|
: undefined
|
|
26
|
-
}, []);
|
|
31
|
+
}, ['executionResults', 'name', 'project', 'runsAt']);
|
|
27
32
|
if (abortedTasks.length > 0) {
|
|
28
33
|
// 開発者へ報告
|
|
29
|
-
const message = (0, factory_2.tasks2lineNotify)({
|
|
34
|
+
const message = (0, factory_2.tasks2lineNotify)({
|
|
35
|
+
tasks: abortedTasks,
|
|
36
|
+
limit: params.limit
|
|
37
|
+
});
|
|
30
38
|
const notifyResult = await (0, notifyByEmail_1.notifyByEmail)({
|
|
31
39
|
subject: message.subject, content: message.content,
|
|
32
40
|
logLevel: 'error'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
|
-
import { IMinimizedIndividualEvent } from '../../../../factory/event';
|
|
3
2
|
declare function createReserveTransactionStartParams(params: {
|
|
4
3
|
project: {
|
|
5
4
|
id: string;
|
|
@@ -13,7 +12,6 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
13
12
|
transactionNumber: string;
|
|
14
13
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
15
14
|
declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
16
|
-
event: Pick<IMinimizedIndividualEvent, 'id'>;
|
|
17
15
|
instrument: {
|
|
18
16
|
/**
|
|
19
17
|
* 予約取引番号
|
|
@@ -21,8 +19,6 @@ declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
21
19
|
transactionNumber: string;
|
|
22
20
|
};
|
|
23
21
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
24
|
-
}, options: {
|
|
25
|
-
useLegacyAuthorizeOfferObject: boolean;
|
|
26
22
|
}): factory.action.authorize.offer.eventService.IAttributes;
|
|
27
23
|
declare function acceptedOffers2amount(params: {
|
|
28
24
|
acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
|
|
@@ -31,7 +27,9 @@ declare function acceptedOffers2authorizeResult(params: {
|
|
|
31
27
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
32
28
|
noOfferSpecified: boolean;
|
|
33
29
|
ticketOffers: factory.product.ITicketOffer[];
|
|
34
|
-
}): factory.action.authorize.offer.eventService.IResult
|
|
30
|
+
}): factory.action.authorize.offer.eventService.IResult & {
|
|
31
|
+
onlyPrice?: boolean;
|
|
32
|
+
};
|
|
35
33
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
36
34
|
export type IResultAcceptedOffer = Omit<factory.order.IOptimizedAcceptedOffer, 'priceSpecification'> & {
|
|
37
35
|
itemOffered: factory.order.IEventReservation;
|