@chevre/domain 26.1.0-alpha.4 → 26.1.0-alpha.5
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/acceptCOAOffer.d.ts +12 -3
- package/lib/chevre/repo/action/acceptCOAOffer.js +64 -11
- package/lib/chevre/repo/concurrentLock.js +18 -8
- package/lib/chevre/repo/concurrentLockAbstract.d.ts +0 -12
- package/lib/chevre/repo/mongoose/schemas/action/acceptCOAOffer.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/action/acceptCOAOffer.js +3 -0
- package/lib/chevre/repo/passport.js +0 -14
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +7 -3
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +4 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +5 -5
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +6 -6
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +3 -1
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +1 -2
- package/lib/chevre/service/task/acceptCOAOffer.js +9 -6
- package/lib/chevre/service/task/authorizePayment.js +0 -1
- package/lib/chevre/service/task/checkMovieTicket.js +0 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +0 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +0 -1
- package/package.json +1 -1
|
@@ -2,12 +2,16 @@ import type { Connection } from 'mongoose';
|
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
import { IActionRecipe, IKeyOfProjection, ActionProcessRepo } from './anyAction/actionProcess';
|
|
4
4
|
export type IAcceptCOAOfferAction = factory.action.accept.coaOffer.IAction;
|
|
5
|
+
type IAcceptCOAOfferActionAsFindResult = Pick<IAcceptCOAOfferAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'id' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'> & {
|
|
6
|
+
expires?: never;
|
|
7
|
+
cancelAction?: never;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* COAオファー採用リポジトリ
|
|
7
11
|
*/
|
|
8
12
|
export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptCOAOfferAction, IActionRecipe<factory.recipe.RecipeCategory.acceptCOAOffer>> {
|
|
9
13
|
constructor(connection: Connection);
|
|
10
|
-
|
|
14
|
+
findAcceptCOAOfferActionBySameAs(params: {
|
|
11
15
|
sameAs: {
|
|
12
16
|
id: string;
|
|
13
17
|
};
|
|
@@ -18,7 +22,7 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
|
|
|
18
22
|
/**
|
|
19
23
|
* 完了済の採用アクションを参照する
|
|
20
24
|
*/
|
|
21
|
-
|
|
25
|
+
findCompletedAcceptCOAOfferActionById(params: {
|
|
22
26
|
project: {
|
|
23
27
|
id: string;
|
|
24
28
|
};
|
|
@@ -38,5 +42,10 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
|
|
|
38
42
|
typeOf: factory.transactionType;
|
|
39
43
|
id: string;
|
|
40
44
|
};
|
|
41
|
-
}): Promise<
|
|
45
|
+
}): Promise<IAcceptCOAOfferActionAsFindResult[]>;
|
|
46
|
+
findAcceptCOAOfferActionById(params: {
|
|
47
|
+
typeOf: IAcceptCOAOfferAction['typeOf'];
|
|
48
|
+
id: string;
|
|
49
|
+
}): Promise<IAcceptCOAOfferActionAsFindResult>;
|
|
42
50
|
}
|
|
51
|
+
export {};
|
|
@@ -2,7 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AcceptCOAOfferActionRepo = void 0;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
+
const settings_1 = require("../../settings");
|
|
5
6
|
const actionProcess_1 = require("./anyAction/actionProcess");
|
|
7
|
+
const defaultFindProjection = {
|
|
8
|
+
_id: 0,
|
|
9
|
+
id: { $toString: '$_id' },
|
|
10
|
+
project: 1,
|
|
11
|
+
actionStatus: 1,
|
|
12
|
+
typeOf: 1,
|
|
13
|
+
agent: 1,
|
|
14
|
+
result: 1,
|
|
15
|
+
error: 1,
|
|
16
|
+
object: 1,
|
|
17
|
+
startDate: 1,
|
|
18
|
+
endDate: 1,
|
|
19
|
+
purpose: 1,
|
|
20
|
+
potentialActions: 1,
|
|
21
|
+
instrument: 1,
|
|
22
|
+
sameAs: 1,
|
|
23
|
+
// 'cancelAction', // projectしなくてよいはず
|
|
24
|
+
};
|
|
6
25
|
const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
|
|
7
26
|
/**
|
|
8
27
|
* COAオファー採用リポジトリ
|
|
@@ -14,7 +33,7 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
14
33
|
recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
|
|
15
34
|
});
|
|
16
35
|
}
|
|
17
|
-
async
|
|
36
|
+
async findAcceptCOAOfferActionBySameAs(params) {
|
|
18
37
|
return this.actionModel.findOne({
|
|
19
38
|
typeOf: { $eq: factory_1.factory.actionType.AcceptAction }, // 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
|
|
20
39
|
'sameAs.id': { $exists: true, $eq: params.sameAs.id },
|
|
@@ -34,7 +53,7 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
34
53
|
/**
|
|
35
54
|
* 完了済の採用アクションを参照する
|
|
36
55
|
*/
|
|
37
|
-
async
|
|
56
|
+
async findCompletedAcceptCOAOfferActionById(params, inclusion) {
|
|
38
57
|
let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
|
|
39
58
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
40
59
|
positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
@@ -58,16 +77,50 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
58
77
|
}
|
|
59
78
|
return doc;
|
|
60
79
|
}
|
|
80
|
+
// 基底クラスに非依存で再実装(2026-08-22~)
|
|
81
|
+
// public async findAcceptCOAOfferActionsByPurpose_(params: {
|
|
82
|
+
// /**
|
|
83
|
+
// * 注文取引でフィルター
|
|
84
|
+
// */
|
|
85
|
+
// purpose: {
|
|
86
|
+
// typeOf: factory.transactionType;
|
|
87
|
+
// id: string;
|
|
88
|
+
// };
|
|
89
|
+
// }): Promise<IAcceptCOAOfferAction[]> {
|
|
90
|
+
// return this.findAnyActionsByPurpose({
|
|
91
|
+
// ...params,
|
|
92
|
+
// typeOf: factory.actionType.AcceptAction,
|
|
93
|
+
// purpose: {
|
|
94
|
+
// typeOf: params.purpose.typeOf,
|
|
95
|
+
// id: params.purpose.id
|
|
96
|
+
// },
|
|
97
|
+
// object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
|
|
98
|
+
// });
|
|
99
|
+
// }
|
|
61
100
|
async findAcceptCOAOfferActionsByPurpose(params) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
typeOf: factory_1.factory.
|
|
65
|
-
purpose: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
101
|
+
const filter = {
|
|
102
|
+
typeOf: { $eq: factory_1.factory.actionType.AcceptAction },
|
|
103
|
+
'object.typeOf': { $exists: true, $eq: factory_1.factory.offerType.AggregateOffer },
|
|
104
|
+
'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf },
|
|
105
|
+
'purpose.id': { $exists: true, $eq: params.purpose.id },
|
|
106
|
+
};
|
|
107
|
+
return this.actionModel.find(filter, defaultFindProjection)
|
|
108
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
109
|
+
.lean()
|
|
110
|
+
.exec();
|
|
111
|
+
}
|
|
112
|
+
// 基底クラスに非依存で再実装(2026-08-22~)
|
|
113
|
+
async findAcceptCOAOfferActionById(params) {
|
|
114
|
+
const doc = await this.actionModel.findOne({
|
|
115
|
+
typeOf: { $eq: params.typeOf },
|
|
116
|
+
_id: { $eq: params.id }
|
|
117
|
+
}, defaultFindProjection)
|
|
118
|
+
.lean() // 2024-08-26~
|
|
119
|
+
.exec();
|
|
120
|
+
if (doc === null) {
|
|
121
|
+
throw new factory_1.factory.errors.NotFound(this.actionModel.modelName);
|
|
122
|
+
}
|
|
123
|
+
return doc;
|
|
71
124
|
}
|
|
72
125
|
}
|
|
73
126
|
exports.AcceptCOAOfferActionRepo = AcceptCOAOfferActionRepo;
|
|
@@ -17,16 +17,26 @@ class ConcurrentLockRepo {
|
|
|
17
17
|
async lock(params) {
|
|
18
18
|
const key = ConcurrentLockRepo.CREATE_REDIS_KEY(params);
|
|
19
19
|
const value = params.audience.identifier;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
// setNXは非推奨のため、setで再実装(2026-08-23~)
|
|
21
|
+
// const results = await this.redisClient.multi()
|
|
22
|
+
// .setNX(key, value)
|
|
23
|
+
// .expireAt(key, params.expires)
|
|
24
|
+
// .exec();
|
|
25
|
+
// if (Array.isArray(results) && (results[0] === 1 || (results as any)[0] === true)) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
26
|
+
// return;
|
|
27
|
+
// } else {
|
|
28
|
+
// throw new factory.errors.AlreadyInUse(params.about.identifier, []);
|
|
29
|
+
// }
|
|
30
|
+
const expiresAtMs = params.expires.getTime();
|
|
31
|
+
const result = await this.redisClient.set(key, value, {
|
|
32
|
+
NX: true,
|
|
33
|
+
PXAT: expiresAtMs // Set the specified Unix time at which the key will expire, in milliseconds (a positive integer).
|
|
34
|
+
});
|
|
35
|
+
// 成功時は 'OK' が返り、既に存在してロック失敗した場合は null が返る
|
|
36
|
+
if (result === 'OK') {
|
|
25
37
|
return;
|
|
26
38
|
}
|
|
27
|
-
|
|
28
|
-
throw new factory_1.factory.errors.AlreadyInUse(params.about.identifier, []);
|
|
29
|
-
}
|
|
39
|
+
throw new factory_1.factory.errors.AlreadyInUse(params.about.identifier, []);
|
|
30
40
|
}
|
|
31
41
|
async unlock(params) {
|
|
32
42
|
const key = ConcurrentLockRepo.CREATE_REDIS_KEY(params);
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { factory } from '../factory';
|
|
2
|
-
export interface IOffer {
|
|
3
|
-
itemOffered?: {
|
|
4
|
-
serviceOutput?: {
|
|
5
|
-
/**
|
|
6
|
-
* 予約ID
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
seatSection: string;
|
|
12
|
-
seatNumber: string;
|
|
13
|
-
}
|
|
14
2
|
export interface IAbout {
|
|
15
3
|
identifier: string;
|
|
16
4
|
typeOf: 'Thing';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { factory } from '../../../../factory';
|
|
2
|
+
type IAcceptCOAOfferActionDocType = Pick<factory.action.accept.coaOffer.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'expires' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'>;
|
|
3
|
+
export { IAcceptCOAOfferActionDocType };
|
|
@@ -80,20 +80,6 @@ class PassportRepo {
|
|
|
80
80
|
catch (_error) {
|
|
81
81
|
throw new factory_1.factory.errors.AlreadyInUse('passport', [], 'passport already in use');
|
|
82
82
|
}
|
|
83
|
-
// const ttl = (passportExpires.isAfter(now))
|
|
84
|
-
// ? moment.unix(params.exp)
|
|
85
|
-
// .diff(moment(), 'seconds')
|
|
86
|
-
// : 1;
|
|
87
|
-
// const results = await this.redisClient.multi()
|
|
88
|
-
// .setNX(key, '1')
|
|
89
|
-
// .expire(key, ttl)
|
|
90
|
-
// .exec();
|
|
91
|
-
// debug('locked,', params.issueUnit.identifier, now, passportExpires, ttl, results);
|
|
92
|
-
// if (Array.isArray(results) && (results[0] === 1 || (<any>results)[0] === true)) {
|
|
93
|
-
// return;
|
|
94
|
-
// } else {
|
|
95
|
-
// throw new factory.errors.AlreadyInUse('passport', [], 'passport already in use');
|
|
96
|
-
// }
|
|
97
83
|
}
|
|
98
84
|
/**
|
|
99
85
|
* 許可証トークンがあれば検証する
|
|
@@ -23,7 +23,7 @@ type ICancelByAcceptActionOperation<T> = (repos: ICancelByAcceptActionRepos) =>
|
|
|
23
23
|
* 興行オファー採用アクションからCOA予約を取り消す
|
|
24
24
|
*/
|
|
25
25
|
declare function cancelByAcceptAction(params: {
|
|
26
|
-
action: factory.action.accept.coaOffer.IAction
|
|
26
|
+
action: Pick<factory.action.accept.coaOffer.IAction, 'project' | 'id' | 'purpose'>;
|
|
27
27
|
}, options: {
|
|
28
28
|
/**
|
|
29
29
|
* cancelPendingReservation async?(2025-03-03~)
|
|
@@ -19,7 +19,7 @@ declare function processVoidTransaction4coa(params: {
|
|
|
19
19
|
task: TaskRepo;
|
|
20
20
|
}) => Promise<void>;
|
|
21
21
|
declare function processVoidTransactionByAcceptAction4coa(params: {
|
|
22
|
-
action: factory.action.accept.coaOffer.IAction
|
|
22
|
+
action: Pick<factory.action.accept.coaOffer.IAction, 'project' | 'id' | 'purpose'>;
|
|
23
23
|
}, options: {
|
|
24
24
|
/**
|
|
25
25
|
* cancelPendingReservation async?(2025-03-03~)
|
|
@@ -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.actions.acceptCOAOffer.
|
|
16
|
+
const acceptAction = await repos.actions.acceptCOAOffer.findAcceptCOAOfferActionById({ 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
|
};
|
|
@@ -5,15 +5,19 @@ import type { EventRepo } from '../../../repo/event';
|
|
|
5
5
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
6
6
|
import { factory } from '../../../factory';
|
|
7
7
|
interface IAcceptRepos {
|
|
8
|
-
|
|
8
|
+
actions: {
|
|
9
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
10
|
+
};
|
|
9
11
|
event: EventRepo;
|
|
10
12
|
placeOrder: PlaceOrderRepo;
|
|
11
13
|
reserveService: COA.service.Reserve;
|
|
12
14
|
masterService: COA.service.Master;
|
|
13
15
|
}
|
|
14
16
|
interface IReAcceptRepos {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
actions: {
|
|
18
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
19
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
20
|
+
};
|
|
17
21
|
event: EventRepo;
|
|
18
22
|
placeOrder: PlaceOrderRepo;
|
|
19
23
|
reserveService: COA.service.Reserve;
|
|
@@ -65,7 +65,7 @@ function acceptOffer(params) {
|
|
|
65
65
|
// requestBody: updTmpReserveSeatArgs // discontinue(2024-06-11~)
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
const action = await repos.
|
|
68
|
+
const action = await repos.actions.acceptCOAOffer.start(actionAttributes, { recipe }); // add recipe(2024-06-11~)
|
|
69
69
|
try {
|
|
70
70
|
const acceptedOffersWithoutDetails = await (0, authorize_1.createAcceptedOffersWithoutDetails)({
|
|
71
71
|
object: params.object,
|
|
@@ -93,7 +93,7 @@ function acceptOffer(params) {
|
|
|
93
93
|
}
|
|
94
94
|
catch (error) {
|
|
95
95
|
try {
|
|
96
|
-
await repos.
|
|
96
|
+
await repos.actions.acceptCOAOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
97
97
|
}
|
|
98
98
|
catch (__) {
|
|
99
99
|
// no op
|
|
@@ -105,7 +105,7 @@ function acceptOffer(params) {
|
|
|
105
105
|
result: { responseBody: { tmpReserveNum: updTmpReserveSeatResult.tmpReserveNum } },
|
|
106
106
|
typeOf: factory_1.factory.actionType.AuthorizeAction
|
|
107
107
|
};
|
|
108
|
-
await repos.
|
|
108
|
+
await repos.actions.acceptCOAOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result, recipe }); // add recipe(2024-06-11~)
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
@@ -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.
|
|
133
|
+
await repos.actions.authorizeOffer.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,
|
|
@@ -143,7 +143,7 @@ function reAcceptOffer(params) {
|
|
|
143
143
|
instrument: { typeOf: factory_1.factory.assetTransactionType.COAReserveTransaction }
|
|
144
144
|
};
|
|
145
145
|
let acceptedOffer;
|
|
146
|
-
const action = await repos.
|
|
146
|
+
const action = await repos.actions.acceptCOAOffer.start(actionAttributes);
|
|
147
147
|
try {
|
|
148
148
|
const acceptedOffersWithoutDetails = params.object.acceptedOffer.map((offer) => {
|
|
149
149
|
return {
|
|
@@ -168,7 +168,7 @@ function reAcceptOffer(params) {
|
|
|
168
168
|
}
|
|
169
169
|
catch (error) {
|
|
170
170
|
try {
|
|
171
|
-
await repos.
|
|
171
|
+
await repos.actions.acceptCOAOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
172
172
|
}
|
|
173
173
|
catch (__) {
|
|
174
174
|
// no op
|
|
@@ -183,6 +183,6 @@ function reAcceptOffer(params) {
|
|
|
183
183
|
},
|
|
184
184
|
typeOf: factory_1.factory.actionType.AuthorizeAction
|
|
185
185
|
};
|
|
186
|
-
await repos.
|
|
186
|
+
await repos.actions.acceptCOAOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
187
187
|
};
|
|
188
188
|
}
|
|
@@ -11,8 +11,10 @@ import { factory } from '../../../factory';
|
|
|
11
11
|
export { IRequestBody, IResponseBody };
|
|
12
12
|
export type IAuthorizeActionResult = factory.action.authorize.offer.eventService.IResult;
|
|
13
13
|
export interface IAuthorizeRepos {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
actions: {
|
|
15
|
+
authorizeOffer: AuthorizeOfferActionRepo;
|
|
16
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
17
|
+
};
|
|
16
18
|
categoryCode: CategoryCodeRepo;
|
|
17
19
|
event: EventRepo;
|
|
18
20
|
offer: OfferRepo;
|
|
@@ -78,8 +78,8 @@ function authorize(params) {
|
|
|
78
78
|
transaction,
|
|
79
79
|
pendingTransaction
|
|
80
80
|
});
|
|
81
|
-
const failedAction = await repos.
|
|
82
|
-
await repos.
|
|
81
|
+
const failedAction = await repos.actions.authorizeOffer.start(failedActionAttributes);
|
|
82
|
+
await repos.actions.authorizeOffer.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
|
|
83
83
|
throw error;
|
|
84
84
|
}
|
|
85
85
|
// const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.transaction.id });
|
|
@@ -95,7 +95,7 @@ function authorize(params) {
|
|
|
95
95
|
transaction,
|
|
96
96
|
pendingTransaction
|
|
97
97
|
});
|
|
98
|
-
const action = await repos.
|
|
98
|
+
const action = await repos.actions.authorizeOffer.start(actionAttributes);
|
|
99
99
|
try {
|
|
100
100
|
// 座席仮予約からオファー情報を生成する
|
|
101
101
|
const { price } = (0, factory_1.offers2resultPrice)(acceptedOffers);
|
|
@@ -123,14 +123,14 @@ function authorize(params) {
|
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
125
125
|
try {
|
|
126
|
-
await repos.
|
|
126
|
+
await repos.actions.authorizeOffer.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
127
127
|
}
|
|
128
128
|
catch (__) {
|
|
129
129
|
// no op
|
|
130
130
|
}
|
|
131
131
|
throw error;
|
|
132
132
|
}
|
|
133
|
-
await repos.
|
|
133
|
+
await repos.actions.authorizeOffer.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
134
134
|
return {
|
|
135
135
|
id: action.id,
|
|
136
136
|
instrument: actionAttributes.instrument,
|
|
@@ -9,7 +9,7 @@ const factory_1 = require("../../../factory");
|
|
|
9
9
|
*/
|
|
10
10
|
function authorizeByAcceptAction(params) {
|
|
11
11
|
return async (repos) => {
|
|
12
|
-
const acceptAction = await repos.
|
|
12
|
+
const acceptAction = await repos.actions.acceptCOAOffer.findCompletedAcceptCOAOfferActionById({
|
|
13
13
|
project: { id: params.project.id },
|
|
14
14
|
id: params.object.id,
|
|
15
15
|
purpose: { id: params.purpose.id },
|
|
@@ -34,7 +34,7 @@ function authorizeByAcceptAction(params) {
|
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
// recipe依存へ変更(2024-06-11~)
|
|
37
|
-
const recipe = await repos.
|
|
37
|
+
const recipe = await repos.actions.acceptCOAOffer.findRecipeByAction({
|
|
38
38
|
project: { id: params.project.id },
|
|
39
39
|
recipeFor: { id: params.object.id }
|
|
40
40
|
});
|
|
@@ -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.
|
|
30
|
+
const authorizeAction = await repos.actions.authorizeOffer.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
|
}
|
|
@@ -48,7 +48,7 @@ function changeOffers(params) {
|
|
|
48
48
|
// },
|
|
49
49
|
// ['result']
|
|
50
50
|
// )).shift()?.result;
|
|
51
|
-
const originalAcceptResult = (await repos.
|
|
51
|
+
const originalAcceptResult = (await repos.actions.acceptCOAOffer.findCompletedAcceptCOAOfferActionById({
|
|
52
52
|
project: { id: authorizeAction.project.id },
|
|
53
53
|
id: originalAcceptActionId,
|
|
54
54
|
purpose: { id: authorizeAction.purpose.id },
|
|
@@ -111,7 +111,7 @@ function changeOffers(params) {
|
|
|
111
111
|
// authorizeAction.object.acceptedOffer = acceptedOffers; // discontinue acceptedOffers(2024-06-21~)
|
|
112
112
|
// recipe依存へ変更(2024-06-11~)
|
|
113
113
|
// const updTmpReserveSeatResult = authorizeAction.result?.responseBody;
|
|
114
|
-
const recipe = await repos.
|
|
114
|
+
const recipe = await repos.actions.acceptCOAOffer.findRecipeByAction({
|
|
115
115
|
project: { id: transaction.project.id },
|
|
116
116
|
recipeFor: { id: originalAcceptActionId }
|
|
117
117
|
});
|
|
@@ -136,7 +136,7 @@ function changeOffers(params) {
|
|
|
136
136
|
// amount: [] // discontinue(2026-07-06~)
|
|
137
137
|
};
|
|
138
138
|
// ActiveActionStatus->CompletedActionStatusで再実装(2024-01-15~)
|
|
139
|
-
await repos.
|
|
139
|
+
await repos.actions.authorizeOffer.reStart({ id: authorizeAction.id, typeOf: authorizeAction.typeOf });
|
|
140
140
|
try {
|
|
141
141
|
// // まずvoidAcceptedOffer
|
|
142
142
|
// // const orderNumberByTransaction = transaction.object.orderNumber;
|
|
@@ -163,7 +163,7 @@ function changeOffers(params) {
|
|
|
163
163
|
}
|
|
164
164
|
catch (error) {
|
|
165
165
|
try {
|
|
166
|
-
await repos.
|
|
166
|
+
await repos.actions.authorizeOffer.giveUp({ typeOf: authorizeAction.typeOf, id: authorizeAction.id, error });
|
|
167
167
|
}
|
|
168
168
|
catch (__) {
|
|
169
169
|
// no op
|
|
@@ -171,7 +171,7 @@ function changeOffers(params) {
|
|
|
171
171
|
throw error;
|
|
172
172
|
}
|
|
173
173
|
// 承認アクションを再完了
|
|
174
|
-
await repos.
|
|
174
|
+
await repos.actions.authorizeOffer.reCompleteAuthorizeEventOfferAction({
|
|
175
175
|
id: params.id,
|
|
176
176
|
object: authorizeAction.object,
|
|
177
177
|
result: actionResult
|
|
@@ -35,7 +35,9 @@ declare function findAcceptAction(params: {
|
|
|
35
35
|
id: string;
|
|
36
36
|
};
|
|
37
37
|
}): (repos: {
|
|
38
|
-
|
|
38
|
+
actions: {
|
|
39
|
+
acceptCOAOffer: AcceptCOAOfferActionRepo;
|
|
40
|
+
};
|
|
39
41
|
asyncAction: AsyncActionRepo;
|
|
40
42
|
}) => Promise<IFindAcceptActionResult>;
|
|
41
43
|
export { findAcceptAction };
|
|
@@ -43,9 +43,8 @@ function findAcceptAction(params) {
|
|
|
43
43
|
break;
|
|
44
44
|
default: {
|
|
45
45
|
// タスクがReadyでなければアクション検索
|
|
46
|
-
const acceptAction = (await repos.
|
|
46
|
+
const acceptAction = (await repos.actions.acceptCOAOffer.findAcceptCOAOfferActionBySameAs({
|
|
47
47
|
sameAs: { id: task.id }
|
|
48
|
-
// purpose: { id: { $eq: String(params.purpose.id) } }
|
|
49
48
|
}));
|
|
50
49
|
if (typeof acceptAction?.id === 'string') {
|
|
51
50
|
// purpose検証
|
|
@@ -49,7 +49,7 @@ function call(params) {
|
|
|
49
49
|
...(credentialsRepo !== undefined) ? { credentialsRepo } : undefined
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const acceptCOAOfferActionRepo = new acceptCOAOffer_1.AcceptCOAOfferActionRepo(connection);
|
|
53
53
|
try {
|
|
54
54
|
const coaIntegrationSettings = await settings.getByKey('coa');
|
|
55
55
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
@@ -75,8 +75,10 @@ function call(params) {
|
|
|
75
75
|
sameAs: { id: params.id },
|
|
76
76
|
isMember
|
|
77
77
|
})({
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
actions: {
|
|
79
|
+
acceptCOAOffer: acceptCOAOfferActionRepo,
|
|
80
|
+
authorizeOffer: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
|
|
81
|
+
},
|
|
80
82
|
event: new event_1.EventRepo(connection),
|
|
81
83
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
82
84
|
reserveService,
|
|
@@ -92,7 +94,9 @@ function call(params) {
|
|
|
92
94
|
sameAs: { id: params.id },
|
|
93
95
|
isMember
|
|
94
96
|
})({
|
|
95
|
-
|
|
97
|
+
actions: {
|
|
98
|
+
acceptCOAOffer: acceptCOAOfferActionRepo,
|
|
99
|
+
},
|
|
96
100
|
event: new event_1.EventRepo(connection),
|
|
97
101
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
98
102
|
reserveService,
|
|
@@ -103,7 +107,7 @@ function call(params) {
|
|
|
103
107
|
catch (error) {
|
|
104
108
|
let throwsError = true;
|
|
105
109
|
// アクションが存在すればタスクを実行済扱いにする
|
|
106
|
-
const action = (await
|
|
110
|
+
const action = (await acceptCOAOfferActionRepo.findAcceptCOAOfferActionBySameAs({
|
|
107
111
|
sameAs: { id: params.id },
|
|
108
112
|
purpose: { id: params.data.purpose.id }
|
|
109
113
|
}));
|
|
@@ -117,7 +121,6 @@ function call(params) {
|
|
|
117
121
|
finally {
|
|
118
122
|
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
119
123
|
// 取引プロセスロック解除
|
|
120
|
-
// await transactionProcessRepo.unlock({ typeOf: factory.transactionType.PlaceOrder, id: params.data.purpose.id });
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
126
|
}
|
|
@@ -110,7 +110,6 @@ function call(params) {
|
|
|
110
110
|
// 取引プロセスロック解除(2024-04-20~)
|
|
111
111
|
if (params.data.options.useUnlockTransactionProcess) {
|
|
112
112
|
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
113
|
-
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
if (callResult !== undefined) {
|
|
@@ -62,7 +62,6 @@ function call(params) {
|
|
|
62
62
|
// 取引プロセスロック解除
|
|
63
63
|
if (typeof params.data.purpose?.id === 'string') {
|
|
64
64
|
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
65
|
-
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
};
|
|
@@ -80,7 +80,6 @@ function call(params) {
|
|
|
80
80
|
// アクションID指定であれば取引プロセスロック解除(2024-05-26~)
|
|
81
81
|
if (voidByActionId) {
|
|
82
82
|
// taskRepo.runImmediatelyのnextパラメータでの解決へ移行したためここでの解除は不要(2025-07-12~)
|
|
83
|
-
// await transactionProcessRepo.unlock({ typeOf: params.data.purpose.typeOf, id: params.data.purpose.id });
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
};
|
package/package.json
CHANGED