@chevre/domain 22.9.0-alpha.49 → 22.9.0-alpha.50
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/service/assetTransaction/reserveCOA/cancel.d.ts +12 -0
- package/lib/chevre/service/assetTransaction/reserveCOA/cancel.js +92 -4
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.d.ts +13 -0
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4coa.js +4 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +6 -7
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +3 -4
- package/lib/chevre/service/reserveCOA/cancelReservation.d.ts +1 -13
- package/lib/chevre/service/reserveCOA/cancelReservation.js +0 -59
- package/lib/chevre/service/task/cancelPendingReservation.js +33 -36
- package/package.json +1 -1
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import type * as COA from '@motionpicture/coa-service';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
import { ActionRepo } from '../../../repo/action';
|
|
4
|
+
import { TaskRepo } from '../../../repo/task';
|
|
4
5
|
type ICancelOperation<T> = (repos: {
|
|
5
6
|
action: ActionRepo;
|
|
6
7
|
reserveService: COA.service.Reserve;
|
|
8
|
+
task: TaskRepo;
|
|
7
9
|
}) => Promise<T>;
|
|
8
10
|
declare function cancel(params: {
|
|
9
11
|
action: factory.action.authorize.offer.eventService.IAction;
|
|
12
|
+
}, options: {
|
|
13
|
+
/**
|
|
14
|
+
* cancelPendingReservation async?(2025-03-03~)
|
|
15
|
+
*/
|
|
16
|
+
asyncCancelPendingReservation: boolean;
|
|
10
17
|
}): ICancelOperation<void>;
|
|
11
18
|
declare function cancelByAcceptAction(params: {
|
|
12
19
|
action: factory.action.accept.coaOffer.IAction;
|
|
20
|
+
}, options: {
|
|
21
|
+
/**
|
|
22
|
+
* cancelPendingReservation async?(2025-03-03~)
|
|
23
|
+
*/
|
|
24
|
+
asyncCancelPendingReservation: boolean;
|
|
13
25
|
}): ICancelOperation<void>;
|
|
14
26
|
export { cancel, cancelByAcceptAction };
|
|
@@ -11,14 +11,102 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.cancel = cancel;
|
|
13
13
|
exports.cancelByAcceptAction = cancelByAcceptAction;
|
|
14
|
+
const factory = require("../../../factory");
|
|
14
15
|
const cancelReservation_1 = require("../../reserveCOA/cancelReservation");
|
|
15
|
-
function cancel(params) {
|
|
16
|
+
function cancel(params, options) {
|
|
16
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
|
|
18
|
+
// object.pendingTransactionに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
|
|
19
|
+
let delTmpReserveParams;
|
|
20
|
+
// objectに進行中取引情報があれば利用する(2023-09-11~)
|
|
21
|
+
const pendingTransaction = params.action.object.pendingTransaction;
|
|
22
|
+
if (typeof (pendingTransaction === null || pendingTransaction === void 0 ? void 0 : pendingTransaction.typeOf) === 'string') {
|
|
23
|
+
delTmpReserveParams = {
|
|
24
|
+
theaterCode: pendingTransaction.theaterCode,
|
|
25
|
+
dateJouei: pendingTransaction.dateJouei,
|
|
26
|
+
titleCode: pendingTransaction.titleCode,
|
|
27
|
+
titleBranchNum: pendingTransaction.titleBranchNum,
|
|
28
|
+
timeBegin: pendingTransaction.timeBegin,
|
|
29
|
+
tmpReserveNum: pendingTransaction.tmpReserveNum
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (delTmpReserveParams !== undefined) {
|
|
33
|
+
const { asyncCancelPendingReservation } = options;
|
|
34
|
+
const object = Object.assign(Object.assign({}, delTmpReserveParams), { reservationStatus: factory.reservationStatusType.ReservationPending, transactionNumber: delTmpReserveParams.tmpReserveNum, typeOf: factory.assetTransactionType.COAReserveTransaction });
|
|
35
|
+
const instrument = [params.action.purpose];
|
|
36
|
+
if (asyncCancelPendingReservation) {
|
|
37
|
+
// support async(2025-03-03~)
|
|
38
|
+
const data = { object, instrument };
|
|
39
|
+
const cancelPendingReservationTask = {
|
|
40
|
+
project: { id: params.action.project.id, typeOf: factory.organizationType.Project },
|
|
41
|
+
name: factory.taskName.CancelPendingReservation,
|
|
42
|
+
status: factory.taskStatus.Ready,
|
|
43
|
+
runsAt: new Date(),
|
|
44
|
+
remainingNumberOfTries: 10,
|
|
45
|
+
numberOfTried: 0,
|
|
46
|
+
executionResults: [],
|
|
47
|
+
data
|
|
48
|
+
};
|
|
49
|
+
yield repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
yield (0, cancelReservation_1.cancelPendingReservation)({
|
|
53
|
+
project: { id: params.action.project.id },
|
|
54
|
+
object,
|
|
55
|
+
instrument
|
|
56
|
+
})(repos);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
18
59
|
});
|
|
19
60
|
}
|
|
20
|
-
function cancelByAcceptAction(params) {
|
|
61
|
+
function cancelByAcceptAction(params, options) {
|
|
21
62
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
|
|
63
|
+
var _a, _b, _c, _d, _e, _f;
|
|
64
|
+
const recipe = yield repos.action.findRecipeByAction({
|
|
65
|
+
project: { id: params.action.project.id },
|
|
66
|
+
recipeFor: { id: params.action.id }
|
|
67
|
+
});
|
|
68
|
+
if (recipe !== null) {
|
|
69
|
+
let delTmpReserveParams;
|
|
70
|
+
// recipeから連携情報取得に変更(2024-06-11~)
|
|
71
|
+
const coaRequestBody = (_c = (_b = (_a = recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.beforeMedia;
|
|
72
|
+
const coaResponseBody = (_f = (_e = (_d = recipe.step[0]) === null || _d === void 0 ? void 0 : _d.itemListElement[0]) === null || _e === void 0 ? void 0 : _e.itemListElement[0]) === null || _f === void 0 ? void 0 : _f.afterMedia;
|
|
73
|
+
if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
|
|
74
|
+
delTmpReserveParams = {
|
|
75
|
+
theaterCode: coaRequestBody.theaterCode,
|
|
76
|
+
dateJouei: coaRequestBody.dateJouei,
|
|
77
|
+
titleCode: coaRequestBody.titleCode,
|
|
78
|
+
titleBranchNum: coaRequestBody.titleBranchNum,
|
|
79
|
+
timeBegin: coaRequestBody.timeBegin,
|
|
80
|
+
tmpReserveNum: coaResponseBody.tmpReserveNum
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (delTmpReserveParams !== undefined) {
|
|
84
|
+
const { asyncCancelPendingReservation } = options;
|
|
85
|
+
const object = Object.assign(Object.assign({}, delTmpReserveParams), { reservationStatus: factory.reservationStatusType.ReservationPending, transactionNumber: delTmpReserveParams.tmpReserveNum, typeOf: factory.assetTransactionType.COAReserveTransaction });
|
|
86
|
+
const instrument = [params.action.purpose];
|
|
87
|
+
if (asyncCancelPendingReservation) {
|
|
88
|
+
// support async(2025-03-03~)
|
|
89
|
+
const data = { object, instrument };
|
|
90
|
+
const cancelPendingReservationTask = {
|
|
91
|
+
project: { id: params.action.project.id, typeOf: factory.organizationType.Project },
|
|
92
|
+
name: factory.taskName.CancelPendingReservation,
|
|
93
|
+
status: factory.taskStatus.Ready,
|
|
94
|
+
runsAt: new Date(),
|
|
95
|
+
remainingNumberOfTries: 10,
|
|
96
|
+
numberOfTried: 0,
|
|
97
|
+
executionResults: [],
|
|
98
|
+
data
|
|
99
|
+
};
|
|
100
|
+
yield repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
yield (0, cancelReservation_1.cancelPendingReservation)({
|
|
104
|
+
project: { id: params.action.project.id },
|
|
105
|
+
object,
|
|
106
|
+
instrument
|
|
107
|
+
})(repos);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
23
111
|
});
|
|
24
112
|
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import type * as COA from '@motionpicture/coa-service';
|
|
2
2
|
import * as factory from '../../../../factory';
|
|
3
3
|
import { ActionRepo } from '../../../../repo/action';
|
|
4
|
+
import { TaskRepo } from '../../../../repo/task';
|
|
4
5
|
declare function processVoidTransaction4coa(params: {
|
|
5
6
|
action: factory.action.authorize.offer.eventService.IAction;
|
|
7
|
+
}, options: {
|
|
8
|
+
/**
|
|
9
|
+
* cancelPendingReservation async?(2025-03-03~)
|
|
10
|
+
*/
|
|
11
|
+
asyncCancelPendingReservation: boolean;
|
|
6
12
|
}): (repos: {
|
|
7
13
|
action: ActionRepo;
|
|
8
14
|
reserveService: COA.service.Reserve;
|
|
15
|
+
task: TaskRepo;
|
|
9
16
|
}) => Promise<void>;
|
|
10
17
|
declare function processVoidTransactionByAcceptAction4coa(params: {
|
|
11
18
|
action: factory.action.accept.coaOffer.IAction;
|
|
19
|
+
}, options: {
|
|
20
|
+
/**
|
|
21
|
+
* cancelPendingReservation async?(2025-03-03~)
|
|
22
|
+
*/
|
|
23
|
+
asyncCancelPendingReservation: boolean;
|
|
12
24
|
}): (repos: {
|
|
13
25
|
action: ActionRepo;
|
|
14
26
|
reserveService: COA.service.Reserve;
|
|
27
|
+
task: TaskRepo;
|
|
15
28
|
}) => Promise<void>;
|
|
16
29
|
export { processVoidTransaction4coa, processVoidTransactionByAcceptAction4coa };
|
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.processVoidTransaction4coa = processVoidTransaction4coa;
|
|
13
13
|
exports.processVoidTransactionByAcceptAction4coa = processVoidTransactionByAcceptAction4coa;
|
|
14
14
|
const cancel_1 = require("../../../assetTransaction/reserveCOA/cancel");
|
|
15
|
-
function processVoidTransaction4coa(params) {
|
|
15
|
+
function processVoidTransaction4coa(params, options) {
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
yield (0, cancel_1.cancel)(params)(repos);
|
|
17
|
+
yield (0, cancel_1.cancel)(params, options)(repos);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function processVoidTransactionByAcceptAction4coa(params) {
|
|
20
|
+
function processVoidTransactionByAcceptAction4coa(params, options) {
|
|
21
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield (0, cancel_1.cancelByAcceptAction)(params)(repos);
|
|
22
|
+
yield (0, cancel_1.cancelByAcceptAction)(params, options)(repos);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -82,12 +82,10 @@ function voidTransaction(params) {
|
|
|
82
82
|
if (reserveService === undefined) {
|
|
83
83
|
throw new factory.errors.Internal('repos.reserveService required');
|
|
84
84
|
}
|
|
85
|
-
yield (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({
|
|
86
|
-
// action: <factory.action.authorize.offer.eventService.IAction<WebAPIIdentifier.COA>>action
|
|
87
|
-
action
|
|
88
|
-
})({
|
|
85
|
+
yield (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: true })({
|
|
89
86
|
action: repos.action,
|
|
90
|
-
reserveService
|
|
87
|
+
reserveService,
|
|
88
|
+
task: repos.task
|
|
91
89
|
});
|
|
92
90
|
break;
|
|
93
91
|
default:
|
|
@@ -162,9 +160,10 @@ function cancelAcceptActions(params) {
|
|
|
162
160
|
if (reserveService === undefined) {
|
|
163
161
|
throw new factory.errors.Internal('repos.reserveService required');
|
|
164
162
|
}
|
|
165
|
-
yield (0, processVoidTransaction4coa_1.processVoidTransactionByAcceptAction4coa)({ action })({
|
|
163
|
+
yield (0, processVoidTransaction4coa_1.processVoidTransactionByAcceptAction4coa)({ action }, { asyncCancelPendingReservation: true })({
|
|
166
164
|
action: repos.action,
|
|
167
|
-
reserveService
|
|
165
|
+
reserveService,
|
|
166
|
+
task: repos.task
|
|
168
167
|
});
|
|
169
168
|
})));
|
|
170
169
|
});
|
|
@@ -57,11 +57,10 @@ function voidTransactionByActionId(params) {
|
|
|
57
57
|
if (reserveService === undefined) {
|
|
58
58
|
throw new factory.errors.Internal('repos.reserveService required');
|
|
59
59
|
}
|
|
60
|
-
yield (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({
|
|
61
|
-
action
|
|
62
|
-
})({
|
|
60
|
+
yield (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: false })({
|
|
63
61
|
action: repos.action,
|
|
64
|
-
reserveService
|
|
62
|
+
reserveService,
|
|
63
|
+
task: repos.task
|
|
65
64
|
});
|
|
66
65
|
break;
|
|
67
66
|
default:
|
|
@@ -9,16 +9,4 @@ declare function cancelPendingReservation(params: factory.task.cancelPendingRese
|
|
|
9
9
|
action: ActionRepo;
|
|
10
10
|
reserveService: COA.service.Reserve;
|
|
11
11
|
}) => Promise<void>;
|
|
12
|
-
|
|
13
|
-
action: factory.action.authorize.offer.eventService.IAction;
|
|
14
|
-
}): (repos: {
|
|
15
|
-
action: ActionRepo;
|
|
16
|
-
reserveService: COA.service.Reserve;
|
|
17
|
-
}) => Promise<void>;
|
|
18
|
-
declare function cancelPendingReservationByAcceptAction(params: {
|
|
19
|
-
action: factory.action.accept.coaOffer.IAction;
|
|
20
|
-
}): (repos: {
|
|
21
|
-
action: ActionRepo;
|
|
22
|
-
reserveService: COA.service.Reserve;
|
|
23
|
-
}) => Promise<void>;
|
|
24
|
-
export { cancelPendingReservation, cancelPendingReservationByAuthorizeAction, cancelPendingReservationByAcceptAction };
|
|
12
|
+
export { cancelPendingReservation };
|
|
@@ -10,8 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.cancelPendingReservation = cancelPendingReservation;
|
|
13
|
-
exports.cancelPendingReservationByAuthorizeAction = cancelPendingReservationByAuthorizeAction;
|
|
14
|
-
exports.cancelPendingReservationByAcceptAction = cancelPendingReservationByAcceptAction;
|
|
15
13
|
const http_status_1 = require("http-status");
|
|
16
14
|
const factory = require("../../factory");
|
|
17
15
|
const factory_1 = require("./factory");
|
|
@@ -78,60 +76,3 @@ function cancelPendingReservation(params) {
|
|
|
78
76
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe });
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
|
-
function cancelPendingReservationByAuthorizeAction(params) {
|
|
82
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
// object.pendingTransactionに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
|
|
84
|
-
let delTmpReserveParams;
|
|
85
|
-
// objectに進行中取引情報があれば利用する(2023-09-11~)
|
|
86
|
-
const pendingTransaction = params.action.object.pendingTransaction;
|
|
87
|
-
if (typeof (pendingTransaction === null || pendingTransaction === void 0 ? void 0 : pendingTransaction.typeOf) === 'string') {
|
|
88
|
-
delTmpReserveParams = {
|
|
89
|
-
theaterCode: pendingTransaction.theaterCode,
|
|
90
|
-
dateJouei: pendingTransaction.dateJouei,
|
|
91
|
-
titleCode: pendingTransaction.titleCode,
|
|
92
|
-
titleBranchNum: pendingTransaction.titleBranchNum,
|
|
93
|
-
timeBegin: pendingTransaction.timeBegin,
|
|
94
|
-
tmpReserveNum: pendingTransaction.tmpReserveNum
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (delTmpReserveParams !== undefined) {
|
|
98
|
-
yield cancelPendingReservation({
|
|
99
|
-
project: { id: params.action.project.id },
|
|
100
|
-
object: Object.assign(Object.assign({}, delTmpReserveParams), { reservationStatus: factory.reservationStatusType.ReservationPending, transactionNumber: delTmpReserveParams.tmpReserveNum, typeOf: factory.assetTransactionType.COAReserveTransaction }),
|
|
101
|
-
instrument: [params.action.purpose]
|
|
102
|
-
})(repos);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function cancelPendingReservationByAcceptAction(params) {
|
|
107
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
var _a, _b, _c, _d, _e, _f;
|
|
109
|
-
const recipe = yield repos.action.findRecipeByAction({
|
|
110
|
-
project: { id: params.action.project.id },
|
|
111
|
-
recipeFor: { id: params.action.id }
|
|
112
|
-
});
|
|
113
|
-
if (recipe !== null) {
|
|
114
|
-
let delTmpReserveParams;
|
|
115
|
-
// recipeから連携情報取得に変更(2024-06-11~)
|
|
116
|
-
const coaRequestBody = (_c = (_b = (_a = recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.beforeMedia;
|
|
117
|
-
const coaResponseBody = (_f = (_e = (_d = recipe.step[0]) === null || _d === void 0 ? void 0 : _d.itemListElement[0]) === null || _e === void 0 ? void 0 : _e.itemListElement[0]) === null || _f === void 0 ? void 0 : _f.afterMedia;
|
|
118
|
-
if (coaRequestBody !== undefined && coaResponseBody !== undefined) {
|
|
119
|
-
delTmpReserveParams = {
|
|
120
|
-
theaterCode: coaRequestBody.theaterCode,
|
|
121
|
-
dateJouei: coaRequestBody.dateJouei,
|
|
122
|
-
titleCode: coaRequestBody.titleCode,
|
|
123
|
-
titleBranchNum: coaRequestBody.titleBranchNum,
|
|
124
|
-
timeBegin: coaRequestBody.timeBegin,
|
|
125
|
-
tmpReserveNum: coaResponseBody.tmpReserveNum
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
if (delTmpReserveParams !== undefined) {
|
|
129
|
-
yield cancelPendingReservation({
|
|
130
|
-
project: { id: params.action.project.id },
|
|
131
|
-
object: Object.assign(Object.assign({}, delTmpReserveParams), { reservationStatus: factory.reservationStatusType.ReservationPending, transactionNumber: delTmpReserveParams.tmpReserveNum, typeOf: factory.assetTransactionType.COAReserveTransaction }),
|
|
132
|
-
instrument: [params.action.purpose]
|
|
133
|
-
})(repos);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
@@ -10,29 +10,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
|
-
|
|
13
|
+
const COA = require("@motionpicture/coa-service");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
17
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
18
18
|
const reservation_1 = require("../../repo/reservation");
|
|
19
|
-
|
|
19
|
+
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
20
20
|
const setting_1 = require("../../repo/setting");
|
|
21
21
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
22
22
|
const task_1 = require("../../repo/task");
|
|
23
23
|
const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const cancelReservation_2 = require("../reserveCOA/cancelReservation");
|
|
25
|
+
let coaAuthClientCreated = false;
|
|
26
|
+
let coaAuthClient = new COA.auth.RefreshToken({
|
|
27
|
+
endpoint: '', // 使用されないので空文字でok
|
|
28
|
+
refreshToken: '', // 使用されないので空文字でok
|
|
29
|
+
useFetch: true
|
|
30
|
+
});
|
|
31
31
|
/**
|
|
32
32
|
* タスク実行関数
|
|
33
33
|
*/
|
|
34
34
|
function call(params) {
|
|
35
|
-
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient }) {
|
|
35
|
+
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient, settings }) {
|
|
36
36
|
var _b, _c, _d, _e;
|
|
37
37
|
if (redisClient === undefined) {
|
|
38
38
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
@@ -51,32 +51,29 @@ function call(params) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
else if (((_c = data.object) === null || _c === void 0 ? void 0 : _c.typeOf) === factory.assetTransactionType.COAReserveTransaction) {
|
|
54
|
-
throw new factory.errors.NotImplemented(`object.typeOf ${
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
// action: new ActionRepo(connection),
|
|
78
|
-
// reserveService
|
|
79
|
-
// });
|
|
54
|
+
// throw new factory.errors.NotImplemented(`object.typeOf ${data.object?.typeOf} not implemented`);
|
|
55
|
+
if (!coaAuthClientCreated) {
|
|
56
|
+
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
57
|
+
const coaAPI = yield reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
58
|
+
const credentials = (_d = coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials;
|
|
59
|
+
if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) === 'string') {
|
|
60
|
+
coaAuthClient = new COA.auth.RefreshToken(credentials);
|
|
61
|
+
coaAuthClientCreated = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const reserveService = new COA.service.Reserve({
|
|
65
|
+
endpoint: coaAuthClient.options.endpoint,
|
|
66
|
+
auth: coaAuthClient
|
|
67
|
+
}, { timeout: settings.coa.timeout });
|
|
68
|
+
const { object, instrument } = data;
|
|
69
|
+
yield (0, cancelReservation_2.cancelPendingReservation)({
|
|
70
|
+
object,
|
|
71
|
+
instrument,
|
|
72
|
+
project: { id: params.project.id }
|
|
73
|
+
})({
|
|
74
|
+
action: new action_1.ActionRepo(connection),
|
|
75
|
+
reserveService
|
|
76
|
+
});
|
|
80
77
|
}
|
|
81
78
|
else {
|
|
82
79
|
throw new factory.errors.NotImplemented(`purpose.typeOf ${(_e = data.purpose) === null || _e === void 0 ? void 0 : _e.typeOf} not implemented`);
|
package/package.json
CHANGED