@chevre/domain 20.11.1 → 20.12.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.
@@ -72,6 +72,10 @@ function importCategoryCodesFromCOA(params) {
72
72
  theaterCode: params.theaterCode,
73
73
  kubunClass: '045'
74
74
  });
75
+ // const acousticKubuns = await repos.masterService.kubunName({
76
+ // theaterCode: params.theaterCode,
77
+ // kubunClass: '046'
78
+ // });
75
79
  const seatKubuns = yield repos.masterService.kubunName({
76
80
  theaterCode: params.theaterCode,
77
81
  kubunClass: '050'
@@ -87,6 +91,16 @@ function importCategoryCodesFromCOA(params) {
87
91
  upsert: true
88
92
  });
89
93
  });
94
+ // acousticKubuns.forEach((kubun) => {
95
+ // saveParams.push({
96
+ // attributes: kubun2categoryCode({
97
+ // kubun,
98
+ // project: params.project,
99
+ // inCodeSet: { identifier: factory.categoryCode.CategorySetIdentifier.SoundFormatType }
100
+ // }),
101
+ // upsert: true
102
+ // });
103
+ // });
90
104
  seatKubuns.forEach((kubun) => {
91
105
  saveParams.push({
92
106
  attributes: kubun2categoryCode({
@@ -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;
53
+ var _a, _b, _c, _d, _e, _f, _g;
54
54
  const acceptedOffer = params.acceptedOffer;
55
55
  const availableUnitPriceOffer = params.availableUnitPriceOffer;
56
56
  const kbnJoueihousiki = (_a = params.screeningEvent.superEvent.coaInfo) === null || _a === void 0 ? void 0 : _a.kbnJoueihousiki;
@@ -130,29 +130,58 @@ function createPriceComponent(params) {
130
130
  // movieTicketTypeChargePriceSpecにaddPriceが含まれる場合は除く
131
131
  if (movieTicketTypeChargePriceSpec === undefined) {
132
132
  if (ticketInfo.addPrice > 0) {
133
- categoryCodeChargeSpecs.push({
134
- name: {
135
- en: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunNameEng) === 'string')
136
- ? kbnJoueihousiki.kubunNameEng
137
- : String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
138
- ja: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunName) === 'string')
139
- ? `${kbnJoueihousiki.kubunName}加算料金`
140
- : '加算単価'
141
- },
142
- price: ticketInfo.addPrice,
143
- priceCurrency: factory.priceCurrency.JPY,
144
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
145
- appliesToCategoryCode: [{
146
- // project: { id: params.project.id, typeOf: factory.organizationType.Project },
147
- typeOf: 'CategoryCode',
148
- codeValue: String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
149
- inCodeSet: {
150
- typeOf: 'CategoryCodeSet',
151
- identifier: factory.categoryCode.CategorySetIdentifier.VideoFormatType
152
- }
153
- }],
154
- valueAddedTaxIncluded: true
155
- });
133
+ const videoFormatTypeCharge = (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunAddPrice) === 'number') ? kbnJoueihousiki.kubunAddPrice : 0;
134
+ const kbnAcoustic = (_g = params.screeningEvent.coaInfo) === null || _g === void 0 ? void 0 : _g.kbnAcoustic;
135
+ const soundFormatTypeCharge = (typeof (kbnAcoustic === null || kbnAcoustic === void 0 ? void 0 : kbnAcoustic.kubunAddPrice) === 'number') ? kbnAcoustic.kubunAddPrice : 0;
136
+ // 上映方式区分加算料金と音響区分加算料金を考慮する
137
+ if (videoFormatTypeCharge > 0) {
138
+ categoryCodeChargeSpecs.push({
139
+ name: {
140
+ en: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunNameEng) === 'string')
141
+ ? kbnJoueihousiki.kubunNameEng
142
+ : String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
143
+ ja: (typeof (kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunName) === 'string')
144
+ ? `${kbnJoueihousiki.kubunName}加算料金`
145
+ : '加算単価'
146
+ },
147
+ price: videoFormatTypeCharge,
148
+ priceCurrency: factory.priceCurrency.JPY,
149
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
150
+ appliesToCategoryCode: [{
151
+ typeOf: 'CategoryCode',
152
+ codeValue: String(kbnJoueihousiki === null || kbnJoueihousiki === void 0 ? void 0 : kbnJoueihousiki.kubunCode),
153
+ inCodeSet: {
154
+ typeOf: 'CategoryCodeSet',
155
+ identifier: factory.categoryCode.CategorySetIdentifier.VideoFormatType
156
+ }
157
+ }],
158
+ valueAddedTaxIncluded: true
159
+ });
160
+ }
161
+ if (soundFormatTypeCharge > 0) {
162
+ categoryCodeChargeSpecs.push({
163
+ name: {
164
+ en: (typeof (kbnAcoustic === null || kbnAcoustic === void 0 ? void 0 : kbnAcoustic.kubunNameEng) === 'string')
165
+ ? kbnAcoustic.kubunNameEng
166
+ : String(kbnAcoustic === null || kbnAcoustic === void 0 ? void 0 : kbnAcoustic.kubunCode),
167
+ ja: (typeof (kbnAcoustic === null || kbnAcoustic === void 0 ? void 0 : kbnAcoustic.kubunName) === 'string')
168
+ ? `${kbnAcoustic.kubunName}加算料金`
169
+ : '加算単価'
170
+ },
171
+ price: soundFormatTypeCharge,
172
+ priceCurrency: factory.priceCurrency.JPY,
173
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
174
+ appliesToCategoryCode: [{
175
+ typeOf: 'CategoryCode',
176
+ codeValue: String(kbnAcoustic === null || kbnAcoustic === void 0 ? void 0 : kbnAcoustic.kubunCode),
177
+ inCodeSet: {
178
+ typeOf: 'CategoryCodeSet',
179
+ identifier: factory.categoryCode.CategorySetIdentifier.SoundFormatType
180
+ }
181
+ }],
182
+ valueAddedTaxIncluded: true
183
+ });
184
+ }
156
185
  }
157
186
  }
158
187
  if (ticketInfo.spseatAdd1 > 0) {
@@ -15,6 +15,7 @@ exports.validateMovieTicket = void 0;
15
15
  */
16
16
  const factory = require("../../../factory");
17
17
  const checkByIdentifier_1 = require("./checkByIdentifier");
18
+ // tslint:disable-next-line:max-func-body-length
18
19
  function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBeforePay) {
19
20
  return (repos) => __awaiter(this, void 0, void 0, function* () {
20
21
  var _a, _b, _c, _d;
@@ -61,21 +62,39 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
61
62
  screeningEvent: screeningEvent,
62
63
  paymentServiceId
63
64
  })(repos);
65
+ // checkResult.movieTicketsへの依存排除(2023-03-24~)
64
66
  // 要求に対して十分かどうか検証する
65
- const availableMovieTickets = checkResult.movieTickets.filter((t) => { var _a; return ((_a = t.amount) === null || _a === void 0 ? void 0 : _a.validThrough) === undefined; });
66
- // 総数が足りているか
67
- if (availableMovieTickets.length < movieTickets.length) {
68
- throw new factory.errors.Argument('movieTickets', `${movieTickets.length - availableMovieTickets.length} movie tickets short`);
69
- }
67
+ // const availableMovieTickets = checkResult.movieTickets.filter((t) => t.amount?.validThrough === undefined);
68
+ // 総数が足りているか(券種ごとに枚数検証を実行するので不要)
69
+ // if (availableMovieTickets.length < movieTickets.length) {
70
+ // throw new factory.errors.Argument(
71
+ // 'movieTickets',
72
+ // `${movieTickets.length - availableMovieTickets.length} movie tickets short`
73
+ // );
74
+ // }
70
75
  // 券種ごとに枚数が足りているか
71
76
  const serviceTypes = [...new Set(movieTickets.map((t) => t.serviceType))];
72
77
  serviceTypes.forEach((serviceType) => {
73
- const availableMovieTicketsByServiceType = availableMovieTickets.filter((t) => t.serviceType === serviceType);
74
- const requiredMovieTicketsByServiceType = movieTickets.filter((t) => t.serviceType === serviceType);
75
- if (availableMovieTicketsByServiceType.length < requiredMovieTicketsByServiceType.length) {
76
- const shortNumber = requiredMovieTicketsByServiceType.length - availableMovieTicketsByServiceType.length;
78
+ var _a, _b, _c;
79
+ const requiredMovieTicketsCountByServiceType = movieTickets.filter((t) => t.serviceType === serviceType).length;
80
+ let availableMovieTicketsCountByServiceType = 0;
81
+ const ykknInfos = (_b = (_a = checkResult.purchaseNumberAuthResult.knyknrNoInfoOut) === null || _a === void 0 ? void 0 : _a.find((knyknrNoInfoOut) => knyknrNoInfoOut.knyknrNo === movieTicketIdentifiers[0])) === null || _b === void 0 ? void 0 : _b.ykknInfo;
82
+ const ykknKnshbtsmiNum = (_c = ykknInfos === null || ykknInfos === void 0 ? void 0 : ykknInfos.find((ykknInfo) => ykknInfo.ykknshTyp === serviceType)) === null || _c === void 0 ? void 0 : _c.ykknKnshbtsmiNum;
83
+ if (typeof ykknKnshbtsmiNum === 'string') {
84
+ availableMovieTicketsCountByServiceType = Number(ykknKnshbtsmiNum);
85
+ }
86
+ if (availableMovieTicketsCountByServiceType < requiredMovieTicketsCountByServiceType) {
87
+ const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsCountByServiceType;
77
88
  throw new factory.errors.Argument('movieTickets', `${shortNumber} movie tickets by service type ${serviceType} short`);
78
89
  }
90
+ // const availableMovieTicketsByServiceType = availableMovieTickets.filter((t) => t.serviceType === serviceType);
91
+ // if (availableMovieTicketsByServiceType.length < requiredMovieTicketsCountByServiceType) {
92
+ // const shortNumber = requiredMovieTicketsCountByServiceType - availableMovieTicketsByServiceType.length;
93
+ // throw new factory.errors.Argument(
94
+ // 'movieTickets',
95
+ // `${shortNumber} movie tickets by service type ${serviceType} short`
96
+ // );
97
+ // }
79
98
  });
80
99
  // checkはするが保管は保留(2023-03-09~)
81
100
  return;
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.1"
123
+ "version": "20.12.0-alpha.1"
124
124
  }