@chevre/domain 25.2.0-alpha.2 → 25.2.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/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/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 +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +12 -12
- package/lib/chevre/repo/order.d.ts +2 -0
- package/lib/chevre/repo/orderInTransaction.d.ts +41 -0
- package/lib/chevre/repo/orderInTransaction.js +122 -0
- package/lib/chevre/repo/transaction/placeOrder.d.ts +1 -44
- package/lib/chevre/repo/transaction/placeOrder.js +42 -82
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +5 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +22 -12
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.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/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 +6 -6
- package/lib/chevre/service/payment/any/factory.js +19 -22
- 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 +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -16
- 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/task/publishPaymentUrl.js +2 -2
- package/lib/chevre/service/task/voidPayTransaction.js +3 -7
- 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 +65 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +15 -152
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +22 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +120 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +5 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +14 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +108 -89
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +7 -0
- package/lib/chevre/service/transaction/placeOrder/confirm.js +35 -60
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +4 -7
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +33 -15
- package/package.json +2 -2
|
@@ -19,9 +19,9 @@ exports.AVAILABLE_PROJECT_FIELDS = [
|
|
|
19
19
|
'endDate',
|
|
20
20
|
'purpose',
|
|
21
21
|
'potentialActions',
|
|
22
|
-
'amount',
|
|
23
|
-
'fromLocation',
|
|
24
|
-
'toLocation',
|
|
22
|
+
// 'amount', // discontinue(2026-07-08~)
|
|
23
|
+
// 'fromLocation', // discontinue(2026-07-08~)
|
|
24
|
+
// 'toLocation', // discontinue(2026-07-08~)
|
|
25
25
|
'instrument',
|
|
26
26
|
'location',
|
|
27
27
|
'replacer',
|
|
@@ -322,60 +322,60 @@ class ActionProcessRepo {
|
|
|
322
322
|
startDate: { $lte: startDateLte }
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
|
|
326
|
-
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
|
|
335
|
-
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
|
|
344
|
-
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
|
|
353
|
-
if (Array.isArray(toLocationTypeOfIn)) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
}
|
|
361
|
-
const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
|
|
362
|
-
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
|
|
371
|
-
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
325
|
+
// const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
|
|
326
|
+
// if (Array.isArray(fromLocationTypeOfIn)) {
|
|
327
|
+
// andConditions.push({
|
|
328
|
+
// 'fromLocation.typeOf': {
|
|
329
|
+
// $exists: true,
|
|
330
|
+
// $in: fromLocationTypeOfIn
|
|
331
|
+
// }
|
|
332
|
+
// });
|
|
333
|
+
// }
|
|
334
|
+
// const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
|
|
335
|
+
// if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
336
|
+
// andConditions.push({
|
|
337
|
+
// 'fromLocation.accountNumber': {
|
|
338
|
+
// $exists: true,
|
|
339
|
+
// $in: fromLocationAccountNumberIn
|
|
340
|
+
// }
|
|
341
|
+
// });
|
|
342
|
+
// }
|
|
343
|
+
// const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
|
|
344
|
+
// if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
345
|
+
// andConditions.push({
|
|
346
|
+
// 'fromLocation.accountType': {
|
|
347
|
+
// $exists: true,
|
|
348
|
+
// $in: fromLocationAccountTypeIn
|
|
349
|
+
// }
|
|
350
|
+
// });
|
|
351
|
+
// }
|
|
352
|
+
// const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
|
|
353
|
+
// if (Array.isArray(toLocationTypeOfIn)) {
|
|
354
|
+
// andConditions.push({
|
|
355
|
+
// 'toLocation.typeOf': {
|
|
356
|
+
// $exists: true,
|
|
357
|
+
// $in: toLocationTypeOfIn
|
|
358
|
+
// }
|
|
359
|
+
// });
|
|
360
|
+
// }
|
|
361
|
+
// const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
|
|
362
|
+
// if (Array.isArray(toLocationAccountNumberIn)) {
|
|
363
|
+
// andConditions.push({
|
|
364
|
+
// 'toLocation.accountNumber': {
|
|
365
|
+
// $exists: true,
|
|
366
|
+
// $in: toLocationAccountNumberIn
|
|
367
|
+
// }
|
|
368
|
+
// });
|
|
369
|
+
// }
|
|
370
|
+
// const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
|
|
371
|
+
// if (Array.isArray(toLocationAccountTypeIn)) {
|
|
372
|
+
// andConditions.push({
|
|
373
|
+
// 'toLocation.accountType': {
|
|
374
|
+
// $exists: true,
|
|
375
|
+
// $in: toLocationAccountTypeIn
|
|
376
|
+
// }
|
|
377
|
+
// });
|
|
378
|
+
// }
|
|
379
379
|
const purposeTypeOfIn = params.purpose?.typeOf?.$in;
|
|
380
380
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
381
381
|
andConditions.push({
|
|
@@ -9,6 +9,10 @@ export { ICancelActionAction };
|
|
|
9
9
|
*/
|
|
10
10
|
type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction>;
|
|
11
11
|
type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds | factory.recipe.RecipeCategory.payCreditCard | factory.recipe.RecipeCategory.payMovieTicket | factory.recipe.RecipeCategory.refundCreditCard | factory.recipe.RecipeCategory.refundMovieTicket>>;
|
|
12
|
+
export interface IDeleteActionResult {
|
|
13
|
+
identifier: string;
|
|
14
|
+
deletedCount?: number;
|
|
15
|
+
}
|
|
12
16
|
/**
|
|
13
17
|
* アクションリポジトリ
|
|
14
18
|
*/
|
|
@@ -50,15 +54,20 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
|
|
|
50
54
|
orderNumber: string;
|
|
51
55
|
sort?: factory.action.ISortOrder;
|
|
52
56
|
}): Promise<IAction<factory.actionType>[]>;
|
|
57
|
+
/**
|
|
58
|
+
* 注文番号から、注文に対するアクションを削除する
|
|
59
|
+
*/
|
|
60
|
+
deleteActionsByOrderNumber(params: {
|
|
61
|
+
project: {
|
|
62
|
+
id: string;
|
|
63
|
+
};
|
|
64
|
+
orderNumber: string;
|
|
65
|
+
}): Promise<IDeleteActionResult[]>;
|
|
53
66
|
deleteByProject(params: {
|
|
54
67
|
project: {
|
|
55
68
|
id: string;
|
|
56
69
|
};
|
|
57
70
|
}): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* イベントと入場ゲート指定で予約使用アクションを集計する
|
|
60
|
-
* discontinue(2024-12-26~)
|
|
61
|
-
*/
|
|
62
71
|
/**
|
|
63
72
|
* 開始日時を一定期間過ぎたアクションを削除する
|
|
64
73
|
*/
|
|
@@ -78,20 +87,18 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
|
|
|
78
87
|
/**
|
|
79
88
|
* 取引からアクションを削除する
|
|
80
89
|
*/
|
|
81
|
-
|
|
90
|
+
deleteActionsByTransactionId(params: {
|
|
82
91
|
project: {
|
|
83
92
|
id: string;
|
|
84
93
|
};
|
|
85
|
-
|
|
94
|
+
transaction: {
|
|
86
95
|
typeOf: factory.transactionType;
|
|
87
96
|
id: string;
|
|
88
97
|
};
|
|
89
98
|
typeOf: {
|
|
90
99
|
$in: factory.actionType[];
|
|
91
100
|
};
|
|
92
|
-
}): Promise<
|
|
93
|
-
deletedCount?: number;
|
|
94
|
-
} | null>;
|
|
101
|
+
}): Promise<IDeleteActionResult[]>;
|
|
95
102
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/action").IAction<import("@chevre/factory/lib/chevre/action").IAttributes<factory.actionType, any, any>>, "id"> & {
|
|
96
103
|
identifier?: string;
|
|
97
104
|
} & {
|
|
@@ -312,130 +312,68 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
312
312
|
.lean() // 2024-08-26~
|
|
313
313
|
.exec();
|
|
314
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* 注文番号から、注文に対するアクションを削除する
|
|
317
|
+
*/
|
|
318
|
+
async deleteActionsByOrderNumber(params) {
|
|
319
|
+
const { project, orderNumber } = params;
|
|
320
|
+
if (typeof project.id !== 'string' || project.id === '') {
|
|
321
|
+
throw new factory_1.factory.errors.ArgumentNull('project.id');
|
|
322
|
+
}
|
|
323
|
+
if (typeof orderNumber !== 'string' || orderNumber === '') {
|
|
324
|
+
throw new factory_1.factory.errors.ArgumentNull('orderNumber');
|
|
325
|
+
}
|
|
326
|
+
const filters = [
|
|
327
|
+
{
|
|
328
|
+
identifier: 'byObject',
|
|
329
|
+
filter: {
|
|
330
|
+
'project.id': { $eq: project.id },
|
|
331
|
+
'object.orderNumber': { $exists: true, $eq: orderNumber }
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
identifier: 'byPurpose',
|
|
336
|
+
filter: {
|
|
337
|
+
'project.id': { $eq: project.id },
|
|
338
|
+
'purpose.orderNumber': { $exists: true, $eq: orderNumber }
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
identifier: 'byAbout',
|
|
343
|
+
filter: {
|
|
344
|
+
'project.id': { $eq: project.id },
|
|
345
|
+
'about.orderNumber': { $exists: true, $eq: orderNumber }
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
identifier: 'byInstrument',
|
|
350
|
+
filter: {
|
|
351
|
+
'project.id': { $eq: project.id },
|
|
352
|
+
'instrument.orderNumber': { $exists: true, $eq: orderNumber }
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
];
|
|
356
|
+
return Promise.all(filters.map(async ({ identifier, filter }) => {
|
|
357
|
+
return this.actionModel.deleteMany(filter)
|
|
358
|
+
.exec()
|
|
359
|
+
.then((result) => {
|
|
360
|
+
return {
|
|
361
|
+
identifier,
|
|
362
|
+
// n: result?.n,
|
|
363
|
+
// opTime: result.opTime,
|
|
364
|
+
// ok: result?.ok,
|
|
365
|
+
// operationTime,
|
|
366
|
+
deletedCount: result?.deletedCount
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
315
371
|
async deleteByProject(params) {
|
|
316
372
|
await this.actionModel.deleteMany({
|
|
317
373
|
'project.id': { $eq: params.project.id }
|
|
318
374
|
})
|
|
319
375
|
.exec();
|
|
320
376
|
}
|
|
321
|
-
// public async reCompleteAuthorizeEventOfferAction(params: {
|
|
322
|
-
// id: string;
|
|
323
|
-
// object: factory.action.authorize.offer.eventService.IObject;
|
|
324
|
-
// result: factory.action.authorize.offer.eventService.IResult;
|
|
325
|
-
// }): Promise<void> {
|
|
326
|
-
// return this.actionModel.findOneAndUpdate(
|
|
327
|
-
// {
|
|
328
|
-
// // typeOf: factory.actionType.AuthorizeAction,
|
|
329
|
-
// _id: { $eq: params.id },
|
|
330
|
-
// // ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
331
|
-
// // actionStatus: factory.actionStatusType.CompletedActionStatus
|
|
332
|
-
// actionStatus: { $eq: factory.actionStatusType.ActiveActionStatus }
|
|
333
|
-
// },
|
|
334
|
-
// {
|
|
335
|
-
// $set: {
|
|
336
|
-
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
337
|
-
// object: params.object,
|
|
338
|
-
// result: params.result,
|
|
339
|
-
// endDate: new Date()
|
|
340
|
-
// }
|
|
341
|
-
// },
|
|
342
|
-
// { new: true, projection: { _id: 1 } }
|
|
343
|
-
// )
|
|
344
|
-
// .lean<{ _id: ObjectId }>()
|
|
345
|
-
// .exec()
|
|
346
|
-
// .then((doc) => {
|
|
347
|
-
// if (doc === null) {
|
|
348
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
349
|
-
// }
|
|
350
|
-
// });
|
|
351
|
-
// }
|
|
352
|
-
// public async updateById(params: {
|
|
353
|
-
// id: string;
|
|
354
|
-
// update: any;
|
|
355
|
-
// }): Promise<void> {
|
|
356
|
-
// await this.actionModel.updateOne(
|
|
357
|
-
// { _id: { $eq: params.id } },
|
|
358
|
-
// params.update
|
|
359
|
-
// )
|
|
360
|
-
// .exec();
|
|
361
|
-
// }
|
|
362
|
-
// public async findByIdAndUpdate(params: {
|
|
363
|
-
// id: string;
|
|
364
|
-
// update: UpdateQuery<IAction<factory.actionType>>;
|
|
365
|
-
// }): Promise<void> {
|
|
366
|
-
// await this.actionModel.findOneAndUpdate(
|
|
367
|
-
// { _id: { $eq: params.id } },
|
|
368
|
-
// params.update,
|
|
369
|
-
// { projection: { _id: 1 } }
|
|
370
|
-
// )
|
|
371
|
-
// .lean<{ _id: ObjectId }>()
|
|
372
|
-
// .exec()
|
|
373
|
-
// .then((doc) => {
|
|
374
|
-
// if (doc === null) {
|
|
375
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
376
|
-
// }
|
|
377
|
-
// });
|
|
378
|
-
// }
|
|
379
|
-
/**
|
|
380
|
-
* イベントと入場ゲート指定で予約使用アクションを集計する
|
|
381
|
-
* discontinue(2024-12-26~)
|
|
382
|
-
*/
|
|
383
|
-
// public async countUseActionsByEntranceGate(params: {
|
|
384
|
-
// event: { id: string };
|
|
385
|
-
// entranceGateIdentifier: string;
|
|
386
|
-
// }): Promise<IUseActionCountByOffer[]> {
|
|
387
|
-
// return this.actionModel.aggregate([
|
|
388
|
-
// {
|
|
389
|
-
// $match: {
|
|
390
|
-
// actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
391
|
-
// }
|
|
392
|
-
// },
|
|
393
|
-
// {
|
|
394
|
-
// $match: {
|
|
395
|
-
// typeOf: { $eq: factory.actionType.UseAction }
|
|
396
|
-
// }
|
|
397
|
-
// },
|
|
398
|
-
// {
|
|
399
|
-
// $match: {
|
|
400
|
-
// 'object.typeOf': {
|
|
401
|
-
// $exists: true,
|
|
402
|
-
// $eq: factory.reservationType.EventReservation
|
|
403
|
-
// }
|
|
404
|
-
// }
|
|
405
|
-
// },
|
|
406
|
-
// {
|
|
407
|
-
// $match: {
|
|
408
|
-
// 'object.reservationFor.id': {
|
|
409
|
-
// $exists: true,
|
|
410
|
-
// $eq: params.event.id
|
|
411
|
-
// }
|
|
412
|
-
// }
|
|
413
|
-
// },
|
|
414
|
-
// {
|
|
415
|
-
// $match: {
|
|
416
|
-
// 'location.identifier': {
|
|
417
|
-
// $exists: true,
|
|
418
|
-
// $eq: params.entranceGateIdentifier
|
|
419
|
-
// }
|
|
420
|
-
// }
|
|
421
|
-
// },
|
|
422
|
-
// {
|
|
423
|
-
// $group: {
|
|
424
|
-
// _id: '$object.id',
|
|
425
|
-
// object: { $first: '$object' }
|
|
426
|
-
// }
|
|
427
|
-
// },
|
|
428
|
-
// {
|
|
429
|
-
// $group: {
|
|
430
|
-
// _id: '$object.reservedTicket.ticketType.id',
|
|
431
|
-
// useActionCount: {
|
|
432
|
-
// $sum: 1
|
|
433
|
-
// }
|
|
434
|
-
// }
|
|
435
|
-
// }
|
|
436
|
-
// ])
|
|
437
|
-
// .exec();
|
|
438
|
-
// }
|
|
439
377
|
/**
|
|
440
378
|
* 開始日時を一定期間過ぎたアクションを削除する
|
|
441
379
|
*/
|
|
@@ -473,69 +411,50 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
473
411
|
/**
|
|
474
412
|
* 取引からアクションを削除する
|
|
475
413
|
*/
|
|
476
|
-
async
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
414
|
+
async deleteActionsByTransactionId(params) {
|
|
415
|
+
const { project, transaction } = params;
|
|
416
|
+
if (typeof project.id !== 'string' || project.id === '') {
|
|
417
|
+
throw new factory_1.factory.errors.ArgumentNull('project.id');
|
|
418
|
+
}
|
|
419
|
+
if (typeof transaction.id !== 'string' || transaction.id === '') {
|
|
420
|
+
throw new factory_1.factory.errors.ArgumentNull('transaction.id ');
|
|
421
|
+
}
|
|
422
|
+
const filters = [
|
|
423
|
+
{
|
|
424
|
+
identifier: 'byPurpose',
|
|
425
|
+
filter: {
|
|
426
|
+
'project.id': { $eq: project.id },
|
|
427
|
+
typeOf: { $in: params.typeOf.$in },
|
|
428
|
+
'purpose.id': { $exists: true, $eq: transaction.id },
|
|
429
|
+
'purpose.typeOf': { $exists: true, $eq: transaction.typeOf }
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
// instrumentによるアクション削除にも対応(2026-07-10~)
|
|
433
|
+
{
|
|
434
|
+
identifier: 'byInstrument',
|
|
435
|
+
filter: {
|
|
436
|
+
'project.id': { $eq: project.id },
|
|
437
|
+
// typeOf: { $in: params.typeOf.$in }, // typOfでフィルターしない
|
|
438
|
+
'instrument.id': { $exists: true, $eq: transaction.id },
|
|
439
|
+
'instrument.typeOf': { $exists: true, $eq: transaction.typeOf }
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
];
|
|
443
|
+
return Promise.all(filters.map(async ({ identifier, filter }) => {
|
|
444
|
+
return this.actionModel.deleteMany(filter)
|
|
445
|
+
.exec()
|
|
446
|
+
.then((result) => {
|
|
447
|
+
return {
|
|
448
|
+
identifier,
|
|
449
|
+
// n: result?.n,
|
|
450
|
+
// opTime: result.opTime,
|
|
451
|
+
// ok: result?.ok,
|
|
452
|
+
// operationTime,
|
|
453
|
+
deletedCount: result?.deletedCount
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
}));
|
|
493
457
|
}
|
|
494
|
-
// public async saveActionWithEndDate(savingAction: Omit<factory.action.authorize.invoice.IAction, 'id'>) {
|
|
495
|
-
// const { sameAs, typeOf, project, agent, object, ...updateFields } = savingAction;
|
|
496
|
-
// const filter: FilterQuery<factory.recipe.IRecipe> = {
|
|
497
|
-
// 'project.id': { $eq: project.id },
|
|
498
|
-
// // 'agent.id': { $exists: true, $eq: agent.id },
|
|
499
|
-
// // 'object.typeOf': { $exists: true, $eq: object.typeOf },
|
|
500
|
-
// 'object.paymentMethodId': { $exists: true, $eq: object.paymentMethodId },
|
|
501
|
-
// typeOf: { $eq: typeOf },
|
|
502
|
-
// 'sameAs.id': { $exists: true, $eq: sameAs.id }
|
|
503
|
-
// };
|
|
504
|
-
// const setOnInsert: AnyKeys<IAction<factory.actionType>> = { typeOf, project, agent, object, sameAs };
|
|
505
|
-
// const setKeys: AnyKeys<IAction<factory.actionType>> = updateFields;
|
|
506
|
-
// const update: UpdateQuery<IAction<factory.actionType>> = {
|
|
507
|
-
// $setOnInsert: setOnInsert,
|
|
508
|
-
// $set: setKeys
|
|
509
|
-
// };
|
|
510
|
-
// return this.actionModel.updateOne<HydratedDocument<IRecipeAsDocument>>(
|
|
511
|
-
// filter,
|
|
512
|
-
// update,
|
|
513
|
-
// {
|
|
514
|
-
// upsert: true,
|
|
515
|
-
// includeResultMetadata: true
|
|
516
|
-
// }
|
|
517
|
-
// )
|
|
518
|
-
// .exec();
|
|
519
|
-
// }
|
|
520
|
-
// public async findRecipeByAction<T extends factory.recipe.RecipeCategory>(params: {
|
|
521
|
-
// project: { id: string };
|
|
522
|
-
// recipeFor: { id: string };
|
|
523
|
-
// }): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null> {
|
|
524
|
-
// return this.actionRecipeModel.findOne(
|
|
525
|
-
// {
|
|
526
|
-
// 'project.id': { $eq: params.project.id },
|
|
527
|
-
// 'recipeFor.id': { $eq: params.recipeFor.id }
|
|
528
|
-
// },
|
|
529
|
-
// { step: 1, recipeCategory: 1 }
|
|
530
|
-
// // { lean: true }
|
|
531
|
-
// )
|
|
532
|
-
// .lean<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'>>()
|
|
533
|
-
// .exec();
|
|
534
|
-
// // if (result === null) {
|
|
535
|
-
// // throw new factory.errors.NotFound(this.actionRecipeModel.modelName);
|
|
536
|
-
// // }
|
|
537
|
-
// // return result;
|
|
538
|
-
// }
|
|
539
458
|
getCursor(conditions, projection) {
|
|
540
459
|
return this.actionModel.find(conditions, projection)
|
|
541
460
|
.sort({ startDate: factory_1.factory.sortType.Descending })
|
|
@@ -21,9 +21,9 @@ const schemaDefinition = {
|
|
|
21
21
|
endDate: Date,
|
|
22
22
|
purpose: mongoose_1.SchemaTypes.Mixed,
|
|
23
23
|
potentialActions: mongoose_1.SchemaTypes.Mixed,
|
|
24
|
-
amount:
|
|
25
|
-
fromLocation:
|
|
26
|
-
toLocation:
|
|
24
|
+
// amount: SchemaTypes.Mixed, // discontinue(2026-07-08~)
|
|
25
|
+
// fromLocation: SchemaTypes.Mixed, // discontinue(2026-07-08~)
|
|
26
|
+
// toLocation: SchemaTypes.Mixed, // discontinue(2026-07-08~)
|
|
27
27
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
28
28
|
location: mongoose_1.SchemaTypes.Mixed, // add location(2022-11-11~)
|
|
29
29
|
replacer: mongoose_1.SchemaTypes.Mixed, // add replacer(2024-03-19~)
|
|
@@ -221,15 +221,16 @@ const indexes = [
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
],
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
224
|
+
// 承認アクションのobject.event廃止につき検索条件も廃止(2026-07-07~)
|
|
225
|
+
// [
|
|
226
|
+
// { 'object.event.id': 1, startDate: -1 },
|
|
227
|
+
// {
|
|
228
|
+
// name: 'searchByObjectEventId',
|
|
229
|
+
// partialFilterExpression: {
|
|
230
|
+
// 'object.event.id': { $exists: true }
|
|
231
|
+
// }
|
|
232
|
+
// }
|
|
233
|
+
// ],
|
|
233
234
|
[
|
|
234
235
|
{ 'about.id': 1, startDate: -1 },
|
|
235
236
|
{
|
|
@@ -329,60 +330,60 @@ const indexes = [
|
|
|
329
330
|
}
|
|
330
331
|
}
|
|
331
332
|
],
|
|
332
|
-
[
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
],
|
|
341
|
-
[
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
],
|
|
350
|
-
[
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
],
|
|
359
|
-
[
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
],
|
|
368
|
-
[
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
],
|
|
377
|
-
[
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
],
|
|
333
|
+
// [
|
|
334
|
+
// { 'fromLocation.typeOf': 1, startDate: -1 },
|
|
335
|
+
// {
|
|
336
|
+
// name: 'searchByFromLocationTypeOf',
|
|
337
|
+
// partialFilterExpression: {
|
|
338
|
+
// 'fromLocation.typeOf': { $exists: true }
|
|
339
|
+
// }
|
|
340
|
+
// }
|
|
341
|
+
// ],
|
|
342
|
+
// [
|
|
343
|
+
// { 'fromLocation.accountNumber': 1, startDate: -1 },
|
|
344
|
+
// {
|
|
345
|
+
// name: 'searchByFromLocationAccountNumber',
|
|
346
|
+
// partialFilterExpression: {
|
|
347
|
+
// 'fromLocation.accountNumber': { $exists: true }
|
|
348
|
+
// }
|
|
349
|
+
// }
|
|
350
|
+
// ],
|
|
351
|
+
// [
|
|
352
|
+
// { 'fromLocation.accountType': 1, startDate: -1 },
|
|
353
|
+
// {
|
|
354
|
+
// name: 'searchByFromLocationAccountType',
|
|
355
|
+
// partialFilterExpression: {
|
|
356
|
+
// 'fromLocation.accountType': { $exists: true }
|
|
357
|
+
// }
|
|
358
|
+
// }
|
|
359
|
+
// ],
|
|
360
|
+
// [
|
|
361
|
+
// { 'toLocation.typeOf': 1, startDate: -1 },
|
|
362
|
+
// {
|
|
363
|
+
// name: 'searchByToLocationTypeOf',
|
|
364
|
+
// partialFilterExpression: {
|
|
365
|
+
// 'toLocation.typeOf': { $exists: true }
|
|
366
|
+
// }
|
|
367
|
+
// }
|
|
368
|
+
// ],
|
|
369
|
+
// [
|
|
370
|
+
// { 'toLocation.accountNumber': 1, startDate: -1 },
|
|
371
|
+
// {
|
|
372
|
+
// name: 'searchByToLocationAccountNumber',
|
|
373
|
+
// partialFilterExpression: {
|
|
374
|
+
// 'toLocation.accountNumber': { $exists: true }
|
|
375
|
+
// }
|
|
376
|
+
// }
|
|
377
|
+
// ],
|
|
378
|
+
// [
|
|
379
|
+
// { 'toLocation.accountType': 1, startDate: -1 },
|
|
380
|
+
// {
|
|
381
|
+
// name: 'searchByToLocationAccountType',
|
|
382
|
+
// partialFilterExpression: {
|
|
383
|
+
// 'toLocation.accountType': { $exists: true }
|
|
384
|
+
// }
|
|
385
|
+
// }
|
|
386
|
+
// ],
|
|
386
387
|
[
|
|
387
388
|
{ 'instrument.transactionNumber': 1, startDate: -1 },
|
|
388
389
|
{
|
|
@@ -7,6 +7,10 @@ type IDocType = Omit<factory.order.IOrder, 'id'> & {
|
|
|
7
7
|
* 注文取引IDとして再定義(2026-06-22~)
|
|
8
8
|
*/
|
|
9
9
|
identifier?: string;
|
|
10
|
+
/**
|
|
11
|
+
* 外部URL決済の場合に発行される決済方法IDとして定義(2026-07-12~)
|
|
12
|
+
*/
|
|
13
|
+
paymentMethodId?: string;
|
|
10
14
|
};
|
|
11
15
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
12
16
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -27,6 +27,7 @@ const schemaDefinition = {
|
|
|
27
27
|
dateReturned: Date,
|
|
28
28
|
orderedItem: [mongoose_1.SchemaTypes.Mixed],
|
|
29
29
|
identifier: { type: String, required: true }, // 注文取引IDとして再定義(2026-06-22~)
|
|
30
|
+
paymentMethodId: { type: String, required: false }, // 注文取引から移行(2026-07-12~)
|
|
30
31
|
// 以下廃止(2026-06-13~)
|
|
31
32
|
// identifier: SchemaTypes.Mixed, // 廃止するためにMixed化(2026-06-12~)
|
|
32
33
|
// isGift: Boolean,
|