@chevre/domain 24.1.0-alpha.45 → 24.1.0-alpha.47

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.
Files changed (28) hide show
  1. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +19 -0
  2. package/lib/chevre/repo/setting/integration.d.ts +2 -1
  3. package/lib/chevre/repo/setting/integration.js +8 -0
  4. package/lib/chevre/service/offer/event/authorize.d.ts +0 -5
  5. package/lib/chevre/service/offer/event/authorize.js +1 -4
  6. package/lib/chevre/service/task/acceptCOAOffer.js +3 -1
  7. package/lib/chevre/service/task/authorizePayment.js +3 -1
  8. package/lib/chevre/service/task/cancelPendingReservation.js +3 -1
  9. package/lib/chevre/service/task/checkMovieTicket.js +3 -1
  10. package/lib/chevre/service/task/confirmReserveTransaction.js +3 -1
  11. package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +3 -1
  12. package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
  13. package/lib/chevre/service/task/importOffersFromCOA.js +3 -1
  14. package/lib/chevre/service/task/invalidatePaymentUrl.js +3 -1
  15. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -1
  16. package/lib/chevre/service/task/onOrderPaymentCompleted.js +3 -1
  17. package/lib/chevre/service/task/pay.js +3 -1
  18. package/lib/chevre/service/task/placeOrder.js +3 -1
  19. package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
  20. package/lib/chevre/service/task/refund.js +3 -1
  21. package/lib/chevre/service/task/returnReserveTransaction.js +3 -1
  22. package/lib/chevre/service/task/syncResourcesFromCOA.js +3 -1
  23. package/lib/chevre/service/task/voidPayment.js +3 -1
  24. package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
  25. package/lib/chevre/service/task.js +2 -10
  26. package/lib/chevre/taskSettings.d.ts +0 -20
  27. package/lib/chevre/taskSettings.js +1 -7
  28. package/package.json +1 -1
@@ -193,6 +193,20 @@ export interface ISendGridSettings {
193
193
  apiKey: string;
194
194
  alert?: ISendGridAlert;
195
195
  }
196
+ interface IHubOnOrderStatusChanged {
197
+ informOrder2hub: factory.project.IInformParams[];
198
+ }
199
+ interface IHubOnReservationStatusChanged {
200
+ informReservation2hub: factory.project.IInformParams[];
201
+ }
202
+ interface IHubOnTaskStatusChanged {
203
+ informTask2hub: factory.project.IInformParams[];
204
+ }
205
+ export interface IHubSettings {
206
+ onOrderStatusChanged: IHubOnOrderStatusChanged;
207
+ onReservationStatusChanged: IHubOnReservationStatusChanged;
208
+ onTaskStatusChanged: IHubOnTaskStatusChanged;
209
+ }
196
210
  export interface IIntegrationSettings {
197
211
  abortedTasksWithoutReport: string[];
198
212
  numTryConfirmReserveTransaction: number;
@@ -205,6 +219,11 @@ export interface IIntegrationSettings {
205
219
  * 2026-05-29~
206
220
  */
207
221
  sendGrid?: ISendGridSettings;
222
+ /**
223
+ * hubへの連携設定
224
+ * 2026-06-02~
225
+ */
226
+ hub?: IHubSettings;
208
227
  useExperimentalFeature: boolean;
209
228
  }
210
229
  export interface ISetting {
@@ -1,5 +1,5 @@
1
1
  import type { Connection } from 'mongoose';
2
- import { IIntegrationSettings, ISendGridSettings } from '../mongoose/schemas/setting';
2
+ import { IIntegrationSettings, ISendGridSettings, IHubSettings } from '../mongoose/schemas/setting';
3
3
  interface IDBOptions {
4
4
  connection: Connection;
5
5
  }
@@ -22,5 +22,6 @@ export declare class IntegrationSettingRepo {
22
22
  */
23
23
  getByKey<T extends keyof IIntegrationSettings>(key: T): Promise<IIntegrationSettings[T]>;
24
24
  addSendGridSettings(params: ISendGridSettings): Promise<import("mongoose").UpdateWriteOpResult>;
25
+ addHubSettings(params: IHubSettings): Promise<import("mongoose").UpdateWriteOpResult>;
25
26
  }
26
27
  export {};
@@ -90,5 +90,13 @@ class IntegrationSettingRepo {
90
90
  })
91
91
  .exec();
92
92
  }
93
+ async addHubSettings(params) {
94
+ return this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
95
+ $set: {
96
+ 'integration.hub': params
97
+ }
98
+ })
99
+ .exec();
100
+ }
93
101
  }
94
102
  exports.IntegrationSettingRepo = IntegrationSettingRepo;
@@ -67,11 +67,6 @@ interface IAuthorizeOptions {
67
67
  * 最大n日前から予約可能
68
68
  */
69
69
  maxReservationGracePeriodInDays: number;
70
- /**
71
- * acceptedOfferのitemOfferedを最小化するかどうか
72
- * 2026-05-25~
73
- */
74
- useAcceptedOfferItemOfferedMinimized: boolean;
75
70
  /**
76
71
  * ticketedSeatなしのacceptedOfferを採用するかどうか
77
72
  * 2026-06-01~
@@ -51,7 +51,6 @@ function authorize(params, options) {
51
51
  }, options)(repos, settings);
52
52
  acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
53
53
  if (!noOfferSpecified) {
54
- const useAcceptedOfferItemOfferedMinimized = options.useAcceptedOfferItemOfferedMinimized === true;
55
54
  const useAcceptedOfferNoTicketedSeat = options.useAcceptedOfferNoTicketedSeat === true;
56
55
  await (0, any_1.acceptOffer)({
57
56
  orderNumber,
@@ -61,9 +60,7 @@ function authorize(params, options) {
61
60
  const { priceSpecification: _priceSpecification, itemOffered, ...acceptOfferNoPriceSpec } = acceptOffer4result;
62
61
  return {
63
62
  ...acceptOfferNoPriceSpec,
64
- itemOffered: (useAcceptedOfferItemOfferedMinimized) // support useAcceptedOfferItemOfferedMinimized(2026-05-25~)
65
- ? minimizeItemOffered(itemOffered, { useAcceptedOfferNoTicketedSeat })
66
- : itemOffered
63
+ itemOffered: minimizeItemOffered(itemOffered, { useAcceptedOfferNoTicketedSeat })
67
64
  };
68
65
  })
69
66
  })(repos);
@@ -11,6 +11,7 @@ const event_1 = require("../../repo/event");
11
11
  const orderNumber_1 = require("../../repo/orderNumber");
12
12
  const project_1 = require("../../repo/project");
13
13
  const reserveInterface_1 = require("../../repo/reserveInterface");
14
+ const integration_1 = require("../../repo/setting/integration");
14
15
  // import { TransactionRepo } from '../../repo/transaction';
15
16
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
16
17
  const acceptOffer_1 = require("../offer/eventServiceByCOA/acceptOffer");
@@ -19,7 +20,7 @@ let coaAuthClient;
19
20
  * タスク実行関数
20
21
  */
21
22
  function call(params) {
22
- return async ({ connection, redisClient, settings }, options) => {
23
+ return async ({ connection, redisClient }, options) => {
23
24
  if (redisClient === undefined) {
24
25
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
25
26
  }
@@ -27,6 +28,7 @@ function call(params) {
27
28
  if (!options.executeById) {
28
29
  return;
29
30
  }
31
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
30
32
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
31
33
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
32
34
  if (typeof coaAPI?.id !== 'string') {
@@ -24,6 +24,7 @@ const potentialAction_1 = require("../../repo/potentialAction");
24
24
  const product_1 = require("../../repo/product");
25
25
  const project_1 = require("../../repo/project");
26
26
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
27
+ const integration_1 = require("../../repo/setting/integration");
27
28
  const task_1 = require("../../repo/task");
28
29
  const ticket_1 = require("../../repo/ticket");
29
30
  // import { TransactionRepo } from '../../repo/transaction';
@@ -35,7 +36,7 @@ const any_1 = require("../payment/any");
35
36
  * タスク実行関数
36
37
  */
37
38
  function call(params) {
38
- return async ({ connection, redisClient, settings }, options) => {
39
+ return async ({ connection, redisClient }, options) => {
39
40
  if (redisClient === undefined) {
40
41
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
41
42
  }
@@ -44,6 +45,7 @@ function call(params) {
44
45
  return;
45
46
  }
46
47
  let callResult;
48
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
47
49
  // const actionRepo = new ActionRepo(connection);
48
50
  const authorizePaymentMethodActionRepo = new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection);
49
51
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
@@ -9,6 +9,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
9
9
  const reservation_1 = require("../../repo/reservation");
10
10
  const reserveInterface_1 = require("../../repo/reserveInterface");
11
11
  const setting_1 = require("../../repo/setting");
12
+ const integration_1 = require("../../repo/setting/integration");
12
13
  const stockHolder_1 = require("../../repo/stockHolder");
13
14
  const task_1 = require("../../repo/task");
14
15
  const cancelReservation_1 = require("../reserve/cancelReservation");
@@ -23,10 +24,11 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
23
24
  * タスク実行関数
24
25
  */
25
26
  function call(params) {
26
- return async ({ connection, redisClient, settings }) => {
27
+ return async ({ connection, redisClient }) => {
27
28
  if (redisClient === undefined) {
28
29
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
29
30
  }
31
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
30
32
  const { data } = params;
31
33
  // support COAReserve(2025-03-01~)
32
34
  if (data.purpose?.typeOf === factory_1.factory.assetTransactionType.Reserve) {
@@ -8,13 +8,14 @@ const event_1 = require("../../repo/event");
8
8
  const paymentService_1 = require("../../repo/paymentService");
9
9
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
10
10
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
11
+ const integration_1 = require("../../repo/setting/integration");
11
12
  // import { TransactionProcessRepo } from '../../repo/transactionProcess';
12
13
  const pay_1 = require("../assetTransaction/pay");
13
14
  /**
14
15
  * タスク実行関数
15
16
  */
16
17
  function call(params) {
17
- return async ({ connection, redisClient, settings }, options) => {
18
+ return async ({ connection, redisClient }, options) => {
18
19
  if (redisClient === undefined) {
19
20
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
20
21
  }
@@ -22,6 +23,7 @@ function call(params) {
22
23
  if (!options.executeById) {
23
24
  return;
24
25
  }
26
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
25
27
  const actionRepo = new checkMovieTicket_1.CheckMovieTicketActionRepo(connection);
26
28
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
27
29
  const paymentServiceId = params.data.object[0]?.id;
@@ -17,6 +17,7 @@ const order_1 = require("../../repo/order");
17
17
  const reservation_1 = require("../../repo/reservation");
18
18
  const reserveInterface_1 = require("../../repo/reserveInterface");
19
19
  const setting_1 = require("../../repo/setting");
20
+ const integration_1 = require("../../repo/setting/integration");
20
21
  const task_1 = require("../../repo/task");
21
22
  let coaAuthClientCreated = false;
22
23
  let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
@@ -28,7 +29,8 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
28
29
  * タスク実行関数
29
30
  */
30
31
  function call(params) {
31
- return async ({ connection, settings }) => {
32
+ return async ({ connection }) => {
33
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
32
34
  if (!coaAuthClientCreated) {
33
35
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
34
36
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
@@ -37,6 +37,7 @@ exports.call = call;
37
37
  const coa_service_1 = require("@motionpicture/coa-service");
38
38
  const event_1 = require("../../repo/event");
39
39
  const reserveInterface_1 = require("../../repo/reserveInterface");
40
+ const integration_1 = require("../../repo/setting/integration");
40
41
  const factory_1 = require("../../factory");
41
42
  const EventAggregationService = __importStar(require("../aggregation/event"));
42
43
  let coaAuthClient;
@@ -44,7 +45,7 @@ let coaAuthClient;
44
45
  * タスク実行関数
45
46
  */
46
47
  function call(params) {
47
- return async ({ connection, settings }) => {
48
+ return async ({ connection }) => {
48
49
  if (coaAuthClient === undefined) {
49
50
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
50
51
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
@@ -54,6 +55,7 @@ function call(params) {
54
55
  }
55
56
  coaAuthClient = new coa_service_1.COA.auth.RefreshToken(credentials);
56
57
  }
58
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
57
59
  const reserveService = new coa_service_1.COA.service.Reserve({
58
60
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
59
61
  auth: coaAuthClient
@@ -44,6 +44,7 @@ const movieTheater_1 = require("../../repo/place/movieTheater");
44
44
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
45
45
  const reserveInterface_1 = require("../../repo/reserveInterface");
46
46
  const seller_1 = require("../../repo/seller");
47
+ const integration_1 = require("../../repo/setting/integration");
47
48
  const factory_1 = require("../../factory");
48
49
  const EventService = __importStar(require("../event"));
49
50
  let coaAuthClient;
@@ -51,7 +52,7 @@ let coaAuthClient;
51
52
  * タスク実行関数
52
53
  */
53
54
  function call(params) {
54
- return async ({ connection, settings }) => {
55
+ return async ({ connection }) => {
55
56
  if (coaAuthClient === undefined) {
56
57
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
57
58
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
@@ -61,6 +62,7 @@ function call(params) {
61
62
  }
62
63
  coaAuthClient = new coa_service_1.COA.auth.RefreshToken(credentials);
63
64
  }
65
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
64
66
  const masterService = new coa_service_1.COA.service.Master({
65
67
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
66
68
  auth: coaAuthClient
@@ -38,6 +38,7 @@ const coa_service_1 = require("@motionpicture/coa-service");
38
38
  const aggregateOffer_1 = require("../../repo/aggregateOffer");
39
39
  const categoryCode_1 = require("../../repo/categoryCode");
40
40
  const reserveInterface_1 = require("../../repo/reserveInterface");
41
+ const integration_1 = require("../../repo/setting/integration");
41
42
  const factory_1 = require("../../factory");
42
43
  const OfferService = __importStar(require("../offer"));
43
44
  let coaAuthClient;
@@ -46,7 +47,7 @@ let paymentMethodType4membershipCoupon;
46
47
  * タスク実行関数
47
48
  */
48
49
  function call(params) {
49
- return async ({ connection, settings }) => {
50
+ return async ({ connection }) => {
50
51
  if (coaAuthClient === undefined || paymentMethodType4membershipCoupon === undefined) {
51
52
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
52
53
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
@@ -61,6 +62,7 @@ function call(params) {
61
62
  }
62
63
  paymentMethodType4membershipCoupon = paymentMethodType4membershipCouponByInterface;
63
64
  }
65
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
64
66
  const aggregateOfferRepo = new aggregateOffer_1.AggregateOfferRepo(connection);
65
67
  const categoryCodeRepo = new categoryCode_1.CategoryCodeRepo(connection);
66
68
  // const taskRepo = new TaskRepo(connection);
@@ -9,10 +9,12 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
9
9
  const paymentService_1 = require("../../repo/paymentService");
10
10
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
11
11
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
12
+ const integration_1 = require("../../repo/setting/integration");
12
13
  const task_1 = require("../../repo/task");
13
14
  const invalidatePaymentUrlByTask_1 = require("./payment/invalidatePaymentUrlByTask");
14
15
  function call(params) {
15
- return async ({ connection, settings }) => {
16
+ return async ({ connection }) => {
17
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
16
18
  await (0, invalidatePaymentUrlByTask_1.invalidatePaymentUrlByTask)({
17
19
  ...params.data,
18
20
  sameAs: { id: params.id }
@@ -5,6 +5,7 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
5
5
  const assetTransaction_1 = require("../../repo/assetTransaction");
6
6
  const order_1 = require("../../repo/order");
7
7
  const setting_1 = require("../../repo/setting");
8
+ const integration_1 = require("../../repo/setting/integration");
8
9
  const task_1 = require("../../repo/task");
9
10
  // import { TransactionRepo } from '../../repo/transaction';
10
11
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
@@ -13,7 +14,8 @@ const onAssetTransactionStatusChanged_1 = require("../order/onAssetTransactionSt
13
14
  * タスク実行関数
14
15
  */
15
16
  function call(data) {
16
- return async ({ connection, settings }) => {
17
+ return async ({ connection }) => {
18
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
17
19
  await (0, onAssetTransactionStatusChanged_1.onAssetTransactionStatusChanged)(data)({
18
20
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
19
21
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
@@ -4,6 +4,7 @@ exports.call = call;
4
4
  const acceptedOffer_1 = require("../../repo/acceptedOffer");
5
5
  const order_1 = require("../../repo/order");
6
6
  const setting_1 = require("../../repo/setting");
7
+ const integration_1 = require("../../repo/setting/integration");
7
8
  const task_1 = require("../../repo/task");
8
9
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
9
10
  const payOrder_1 = require("../order/payOrder");
@@ -11,7 +12,8 @@ const payOrder_1 = require("../order/payOrder");
11
12
  * タスク実行関数
12
13
  */
13
14
  function call(data) {
14
- return async ({ connection, settings }) => {
15
+ return async ({ connection }) => {
16
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
15
17
  await (0, payOrder_1.payOrder)(data)({
16
18
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
17
19
  order: new order_1.OrderRepo(connection),
@@ -17,16 +17,18 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
17
17
  const product_1 = require("../../repo/product");
18
18
  const project_1 = require("../../repo/project");
19
19
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
20
+ const integration_1 = require("../../repo/setting/integration");
20
21
  const task_1 = require("../../repo/task");
21
22
  const payByTask_1 = require("./payment/payByTask");
22
23
  /**
23
24
  * タスク実行関数
24
25
  */
25
26
  function call(params) {
26
- return async ({ connection, redisClient, settings }) => {
27
+ return async ({ connection, redisClient }) => {
27
28
  if (redisClient === undefined) {
28
29
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
29
30
  }
31
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
30
32
  const payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
31
33
  ...params.data,
32
34
  sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
@@ -9,6 +9,7 @@ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMeth
9
9
  const order_1 = require("../../repo/order");
10
10
  const orderInTransaction_1 = require("../../repo/orderInTransaction");
11
11
  const setting_1 = require("../../repo/setting");
12
+ const integration_1 = require("../../repo/setting/integration");
12
13
  const task_1 = require("../../repo/task");
13
14
  // import { TransactionRepo } from '../../repo/transaction';
14
15
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
@@ -17,7 +18,8 @@ const placeOrder_2 = require("../order/placeOrder");
17
18
  * タスク実行関数
18
19
  */
19
20
  function call(data) {
20
- return async ({ connection, settings }) => {
21
+ return async ({ connection }) => {
22
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
21
23
  await (0, placeOrder_2.placeOrder)({
22
24
  ...data,
23
25
  useOnOrderStatusChanged: true
@@ -15,6 +15,7 @@ const paymentService_1 = require("../../repo/paymentService");
15
15
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
16
16
  const project_1 = require("../../repo/project");
17
17
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
18
+ const integration_1 = require("../../repo/setting/integration");
18
19
  const ticket_1 = require("../../repo/ticket");
19
20
  // import { TransactionRepo } from '../../repo/transaction';
20
21
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
@@ -25,7 +26,7 @@ const any_1 = require("../payment/any");
25
26
  * タスク実行関数
26
27
  */
27
28
  function call(params) {
28
- return async ({ connection, redisClient, settings }, options) => {
29
+ return async ({ connection, redisClient }, options) => {
29
30
  if (redisClient === undefined) {
30
31
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
31
32
  }
@@ -33,6 +34,7 @@ function call(params) {
33
34
  if (!options.executeById) {
34
35
  return;
35
36
  }
37
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
36
38
  const actionRepo = new acceptPay_1.AcceptPayActionRepo(connection);
37
39
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
38
40
  try {
@@ -13,6 +13,7 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
13
13
  const product_1 = require("../../repo/product");
14
14
  const project_1 = require("../../repo/project");
15
15
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
16
+ const integration_1 = require("../../repo/setting/integration");
16
17
  const task_1 = require("../../repo/task");
17
18
  const transactionNumber_1 = require("../../repo/transactionNumber");
18
19
  const refundByTask_1 = require("./payment/refundByTask");
@@ -20,10 +21,11 @@ const refundByTask_1 = require("./payment/refundByTask");
20
21
  * タスク実行関数
21
22
  */
22
23
  function call(params) {
23
- return async ({ connection, redisClient, settings }) => {
24
+ return async ({ connection, redisClient }) => {
24
25
  if (redisClient === undefined) {
25
26
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
26
27
  }
28
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
27
29
  let data;
28
30
  if (params.name === factory_1.factory.taskName.Refund) {
29
31
  data = {
@@ -48,6 +48,7 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
48
48
  const project_1 = require("../../repo/project");
49
49
  const reservation_1 = require("../../repo/reservation");
50
50
  const reserveInterface_1 = require("../../repo/reserveInterface");
51
+ const integration_1 = require("../../repo/setting/integration");
51
52
  const transactionNumber_1 = require("../../repo/transactionNumber");
52
53
  let coaAuthClientCreated = false;
53
54
  let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
@@ -59,7 +60,7 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
59
60
  * タスク実行関数
60
61
  */
61
62
  function call(params) {
62
- return async ({ connection, redisClient, settings }) => {
63
+ return async ({ connection, redisClient }) => {
63
64
  if (redisClient === undefined) {
64
65
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
65
66
  }
@@ -72,6 +73,7 @@ function call(params) {
72
73
  coaAuthClientCreated = true;
73
74
  }
74
75
  }
76
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
75
77
  const reserveService = new coa_service_1.COA.service.Reserve({
76
78
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
77
79
  auth: coaAuthClient
@@ -16,6 +16,7 @@ const eventSeries_1 = require("../../repo/eventSeries");
16
16
  const movieTheater_1 = require("../../repo/place/movieTheater");
17
17
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
18
18
  const reserveInterface_1 = require("../../repo/reserveInterface");
19
+ const integration_1 = require("../../repo/setting/integration");
19
20
  const saveScreeningEvents_1 = require("../event/saveScreeningEvents");
20
21
  const saveScreeningEventSeries_1 = require("../event/saveScreeningEventSeries");
21
22
  let coaAuthClient;
@@ -23,7 +24,7 @@ let coaAuthClient;
23
24
  * タスク実行関数
24
25
  */
25
26
  function call(params) {
26
- return async ({ connection, redisClient, settings }, options) => {
27
+ return async ({ connection, redisClient }, options) => {
27
28
  if (redisClient === undefined) {
28
29
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
29
30
  }
@@ -31,6 +32,7 @@ function call(params) {
31
32
  if (!options.executeById) {
32
33
  return;
33
34
  }
35
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
34
36
  const reserveInterfaceRepo = new reserveInterface_1.ReserveInterfaceRepo(connection);
35
37
  const coaAPI = await reserveInterfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
36
38
  if (typeof coaAPI?.id !== 'string') {
@@ -13,16 +13,18 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
13
13
  const product_1 = require("../../repo/product");
14
14
  const project_1 = require("../../repo/project");
15
15
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
16
+ const integration_1 = require("../../repo/setting/integration");
16
17
  const task_1 = require("../../repo/task");
17
18
  const voidPaymentByTask_1 = require("./payment/voidPaymentByTask");
18
19
  /**
19
20
  * タスク実行関数
20
21
  */
21
22
  function call(data) {
22
- return async ({ connection, redisClient, settings }) => {
23
+ return async ({ connection, redisClient }) => {
23
24
  if (redisClient === undefined) {
24
25
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
25
26
  }
27
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
26
28
  const paymentServiceId = data.object.object.id;
27
29
  const credentialsExpireInSeconds = (await settings.getByKey('movieticketReserve')).credentialsExpireInSeconds;
28
30
  const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
@@ -13,6 +13,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
13
13
  const reservation_1 = require("../../repo/reservation");
14
14
  const reserveInterface_1 = require("../../repo/reserveInterface");
15
15
  const setting_1 = require("../../repo/setting");
16
+ const integration_1 = require("../../repo/setting/integration");
16
17
  const stockHolder_1 = require("../../repo/stockHolder");
17
18
  const task_1 = require("../../repo/task");
18
19
  // import { TransactionRepo } from '../../repo/transaction';
@@ -27,7 +28,7 @@ let coaAuthClient = new coa_service_1.COA.auth.RefreshToken({
27
28
  * タスク実行関数
28
29
  */
29
30
  function call(params) {
30
- return async ({ connection, redisClient, settings }, options) => {
31
+ return async ({ connection, redisClient }, options) => {
31
32
  if (redisClient === undefined) {
32
33
  throw new factory_1.factory.errors.Argument('settings', 'redisClient required');
33
34
  }
@@ -47,6 +48,7 @@ function call(params) {
47
48
  coaAuthClientCreated = true;
48
49
  }
49
50
  }
51
+ const settings = new integration_1.IntegrationSettingRepo({ connection });
50
52
  const reserveService = new coa_service_1.COA.service.Reserve({
51
53
  endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
52
54
  auth: coaAuthClient
@@ -17,7 +17,6 @@ const debug = (0, debug_1.default)('chevre-domain:service:task');
17
17
  function executeById(params, next) {
18
18
  return async (settings) => {
19
19
  const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
20
- const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
21
20
  const { id, status, executor, expires } = params;
22
21
  let task = null;
23
22
  try {
@@ -35,10 +34,7 @@ function executeById(params, next) {
35
34
  }
36
35
  // タスクがなければ終了
37
36
  if (task !== null) {
38
- await (0, taskHandler_1.executeTask)(task, (typeof next === 'function') ? next : undefined)({
39
- ...settings,
40
- settings: integrationSettingRepo
41
- }, {
37
+ await (0, taskHandler_1.executeTask)(task, (typeof next === 'function') ? next : undefined)(settings, {
42
38
  executeById: true,
43
39
  executeByName: false
44
40
  });
@@ -48,7 +44,6 @@ function executeById(params, next) {
48
44
  function executeOneIfExists(params) {
49
45
  return async (settings) => {
50
46
  const taskRepo = new (await import('../repo/task.js')).TaskRepo(settings.connection);
51
- const integrationSettingRepo = new (await import('../repo/setting/integration.js')).IntegrationSettingRepo({ connection: settings.connection });
52
47
  // 未実行のタスクを取得
53
48
  let task = null;
54
49
  try {
@@ -66,10 +61,7 @@ function executeOneIfExists(params) {
66
61
  }
67
62
  // タスクがなければ終了
68
63
  if (task !== null) {
69
- await (0, taskHandler_1.executeTask)(task)({
70
- ...settings,
71
- settings: integrationSettingRepo
72
- }, {
64
+ await (0, taskHandler_1.executeTask)(task)(settings, {
73
65
  executeById: false,
74
66
  executeByName: (typeof params.name?.$eq === 'string')
75
67
  });
@@ -1,15 +1,5 @@
1
1
  import type { IExecuteSettings as IMinimumExecuteSettings } from './eventEmitter/task';
2
2
  import { factory } from './factory';
3
- import type { IntegrationSettingRepo } from './repo/setting/integration';
4
- interface IOnOrderStatusChanged {
5
- informOrder2hub?: factory.project.IInformParams[];
6
- }
7
- interface IOnReservationStatusChanged {
8
- informReservation2hub?: factory.project.IInformParams[];
9
- }
10
- interface IOnTaskStatusChanged {
11
- informTask2hub?: factory.project.IInformParams[];
12
- }
13
3
  interface ICallableTask {
14
4
  aggregateOnSystem?: ICallableTaskOperation;
15
5
  handleNotification?: ICallableTaskOperation;
@@ -19,25 +9,15 @@ interface IOptions {
19
9
  * タスク実行処理の実装
20
10
  */
21
11
  callableTask?: ICallableTask;
22
- onOrderStatusChanged: IOnOrderStatusChanged;
23
- onReservationStatusChanged: IOnReservationStatusChanged;
24
- onTaskStatusChanged: IOnTaskStatusChanged;
25
12
  }
26
13
  /**
27
14
  * aggregation domain settings
28
15
  */
29
16
  declare class AggregationSettings {
30
17
  readonly callableTask?: ICallableTask;
31
- readonly onOrderStatusChanged: IOnOrderStatusChanged;
32
- readonly onReservationStatusChanged: IOnReservationStatusChanged;
33
- readonly onTaskStatusChanged: IOnTaskStatusChanged;
34
18
  constructor(options: IOptions);
35
19
  }
36
20
  interface IExecuteSettings extends IMinimumExecuteSettings {
37
- /**
38
- * 外部連携設定リポジトリ
39
- */
40
- settings: IntegrationSettingRepo;
41
21
  aggregationSettings?: AggregationSettings;
42
22
  }
43
23
  interface IExecuteOptions {
@@ -6,14 +6,8 @@ exports.AggregationSettings = void 0;
6
6
  */
7
7
  class AggregationSettings {
8
8
  callableTask;
9
- onOrderStatusChanged;
10
- onReservationStatusChanged;
11
- onTaskStatusChanged;
12
9
  constructor(options) {
13
- const { callableTask, onOrderStatusChanged, onReservationStatusChanged, onTaskStatusChanged } = options;
14
- this.onOrderStatusChanged = onOrderStatusChanged;
15
- this.onReservationStatusChanged = onReservationStatusChanged;
16
- this.onTaskStatusChanged = onTaskStatusChanged;
10
+ const { callableTask, } = options;
17
11
  if (callableTask !== undefined) {
18
12
  this.callableTask = callableTask;
19
13
  }
package/package.json CHANGED
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.1.0-alpha.45"
94
+ "version": "24.1.0-alpha.47"
95
95
  }