@chevre/domain 28.1.0-alpha.4 → 28.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/mongoose/schemas/offerCatalog.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +23 -20
- package/lib/chevre/repo/mongoose/schemas/setting.js +7 -4
- package/lib/chevre/repo/setting/integration.d.ts +1 -0
- package/lib/chevre/repo/setting/integration.js +31 -0
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +3 -4
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +1 -3
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +3 -4
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +1 -3
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +3 -3
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -4
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
- package/lib/chevre/service/offer/onEventChanged.js +4 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +0 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +3 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +0 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +3 -4
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +3 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +3 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -1
- package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -2
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +3 -4
- package/lib/chevre/service/order/payOrder.js +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +3 -4
- package/lib/chevre/service/order/placeOrder.js +2 -2
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
- package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -2
- package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +2 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +2 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
- package/lib/chevre/service/task/cancelReservation.js +2 -2
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -4
- package/lib/chevre/service/task/confirmReserveTransaction.js +6 -7
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -4
- package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -4
- package/lib/chevre/service/task/placeOrder.js +2 -4
- package/lib/chevre/service/task/reserve.js +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/task/useReservation.js +2 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -5
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -2
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +4 -4
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -2
- package/lib/chevre/service/taskHandler.js +2 -2
- package/package.json +1 -1
|
@@ -9,10 +9,10 @@ const factory_2 = require("../factory");
|
|
|
9
9
|
function onReservationCheckedIn(params) {
|
|
10
10
|
return async (repos) => {
|
|
11
11
|
const { dateIssued } = params.object.reservedTicket;
|
|
12
|
-
const setting = await repos.
|
|
12
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
13
13
|
const tasks = [];
|
|
14
14
|
const project = { id: params.project.id, typeOf: factory_1.factory.organizationType.Project };
|
|
15
|
-
const informReservations = setting?.
|
|
15
|
+
const informReservations = setting?.informActions;
|
|
16
16
|
let reservations4inform = [];
|
|
17
17
|
const ticketToken = params.purpose?.code;
|
|
18
18
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { factory } from '../../../factory';
|
|
5
5
|
import { AuthorizationRepo } from '../../../repo/authorization';
|
|
6
|
-
import type {
|
|
6
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
7
7
|
import type { TaskRepo } from '../../../repo/task';
|
|
8
8
|
export type IConfirmedReservation = Pick<factory.reservation.eventReservation.IReservation, 'additionalProperty' | 'additionalTicketText' | 'bookingTime' | 'id' | 'modifiedTime' | 'project' | 'provider' | 'reservationNumber' | 'subReservation' | 'typeOf' | 'reservedTicket'> & {
|
|
9
9
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
@@ -13,6 +13,6 @@ export type IConfirmedReservation = Pick<factory.reservation.eventReservation.IR
|
|
|
13
13
|
};
|
|
14
14
|
export declare function onReservationConfirmed(confirmedReservations: IConfirmedReservation[], reserveAction: Pick<factory.action.reserve.IAttributes, 'instrument'>): (repos: {
|
|
15
15
|
code: AuthorizationRepo;
|
|
16
|
-
|
|
16
|
+
integrationSetting: IntegrationSettingRepo;
|
|
17
17
|
task: TaskRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
@@ -8,8 +8,8 @@ const factory_1 = require("../../../factory");
|
|
|
8
8
|
const factory_2 = require("../factory");
|
|
9
9
|
function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
10
10
|
return async (repos) => {
|
|
11
|
-
const setting = await repos.
|
|
12
|
-
const informReservations = setting?.
|
|
11
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
12
|
+
const informReservations = setting?.informActions;
|
|
13
13
|
let orderAsAbout;
|
|
14
14
|
if (Array.isArray(reserveAction.instrument)) {
|
|
15
15
|
for (const eachInstrument of reserveAction.instrument) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { IAttendedReservation } from '../../../repo/reservation';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
4
4
|
import type { TaskRepo } from '../../../repo/task';
|
|
5
5
|
export type IUseReservationAction = factory.action.consume.use.reservation.IAction;
|
|
6
6
|
/**
|
|
@@ -10,6 +10,6 @@ export declare function onReservationUsed(attendedReservation: IAttendedReservat
|
|
|
10
10
|
id: string;
|
|
11
11
|
startDate: Date;
|
|
12
12
|
}): (repos: {
|
|
13
|
-
|
|
13
|
+
integrationSetting: IntegrationSettingRepo;
|
|
14
14
|
task: TaskRepo;
|
|
15
15
|
}) => Promise<void>;
|
|
@@ -17,11 +17,10 @@ function onReservationUsed(attendedReservation, action) {
|
|
|
17
17
|
return async (repos
|
|
18
18
|
// settings: Settings
|
|
19
19
|
) => {
|
|
20
|
-
const setting = await repos.
|
|
20
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
21
21
|
const tasks = [];
|
|
22
22
|
const now = new Date();
|
|
23
|
-
|
|
24
|
-
const informReservations = setting?.onReservationStatusChanged?.informReservation;
|
|
23
|
+
const informReservations = setting?.informActions;
|
|
25
24
|
const informTaskRunsAt = now;
|
|
26
25
|
// support notification.reservation.IUseAction(2024-11-11~)
|
|
27
26
|
const useForTheFirstTime = attendedReservation.reservedTicket.dateUsed !== undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
2
2
|
import type { TaskRepo } from '../../../repo/task';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
4
|
/**
|
|
@@ -13,6 +13,6 @@ export declare function onReservationsCreated(params: {
|
|
|
13
13
|
};
|
|
14
14
|
transaction: Pick<factory.assetTransaction.reserve.ITransaction, 'transactionNumber' | 'instrument'>;
|
|
15
15
|
}): (repos: {
|
|
16
|
-
|
|
16
|
+
integrationSetting: IntegrationSettingRepo;
|
|
17
17
|
task: TaskRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
@@ -10,11 +10,10 @@ function onReservationsCreated(params) {
|
|
|
10
10
|
return async (repos
|
|
11
11
|
// settings: Settings
|
|
12
12
|
) => {
|
|
13
|
-
const setting = await repos.
|
|
13
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
14
14
|
// create AggregateScreeningEvent task -> migrate to agg(2024-10-29~)
|
|
15
15
|
// inform(2024-10-25~)
|
|
16
|
-
|
|
17
|
-
const informReservations = setting?.onReservationStatusChanged?.informReservation;
|
|
16
|
+
const informReservations = setting?.informActions;
|
|
18
17
|
const now = new Date();
|
|
19
18
|
const taskAttributes = [];
|
|
20
19
|
const informObject = {
|
|
@@ -5,7 +5,7 @@ import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
|
5
5
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
6
6
|
import type { OrderRepo } from '../../repo/order';
|
|
7
7
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
8
|
-
import type {
|
|
8
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
9
9
|
import type { TaskRepo } from '../../repo/task';
|
|
10
10
|
/**
|
|
11
11
|
* 予約使用
|
|
@@ -34,6 +34,6 @@ export declare function useReservation(params: {
|
|
|
34
34
|
code: AuthorizationRepo;
|
|
35
35
|
order: OrderRepo;
|
|
36
36
|
reservation: ReservationRepo;
|
|
37
|
-
|
|
37
|
+
integrationSetting: IntegrationSettingRepo;
|
|
38
38
|
task: TaskRepo;
|
|
39
39
|
}) => Promise<void>;
|
|
@@ -8,7 +8,6 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
8
8
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
9
9
|
const reservation_1 = require("../../repo/reservation");
|
|
10
10
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
11
|
-
const setting_1 = require("../../repo/setting");
|
|
12
11
|
const integration_1 = require("../../repo/setting/integration");
|
|
13
12
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
14
13
|
const task_1 = require("../../repo/task");
|
|
@@ -27,7 +26,7 @@ function call(params) {
|
|
|
27
26
|
if (redisClient === undefined) {
|
|
28
27
|
throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
|
|
29
28
|
}
|
|
30
|
-
const
|
|
29
|
+
const integrationSettingRepo = new integration_1.IntegrationSettingRepo({ connection });
|
|
31
30
|
const { data } = params;
|
|
32
31
|
// support COAReserve(2025-03-01~)
|
|
33
32
|
if (data.purpose?.typeOf === factory_1.factory.assetTransactionType.Reserve) {
|
|
@@ -37,7 +36,7 @@ function call(params) {
|
|
|
37
36
|
stockHolder: new stockHolder_1.StockHolderRepo({ connection }),
|
|
38
37
|
offerRateLimit: new offer_1.OfferRateLimitRepo(redisClient),
|
|
39
38
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
40
|
-
|
|
39
|
+
integrationSetting: integrationSettingRepo,
|
|
41
40
|
task: new task_1.TaskRepo(connection)
|
|
42
41
|
});
|
|
43
42
|
}
|
|
@@ -55,7 +54,7 @@ function call(params) {
|
|
|
55
54
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
56
55
|
endpoint: coaAuthClient.options.endpoint,
|
|
57
56
|
auth: coaAuthClient
|
|
58
|
-
}, { timeout: (await
|
|
57
|
+
}, { timeout: (await integrationSettingRepo.getByKey('coa')).timeoutReserve });
|
|
59
58
|
const { object, instrument } = data;
|
|
60
59
|
await (0, cancelReservation_2.cancelPendingReservation)({
|
|
61
60
|
object,
|
|
@@ -6,7 +6,7 @@ const cancel_1 = require("../../repo/action/cancel");
|
|
|
6
6
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
7
7
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
8
8
|
const reservation_1 = require("../../repo/reservation");
|
|
9
|
-
const
|
|
9
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
10
10
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
11
11
|
const task_1 = require("../../repo/task");
|
|
12
12
|
const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
@@ -22,7 +22,7 @@ function call(params) {
|
|
|
22
22
|
await (0, cancelReservation_1.cancelReservation)(data.actionAttributes)({
|
|
23
23
|
actions: { cancel: new cancel_1.CancelActionRepo(connection) },
|
|
24
24
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
25
|
-
|
|
25
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
26
26
|
task: new task_1.TaskRepo(connection),
|
|
27
27
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
28
28
|
offerRateLimit: new offer_1.OfferRateLimitRepo(redisClient),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { COA } from '@motionpicture/coa-service';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
|
-
import type { IntegrationSettingRepo as Settings } from '../../repo/setting/integration';
|
|
4
3
|
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
5
4
|
import { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
6
5
|
import { ConfirmActionRepo } from '../../repo/action/confirm';
|
|
@@ -9,7 +8,7 @@ import { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
|
9
8
|
import { AuthorizationRepo } from '../../repo/authorization';
|
|
10
9
|
import { OrderRepo } from '../../repo/order';
|
|
11
10
|
import { ReservationRepo } from '../../repo/reservation';
|
|
12
|
-
import {
|
|
11
|
+
import { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
13
12
|
import { TaskRepo } from '../../repo/task';
|
|
14
13
|
/**
|
|
15
14
|
* タスク実行関数
|
|
@@ -39,7 +38,7 @@ export declare function confirmReserveTransaction(params: Omit<factory.task.IDat
|
|
|
39
38
|
code: AuthorizationRepo;
|
|
40
39
|
order: OrderRepo;
|
|
41
40
|
reservation: ReservationRepo;
|
|
42
|
-
|
|
41
|
+
integrationSetting: IntegrationSettingRepo;
|
|
43
42
|
task: TaskRepo;
|
|
44
43
|
reserveService: COA.service.Reserve;
|
|
45
|
-
}
|
|
44
|
+
}) => Promise<void>;
|
|
@@ -17,7 +17,6 @@ const authorization_1 = require("../../repo/authorization");
|
|
|
17
17
|
const order_1 = require("../../repo/order");
|
|
18
18
|
const reservation_1 = require("../../repo/reservation");
|
|
19
19
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
20
|
-
const setting_1 = require("../../repo/setting");
|
|
21
20
|
const integration_1 = require("../../repo/setting/integration");
|
|
22
21
|
const task_1 = require("../../repo/task");
|
|
23
22
|
let coaAuthClientCreated = false;
|
|
@@ -30,7 +29,7 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
|
|
|
30
29
|
*/
|
|
31
30
|
function call(params) {
|
|
32
31
|
return async ({ connection }) => {
|
|
33
|
-
const
|
|
32
|
+
const integrationSettingRepo = new integration_1.IntegrationSettingRepo({ connection });
|
|
34
33
|
if (!coaAuthClientCreated) {
|
|
35
34
|
const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
|
|
36
35
|
const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
@@ -43,7 +42,7 @@ function call(params) {
|
|
|
43
42
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
44
43
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
45
44
|
auth: coaAuthClient
|
|
46
|
-
}, { timeout: (await
|
|
45
|
+
}, { timeout: (await integrationSettingRepo.getByKey('coa')).timeoutReserve });
|
|
47
46
|
await confirmReserveTransaction({
|
|
48
47
|
...params.data,
|
|
49
48
|
project: params.project,
|
|
@@ -61,10 +60,10 @@ function call(params) {
|
|
|
61
60
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
62
61
|
order: new order_1.OrderRepo(connection),
|
|
63
62
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
64
|
-
|
|
63
|
+
integrationSetting: integrationSettingRepo,
|
|
65
64
|
task: new task_1.TaskRepo(connection),
|
|
66
65
|
reserveService
|
|
67
|
-
}
|
|
66
|
+
});
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
69
|
function createConfirmObject4COAByOrder(params) {
|
|
@@ -148,7 +147,7 @@ function fixOrderAsPurpose(params) {
|
|
|
148
147
|
* 予約を確定する
|
|
149
148
|
*/
|
|
150
149
|
function confirmReserveTransaction(params, options) {
|
|
151
|
-
return async (repos
|
|
150
|
+
return async (repos) => {
|
|
152
151
|
let confirmActionObject;
|
|
153
152
|
// let updReserveResult: COA.factory.reserve.IUpdReserveResult | undefined;
|
|
154
153
|
let recipe;
|
|
@@ -207,7 +206,7 @@ function confirmReserveTransaction(params, options) {
|
|
|
207
206
|
await (0, confirm_1.confirm)({
|
|
208
207
|
transactionNumber: object.transactionNumber,
|
|
209
208
|
potentialActions: object.potentialActions
|
|
210
|
-
})(repos
|
|
209
|
+
})(repos);
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
catch (error) {
|
|
@@ -5,7 +5,6 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
|
5
5
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
6
|
const message_1 = require("../../repo/message");
|
|
7
7
|
const order_1 = require("../../repo/order");
|
|
8
|
-
const setting_1 = require("../../repo/setting");
|
|
9
8
|
const integration_1 = require("../../repo/setting/integration");
|
|
10
9
|
const task_1 = require("../../repo/task");
|
|
11
10
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -16,15 +15,15 @@ const onAssetTransactionStatusChanged_1 = require("../order/onAssetTransactionSt
|
|
|
16
15
|
function call(params) {
|
|
17
16
|
return async ({ connection }) => {
|
|
18
17
|
const { data } = params;
|
|
19
|
-
const
|
|
18
|
+
const integrationSettingRepo = new integration_1.IntegrationSettingRepo({ connection });
|
|
20
19
|
await (0, onAssetTransactionStatusChanged_1.onAssetTransactionStatusChanged)(data)({
|
|
21
20
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
22
21
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
23
22
|
message: new message_1.MessageRepo(connection),
|
|
24
23
|
order: new order_1.OrderRepo(connection),
|
|
25
|
-
|
|
24
|
+
integrationSetting: integrationSettingRepo,
|
|
26
25
|
task: new task_1.TaskRepo(connection),
|
|
27
26
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
28
|
-
},
|
|
27
|
+
}, integrationSettingRepo);
|
|
29
28
|
};
|
|
30
29
|
}
|
|
@@ -8,7 +8,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
8
8
|
const authorization_1 = require("../../repo/authorization");
|
|
9
9
|
const order_1 = require("../../repo/order");
|
|
10
10
|
const reservation_1 = require("../../repo/reservation");
|
|
11
|
-
const
|
|
11
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
12
12
|
const task_1 = require("../../repo/task");
|
|
13
13
|
const reserve_2 = require("../reserve");
|
|
14
14
|
/**
|
|
@@ -23,7 +23,7 @@ function call(params) {
|
|
|
23
23
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
24
24
|
order: new order_1.OrderRepo(connection),
|
|
25
25
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
26
|
-
|
|
26
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
27
27
|
task: new task_1.TaskRepo(connection)
|
|
28
28
|
});
|
|
29
29
|
};
|
|
@@ -4,7 +4,6 @@ exports.call = call;
|
|
|
4
4
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
5
5
|
const message_1 = require("../../repo/message");
|
|
6
6
|
const order_1 = require("../../repo/order");
|
|
7
|
-
const setting_1 = require("../../repo/setting");
|
|
8
7
|
const integration_1 = require("../../repo/setting/integration");
|
|
9
8
|
const task_1 = require("../../repo/task");
|
|
10
9
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -15,14 +14,13 @@ const payOrder_1 = require("../order/payOrder");
|
|
|
15
14
|
function call(params) {
|
|
16
15
|
return async ({ connection }) => {
|
|
17
16
|
const { data } = params;
|
|
18
|
-
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
19
17
|
await (0, payOrder_1.payOrder)(data)({
|
|
20
18
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
21
19
|
message: new message_1.MessageRepo(connection),
|
|
22
20
|
order: new order_1.OrderRepo(connection),
|
|
23
|
-
|
|
21
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
24
22
|
task: new task_1.TaskRepo(connection),
|
|
25
23
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
26
|
-
}
|
|
24
|
+
});
|
|
27
25
|
};
|
|
28
26
|
}
|
|
@@ -10,7 +10,6 @@ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMeth
|
|
|
10
10
|
const message_1 = require("../../repo/message");
|
|
11
11
|
const order_2 = require("../../repo/order");
|
|
12
12
|
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
13
|
-
const setting_1 = require("../../repo/setting");
|
|
14
13
|
const integration_1 = require("../../repo/setting/integration");
|
|
15
14
|
const task_1 = require("../../repo/task");
|
|
16
15
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -21,7 +20,6 @@ const placeOrder_2 = require("../order/placeOrder");
|
|
|
21
20
|
function call(params) {
|
|
22
21
|
return async ({ connection }) => {
|
|
23
22
|
const { data } = params;
|
|
24
|
-
const settings = new integration_1.IntegrationSettingRepo({ connection });
|
|
25
23
|
await (0, placeOrder_2.placeOrder)({
|
|
26
24
|
...data,
|
|
27
25
|
agent: { id: data.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
@@ -37,9 +35,9 @@ function call(params) {
|
|
|
37
35
|
message: new message_1.MessageRepo(connection),
|
|
38
36
|
order: new order_2.OrderRepo(connection),
|
|
39
37
|
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
40
|
-
|
|
38
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
41
39
|
task: new task_1.TaskRepo(connection),
|
|
42
40
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
43
|
-
}
|
|
41
|
+
});
|
|
44
42
|
};
|
|
45
43
|
}
|
|
@@ -5,7 +5,7 @@ const reserve_1 = require("../../repo/action/reserve");
|
|
|
5
5
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
6
|
const authorization_1 = require("../../repo/authorization");
|
|
7
7
|
const reservation_1 = require("../../repo/reservation");
|
|
8
|
-
const
|
|
8
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
9
9
|
const task_1 = require("../../repo/task");
|
|
10
10
|
const confirmReservation_1 = require("../reserve/confirmReservation");
|
|
11
11
|
/**
|
|
@@ -23,7 +23,7 @@ function call(params) {
|
|
|
23
23
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
24
24
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
25
25
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
26
|
-
|
|
26
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
27
27
|
task: new task_1.TaskRepo(connection)
|
|
28
28
|
});
|
|
29
29
|
};
|
|
@@ -4,7 +4,7 @@ exports.call = call;
|
|
|
4
4
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
5
5
|
const returnAction_1 = require("../../repo/action/returnAction");
|
|
6
6
|
const order_1 = require("../../repo/order");
|
|
7
|
-
const
|
|
7
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
8
8
|
const task_1 = require("../../repo/task");
|
|
9
9
|
// import { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
|
|
10
10
|
const returnOrder_1 = require("../order/returnOrder");
|
|
@@ -21,7 +21,7 @@ function call(params) {
|
|
|
21
21
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
22
22
|
actions: { returnAction: new returnAction_1.ReturnActionRepo(connection) },
|
|
23
23
|
order: new order_1.OrderRepo(connection),
|
|
24
|
-
|
|
24
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
25
25
|
task: new task_1.TaskRepo(connection),
|
|
26
26
|
// returnOrder: new ReturnOrderRepo(connection)
|
|
27
27
|
});
|
|
@@ -5,7 +5,7 @@ const factory_1 = require("../../factory");
|
|
|
5
5
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
6
|
const sendOrder_1 = require("../../repo/action/sendOrder");
|
|
7
7
|
const order_1 = require("../../repo/order");
|
|
8
|
-
const
|
|
8
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
9
9
|
const task_1 = require("../../repo/task");
|
|
10
10
|
const sendOrder_2 = require("../order/sendOrder");
|
|
11
11
|
/**
|
|
@@ -30,7 +30,7 @@ function call(params) {
|
|
|
30
30
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
31
31
|
actions: { sendOrder: new sendOrder_1.SendOrderActionRepo(connection) },
|
|
32
32
|
order: new order_1.OrderRepo(connection),
|
|
33
|
-
|
|
33
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
34
34
|
task: new task_1.TaskRepo(connection),
|
|
35
35
|
});
|
|
36
36
|
};
|
|
@@ -7,7 +7,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
7
7
|
const authorization_1 = require("../../repo/authorization");
|
|
8
8
|
const order_1 = require("../../repo/order");
|
|
9
9
|
const reservation_1 = require("../../repo/reservation");
|
|
10
|
-
const
|
|
10
|
+
const integration_1 = require("../../repo/setting/integration");
|
|
11
11
|
const task_1 = require("../../repo/task");
|
|
12
12
|
const useReservation_1 = require("../reserve/useReservation");
|
|
13
13
|
/**
|
|
@@ -31,7 +31,7 @@ function call(params) {
|
|
|
31
31
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
32
32
|
order: new order_1.OrderRepo(connection),
|
|
33
33
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
34
|
-
|
|
34
|
+
integrationSetting: new integration_1.IntegrationSettingRepo({ connection }),
|
|
35
35
|
task: new task_1.TaskRepo(connection)
|
|
36
36
|
});
|
|
37
37
|
};
|
|
@@ -12,7 +12,6 @@ const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
|
12
12
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
13
13
|
const reservation_1 = require("../../repo/reservation");
|
|
14
14
|
const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
15
|
-
const setting_1 = require("../../repo/setting");
|
|
16
15
|
const integration_1 = require("../../repo/setting/integration");
|
|
17
16
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
18
17
|
const task_1 = require("../../repo/task");
|
|
@@ -46,11 +45,11 @@ function call(params) {
|
|
|
46
45
|
coaAuthClientCreated = true;
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
const
|
|
48
|
+
const integrationSettingRepo = new integration_1.IntegrationSettingRepo({ connection });
|
|
50
49
|
const reserveService = new coa_service_1.COA.service.Reserve({
|
|
51
50
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
52
51
|
auth: coaAuthClient
|
|
53
|
-
}, { timeout: (await
|
|
52
|
+
}, { timeout: (await integrationSettingRepo.getByKey('coa')).timeoutReserve });
|
|
54
53
|
try {
|
|
55
54
|
await (0, voidTransaction_1.voidTransaction)({
|
|
56
55
|
...params.data,
|
|
@@ -67,11 +66,11 @@ function call(params) {
|
|
|
67
66
|
offerRateLimit: new offer_1.OfferRateLimitRepo(redisClient),
|
|
68
67
|
orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
|
|
69
68
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
70
|
-
|
|
69
|
+
integrationSetting: integrationSettingRepo,
|
|
71
70
|
task: new task_1.TaskRepo(connection),
|
|
72
71
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
73
72
|
reserveService
|
|
74
|
-
}
|
|
73
|
+
});
|
|
75
74
|
}
|
|
76
75
|
catch (error) { // eslint-disable-line no-useless-catch
|
|
77
76
|
throw error;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
4
4
|
import type { IExecutableTask } from '../../../taskSettings';
|
|
5
5
|
declare function informTaskIfNeeded(params: {
|
|
6
6
|
task: IExecutableTask<factory.taskName>;
|
|
7
7
|
executionEndDate: Date;
|
|
8
8
|
}): (repos: {
|
|
9
|
-
|
|
9
|
+
integrationSetting: IntegrationSettingRepo;
|
|
10
10
|
task: TaskRepo;
|
|
11
11
|
}) => Promise<void>;
|
|
12
12
|
export { informTaskIfNeeded };
|
|
@@ -9,9 +9,9 @@ const factory_1 = require("../../../factory");
|
|
|
9
9
|
const debug = (0, debug_1.default)('chevre-domain:service:taskHandler:onOperationFailed');
|
|
10
10
|
function createInformTasks(params) {
|
|
11
11
|
const { task, setting, executionEndDate } = params;
|
|
12
|
-
const informTask = setting?.
|
|
13
|
-
const informTaskNames = setting?.
|
|
14
|
-
const informTaskStatuses = setting?.
|
|
12
|
+
const informTask = setting?.informActions;
|
|
13
|
+
const informTaskNames = setting?.informTaskNames;
|
|
14
|
+
const informTaskStatuses = setting?.informTaskStatuses;
|
|
15
15
|
const informTasks = [];
|
|
16
16
|
if (Array.isArray(informTaskNames) && informTaskNames.includes(task.name)) {
|
|
17
17
|
if (Array.isArray(informTaskStatuses)) {
|
|
@@ -85,7 +85,7 @@ function informTaskIfNeeded(params) {
|
|
|
85
85
|
&& task.name !== factory_1.factory.taskName.HandleNotification // nameで絞る
|
|
86
86
|
&& task.name !== factory_1.factory.taskName.TriggerWebhook;
|
|
87
87
|
if (useInform) {
|
|
88
|
-
const setting = await repos.
|
|
88
|
+
const setting = await repos.integrationSetting.getByKey('agg');
|
|
89
89
|
const informTasks = createInformTasks({ task, setting, executionEndDate });
|
|
90
90
|
debug('informTaskIfNeeded: creating inform tasks...', JSON.stringify(informTasks));
|
|
91
91
|
if (informTasks.length > 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSettingRepo } from '../../repo/setting/integration';
|
|
3
3
|
import type { TaskRepo } from '../../repo/task';
|
|
4
4
|
import type { TaskRunningRepo } from '../../repo/taskRunning';
|
|
5
5
|
import type { IExecutableTask } from '../../taskSettings';
|
|
@@ -12,7 +12,7 @@ declare function onOperationFailed(params: {
|
|
|
12
12
|
error: any;
|
|
13
13
|
next?: never;
|
|
14
14
|
}): (repos: {
|
|
15
|
-
|
|
15
|
+
integrationSetting: IntegrationSettingRepo;
|
|
16
16
|
task: TaskRepo;
|
|
17
17
|
taskRunning: TaskRunningRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
@@ -21,7 +21,7 @@ function executeTask(task) {
|
|
|
21
21
|
const now = new Date();
|
|
22
22
|
debug('executing an executableTask...', task, now);
|
|
23
23
|
return async (settings, options) => {
|
|
24
|
-
const
|
|
24
|
+
const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
|
|
25
25
|
const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
|
|
26
26
|
const taskRunningRepo = new (await import('../repo/taskRunning.js')).TaskRunningRepo(settings.connection);
|
|
27
27
|
try {
|
|
@@ -56,7 +56,7 @@ function executeTask(task) {
|
|
|
56
56
|
catch (error) {
|
|
57
57
|
await (0, onOperationFailed_1.onOperationFailed)({
|
|
58
58
|
task, now, error
|
|
59
|
-
})({
|
|
59
|
+
})({ integrationSetting: integrationSettingRepo, task: taskRepo, taskRunning: taskRunningRepo });
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}
|
package/package.json
CHANGED