@chevre/domain 24.1.0-alpha.23 → 24.1.0-alpha.25

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.
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.OrderInTransactionRepo = void 0;
7
- const debug_1 = __importDefault(require("debug"));
8
- const util_1 = require("util");
4
+ // import { isDeepStrictEqual } from 'util';
9
5
  const factory_1 = require("../factory");
10
6
  const order_1 = require("./mongoose/schemas/order");
11
7
  const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
12
- const debug = (0, debug_1.default)('chevre-domain:repo:orderInTransaction');
8
+ // const debug = createDebug('chevre-domain:repo:orderInTransaction');
13
9
  /**
14
10
  * 取引中注文リポジトリ
15
11
  */
@@ -75,15 +71,21 @@ class OrderInTransactionRepo {
75
71
  }
76
72
  return doc.acceptedOffers.map((acceptedOffer) => {
77
73
  const priceBySubReservation = subReservations.find((subReservation) => subReservation.id === acceptedOffer.itemOffered.id)?.price;
78
- const priceSpecMatched = (0, util_1.isDeepStrictEqual)(acceptedOffer.priceSpecification, priceBySubReservation);
79
- debug('findAcceptedOffersWithPriceByOrderNumber: priceSpecMatched?', priceSpecMatched, acceptedOffer.itemOffered.id, params.orderNumber, params.project.id);
80
- if (!priceSpecMatched) {
81
- console.error('findAcceptedOffersWithPriceByOrderNumber: priceSpecMatched: false!!!', acceptedOffer.itemOffered.id, params.orderNumber, params.project.id);
74
+ // 予約の価格は必ず存在するはず
75
+ if (priceBySubReservation === undefined) {
76
+ console.error('findAcceptedOffersWithPriceByOrderNumber: priceBySubReservation: undefined!!!', acceptedOffer.itemOffered.id);
82
77
  }
78
+ // const priceSpecMatched = isDeepStrictEqual(acceptedOffer.priceSpecification, priceBySubReservation);
79
+ // debug('findAcceptedOffersWithPriceByOrderNumber: priceSpecMatched?', priceSpecMatched, acceptedOffer.itemOffered.id, params.orderNumber, params.project.id);
80
+ // if (!priceSpecMatched) {
81
+ // console.error('findAcceptedOffersWithPriceByOrderNumber: priceSpecMatched: false!!!', acceptedOffer.itemOffered.id, params.orderNumber, params.project.id);
82
+ // }
83
+ // const overwritePriceSpec = priceSpecMatched || acceptedOffer.priceSpecification === undefined;
83
84
  return {
84
85
  ...acceptedOffer,
85
- // 予約取引内の価格仕様と一致した場合のみ上書きしてみる
86
- ...((priceSpecMatched && priceBySubReservation !== undefined) && { priceSpecification: priceBySubReservation })
86
+ // // 予約取引内の価格仕様と一致した場合のみ上書きしてみる
87
+ // ...((overwritePriceSpec && priceBySubReservation !== undefined) && { priceSpecification: priceBySubReservation })
88
+ ...((priceBySubReservation !== undefined) && { priceSpecification: priceBySubReservation })
87
89
  };
88
90
  });
89
91
  }
@@ -10,11 +10,6 @@ exports.createReserveTransactionStartParams = createReserveTransactionStartParam
10
10
  exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
11
11
  const moment_1 = __importDefault(require("moment"));
12
12
  const factory_1 = require("../../../../factory");
13
- /**
14
- * 実験的に導入
15
- * 2026-005-18~
16
- */
17
- const USE_ACCEPTED_OFFER_NO_PRICE_SPEC = process.env.USE_ACCEPTED_OFFER_NO_PRICE_SPEC === '1';
18
13
  function createReserveTransactionStartParams(params) {
19
14
  const { transaction, transactionNumber } = params;
20
15
  const { seller } = transaction;
@@ -290,16 +285,12 @@ function responseBody2acceptedOffers4result(params) {
290
285
  name: itemOffered.reservedTicket.ticketType.name,
291
286
  itemOffered: reservation,
292
287
  offeredThrough: { typeOf: 'WebAPI', identifier: factory_1.factory.service.webAPI.Identifier.Chevre },
293
- ...(USE_ACCEPTED_OFFER_NO_PRICE_SPEC)
294
- ? {}
295
- : {
296
- priceSpecification: {
297
- priceComponent: priceComponent,
298
- priceCurrency: priceSpecification.priceCurrency,
299
- typeOf: priceSpecification.typeOf,
300
- valueAddedTaxIncluded: priceSpecification.valueAddedTaxIncluded
301
- }
302
- },
288
+ priceSpecification: {
289
+ priceComponent: priceComponent,
290
+ priceCurrency: priceSpecification.priceCurrency,
291
+ typeOf: priceSpecification.typeOf,
292
+ valueAddedTaxIncluded: priceSpecification.valueAddedTaxIncluded
293
+ },
303
294
  serialNumber: params.transactionNumber
304
295
  };
305
296
  return resultAcceptedOffer;
@@ -67,6 +67,12 @@ interface IAuthorizeOptions {
67
67
  * 最大n日前から予約可能
68
68
  */
69
69
  maxReservationGracePeriodInDays: number;
70
+ /**
71
+ * 価格仕様なしのacceptedOfferを採用するかどうか
72
+ * 実験的に導入
73
+ * 2026-005-19~
74
+ */
75
+ useAcceptedOfferNoPriceSpec?: boolean;
70
76
  }
71
77
  /**
72
78
  * 興行オファー承認
@@ -58,13 +58,21 @@ function authorize(params, options) {
58
58
  acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
59
59
  // add orderInTransaction(2024-01-15~)
60
60
  if (!noOfferSpecified) {
61
- // if (params.options.useCreateOrderOnOfferAccepted) {
61
+ const useAcceptedOfferNoPriceSpec = options.useAcceptedOfferNoPriceSpec === true;
62
62
  await (0, any_1.acceptOffer)({
63
63
  orderNumber,
64
64
  project: transaction.project,
65
- acceptedOffers: acceptedOffers4result
65
+ acceptedOffers: acceptedOffers4result.map((acceptOffer4result) => {
66
+ // support useAcceptedOfferNoPriceSpec(2026-05-19~)
67
+ if (useAcceptedOfferNoPriceSpec) {
68
+ const { priceSpecification: _priceSpecification, ...acceptOfferNoPriceSpec } = acceptOffer4result;
69
+ return acceptOfferNoPriceSpec;
70
+ }
71
+ else {
72
+ return acceptOffer4result;
73
+ }
74
+ })
66
75
  })(repos);
67
- // }
68
76
  }
69
77
  }
70
78
  catch (error) {
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.23"
94
+ "version": "24.1.0-alpha.25"
95
95
  }