@chevre/domain 20.4.0-alpha.34 → 20.4.0-alpha.36

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.
@@ -22,7 +22,7 @@ async function main() {
22
22
  const productRepo = new chevre.repository.Product(mongoose.connection);
23
23
 
24
24
  const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
25
- event: { id: 'ale6qiedi' },
25
+ event: { id: 'ale6qiedq' },
26
26
  onlyValid: true,
27
27
  validateOfferRateLimit: true,
28
28
  addSortIndex: true,
@@ -26,7 +26,7 @@ function searchTicketOffersByItemOffered(params) {
26
26
  if (typeof catalogId !== 'string') {
27
27
  throw new factory.errors.NotFound('itemOffered.hasOfferCatalog');
28
28
  }
29
- const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
29
+ const { offers, sortedOfferIds } = yield repos.offer.findOffersByOfferCatalogId({
30
30
  ids: params.ids,
31
31
  offerCatalog: { id: catalogId },
32
32
  availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id },
@@ -38,9 +38,7 @@ function searchTicketOffersByItemOffered(params) {
38
38
  page: params.page,
39
39
  sort: false
40
40
  });
41
- const availableOffers = findOffersByOfferCatalogIdResult.offers;
42
- const sortedOfferIds = findOffersByOfferCatalogIdResult.sortedOfferIds;
43
- return { availableOffers, sortedOfferIds };
41
+ return { availableOffers: offers, sortedOfferIds };
44
42
  });
45
43
  }
46
44
  /**
@@ -74,10 +72,13 @@ function searchEventTicketOffersByEvent(params) {
74
72
  unacceptedPaymentMethod,
75
73
  excludeAppliesToMovieTicket
76
74
  })(repos);
77
- const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: event.project.id }, soundFormatTypes, videoFormatTypes })(repos);
78
- // 決済カード加算料金が存在しない場合自動補完する(2023-02-21~)
79
- // if (!settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
80
- // }
75
+ // 冗長な検索について最適化(2023-03-03~)
76
+ const { soundFormatChargeSpecs, videoFormatChargeSpecs, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({
77
+ project: { id: event.project.id },
78
+ soundFormatTypes,
79
+ videoFormatTypes,
80
+ availableOffers
81
+ })(repos);
81
82
  const offers4event = [];
82
83
  // 単価オファーから興行オファーを生成(順に処理)
83
84
  for (const availableOffer of availableOffers) {
@@ -114,8 +115,8 @@ function searchEventTicketOffersByEvent(params) {
114
115
  offers4event.push((0, factory_1.createCompoundPriceSpec4event)({
115
116
  eligibleQuantity: eventOffers.eligibleQuantity,
116
117
  offer: availableOffer,
117
- videoFormatChargeSpecifications,
118
- soundFormatChargeSpecifications,
118
+ videoFormatChargeSpecs,
119
+ soundFormatChargeSpecs,
119
120
  movieTicketTypeChargeSpecs,
120
121
  videoFormatTypes,
121
122
  availability,
@@ -134,7 +135,6 @@ function getUnacceptedPaymentMethodByEvent(params) {
134
135
  const eventOffers = params.event.offers;
135
136
  const unacceptedPaymentMethodByEvent = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.unacceptedPaymentMethod;
136
137
  // 施設コンテンツを参照する必要はない(2022-10-31~)
137
- // イベントにunacceptedPaymentMethod設定があれば上書き
138
138
  if (Array.isArray(unacceptedPaymentMethodByEvent)) {
139
139
  unacceptedPaymentMethod = unacceptedPaymentMethodByEvent;
140
140
  }
@@ -142,38 +142,57 @@ function getUnacceptedPaymentMethodByEvent(params) {
142
142
  }
143
143
  function searchPriceSpecs4event(params) {
144
144
  return (repos) => __awaiter(this, void 0, void 0, function* () {
145
- const soundFormatChargeSpecifications = (params.soundFormatTypes.length > 0)
146
- ? yield repos.priceSpecification.search({
147
- project: { id: { $eq: params.project.id } },
148
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
149
- appliesToCategoryCode: {
150
- $elemMatch: {
151
- codeValue: { $in: params.soundFormatTypes },
152
- 'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.SoundFormatType }
153
- }
145
+ let soundFormatChargeSpecs = [];
146
+ let videoFormatChargeSpecs = [];
147
+ let movieTicketTypeChargeSpecs = [];
148
+ const movieTicketServiceTypes = [...new Set(params.availableOffers.reduce((a, b) => {
149
+ if (!Array.isArray(b.priceSpecification.appliesToMovieTicket)) {
150
+ return a;
154
151
  }
155
- })
156
- : [];
157
- const videoFormatChargeSpecifications = (params.videoFormatTypes.length > 0)
158
- ? yield repos.priceSpecification.search({
159
- project: { id: { $eq: params.project.id } },
160
- typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
161
- appliesToCategoryCode: {
162
- $elemMatch: {
163
- codeValue: { $in: params.videoFormatTypes },
164
- 'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType }
152
+ return [
153
+ ...a,
154
+ ...b.priceSpecification.appliesToMovieTicket.map((movieTicket) => movieTicket.serviceType)
155
+ ];
156
+ }, []))];
157
+ if (params.soundFormatTypes.length > 0) {
158
+ soundFormatChargeSpecs =
159
+ yield repos.priceSpecification.search({
160
+ project: { id: { $eq: params.project.id } },
161
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
162
+ appliesToCategoryCode: {
163
+ $elemMatch: {
164
+ codeValue: { $in: params.soundFormatTypes },
165
+ 'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.SoundFormatType }
166
+ }
165
167
  }
166
- }
167
- })
168
- : [];
169
- const movieTicketTypeChargeSpecs = (params.videoFormatTypes.length > 0)
170
- ? yield repos.priceSpecification.search({
171
- project: { id: { $eq: params.project.id } },
172
- typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
173
- appliesToVideoFormats: params.videoFormatTypes
174
- })
175
- : [];
176
- return { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs };
168
+ });
169
+ }
170
+ if ((params.videoFormatTypes.length > 0)) {
171
+ videoFormatChargeSpecs =
172
+ yield repos.priceSpecification.search({
173
+ project: { id: { $eq: params.project.id } },
174
+ typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
175
+ appliesToCategoryCode: {
176
+ $elemMatch: {
177
+ codeValue: { $in: params.videoFormatTypes },
178
+ 'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType }
179
+ }
180
+ }
181
+ });
182
+ // 存在する適用決済カード区分の分だけ検索する(2023-03-03~)
183
+ if (movieTicketServiceTypes.length > 0) {
184
+ movieTicketTypeChargeSpecs =
185
+ yield repos.priceSpecification.search({
186
+ project: { id: { $eq: params.project.id } },
187
+ typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
188
+ appliesToVideoFormats: params.videoFormatTypes,
189
+ appliesToMovieTicket: {
190
+ serviceTypes: movieTicketServiceTypes
191
+ }
192
+ });
193
+ }
194
+ }
195
+ return { soundFormatChargeSpecs, videoFormatChargeSpecs, movieTicketTypeChargeSpecs };
177
196
  });
178
197
  }
179
198
  function checkAvailability(params) {
@@ -5,8 +5,8 @@ declare function createCompoundPriceSpec4event(params: {
5
5
  eligibleQuantity: factory.quantitativeValue.IQuantitativeValue<factory.unitCode.C62>;
6
6
  offer: factory.unitPriceOffer.IUnitPriceOffer;
7
7
  movieTicketTypeChargeSpecs: IMovieTicketTypeChargeSpecification[];
8
- videoFormatChargeSpecifications: ICategoryCodeChargeSpecification[];
9
- soundFormatChargeSpecifications: ICategoryCodeChargeSpecification[];
8
+ videoFormatChargeSpecs: ICategoryCodeChargeSpecification[];
9
+ soundFormatChargeSpecs: ICategoryCodeChargeSpecification[];
10
10
  videoFormatTypes: string[];
11
11
  availability?: factory.itemAvailability;
12
12
  addOn: factory.product.ITicketAddOn[] | factory.product.IMinimizedTicketAddOn[];
@@ -23,8 +23,8 @@ function createCompoundPriceSpec4event(params) {
23
23
  // 区分加算料金を適用しないオプションを追加(2023-01-26~)
24
24
  const ignoreCategoryCodeChargeSpec = ((_a = params.offer.settings) === null || _a === void 0 ? void 0 : _a.ignoreCategoryCodeChargeSpec) === true;
25
25
  if (!ignoreCategoryCodeChargeSpec) {
26
- videoFormatChargeSpecComponents = params.videoFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
27
- soundFormatChargeSpecComponents = params.soundFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
26
+ videoFormatChargeSpecComponents = params.videoFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
27
+ soundFormatChargeSpecComponents = params.soundFormatChargeSpecs.map(categoryCodeChargePriceSpec2component);
28
28
  }
29
29
  const mvtkPriceComponents = [];
30
30
  // 複数決済カード対応(2022-07-11~)
@@ -3,7 +3,7 @@ import * as factory from '../../../factory';
3
3
  export declare function createSeatInfoSyncIn(params: {
4
4
  paymentMethodType: string;
5
5
  paymentMethodId: string;
6
- movieTickets: factory.paymentMethod.paymentCard.movieTicket.IMovieTicket[];
6
+ movieTickets: factory.action.trade.pay.IMovieTicket[];
7
7
  event: factory.event.screeningEvent.IEvent;
8
8
  purpose: factory.action.trade.pay.IPurpose;
9
9
  seller: factory.seller.ISeller;
@@ -6,11 +6,10 @@ import { MongoRepository as ProjectRepo } from '../../repo/project';
6
6
  import { MongoRepository as SellerRepo } from '../../repo/seller';
7
7
  import { MongoRepository as TaskRepo } from '../../repo/task';
8
8
  import * as factory from '../../factory';
9
- declare type IMovieTicket = factory.paymentMethod.paymentCard.movieTicket.IMovieTicket;
10
9
  interface ICheckResult {
11
10
  purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
12
11
  purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
13
- movieTickets: IMovieTicket[];
12
+ movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
14
13
  }
15
14
  interface ICheckOperationRepos {
16
15
  action: ActionRepo;
@@ -48,7 +47,7 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
48
47
  * MovieTicket認証
49
48
  */
50
49
  declare function checkByIdentifier(params: {
51
- movieTickets: IMovieTicket[];
50
+ movieTickets: factory.action.check.paymentMethod.movieTicket.IMovieTicket[];
52
51
  seller: factory.seller.ISeller;
53
52
  screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
54
53
  paymentServiceId: string;
@@ -195,7 +195,7 @@ function purchaseNumberAuthResult2movieTickets(params) {
195
195
  // tslint:disable-next-line:prefer-array-literal
196
196
  [...Array(Number(ykknInfo.ykknKnshbtsmiNum))].forEach(() => {
197
197
  movieTickets.push({
198
- project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
198
+ // project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
199
199
  typeOf: paymentMethodType,
200
200
  identifier: knyknrNoInfo.knyknrNo,
201
201
  accessCode: knyknrNoInfo.pinCd,
@@ -207,16 +207,16 @@ function purchaseNumberAuthResult2movieTickets(params) {
207
207
  reservationFor: {
208
208
  typeOf: params.screeningEvent.typeOf,
209
209
  id: params.screeningEvent.id
210
- },
211
- reservedTicket: {
212
- ticketedSeat: {
213
- typeOf: factory.placeType.Seat,
214
- // seatingType: 'Default', // 情報空でよし
215
- seatNumber: '',
216
- seatRow: '',
217
- seatSection: '' // 情報空でよし
218
- }
219
210
  }
211
+ // reservedTicket: {
212
+ // ticketedSeat: {
213
+ // typeOf: factory.placeType.Seat,
214
+ // // seatingType: 'Default', // 情報空でよし
215
+ // seatNumber: '', // 情報空でよし
216
+ // seatRow: '', // 情報空でよし
217
+ // seatSection: '' // 情報空でよし
218
+ // }
219
+ // }
220
220
  }
221
221
  });
222
222
  });
@@ -226,7 +226,9 @@ function purchaseNumberAuthResult2movieTickets(params) {
226
226
  knyknrNoInfoOut.mkknInfo.forEach((mkknInfo) => {
227
227
  // tslint:disable-next-line:prefer-array-literal
228
228
  [...Array(Number(mkknInfo.mkknKnshbtsmiNum))].forEach(() => {
229
- movieTickets.push(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id }, typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
229
+ movieTickets.push(Object.assign({
230
+ // project: { typeOf: factory.organizationType.Project, id: params.screeningEvent.project.id },
231
+ typeOf: paymentMethodType, identifier: knyknrNoInfo.knyknrNo, accessCode: knyknrNoInfo.pinCd, category: {
230
232
  codeValue: movieTicketCategoryCode // 追加(2023-02-08~)
231
233
  }, amount: {
232
234
  typeOf: 'MonetaryAmount',
@@ -237,16 +239,16 @@ function purchaseNumberAuthResult2movieTickets(params) {
237
239
  reservationFor: {
238
240
  typeOf: params.screeningEvent.typeOf,
239
241
  id: params.screeningEvent.id
240
- },
241
- reservedTicket: {
242
- ticketedSeat: {
243
- typeOf: factory.placeType.Seat,
244
- // seatingType: 'Default', // 情報空でよし
245
- seatNumber: '',
246
- seatRow: '',
247
- seatSection: '' // 情報空でよし
248
- }
249
242
  }
243
+ // reservedTicket: {
244
+ // ticketedSeat: {
245
+ // typeOf: factory.placeType.Seat,
246
+ // // seatingType: 'Default', // 情報空でよし
247
+ // seatNumber: '', // 情報空でよし
248
+ // seatRow: '', // 情報空でよし
249
+ // seatSection: '' // 情報空でよし
250
+ // }
251
+ // }
250
252
  } }, {
251
253
  validThrough: moment(`${mkknInfo.yykDt}+09:00`, 'YYYY/MM/DD HH:mm:ssZ')
252
254
  .toDate()
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.293.0-alpha.0",
13
- "@cinerino/sdk": "3.143.0",
12
+ "@chevre/factory": "4.293.0-alpha.1",
13
+ "@cinerino/sdk": "3.144.0-alpha.1",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -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.4.0-alpha.34"
123
+ "version": "20.4.0-alpha.36"
124
124
  }