@chevre/domain 28.0.0-alpha.2 → 28.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/eventEmitter/transaction.d.ts +2 -2
- package/lib/chevre/eventEmitter/transaction.js +1 -1
- package/lib/chevre/repo/adminTransaction.d.ts +35 -29
- package/lib/chevre/repo/adminTransaction.js +0 -98
- package/lib/chevre/repo/aggregateTransaction.d.ts +0 -1
- package/lib/chevre/repo/aggregateTransaction.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +2 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +39 -27
- package/lib/chevre/repo/orderInTransaction.js +0 -6
- package/lib/chevre/repo/transaction/placeOrder.d.ts +6 -11
- package/lib/chevre/repo/transaction/placeOrder.js +38 -110
- package/lib/chevre/repo/transaction/returnOrderInProgress.d.ts +1 -1
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repo/transaction.js +0 -1
- package/lib/chevre/service/aggregation/system.js +1 -3
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +1 -4
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -5
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -8
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -1
- package/lib/chevre/service/payment/any/authorize.js +1 -1
- package/lib/chevre/service/payment/any/factory.d.ts +2 -2
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +1 -4
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -4
- package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -4
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -3
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +13 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +14 -3
- package/lib/chevre/service/transaction/returnOrder.js +1 -6
- package/lib/chevre/service/transaction.d.ts +1 -1
- package/package.json +2 -2
|
@@ -35,17 +35,17 @@ class PlaceOrderRepo {
|
|
|
35
35
|
this.transactionModel = connection.model(transaction_2.modelName, (0, transaction_2.createSchema)());
|
|
36
36
|
}
|
|
37
37
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
38
|
-
if (params.typeOf !==
|
|
39
|
-
|
|
40
|
-
}
|
|
38
|
+
// if (params.typeOf !== factory.transactionType.PlaceOrder) {
|
|
39
|
+
// throw new factory.errors.Argument('typeOf', `must be ${factory.transactionType.PlaceOrder}`);
|
|
40
|
+
// }
|
|
41
41
|
const andConditions = [];
|
|
42
42
|
const projectIdEq = params.project?.id?.$eq;
|
|
43
43
|
if (typeof projectIdEq === 'string') {
|
|
44
44
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
45
45
|
}
|
|
46
|
-
if (typeof params.typeOf === 'string') {
|
|
47
|
-
|
|
48
|
-
}
|
|
46
|
+
// if (typeof params.typeOf === 'string') {
|
|
47
|
+
// andConditions.push({ typeOf: { $eq: params.typeOf } });
|
|
48
|
+
// }
|
|
49
49
|
if (params.startFrom !== undefined) {
|
|
50
50
|
andConditions.push({
|
|
51
51
|
startDate: { $gte: params.startFrom }
|
|
@@ -56,22 +56,22 @@ class PlaceOrderRepo {
|
|
|
56
56
|
startDate: { $lte: params.startThrough }
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
if (params.endFrom !== undefined) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (params.endThrough !== undefined) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
59
|
+
// if (params.endFrom !== undefined) {
|
|
60
|
+
// andConditions.push({
|
|
61
|
+
// endDate: {
|
|
62
|
+
// $exists: true,
|
|
63
|
+
// $gte: params.endFrom
|
|
64
|
+
// }
|
|
65
|
+
// });
|
|
66
|
+
// }
|
|
67
|
+
// if (params.endThrough !== undefined) {
|
|
68
|
+
// andConditions.push({
|
|
69
|
+
// endDate: {
|
|
70
|
+
// $exists: true,
|
|
71
|
+
// $lt: params.endThrough
|
|
72
|
+
// }
|
|
73
|
+
// });
|
|
74
|
+
// }
|
|
75
75
|
if (Array.isArray(params.ids)) {
|
|
76
76
|
andConditions.push({
|
|
77
77
|
_id: { $in: params.ids }
|
|
@@ -122,18 +122,6 @@ class PlaceOrderRepo {
|
|
|
122
122
|
if (Array.isArray(sellerIdIn)) {
|
|
123
123
|
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIdIn } });
|
|
124
124
|
}
|
|
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
|
-
// }
|
|
137
125
|
const objectOrderNumberEq = params.object?.orderNumber?.$eq;
|
|
138
126
|
if (typeof objectOrderNumberEq === 'string') {
|
|
139
127
|
andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
|
|
@@ -186,62 +174,12 @@ class PlaceOrderRepo {
|
|
|
186
174
|
.lean()
|
|
187
175
|
.exec();
|
|
188
176
|
}
|
|
189
|
-
// /**
|
|
190
|
-
// * 取引の注文番号を検索する
|
|
191
|
-
// */
|
|
192
|
-
// public async findInProgressOrderNumberById(params: {
|
|
193
|
-
// id: string;
|
|
194
|
-
// }): Promise<string | undefined> {
|
|
195
|
-
// const doc = await this.transactionModel.findOne(
|
|
196
|
-
// {
|
|
197
|
-
// _id: { $eq: params.id },
|
|
198
|
-
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
199
|
-
// status: { $eq: factory.transactionStatusType.InProgress }
|
|
200
|
-
// },
|
|
201
|
-
// { 'object.orderNumber': 1 }
|
|
202
|
-
// )
|
|
203
|
-
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'orderNumber'> }>() // 2024-08-26~
|
|
204
|
-
// .exec();
|
|
205
|
-
// if (doc === null) {
|
|
206
|
-
// throw new factory.errors.NotFound(
|
|
207
|
-
// this.transactionModel.modelName,
|
|
208
|
-
// `${factory.transactionType.PlaceOrder} ${factory.transactionStatusType.InProgress} not found`
|
|
209
|
-
// );
|
|
210
|
-
// }
|
|
211
|
-
// return doc.object.orderNumber;
|
|
212
|
-
// }
|
|
213
|
-
// /**
|
|
214
|
-
// * 取引の確認番号を検索する
|
|
215
|
-
// */
|
|
216
|
-
// public async findInProgressConfirmationNumberById(params: {
|
|
217
|
-
// id: string;
|
|
218
|
-
// status: { $in: factory.transactionStatusType[] };
|
|
219
|
-
// }): Promise<string | undefined> {
|
|
220
|
-
// const doc = await this.transactionModel.findOne(
|
|
221
|
-
// {
|
|
222
|
-
// _id: { $eq: params.id },
|
|
223
|
-
// typeOf: { $eq: factory.transactionType.PlaceOrder },
|
|
224
|
-
// status: { $in: params.status.$in }
|
|
225
|
-
// },
|
|
226
|
-
// { 'object.confirmationNumber': 1 }
|
|
227
|
-
// )
|
|
228
|
-
// .lean<{ object: Pick<factory.transaction.placeOrder.IObject, 'confirmationNumber'> }>() // 2024-08-26~
|
|
229
|
-
// .exec();
|
|
230
|
-
// if (doc === null) {
|
|
231
|
-
// throw new factory.errors.NotFound(
|
|
232
|
-
// this.transactionModel.modelName,
|
|
233
|
-
// `${factory.transactionType.PlaceOrder} ${params.status.$in.join(' or ')} not found`
|
|
234
|
-
// );
|
|
235
|
-
// }
|
|
236
|
-
// return doc.object.confirmationNumber;
|
|
237
|
-
// }
|
|
238
177
|
/**
|
|
239
178
|
* 取引期限変更
|
|
240
179
|
*/
|
|
241
180
|
async updateExpires(params) {
|
|
242
181
|
const doc = await this.transactionModel.findOneAndUpdate({
|
|
243
182
|
_id: { $eq: params.id },
|
|
244
|
-
typeOf: { $eq: params.typeOf },
|
|
245
183
|
status: { $eq: factory_1.factory.transactionStatusType.InProgress }
|
|
246
184
|
}, {
|
|
247
185
|
$set: {
|
|
@@ -253,7 +191,7 @@ class PlaceOrderRepo {
|
|
|
253
191
|
.lean()
|
|
254
192
|
.exec();
|
|
255
193
|
if (doc === null) {
|
|
256
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${
|
|
194
|
+
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
257
195
|
}
|
|
258
196
|
}
|
|
259
197
|
/**
|
|
@@ -303,7 +241,6 @@ class PlaceOrderRepo {
|
|
|
303
241
|
};
|
|
304
242
|
const filter = {
|
|
305
243
|
_id: { $eq: params.id },
|
|
306
|
-
typeOf: { $eq: params.typeOf },
|
|
307
244
|
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
308
245
|
// expiresを条件に追加(2023-05-12~),
|
|
309
246
|
expires: { $gt: new Date() }
|
|
@@ -312,7 +249,7 @@ class PlaceOrderRepo {
|
|
|
312
249
|
.lean()
|
|
313
250
|
.exec();
|
|
314
251
|
if (doc === null) {
|
|
315
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${
|
|
252
|
+
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
316
253
|
}
|
|
317
254
|
return doc;
|
|
318
255
|
}
|
|
@@ -334,13 +271,12 @@ class PlaceOrderRepo {
|
|
|
334
271
|
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
335
272
|
};
|
|
336
273
|
const doc = await this.transactionModel.findOne({
|
|
337
|
-
_id: { $eq: params.id }
|
|
338
|
-
typeOf: { $eq: params.typeOf }
|
|
274
|
+
_id: { $eq: params.id }
|
|
339
275
|
}, projection)
|
|
340
276
|
.lean() // 2024-08-26~
|
|
341
277
|
.exec();
|
|
342
278
|
if (doc === null) {
|
|
343
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${
|
|
279
|
+
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} not found`);
|
|
344
280
|
}
|
|
345
281
|
return doc;
|
|
346
282
|
}
|
|
@@ -353,7 +289,7 @@ class PlaceOrderRepo {
|
|
|
353
289
|
// const tasksExportationStatus = factory.transactionTasksExportationStatus.Unexported; // discontinue(2024-06-20~)
|
|
354
290
|
const startDate = new Date();
|
|
355
291
|
let expires;
|
|
356
|
-
const
|
|
292
|
+
const typeOf = factory_1.factory.transactionType.PlaceOrder;
|
|
357
293
|
// expiresInSecondsの指定があれば優先して適用する(2022-11-25~)
|
|
358
294
|
if (typeof params.expiresInSeconds === 'number' && params.expiresInSeconds > 0) {
|
|
359
295
|
expires = (0, moment_1.default)(startDate)
|
|
@@ -363,18 +299,12 @@ class PlaceOrderRepo {
|
|
|
363
299
|
else {
|
|
364
300
|
throw new factory_1.factory.errors.ArgumentNull('expiresInSeconds');
|
|
365
301
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
...(typeof instrument?.id === 'string') ? { instrument } : undefined
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
throw new factory_1.factory.errors.NotImplemented(`${typeOf} not implemented`);
|
|
377
|
-
}
|
|
302
|
+
const { agent, project, object, seller, instrument } = params;
|
|
303
|
+
const creatingTransaction = {
|
|
304
|
+
status, startDate, expires, typeOf, tasksExportAction,
|
|
305
|
+
agent, project, seller, object,
|
|
306
|
+
...(typeof instrument?.id === 'string') ? { instrument } : undefined
|
|
307
|
+
};
|
|
378
308
|
// reimplemnt with insertMany(2024-05-30~)
|
|
379
309
|
const result = await this.transactionModel.insertMany(creatingTransaction, { rawResult: true });
|
|
380
310
|
const id = result.insertedIds?.[0]?.toHexString();
|
|
@@ -392,7 +322,6 @@ class PlaceOrderRepo {
|
|
|
392
322
|
const endDate = new Date();
|
|
393
323
|
const doc = await this.transactionModel.findOneAndUpdate({
|
|
394
324
|
_id: { $eq: params.id },
|
|
395
|
-
typeOf: { $eq: params.typeOf },
|
|
396
325
|
status: { $eq: factory_1.factory.transactionStatusType.InProgress },
|
|
397
326
|
expires: { $gt: endDate } // add expires(2025-02-27~)
|
|
398
327
|
}, {
|
|
@@ -411,7 +340,7 @@ class PlaceOrderRepo {
|
|
|
411
340
|
.exec();
|
|
412
341
|
// NotFoundであれば取引状態確認
|
|
413
342
|
if (doc === null) {
|
|
414
|
-
const { expires, status } = await this.findPlaceOrderById({
|
|
343
|
+
const { expires, status } = await this.findPlaceOrderById({ id: params.id }, ['expires', 'status']);
|
|
415
344
|
if (status === factory_1.factory.transactionStatusType.Confirmed) {
|
|
416
345
|
// すでに確定済の場合スルー
|
|
417
346
|
}
|
|
@@ -426,12 +355,12 @@ class PlaceOrderRepo {
|
|
|
426
355
|
.isSameOrBefore((0, moment_1.default)(endDate))) {
|
|
427
356
|
throw new factory_1.factory.errors.Argument('Transaction id', 'potentially expired');
|
|
428
357
|
}
|
|
429
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${
|
|
358
|
+
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
430
359
|
}
|
|
431
360
|
}
|
|
432
361
|
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
433
362
|
id: params.id,
|
|
434
|
-
typeOf:
|
|
363
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
435
364
|
status: factory_1.factory.transactionStatusType.Confirmed
|
|
436
365
|
});
|
|
437
366
|
}
|
|
@@ -442,7 +371,6 @@ class PlaceOrderRepo {
|
|
|
442
371
|
const endDate = new Date();
|
|
443
372
|
// 進行中ステータスの取引を中止する
|
|
444
373
|
const doc = await this.transactionModel.findOneAndUpdate({
|
|
445
|
-
typeOf: params.typeOf,
|
|
446
374
|
_id: params.id,
|
|
447
375
|
status: factory_1.factory.transactionStatusType.InProgress
|
|
448
376
|
}, {
|
|
@@ -467,12 +395,12 @@ class PlaceOrderRepo {
|
|
|
467
395
|
throw new factory_1.factory.errors.Argument('Transaction id', 'Confirmed transaction unable to cancel');
|
|
468
396
|
}
|
|
469
397
|
else {
|
|
470
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${
|
|
398
|
+
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
|
|
471
399
|
}
|
|
472
400
|
}
|
|
473
401
|
transaction_1.transactionEventEmitter.emitTransactionStatusChanged({
|
|
474
402
|
id: params.id,
|
|
475
|
-
typeOf:
|
|
403
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
476
404
|
status: factory_1.factory.transactionStatusType.Canceled
|
|
477
405
|
});
|
|
478
406
|
}
|
|
@@ -15,7 +15,7 @@ export declare class ReturnOrderInProgressRepo {
|
|
|
15
15
|
/**
|
|
16
16
|
* 取引を開始する
|
|
17
17
|
*/
|
|
18
|
-
startReturnOrder(params: factory.transaction.returnOrder.IStartParams): Promise<IStartedTransaction>;
|
|
18
|
+
startReturnOrder(params: Pick<factory.transaction.returnOrder.IStartParams, 'agent' | 'expiresInSeconds' | 'object' | 'project' | 'typeOf'>): Promise<IStartedTransaction>;
|
|
19
19
|
findReturnOrderById(params: {
|
|
20
20
|
id: string;
|
|
21
21
|
}): Promise<IReturnOrderAsFindResult>;
|
|
@@ -26,7 +26,7 @@ export declare class TransactionRepo {
|
|
|
26
26
|
endDate?: factory.sortType;
|
|
27
27
|
startDate?: factory.sortType;
|
|
28
28
|
};
|
|
29
|
-
}): Promise<Pick<factory.transaction.ITransaction
|
|
29
|
+
}): Promise<Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf'> | null>;
|
|
30
30
|
/**
|
|
31
31
|
* set task status exported by transaction id
|
|
32
32
|
* IDでタスクをエクスポート済に変更する
|
|
@@ -30,7 +30,6 @@ class TransactionRepo {
|
|
|
30
30
|
throw new factory_1.factory.errors.Argument('endDate.$lt', 'must be Date');
|
|
31
31
|
}
|
|
32
32
|
const query = this.transactionModel.findOneAndUpdate({
|
|
33
|
-
// ...(Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined,
|
|
34
33
|
status: {
|
|
35
34
|
...(typeof statusEq === 'string')
|
|
36
35
|
? { $eq: statusEq }
|
|
@@ -137,8 +137,7 @@ function aggregatePlaceOrder(params) {
|
|
|
137
137
|
const aggregateResult = await repos.aggregateTransaction.aggregatePlaceOrder({
|
|
138
138
|
project: { id: { $ne: params.excludedProjectId } },
|
|
139
139
|
startFrom,
|
|
140
|
-
startThrough
|
|
141
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder
|
|
140
|
+
startThrough
|
|
142
141
|
});
|
|
143
142
|
debug('aggregatePlaceOrder:result', aggregateResult, aggregateResult.statuses[0]?.aggregation, startFrom);
|
|
144
143
|
const aggregateResultsByClientId = [];
|
|
@@ -148,7 +147,6 @@ function aggregatePlaceOrder(params) {
|
|
|
148
147
|
project: { id: { $ne: params.excludedProjectId } },
|
|
149
148
|
startFrom,
|
|
150
149
|
startThrough,
|
|
151
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
152
150
|
clientId
|
|
153
151
|
});
|
|
154
152
|
debug('aggregateResultByClientId', aggregateResultByClientId, aggregateResultByClientId.statuses[0]?.aggregation, clientId, startFrom);
|
|
@@ -8,7 +8,7 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
8
8
|
id: string;
|
|
9
9
|
};
|
|
10
10
|
broker?: factory.reservation.IBroker;
|
|
11
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
11
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'expires' | 'seller'>;
|
|
12
12
|
transactionNumber: string;
|
|
13
13
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
14
14
|
declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
@@ -18,7 +18,7 @@ declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
18
18
|
*/
|
|
19
19
|
transactionNumber: string;
|
|
20
20
|
};
|
|
21
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
21
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
22
22
|
}): factory.action.authorize.offer.eventService.IAttributes;
|
|
23
23
|
declare function acceptedOffers2amount(params: {
|
|
24
24
|
acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
|
|
@@ -31,7 +31,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
31
31
|
};
|
|
32
32
|
broker?: factory.reservation.IBroker;
|
|
33
33
|
transactionNumber: string;
|
|
34
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
34
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'agent' | 'expires' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
35
35
|
availableAtOrFrom: {
|
|
36
36
|
id: string;
|
|
37
37
|
};
|
|
@@ -121,10 +121,7 @@ function minimizeItemOffered(itemOffered, options) {
|
|
|
121
121
|
}
|
|
122
122
|
function validateCreateRequest(params) {
|
|
123
123
|
return async (repos) => {
|
|
124
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
125
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
126
|
-
id: params.transaction.id
|
|
127
|
-
}, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
|
|
124
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['agent', 'expires', 'project', 'seller', 'typeOf', 'instrument']);
|
|
128
125
|
if (transaction.agent.id !== params.agent.id) {
|
|
129
126
|
throw new factory_1.factory.errors.Forbidden('Transaction not yours');
|
|
130
127
|
}
|
|
@@ -63,7 +63,7 @@ function issueEventOfferTicket(params) {
|
|
|
63
63
|
return async (repos) => {
|
|
64
64
|
const { now, audience, eventId, eventOfferId, ticketedOffer, author, project, instrument } = params;
|
|
65
65
|
// 取引は存在するか
|
|
66
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
66
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: audience.id }, ['expires', 'typeOf', 'seller']);
|
|
67
67
|
// イベントは存在するか
|
|
68
68
|
const event = await repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
|
|
69
69
|
const { seller } = transaction;
|
|
@@ -22,7 +22,7 @@ function voidTransaction(params) {
|
|
|
22
22
|
agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
23
23
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
24
24
|
};
|
|
25
|
-
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
25
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'object']);
|
|
26
26
|
// 興行オファー承認アクション検索
|
|
27
27
|
let authorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
|
|
28
28
|
// typeOf: factory.actionType.AuthorizeAction,
|
|
@@ -115,10 +115,7 @@ function cancelAcceptActions(params) {
|
|
|
115
115
|
agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
116
116
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
117
117
|
};
|
|
118
|
-
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
119
|
-
typeOf: params.purpose.typeOf,
|
|
120
|
-
id: params.purpose.id
|
|
121
|
-
}, ['typeOf', 'status']);
|
|
118
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status']);
|
|
122
119
|
// 興行オファー承認アクション検索
|
|
123
120
|
const completedAuthorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
|
|
124
121
|
// typeOf: factory.actionType.AuthorizeAction,
|
|
@@ -19,10 +19,7 @@ function voidTransactionByActionId(params) {
|
|
|
19
19
|
agent: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
20
20
|
...(typeof params.sameAs?.id === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined
|
|
21
21
|
};
|
|
22
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
23
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
24
|
-
id: params.purpose.id
|
|
25
|
-
}, ['typeOf']);
|
|
22
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['typeOf']);
|
|
26
23
|
// if (transaction.agent.id !== params.agent.id) {
|
|
27
24
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
28
25
|
// }
|
|
@@ -33,10 +33,7 @@ function acceptOffer(params) {
|
|
|
33
33
|
if (typeof params.sameAs.id !== 'string' || params.sameAs.id === '') {
|
|
34
34
|
throw new factory_1.factory.errors.ArgumentNull('sameAs.id');
|
|
35
35
|
}
|
|
36
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
37
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
38
|
-
id: params.purpose.id
|
|
39
|
-
}, ['project', 'agent', 'typeOf']);
|
|
36
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['project', 'agent', 'typeOf']);
|
|
40
37
|
// // 注文ドキュメントを参照(2026-06-24~)
|
|
41
38
|
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
42
39
|
// identifier: transaction.id,
|
|
@@ -118,10 +115,7 @@ function reAcceptOffer(params) {
|
|
|
118
115
|
if (typeof params.potentialActions?.id !== 'string' || params.potentialActions.id === '') {
|
|
119
116
|
throw new factory_1.factory.errors.ArgumentNull('potentialActions.id');
|
|
120
117
|
}
|
|
121
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
122
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
123
|
-
id: params.purpose.id
|
|
124
|
-
}, ['project', 'agent', 'typeOf']);
|
|
118
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['project', 'agent', 'typeOf']);
|
|
125
119
|
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: transaction.id });
|
|
126
120
|
// if (typeof orderNumber !== 'string') {
|
|
127
121
|
// // 事前に発行されているはず
|
|
@@ -8,7 +8,7 @@ export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
|
8
8
|
acceptAction: {
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
11
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
11
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'agent' | 'id' | 'project' | 'seller' | 'typeOf'>;
|
|
12
12
|
/**
|
|
13
13
|
* 仮予約済のCOA予約取引
|
|
14
14
|
*/
|
|
@@ -14,10 +14,7 @@ const factory_2 = require("../../../factory");
|
|
|
14
14
|
*/
|
|
15
15
|
function authorize(params) {
|
|
16
16
|
return async (repos) => {
|
|
17
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
18
|
-
typeOf: factory_2.factory.transactionType.PlaceOrder,
|
|
19
|
-
id: params.transaction.id
|
|
20
|
-
}, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
|
|
17
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['agent', 'project', 'seller', 'typeOf', 'instrument']);
|
|
21
18
|
if (transaction.agent.id !== params.agent.id) {
|
|
22
19
|
throw new factory_2.factory.errors.Forbidden('Transaction not yours');
|
|
23
20
|
}
|
|
@@ -14,10 +14,7 @@ const factory_2 = require("../../../factory");
|
|
|
14
14
|
*/
|
|
15
15
|
function changeOffers(params) {
|
|
16
16
|
return async (repos) => {
|
|
17
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
18
|
-
typeOf: factory_2.factory.transactionType.PlaceOrder,
|
|
19
|
-
id: params.transaction.id
|
|
20
|
-
}, ['typeOf', 'agent', 'project', 'seller']);
|
|
17
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.transaction.id }, ['typeOf', 'agent', 'project', 'seller']);
|
|
21
18
|
if (transaction.agent.id !== params.agent.id) {
|
|
22
19
|
throw new factory_2.factory.errors.Forbidden('Transaction not yours');
|
|
23
20
|
}
|
package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js
CHANGED
|
@@ -36,7 +36,7 @@ function cancelOrderIfExist(params) {
|
|
|
36
36
|
limit: 1,
|
|
37
37
|
page: 1,
|
|
38
38
|
project: { id: { $eq: params.project.id } },
|
|
39
|
-
typeOf:
|
|
39
|
+
// typeOf: factory.transactionType.PlaceOrder,
|
|
40
40
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
41
41
|
// resultではなくobjectで参照するように変更(2026-06-16~)
|
|
42
42
|
object: {
|
|
@@ -83,7 +83,7 @@ function createOnAuthorizationCreatedTask(order) {
|
|
|
83
83
|
const placeOrderTransaction = (await repos.placeOrder.findPlaceOrderTransactions({
|
|
84
84
|
limit: 1,
|
|
85
85
|
page: 1,
|
|
86
|
-
typeOf:
|
|
86
|
+
// typeOf: factory.transactionType.PlaceOrder,
|
|
87
87
|
object: { orderNumber: { $eq: order.orderNumber } },
|
|
88
88
|
inclusion: ['result']
|
|
89
89
|
})).shift();
|
|
@@ -11,7 +11,7 @@ function createPlacingOrderFromExistingTransaction(params) {
|
|
|
11
11
|
limit: 1,
|
|
12
12
|
page: 1,
|
|
13
13
|
project: { id: { $eq: params.project.id } },
|
|
14
|
-
typeOf:
|
|
14
|
+
// typeOf: factory.transactionType.PlaceOrder,
|
|
15
15
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
16
16
|
// resultではなくobjectで参照するように変更(2026-06-16~)
|
|
17
17
|
object: {
|
|
@@ -59,7 +59,7 @@ function authorize(params) {
|
|
|
59
59
|
if (purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
|
|
60
60
|
throw new factory_1.factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
61
61
|
}
|
|
62
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
62
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: purpose.id }, ['agent', 'expires', 'typeOf', 'project', 'seller']);
|
|
63
63
|
if (project.id !== transaction.project.id) {
|
|
64
64
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
65
65
|
}
|
|
@@ -8,7 +8,7 @@ export declare function creatPublishPaymentUrlParams(params: {
|
|
|
8
8
|
accountId?: string;
|
|
9
9
|
object: Pick<factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod' | 'referencesOrder'>;
|
|
10
10
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
11
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
11
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'expires' | 'seller' | 'project'>;
|
|
12
12
|
transactionNumber: string;
|
|
13
13
|
location?: factory.action.trade.pay.ILocation;
|
|
14
14
|
identifier?: string;
|
|
@@ -26,7 +26,7 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
26
26
|
accountId?: string;
|
|
27
27
|
object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
|
|
28
28
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
29
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
29
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'expires' | 'seller' | 'project'>;
|
|
30
30
|
transactionNumber: string;
|
|
31
31
|
location?: factory.action.trade.pay.ILocation;
|
|
32
32
|
order: {
|
|
@@ -12,10 +12,7 @@ function invalidatePaymentUrl(params) {
|
|
|
12
12
|
if (params.purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
|
|
13
13
|
throw new factory_1.factory.errors.Argument('purpose.typeOf', `must be ${factory_1.factory.transactionType.PlaceOrder}`);
|
|
14
14
|
}
|
|
15
|
-
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
16
|
-
typeOf: params.purpose.typeOf,
|
|
17
|
-
id: params.purpose.id
|
|
18
|
-
}, ['typeOf', 'status', 'object', 'project', 'seller', 'agent']);
|
|
15
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'object', 'project', 'seller', 'agent']);
|
|
19
16
|
// const orderCancelled: boolean = params.purpose.result?.order?.orderStatus === factory.orderStatus.OrderCancelled;
|
|
20
17
|
// if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
21
18
|
// if (!orderCancelled) {
|
|
@@ -50,10 +50,10 @@ function processVoidPayTransaction(params) {
|
|
|
50
50
|
let transaction;
|
|
51
51
|
// アクションID指定の場合、進行中取引検証(2023-02-24~)
|
|
52
52
|
if (typeof params.id === 'string') {
|
|
53
|
-
transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
53
|
+
transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: params.purpose.id }, ['typeOf', 'status']);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
transaction = await repos.placeOrder.findPlaceOrderById({
|
|
56
|
+
transaction = await repos.placeOrder.findPlaceOrderById({ id: params.purpose.id }, ['typeOf', 'status', 'result']);
|
|
57
57
|
}
|
|
58
58
|
// 承認アクションを取得
|
|
59
59
|
let authorizeActions;
|
|
@@ -48,7 +48,7 @@ function publishPaymentUrl(params) {
|
|
|
48
48
|
throw new factory_1.factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
49
49
|
}
|
|
50
50
|
try {
|
|
51
|
-
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
51
|
+
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({ id: purpose.id }, ['expires', 'seller', 'project']);
|
|
52
52
|
if (project.id !== transaction.project.id) {
|
|
53
53
|
throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
|
|
54
54
|
}
|
|
@@ -36,7 +36,7 @@ function deleteTransactionById(params) {
|
|
|
36
36
|
if (params.object.typeOf === factory_1.factory.transactionType.PlaceOrder) {
|
|
37
37
|
transaction = (await repos.placeOrder.findPlaceOrderTransactions({
|
|
38
38
|
ids: [deletingTransactionId],
|
|
39
|
-
typeOf: params.object.typeOf,
|
|
39
|
+
// typeOf: params.object.typeOf,
|
|
40
40
|
inclusion: ['typeOf', 'project', 'status']
|
|
41
41
|
})).shift();
|
|
42
42
|
}
|
|
@@ -63,7 +63,7 @@ function confirm(params, options) {
|
|
|
63
63
|
// status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
|
|
64
64
|
object: { orderDate: params.result.order.orderDate }
|
|
65
65
|
})(repos);
|
|
66
|
-
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
66
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
|
|
67
67
|
// 注文ドキュメントから注文番号を参照(取引開始時に発行済の前提)(2026-06-26~)
|
|
68
68
|
const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
69
69
|
identifier: params.id,
|
|
@@ -169,7 +169,6 @@ function confirm(params, options) {
|
|
|
169
169
|
// ステータス変更
|
|
170
170
|
try {
|
|
171
171
|
await repos.placeOrder.confirmPlaceOrder({
|
|
172
|
-
typeOf: transaction.typeOf,
|
|
173
172
|
id: transaction.id,
|
|
174
173
|
object: {
|
|
175
174
|
orderDate: params.result.order.orderDate,
|
|
@@ -6,10 +6,10 @@ type IPlaceOrderPotentialTask = factory.task.IAttributes<factory.taskName.PlaceO
|
|
|
6
6
|
* 取引削除タスクを分離(2026-08-02~)
|
|
7
7
|
*/
|
|
8
8
|
export declare function createImmediateTasks(params: {
|
|
9
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
9
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'endDate' | 'id' | 'object' | 'project' | 'seller' | 'startDate' | 'status' | 'typeOf'>;
|
|
10
10
|
taskRunsAt: Date;
|
|
11
11
|
}): IPlaceOrderPotentialTask[];
|
|
12
12
|
export declare function createScheduledTasks(params: {
|
|
13
|
-
transaction: Pick<factory.transaction.ITransaction
|
|
13
|
+
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'endDate' | 'id' | 'object' | 'project' | 'status' | 'typeOf'>;
|
|
14
14
|
}, setting: Pick<ISetting, 'storage'> | null): factory.task.deleteTransaction.IAttributes;
|
|
15
15
|
export {};
|
|
@@ -12,10 +12,7 @@ const factory_2 = require("./exportTasks/factory");
|
|
|
12
12
|
*/
|
|
13
13
|
function exportTasksById(params) {
|
|
14
14
|
return async (repos) => {
|
|
15
|
-
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
16
|
-
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
17
|
-
id: params.id
|
|
18
|
-
}, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
|
|
15
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ id: params.id }, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
|
|
19
16
|
// タスク実行日時バッファの指定があれば調整
|
|
20
17
|
let taskRunsAt = new Date();
|
|
21
18
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|