@chevre/domain 20.9.0-alpha.2 → 20.9.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.
@@ -27,8 +27,7 @@ async function main() {
27
27
  validateOfferRateLimit: true,
28
28
  addSortIndex: true,
29
29
  limit: 100,
30
- page: 1,
31
- searchAddOns: true
30
+ page: 1
32
31
  // ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
33
32
  })({
34
33
  event: eventRepo,
@@ -2,6 +2,9 @@
2
2
  * 予約価格ファクトリー
3
3
  */
4
4
  import * as factory from '../../../../factory';
5
+ export declare type IAcceptedAddOn = Pick<factory.offer.IAddOn, 'id' | 'identifier' | 'itemOffered' | 'priceCurrency' | 'typeOf' | 'validFrom' | 'validThrough'> & {
6
+ priceSpecification: factory.product.ITicketUnitPriceComponent;
7
+ };
5
8
  export declare function createPrice(params: {
6
9
  project: {
7
10
  id: string;
@@ -9,6 +12,6 @@ export declare function createPrice(params: {
9
12
  };
10
13
  ticketOffer: factory.product.ITicketOffer;
11
14
  seatPriceComponent: factory.place.seat.IPriceComponent[];
12
- acceptedAddOns: factory.product.ITicketAddOn[];
15
+ acceptedAddOns: IAcceptedAddOn[];
13
16
  appliesToMovieTicket?: factory.assetTransaction.reserve.IAcceptedAppliesToMovieTicket;
14
17
  }): factory.reservation.IPriceSpecification<factory.reservationType.EventReservation>;
@@ -1,5 +1,7 @@
1
1
  import * as factory from '../../../factory';
2
+ import { IAcceptedAddOn } from './factory/price';
2
3
  declare type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
4
+ export { IAcceptedAddOn };
3
5
  export declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
4
6
  reservationNumber: string;
5
7
  }): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve>;
@@ -59,7 +61,7 @@ export declare function createReservation(params: {
59
61
  additionalTicketText?: string;
60
62
  ticketOffer: factory.product.ITicketOffer;
61
63
  seatPriceComponent: factory.place.seat.IPriceComponent[];
62
- acceptedAddOns: factory.product.ITicketAddOn[];
64
+ acceptedAddOns: IAcceptedAddOn[];
63
65
  subReservation?: factory.reservation.ISubReservation<factory.reservationType.EventReservation>[];
64
66
  programMembershipUsed?: factory.reservation.IProgramMembershipUsed<factory.reservationType.EventReservation>;
65
67
  availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
@@ -73,4 +75,3 @@ export declare function createPotentialActions(params: factory.assetTransaction.
73
75
  export declare function createPendingReservationAction(params: {
74
76
  transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
75
77
  }): factory.action.cancel.reservation.IAttributes[];
76
- export {};
@@ -119,8 +119,7 @@ function addReservations(params) {
119
119
  store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
120
120
  onlyValid: true,
121
121
  addSortIndex: false,
122
- validateOfferRateLimit: true,
123
- searchAddOns: false // false化(2023-03-02~)
122
+ validateOfferRateLimit: true
124
123
  })(repos);
125
124
  ticketOffers = searchEventTicketOffersResult.ticketOffers;
126
125
  availableOffers = searchEventTicketOffersResult.unitPriceOffers;
@@ -226,8 +226,7 @@ function validateAcceptedOffers(params) {
226
226
  store: params.store,
227
227
  onlyValid: true,
228
228
  addSortIndex: false,
229
- validateOfferRateLimit: true,
230
- searchAddOns: false // false化(2023-03-02~)
229
+ validateOfferRateLimit: true
231
230
  })(repos);
232
231
  // 利用可能なチケットオファーであれば受け入れる
233
232
  const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
@@ -12,7 +12,6 @@ interface ISearchEventTicketOffersRepos {
12
12
  product: ProductRepo;
13
13
  }
14
14
  declare type ISearchEventTicketOffersOperation<T> = (repos: ISearchEventTicketOffersRepos) => Promise<T>;
15
- declare type IAcceptedPaymentMethod = factory.paymentMethod.paymentCard.movieTicket.IMovieTicket;
16
15
  declare type ITicketOfferWithSortIndex = factory.product.ITicketOffer;
17
16
  /**
18
17
  * 興行オファー検索
@@ -41,41 +40,13 @@ declare function searchEventTicketOffers(params: {
41
40
  /**
42
41
  * どの決済方法に対して
43
42
  */
44
- paymentMethod?: IAcceptedPaymentMethod;
45
43
  /**
46
44
  * COAムビチケ券種もほしい場合に指定
47
45
  */
48
- movieTicket?: {
49
- /**
50
- * 電子券区分
51
- */
52
- kbnDenshiken: string;
53
- /**
54
- * 前売券区分
55
- */
56
- kbnMaeuriken: string;
57
- /**
58
- * 券種区分
59
- */
60
- kbnKensyu: string;
61
- /**
62
- * 販売単価
63
- */
64
- salesPrice: number;
65
- /**
66
- * 計上単価
67
- */
68
- appPrice: number;
69
- /**
70
- * 映写方式区分
71
- */
72
- kbnEisyahousiki: string;
73
- };
74
46
  limit?: number;
75
47
  page?: number;
76
48
  addSortIndex: boolean;
77
49
  validateOfferRateLimit: boolean;
78
- searchAddOns: boolean;
79
50
  }): ISearchEventTicketOffersOperation<{
80
51
  ticketOffers: ITicketOfferWithSortIndex[];
81
52
  unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
@@ -47,7 +47,7 @@ function searchTicketOffersByItemOffered(params) {
47
47
  function searchEventTicketOffersByEvent(params) {
48
48
  // tslint:disable-next-line:max-func-body-length
49
49
  return (repos) => __awaiter(this, void 0, void 0, function* () {
50
- var _a, _b;
50
+ var _a;
51
51
  const event = params.event;
52
52
  let soundFormatTypes = [];
53
53
  let videoFormatTypes = [];
@@ -91,27 +91,6 @@ function searchEventTicketOffersByEvent(params) {
91
91
  // レート制限を確認
92
92
  availability = yield checkAvailability({ event, unitPriceOffer: availableOffer })(repos);
93
93
  }
94
- // アドオン設定があれば、プロダクトオファーを検索
95
- let offerAddOn = [];
96
- if (Array.isArray(availableOffer.addOn)) {
97
- if (params.searchAddOns) {
98
- for (const addOn of availableOffer.addOn) {
99
- const productId = (_b = addOn.itemOffered) === null || _b === void 0 ? void 0 : _b.id;
100
- if (typeof productId === 'string') {
101
- const productOffers = yield searchAddOns({
102
- product: { id: productId },
103
- store: params.store,
104
- addSortIndex: params.addSortIndex,
105
- onlyValid: params.onlyValid
106
- })(repos);
107
- offerAddOn.push(...productOffers);
108
- }
109
- }
110
- }
111
- else {
112
- offerAddOn = availableOffer.addOn;
113
- }
114
- }
115
94
  offers4event.push((0, factory_1.createCompoundPriceSpec4event)({
116
95
  eligibleQuantity: eventOffers.eligibleQuantity,
117
96
  offer: availableOffer,
@@ -120,7 +99,7 @@ function searchEventTicketOffersByEvent(params) {
120
99
  movieTicketTypeChargeSpecs,
121
100
  videoFormatTypes,
122
101
  availability,
123
- addOn: offerAddOn,
102
+ addOn: (Array.isArray(availableOffer.addOn)) ? availableOffer.addOn : [],
124
103
  sortIndex
125
104
  }));
126
105
  }
@@ -228,59 +207,11 @@ function checkAvailability(params) {
228
207
  return availability;
229
208
  });
230
209
  }
231
- /**
232
- * アドオンを検索する
233
- */
234
- function searchAddOns(params) {
235
- return (repos) => __awaiter(this, void 0, void 0, function* () {
236
- var _a, _b, _c;
237
- let addOns = [];
238
- const productId = (_a = params.product) === null || _a === void 0 ? void 0 : _a.id;
239
- if (typeof productId === 'string') {
240
- const productWithAddOns = yield repos.product.findById({ id: productId });
241
- const offerCatalogId = (_b = productWithAddOns.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id;
242
- if (typeof offerCatalogId === 'string') {
243
- const { offers, sortedOfferIds } = yield repos.offer.findOffersByOfferCatalogId({
244
- offerCatalog: { id: offerCatalogId },
245
- availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
246
- excludeAppliesToMovieTicket: false,
247
- onlyValid: params.onlyValid === true,
248
- sort: true
249
- });
250
- const unitPriceOffers = offers;
251
- addOns = unitPriceOffers.map((o) => {
252
- let sortIndex;
253
- if (params.addSortIndex) {
254
- sortIndex = sortedOfferIds.indexOf(String(o.id));
255
- }
256
- const itemOffered4addOn = {
257
- description: productWithAddOns.description,
258
- id: productWithAddOns.id,
259
- name: productWithAddOns.name,
260
- productID: productWithAddOns.productID,
261
- // project: productWithAddOns.project,
262
- typeOf: productWithAddOns.typeOf
263
- };
264
- return Object.assign(Object.assign(Object.assign({
265
- // additionalProperty: Array.isArray(o.additionalProperty) ? o.additionalProperty : [],
266
- alternateName: o.alternateName, availability: o.availability,
267
- // availableAtOrFrom: o.availableAtOrFrom,
268
- // color: o.color,
269
- description: o.description, id: String(o.id), identifier: o.identifier, itemOffered: itemOffered4addOn, name: o.name, priceCurrency: o.priceCurrency, priceSpecification: o.priceSpecification,
270
- // project: o.project,
271
- typeOf: o.typeOf }, (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined), (typeof sortIndex === 'number') ? { sortIndex } : undefined);
272
- });
273
- }
274
- }
275
- return addOns;
276
- });
277
- }
278
210
  /**
279
211
  * 興行オファー検索
280
212
  */
281
213
  function searchEventTicketOffers(params) {
282
214
  return (repos) => __awaiter(this, void 0, void 0, function* () {
283
- // const now = moment();
284
215
  const event = yield repos.event.findMinimizedIndividualEventById({ id: params.event.id });
285
216
  let offers;
286
217
  let unitPriceOffers;
@@ -303,47 +234,10 @@ function searchEventTicketOffers(params) {
303
234
  page: params.page,
304
235
  addSortIndex: params.addSortIndex,
305
236
  validateOfferRateLimit: params.validateOfferRateLimit,
306
- onlyValid: params.onlyValid === true,
307
- searchAddOns: params.searchAddOns
237
+ onlyValid: params.onlyValid === true
308
238
  })(repos);
309
239
  offers = searchOffersResult.ticketOffers;
310
240
  unitPriceOffers = searchOffersResult.unitPriceOffers;
311
- // mongo条件へ移行(2023-02-24~)
312
- // 有効期間を適用
313
- // if (params.onlyValid === true) {
314
- // offers = offers.filter((o) => {
315
- // let isvalid = true;
316
- // if (o.validFrom !== undefined && moment(o.validFrom)
317
- // .isAfter(now)) {
318
- // isvalid = false;
319
- // }
320
- // if (o.validThrough !== undefined && moment(o.validThrough)
321
- // .isBefore(now)) {
322
- // isvalid = false;
323
- // }
324
- // return isvalid;
325
- // });
326
- // }
327
- // mongo条件へ移行(2023-02-27~)
328
- // for (const offer of offers) {
329
- // if (Array.isArray(offer.addOn)) {
330
- // // addOnsに対しても有効期間を適用
331
- // if (params.onlyValid === true) {
332
- // offer.addOn = offer.addOn.filter((offer4addOn) => {
333
- // let isvalid = true;
334
- // if (offer4addOn.validFrom !== undefined && moment(offer4addOn.validFrom)
335
- // .isAfter(now)) {
336
- // isvalid = false;
337
- // }
338
- // if (offer4addOn.validThrough !== undefined && moment(offer4addOn.validThrough)
339
- // .isBefore(now)) {
340
- // isvalid = false;
341
- // }
342
- // return isvalid;
343
- // });
344
- // }
345
- // }
346
- // }
347
241
  }
348
242
  return { ticketOffers: offers, unitPriceOffers };
349
243
  });
@@ -9,7 +9,7 @@ declare function createCompoundPriceSpec4event(params: {
9
9
  soundFormatChargeSpecs: ICategoryCodeChargeSpecification[];
10
10
  videoFormatTypes: string[];
11
11
  availability?: factory.itemAvailability;
12
- addOn: factory.product.ITicketAddOn[] | factory.product.IMinimizedTicketAddOn[];
12
+ addOn: factory.product.IMinimizedTicketAddOn[];
13
13
  sortIndex?: number;
14
14
  }): factory.product.ITicketOffer & {
15
15
  sortIndex?: number;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.302.0",
12
+ "@chevre/factory": "4.303.0",
13
13
  "@cinerino/sdk": "3.150.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.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.9.0-alpha.2"
123
+ "version": "20.9.0"
124
124
  }