@chevre/domain 25.0.0-alpha.8 → 25.0.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.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +11 -110
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +7 -15
- package/lib/chevre/repo/mongoose/schemas/setting.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.js +51 -50
- package/lib/chevre/repo/order.d.ts +3 -7
- package/lib/chevre/repo/order.js +56 -26
- package/lib/chevre/repo/orderInTransaction.d.ts +45 -22
- package/lib/chevre/repo/orderInTransaction.js +108 -77
- package/lib/chevre/repo/orderNumber.d.ts +4 -0
- package/lib/chevre/repo/orderNumber.js +32 -60
- package/lib/chevre/repo/passport.d.ts +5 -2
- 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 +5 -0
- package/lib/chevre/repository.js +11 -0
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/offer/any.d.ts +2 -3
- package/lib/chevre/service/offer/any.js +8 -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 +6 -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 +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +21 -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 +20 -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
|
@@ -17,36 +17,25 @@ const ORDER_NUMBER_SEPARATOR = '-';
|
|
|
17
17
|
class OrderNumberRepo {
|
|
18
18
|
counterRepo;
|
|
19
19
|
settingModel;
|
|
20
|
+
// static にすることで、クラスが何回 new されてもメモリ上で1つだけ保持される
|
|
21
|
+
static cachedSettings;
|
|
22
|
+
static cacheExpiry = 0;
|
|
23
|
+
static CACHE_TTL_MS = 10 * 60 * 1000; // 10分
|
|
20
24
|
constructor(params) {
|
|
21
25
|
this.counterRepo = new transactionNumberCounter_1.TransactionNumberCounterRepo(params);
|
|
22
26
|
this.settingModel = params.connection.model(setting_1.modelName, (0, setting_1.createSchema)());
|
|
23
27
|
}
|
|
24
|
-
// public static GENERATE_VERSION0(timestamp: string, seq: number): string {
|
|
25
|
-
// let orderNumber = `${timestamp}${seq}`;
|
|
26
|
-
// // checkdigit
|
|
27
|
-
// const cd = cdigit.luhn.compute(orderNumber);
|
|
28
|
-
// orderNumber = fpe({ password: cd })
|
|
29
|
-
// .encrypt(orderNumber);
|
|
30
|
-
// orderNumber = `${cd}${orderNumber}`;
|
|
31
|
-
// return orderNumber;
|
|
32
|
-
// }
|
|
33
28
|
/**
|
|
34
29
|
* 注文日時から新しい注文番号を発行する
|
|
35
30
|
* グローバルユニークである前提
|
|
36
31
|
*/
|
|
37
32
|
async issueOrderNumber(params) {
|
|
38
|
-
const { fpeSecret, version
|
|
39
|
-
// versioningForceProjects
|
|
40
|
-
// versioningExceptionProjects
|
|
41
|
-
} = await this.findSetting();
|
|
33
|
+
const { fpeSecret, version } = await this.findSetting();
|
|
42
34
|
const timestamp = (0, moment_timezone_1.default)(params.orderDate)
|
|
43
35
|
.valueOf()
|
|
44
36
|
.toString();
|
|
45
|
-
// const projectPrefix = params.project.alternateName
|
|
46
|
-
// .toUpperCase();
|
|
47
37
|
const projectPrefix = params.project.alternateName
|
|
48
38
|
.toUpperCase().at(0);
|
|
49
|
-
// const dataFeedIdentifier = `${projectPrefix}:${timestamp}`;
|
|
50
39
|
const dataFeedIdentifier = timestamp; // reconsider increment scope(2026-02-21~)
|
|
51
40
|
const dataFeedExpires = (0, moment_timezone_1.default)(params.orderDate)
|
|
52
41
|
.add(1, 'minute') // ミリ秒でカウントしていくので、注文日時後1分で十分
|
|
@@ -57,32 +46,16 @@ class OrderNumberRepo {
|
|
|
57
46
|
expires: dataFeedExpires
|
|
58
47
|
});
|
|
59
48
|
let orderNumber;
|
|
60
|
-
const useVersioning = (validFrom instanceof Date && (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
orderNumber
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
].join(ORDER_NUMBER_SEPARATOR)}`;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
// discontinue version0(2026-02-13~)
|
|
74
|
-
throw new factory_1.factory.errors.NotImplemented('orderNumber with no version discontinued');
|
|
75
|
-
// orderNumber = OrderNumberRepo.GENERATE_VERSION0(timestamp, incrReply);
|
|
76
|
-
// orderNumber = `${projectPrefix}${orderNumber}`;
|
|
77
|
-
// orderNumber = `${[
|
|
78
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
79
|
-
// orderNumber.slice(0, 4),
|
|
80
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
81
|
-
// orderNumber.slice(4, 11),
|
|
82
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
83
|
-
// orderNumber.slice(11)
|
|
84
|
-
// ].join(ORDER_NUMBER_SEPARATOR)}`;
|
|
85
|
-
}
|
|
49
|
+
// const useVersioning: boolean = (validFrom instanceof Date && moment(validFrom)
|
|
50
|
+
// .isSameOrBefore(params.orderDate));
|
|
51
|
+
const transactionFactory = new transactionNumber_1.TransactionNumberFactory({ fpeSecret, version });
|
|
52
|
+
orderNumber = transactionFactory.generate(timestamp, incrReply);
|
|
53
|
+
orderNumber = `${projectPrefix}${orderNumber}`; // 桁数をversion0に合わせるためにエイリアスの1文字目のみを採用
|
|
54
|
+
orderNumber = `${[
|
|
55
|
+
orderNumber.slice(0, 4),
|
|
56
|
+
orderNumber.slice(4, 11),
|
|
57
|
+
orderNumber.slice(11)
|
|
58
|
+
].join(ORDER_NUMBER_SEPARATOR)}`;
|
|
86
59
|
return orderNumber;
|
|
87
60
|
}
|
|
88
61
|
async decrypt(id) {
|
|
@@ -97,41 +70,40 @@ class OrderNumberRepo {
|
|
|
97
70
|
throw new factory_1.factory.errors.NotImplemented('no version not implemented');
|
|
98
71
|
}
|
|
99
72
|
}
|
|
73
|
+
clearSettingCache() {
|
|
74
|
+
OrderNumberRepo.cacheExpiry = 0;
|
|
75
|
+
OrderNumberRepo.cachedSettings = undefined;
|
|
76
|
+
}
|
|
100
77
|
/**
|
|
101
78
|
* 注文番号生成設定を検索する
|
|
102
79
|
*/
|
|
103
80
|
async findSetting() {
|
|
81
|
+
const now = Date.now();
|
|
82
|
+
// キャッシュ参照(2026-06-22~)
|
|
83
|
+
if (OrderNumberRepo.cachedSettings !== undefined && now < OrderNumberRepo.cacheExpiry) {
|
|
84
|
+
return OrderNumberRepo.cachedSettings;
|
|
85
|
+
}
|
|
104
86
|
const filterQuery = { 'project.id': { $eq: '*' } };
|
|
105
|
-
const
|
|
87
|
+
const setting = await this.settingModel.findOne(filterQuery, {
|
|
106
88
|
_id: 0,
|
|
107
89
|
orderNumber: 1
|
|
108
|
-
}
|
|
109
|
-
const setting = await this.settingModel.findOne(filterQuery, projection)
|
|
90
|
+
})
|
|
110
91
|
.lean()
|
|
111
92
|
.exec();
|
|
112
93
|
if (setting === null || setting.orderNumber === undefined) {
|
|
113
|
-
|
|
114
|
-
// versioningForceProjects: []
|
|
115
|
-
// versioningExceptionProjects: []
|
|
116
|
-
};
|
|
94
|
+
throw new factory_1.factory.errors.NotFound('setting.orderNumber');
|
|
117
95
|
}
|
|
118
|
-
const { fpeSecret, version
|
|
96
|
+
const { fpeSecret, version } = setting.orderNumber;
|
|
119
97
|
if (typeof fpeSecret !== 'string' || fpeSecret === '') {
|
|
120
98
|
throw new factory_1.factory.errors.NotFound('setting.orderNumber.secret');
|
|
121
99
|
}
|
|
122
100
|
if (typeof version !== 'string' || version === '') {
|
|
123
101
|
throw new factory_1.factory.errors.NotFound('setting.orderNumber.version');
|
|
124
102
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
fpeSecret, version, validFrom
|
|
130
|
-
// versioningForceProjects: [
|
|
131
|
-
// ...(Array.isArray(versioningForceProjects)) ? versioningForceProjects : []
|
|
132
|
-
// ]
|
|
133
|
-
// versioningExceptionProjects: (Array.isArray(versioningExceptionProjects)) ? versioningExceptionProjects : []
|
|
134
|
-
};
|
|
103
|
+
// キャッシュを更新
|
|
104
|
+
OrderNumberRepo.cachedSettings = { fpeSecret, version };
|
|
105
|
+
OrderNumberRepo.cacheExpiry = now + OrderNumberRepo.CACHE_TTL_MS;
|
|
106
|
+
return OrderNumberRepo.cachedSettings;
|
|
135
107
|
}
|
|
136
108
|
}
|
|
137
109
|
exports.OrderNumberRepo = OrderNumberRepo;
|
|
@@ -20,7 +20,6 @@ interface IOptions {
|
|
|
20
20
|
secret: string;
|
|
21
21
|
passportValidator?: IPassportValidator;
|
|
22
22
|
}
|
|
23
|
-
type IStartParams = (factory.transaction.placeOrder.IStartParamsWithoutDetail) & {};
|
|
24
23
|
/**
|
|
25
24
|
* 取引許可証リポジトリ
|
|
26
25
|
*/
|
|
@@ -34,7 +33,11 @@ export declare class PassportRepo {
|
|
|
34
33
|
/**
|
|
35
34
|
* 許可証トークンがあれば検証する
|
|
36
35
|
*/
|
|
37
|
-
validatePassportTokenIfExist(params:
|
|
36
|
+
validatePassportTokenIfExist(params: {
|
|
37
|
+
object?: {
|
|
38
|
+
passport?: factory.transaction.IPassportBeforeStart;
|
|
39
|
+
};
|
|
40
|
+
}): Promise<{
|
|
38
41
|
passport?: IVerifiedPassport;
|
|
39
42
|
customerType?: string;
|
|
40
43
|
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { IWaiterSettings } from '../mongoose/schemas/setting';
|
|
3
|
+
interface IDBOptions {
|
|
4
|
+
connection: Connection;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 流入制限設定リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
export declare class WaiterSettingRepo {
|
|
10
|
+
private readonly settingModel;
|
|
11
|
+
private static cachedSettings;
|
|
12
|
+
private static cacheExpiry;
|
|
13
|
+
private static readonly CACHE_TTL_MS;
|
|
14
|
+
constructor(options: IDBOptions);
|
|
15
|
+
findWaiterSetting(): Promise<IWaiterSettings | undefined>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WaiterSettingRepo = void 0;
|
|
4
|
+
const setting_1 = require("../mongoose/schemas/setting");
|
|
5
|
+
/**
|
|
6
|
+
* 流入制限設定リポジトリ
|
|
7
|
+
*/
|
|
8
|
+
class WaiterSettingRepo {
|
|
9
|
+
settingModel;
|
|
10
|
+
// static にすることで、クラスが何回 new されてもメモリ上で1つだけ保持される
|
|
11
|
+
static cachedSettings;
|
|
12
|
+
static cacheExpiry = 0;
|
|
13
|
+
static CACHE_TTL_MS = 10 * 60 * 1000; // 10分
|
|
14
|
+
constructor(options) {
|
|
15
|
+
const { connection } = options;
|
|
16
|
+
this.settingModel = connection.model(setting_1.modelName, (0, setting_1.createSchema)());
|
|
17
|
+
}
|
|
18
|
+
async findWaiterSetting() {
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
// キャッシュ参照
|
|
21
|
+
if (WaiterSettingRepo.cachedSettings !== undefined && now < WaiterSettingRepo.cacheExpiry) {
|
|
22
|
+
return WaiterSettingRepo.cachedSettings;
|
|
23
|
+
}
|
|
24
|
+
const settingDoc = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, {
|
|
25
|
+
_id: 0,
|
|
26
|
+
waiter: 1
|
|
27
|
+
})
|
|
28
|
+
.lean()
|
|
29
|
+
.exec();
|
|
30
|
+
// キャッシュを更新
|
|
31
|
+
if (settingDoc?.waiter !== undefined) {
|
|
32
|
+
console.log('document exist!', settingDoc);
|
|
33
|
+
WaiterSettingRepo.cachedSettings = settingDoc.waiter;
|
|
34
|
+
WaiterSettingRepo.cacheExpiry = now + WaiterSettingRepo.CACHE_TTL_MS;
|
|
35
|
+
}
|
|
36
|
+
return WaiterSettingRepo.cachedSettings;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.WaiterSettingRepo = WaiterSettingRepo;
|
|
@@ -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,7 @@ 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 { WaiterSettingRepo } from './repo/setting/waiter';
|
|
84
85
|
import type { StockHolderRepo } from './repo/stockHolder';
|
|
85
86
|
import type { TaskRepo } from './repo/task';
|
|
86
87
|
import type { TicketRepo } from './repo/ticket';
|
|
@@ -446,6 +447,10 @@ export declare namespace setting {
|
|
|
446
447
|
namespace JWT {
|
|
447
448
|
function createInstance(...params: ConstructorParameters<typeof JWTSettingRepo>): Promise<JWTSettingRepo>;
|
|
448
449
|
}
|
|
450
|
+
type Waiter = WaiterSettingRepo;
|
|
451
|
+
namespace Waiter {
|
|
452
|
+
function createInstance(...params: ConstructorParameters<typeof WaiterSettingRepo>): Promise<WaiterSettingRepo>;
|
|
453
|
+
}
|
|
449
454
|
}
|
|
450
455
|
export type StockHolder = StockHolderRepo;
|
|
451
456
|
export declare namespace StockHolder {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -933,6 +933,17 @@ var setting;
|
|
|
933
933
|
}
|
|
934
934
|
JWT.createInstance = createInstance;
|
|
935
935
|
})(JWT = setting.JWT || (setting.JWT = {}));
|
|
936
|
+
let Waiter;
|
|
937
|
+
(function (Waiter) {
|
|
938
|
+
let repo;
|
|
939
|
+
async function createInstance(...params) {
|
|
940
|
+
if (repo === undefined) {
|
|
941
|
+
repo = (await import('./repo/setting/waiter.js')).WaiterSettingRepo;
|
|
942
|
+
}
|
|
943
|
+
return new repo(...params);
|
|
944
|
+
}
|
|
945
|
+
Waiter.createInstance = createInstance;
|
|
946
|
+
})(Waiter = setting.Waiter || (setting.Waiter = {}));
|
|
936
947
|
})(setting || (exports.setting = setting = {}));
|
|
937
948
|
var StockHolder;
|
|
938
949
|
(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,12 +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
|
};
|
|
12
|
+
placeOrderId: string;
|
|
13
13
|
acceptedOffers: IMinimizedAcceptedOffer[] | factory.order.ICOAAcceptedOffer[];
|
|
14
|
-
broker?: factory.order.IBroker;
|
|
15
14
|
}): IAcceptOfferOperation<void>;
|
|
16
15
|
export declare function voidAcceptedOffer(params: {
|
|
17
16
|
/**
|
|
@@ -21,7 +20,7 @@ export declare function voidAcceptedOffer(params: {
|
|
|
21
20
|
* instrument.serialNumberからvoidする場合に指定
|
|
22
21
|
*/
|
|
23
22
|
authorizeActionsWithInstrument: IAuthorizeActionWithInstrument[];
|
|
24
|
-
|
|
23
|
+
placeOrderId: string;
|
|
25
24
|
}): (repos: {
|
|
26
25
|
orderInTransaction: OrderInTransactionRepo;
|
|
27
26
|
}) => Promise<void>;
|
|
@@ -10,17 +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
|
-
|
|
17
|
-
|
|
15
|
+
identifier: params.placeOrderId,
|
|
16
|
+
acceptedOffers: params.acceptedOffers
|
|
18
17
|
});
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
20
|
function voidAcceptedOffer(params) {
|
|
22
21
|
return async (repos) => {
|
|
23
|
-
const {
|
|
22
|
+
const { placeOrderId } = params;
|
|
24
23
|
// let reservationNumbers: string[] = [];
|
|
25
24
|
// authorizeActions.forEach((authorizeAction) => {
|
|
26
25
|
// const reserveTransactionNumberByAction = authorizeAction.object.pendingTransaction?.transactionNumber;
|
|
@@ -41,10 +40,11 @@ function voidAcceptedOffer(params) {
|
|
|
41
40
|
const serialNumbers = params.authorizeActionsWithInstrument
|
|
42
41
|
.filter(({ instrument }) => typeof instrument.transactionNumber === 'string')
|
|
43
42
|
.map(({ instrument }) => String(instrument.transactionNumber));
|
|
44
|
-
debug('removing acceptedOffers from PlaceOrder...',
|
|
43
|
+
debug('removing acceptedOffers from PlaceOrder...', placeOrderId, 'serialNumbers:', serialNumbers);
|
|
45
44
|
if (serialNumbers.length > 0) {
|
|
46
|
-
const result = await repos.orderInTransaction.
|
|
47
|
-
orderNumber,
|
|
45
|
+
const result = await repos.orderInTransaction.voidAcceptedOfferByIdentifier({
|
|
46
|
+
// orderNumber,
|
|
47
|
+
identifier: placeOrderId,
|
|
48
48
|
acceptedOffers: { serialNumber: { $in: serialNumbers } }
|
|
49
49
|
});
|
|
50
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;
|