@chevre/domain 25.0.0-alpha.9 → 25.1.0-alpha.0
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/message.d.ts +7 -15
- package/lib/chevre/repo/message.js +37 -74
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -110
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +35 -9
- package/lib/chevre/repo/mongoose/schemas/setting.js +3 -2
- package/lib/chevre/repo/mongoose/schemas/transaction.js +51 -50
- package/lib/chevre/repo/order.d.ts +1 -7
- package/lib/chevre/repo/order.js +56 -26
- package/lib/chevre/repo/orderInTransaction.d.ts +41 -22
- package/lib/chevre/repo/orderInTransaction.js +108 -79
- package/lib/chevre/repo/passport.d.ts +5 -2
- package/lib/chevre/repo/setting/rateLimit.d.ts +18 -0
- package/lib/chevre/repo/setting/rateLimit.js +48 -0
- package/lib/chevre/repo/setting/waiter.d.ts +17 -0
- package/lib/chevre/repo/setting/waiter.js +39 -0
- package/lib/chevre/repo/setting.d.ts +12 -11
- package/lib/chevre/repo/setting.js +6 -18
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transaction/placeOrder.d.ts +1 -6
- package/lib/chevre/repo/transaction/placeOrder.js +37 -26
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repo/transaction.js +2 -2
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +22 -0
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/offer/any.d.ts +1 -3
- package/lib/chevre/service/offer/any.js +7 -8
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +5 -8
- package/lib/chevre/service/offer/event/voidTransaction.js +29 -17
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +16 -12
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +0 -6
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -7
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +20 -17
- package/lib/chevre/service/order/deleteOrder.d.ts +6 -10
- package/lib/chevre/service/order/deleteOrder.js +7 -48
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -26
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -2
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +6 -6
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.d.ts +1 -3
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.js +3 -15
- package/lib/chevre/service/order/placeOrder.js +6 -6
- package/lib/chevre/service/order.d.ts +1 -2
- package/lib/chevre/service/order.js +1 -5
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.d.ts +2 -4
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +4 -6
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -4
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +5 -8
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -10
- package/lib/chevre/service/task/authorizePayment.js +2 -6
- package/lib/chevre/service/task/deleteTransaction.js +2 -10
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -9
- package/lib/chevre/service/taskHandler.js +0 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +8 -16
- package/lib/chevre/service/transaction/deleteTransaction.js +46 -145
- package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.d.ts +7 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +3 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +3 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.js +29 -24
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +45 -54
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +2 -3
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.d.ts +5 -0
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.js +37 -23
- package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +20 -4
- package/lib/chevre/service/transaction/placeOrder/start/factory.js +20 -7
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +9 -4
- package/lib/chevre/service/transaction/placeOrder/start.js +18 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +19 -22
- package/lib/chevre/service/transaction/placeOrder.d.ts +1 -2
- package/lib/chevre/service/transaction/placeOrder.js +1 -3
- package/lib/chevre/service/transaction.d.ts +0 -4
- package/lib/chevre/service/transaction.js +1 -1
- package/lib/chevre/service.d.ts +0 -2
- package/lib/chevre/service.js +0 -2
- package/package.json +2 -2
- package/lib/chevre/factory/order.d.ts +0 -2
- package/lib/chevre/factory/order.js +0 -5
- package/lib/chevre/service/order/placeOrderWithoutTransaction.d.ts +0 -22
- package/lib/chevre/service/order/placeOrderWithoutTransaction.js +0 -51
- package/lib/chevre/service/task/deletePerson.d.ts +0 -6
- package/lib/chevre/service/task/deletePerson.js +0 -465
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
|
-
import { ISetting } from './mongoose/schemas/setting';
|
|
3
|
-
type IKeyOfProjection = keyof ISetting
|
|
4
|
-
|
|
2
|
+
import { ISetting, IStorageSettings } from './mongoose/schemas/setting';
|
|
3
|
+
type IKeyOfProjection = Exclude<keyof ISetting, 'jwt' | 'project' | 'waiter' | 'integration'>;
|
|
4
|
+
type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'onEventChanged' | 'onOrderStatusChanged' | 'onReservationStatusChanged' | 'onResourceUpdated' | 'onTaskStatusChanged' | 'orderNumber' | 'quota' | 'serviceOutputIdentifier' | 'storage' | 'transactionNumber' | 'triggerWebhook' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
|
|
5
|
+
export { IGlobalSetting as ISetting };
|
|
5
6
|
/**
|
|
6
7
|
* 設定リポジトリ
|
|
7
8
|
*/
|
|
@@ -15,14 +16,14 @@ export declare class SettingRepo {
|
|
|
15
16
|
$eq?: string;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
|
-
}, inclusion: IKeyOfProjection[]): Promise<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
19
|
+
}, inclusion: IKeyOfProjection[]): Promise<IGlobalSetting | null>;
|
|
20
|
+
/**
|
|
21
|
+
* 初期設定追加専用
|
|
22
|
+
*/
|
|
23
|
+
addGlobalStorageSettings(params: {
|
|
24
|
+
key: keyof IStorageSettings;
|
|
25
|
+
value: number;
|
|
26
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
26
27
|
unsetUnnecessaryFields(params: {
|
|
27
28
|
filter: FilterQuery<ISetting>;
|
|
28
29
|
$unset: any;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SettingRepo = void 0;
|
|
4
|
-
// import { factory } from '../factory';
|
|
5
4
|
const setting_1 = require("./mongoose/schemas/setting");
|
|
6
5
|
/**
|
|
7
6
|
* 設定リポジトリ
|
|
@@ -36,24 +35,13 @@ class SettingRepo {
|
|
|
36
35
|
.lean()
|
|
37
36
|
.exec();
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
/**
|
|
39
|
+
* 初期設定追加専用
|
|
40
|
+
*/
|
|
41
|
+
async addGlobalStorageSettings(params) {
|
|
42
|
+
return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
|
|
42
43
|
$set: {
|
|
43
|
-
|
|
44
|
-
...(onReservationStatusChanged !== undefined) ? { onReservationStatusChanged } : undefined,
|
|
45
|
-
...(onTaskStatusChanged !== undefined) ? { onTaskStatusChanged } : undefined,
|
|
46
|
-
...(onResourceUpdated !== undefined) ? { onResourceUpdated } : undefined,
|
|
47
|
-
...(defaultSenderEmail !== undefined) ? { defaultSenderEmail } : undefined,
|
|
48
|
-
...(useInformResourceTypes !== undefined) ? { useInformResourceTypes } : undefined,
|
|
49
|
-
...(userPoolIdNew !== undefined) ? { userPoolIdNew } : undefined,
|
|
50
|
-
...(userPoolIdOld !== undefined) ? { userPoolIdOld } : undefined,
|
|
51
|
-
...(storage !== undefined) ? { storage } : undefined,
|
|
52
|
-
...(quota !== undefined) ? { quota } : undefined,
|
|
53
|
-
...(triggerWebhook !== undefined) ? { triggerWebhook } : undefined,
|
|
54
|
-
...(waiter !== undefined) ? { waiter } : undefined,
|
|
55
|
-
...(orderNumber !== undefined) ? { orderNumber } : undefined,
|
|
56
|
-
...(transactionNumber !== undefined) ? { transactionNumber } : undefined
|
|
44
|
+
[`storage.${params.key}`]: params.value
|
|
57
45
|
}
|
|
58
46
|
})
|
|
59
47
|
.exec();
|
|
@@ -31,7 +31,7 @@ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
|
|
|
31
31
|
export declare class TaskRepo {
|
|
32
32
|
readonly taskModel: IModel;
|
|
33
33
|
constructor(connection: Connection);
|
|
34
|
-
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/
|
|
34
|
+
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/deleteTransaction").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").ITask>[];
|
|
35
35
|
runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'expires' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
|
|
36
36
|
alternateName?: never;
|
|
37
37
|
identifier?: never;
|
|
@@ -43,12 +43,6 @@ export declare class PlaceOrderRepo {
|
|
|
43
43
|
findInProgressPaymentMethodId(params: {
|
|
44
44
|
id: string;
|
|
45
45
|
}): Promise<factory.transaction.placeOrder.IPaymentMethodByPaymentUrl | undefined>;
|
|
46
|
-
/**
|
|
47
|
-
* 取引の注文番号を検索する
|
|
48
|
-
*/
|
|
49
|
-
findInProgressOrderNumberById(params: {
|
|
50
|
-
id: string;
|
|
51
|
-
}): Promise<string | undefined>;
|
|
52
46
|
/**
|
|
53
47
|
* 取引の確認番号を検索する
|
|
54
48
|
*/
|
|
@@ -130,6 +124,7 @@ export declare class PlaceOrderRepo {
|
|
|
130
124
|
id: string;
|
|
131
125
|
object: {
|
|
132
126
|
orderDate: Date;
|
|
127
|
+
orderNumber: string;
|
|
133
128
|
};
|
|
134
129
|
result: factory.transaction.IResult<factory.transactionType.PlaceOrder>;
|
|
135
130
|
potentialActions: factory.transaction.IPotentialActions<factory.transactionType.PlaceOrder>;
|
|
@@ -122,16 +122,18 @@ class PlaceOrderRepo {
|
|
|
122
122
|
if (Array.isArray(sellerIdIn)) {
|
|
123
123
|
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
125
|
+
// result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
|
|
126
|
+
// const resultOrderNumberIn = params.result?.order?.orderNumbers;
|
|
127
|
+
// if (Array.isArray(resultOrderNumberIn)) {
|
|
128
|
+
// andConditions.push({ 'result.order.orderNumber': { $exists: true, $in: resultOrderNumberIn } });
|
|
129
|
+
// }
|
|
130
|
+
// result.orderは完全に廃止したので検索条件としても廃止(2026-06-26~)
|
|
131
|
+
// const resultOrderConfirmationNumberEq = params.result?.order?.confirmationNumber?.$eq;
|
|
132
|
+
// if (typeof resultOrderConfirmationNumberEq === 'string') {
|
|
133
|
+
// andConditions.push({
|
|
134
|
+
// 'result.order.confirmationNumber': { $exists: true, $eq: resultOrderConfirmationNumberEq }
|
|
135
|
+
// });
|
|
136
|
+
// }
|
|
135
137
|
const objectOrderNumberEq = params.object?.orderNumber?.$eq;
|
|
136
138
|
if (typeof objectOrderNumberEq === 'string') {
|
|
137
139
|
andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
|
|
@@ -200,22 +202,30 @@ class PlaceOrderRepo {
|
|
|
200
202
|
}
|
|
201
203
|
return doc.object.paymentMethods;
|
|
202
204
|
}
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
async findInProgressOrderNumberById(params
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
205
|
+
// /**
|
|
206
|
+
// * 取引の注文番号を検索する
|
|
207
|
+
// */
|
|
208
|
+
// public async findInProgressOrderNumberById(params: {
|
|
209
|
+
// id: string;
|
|
210
|
+
// }): Promise<string | undefined> {
|
|
211
|
+
// const doc = await this.transactionModel.findOne(
|
|
212
|
+
// {
|
|
213
|
+
// _id: { $eq: params.id },
|
|
214
|
+
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
215
|
+
// status: { $eq: factory.transactionStatusType.InProgress }
|
|
216
|
+
// },
|
|
217
|
+
// { 'object.orderNumber': 1 }
|
|
218
|
+
// )
|
|
219
|
+
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'orderNumber'> }>() // 2024-08-26~
|
|
220
|
+
// .exec();
|
|
221
|
+
// if (doc === null) {
|
|
222
|
+
// throw new factory.errors.NotFound(
|
|
223
|
+
// this.transactionModel.modelName,
|
|
224
|
+
// `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
|
|
225
|
+
// );
|
|
226
|
+
// }
|
|
227
|
+
// return doc.object.orderNumber;
|
|
228
|
+
// }
|
|
219
229
|
/**
|
|
220
230
|
* 取引の確認番号を検索する
|
|
221
231
|
*/
|
|
@@ -430,6 +440,7 @@ class PlaceOrderRepo {
|
|
|
430
440
|
status: factory_1.factory.transactionStatusType.Confirmed, // ステータス変更
|
|
431
441
|
endDate,
|
|
432
442
|
'object.orderDate': params.object.orderDate, // add(2026-06-15~)
|
|
443
|
+
'object.orderNumber': params.object.orderNumber, // add(2026-06-27~)
|
|
433
444
|
result: params.result, // resultを更新
|
|
434
445
|
potentialActions: params.potentialActions // resultを更新
|
|
435
446
|
}, {
|
|
@@ -130,7 +130,7 @@ export declare class TransactionRepo {
|
|
|
130
130
|
$lt: Date;
|
|
131
131
|
};
|
|
132
132
|
}): Promise<import("mongodb").DeleteResult>;
|
|
133
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
|
|
133
|
+
getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & (({
|
|
134
134
|
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
135
135
|
error?: any;
|
|
136
136
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
@@ -316,9 +316,9 @@ class TransactionRepo {
|
|
|
316
316
|
})
|
|
317
317
|
.exec();
|
|
318
318
|
}
|
|
319
|
-
getCursor(conditions, projection) {
|
|
319
|
+
getCursor(conditions, projection, sort) {
|
|
320
320
|
return this.transactionModel.find(conditions, projection)
|
|
321
|
-
.sort({ startDate: factory_1.factory.sortType.Descending })
|
|
321
|
+
.sort({ startDate: (sort === factory_1.factory.sortType.Ascending) ? sort : factory_1.factory.sortType.Descending })
|
|
322
322
|
.cursor();
|
|
323
323
|
}
|
|
324
324
|
async aggregatePlaceOrder(params) {
|
|
@@ -81,6 +81,8 @@ import type { ServiceAvailableHourRepo } from './repo/service/availableHour';
|
|
|
81
81
|
import type { SettingRepo } from './repo/setting';
|
|
82
82
|
import type { IntegrationSettingRepo } from './repo/setting/integration';
|
|
83
83
|
import type { JWTSettingRepo } from './repo/setting/jwt';
|
|
84
|
+
import type { RateLimitSettingRepo } from './repo/setting/rateLimit';
|
|
85
|
+
import type { WaiterSettingRepo } from './repo/setting/waiter';
|
|
84
86
|
import type { StockHolderRepo } from './repo/stockHolder';
|
|
85
87
|
import type { TaskRepo } from './repo/task';
|
|
86
88
|
import type { TicketRepo } from './repo/ticket';
|
|
@@ -446,6 +448,14 @@ export declare namespace setting {
|
|
|
446
448
|
namespace JWT {
|
|
447
449
|
function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
|
|
448
450
|
}
|
|
451
|
+
type RateLimit = RateLimitSettingRepo;
|
|
452
|
+
namespace RateLimit {
|
|
453
|
+
function createInstance(...params: ConstructorParameters<typeof RateLimitSettingRepo>): Promise<RateLimitSettingRepo>;
|
|
454
|
+
}
|
|
455
|
+
type Waiter = WaiterSettingRepo;
|
|
456
|
+
namespace Waiter {
|
|
457
|
+
function createInstance(...params: ConstructorParameters<typeof WaiterSettingRepo>): Promise<WaiterSettingRepo>;
|
|
458
|
+
}
|
|
449
459
|
}
|
|
450
460
|
export type StockHolder = StockHolderRepo;
|
|
451
461
|
export declare namespace StockHolder {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -933,6 +933,28 @@ var setting;
|
|
|
933
933
|
}
|
|
934
934
|
JWT.createInstance = createInstance;
|
|
935
935
|
})(JWT = setting.JWT || (setting.JWT = {}));
|
|
936
|
+
let RateLimit;
|
|
937
|
+
(function (RateLimit) {
|
|
938
|
+
let repo;
|
|
939
|
+
async function createInstance(...params) {
|
|
940
|
+
if (repo === undefined) {
|
|
941
|
+
repo = (await import('./repo/setting/rateLimit.js')).RateLimitSettingRepo;
|
|
942
|
+
}
|
|
943
|
+
return new repo(...params);
|
|
944
|
+
}
|
|
945
|
+
RateLimit.createInstance = createInstance;
|
|
946
|
+
})(RateLimit = setting.RateLimit || (setting.RateLimit = {}));
|
|
947
|
+
let Waiter;
|
|
948
|
+
(function (Waiter) {
|
|
949
|
+
let repo;
|
|
950
|
+
async function createInstance(...params) {
|
|
951
|
+
if (repo === undefined) {
|
|
952
|
+
repo = (await import('./repo/setting/waiter.js')).WaiterSettingRepo;
|
|
953
|
+
}
|
|
954
|
+
return new repo(...params);
|
|
955
|
+
}
|
|
956
|
+
Waiter.createInstance = createInstance;
|
|
957
|
+
})(Waiter = setting.Waiter || (setting.Waiter = {}));
|
|
936
958
|
})(setting || (exports.setting = setting = {}));
|
|
937
959
|
var StockHolder;
|
|
938
960
|
(function (StockHolder) {
|
|
@@ -15,7 +15,6 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
|
15
15
|
import { SeatRepo } from '../../../repo/place/seat';
|
|
16
16
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
17
17
|
import type { ProductRepo } from '../../../repo/product';
|
|
18
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
19
18
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
20
19
|
import type { SettingRepo } from '../../../repo/setting';
|
|
21
20
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
@@ -37,7 +36,6 @@ interface IStartOperationRepos {
|
|
|
37
36
|
paymentService: PaymentServiceRepo;
|
|
38
37
|
product: ProductRepo;
|
|
39
38
|
priceSpecification: PriceSpecificationRepo;
|
|
40
|
-
project: ProjectRepo;
|
|
41
39
|
seat: SeatRepo;
|
|
42
40
|
setting: SettingRepo;
|
|
43
41
|
task: TaskRepo;
|
|
@@ -6,13 +6,11 @@ interface IAcceptOfferOperationRepos {
|
|
|
6
6
|
type IAcceptOfferOperation<T> = (repos: IAcceptOfferOperationRepos) => Promise<T>;
|
|
7
7
|
export type IAuthorizeActionWithInstrument = Pick<factory.action.authorize.offer.eventService.IAction, 'instrument'>;
|
|
8
8
|
export declare function acceptOffer(params: {
|
|
9
|
-
orderNumber: string;
|
|
10
9
|
project: {
|
|
11
10
|
id: string;
|
|
12
11
|
};
|
|
13
12
|
placeOrderId: string;
|
|
14
13
|
acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
|
|
15
|
-
broker?: factory.order.IBroker;
|
|
16
14
|
}): IAcceptOfferOperation<void>;
|
|
17
15
|
export declare function voidAcceptedOffer(params: {
|
|
18
16
|
/**
|
|
@@ -22,7 +20,7 @@ export declare function voidAcceptedOffer(params: {
|
|
|
22
20
|
* instrument.serialNumberからvoidする場合に指定
|
|
23
21
|
*/
|
|
24
22
|
authorizeActionsWithInstrument: IAuthorizeActionWithInstrument[];
|
|
25
|
-
|
|
23
|
+
placeOrderId: string;
|
|
26
24
|
}): (repos: {
|
|
27
25
|
orderInTransaction: OrderInTransactionRepo;
|
|
28
26
|
}) => Promise<void>;
|
|
@@ -10,18 +10,16 @@ const factory_1 = require("../../factory");
|
|
|
10
10
|
const debug = (0, debug_1.default)('chevre-domain:service:offer');
|
|
11
11
|
function acceptOffer(params) {
|
|
12
12
|
return async (repos) => {
|
|
13
|
-
await repos.orderInTransaction.
|
|
14
|
-
orderNumber: params.orderNumber,
|
|
13
|
+
await repos.orderInTransaction.acceptOfferByIdentifier({
|
|
15
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
16
15
|
identifier: params.placeOrderId,
|
|
17
|
-
acceptedOffers: params.acceptedOffers
|
|
18
|
-
...((params.broker !== undefined) && { broker: params.broker })
|
|
16
|
+
acceptedOffers: params.acceptedOffers
|
|
19
17
|
});
|
|
20
18
|
};
|
|
21
19
|
}
|
|
22
20
|
function voidAcceptedOffer(params) {
|
|
23
21
|
return async (repos) => {
|
|
24
|
-
const {
|
|
22
|
+
const { placeOrderId } = params;
|
|
25
23
|
// let reservationNumbers: string[] = [];
|
|
26
24
|
// authorizeActions.forEach((authorizeAction) => {
|
|
27
25
|
// const reserveTransactionNumberByAction = authorizeAction.object.pendingTransaction?.transactionNumber;
|
|
@@ -42,10 +40,11 @@ function voidAcceptedOffer(params) {
|
|
|
42
40
|
const serialNumbers = params.authorizeActionsWithInstrument
|
|
43
41
|
.filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
|
|
44
42
|
.map(({ instrument }) => String(instrument.transactionNumber));
|
|
45
|
-
debug('removing acceptedOffers from PlaceOrder...',
|
|
43
|
+
debug('removing acceptedOffers from PlaceOrder...', placeOrderId, 'serialNumbers:', serialNumbers);
|
|
46
44
|
if (serialNumbers.length > 0) {
|
|
47
|
-
const result = await repos.orderInTransaction.
|
|
48
|
-
orderNumber,
|
|
45
|
+
const result = await repos.orderInTransaction.voidAcceptedOfferByIdentifier({
|
|
46
|
+
// orderNumber,
|
|
47
|
+
identifier: placeOrderId,
|
|
49
48
|
acceptedOffers: { serialNumber: { $in: serialNumbers } }
|
|
50
49
|
});
|
|
51
50
|
debug('acceptedOffers removed from PlaceOrder by serialNumbers.', result);
|
|
@@ -15,7 +15,6 @@ import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
|
15
15
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
16
16
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
17
17
|
import type { ProductRepo } from '../../../../repo/product';
|
|
18
|
-
import type { ProjectRepo } from '../../../../repo/project';
|
|
19
18
|
import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
|
|
20
19
|
import type { SettingRepo } from '../../../../repo/setting';
|
|
21
20
|
import type { StockHolderRepo } from '../../../../repo/stockHolder';
|
|
@@ -63,7 +62,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
63
62
|
paymentService: PaymentServiceRepo;
|
|
64
63
|
product: ProductRepo;
|
|
65
64
|
priceSpecification: PriceSpecificationRepo;
|
|
66
|
-
project: ProjectRepo;
|
|
67
65
|
seat: SeatRepo;
|
|
68
66
|
setting: SettingRepo;
|
|
69
67
|
task: TaskRepo;
|
|
@@ -13,12 +13,10 @@ import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
|
13
13
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
14
14
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
15
15
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
16
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
17
16
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
18
17
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
19
18
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
20
19
|
import type { ProductRepo } from '../../../repo/product';
|
|
21
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
22
20
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
23
21
|
import type { SettingRepo } from '../../../repo/setting';
|
|
24
22
|
import type { StockHolderRepo } from '../../../repo/stockHolder';
|
|
@@ -43,11 +41,9 @@ interface IAuthorizeRepos {
|
|
|
43
41
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
44
42
|
offerRateLimit: OfferRateLimitRepo;
|
|
45
43
|
orderInTransaction: OrderInTransactionRepo;
|
|
46
|
-
orderNumber: OrderNumberRepo;
|
|
47
44
|
paymentService: PaymentServiceRepo;
|
|
48
45
|
priceSpecification: PriceSpecificationRepo;
|
|
49
46
|
product: ProductRepo;
|
|
50
|
-
project: ProjectRepo;
|
|
51
47
|
seat: SeatRepo;
|
|
52
48
|
setting: SettingRepo;
|
|
53
49
|
task: TaskRepo;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authorize = authorize;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
-
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
6
5
|
const any_1 = require("../any");
|
|
7
6
|
const defaultOffer_1 = require("./authorize/defaultOffer");
|
|
8
7
|
const factory_2 = require("./authorize/factory");
|
|
@@ -25,11 +24,11 @@ function authorize(params, options) {
|
|
|
25
24
|
})(repos);
|
|
26
25
|
let acceptedOffers4result;
|
|
27
26
|
const now = new Date();
|
|
28
|
-
|
|
27
|
+
// 注文ドキュメントを参照(2026-06-24~)
|
|
28
|
+
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
29
|
+
identifier: transaction.id,
|
|
29
30
|
project: { id: params.project.id },
|
|
30
|
-
|
|
31
|
-
object: { orderDate: now }
|
|
32
|
-
})(repos);
|
|
31
|
+
}, { onlyPlaceOrder: true });
|
|
33
32
|
// まず取引番号発行
|
|
34
33
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: now });
|
|
35
34
|
const actionAttributes = (0, factory_2.createAuthorizeSeatReservationActionAttributes)({
|
|
@@ -64,11 +63,9 @@ function authorize(params, options) {
|
|
|
64
63
|
};
|
|
65
64
|
});
|
|
66
65
|
await (0, any_1.acceptOffer)({
|
|
67
|
-
orderNumber,
|
|
68
66
|
project: transaction.project,
|
|
69
67
|
placeOrderId: transaction.id,
|
|
70
|
-
acceptedOffers: minimizedAcceptedOffers
|
|
71
|
-
...((typeof params.object.broker?.typeOf === 'string') && { broker: params.object.broker })
|
|
68
|
+
acceptedOffers: minimizedAcceptedOffers
|
|
72
69
|
})(repos);
|
|
73
70
|
}
|
|
74
71
|
}
|
|
@@ -48,23 +48,35 @@ function voidTransaction(params) {
|
|
|
48
48
|
default:
|
|
49
49
|
// no op
|
|
50
50
|
}
|
|
51
|
-
// add orderInTransaction(2024-01-15~)
|
|
52
|
-
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
53
|
-
const orderNumberByTransaction = transaction.object.orderNumber;
|
|
54
|
-
if (typeof orderNumberByTransaction === 'string') {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
// // add orderInTransaction(2024-01-15~)
|
|
52
|
+
// // USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
53
|
+
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
54
|
+
// if (typeof orderNumberByTransaction === 'string') {
|
|
55
|
+
// switch (transaction.status) {
|
|
56
|
+
// case factory.transactionStatusType.Confirmed:
|
|
57
|
+
// // 確定取引の場合、不要なオファーのみ除外
|
|
58
|
+
// await voidAcceptedOffer({
|
|
59
|
+
// // authorizeActions,
|
|
60
|
+
// authorizeActionsWithInstrument: authorizeActions,
|
|
61
|
+
// orderNumber: orderNumberByTransaction
|
|
62
|
+
// })(repos);
|
|
63
|
+
// break;
|
|
64
|
+
// default:
|
|
65
|
+
// // orderInTransaction自体を削除
|
|
66
|
+
// await repos.orderInTransaction.deleteByOrderNumber({ orderNumber: orderNumberByTransaction });
|
|
67
|
+
// }
|
|
68
|
+
// }
|
|
69
|
+
switch (transaction.status) {
|
|
70
|
+
case factory_1.factory.transactionStatusType.Confirmed:
|
|
71
|
+
// 確定取引の場合、不要なオファーのみ除外
|
|
72
|
+
await (0, any_1.voidAcceptedOffer)({
|
|
73
|
+
authorizeActionsWithInstrument: authorizeActions,
|
|
74
|
+
placeOrderId: params.purpose.id
|
|
75
|
+
})(repos);
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
// orderInTransaction自体を削除
|
|
79
|
+
await repos.orderInTransaction.deleteByIdentifier({ identifier: params.purpose.id });
|
|
68
80
|
}
|
|
69
81
|
await Promise.all(authorizeActions.map(async (action) => {
|
|
70
82
|
await repos.authorizeOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
|
|
@@ -26,7 +26,7 @@ function voidTransactionByActionId(params) {
|
|
|
26
26
|
// if (transaction.agent.id !== params.agent.id) {
|
|
27
27
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
28
28
|
// }
|
|
29
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
29
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
30
30
|
const action = await repos.authorizeOfferAction.findById({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id });
|
|
31
31
|
if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
|
|
32
32
|
throw new factory_1.factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -34,17 +34,21 @@ function voidTransactionByActionId(params) {
|
|
|
34
34
|
// MongoDBでcompleteステータスであるにも関わらず、Chevreでは削除されている、というのが最悪の状況
|
|
35
35
|
// それだけは回避するためにMongoDBを先に変更
|
|
36
36
|
await repos.authorizeOfferAction.cancelWithVoid({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id, cancelAction });
|
|
37
|
-
// add orderInTransaction(2024-01-15~)
|
|
38
|
-
// USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
39
|
-
// const orderNumberByTransaction = transaction.object.orderNumber;
|
|
40
|
-
const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
41
|
-
if (typeof orderNumberByTransaction === 'string') {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
37
|
+
// // add orderInTransaction(2024-01-15~)
|
|
38
|
+
// // USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
|
|
39
|
+
// // const orderNumberByTransaction = transaction.object.orderNumber;
|
|
40
|
+
// const orderNumberByTransaction = orderNumber; // transaction.objectへのアクセス回避(2024-05-30~)
|
|
41
|
+
// if (typeof orderNumberByTransaction === 'string') {
|
|
42
|
+
// await voidAcceptedOffer({
|
|
43
|
+
// // authorizeActions: [action],
|
|
44
|
+
// authorizeActionsWithInstrument: [action],
|
|
45
|
+
// orderNumber: orderNumberByTransaction
|
|
46
|
+
// })(repos);
|
|
47
|
+
// }
|
|
48
|
+
await (0, any_1.voidAcceptedOffer)({
|
|
49
|
+
authorizeActionsWithInstrument: [action],
|
|
50
|
+
placeOrderId: params.purpose.id
|
|
51
|
+
})(repos);
|
|
48
52
|
switch (action.instrument.typeOf) {
|
|
49
53
|
case factory_1.factory.assetTransactionType.COAReserveTransaction: {
|
|
50
54
|
const { reserveService } = repos;
|
|
@@ -2,15 +2,11 @@ import type { COA } from '@motionpicture/coa-service';
|
|
|
2
2
|
import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
|
|
3
3
|
import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
|
|
4
4
|
import type { EventRepo } from '../../../repo/event';
|
|
5
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
6
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
7
5
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
8
6
|
import { factory } from '../../../factory';
|
|
9
7
|
interface IAcceptRepos {
|
|
10
8
|
action: AcceptCOAOfferActionRepo;
|
|
11
9
|
event: EventRepo;
|
|
12
|
-
orderNumber: OrderNumberRepo;
|
|
13
|
-
project: ProjectRepo;
|
|
14
10
|
placeOrder: PlaceOrderRepo;
|
|
15
11
|
reserveService: COA.service.Reserve;
|
|
16
12
|
masterService: COA.service.Master;
|
|
@@ -19,8 +15,6 @@ interface IReAcceptRepos {
|
|
|
19
15
|
action: AcceptCOAOfferActionRepo;
|
|
20
16
|
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
21
17
|
event: EventRepo;
|
|
22
|
-
orderNumber: OrderNumberRepo;
|
|
23
|
-
project: ProjectRepo;
|
|
24
18
|
placeOrder: PlaceOrderRepo;
|
|
25
19
|
reserveService: COA.service.Reserve;
|
|
26
20
|
masterService: COA.service.Master;
|
|
@@ -4,7 +4,6 @@ exports.acceptOffer = acceptOffer;
|
|
|
4
4
|
exports.reAcceptOffer = reAcceptOffer;
|
|
5
5
|
const errorHandler_1 = require("../../../errorHandler");
|
|
6
6
|
const factory_1 = require("../../../factory");
|
|
7
|
-
const issueOrderNumberIfNotExist_1 = require("../../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
8
7
|
const authorize_1 = require("./acceptOffer/authorize");
|
|
9
8
|
const factory_2 = require("./acceptOffer/factory");
|
|
10
9
|
function findCOAInfo(params) {
|
|
@@ -39,12 +38,11 @@ function acceptOffer(params) {
|
|
|
39
38
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
40
39
|
id: params.purpose.id
|
|
41
40
|
}, ['project', 'agent', 'typeOf']);
|
|
42
|
-
//
|
|
43
|
-
await
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})(repos);
|
|
41
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
42
|
+
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
43
|
+
// identifier: transaction.id,
|
|
44
|
+
// project: { id: transaction.project.id },
|
|
45
|
+
// });
|
|
48
46
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
49
47
|
const updTmpReserveSeatArgs = (0, factory_2.createUpdTmpReserveSeatArgs)({ object: params.object, coaInfo });
|
|
50
48
|
let updTmpReserveSeatResult;
|
|
@@ -125,11 +123,11 @@ function reAcceptOffer(params) {
|
|
|
125
123
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
126
124
|
id: params.purpose.id
|
|
127
125
|
}, ['project', 'agent', 'typeOf']);
|
|
128
|
-
const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
129
|
-
if (typeof orderNumber !== 'string') {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
126
|
+
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
127
|
+
// if (typeof orderNumber !== 'string') {
|
|
128
|
+
// // 事前に発行されているはず
|
|
129
|
+
// throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
130
|
+
// }
|
|
133
131
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
134
132
|
// 承認アクション存在検証
|
|
135
133
|
await repos.authorizeOfferAction.findById({ id: params.potentialActions.id, typeOf: factory_1.factory.actionType.AuthorizeAction }, ['id'], []);
|
|
@@ -32,7 +32,7 @@ export declare function responseBody2acceptedOffers4result(params: {
|
|
|
32
32
|
responseBody: IResponseBody;
|
|
33
33
|
acceptedOffer: IAcceptedOffer4COA[];
|
|
34
34
|
event: Pick<IMinimizedIndividualEvent, 'coaInfo' | 'doorTime' | 'endDate' | 'id' | 'location' | 'startDate' | 'superEvent' | 'typeOf' | 'identifier' | 'name'>;
|
|
35
|
-
seller
|
|
35
|
+
seller?: never;
|
|
36
36
|
bookingTime: Date;
|
|
37
37
|
totalPrice: number;
|
|
38
38
|
}): IResultAcceptedOffer[];
|