@chevre/domain 26.0.0-alpha.42 → 26.0.0-alpha.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/action/acceptPay.d.ts +2 -2
- package/lib/chevre/repo/action/acceptPay.js +3 -3
- package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +3 -3
- package/lib/chevre/repo/action/anyAction/actionProcess.js +2 -66
- package/lib/chevre/repository.d.ts +15 -0
- package/lib/chevre/repository.js +33 -0
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +5 -7
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -14
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -1
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +0 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +0 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +0 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +5 -4
- package/package.json +1 -1
|
@@ -19,8 +19,8 @@ export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAct
|
|
|
19
19
|
id: string;
|
|
20
20
|
};
|
|
21
21
|
actionStatus?: factory.actionStatusType.CompletedActionStatus;
|
|
22
|
-
limit?:
|
|
23
|
-
page?:
|
|
22
|
+
limit?: never;
|
|
23
|
+
page?: never;
|
|
24
24
|
}, inclusion: IKeyOfProjection[]): Promise<IAcceptPayAction[]>;
|
|
25
25
|
/**
|
|
26
26
|
* 決済取引番号から完了済の決済採用アクションを参照する
|
|
@@ -19,7 +19,7 @@ class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
19
19
|
* 件数はlimitされない
|
|
20
20
|
*/
|
|
21
21
|
async findAcceptActionsByPurpose(params, inclusion) {
|
|
22
|
-
const { actionStatus
|
|
22
|
+
const { actionStatus } = params;
|
|
23
23
|
return this.findAnyActions({
|
|
24
24
|
project: { id: { $eq: params.project.id } },
|
|
25
25
|
typeOf: { $eq: factory_1.factory.actionType.AcceptAction }, // 採用アクション
|
|
@@ -30,8 +30,8 @@ class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
30
30
|
...(typeof actionStatus === 'string')
|
|
31
31
|
? { actionStatus: { $in: [actionStatus] } }
|
|
32
32
|
: undefined,
|
|
33
|
-
...(typeof limit === 'number') ? { limit } : undefined,
|
|
34
|
-
...(typeof page === 'number') ? { page } : undefined,
|
|
33
|
+
// ...(typeof limit === 'number') ? { limit } : undefined,
|
|
34
|
+
// ...(typeof page === 'number') ? { page } : undefined,
|
|
35
35
|
}, inclusion);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection } from 'mongoose';
|
|
1
|
+
import { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import { factory } from '../../../factory';
|
|
3
3
|
import { IModel as IActionModel, IDocType } from '../../mongoose/schemas/action';
|
|
4
4
|
import { ActionRecipeRepo, IActionRecipe, IRecipeAsActionAttributes } from './actionRecipe';
|
|
@@ -33,7 +33,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
33
33
|
protected constructor(params: {
|
|
34
34
|
connection: Connection;
|
|
35
35
|
}, options: IOptions);
|
|
36
|
-
static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions):
|
|
36
|
+
static CREATE_MONGO_CONDITIONS(params: factory.action.ISearchConditions): FilterQuery<IDocType>[];
|
|
37
37
|
/**
|
|
38
38
|
* アクション開始
|
|
39
39
|
*/
|
|
@@ -64,7 +64,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
64
64
|
error: Error | Error[] | unknown;
|
|
65
65
|
recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
|
|
66
66
|
}): Promise<void>;
|
|
67
|
-
|
|
67
|
+
findAnyActionById(params: {
|
|
68
68
|
typeOf: TAction['typeOf'];
|
|
69
69
|
id: string;
|
|
70
70
|
}, inclusion?: IKeyOfProjection[], exclusion?: IKeyOfProjection[]): Promise<TAction>;
|
|
@@ -42,7 +42,7 @@ class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
|
42
42
|
this.options = options;
|
|
43
43
|
}
|
|
44
44
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
45
|
-
const andConditions = [];
|
|
45
|
+
const andConditions = [];
|
|
46
46
|
const idIn = params.id?.$in;
|
|
47
47
|
if (Array.isArray(idIn)) {
|
|
48
48
|
andConditions.push({ _id: { $in: idIn } });
|
|
@@ -259,16 +259,6 @@ class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
// 承認アクションのobject.event廃止につき検索条件も廃止(2026-07-04~)
|
|
263
|
-
// const objectEventIdIn = params.object?.event?.id?.$in;
|
|
264
|
-
// if (Array.isArray(objectEventIdIn)) {
|
|
265
|
-
// andConditions.push({
|
|
266
|
-
// 'object.event.id': {
|
|
267
|
-
// $exists: true,
|
|
268
|
-
// $in: objectEventIdIn
|
|
269
|
-
// }
|
|
270
|
-
// });
|
|
271
|
-
// }
|
|
272
262
|
const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
|
|
273
263
|
if (typeof objectTransactionNumberEq === 'string') {
|
|
274
264
|
andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
|
|
@@ -309,60 +299,6 @@ class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
|
309
299
|
startDate: { $lte: startDateLte }
|
|
310
300
|
});
|
|
311
301
|
}
|
|
312
|
-
// const fromLocationTypeOfIn = params.fromLocation?.typeOf?.$in;
|
|
313
|
-
// if (Array.isArray(fromLocationTypeOfIn)) {
|
|
314
|
-
// andConditions.push({
|
|
315
|
-
// 'fromLocation.typeOf': {
|
|
316
|
-
// $exists: true,
|
|
317
|
-
// $in: fromLocationTypeOfIn
|
|
318
|
-
// }
|
|
319
|
-
// });
|
|
320
|
-
// }
|
|
321
|
-
// const fromLocationAccountNumberIn = params.fromLocation?.accountNumber?.$in;
|
|
322
|
-
// if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
323
|
-
// andConditions.push({
|
|
324
|
-
// 'fromLocation.accountNumber': {
|
|
325
|
-
// $exists: true,
|
|
326
|
-
// $in: fromLocationAccountNumberIn
|
|
327
|
-
// }
|
|
328
|
-
// });
|
|
329
|
-
// }
|
|
330
|
-
// const fromLocationAccountTypeIn = params.fromLocation?.accountType?.$in;
|
|
331
|
-
// if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
332
|
-
// andConditions.push({
|
|
333
|
-
// 'fromLocation.accountType': {
|
|
334
|
-
// $exists: true,
|
|
335
|
-
// $in: fromLocationAccountTypeIn
|
|
336
|
-
// }
|
|
337
|
-
// });
|
|
338
|
-
// }
|
|
339
|
-
// const toLocationTypeOfIn = params.toLocation?.typeOf?.$in;
|
|
340
|
-
// if (Array.isArray(toLocationTypeOfIn)) {
|
|
341
|
-
// andConditions.push({
|
|
342
|
-
// 'toLocation.typeOf': {
|
|
343
|
-
// $exists: true,
|
|
344
|
-
// $in: toLocationTypeOfIn
|
|
345
|
-
// }
|
|
346
|
-
// });
|
|
347
|
-
// }
|
|
348
|
-
// const toLocationAccountNumberIn = params.toLocation?.accountNumber?.$in;
|
|
349
|
-
// if (Array.isArray(toLocationAccountNumberIn)) {
|
|
350
|
-
// andConditions.push({
|
|
351
|
-
// 'toLocation.accountNumber': {
|
|
352
|
-
// $exists: true,
|
|
353
|
-
// $in: toLocationAccountNumberIn
|
|
354
|
-
// }
|
|
355
|
-
// });
|
|
356
|
-
// }
|
|
357
|
-
// const toLocationAccountTypeIn = params.toLocation?.accountType?.$in;
|
|
358
|
-
// if (Array.isArray(toLocationAccountTypeIn)) {
|
|
359
|
-
// andConditions.push({
|
|
360
|
-
// 'toLocation.accountType': {
|
|
361
|
-
// $exists: true,
|
|
362
|
-
// $in: toLocationAccountTypeIn
|
|
363
|
-
// }
|
|
364
|
-
// });
|
|
365
|
-
// }
|
|
366
302
|
const purposeTypeOfIn = params.purpose?.typeOf?.$in;
|
|
367
303
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
368
304
|
andConditions.push({
|
|
@@ -549,7 +485,7 @@ class ActionProcessRepo extends actionRecipe_1.ActionRecipeRepo {
|
|
|
549
485
|
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
550
486
|
}
|
|
551
487
|
}
|
|
552
|
-
async
|
|
488
|
+
async findAnyActionById(params, inclusion, exclusion) {
|
|
553
489
|
let positiveProjectionFields = exports.AVAILABLE_PROJECT_FIELDS;
|
|
554
490
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
555
491
|
positiveProjectionFields = inclusion.filter((key) => exports.AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
@@ -16,6 +16,9 @@ import type { PayActionRepo } from './repo/action/pay';
|
|
|
16
16
|
import type { RefundActionRepo } from './repo/action/refund';
|
|
17
17
|
import type { UpdateActionRepo } from './repo/action/update';
|
|
18
18
|
import type { UseActionRepo } from './repo/action/use';
|
|
19
|
+
import type { CancelActionRepo } from './repo/action/cancel';
|
|
20
|
+
import type { OrderActionRepo } from './repo/action/order';
|
|
21
|
+
import type { ConfirmActionRepo } from './repo/action/confirm';
|
|
19
22
|
import type { AsyncActionRepo } from './repo/asyncAction';
|
|
20
23
|
import type { AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
21
24
|
import type { AdminActionRepo } from './repo/adminAction';
|
|
@@ -171,6 +174,18 @@ export declare namespace action {
|
|
|
171
174
|
namespace Use {
|
|
172
175
|
function createInstance(...params: ConstructorParameters<typeof UseActionRepo>): Promise<UseActionRepo>;
|
|
173
176
|
}
|
|
177
|
+
type Cancel = CancelActionRepo;
|
|
178
|
+
namespace Cancel {
|
|
179
|
+
function createInstance(...params: ConstructorParameters<typeof CancelActionRepo>): Promise<CancelActionRepo>;
|
|
180
|
+
}
|
|
181
|
+
type Order = OrderActionRepo;
|
|
182
|
+
namespace Order {
|
|
183
|
+
function createInstance(...params: ConstructorParameters<typeof OrderActionRepo>): Promise<OrderActionRepo>;
|
|
184
|
+
}
|
|
185
|
+
type Confirm = ConfirmActionRepo;
|
|
186
|
+
namespace Confirm {
|
|
187
|
+
function createInstance(...params: ConstructorParameters<typeof ConfirmActionRepo>): Promise<ConfirmActionRepo>;
|
|
188
|
+
}
|
|
174
189
|
}
|
|
175
190
|
export type AdditionalProperty = AdditionalPropertyRepo;
|
|
176
191
|
export declare namespace AdditionalProperty {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -169,6 +169,39 @@ var action;
|
|
|
169
169
|
}
|
|
170
170
|
Use.createInstance = createInstance;
|
|
171
171
|
})(Use = action.Use || (action.Use = {}));
|
|
172
|
+
let Cancel;
|
|
173
|
+
(function (Cancel) {
|
|
174
|
+
let repo;
|
|
175
|
+
async function createInstance(...params) {
|
|
176
|
+
if (repo === undefined) {
|
|
177
|
+
repo = (await import('./repo/action/cancel.js')).CancelActionRepo;
|
|
178
|
+
}
|
|
179
|
+
return new repo(...params);
|
|
180
|
+
}
|
|
181
|
+
Cancel.createInstance = createInstance;
|
|
182
|
+
})(Cancel = action.Cancel || (action.Cancel = {}));
|
|
183
|
+
let Order;
|
|
184
|
+
(function (Order) {
|
|
185
|
+
let repo;
|
|
186
|
+
async function createInstance(...params) {
|
|
187
|
+
if (repo === undefined) {
|
|
188
|
+
repo = (await import('./repo/action/order.js')).OrderActionRepo;
|
|
189
|
+
}
|
|
190
|
+
return new repo(...params);
|
|
191
|
+
}
|
|
192
|
+
Order.createInstance = createInstance;
|
|
193
|
+
})(Order = action.Order || (action.Order = {}));
|
|
194
|
+
let Confirm;
|
|
195
|
+
(function (Confirm) {
|
|
196
|
+
let repo;
|
|
197
|
+
async function createInstance(...params) {
|
|
198
|
+
if (repo === undefined) {
|
|
199
|
+
repo = (await import('./repo/action/confirm.js')).ConfirmActionRepo;
|
|
200
|
+
}
|
|
201
|
+
return new repo(...params);
|
|
202
|
+
}
|
|
203
|
+
Confirm.createInstance = createInstance;
|
|
204
|
+
})(Confirm = action.Confirm || (action.Confirm = {}));
|
|
172
205
|
})(action || (exports.action = action = {}));
|
|
173
206
|
var AdditionalProperty;
|
|
174
207
|
(function (AdditionalProperty) {
|
|
@@ -13,8 +13,8 @@ interface ICancelRepos {
|
|
|
13
13
|
interface ICancelByAcceptActionRepos {
|
|
14
14
|
actions: {
|
|
15
15
|
cancel: CancelActionRepo;
|
|
16
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
16
17
|
};
|
|
17
|
-
acceptCOAOfferAction: AcceptCOAOfferActionRepo;
|
|
18
18
|
reserveService: COA.service.Reserve;
|
|
19
19
|
task: TaskRepo;
|
|
20
20
|
}
|
|
@@ -8,7 +8,7 @@ const cancelReservation_1 = require("../../reserveCOA/cancelReservation");
|
|
|
8
8
|
*/
|
|
9
9
|
function cancelByAcceptAction(params, options) {
|
|
10
10
|
return async (repos) => {
|
|
11
|
-
const recipe = await repos.
|
|
11
|
+
const recipe = await repos.actions.acceptCOAOffer.findRecipeByAction({
|
|
12
12
|
project: { id: params.action.project.id },
|
|
13
13
|
recipeFor: { id: params.action.id }
|
|
14
14
|
});
|
|
@@ -13,8 +13,8 @@ declare function processVoidTransaction4coa(params: {
|
|
|
13
13
|
}): (repos: {
|
|
14
14
|
actions: {
|
|
15
15
|
cancel: CancelActionRepo;
|
|
16
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
16
17
|
};
|
|
17
|
-
acceptCOAOfferAction: AcceptCOAOfferActionRepo;
|
|
18
18
|
reserveService: COA.service.Reserve;
|
|
19
19
|
task: TaskRepo;
|
|
20
20
|
}) => Promise<void>;
|
|
@@ -28,8 +28,8 @@ declare function processVoidTransactionByAcceptAction4coa(params: {
|
|
|
28
28
|
}): (repos: {
|
|
29
29
|
actions: {
|
|
30
30
|
cancel: CancelActionRepo;
|
|
31
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
31
32
|
};
|
|
32
|
-
acceptCOAOfferAction: AcceptCOAOfferActionRepo;
|
|
33
33
|
reserveService: COA.service.Reserve;
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
}) => Promise<void>;
|
|
@@ -13,7 +13,7 @@ function processVoidTransaction4coa(params, options) {
|
|
|
13
13
|
if (typeof acceptActionId !== 'string') {
|
|
14
14
|
throw new factory_1.factory.errors.NotFound('action.object.id');
|
|
15
15
|
}
|
|
16
|
-
const acceptAction = await repos.
|
|
16
|
+
const acceptAction = await repos.actions.acceptCOAOffer.findAnyActionById({ id: acceptActionId, typeOf: factory_1.factory.actionType.AcceptAction });
|
|
17
17
|
// console.log('processVoidTransaction4coa processing...', params.action.id, params.action.purpose.id, acceptAction);
|
|
18
18
|
await (0, cancel_1.cancelByAcceptAction)({ action: acceptAction }, options)(repos);
|
|
19
19
|
};
|
|
@@ -18,9 +18,9 @@ interface IVoidTransactionRepos {
|
|
|
18
18
|
*/
|
|
19
19
|
actions: {
|
|
20
20
|
cancel: CancelActionRepo;
|
|
21
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
22
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
21
23
|
};
|
|
22
|
-
acceptCOAOfferAction: AcceptCOAOfferActionRepo;
|
|
23
|
-
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
24
24
|
assetTransaction: AssetTransactionRepo;
|
|
25
25
|
stockHolder: StockHolderRepo;
|
|
26
26
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -24,7 +24,7 @@ function voidTransaction(params) {
|
|
|
24
24
|
};
|
|
25
25
|
const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'object']);
|
|
26
26
|
// 興行オファー承認アクション検索
|
|
27
|
-
let authorizeActions = await repos.
|
|
27
|
+
let authorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
|
|
28
28
|
// typeOf: factory.actionType.AuthorizeAction,
|
|
29
29
|
purpose: {
|
|
30
30
|
typeOf: params.purpose.typeOf,
|
|
@@ -79,7 +79,7 @@ function voidTransaction(params) {
|
|
|
79
79
|
await repos.orderInTransaction.deleteByIdentifier({ identifier: params.purpose.id });
|
|
80
80
|
}
|
|
81
81
|
await Promise.all(authorizeActions.map(async (action) => {
|
|
82
|
-
await repos.
|
|
82
|
+
await repos.actions.authorizeOffer.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
|
|
83
83
|
switch (action.instrument.typeOf) {
|
|
84
84
|
// case WebAPIIdentifier.COA:
|
|
85
85
|
case factory_1.factory.assetTransactionType.COAReserveTransaction: {
|
|
@@ -89,7 +89,6 @@ function voidTransaction(params) {
|
|
|
89
89
|
}
|
|
90
90
|
await (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: true })({
|
|
91
91
|
actions: repos.actions,
|
|
92
|
-
acceptCOAOfferAction: repos.acceptCOAOfferAction,
|
|
93
92
|
reserveService,
|
|
94
93
|
task: repos.task
|
|
95
94
|
});
|
|
@@ -121,7 +120,7 @@ function cancelAcceptActions(params) {
|
|
|
121
120
|
id: params.purpose.id
|
|
122
121
|
}, ['typeOf', 'status']);
|
|
123
122
|
// 興行オファー承認アクション検索
|
|
124
|
-
const completedAuthorizeActions = await repos.
|
|
123
|
+
const completedAuthorizeActions = await repos.actions.authorizeOffer.findAuthorizeOfferActionsByPurpose({
|
|
125
124
|
// typeOf: factory.actionType.AuthorizeAction,
|
|
126
125
|
purpose: {
|
|
127
126
|
typeOf: params.purpose.typeOf,
|
|
@@ -131,7 +130,7 @@ function cancelAcceptActions(params) {
|
|
|
131
130
|
actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus }
|
|
132
131
|
});
|
|
133
132
|
// 興行オファー採用アクション検索
|
|
134
|
-
let acceptActions = await repos.
|
|
133
|
+
let acceptActions = await repos.actions.acceptCOAOffer.findAcceptCOAOfferActionsByPurpose({
|
|
135
134
|
// typeOf: factory.actionType.AcceptAction,
|
|
136
135
|
purpose: {
|
|
137
136
|
typeOf: params.purpose.typeOf,
|
|
@@ -166,13 +165,12 @@ function cancelAcceptActions(params) {
|
|
|
166
165
|
}
|
|
167
166
|
const { reserveService } = repos;
|
|
168
167
|
await Promise.all(acceptActions.map(async (action) => {
|
|
169
|
-
await repos.
|
|
168
|
+
await repos.actions.acceptCOAOffer.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
|
|
170
169
|
if (reserveService === undefined) {
|
|
171
170
|
throw new factory_1.factory.errors.Internal('repos.reserveService required');
|
|
172
171
|
}
|
|
173
172
|
await (0, processVoidTransaction4coa_1.processVoidTransactionByAcceptAction4coa)({ action }, { asyncCancelPendingReservation: true })({
|
|
174
173
|
actions: repos.actions,
|
|
175
|
-
acceptCOAOfferAction: repos.acceptCOAOfferAction,
|
|
176
174
|
reserveService,
|
|
177
175
|
task: repos.task
|
|
178
176
|
});
|
|
@@ -18,9 +18,9 @@ interface IVoidTransactionByActionIdRepos {
|
|
|
18
18
|
*/
|
|
19
19
|
actions: {
|
|
20
20
|
cancel: CancelActionRepo;
|
|
21
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
22
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
21
23
|
};
|
|
22
|
-
acceptCOAOfferAction: AcceptCOAOfferActionRepo;
|
|
23
|
-
authorizeOfferAction: AuthorizeOfferActionRepo;
|
|
24
24
|
assetTransaction: AssetTransactionRepo;
|
|
25
25
|
stockHolder: StockHolderRepo;
|
|
26
26
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -27,24 +27,13 @@ function voidTransactionByActionId(params) {
|
|
|
27
27
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
28
28
|
// }
|
|
29
29
|
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
|
|
30
|
-
const action = await repos.
|
|
30
|
+
const action = await repos.actions.authorizeOffer.findAnyActionById({ 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');
|
|
33
33
|
}
|
|
34
34
|
// MongoDBでcompleteステータスであるにも関わらず、Chevreでは削除されている、というのが最悪の状況
|
|
35
35
|
// それだけは回避するためにMongoDBを先に変更
|
|
36
|
-
await repos.
|
|
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
|
-
// }
|
|
36
|
+
await repos.actions.authorizeOffer.cancelWithVoid({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id, cancelAction });
|
|
48
37
|
await (0, any_1.voidAcceptedOffer)({
|
|
49
38
|
authorizeActionsWithInstrument: [action],
|
|
50
39
|
placeOrderId: params.purpose.id
|
|
@@ -57,7 +46,6 @@ function voidTransactionByActionId(params) {
|
|
|
57
46
|
}
|
|
58
47
|
await (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: false })({
|
|
59
48
|
actions: repos.actions,
|
|
60
|
-
acceptCOAOfferAction: repos.acceptCOAOfferAction,
|
|
61
49
|
reserveService,
|
|
62
50
|
task: repos.task
|
|
63
51
|
});
|
|
@@ -130,7 +130,7 @@ function reAcceptOffer(params) {
|
|
|
130
130
|
// }
|
|
131
131
|
const coaInfo = await findCOAInfo({ id: params.object.event.id, project: { id: transaction.project.id } })(repos);
|
|
132
132
|
// 承認アクション存在検証
|
|
133
|
-
await repos.authorizeOfferAction.
|
|
133
|
+
await repos.authorizeOfferAction.findAnyActionById({ id: params.potentialActions.id, typeOf: factory_1.factory.actionType.AuthorizeAction }, ['id'], []);
|
|
134
134
|
const actionAttributes = {
|
|
135
135
|
project: transaction.project,
|
|
136
136
|
typeOf: factory_1.factory.actionType.AcceptAction,
|
|
@@ -27,7 +27,7 @@ function changeOffers(params) {
|
|
|
27
27
|
// throw new factory.errors.NotFound('transaction.object.orderNumber');
|
|
28
28
|
// }
|
|
29
29
|
// 取引内のアクションかどうか確認
|
|
30
|
-
const authorizeAction = await repos.action.
|
|
30
|
+
const authorizeAction = await repos.action.findAnyActionById({ typeOf: factory_2.factory.actionType.AuthorizeAction, id: params.id });
|
|
31
31
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
32
32
|
throw new factory_2.factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
33
33
|
}
|
|
@@ -13,7 +13,7 @@ function onPaymentStatusChanged(params) {
|
|
|
13
13
|
case factory_1.factory.actionType.PayAction: {
|
|
14
14
|
// アクションリポジトリから実アクションを参照する
|
|
15
15
|
// そうすることで、通知する情報は最低限で済む
|
|
16
|
-
const action = await repos.actions.pay.
|
|
16
|
+
const action = await repos.actions.pay.findAnyActionById({ id: params.id, typeOf: params.typeOf });
|
|
17
17
|
const optimizedAction = optimizeAction4report((action));
|
|
18
18
|
await (0, onPaid_1.onPaid)(optimizedAction, { id: action.project.id })(repos);
|
|
19
19
|
break;
|
|
@@ -21,7 +21,7 @@ function onPaymentStatusChanged(params) {
|
|
|
21
21
|
case factory_1.factory.actionType.RefundAction: {
|
|
22
22
|
// アクションリポジトリから実アクションを参照する
|
|
23
23
|
// そうすることで、通知する情報は最低限で済む
|
|
24
|
-
const action = await repos.actions.refund.
|
|
24
|
+
const action = await repos.actions.refund.findAnyActionById({ id: params.id, typeOf: params.typeOf });
|
|
25
25
|
const optimizedAction = optimizeAction4report((action));
|
|
26
26
|
await (0, onRefunded_1.onRefunded)(optimizedAction, { id: action.project.id })(repos);
|
|
27
27
|
break;
|
|
@@ -58,7 +58,7 @@ function processVoidPayTransaction(params) {
|
|
|
58
58
|
// 承認アクションを取得
|
|
59
59
|
let authorizeActions;
|
|
60
60
|
if (typeof params.id === 'string') {
|
|
61
|
-
const authorizeAction = await repos.authorizePaymentMethodAction.
|
|
61
|
+
const authorizeAction = await repos.authorizePaymentMethodAction.findAnyActionById({ typeOf: factory_1.factory.actionType.AuthorizeAction, id: params.id });
|
|
62
62
|
// 取引内のアクションかどうか確認
|
|
63
63
|
if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
|
|
64
64
|
throw new factory_1.factory.errors.Argument('Transaction', 'Action not found in the transaction');
|
|
@@ -21,7 +21,6 @@ let coaAuthClientCreated = false;
|
|
|
21
21
|
let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
22
22
|
endpoint: '', // 使用されないので空文字でok
|
|
23
23
|
refreshToken: '', // 使用されないので空文字でok
|
|
24
|
-
// useFetch: true
|
|
25
24
|
});
|
|
26
25
|
/**
|
|
27
26
|
* タスク実行関数
|
|
@@ -58,9 +57,11 @@ function call(params) {
|
|
|
58
57
|
project: { id: params.project.id },
|
|
59
58
|
sameAs: { id: params.id }
|
|
60
59
|
})({
|
|
61
|
-
actions: {
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
actions: {
|
|
61
|
+
cancel: new cancel_1.CancelActionRepo(connection),
|
|
62
|
+
acceptCOAOffer: new acceptCOAOffer_1.AcceptCOAOfferActionRepo(connection),
|
|
63
|
+
authorizeOffer: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
|
|
64
|
+
},
|
|
64
65
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
65
66
|
stockHolder: new stockHolder_1.StockHolderRepo({ connection }),
|
|
66
67
|
offerRateLimit: new offer_1.OfferRateLimitRepo(redisClient),
|
package/package.json
CHANGED