@chevre/domain 25.2.0-alpha.1 → 25.2.0-alpha.2

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.
@@ -71,7 +71,10 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
71
71
  */
72
72
  deleteEndDatePassedCertainPeriod(params: {
73
73
  $lt: Date;
74
- }): Promise<void>;
74
+ }): Promise<{
75
+ deleteActionRecipesResult: import("mongodb").DeleteResult;
76
+ deleteActionsResult: import("mongodb").DeleteResult;
77
+ } | undefined>;
75
78
  /**
76
79
  * 取引からアクションを削除する
77
80
  */
@@ -454,7 +454,7 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
454
454
  async deleteEndDatePassedCertainPeriod(params) {
455
455
  const { $lt } = params;
456
456
  if ($lt instanceof Date) {
457
- await this.actionModel.deleteMany({
457
+ const deleteActionsResult = await this.actionModel.deleteMany({
458
458
  // 終了日時を一定期間過ぎたもの
459
459
  endDate: { $exists: true, $lt }
460
460
  })
@@ -463,10 +463,11 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
463
463
  const dateCreatedLt = (0, moment_1.default)($lt)
464
464
  .add(-1, 'day') // レシピ作成とアクション終了の時間差を考慮
465
465
  .toDate();
466
- await this.actionRecipeModel.deleteMany({
466
+ const deleteActionRecipesResult = await this.actionRecipeModel.deleteMany({
467
467
  dateCreated: { $lt: dateCreatedLt }
468
468
  })
469
469
  .exec();
470
+ return { deleteActionRecipesResult, deleteActionsResult };
470
471
  }
471
472
  }
472
473
  /**
@@ -203,7 +203,7 @@ export declare class AssetTransactionRepo {
203
203
  */
204
204
  deleteEndDatePassedCertainPeriod(params: {
205
205
  $lt: Date;
206
- }): Promise<void>;
206
+ }): Promise<import("mongodb").DeleteResult>;
207
207
  /**
208
208
  * 特定の取引を更新する(汎用)
209
209
  */
@@ -904,7 +904,7 @@ class AssetTransactionRepo {
904
904
  * 終了日時を一定期間過ぎたアクションを削除する
905
905
  */
906
906
  async deleteEndDatePassedCertainPeriod(params) {
907
- await this.transactionModel.deleteMany({
907
+ return this.transactionModel.deleteMany({
908
908
  // 終了日時を一定期間過ぎたもの
909
909
  endDate: {
910
910
  $exists: true,
@@ -28,7 +28,6 @@ declare function acceptedOffers2amount(params: {
28
28
  acceptedOffers: Pick<IResultAcceptedOffer, 'priceSpecification' | 'id'>[];
29
29
  }): number;
30
30
  declare function acceptedOffers2authorizeResult(params: {
31
- acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
32
31
  acceptedOffers4result: IResultAcceptedOffer[];
33
32
  noOfferSpecified: boolean;
34
33
  ticketOffers: factory.product.ITicketOffer[];
@@ -173,9 +173,8 @@ function acceptedOffers2programMembershipUsed(params) {
173
173
  return programMembershipUsed;
174
174
  }
175
175
  function acceptedOffers2authorizeResult(params) {
176
- const { acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
176
+ const { acceptedOffers4result, noOfferSpecified, ticketOffers } = params;
177
177
  const priceCurrency = factory_1.factory.priceCurrency.JPY; // fix(2024-07-03~)
178
- // redefine as typeOf: AggregateOffer(2024-06-18~)
179
178
  let offers;
180
179
  let price;
181
180
  let programMembershipUsed = [];
@@ -183,13 +182,15 @@ function acceptedOffers2authorizeResult(params) {
183
182
  price = acceptedOffers2amount({ acceptedOffers: acceptedOffers4result }); // オファー指定の場合のみ金額計算(2023-11-27~)
184
183
  programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
185
184
  // オファーIDごとに集計
186
- const offerIds = [...new Set(acceptedOffers.map((o) => o.id))];
185
+ const offerIds = [...new Set(acceptedOffers4result.map((o) => String(o.id)))];
186
+ // const offerIds = [...new Set(acceptedOffers.map((o) => o.id))];
187
187
  offers = offerIds.map((offerId) => {
188
188
  const acceptedOffer = ticketOffers.find(({ id }) => id === offerId);
189
189
  if (acceptedOffer === undefined) {
190
190
  throw new factory_1.factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
191
191
  }
192
- const amountOfThisGood = acceptedOffers.filter(({ id }) => id === offerId).length;
192
+ const amountOfThisGood = acceptedOffers4result.filter(({ id }) => id === offerId).length;
193
+ // const amountOfThisGood: number = acceptedOffers.filter(({ id }) => id === offerId).length;
193
194
  const { acceptedPaymentMethod, priceSpecification } = acceptedOffer;
194
195
  const unitPriceSpec = priceSpecification.priceComponent.find((spec) => spec.typeOf === factory_1.factory.priceSpecificationType.UnitPriceSpecification
195
196
  && (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
@@ -197,14 +198,14 @@ function acceptedOffers2authorizeResult(params) {
197
198
  if (unitPriceSpec === undefined) {
198
199
  throw new factory_1.factory.errors.Internal(`unitPriceSpec not found [id:${offerId}]`);
199
200
  }
200
- const { eligibleQuantity, eligibleTransactionVolume } = unitPriceSpec;
201
+ const { eligibleQuantity } = unitPriceSpec;
201
202
  return {
202
203
  id: offerId,
203
204
  includesObject: { amountOfThisGood },
204
205
  typeOf: factory_1.factory.offerType.Offer,
205
206
  priceSpecification: {
206
207
  ...(eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined,
207
- ...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined
208
+ // ...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined // discontinue(2026-07-05~)
208
209
  },
209
210
  ...(acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined
210
211
  };
@@ -217,9 +218,6 @@ function acceptedOffers2authorizeResult(params) {
217
218
  itemOffered: {
218
219
  serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
219
220
  },
220
- // requestBody: {}, // discontinue(2024-06-11~)
221
- // responseBody: {}, // discontinue(2024-06-11~)
222
- // acceptedOffers: [] // discontinue(2024-06-17~)
223
221
  ...(typeof price === 'number') ? { price } : undefined,
224
222
  ...(Array.isArray(offers)) ? { offers } : undefined
225
223
  };
@@ -78,7 +78,7 @@ function authorize(params, options) {
78
78
  }
79
79
  throw error;
80
80
  }
81
- const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
81
+ const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers4result, noOfferSpecified, ticketOffers });
82
82
  await repos.authorizeOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
83
83
  return { id: action.id, result };
84
84
  };
@@ -329,14 +329,23 @@ function validateEventOffers(params) {
329
329
  acceptedOffersInResult.forEach((acceptedOfferInResult) => {
330
330
  const offerId = acceptedOfferInResult.id;
331
331
  const unitPriceSpec = acceptedOfferInResult.priceSpecification;
332
- // 適用金額要件を満たしていなければエラー
333
- const eligibleTransactionVolumePrice = unitPriceSpec?.eligibleTransactionVolume?.price;
334
- const eligibleTransactionVolumePriceCurrency = unitPriceSpec?.eligibleTransactionVolume?.priceCurrency;
335
- if (typeof eligibleTransactionVolumePrice === 'number') {
336
- if (params.order.price < eligibleTransactionVolumePrice) {
337
- throw new factory_1.factory.errors.Argument('Transaction', (0, util_1.format)('Transaction volume must be more than or equal to %s %s for offer:%s', eligibleTransactionVolumePrice, eligibleTransactionVolumePriceCurrency, offerId));
338
- }
339
- }
332
+ // 適用金額要件は廃止(2026-07-05~)
333
+ // // 適用金額要件を満たしていなければエラー
334
+ // const eligibleTransactionVolumePrice = unitPriceSpec?.eligibleTransactionVolume?.price;
335
+ // const eligibleTransactionVolumePriceCurrency = unitPriceSpec?.eligibleTransactionVolume?.priceCurrency;
336
+ // if (typeof eligibleTransactionVolumePrice === 'number') {
337
+ // if (params.order.price < eligibleTransactionVolumePrice) {
338
+ // throw new factory.errors.Argument(
339
+ // 'Transaction',
340
+ // format(
341
+ // 'Transaction volume must be more than or equal to %s %s for offer:%s',
342
+ // eligibleTransactionVolumePrice,
343
+ // eligibleTransactionVolumePriceCurrency,
344
+ // offerId
345
+ // )
346
+ // );
347
+ // }
348
+ // }
340
349
  // 適用数量検証(全興行オファー承認アクションについて)(2023-11-15~)
341
350
  // 適用数量要件を満たしていなければエラー
342
351
  const numAcceptedOffersByOfferId = params.authorizeEventServiceOfferActions.reduce((previousNumOffer, { result }) => {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.5.0-alpha.1",
14
+ "@chevre/factory": "9.5.0-alpha.2",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.2.0-alpha.1"
94
+ "version": "25.2.0-alpha.2"
95
95
  }