@chevre/domain 20.10.0-alpha.0 → 20.10.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.
@@ -15,6 +15,7 @@ declare function validateAcceptedOffers(params: {
15
15
  id: string;
16
16
  };
17
17
  availablePaymentMethodTypes: factory.categoryCode.ICategoryCode[];
18
+ screeningEvent: Pick<factory.event.screeningEvent.IEvent, 'id' | 'superEvent'>;
18
19
  }): (repos: {
19
20
  offer: OfferRepo;
20
21
  }) => Promise<{
@@ -50,7 +50,7 @@ function createAppliesToMovieTicket(params) {
50
50
  }
51
51
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
52
52
  function createPriceComponent(params) {
53
- var _a, _b, _c, _d, _e, _f, _g;
53
+ var _a, _b, _c, _d, _e, _f, _g, _h;
54
54
  const acceptedOffer = params.acceptedOffer;
55
55
  const availableUnitPriceOffer = params.availableUnitPriceOffer;
56
56
  const { name, ticketInfo } = acceptedOffer;
@@ -130,15 +130,26 @@ function createPriceComponent(params) {
130
130
  // movieTicketTypeChargePriceSpecにaddPriceが含まれる場合は除く
131
131
  if (movieTicketTypeChargePriceSpec === undefined) {
132
132
  if (ticketInfo.addPrice > 0) {
133
+ const kbnJoueihousiki = (_h = params.screeningEvent.superEvent.coaInfo) === null || _h === void 0 ? void 0 : _h.kbnJoueihousiki;
133
134
  categoryCodeChargeSpecs.push({
134
135
  name: {
135
- en: factory.priceSpecificationType.CategoryCodeChargeSpecification,
136
- ja: '加算単価'
136
+ en: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunNameEng) === 'string')
137
+ ? kbnJoueihousiki.kubunNameEng
138
+ : factory.priceSpecificationType.CategoryCodeChargeSpecification,
139
+ ja: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunName) === 'string') ? kbnJoueihousiki.kubunName : '加算単価'
137
140
  },
138
141
  price: ticketInfo.addPrice,
139
142
  priceCurrency: factory.priceCurrency.JPY,
140
143
  typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
141
- appliesToCategoryCode: [],
144
+ appliesToCategoryCode: [{
145
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
146
+ typeOf: 'CategoryCode',
147
+ codeValue: String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
148
+ inCodeSet: {
149
+ typeOf: 'CategoryCodeSet',
150
+ identifier: factory.categoryCode.CategorySetIdentifier.VideoFormatType
151
+ }
152
+ }],
142
153
  valueAddedTaxIncluded: true
143
154
  });
144
155
  }
@@ -152,7 +163,15 @@ function createPriceComponent(params) {
152
163
  price: ticketInfo.spseatAdd1,
153
164
  priceCurrency: factory.priceCurrency.JPY,
154
165
  typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
155
- appliesToCategoryCode: [],
166
+ appliesToCategoryCode: [{
167
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
168
+ typeOf: 'CategoryCode',
169
+ codeValue: ticketInfo.spseatKbn,
170
+ inCodeSet: {
171
+ typeOf: 'CategoryCodeSet',
172
+ identifier: factory.categoryCode.CategorySetIdentifier.SeatingType
173
+ }
174
+ }],
156
175
  valueAddedTaxIncluded: true
157
176
  });
158
177
  }
@@ -245,9 +264,11 @@ function validateAcceptedOffers(params) {
245
264
  }
246
265
  // priceComponentを再生成(2023-03-14~)
247
266
  const { priceComponent, eligibleMonetaryAmount } = createPriceComponent({
267
+ project: { id: params.project.id },
248
268
  availablePaymentMethodTypes: params.availablePaymentMethodTypes,
249
269
  acceptedOffer,
250
- availableUnitPriceOffer
270
+ availableUnitPriceOffer,
271
+ screeningEvent: params.screeningEvent
251
272
  });
252
273
  priceSpecification.priceComponent = priceComponent;
253
274
  return Object.assign(Object.assign({ additionalProperty,
@@ -42,7 +42,8 @@ function authorize(params) {
42
42
  const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
43
43
  object: params.object,
44
44
  project: { id: transaction.project.id },
45
- availablePaymentMethodTypes
45
+ availablePaymentMethodTypes,
46
+ screeningEvent
46
47
  })(repos);
47
48
  const updTmpReserveSeatArgs = params.result.requestBody;
48
49
  const updTmpReserveSeatResult = params.result.responseBody;
@@ -148,20 +149,6 @@ function changeOffers(params) {
148
149
  throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
149
150
  }
150
151
  validate4changeOffer({ action: authorizeAction, object: params.object });
151
- // 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは指定されないので注意)(2023-03-17~)
152
- params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
153
- const originalOffer = authorizeAction.object.acceptedOffer.find((o) => {
154
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
155
- return ((_d = (_c = (_b = (_a = o.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
156
- === ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
157
- && ((_k = (_j = (_h = o.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
158
- === ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
159
- });
160
- if (originalOffer === undefined) {
161
- throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
162
- }
163
- return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalOffer.ticketInfo.spseatAdd1, spseatAdd2: originalOffer.ticketInfo.spseatAdd2, spseatKbn: originalOffer.ticketInfo.spseatKbn }) });
164
- });
165
152
  // イベント取得属性最適化(2023-01-23~)
166
153
  const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
167
154
  id: params.object.event.id
@@ -176,7 +163,8 @@ function changeOffers(params) {
176
163
  const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
177
164
  object: params.object,
178
165
  project: { id: transaction.project.id },
179
- availablePaymentMethodTypes
166
+ availablePaymentMethodTypes,
167
+ screeningEvent
180
168
  })(repos);
181
169
  // 供給情報と価格を変更してからDB更新
182
170
  authorizeAction.object.acceptedOffer = acceptedOffers;
package/package.json CHANGED
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.10.0-alpha.0"
123
+ "version": "20.10.0"
124
124
  }