@chevre/domain 20.4.0-alpha.20 → 20.4.0-alpha.22

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.
@@ -0,0 +1,22 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ async function main() {
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
8
+
9
+ const taskRepo = new chevre.repository.Task(mongoose.connection);
10
+
11
+ const tasks = await taskRepo.search({
12
+ limit: 100,
13
+ page: 1,
14
+ id: { $eq: '63b7a54d8ba861284895937f' }
15
+ });
16
+ console.log(tasks);
17
+ console.log(tasks.length);
18
+ }
19
+
20
+ main()
21
+ .then(console.log)
22
+ .catch(console.error);
@@ -29,9 +29,13 @@ class MongoRepository {
29
29
  }
30
30
  // tslint:disable-next-line:max-func-body-length
31
31
  static CREATE_MONGO_CONDITIONS(params) {
32
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
33
33
  const andConditions = [];
34
- const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
34
+ const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
35
+ if (typeof idEq === 'string') {
36
+ andConditions.push({ _id: { $eq: idEq } });
37
+ }
38
+ const projectIdEq = (_c = (_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.$eq;
35
39
  if (typeof projectIdEq === 'string') {
36
40
  andConditions.push({ 'project.id': { $eq: projectIdEq } });
37
41
  }
@@ -39,11 +43,11 @@ class MongoRepository {
39
43
  andConditions.push({ name: { $eq: params.name } });
40
44
  }
41
45
  else {
42
- const nameIn = (_c = params.name) === null || _c === void 0 ? void 0 : _c.$in;
46
+ const nameIn = (_d = params.name) === null || _d === void 0 ? void 0 : _d.$in;
43
47
  if (Array.isArray(nameIn)) {
44
48
  andConditions.push({ name: { $in: nameIn } });
45
49
  }
46
- const nameNin = (_d = params.name) === null || _d === void 0 ? void 0 : _d.$nin;
50
+ const nameNin = (_e = params.name) === null || _e === void 0 ? void 0 : _e.$nin;
47
51
  if (Array.isArray(nameNin)) {
48
52
  andConditions.push({ name: { $nin: nameNin } });
49
53
  }
@@ -89,7 +93,7 @@ class MongoRepository {
89
93
  }
90
94
  });
91
95
  }
92
- const dateAbortedGte = (_e = params.dateAborted) === null || _e === void 0 ? void 0 : _e.$gte;
96
+ const dateAbortedGte = (_f = params.dateAborted) === null || _f === void 0 ? void 0 : _f.$gte;
93
97
  if (dateAbortedGte instanceof Date) {
94
98
  andConditions.push({
95
99
  dateAborted: {
@@ -98,7 +102,7 @@ class MongoRepository {
98
102
  }
99
103
  });
100
104
  }
101
- const dateAbortedLte = (_f = params.dateAborted) === null || _f === void 0 ? void 0 : _f.$lte;
105
+ const dateAbortedLte = (_g = params.dateAborted) === null || _g === void 0 ? void 0 : _g.$lte;
102
106
  if (dateAbortedLte instanceof Date) {
103
107
  andConditions.push({
104
108
  dateAborted: {
@@ -107,7 +111,7 @@ class MongoRepository {
107
111
  }
108
112
  });
109
113
  }
110
- const objectTransactionNumberEq = (_j = (_h = (_g = params.data) === null || _g === void 0 ? void 0 : _g.object) === null || _h === void 0 ? void 0 : _h.transactionNumber) === null || _j === void 0 ? void 0 : _j.$eq;
114
+ const objectTransactionNumberEq = (_k = (_j = (_h = params.data) === null || _h === void 0 ? void 0 : _h.object) === null || _j === void 0 ? void 0 : _j.transactionNumber) === null || _k === void 0 ? void 0 : _k.$eq;
111
115
  if (typeof objectTransactionNumberEq === 'string') {
112
116
  andConditions.push({
113
117
  'data.object.transactionNumber': {
@@ -116,7 +120,7 @@ class MongoRepository {
116
120
  }
117
121
  });
118
122
  }
119
- const objectPurposeIdEq = (_m = (_l = (_k = params.data) === null || _k === void 0 ? void 0 : _k.purpose) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
123
+ const objectPurposeIdEq = (_o = (_m = (_l = params.data) === null || _l === void 0 ? void 0 : _l.purpose) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$eq;
120
124
  if (typeof objectPurposeIdEq === 'string') {
121
125
  andConditions.push({
122
126
  'data.purpose.id': {
@@ -125,7 +129,7 @@ class MongoRepository {
125
129
  }
126
130
  });
127
131
  }
128
- const objectPurposeOrderNumberEq = (_q = (_p = (_o = params.data) === null || _o === void 0 ? void 0 : _o.purpose) === null || _p === void 0 ? void 0 : _p.orderNumber) === null || _q === void 0 ? void 0 : _q.$eq;
132
+ const objectPurposeOrderNumberEq = (_r = (_q = (_p = params.data) === null || _p === void 0 ? void 0 : _p.purpose) === null || _q === void 0 ? void 0 : _q.orderNumber) === null || _r === void 0 ? void 0 : _r.$eq;
129
133
  if (typeof objectPurposeOrderNumberEq === 'string') {
130
134
  andConditions.push({
131
135
  'data.purpose.orderNumber': {
@@ -12,75 +12,59 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.searchEventTicketOffers = void 0;
13
13
  const moment = require("moment-timezone");
14
14
  const factory = require("../../../factory");
15
- const settings_1 = require("../../../settings");
16
15
  const factory_1 = require("../factory");
16
+ function searchTicketOffersByItemOffered(params) {
17
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
18
+ var _a, _b, _c, _d;
19
+ let catalogId;
20
+ if (typeof ((_a = params.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
21
+ const eventService = yield repos.product.findById({ id: (_b = params.itemOffered) === null || _b === void 0 ? void 0 : _b.id });
22
+ if (typeof ((_c = eventService.hasOfferCatalog) === null || _c === void 0 ? void 0 : _c.id) === 'string') {
23
+ catalogId = eventService.hasOfferCatalog.id;
24
+ }
25
+ }
26
+ if (typeof catalogId !== 'string') {
27
+ throw new factory.errors.NotFound('itemOffered.hasOfferCatalog');
28
+ }
29
+ const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId(Object.assign({ ids: params.ids, offerCatalog: { id: catalogId }, availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id }, unacceptedPaymentMethod: params.unacceptedPaymentMethod, excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
30
+ ? {
31
+ limit: params.limit,
32
+ page: params.page
33
+ }
34
+ : undefined));
35
+ const availableOffers = findOffersByOfferCatalogIdResult.offers;
36
+ const sortedOfferIds = findOffersByOfferCatalogIdResult.sortedOfferIds;
37
+ return { availableOffers, sortedOfferIds };
38
+ });
39
+ }
17
40
  /**
18
41
  * 旅客オファー検索
19
42
  */
20
43
  function searchTransportationEventTicketOffers(params) {
21
- // tslint:disable-next-line:max-func-body-length
22
44
  return (repos) => __awaiter(this, void 0, void 0, function* () {
23
- var _a, _b, _c, _d;
45
+ var _a, _b;
24
46
  const screeningEvent = params.event;
25
47
  const soundFormatTypes = [];
26
48
  const videoFormatTypes = [];
27
49
  const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
28
50
  // 上映方式がなければMovieTicket除外(2023-02-21~)
29
51
  const excludeAppliesToMovieTicket = videoFormatTypes.length === 0;
30
- let availableOffers = [];
31
- let sortedOfferIds = [];
32
- // 興行設定があれば興行のカタログを参照する(2022-08-31~)
33
52
  const eventOffers = screeningEvent.offers;
34
- if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
35
- const transportation = yield repos.product.findById({ id: eventOffers.itemOffered.id });
36
- if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
37
- const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId(Object.assign({ ids: params.ids, offerCatalog: { id: transportation.hasOfferCatalog.id }, availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id }, unacceptedPaymentMethod,
38
- excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
39
- ? {
40
- limit: params.limit,
41
- page: params.page
42
- }
43
- : undefined));
44
- availableOffers = findOffersByOfferCatalogIdResult.offers;
45
- sortedOfferIds = findOffersByOfferCatalogIdResult.sortedOfferIds;
46
- }
47
- }
48
- else {
49
- // hasOfferCatalog参照廃止(2022-09-02~)
50
- throw new factory.errors.NotFound('event.offers.itemOffered.id');
51
- }
53
+ const { availableOffers, sortedOfferIds } = yield searchTicketOffersByItemOffered({
54
+ itemOffered: { id: (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id },
55
+ ids: params.ids,
56
+ store: params.store,
57
+ limit: params.limit,
58
+ page: params.page,
59
+ sort: params.sort,
60
+ onlyValid: params.onlyValid,
61
+ unacceptedPaymentMethod,
62
+ excludeAppliesToMovieTicket
63
+ })(repos);
52
64
  const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
53
- // 適用決済カード条件がある場合、決済カード加算料金が存在しないオファーは除外する
54
- availableOffers = availableOffers.filter((o) => {
55
- var _a;
56
- // 複数決済カード対応(2022-07-26~)
57
- const priceSpecificationAppliesToMovieTicket = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
58
- if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
59
- // 適用決済カード数が0であれば除外
60
- if (priceSpecificationAppliesToMovieTicket.length === 0) {
61
- return false;
62
- }
63
- // 上映方式がなければ除外(2022-11-03~)
64
- // if (videoFormatTypes.length === 0) {
65
- // return false;
66
- // }
67
- return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
68
- // すべての上映方式について検証する(2022-10-29~)
69
- return videoFormatTypes.every((videoFormat) => {
70
- return movieTicketTypeChargeSpecs.some((s) => {
71
- var _a, _b, _c, _d;
72
- return ((_b = (_a = s.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.typeOf) === ((_c = appliesToMovieTicket.serviceOutput) === null || _c === void 0 ? void 0 : _c.typeOf)
73
- && ((_d = s.appliesToMovieTicket) === null || _d === void 0 ? void 0 : _d.serviceType) === appliesToMovieTicket.serviceType
74
- && s.appliesToVideoFormat === videoFormat;
75
- });
76
- });
77
- });
78
- }
79
- else {
80
- // Arrayでないケースは廃止(2022-09-10~)
81
- return true;
82
- }
83
- });
65
+ // 決済カード加算料金が存在しない場合自動補完する(2023-02-21~)
66
+ // if (!settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
67
+ // }
84
68
  let offers4event = availableOffers.map((availableOffer) => {
85
69
  let sortIndex;
86
70
  if (params.addSortIndex) {
@@ -107,7 +91,7 @@ function searchTransportationEventTicketOffers(params) {
107
91
  const offerAddOn = [];
108
92
  if (Array.isArray(offer.addOn)) {
109
93
  for (const addOn of offer.addOn) {
110
- const productId = (_d = addOn.itemOffered) === null || _d === void 0 ? void 0 : _d.id;
94
+ const productId = (_b = addOn.itemOffered) === null || _b === void 0 ? void 0 : _b.id;
111
95
  if (typeof productId === 'string') {
112
96
  const productOffers = yield searchAddOns({
113
97
  product: { id: productId },
@@ -129,9 +113,8 @@ function searchTransportationEventTicketOffers(params) {
129
113
  * 興行オファー全検索
130
114
  */
131
115
  function searchScreeningEventTicketOffers(params) {
132
- // tslint:disable-next-line:max-func-body-length
133
116
  return (repos) => __awaiter(this, void 0, void 0, function* () {
134
- var _a, _b, _c, _d;
117
+ var _a, _b;
135
118
  // イベント取得属性最適化(2023-01-23~)
136
119
  const screeningEvent = params.event;
137
120
  // 取得属性最適化(2023-01-25~)
@@ -141,79 +124,23 @@ function searchScreeningEventTicketOffers(params) {
141
124
  const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
142
125
  // 上映方式がなければMovieTicket除外(2023-02-21~)
143
126
  const excludeAppliesToMovieTicket = videoFormatTypes.length === 0;
144
- let availableOffers = [];
145
- let sortedOfferIds = [];
146
127
  // 興行設定があれば興行のカタログを参照する(2022-08-31~)
147
128
  const eventOffers = screeningEvent.offers;
148
- if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
149
- const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
150
- if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
151
- const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId(Object.assign({ ids: params.ids, offerCatalog: { id: eventService.hasOfferCatalog.id }, availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id }, unacceptedPaymentMethod,
152
- excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
153
- ? {
154
- limit: params.limit,
155
- page: params.page
156
- }
157
- : undefined));
158
- availableOffers = findOffersByOfferCatalogIdResult.offers;
159
- sortedOfferIds = findOffersByOfferCatalogIdResult.sortedOfferIds;
160
- }
161
- }
162
- else {
163
- // hasOfferCatalog参照廃止(2022-09-02~)
164
- throw new factory.errors.NotFound('event.offers.itemOffered.id');
165
- }
129
+ const { availableOffers, sortedOfferIds } = yield searchTicketOffersByItemOffered({
130
+ itemOffered: { id: (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id },
131
+ ids: params.ids,
132
+ store: params.store,
133
+ limit: params.limit,
134
+ page: params.page,
135
+ sort: params.sort,
136
+ onlyValid: params.onlyValid,
137
+ unacceptedPaymentMethod,
138
+ excludeAppliesToMovieTicket
139
+ })(repos);
166
140
  const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
167
- // 不許可決済方法があれば、該当オファーを除外
168
- // Mongoオファー検索条件へ移行(2023-02-21~)
169
- // if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
170
- // availableOffers = availableOffers.filter((o) => {
171
- // // 複数決済カード対応(2022-07-11~)
172
- // const priceSpecificationAppliesToMovieTicket = o.priceSpecification?.appliesToMovieTicket;
173
- // if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
174
- // return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
175
- // return !unacceptedPaymentMethod.includes(appliesToMovieTicket.serviceOutput.typeOf);
176
- // });
177
- // } else {
178
- // // Arrayでないケースは廃止(2022-09-10~)
179
- // return true;
180
- // }
181
- // });
182
- // }
183
141
  // 決済カード加算料金が存在しない場合自動補完する(2023-02-21~)
184
- if (!settings_1.settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
185
- // 適用決済カード条件がある場合、決済カード加算料金が存在しないオファーは除外する
186
- availableOffers = availableOffers.filter((o) => {
187
- var _a;
188
- // 複数決済カード対応(2022-07-26~)
189
- const priceSpecificationAppliesToMovieTicket = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
190
- if (Array.isArray(priceSpecificationAppliesToMovieTicket)) {
191
- // 適用決済カード数が0であれば除外
192
- if (priceSpecificationAppliesToMovieTicket.length === 0) {
193
- return false;
194
- }
195
- // 上映方式がなければ除外(2022-11-03~)
196
- // if (videoFormatTypes.length === 0) {
197
- // return false;
198
- // }
199
- return priceSpecificationAppliesToMovieTicket.every((appliesToMovieTicket) => {
200
- // すべての上映方式について検証する(2022-10-29~)
201
- return videoFormatTypes.every((videoFormat) => {
202
- return movieTicketTypeChargeSpecs.some((s) => {
203
- var _a, _b, _c, _d;
204
- return ((_b = (_a = s.appliesToMovieTicket) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.typeOf) === ((_c = appliesToMovieTicket.serviceOutput) === null || _c === void 0 ? void 0 : _c.typeOf)
205
- && ((_d = s.appliesToMovieTicket) === null || _d === void 0 ? void 0 : _d.serviceType) === appliesToMovieTicket.serviceType
206
- && s.appliesToVideoFormat === videoFormat;
207
- });
208
- });
209
- });
210
- }
211
- else {
212
- // Arrayでないケースは廃止(2022-09-10~)
213
- return true;
214
- }
215
- });
216
- }
142
+ // if (!settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
143
+ // }
217
144
  let offers4event = availableOffers.map((availableOffer) => {
218
145
  let sortIndex;
219
146
  if (params.addSortIndex) {
@@ -240,7 +167,7 @@ function searchScreeningEventTicketOffers(params) {
240
167
  const offerAddOn = [];
241
168
  if (Array.isArray(offer.addOn)) {
242
169
  for (const addOn of offer.addOn) {
243
- const productId = (_d = addOn.itemOffered) === null || _d === void 0 ? void 0 : _d.id;
170
+ const productId = (_b = addOn.itemOffered) === null || _b === void 0 ? void 0 : _b.id;
244
171
  if (typeof productId === 'string') {
245
172
  const productOffers = yield searchAddOns({ product: { id: productId } })(repos);
246
173
  offerAddOn.push(...productOffers);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCompoundPriceSpec4event = void 0;
4
4
  const factory = require("../../factory");
5
- const settings_1 = require("../../settings");
6
5
  function categoryCodeChargePriceSpec2component(params) {
7
6
  var _a;
8
7
  return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
@@ -31,50 +30,36 @@ function createCompoundPriceSpec4event(params) {
31
30
  // 複数決済カード対応(2022-07-11~)
32
31
  if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
33
32
  // 決済カード加算料金自動補完(2023-02-21~)
34
- if (settings_1.settings.useOffersAppliedToMovieTicketWithoutChargeSpecification) {
35
- unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
36
- // すべての上映方式に該当する加算料金を追加
37
- params.videoFormatTypes.forEach((videoFormatType) => {
38
- let existingMvtkSpec4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.find((s) => {
39
- var _a;
40
- return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
41
- && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
42
- && s.appliesToVideoFormat === videoFormatType;
43
- });
44
- // 加算料金が存在しなければprice: 0で自動補完
45
- if (existingMvtkSpec4appliesToMovieTicket === undefined) {
46
- existingMvtkSpec4appliesToMovieTicket = {
47
- typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
48
- price: 0,
49
- priceCurrency: factory.priceCurrency.JPY,
50
- appliesToVideoFormat: videoFormatType,
51
- valueAddedTaxIncluded: true,
52
- project: params.offer.project,
53
- id: '',
54
- name: params.offer.name,
55
- appliesToMovieTicket: {
56
- typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
57
- serviceType: appliesToMovieTicket.serviceType,
58
- serviceOutput: { typeOf: appliesToMovieTicket.serviceOutput.typeOf }
59
- }
60
- };
61
- }
62
- mvtkPriceComponents.push(mvtkChargePriceSpec2component(existingMvtkSpec4appliesToMovieTicket));
63
- });
64
- });
65
- }
66
- else {
67
- unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
68
- // すべての上映方式に該当する加算料金を追加(2022-10-29~)
69
- const mvtkSpecs4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.filter((s) => {
33
+ unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
34
+ // すべての上映方式に該当する加算料金を追加
35
+ params.videoFormatTypes.forEach((videoFormatType) => {
36
+ let existingMvtkSpec4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.find((s) => {
70
37
  var _a;
71
38
  return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
72
39
  && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
73
- && params.videoFormatTypes.includes(s.appliesToVideoFormat);
40
+ && s.appliesToVideoFormat === videoFormatType;
74
41
  });
75
- mvtkPriceComponents.push(...mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component));
42
+ // 加算料金が存在しなければprice: 0で自動補完
43
+ if (existingMvtkSpec4appliesToMovieTicket === undefined) {
44
+ existingMvtkSpec4appliesToMovieTicket = {
45
+ typeOf: factory.priceSpecificationType.MovieTicketTypeChargeSpecification,
46
+ price: 0,
47
+ priceCurrency: factory.priceCurrency.JPY,
48
+ appliesToVideoFormat: videoFormatType,
49
+ valueAddedTaxIncluded: true,
50
+ project: params.offer.project,
51
+ id: '',
52
+ name: params.offer.name,
53
+ appliesToMovieTicket: {
54
+ typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
55
+ serviceType: appliesToMovieTicket.serviceType,
56
+ serviceOutput: { typeOf: appliesToMovieTicket.serviceOutput.typeOf }
57
+ }
58
+ };
59
+ }
60
+ mvtkPriceComponents.push(mvtkChargePriceSpec2component(existingMvtkSpec4appliesToMovieTicket));
76
61
  });
77
- }
62
+ });
78
63
  }
79
64
  // 区分加算料金は決済カード適用でも価格要素に含まれるはず(2022-11-02~)
80
65
  const priceComponent = [
@@ -53,6 +53,7 @@ function creatPayTransactionStartParams(params) {
53
53
  }
54
54
  exports.creatPayTransactionStartParams = creatPayTransactionStartParams;
55
55
  function createMovieTicket(params) {
56
+ var _a;
56
57
  const serviceOutput = {
57
58
  reservationFor: {
58
59
  typeOf: params.serviceOutput.reservationFor.typeOf,
@@ -72,7 +73,7 @@ function createMovieTicket(params) {
72
73
  typeOf: params.typeOf,
73
74
  identifier: params.identifier,
74
75
  accessCode: params.accessCode,
75
- category: { codeValue: params.category.codeValue },
76
+ category: { codeValue: (typeof ((_a = params.category) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string') ? params.category.codeValue : '' },
76
77
  serviceType: params.serviceType,
77
78
  serviceOutput
78
79
  };
@@ -22,7 +22,6 @@ export declare type ISettings = factory.project.ISettings & {
22
22
  userPoolIdNew: string;
23
23
  maxNumCreditCardPaymentMethod?: number;
24
24
  useEventWorkPerformed: boolean;
25
- useOffersAppliedToMovieTicketWithoutChargeSpecification: boolean;
26
25
  useAggregateEntranceGateProjects: string[];
27
26
  useAggregateOfferProjects: string[];
28
27
  useOfferRateLimitProjects: string[];
@@ -94,7 +94,7 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onOrder
94
94
  timeout: triggerWebhookTimeout
95
95
  }, maximumReservationGracePeriodInDays: MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS, userPoolIdOld: String(process.env.USERPOOL_ID_OLD), userPoolIdNew: String(process.env.USERPOOL_ID_NEW) }, (typeof MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'number')
96
96
  ? { maxNumCreditCardPaymentMethod: MAX_NUM_CREDIT_CARD_PAYMENT_METHOD }
97
- : undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1', useOffersAppliedToMovieTicketWithoutChargeSpecification: process.env.USE_OFFERS_APPLIED_TO_MOVIE_TICKET_WITHOUT_PRICE_SPEC === '1', useAggregateEntranceGateProjects: (typeof process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS === 'string')
97
+ : undefined), { useEventWorkPerformed: process.env.USE_EVENT_WORK_PERFORMED === '1', useAggregateEntranceGateProjects: (typeof process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS === 'string')
98
98
  ? process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS.split(',')
99
99
  : [], useAggregateOfferProjects: (typeof process.env.USE_AGGREGATE_OFFER_PROJECTS === 'string')
100
100
  ? process.env.USE_AGGREGATE_OFFER_PROJECTS.split(',')
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.289.0-alpha.15",
12
+ "@chevre/factory": "4.289.0",
13
13
  "@cinerino/sdk": "3.140.0-alpha.16",
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.4.0-alpha.20"
123
+ "version": "20.4.0-alpha.22"
124
124
  }
@@ -1,31 +0,0 @@
1
- // tslint:disable:no-console
2
- // import * as redis from 'redis';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../lib/index';
6
-
7
- async function main() {
8
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
9
-
10
- const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
11
-
12
- const catalogs = await offerCatalogRepo.search({
13
- limit: 100,
14
- page: 1,
15
- // id: { $in: ['0001'] },
16
- itemListElement: {
17
- id: {
18
- $all: ['901', '3001']
19
- // $in: ['1001'],
20
- // $nin: ['1005']
21
- }
22
- },
23
- itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } }
24
- });
25
- console.log(catalogs);
26
- console.log(catalogs.length);
27
- }
28
-
29
- main()
30
- .then(console.log)
31
- .catch(console.error);