@chevre/domain 20.11.0-alpha.0 → 20.11.0-alpha.1

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,9 +15,10 @@ declare function validateAcceptedOffers(params: {
15
15
  project: {
16
16
  id: string;
17
17
  };
18
- availablePaymentMethodTypes: factory.categoryCode.ICategoryCode[];
19
18
  screeningEvent: Pick<factory.event.screeningEvent.IEvent, 'id' | 'superEvent'>;
19
+ availablePaymentMethodTypes: factory.categoryCode.ICategoryCode[];
20
20
  seatingTypes: factory.categoryCode.ICategoryCode[];
21
+ videoFormatTypes: factory.categoryCode.ICategoryCode[];
21
22
  }): (repos: {
22
23
  offer: OfferRepo;
23
24
  }) => Promise<{
@@ -37,7 +37,7 @@ function createAppliesToMovieTicket(params) {
37
37
  serviceType: params.ticketInfo.mvtkKbnKensyu,
38
38
  serviceOutput: { typeOf: availablePaymentMethod }
39
39
  },
40
- appliesToVideoFormat: params.ticketInfo.kbnEisyahousiki
40
+ appliesToVideoFormat: params.appliesToVideoFormat
41
41
  };
42
42
  appliesToMovieTicket = {
43
43
  typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
@@ -50,35 +50,35 @@ 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, _h;
53
+ var _a, _b, _c, _d, _e, _f;
54
54
  const acceptedOffer = params.acceptedOffer;
55
55
  const availableUnitPriceOffer = params.availableUnitPriceOffer;
56
+ const kbnJoueihousiki = (_a = params.screeningEvent.superEvent.coaInfo) === null || _a === void 0 ? void 0 : _a.kbnJoueihousiki;
57
+ const appliesToVideoFormat = (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode) === 'string')
58
+ ? kbnJoueihousiki.kubunCode
59
+ : 'Default';
56
60
  const { name, ticketInfo } = acceptedOffer;
57
61
  // appliesToMovieTicket.serviceOutput.typeOfを自動補完(2023-03-13~)
58
62
  const { appliesToMovieTicket, movieTicketTypeChargePriceSpec } = createAppliesToMovieTicket({
59
63
  ticketInfo,
60
- availablePaymentMethodTypes: params.availablePaymentMethodTypes
64
+ availablePaymentMethodTypes: params.availablePaymentMethodTypes,
65
+ appliesToVideoFormat
61
66
  });
62
67
  let surfrockChargePriceSpec;
63
68
  let appliesToMovieTicket4surfrock;
64
69
  // appliesToSurfrockの指定があれば強制的にMovieTicket決済
65
70
  let eligibleMonetaryAmount;
66
- const surfrockIdentifier = (_b = (_a = acceptedOffer.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToSurfrock) === null || _b === void 0 ? void 0 : _b.identifier;
67
- const surfrockPaymentMethodType = (_e = (_d = (_c = acceptedOffer.priceSpecification) === null || _c === void 0 ? void 0 : _c.appliesToSurfrock) === null || _d === void 0 ? void 0 : _d.serviceOutput) === null || _e === void 0 ? void 0 : _e.typeOf;
71
+ const surfrockIdentifier = (_c = (_b = acceptedOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.appliesToSurfrock) === null || _c === void 0 ? void 0 : _c.identifier;
72
+ const surfrockPaymentMethodType = (_f = (_e = (_d = acceptedOffer.priceSpecification) === null || _d === void 0 ? void 0 : _d.appliesToSurfrock) === null || _e === void 0 ? void 0 : _e.serviceOutput) === null || _f === void 0 ? void 0 : _f.typeOf;
68
73
  if (typeof surfrockIdentifier === 'string' && surfrockIdentifier.length > 0
69
74
  && typeof surfrockPaymentMethodType === 'string' && surfrockPaymentMethodType.length > 0) {
70
- // serviceTypeはticketCode
71
- const serviceType = (_g = (_f = availableUnitPriceOffer.additionalProperty) === null || _f === void 0 ? void 0 : _f.find((p) => p.name === 'ticketCode')) === null || _g === void 0 ? void 0 : _g.value;
72
- if (typeof serviceType !== 'string') {
73
- throw new factory.errors.NotFound('ticketCode of unitPriceOffer');
74
- }
75
75
  surfrockChargePriceSpec = {
76
76
  appliesToMovieTicket: {
77
77
  typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
78
78
  serviceOutput: { typeOf: surfrockPaymentMethodType },
79
- serviceType
79
+ serviceType: ticketInfo.ticketCode // serviceTypeはticketCode
80
80
  },
81
- appliesToVideoFormat: 'Default',
81
+ appliesToVideoFormat,
82
82
  name,
83
83
  price: 0,
84
84
  priceCurrency: factory.priceCurrency.JPY,
@@ -89,7 +89,7 @@ function createPriceComponent(params) {
89
89
  typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
90
90
  identifier: surfrockIdentifier,
91
91
  serviceOutput: { typeOf: surfrockPaymentMethodType },
92
- serviceType
92
+ serviceType: ticketInfo.ticketCode // serviceTypeはticketCode
93
93
  };
94
94
  }
95
95
  else {
@@ -130,7 +130,6 @@ 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;
134
133
  categoryCodeChargeSpecs.push({
135
134
  name: {
136
135
  en: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunNameEng) === 'string')
@@ -274,6 +273,7 @@ function validateAcceptedOffers(params) {
274
273
  project: { id: params.project.id },
275
274
  availablePaymentMethodTypes: params.availablePaymentMethodTypes,
276
275
  seatingTypes: params.seatingTypes,
276
+ videoFormatTypes: params.videoFormatTypes,
277
277
  acceptedOffer,
278
278
  availableUnitPriceOffer,
279
279
  screeningEvent: params.screeningEvent
@@ -40,15 +40,18 @@ function authorize(params) {
40
40
  project: { id: { $eq: transaction.project.id } },
41
41
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
42
42
  });
43
+ const videoFormatTypes = yield repos.categoryCode.search({
44
+ project: { id: { $eq: transaction.project.id } },
45
+ inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
46
+ });
43
47
  // COA仮予約後にリクエストが来る前提
44
- // validate acceptedOffer(2023-03-09~)
45
- // const acceptedOffer = params.object.acceptedOffer;
46
48
  const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
47
49
  object: params.object,
48
50
  project: { id: transaction.project.id },
49
- availablePaymentMethodTypes,
50
51
  screeningEvent,
51
- seatingTypes
52
+ availablePaymentMethodTypes,
53
+ seatingTypes,
54
+ videoFormatTypes
52
55
  })(repos);
53
56
  const updTmpReserveSeatArgs = params.result.requestBody;
54
57
  const updTmpReserveSeatResult = params.result.responseBody;
@@ -180,15 +183,18 @@ function changeOffers(params) {
180
183
  project: { id: { $eq: transaction.project.id } },
181
184
  inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
182
185
  });
186
+ const videoFormatTypes = yield repos.categoryCode.search({
187
+ project: { id: { $eq: transaction.project.id } },
188
+ inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
189
+ });
183
190
  // COA仮予約後にリクエストが来る前提
184
- // validate acceptedOffer(2023-03-09~)
185
- // const acceptedOffer = params.object.acceptedOffer;
186
191
  const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
187
192
  object: params.object,
188
193
  project: { id: transaction.project.id },
189
- availablePaymentMethodTypes,
190
194
  screeningEvent,
191
- seatingTypes
195
+ availablePaymentMethodTypes,
196
+ seatingTypes,
197
+ videoFormatTypes
192
198
  })(repos);
193
199
  // 供給情報と価格を変更してからDB更新
194
200
  authorizeAction.object.acceptedOffer = acceptedOffers;
@@ -11,9 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  var _a;
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.createConfirmRegisterServiceActionObjectByOrder = exports.createConfirmReservationActionObject4COAByOrder = exports.createConfirmReservationActionObject4ChevreByOrder = exports.createDeleteTasks = exports.createInformTasks = exports.getOrderWithToken = void 0;
14
- /**
15
- * 注文ステータス変更時処理
16
- */
17
14
  const google_libphonenumber_1 = require("google-libphonenumber");
18
15
  const jwt = require("jsonwebtoken");
19
16
  const moment = require("moment");
@@ -246,10 +243,18 @@ function createConfirmReservationActionObject4COAByOrder(params) {
246
243
  throw new factory.errors.NotFound('reservedTicket.coaReserveAmount');
247
244
  }
248
245
  const listTicket = coaReservations.map((r) => {
249
- if (r.reservedTicket.coaTicketInfo === undefined) {
246
+ var _a;
247
+ if (typeof ((_a = r.reservedTicket.coaTicketInfo) === null || _a === void 0 ? void 0 : _a.ticketCode) !== 'string') {
250
248
  throw new factory.errors.NotFound('reservedTicket.coaTicketInfo');
251
249
  }
252
- return r.reservedTicket.coaTicketInfo;
250
+ // 冗長な属性を排除(2023-03-20~)
251
+ const { ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2, disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn, seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken, mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk } = r.reservedTicket.coaTicketInfo;
252
+ return {
253
+ ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
254
+ disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
255
+ seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
256
+ mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
257
+ };
253
258
  });
254
259
  return {
255
260
  theaterCode: reservationForCOAInfo.theaterCode,
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.11.0-alpha.0"
123
+ "version": "20.11.0-alpha.1"
124
124
  }