@chevre/domain 22.2.0 → 22.3.0-alpha.0

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.
@@ -186,6 +186,9 @@ function availableSalesTicket2offerWithDetails(params) {
186
186
  }
187
187
  }
188
188
  const priceSpecification = Object.assign({}, (typeof (appliesToSurfrock === null || appliesToSurfrock === void 0 ? void 0 : appliesToSurfrock.identifier) === 'string') ? { appliesToSurfrock } : undefined);
189
+ const disPrice = (typeof availableSalesTicket.disPrice === 'number' && availableSalesTicket.disPrice > 0)
190
+ ? availableSalesTicket.disPrice
191
+ : 0; // support case of coupon(2024-08-31~)
189
192
  const ticketInfo = {
190
193
  ticketCode: availableSalesTicket.ticketCode,
191
194
  ticketName: availableSalesTicket.ticketName,
@@ -193,7 +196,7 @@ function availableSalesTicket2offerWithDetails(params) {
193
196
  ticketNameKana: availableSalesTicket.ticketNameKana,
194
197
  stdPrice: availableSalesTicket.stdPrice,
195
198
  addPrice: availableSalesTicket.addPrice,
196
- disPrice: 0,
199
+ disPrice,
197
200
  // salePrice: salePrice,
198
201
  salesTicketSalePrice: Number(availableSalesTicket.salePrice),
199
202
  spseatAdd1: offer.ticketInfo.spseatAdd1,
@@ -98,12 +98,44 @@ function createPriceComponent(params) {
98
98
  eligibleMonetaryAmount = availableUnitPriceOffer.eligibleMonetaryAmount;
99
99
  }
100
100
  }
101
- const accountsReceivable = (ticketInfo.mvtkAppPrice > 0) ? ticketInfo.mvtkAppPrice : ticketInfo.stdPrice;
102
- const unitPriceSpec = Object.assign({ typeOf: factory.priceSpecificationType.UnitPriceSpecification, name: { ja: ticketInfo.ticketName, en: ticketInfo.ticketNameEng }, price: Number(ticketInfo.stdPrice), priceCurrency: factory.priceCurrency.JPY, referenceQuantity: {
103
- typeOf: 'QuantitativeValue',
104
- unitCode: factory.unitCode.C62,
105
- value: 1
106
- }, valueAddedTaxIncluded: true, accounting: {
101
+ const { disPrice, limitCount, stdPrice } = ticketInfo;
102
+ if (typeof stdPrice !== 'number') {
103
+ throw new factory.errors.Argument('ticketInfo.stdPrice', 'must be number');
104
+ }
105
+ const accountsReceivable = (ticketInfo.mvtkAppPrice > 0) ? ticketInfo.mvtkAppPrice : stdPrice;
106
+ // const maxPrice: number = stdPrice;
107
+ let price = stdPrice;
108
+ // support disPrice(2024-09-02~)
109
+ if (typeof disPrice === 'number' && disPrice > 0) {
110
+ price -= disPrice;
111
+ }
112
+ let referenceQuantity = {
113
+ typeOf: 'QuantitativeValue',
114
+ unitCode: factory.unitCode.C62,
115
+ value: 1
116
+ };
117
+ switch (ticketInfo.limitUnit) {
118
+ case '001':
119
+ referenceQuantity = {
120
+ typeOf: 'QuantitativeValue',
121
+ unitCode: factory.unitCode.C62,
122
+ value: Number(limitCount)
123
+ };
124
+ price = Number(limitCount) * price;
125
+ break;
126
+ case '002':
127
+ referenceQuantity = {
128
+ typeOf: 'QuantitativeValue',
129
+ unitCode: factory.unitCode.C62,
130
+ value: 1,
131
+ minValue: Number(limitCount)
132
+ };
133
+ break;
134
+ default:
135
+ // no op
136
+ // referenceQuantity.value = 1;
137
+ }
138
+ const unitPriceSpec = Object.assign({ typeOf: factory.priceSpecificationType.UnitPriceSpecification, name: { ja: ticketInfo.ticketName, en: ticketInfo.ticketNameEng }, price, priceCurrency: factory.priceCurrency.JPY, referenceQuantity, valueAddedTaxIncluded: true, accounting: {
107
139
  typeOf: 'Accounting',
108
140
  accountsReceivable
109
141
  } }, (appliesToMovieTicket !== undefined || appliesToMovieTicket4surfrock !== undefined)
@@ -114,17 +146,6 @@ function createPriceComponent(params) {
114
146
  ]
115
147
  }
116
148
  : undefined);
117
- switch (ticketInfo.limitUnit) {
118
- case '001':
119
- unitPriceSpec.referenceQuantity.value = Number(ticketInfo.limitCount);
120
- unitPriceSpec.price = Number(ticketInfo.limitCount) * Number(ticketInfo.stdPrice);
121
- break;
122
- case '002':
123
- unitPriceSpec.referenceQuantity.minValue = Number(ticketInfo.limitCount);
124
- break;
125
- default:
126
- unitPriceSpec.referenceQuantity.value = 1;
127
- }
128
149
  // 区分加算料金
129
150
  const categoryCodeChargeSpecs = [];
130
151
  // movieTicketTypeChargePriceSpecにaddPriceが含まれる場合は除く
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.2.0"
113
+ "version": "22.3.0-alpha.0"
114
114
  }