@chevre/domain 28.1.0-alpha.4 → 28.1.0-alpha.6

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 (97) hide show
  1. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
  2. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +28 -36
  3. package/lib/chevre/repo/mongoose/schemas/setting.js +9 -6
  4. package/lib/chevre/repo/mongoose/schemas/transactionNumber.d.ts +1 -2
  5. package/lib/chevre/repo/mongoose/schemas/transactionNumber.js +1 -1
  6. package/lib/chevre/repo/setting/integration.d.ts +2 -0
  7. package/lib/chevre/repo/setting/integration.js +53 -0
  8. package/lib/chevre/repo/setting.d.ts +1 -1
  9. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +3 -4
  10. package/lib/chevre/service/assetTransaction/reserve/cancel.js +1 -3
  11. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +3 -4
  12. package/lib/chevre/service/assetTransaction/reserve/confirm.js +1 -3
  13. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +3 -2
  14. package/lib/chevre/service/notification/triggerWebhook/processInformAction.d.ts +1 -3
  15. package/lib/chevre/service/notification/triggerWebhook/processInformAction.js +3 -3
  16. package/lib/chevre/service/notification/triggerWebhook.js +4 -4
  17. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
  18. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -6
  19. package/lib/chevre/service/offer/event/authorize.d.ts +3 -2
  20. package/lib/chevre/service/offer/event/authorize.js +2 -2
  21. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +3 -4
  22. package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +2 -2
  23. package/lib/chevre/service/offer/event/voidTransaction.d.ts +3 -4
  24. package/lib/chevre/service/offer/event/voidTransaction.js +3 -3
  25. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -4
  26. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
  27. package/lib/chevre/service/offer/onEventChanged.js +4 -4
  28. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +0 -2
  29. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +3 -4
  30. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
  31. package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +0 -2
  32. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +3 -4
  33. package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +2 -2
  34. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +2 -2
  35. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
  36. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
  37. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +1 -1
  38. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -2
  39. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  40. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
  41. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +1 -1
  42. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +2 -2
  43. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +2 -4
  44. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
  45. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
  46. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +3 -4
  47. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +3 -3
  48. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
  49. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +1 -1
  50. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
  51. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
  52. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
  53. package/lib/chevre/service/order/onOrderUpdated/factory.js +1 -1
  54. package/lib/chevre/service/order/onOrderUpdated.d.ts +2 -2
  55. package/lib/chevre/service/order/onOrderUpdated.js +1 -1
  56. package/lib/chevre/service/order/payOrder.d.ts +3 -4
  57. package/lib/chevre/service/order/payOrder.js +2 -2
  58. package/lib/chevre/service/order/placeOrder.d.ts +3 -4
  59. package/lib/chevre/service/order/placeOrder.js +2 -2
  60. package/lib/chevre/service/order/returnOrder.d.ts +2 -2
  61. package/lib/chevre/service/order/sendOrder.d.ts +2 -2
  62. package/lib/chevre/service/reserve/cancelReservation.d.ts +3 -3
  63. package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -2
  64. package/lib/chevre/service/reserve/confirmReservation.d.ts +2 -2
  65. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +2 -2
  66. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +2 -3
  67. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +2 -2
  68. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -3
  69. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -2
  70. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -2
  71. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -2
  72. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -2
  73. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
  74. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  75. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +2 -2
  76. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +2 -3
  77. package/lib/chevre/service/reserve/useReservation.d.ts +2 -2
  78. package/lib/chevre/service/task/cancelPendingReservation.js +3 -4
  79. package/lib/chevre/service/task/cancelReservation.js +2 -2
  80. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -4
  81. package/lib/chevre/service/task/confirmReserveTransaction.js +6 -7
  82. package/lib/chevre/service/task/informHub.js +0 -2
  83. package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +3 -4
  84. package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
  85. package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -4
  86. package/lib/chevre/service/task/placeOrder.js +2 -4
  87. package/lib/chevre/service/task/reserve.js +2 -2
  88. package/lib/chevre/service/task/returnOrder.js +2 -2
  89. package/lib/chevre/service/task/sendOrder.js +2 -2
  90. package/lib/chevre/service/task/triggerWebhook.js +0 -2
  91. package/lib/chevre/service/task/useReservation.js +2 -2
  92. package/lib/chevre/service/task/voidReserveTransaction.js +4 -5
  93. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -2
  94. package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.js +4 -4
  95. package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -2
  96. package/lib/chevre/service/taskHandler.js +2 -2
  97. package/package.json +1 -1
@@ -16,7 +16,7 @@ const schemaDefinition = {
16
16
  typeOf: { type: String, required: true },
17
17
  itemListElement: [mongoose_1.SchemaTypes.Mixed],
18
18
  itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
19
- // additionalProperty: [SchemaTypes.Mixed], // TODO discontinue(2026-10-31~)
19
+ // additionalProperty: [SchemaTypes.Mixed], // discontinue(2026-10-31~)
20
20
  dateSynced: Date // 追加(2023-09-13~)
21
21
  };
22
22
  const schemaOptions = {
@@ -2,19 +2,10 @@ import type { Algorithm } from 'jsonwebtoken';
2
2
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
3
3
  import { factory } from '../../../factory';
4
4
  import { IVirtuals } from '../virtuals';
5
- interface IOnOrderStatusChanged {
6
- /**
7
- * AggService通知先
8
- */
9
- informOrder?: factory.project.IInformParams[];
10
- }
11
- interface IOnReservationStatusChanged {
12
- /**
13
- * AggService通知先
14
- */
15
- informReservation?: factory.project.IInformParams[];
16
- }
17
- interface IOnTaskStatusChanged {
5
+ /**
6
+ * @deprecated integration.aggへ移行済(2026-11-03~)
7
+ */
8
+ export interface IOnTaskStatusChanged {
18
9
  /**
19
10
  * AggService通知先
20
11
  */
@@ -28,9 +19,6 @@ interface IOnTaskStatusChanged {
28
19
  */
29
20
  informTaskStatuses?: factory.taskStatus[];
30
21
  }
31
- interface IOnEventChanged {
32
- informEvent2agg?: factory.project.IInformParams[];
33
- }
34
22
  export interface IStorageSettings {
35
23
  deleteTransactionTaskExpiresInDays: number;
36
24
  /**
@@ -54,7 +42,7 @@ interface IQuotaSettings {
54
42
  placeOrderExpiresInSecondsMax?: number;
55
43
  placeOrderExpiresInSecondsMin?: number;
56
44
  }
57
- interface ITriggerWebhookSettings {
45
+ export interface ITriggerWebhookSettings {
58
46
  /**
59
47
  * リクエストタイムアウト
60
48
  */
@@ -121,16 +109,6 @@ export interface ITransactionNumberSetting {
121
109
  */
122
110
  version: string;
123
111
  }
124
- export interface IServiceOutputIdentifierSetting {
125
- /**
126
- * fpe暗号鍵
127
- */
128
- fpeSecret: string;
129
- /**
130
- * "1"
131
- */
132
- version: string;
133
- }
134
112
  interface ICOAIntegrationSettings {
135
113
  timeoutReserve: number;
136
114
  timeoutMaster: number;
@@ -198,6 +176,20 @@ export interface IHubSettings {
198
176
  */
199
177
  googleTargetAudience?: string;
200
178
  }
179
+ export interface IAggSettings {
180
+ /**
181
+ * AggService通知先
182
+ */
183
+ informActions?: factory.project.IInformParams[];
184
+ /**
185
+ * 分析連携するtaskNameリスト
186
+ */
187
+ informTaskNames?: factory.taskName[];
188
+ /**
189
+ * 分析連携するtaskStatusリスト
190
+ */
191
+ informTaskStatuses?: factory.taskStatus[];
192
+ }
201
193
  export interface IIntegrationSettings {
202
194
  abortedTasksWithoutReport: string[];
203
195
  numTryConfirmReserveTransaction: number;
@@ -215,6 +207,15 @@ export interface IIntegrationSettings {
215
207
  * 2026-06-02~
216
208
  */
217
209
  hub?: IHubSettings;
210
+ /**
211
+ * 集計サービスへの連携設定
212
+ * 2026-11-02~
213
+ */
214
+ agg?: IAggSettings;
215
+ /**
216
+ * 通知設定
217
+ */
218
+ triggerWebhook?: ITriggerWebhookSettings;
218
219
  useExperimentalFeature: boolean;
219
220
  }
220
221
  /**
@@ -261,23 +262,14 @@ export interface IMemberSetting {
261
262
  export interface ISetting {
262
263
  defaultSenderEmail?: string;
263
264
  jwt?: IJWTSetting;
264
- onEventChanged?: IOnEventChanged;
265
- onOrderStatusChanged: IOnOrderStatusChanged;
266
- onReservationStatusChanged?: IOnReservationStatusChanged;
267
- onTaskStatusChanged?: IOnTaskStatusChanged;
268
265
  orderNumber?: IOrderNumberSetting;
269
266
  project: {
270
267
  id: string;
271
268
  typeOf: factory.organizationType.Project;
272
269
  };
273
270
  quota?: IQuotaSettings;
274
- serviceOutputIdentifier?: IServiceOutputIdentifierSetting;
275
271
  storage?: IStorageSettings;
276
272
  transactionNumber?: ITransactionNumberSetting;
277
- /**
278
- * 通知設定
279
- */
280
- triggerWebhook?: ITriggerWebhookSettings;
281
273
  useInformResourceTypes?: string[];
282
274
  userPoolIdOld?: string;
283
275
  userPoolIdNew?: string;
@@ -11,18 +11,21 @@ const schemaDefinition = {
11
11
  defaultSenderEmail: String,
12
12
  jwt: mongoose_1.SchemaTypes.Mixed,
13
13
  project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
14
- onEventChanged: mongoose_1.SchemaTypes.Mixed,
15
- onOrderStatusChanged: mongoose_1.SchemaTypes.Mixed,
16
- onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
17
- onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
14
+ // discontinue(2026-11-02~)
15
+ ...{
16
+ onEventChanged: mongoose_1.SchemaTypes.Mixed,
17
+ onOrderStatusChanged: mongoose_1.SchemaTypes.Mixed,
18
+ onReservationStatusChanged: mongoose_1.SchemaTypes.Mixed,
19
+ onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
20
+ triggerWebhook: mongoose_1.SchemaTypes.Mixed,
21
+ },
18
22
  // onResourceUpdated: SchemaTypes.Mixed, // discontinue(2026-11-02~)
19
23
  // onTransactionStatusChanged: SchemaTypes.Mixed, // discontinue(2026-06-29~)
20
24
  orderNumber: mongoose_1.SchemaTypes.Mixed,
21
25
  quota: mongoose_1.SchemaTypes.Mixed,
22
- serviceOutputIdentifier: mongoose_1.SchemaTypes.Mixed,
26
+ // serviceOutputIdentifier: SchemaTypes.Mixed, // discontinue(2026-11-03~)
23
27
  storage: mongoose_1.SchemaTypes.Mixed,
24
28
  transactionNumber: mongoose_1.SchemaTypes.Mixed,
25
- triggerWebhook: mongoose_1.SchemaTypes.Mixed,
26
29
  useInformResourceTypes: [String],
27
30
  userPoolIdOld: String,
28
31
  userPoolIdNew: String,
@@ -4,8 +4,7 @@ import { factory } from '../../../factory';
4
4
  declare enum DataCatalogIdentifier {
5
5
  confirmationNumber = "confirmationNumber",
6
6
  transactionNumber = "transactionNumber",
7
- orderNumber = "orderNumber",
8
- serviceOutputIdentifier = "serviceOutputIdentifier"
7
+ orderNumber = "orderNumber"
9
8
  }
10
9
  interface IDataCatalog {
11
10
  identifier: DataCatalogIdentifier;
@@ -10,7 +10,7 @@ var DataCatalogIdentifier;
10
10
  DataCatalogIdentifier["confirmationNumber"] = "confirmationNumber";
11
11
  DataCatalogIdentifier["transactionNumber"] = "transactionNumber";
12
12
  DataCatalogIdentifier["orderNumber"] = "orderNumber";
13
- DataCatalogIdentifier["serviceOutputIdentifier"] = "serviceOutputIdentifier";
13
+ // serviceOutputIdentifier = 'serviceOutputIdentifier' // discontinue(2026-11-03~)
14
14
  })(DataCatalogIdentifier || (exports.DataCatalogIdentifier = DataCatalogIdentifier = {}));
15
15
  const modelName = 'TransactionNumber';
16
16
  exports.modelName = modelName;
@@ -24,4 +24,6 @@ export declare class IntegrationSettingRepo {
24
24
  getByKey<T extends keyof IIntegrationSettings>(key: T): Promise<IIntegrationSettings[T]>;
25
25
  addSendGridSettings(params: ISendGridSettings): Promise<import("mongoose").UpdateWriteOpResult>;
26
26
  addHubSettings(params: IHubSettings): Promise<import("mongoose").UpdateWriteOpResult>;
27
+ migrateAggSettings(): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
28
+ migrateTriggerWebhookSettings(): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
27
29
  }
@@ -98,5 +98,58 @@ class IntegrationSettingRepo {
98
98
  })
99
99
  .exec();
100
100
  }
101
+ async migrateAggSettings() {
102
+ const oldSetting = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, { onTaskStatusChanged: 1 })
103
+ .lean()
104
+ .exec();
105
+ if (oldSetting?.onTaskStatusChanged !== undefined) {
106
+ const { informTask, informTaskNames, informTaskStatuses } = oldSetting.onTaskStatusChanged;
107
+ const aggSettings = {
108
+ informActions: informTask,
109
+ informTaskNames,
110
+ informTaskStatuses
111
+ };
112
+ console.dir(aggSettings, { depth: null });
113
+ const updateResult = await this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
114
+ $set: { 'integration.agg': aggSettings }
115
+ })
116
+ .exec();
117
+ // const unsetResult = await this.settingModel.updateOne(
118
+ // { 'project.id': { $eq: '*' } },
119
+ // {
120
+ // $unset: {
121
+ // onEventChanged: 1,
122
+ // onOrderStatusChanged: 1,
123
+ // onReservationStatusChanged: 1,
124
+ // onTaskStatusChanged: 1,
125
+ // }
126
+ // }
127
+ // )
128
+ // .exec();
129
+ return updateResult;
130
+ }
131
+ }
132
+ async migrateTriggerWebhookSettings() {
133
+ const oldSetting = await this.settingModel.findOne({ 'project.id': { $eq: '*' } }, { triggerWebhook: 1 })
134
+ .lean()
135
+ .exec();
136
+ if (oldSetting?.triggerWebhook !== undefined) {
137
+ console.dir(oldSetting.triggerWebhook, { depth: null });
138
+ const updateResult = await this.settingModel.updateOne({ 'project.id': { $eq: '*' } }, {
139
+ $set: { 'integration.triggerWebhook': oldSetting.triggerWebhook }
140
+ })
141
+ .exec();
142
+ // const unsetResult = await this.settingModel.updateOne(
143
+ // { 'project.id': { $eq: '*' } },
144
+ // {
145
+ // $unset: {
146
+ // triggerWebhook: 1,
147
+ // }
148
+ // }
149
+ // )
150
+ // .exec();
151
+ return updateResult;
152
+ }
153
+ }
101
154
  }
102
155
  exports.IntegrationSettingRepo = IntegrationSettingRepo;
@@ -1,7 +1,7 @@
1
1
  import type { Connection, FilterQuery } from 'mongoose';
2
2
  import { ISetting, IStorageSettings } from './mongoose/schemas/setting';
3
3
  type IKeyOfProjection = Exclude<keyof ISetting, 'jwt' | 'project' | 'waiter' | 'integration'>;
4
- type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'onEventChanged' | 'onOrderStatusChanged' | 'onReservationStatusChanged' | 'onTaskStatusChanged' | 'orderNumber' | 'quota' | 'serviceOutputIdentifier' | 'storage' | 'transactionNumber' | 'triggerWebhook' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
4
+ type IGlobalSetting = Pick<ISetting, 'defaultSenderEmail' | 'orderNumber' | 'quota' | 'storage' | 'transactionNumber' | 'useInformResourceTypes' | 'useMongo4confirmationNumberFrom' | 'useMongo4orderNumberFrom' | 'useMongo4transactionNumberFrom' | 'useMongoAsStockHolder' | 'useMongoAsStockHolderProjects' | 'userPoolIdNew' | 'userPoolIdOld'>;
5
5
  export { IGlobalSetting as ISetting };
6
6
  /**
7
7
  * 設定リポジトリ
@@ -1,9 +1,8 @@
1
- import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
2
1
  import type { CancelActionRepo } from '../../../repo/action/cancel';
3
2
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
4
3
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
5
4
  import type { ReservationRepo } from '../../../repo/reservation';
6
- import type { SettingRepo } from '../../../repo/setting';
5
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
7
6
  import type { StockHolderRepo } from '../../../repo/stockHolder';
8
7
  import type { TaskRepo } from '../../../repo/task';
9
8
  type ICancelOperation<T> = (repos: {
@@ -13,10 +12,10 @@ type ICancelOperation<T> = (repos: {
13
12
  stockHolder: StockHolderRepo;
14
13
  offerRateLimit: OfferRateLimitRepo;
15
14
  reservation: ReservationRepo;
16
- setting: SettingRepo;
15
+ integrationSetting: IntegrationSettingRepo;
17
16
  task: TaskRepo;
18
17
  assetTransaction: AssetTransactionRepo;
19
- }, settings: Settings) => Promise<T>;
18
+ }) => Promise<T>;
20
19
  /**
21
20
  * 取引中止
22
21
  */
@@ -7,9 +7,7 @@ const cancelReservation_1 = require("../../reserve/cancelReservation");
7
7
  * 取引中止
8
8
  */
9
9
  function cancel(params) {
10
- return async (repos
11
- // settings: Settings
12
- ) => {
10
+ return async (repos) => {
13
11
  // まず取引状態変更
14
12
  const { id } = await repos.assetTransaction.cancel({
15
13
  typeOf: factory_1.factory.assetTransactionType.Reserve,
@@ -1,11 +1,10 @@
1
1
  import { factory } from '../../../factory';
2
- import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
2
  import type { ReserveActionRepo } from '../../../repo/action/reserve';
4
3
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
4
  import type { AuthorizationRepo } from '../../../repo/authorization';
6
5
  import type { OrderRepo } from '../../../repo/order';
7
6
  import type { ReservationRepo } from '../../../repo/reservation';
8
- import type { SettingRepo } from '../../../repo/setting';
7
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
9
8
  import type { TaskRepo } from '../../../repo/task';
10
9
  interface IConfirmRepo {
11
10
  actions: {
@@ -15,10 +14,10 @@ interface IConfirmRepo {
15
14
  code: AuthorizationRepo;
16
15
  order: OrderRepo;
17
16
  reservation: ReservationRepo;
18
- setting: SettingRepo;
17
+ integrationSetting: IntegrationSettingRepo;
19
18
  task: TaskRepo;
20
19
  }
21
- type IConfirmOperation<T> = (repos: IConfirmRepo, settings: Settings) => Promise<T>;
20
+ type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
22
21
  /**
23
22
  * 取引確定
24
23
  */
@@ -8,9 +8,7 @@ const factory_2 = require("./confirm/factory");
8
8
  * 取引確定
9
9
  */
10
10
  function confirm(params) {
11
- return async (repos
12
- // settings: Settings
13
- ) => {
11
+ return async (repos) => {
14
12
  let transaction;
15
13
  // 取引存在確認
16
14
  if (typeof params.id === 'string') {
@@ -1,5 +1,4 @@
1
1
  import { factory } from '../../../factory';
2
- import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
2
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
4
3
  import type { AuthorizationRepo } from '../../../repo/authorization';
5
4
  import type { EventRepo } from '../../../repo/event';
@@ -17,6 +16,7 @@ import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
17
16
  import type { ProductRepo } from '../../../repo/product';
18
17
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
19
18
  import type { SettingRepo } from '../../../repo/setting';
19
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
20
20
  import type { StockHolderRepo } from '../../../repo/stockHolder';
21
21
  import type { TaskRepo } from '../../../repo/task';
22
22
  import type { TicketRepo } from '../../../repo/ticket';
@@ -38,11 +38,12 @@ interface IStartOperationRepos {
38
38
  priceSpecification: PriceSpecificationRepo;
39
39
  seat: SeatRepo;
40
40
  setting: SettingRepo;
41
+ integrationSetting: IntegrationSettingRepo;
41
42
  task: TaskRepo;
42
43
  ticket: TicketRepo;
43
44
  assetTransaction: AssetTransactionRepo;
44
45
  }
45
- type IStartOperation<T> = (repos: IStartOperationRepos, settings: Settings) => Promise<T>;
46
+ type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
46
47
  type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
47
48
  type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
48
49
  /**
@@ -1,21 +1,19 @@
1
1
  import { factory } from '../../../factory';
2
2
  import type { InformActionRepo } from '../../../repo/action/inform';
3
3
  import type { PotentialActionRepo } from '../../../repo/potentialAction';
4
- import type { ISetting, SettingRepo } from '../../../repo/setting';
5
4
  import type { IIntegrationSettings, IntegrationSettingRepo } from '../../../repo/setting/integration';
6
5
  interface ITriggerWebhookRepos {
7
6
  actions: {
8
7
  inform: InformActionRepo;
9
8
  };
10
9
  potentialAction: PotentialActionRepo;
11
- setting: SettingRepo;
12
10
  integrationSetting: IntegrationSettingRepo;
13
11
  }
14
12
  declare function processInformAction(params: (factory.task.triggerWebhook.IData | factory.task.informHub.IData) & {
15
13
  project: {
16
14
  id: string;
17
15
  };
18
- }, settings: Pick<ISetting, 'triggerWebhook'>, options: {
16
+ }, settings: IIntegrationSettings['triggerWebhook'], options: {
19
17
  integrationSettings?: IIntegrationSettings['hub'];
20
18
  useIAP: boolean;
21
19
  }): (repos: {
@@ -100,8 +100,8 @@ function signRequest(params) {
100
100
  async function makeRequestHeaders(params, options) {
101
101
  const { action, settings, integrationSettings, requestBody } = params;
102
102
  const { useIAP } = options;
103
- const secretKey = settings?.triggerWebhook?.secretKey;
104
- const headerIdentifier = settings?.triggerWebhook?.headerIdentifier;
103
+ const secretKey = settings?.secretKey;
104
+ const headerIdentifier = settings?.headerIdentifier;
105
105
  const googleTargetAudience = integrationSettings?.googleTargetAudience;
106
106
  const timestamp = action.startDate.valueOf();
107
107
  // sign request(2024-10-28~)
@@ -134,7 +134,7 @@ async function makeRequestHeaders(params, options) {
134
134
  }
135
135
  function processInformAction(params, settings, options) {
136
136
  return async (repos) => {
137
- const timeout = settings?.triggerWebhook?.timeout;
137
+ const timeout = settings?.timeout;
138
138
  const { identifier } = params;
139
139
  const informActionAttributes = await createInformActionAttributes(params)(repos);
140
140
  const action = await repos.actions.inform.startInformAction(informActionAttributes);
@@ -6,12 +6,12 @@ const factory_1 = require("../../factory");
6
6
  const processInformAction_1 = require("./triggerWebhook/processInformAction");
7
7
  function findSettings() {
8
8
  return async (repos) => {
9
- const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['triggerWebhook']);
10
- if (setting === null) {
9
+ const setting = await repos.integrationSetting.getByKey('triggerWebhook');
10
+ if (setting === undefined) {
11
11
  throw new factory_1.factory.errors.NotFound('settings.triggerWebhook');
12
12
  }
13
- const retryCountMax = setting?.triggerWebhook?.retryCountMax;
14
- const retryIntervalInMS = setting?.triggerWebhook?.retryIntervalInMS;
13
+ const retryCountMax = setting?.retryCountMax;
14
+ const retryIntervalInMS = setting?.retryIntervalInMS;
15
15
  if (typeof retryCountMax !== 'number') {
16
16
  throw new factory_1.factory.errors.NotFound('setting.triggerWebhook.retryCountMax');
17
17
  }
@@ -1,5 +1,4 @@
1
1
  import { factory } from '../../../../factory';
2
- import type { IntegrationSettingRepo as Settings } from '../../../../repo/setting/integration';
3
2
  import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
4
3
  import type { AuthorizationRepo } from '../../../../repo/authorization';
5
4
  import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/event';
@@ -17,6 +16,7 @@ import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification
17
16
  import type { ProductRepo } from '../../../../repo/product';
18
17
  import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
19
18
  import type { SettingRepo } from '../../../../repo/setting';
19
+ import type { IntegrationSettingRepo } from '../../../../repo/setting/integration';
20
20
  import type { StockHolderRepo } from '../../../../repo/stockHolder';
21
21
  import type { TaskRepo } from '../../../../repo/task';
22
22
  import type { TicketRepo } from '../../../../repo/ticket';
@@ -64,10 +64,11 @@ declare function processStartReserve4chevre(params: {
64
64
  priceSpecification: PriceSpecificationRepo;
65
65
  seat: SeatRepo;
66
66
  setting: SettingRepo;
67
+ integrationSetting: IntegrationSettingRepo;
67
68
  task: TaskRepo;
68
69
  ticket: TicketRepo;
69
70
  assetTransaction: AssetTransactionRepo;
70
- }, settings: Settings) => Promise<{
71
+ }) => Promise<{
71
72
  acceptedOffers4result: IResultAcceptedOffer[];
72
73
  }>;
73
74
  export { processStartReserve4chevre };
@@ -39,11 +39,7 @@ const ReserveTransactionService = __importStar(require("../../../assetTransactio
39
39
  const factory_2 = require("./factory");
40
40
  const requestedProgramMembershipUsed2permit_1 = require("./processStartReserve4chevre/requestedProgramMembershipUsed2permit");
41
41
  function processStartReserve4chevre(params, options) {
42
- return async (repos, settings
43
- // credentials: {
44
- // jwt: JWTCredentials;
45
- // }
46
- ) => {
42
+ return async (repos) => {
47
43
  const { event, transaction, transactionNumber } = params;
48
44
  // 予約取引開始
49
45
  const startParams = (0, factory_2.createReserveTransactionStartParams)({
@@ -76,7 +72,7 @@ function processStartReserve4chevre(params, options) {
76
72
  ]
77
73
  // useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, // discontinue(2024-07-02~)
78
74
  // stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
79
- }, options)(repos, settings);
75
+ }, options)(repos);
80
76
  // 予約取引結果から注文オファーを生成する
81
77
  const acceptedOffers4result = (0, factory_2.responseBody2acceptedOffers4result)({
82
78
  issuedThrough: startReserveTransactionResult.issuedThrough,
@@ -1,5 +1,4 @@
1
1
  import { factory } from '../../../factory';
2
- import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
3
2
  import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
4
3
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
4
  import type { AuthorizationRepo } from '../../../repo/authorization';
@@ -19,6 +18,7 @@ import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
19
18
  import type { ProductRepo } from '../../../repo/product';
20
19
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
21
20
  import type { SettingRepo } from '../../../repo/setting';
21
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
22
22
  import type { StockHolderRepo } from '../../../repo/stockHolder';
23
23
  import type { TaskRepo } from '../../../repo/task';
24
24
  import type { TicketRepo } from '../../../repo/ticket';
@@ -45,12 +45,13 @@ interface IAuthorizeRepos {
45
45
  product: ProductRepo;
46
46
  seat: SeatRepo;
47
47
  setting: SettingRepo;
48
+ integrationSetting: IntegrationSettingRepo;
48
49
  task: TaskRepo;
49
50
  ticket: TicketRepo;
50
51
  placeOrder: PlaceOrderRepo;
51
52
  transactionNumber: TransactionNumberRepo;
52
53
  }
53
- type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings) => Promise<T>;
54
+ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
54
55
  type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction;
55
56
  type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail;
56
57
  interface IAuthorizeOptions {
@@ -11,7 +11,7 @@ const searchOffersByIds_1 = require("./searchOffersByIds");
11
11
  * 興行オファー承認
12
12
  */
13
13
  function authorize(params, options) {
14
- return async (repos, settings) => {
14
+ return async (repos) => {
15
15
  const { noOfferSpecified } = options;
16
16
  const { transaction, event } = await validateCreateRequest(params)(repos);
17
17
  const { acceptedOffers, ticketOffers, unitPriceOffers } = await validateAcceptedOffers({
@@ -47,7 +47,7 @@ function authorize(params, options) {
47
47
  orderNumber,
48
48
  instrument: params.instrument,
49
49
  ...(typeof params.object.broker?.typeOf === 'string') ? { broker: params.object.broker } : undefined
50
- }, options)(repos, settings);
50
+ }, options)(repos);
51
51
  acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
52
52
  if (!noOfferSpecified) {
53
53
  const minimizedAcceptedOffers = acceptedOffers4result.map((acceptOffer4result, offerIndex) => {
@@ -1,11 +1,10 @@
1
1
  import { factory } from '../../../../factory';
2
- import type { IntegrationSettingRepo as Settings } from '../../../../repo/setting/integration';
3
2
  import type { CancelActionRepo } from '../../../../repo/action/cancel';
4
3
  import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
5
4
  import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
6
5
  import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
7
6
  import type { ReservationRepo } from '../../../../repo/reservation';
8
- import type { SettingRepo } from '../../../../repo/setting';
7
+ import type { IntegrationSettingRepo } from '../../../../repo/setting/integration';
9
8
  import type { StockHolderRepo } from '../../../../repo/stockHolder';
10
9
  import type { TaskRepo } from '../../../../repo/task';
11
10
  interface IVoidTransactionRepos {
@@ -17,10 +16,10 @@ interface IVoidTransactionRepos {
17
16
  offerRateLimit: OfferRateLimitRepo;
18
17
  orderInTransaction: OrderInTransactionRepo;
19
18
  reservation: ReservationRepo;
20
- setting: SettingRepo;
19
+ integrationSetting: IntegrationSettingRepo;
21
20
  task: TaskRepo;
22
21
  }
23
22
  declare function processVoidTransaction4chevre(params: {
24
23
  action: factory.action.authorize.offer.eventService.IAction;
25
- }): (repos: IVoidTransactionRepos, settings: Settings) => Promise<void>;
24
+ }): (repos: IVoidTransactionRepos) => Promise<void>;
26
25
  export { processVoidTransaction4chevre };
@@ -4,7 +4,7 @@ exports.processVoidTransaction4chevre = processVoidTransaction4chevre;
4
4
  const factory_1 = require("../../../../factory");
5
5
  const reserve_1 = require("../../../assetTransaction/reserve");
6
6
  function processVoidTransaction4chevre(params) {
7
- return async (repos, settings) => {
7
+ return async (repos) => {
8
8
  const transactionNumber = params.action.instrument.transactionNumber;
9
9
  if (typeof transactionNumber === 'string') {
10
10
  // 取引が存在すれば中止
@@ -16,7 +16,7 @@ function processVoidTransaction4chevre(params) {
16
16
  transactionNumber: { $eq: transactionNumber }
17
17
  }, ['_id']);
18
18
  if (assetTransactions.length > 0) {
19
- await (0, reserve_1.cancel)({ transactionNumber })(repos, settings);
19
+ await (0, reserve_1.cancel)({ transactionNumber })(repos);
20
20
  }
21
21
  }
22
22
  };
@@ -1,6 +1,5 @@
1
1
  import type { 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 { CancelActionRepo } from '../../../repo/action/cancel';
5
4
  import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
6
5
  import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
@@ -8,7 +7,7 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
8
7
  import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
9
8
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
10
9
  import type { ReservationRepo } from '../../../repo/reservation';
11
- import type { SettingRepo } from '../../../repo/setting';
10
+ import type { IntegrationSettingRepo } from '../../../repo/setting/integration';
12
11
  import type { StockHolderRepo } from '../../../repo/stockHolder';
13
12
  import type { TaskRepo } from '../../../repo/task';
14
13
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
@@ -26,7 +25,7 @@ interface IVoidTransactionRepos {
26
25
  offerRateLimit: OfferRateLimitRepo;
27
26
  orderInTransaction: OrderInTransactionRepo;
28
27
  reservation: ReservationRepo;
29
- setting: SettingRepo;
28
+ integrationSetting: IntegrationSettingRepo;
30
29
  task: TaskRepo;
31
30
  placeOrder: PlaceOrderRepo;
32
31
  /**
@@ -48,5 +47,5 @@ declare function voidTransaction(params: factory.task.voidReserveTransaction.IDa
48
47
  */
49
48
  id: string;
50
49
  };
51
- }): (repos: IVoidTransactionRepos, settings: Settings) => Promise<void>;
50
+ }): (repos: IVoidTransactionRepos) => Promise<void>;
52
51
  export { IVoidTransactionRepos, voidTransaction };
@@ -11,10 +11,10 @@ const voidTransactionByActionId_1 = require("./voidTransactionByActionId");
11
11
  * 取引中の承認アクション全てについて処理する or 特定の承認アクションについて処理する
12
12
  */
13
13
  function voidTransaction(params) {
14
- return async (repos, settings) => {
14
+ return async (repos) => {
15
15
  // support void by action ID(2024-05-26~)
16
16
  if (typeof params.id === 'string') {
17
- await (0, voidTransactionByActionId_1.voidTransactionByActionId)(params)(repos, settings);
17
+ await (0, voidTransactionByActionId_1.voidTransactionByActionId)(params)(repos);
18
18
  return;
19
19
  }
20
20
  const cancelAction = {
@@ -98,7 +98,7 @@ function voidTransaction(params) {
98
98
  await (0, processVoidTransaction4chevre_1.processVoidTransaction4chevre)({
99
99
  // action: <factory.action.authorize.offer.eventService.IAction<WebAPIIdentifier.Chevre>>action
100
100
  action
101
- })(repos, settings);
101
+ })(repos);
102
102
  }
103
103
  }));
104
104
  // acceptActionについても取り消す(2024-05-27~)