@chevre/domain 22.9.0-alpha.75 → 22.9.0-alpha.76
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/example/src/chevre/countPotentiallyExpired.ts +15 -1
- package/example/src/chevre/searchAuthorizations.ts +4 -3
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -4
- package/lib/chevre/repo/authorization.d.ts +2 -1
- package/lib/chevre/repo/authorization.js +25 -19
- package/lib/chevre/repo/task.d.ts +15 -0
- package/lib/chevre/repo/task.js +24 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -0
- package/lib/chevre/service/reserve/checkInReservation.d.ts +5 -0
- package/lib/chevre/service/reserve/checkInReservation.js +6 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +29 -0
- package/lib/chevre/service/reserve/useReservation.d.ts +2 -0
- package/lib/chevre/service/reserve/useReservation.js +0 -18
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +2 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +2 -0
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +2 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +9 -15
- package/lib/chevre/service/task/reserve.js +2 -0
- package/lib/chevre/service/task/useReservation.js +2 -0
- package/lib/chevre/service/task.js +1 -0
- package/package.json +2 -2
|
@@ -11,7 +11,9 @@ async function main() {
|
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
13
|
const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
|
|
14
|
-
const
|
|
14
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
let result = await transactionRepo.countPotentiallyExpired({
|
|
15
17
|
expires: {
|
|
16
18
|
$lt: moment()
|
|
17
19
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -21,6 +23,18 @@ async function main() {
|
|
|
21
23
|
limit: 10
|
|
22
24
|
});
|
|
23
25
|
console.log('result', result);
|
|
26
|
+
|
|
27
|
+
result = await taskRepo.countPotentiallyRunning({
|
|
28
|
+
runsAt: {
|
|
29
|
+
$lt: moment()
|
|
30
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
31
|
+
.add(-60, 'seconds')
|
|
32
|
+
.toDate()
|
|
33
|
+
},
|
|
34
|
+
name: { $eq: chevre.factory.taskName.DeleteTransaction },
|
|
35
|
+
limit: 10
|
|
36
|
+
});
|
|
37
|
+
console.log('result', result);
|
|
24
38
|
}
|
|
25
39
|
|
|
26
40
|
main()
|
|
@@ -22,9 +22,10 @@ async function main() {
|
|
|
22
22
|
const docs = await authorizationRepo.projectFields(
|
|
23
23
|
{
|
|
24
24
|
limit: 10,
|
|
25
|
-
project: { id: { $eq: project.id } }
|
|
26
|
-
audience: { id: { $eq: '6749bd9b84c1b2a0759cbfc8' } }
|
|
27
|
-
}
|
|
25
|
+
project: { id: { $eq: project.id } }
|
|
26
|
+
// audience: { id: { $eq: '6749bd9b84c1b2a0759cbfc8' } }
|
|
27
|
+
},
|
|
28
|
+
['code']
|
|
28
29
|
);
|
|
29
30
|
console.log('docs found', docs);
|
|
30
31
|
console.log(docs.length, 'docs found');
|
|
@@ -9,16 +9,17 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const paymentServiceRepo = await chevre.repository.PaymentService.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
let updateResult: any;
|
|
15
15
|
|
|
16
|
-
updateResult = await
|
|
16
|
+
updateResult = await paymentServiceRepo.unsetUnnecessaryFields({
|
|
17
17
|
filter: {
|
|
18
|
-
|
|
18
|
+
'availableChannel.serviceUrl': { $exists: true }
|
|
19
|
+
// _id: { $eq: '657e4003d4abb2d3871bb92f' }
|
|
19
20
|
},
|
|
20
21
|
$unset: {
|
|
21
|
-
|
|
22
|
+
'availableChannel.serviceUrl': 1
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
console.log(updateResult);
|
|
@@ -7,6 +7,7 @@ type ISaveParams = Pick<factory.authorization.IAuthorization, 'audience' | 'auth
|
|
|
7
7
|
expiresInSeconds: number;
|
|
8
8
|
};
|
|
9
9
|
type IPublishParams = Pick<ISaveParams, 'audience' | 'author' | 'expiresInSeconds' | 'issuedBy' | 'object' | 'project' | 'validFrom'>;
|
|
10
|
+
type IKeyOfProjection = keyof factory.authorization.IAuthorization;
|
|
10
11
|
/**
|
|
11
12
|
* 承認リポジトリ
|
|
12
13
|
*/
|
|
@@ -36,7 +37,7 @@ export declare class AuthorizationRepo {
|
|
|
36
37
|
};
|
|
37
38
|
id: string;
|
|
38
39
|
}): Promise<Pick<IFindValidOneResult, 'object'>>;
|
|
39
|
-
projectFields(params: factory.authorization.ISearchConditions): Promise<(factory.authorization.IAuthorization & {
|
|
40
|
+
projectFields(params: factory.authorization.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<(factory.authorization.IAuthorization & {
|
|
40
41
|
id: string;
|
|
41
42
|
})[]>;
|
|
42
43
|
/**
|
|
@@ -15,6 +15,17 @@ const uuid = require("uuid");
|
|
|
15
15
|
const factory = require("../factory");
|
|
16
16
|
const authorization_1 = require("./mongoose/schemas/authorization");
|
|
17
17
|
const settings_1 = require("../settings");
|
|
18
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
19
|
+
'project',
|
|
20
|
+
'typeOf',
|
|
21
|
+
'code',
|
|
22
|
+
'object',
|
|
23
|
+
'validFrom',
|
|
24
|
+
'validUntil',
|
|
25
|
+
'audience',
|
|
26
|
+
'author',
|
|
27
|
+
'issuedBy'
|
|
28
|
+
];
|
|
18
29
|
/**
|
|
19
30
|
* 承認リポジトリ
|
|
20
31
|
*/
|
|
@@ -24,7 +35,7 @@ class AuthorizationRepo {
|
|
|
24
35
|
}
|
|
25
36
|
// tslint:disable-next-line:max-func-body-length
|
|
26
37
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
28
39
|
const andConditions = [];
|
|
29
40
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
30
41
|
if (typeof projectIdEq === 'string') {
|
|
@@ -46,6 +57,10 @@ class AuthorizationRepo {
|
|
|
46
57
|
if (Array.isArray(codeIn)) {
|
|
47
58
|
andConditions.push({ code: { $in: codeIn } });
|
|
48
59
|
}
|
|
60
|
+
const objectOrderNumberEq = (_h = (_g = params.object) === null || _g === void 0 ? void 0 : _g.orderNumber) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
61
|
+
if (typeof objectOrderNumberEq === 'string') {
|
|
62
|
+
andConditions.push({ 'object.orderNumber': { $exists: true, $eq: objectOrderNumberEq } });
|
|
63
|
+
}
|
|
49
64
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
50
65
|
/* istanbul ignore else */
|
|
51
66
|
const object = params.object;
|
|
@@ -89,7 +104,7 @@ class AuthorizationRepo {
|
|
|
89
104
|
if (params.validThrough instanceof Date) {
|
|
90
105
|
andConditions.push({ validFrom: { $lte: params.validThrough } });
|
|
91
106
|
}
|
|
92
|
-
const audienceIdeEq = (
|
|
107
|
+
const audienceIdeEq = (_k = (_j = params.audience) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
93
108
|
if (typeof audienceIdeEq === 'string') {
|
|
94
109
|
andConditions.push({ 'audience.id': { $exists: true, $eq: audienceIdeEq } });
|
|
95
110
|
}
|
|
@@ -152,31 +167,22 @@ class AuthorizationRepo {
|
|
|
152
167
|
return doc;
|
|
153
168
|
});
|
|
154
169
|
}
|
|
155
|
-
projectFields(params) {
|
|
170
|
+
projectFields(params, inclusion) {
|
|
156
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
172
|
var _a;
|
|
158
173
|
const conditions = AuthorizationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
object: 1,
|
|
166
|
-
validFrom: 1,
|
|
167
|
-
validUntil: 1,
|
|
168
|
-
audience: 1,
|
|
169
|
-
author: 1,
|
|
170
|
-
issuedBy: 1
|
|
171
|
-
});
|
|
174
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
175
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
176
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
177
|
+
}
|
|
178
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
179
|
+
const query = this.authorizationModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
172
180
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
173
181
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
174
182
|
query.limit(params.limit)
|
|
175
183
|
.skip(params.limit * (page - 1));
|
|
176
184
|
}
|
|
177
|
-
|
|
178
|
-
/* istanbul ignore else */
|
|
179
|
-
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.validFrom) !== undefined) {
|
|
185
|
+
if (typeof ((_a = params.sort) === null || _a === void 0 ? void 0 : _a.validFrom) === 'number') {
|
|
180
186
|
query.sort({ validFrom: params.sort.validFrom });
|
|
181
187
|
}
|
|
182
188
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
@@ -87,6 +87,21 @@ export declare class TaskRepo {
|
|
|
87
87
|
$lt: Date;
|
|
88
88
|
};
|
|
89
89
|
}): Promise<IExecutableTask<factory.taskName> | null>;
|
|
90
|
+
/**
|
|
91
|
+
* add(2025-03-16~)
|
|
92
|
+
*/
|
|
93
|
+
countPotentiallyRunning(params: {
|
|
94
|
+
name?: {
|
|
95
|
+
$eq?: factory.taskName;
|
|
96
|
+
$nin?: factory.taskName[];
|
|
97
|
+
};
|
|
98
|
+
runsAt: {
|
|
99
|
+
$lt: Date;
|
|
100
|
+
};
|
|
101
|
+
limit?: number;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
count: number;
|
|
104
|
+
}>;
|
|
90
105
|
emitRunningIfExists(params: {
|
|
91
106
|
name?: {
|
|
92
107
|
$eq?: factory.taskName;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -444,6 +444,30 @@ class TaskRepo {
|
|
|
444
444
|
return doc;
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* add(2025-03-16~)
|
|
449
|
+
*/
|
|
450
|
+
countPotentiallyRunning(params) {
|
|
451
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
452
|
+
const { runsAt, limit, name } = params;
|
|
453
|
+
const nameEq = name === null || name === void 0 ? void 0 : name.$eq;
|
|
454
|
+
const nameNin = name === null || name === void 0 ? void 0 : name.$nin;
|
|
455
|
+
if (!(runsAt.$lt instanceof Date)) {
|
|
456
|
+
throw new factory.errors.Argument('runsAt.$lt', 'must be Date');
|
|
457
|
+
}
|
|
458
|
+
const query = this.taskModel.countDocuments(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: params.runsAt.$lt } }, (typeof nameEq === 'string' || Array.isArray(nameNin))
|
|
459
|
+
? {
|
|
460
|
+
name: Object.assign(Object.assign({}, (typeof nameEq === 'string') ? { $eq: nameEq } : undefined), (Array.isArray(nameNin)) ? { $nin: nameNin } : undefined)
|
|
461
|
+
}
|
|
462
|
+
: undefined));
|
|
463
|
+
if (typeof limit === 'number' && limit >= 0) {
|
|
464
|
+
query.limit(limit);
|
|
465
|
+
}
|
|
466
|
+
const count = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
467
|
+
.exec();
|
|
468
|
+
return { count };
|
|
469
|
+
});
|
|
470
|
+
}
|
|
447
471
|
emitRunningIfExists(params) {
|
|
448
472
|
return __awaiter(this, void 0, void 0, function* () {
|
|
449
473
|
var _a, _b;
|
|
@@ -2,6 +2,7 @@ import * as factory from '../../../factory';
|
|
|
2
2
|
import { Settings } from '../../../settings';
|
|
3
3
|
import type { ActionRepo } from '../../../repo/action';
|
|
4
4
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
5
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
5
6
|
import type { OrderRepo } from '../../../repo/order';
|
|
6
7
|
import type { ReservationRepo } from '../../../repo/reservation';
|
|
7
8
|
import type { SettingRepo } from '../../../repo/setting';
|
|
@@ -9,6 +10,7 @@ import type { TaskRepo } from '../../../repo/task';
|
|
|
9
10
|
interface IConfirmRepo {
|
|
10
11
|
action: ActionRepo;
|
|
11
12
|
assetTransaction: AssetTransactionRepo;
|
|
13
|
+
code: AuthorizationRepo;
|
|
12
14
|
order: OrderRepo;
|
|
13
15
|
reservation: ReservationRepo;
|
|
14
16
|
setting: SettingRepo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActionRepo } from '../../repo/action';
|
|
2
2
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
|
+
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
3
4
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
4
5
|
import type { SettingRepo } from '../../repo/setting';
|
|
5
6
|
import type { TaskRepo } from '../../repo/task';
|
|
@@ -26,10 +27,14 @@ interface ICheckInReservationParams {
|
|
|
26
27
|
instrument: {
|
|
27
28
|
orderNumber?: string;
|
|
28
29
|
};
|
|
30
|
+
options: {
|
|
31
|
+
retry: boolean;
|
|
32
|
+
};
|
|
29
33
|
}
|
|
30
34
|
export declare function checkInReservation(params: ICheckInReservationParams): (repos: {
|
|
31
35
|
action: ActionRepo;
|
|
32
36
|
assetTransaction: AssetTransactionRepo;
|
|
37
|
+
code: AuthorizationRepo;
|
|
33
38
|
reservation: ReservationRepo;
|
|
34
39
|
setting: SettingRepo;
|
|
35
40
|
task: TaskRepo;
|
|
@@ -29,7 +29,9 @@ function checkInReservation(params) {
|
|
|
29
29
|
typeOf: factory.reservationType.EventReservation
|
|
30
30
|
});
|
|
31
31
|
if (existingReservationCount !== params.object.ids.length) {
|
|
32
|
-
|
|
32
|
+
if (params.options.retry === true) {
|
|
33
|
+
throw new factory.errors.NotFound(factory.reservationType.EventReservation, `Some reservations dot not exist. ${params.object.ids.join(',')}`);
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
checkedInResult = yield repos.reservation.checkInIfNot({ id: { $in: params.object.ids }, now });
|
|
35
37
|
checkedInReservationIds = params.object.ids;
|
|
@@ -41,7 +43,9 @@ function checkInReservation(params) {
|
|
|
41
43
|
typeOf: factory.reservationType.EventReservation
|
|
42
44
|
});
|
|
43
45
|
if (existingReservationCount === 0) {
|
|
44
|
-
|
|
46
|
+
if (params.options.retry === true) {
|
|
47
|
+
throw new factory.errors.NotFound(factory.reservationType.EventReservation, `Some reservations dot not exist. ${params.object.reservationNumbers.join(',')}`);
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
checkedInResult = yield repos.reservation.checkInIfNot({ reservationNumber: { $in: params.object.reservationNumbers }, now });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { ActionRepo } from '../../repo/action';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
4
5
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
5
6
|
import type { SettingRepo } from '../../repo/setting';
|
|
6
7
|
import type { TaskRepo } from '../../repo/task';
|
|
@@ -14,6 +15,7 @@ export declare function confirmReservation(params: {
|
|
|
14
15
|
}): (repos: {
|
|
15
16
|
action: ActionRepo;
|
|
16
17
|
assetTransaction: AssetTransactionRepo;
|
|
18
|
+
code: AuthorizationRepo;
|
|
17
19
|
reservation: ReservationRepo;
|
|
18
20
|
setting: SettingRepo;
|
|
19
21
|
task: TaskRepo;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* 予約確定時アクション
|
|
3
3
|
*/
|
|
4
4
|
import * as factory from '../../../factory';
|
|
5
|
+
import { AuthorizationRepo } from '../../../repo/authorization';
|
|
5
6
|
import type { SettingRepo } from '../../../repo/setting';
|
|
6
7
|
import type { TaskRepo } from '../../../repo/task';
|
|
7
8
|
type IEventReservation = factory.reservation.IReservation<factory.reservationType.EventReservation>;
|
|
@@ -12,6 +13,7 @@ export declare function onReservationConfirmedByAction(actionAttributes: Pick<fa
|
|
|
12
13
|
task: TaskRepo;
|
|
13
14
|
}) => Promise<void>;
|
|
14
15
|
export declare function onReservationConfirmed(confirmedReservations: IEventReservation[], reserveAction: Pick<factory.action.reserve.IAttributes, 'instrument'>): (repos: {
|
|
16
|
+
code: AuthorizationRepo;
|
|
15
17
|
setting: SettingRepo;
|
|
16
18
|
task: TaskRepo;
|
|
17
19
|
}) => Promise<void>;
|
|
@@ -73,6 +73,35 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
73
73
|
// create AggregateScreeningEvent task -> migrate to agg(2024-10-29~)
|
|
74
74
|
const now = new Date();
|
|
75
75
|
const taskAttributes = [];
|
|
76
|
+
// support OnAuthorizationCreated(2025-03-15~)
|
|
77
|
+
if (typeof (orderAsAbout === null || orderAsAbout === void 0 ? void 0 : orderAsAbout.orderNumber) === 'string') {
|
|
78
|
+
const existingAuthorization = (yield repos.code.projectFields({
|
|
79
|
+
limit: 1,
|
|
80
|
+
page: 1,
|
|
81
|
+
object: {
|
|
82
|
+
orderNumber: { $eq: orderAsAbout.orderNumber },
|
|
83
|
+
typeOfs: [factory.order.OrderType.Order]
|
|
84
|
+
}
|
|
85
|
+
}, ['code'])).shift();
|
|
86
|
+
if (existingAuthorization !== undefined) {
|
|
87
|
+
// tslint:disable-next-line:no-console
|
|
88
|
+
console.log('onReservationConfirmed: existingAuthorization found.', orderAsAbout.orderNumber, reservationNumber, JSON.stringify(existingAuthorization));
|
|
89
|
+
const onAuthorizationCreatedTask = {
|
|
90
|
+
name: factory.taskName.OnAuthorizationCreated,
|
|
91
|
+
status: factory.taskStatus.Ready,
|
|
92
|
+
runsAt: now,
|
|
93
|
+
remainingNumberOfTries: 3,
|
|
94
|
+
numberOfTried: 0,
|
|
95
|
+
executionResults: [],
|
|
96
|
+
data: {
|
|
97
|
+
project: { id: project.id },
|
|
98
|
+
code: existingAuthorization.code
|
|
99
|
+
},
|
|
100
|
+
project
|
|
101
|
+
};
|
|
102
|
+
taskAttributes.push(onAuthorizationCreatedTask);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
76
105
|
const subReservations4inform = confirmedReservations.map((r) => {
|
|
77
106
|
const { additionalProperty, additionalTicketText,
|
|
78
107
|
// attended, checkedIn,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { ActionRepo } from '../../repo/action';
|
|
3
3
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
4
5
|
import type { OrderRepo } from '../../repo/order';
|
|
5
6
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
6
7
|
import type { SettingRepo } from '../../repo/setting';
|
|
@@ -26,6 +27,7 @@ export declare function useReservation(params: {
|
|
|
26
27
|
}): (repos: {
|
|
27
28
|
action: ActionRepo;
|
|
28
29
|
assetTransaction: AssetTransactionRepo;
|
|
30
|
+
code: AuthorizationRepo;
|
|
29
31
|
order: OrderRepo;
|
|
30
32
|
reservation: ReservationRepo;
|
|
31
33
|
setting: SettingRepo;
|
|
@@ -113,24 +113,6 @@ function reserveIfNotYet(params) {
|
|
|
113
113
|
yield (0, confirmReservation_1.confirmReservation)({
|
|
114
114
|
// optimize(2024-07-01~)
|
|
115
115
|
potentialReserveAction: { object: { reservationNumber: reserveTransaction.transactionNumber } },
|
|
116
|
-
// actionAttributesList: [{
|
|
117
|
-
// project: reserveTransaction.project,
|
|
118
|
-
// typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
|
|
119
|
-
// object: {
|
|
120
|
-
// typeOf: reserveTransaction.object.typeOf,
|
|
121
|
-
// reservationNumber: reserveTransaction.object.reservationNumber,
|
|
122
|
-
// reservationStatus: (typeof reserveTransaction.object.reservationStatus === 'string')
|
|
123
|
-
// ? reserveTransaction.object.reservationStatus
|
|
124
|
-
// : factory.reservationStatusType.ReservationPending,
|
|
125
|
-
// reservationFor: {
|
|
126
|
-
// id: String(reserveTransaction.object.reservationFor.id),
|
|
127
|
-
// typeOf: reserveTransaction.object.reservationFor.typeOf,
|
|
128
|
-
// optimized: true
|
|
129
|
-
// } // optimize(2024-01-24~)
|
|
130
|
-
// },
|
|
131
|
-
// agent: reserveTransaction.project,
|
|
132
|
-
// purpose: { typeOf: reserveTransaction.typeOf, id: reserveTransaction.id }
|
|
133
|
-
// }],
|
|
134
116
|
useOnReservationConfirmed: false, // ここでは確定予約の存在を担保すればよいだけ
|
|
135
117
|
byTask: false
|
|
136
118
|
})(repos);
|
|
@@ -5,6 +5,7 @@ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../tas
|
|
|
5
5
|
import { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
6
6
|
import { ActionRepo } from '../../repo/action';
|
|
7
7
|
import { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
8
|
+
import { AuthorizationRepo } from '../../repo/authorization';
|
|
8
9
|
import { OrderRepo } from '../../repo/order';
|
|
9
10
|
import { ReservationRepo } from '../../repo/reservation';
|
|
10
11
|
import { SettingRepo } from '../../repo/setting';
|
|
@@ -27,6 +28,7 @@ export declare function confirmReserveTransaction(params: factory.task.IData<fac
|
|
|
27
28
|
acceptedOffer: AcceptedOfferRepo;
|
|
28
29
|
action: ActionRepo;
|
|
29
30
|
assetTransaction: AssetTransactionRepo;
|
|
31
|
+
code: AuthorizationRepo;
|
|
30
32
|
order: OrderRepo;
|
|
31
33
|
reservation: ReservationRepo;
|
|
32
34
|
setting: SettingRepo;
|
|
@@ -21,6 +21,7 @@ const factory_1 = require("../assetTransaction/reserveCOA/factory");
|
|
|
21
21
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
22
22
|
const action_1 = require("../../repo/action");
|
|
23
23
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
24
|
+
const authorization_1 = require("../../repo/authorization");
|
|
24
25
|
const order_1 = require("../../repo/order");
|
|
25
26
|
const reservation_1 = require("../../repo/reservation");
|
|
26
27
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
@@ -58,6 +59,7 @@ function call(params) {
|
|
|
58
59
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
59
60
|
action: new action_1.ActionRepo(connection),
|
|
60
61
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
62
|
+
code: new authorization_1.AuthorizationRepo(connection),
|
|
61
63
|
order: new order_1.OrderRepo(connection),
|
|
62
64
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
63
65
|
setting: new setting_1.SettingRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../task';
|
|
2
|
+
import type { IExecutableTaskKeys, IOperationExecute } from '../task';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.onAuthorizationCreated.ITask, IExecutableTaskKeys>): IOperationExecute<void>;
|
|
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
-
// import { Settings } from '../../settings';
|
|
15
14
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
16
15
|
const action_1 = require("../../repo/action");
|
|
17
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
@@ -25,9 +24,9 @@ const reserve_1 = require("../reserve");
|
|
|
25
24
|
/**
|
|
26
25
|
* タスク実行関数
|
|
27
26
|
*/
|
|
28
|
-
function call(
|
|
27
|
+
function call(params) {
|
|
29
28
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection }) {
|
|
30
|
-
yield onAuthorizationCreated(
|
|
29
|
+
yield onAuthorizationCreated(params)({
|
|
31
30
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
32
31
|
action: new action_1.ActionRepo(connection),
|
|
33
32
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -37,23 +36,19 @@ function call(data) {
|
|
|
37
36
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
38
37
|
setting: new setting_1.SettingRepo(connection),
|
|
39
38
|
task: new task_1.TaskRepo(connection)
|
|
40
|
-
}
|
|
41
|
-
// settings
|
|
42
|
-
);
|
|
39
|
+
});
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
42
|
// tslint:disable-next-line:max-func-body-length
|
|
46
43
|
function onAuthorizationCreated(params) {
|
|
47
|
-
return (repos
|
|
48
|
-
// settings: Settings
|
|
49
|
-
) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
50
45
|
// 発券対象予約ID
|
|
51
46
|
let reservationIds = [];
|
|
52
47
|
// 発券対象予約番号
|
|
53
48
|
let reservationNumbers = [];
|
|
54
49
|
let orderNumber;
|
|
55
50
|
const authorization = yield repos.code.findValidOneByCode({
|
|
56
|
-
code: params.code,
|
|
51
|
+
code: params.data.code,
|
|
57
52
|
project: { id: params.project.id }
|
|
58
53
|
});
|
|
59
54
|
switch (authorization.object.typeOf) {
|
|
@@ -86,10 +81,9 @@ function onAuthorizationCreated(params) {
|
|
|
86
81
|
reservationNumbers: reservationNumbers
|
|
87
82
|
// reservationFor: { ids: reservationForIds }
|
|
88
83
|
},
|
|
89
|
-
purpose: { code: params.code },
|
|
90
|
-
instrument: Object.assign({}, (typeof orderNumber === 'string') ? { orderNumber } : undefined)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
84
|
+
purpose: { code: params.data.code },
|
|
85
|
+
instrument: Object.assign({}, (typeof orderNumber === 'string') ? { orderNumber } : undefined),
|
|
86
|
+
options: { retry: false } // add(2025-03-15~)
|
|
87
|
+
})(repos);
|
|
94
88
|
});
|
|
95
89
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = call;
|
|
13
13
|
const action_1 = require("../../repo/action");
|
|
14
14
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
15
|
+
const authorization_1 = require("../../repo/authorization");
|
|
15
16
|
const reservation_1 = require("../../repo/reservation");
|
|
16
17
|
const setting_1 = require("../../repo/setting");
|
|
17
18
|
const task_1 = require("../../repo/task");
|
|
@@ -29,6 +30,7 @@ function call(data) {
|
|
|
29
30
|
})({
|
|
30
31
|
action: new action_1.ActionRepo(connection),
|
|
31
32
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
33
|
+
code: new authorization_1.AuthorizationRepo(connection),
|
|
32
34
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
33
35
|
setting: new setting_1.SettingRepo(connection),
|
|
34
36
|
task: new task_1.TaskRepo(connection)
|
|
@@ -13,6 +13,7 @@ exports.call = call;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const authorization_1 = require("../../repo/authorization");
|
|
16
17
|
const order_1 = require("../../repo/order");
|
|
17
18
|
const reservation_1 = require("../../repo/reservation");
|
|
18
19
|
const setting_1 = require("../../repo/setting");
|
|
@@ -37,6 +38,7 @@ function call(data) {
|
|
|
37
38
|
yield (0, useReservation_1.useReservation)(Object.assign({ project: data.project, agent: data.agent, object: data.object, instrument }, (typeof ((_c = data.location) === null || _c === void 0 ? void 0 : _c.typeOf) === 'string') ? { location: data.location } : undefined))({
|
|
38
39
|
action: new action_1.ActionRepo(connection),
|
|
39
40
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
41
|
+
code: new authorization_1.AuthorizationRepo(connection),
|
|
40
42
|
order: new order_1.OrderRepo(connection),
|
|
41
43
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
42
44
|
setting: new setting_1.SettingRepo(connection),
|
|
@@ -110,6 +110,7 @@ function execute(task) {
|
|
|
110
110
|
case factory.taskName.ImportEventsFromCOA:
|
|
111
111
|
case factory.taskName.ImportOffersFromCOA:
|
|
112
112
|
case factory.taskName.InvalidatePaymentUrl:
|
|
113
|
+
case factory.taskName.OnAuthorizationCreated:
|
|
113
114
|
case factory.taskName.Pay:
|
|
114
115
|
case factory.taskName.PublishPaymentUrl:
|
|
115
116
|
case factory.taskName.Refund:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.393.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.393.0-alpha.39",
|
|
15
15
|
"@cinerino/sdk": "10.21.0-alpha.24",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"postversion": "git push origin --tags",
|
|
114
114
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
115
115
|
},
|
|
116
|
-
"version": "22.9.0-alpha.
|
|
116
|
+
"version": "22.9.0-alpha.76"
|
|
117
117
|
}
|