@chevre/domain 20.11.0-alpha.2 → 20.11.0-alpha.3
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,7 +15,7 @@ declare function validateAcceptedOffers(params: {
|
|
|
15
15
|
project: {
|
|
16
16
|
id: string;
|
|
17
17
|
};
|
|
18
|
-
screeningEvent: Pick<factory.event.screeningEvent.IEvent, 'id' | 'superEvent'>;
|
|
18
|
+
screeningEvent: Pick<factory.event.screeningEvent.IEvent, 'id' | 'superEvent' | 'coaInfo'>;
|
|
19
19
|
availablePaymentMethodTypes: factory.categoryCode.ICategoryCode[];
|
|
20
20
|
seatingTypes: factory.categoryCode.ICategoryCode[];
|
|
21
21
|
videoFormatTypes: factory.categoryCode.ICategoryCode[];
|
|
@@ -245,29 +245,46 @@ function createPriceComponent(params) {
|
|
|
245
245
|
/**
|
|
246
246
|
* 受け入れらたオファーの内容を検証
|
|
247
247
|
*/
|
|
248
|
+
// tslint:disable-next-line:max-func-body-length
|
|
248
249
|
function validateAcceptedOffers(params) {
|
|
250
|
+
// tslint:disable-next-line:max-func-body-length
|
|
249
251
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
var _a;
|
|
253
|
+
// const offerIds: string[] = (Array.isArray(params.object.acceptedOffer))
|
|
254
|
+
// ? [...new Set(params.object.acceptedOffer.map((o) => o.id))]
|
|
255
|
+
// : [];
|
|
256
|
+
const theaterCode = String((_a = params.screeningEvent.coaInfo) === null || _a === void 0 ? void 0 : _a.theaterCode);
|
|
257
|
+
const offerIdentifiers = (Array.isArray(params.object.acceptedOffer))
|
|
258
|
+
? [...new Set((params.object.acceptedOffer).map((o) => {
|
|
259
|
+
return `COA-${theaterCode}-${String(o.ticketInfo.ticketCode)}`;
|
|
260
|
+
}))]
|
|
252
261
|
: [];
|
|
253
262
|
let availableUnitPriceOffers = [];
|
|
254
263
|
// 指定された単価オファーを検索
|
|
255
|
-
|
|
264
|
+
// ticketCodeで検索(2023-03-22~)
|
|
265
|
+
// if (offerIds.length > 0) {
|
|
266
|
+
// availableUnitPriceOffers = await repos.offer.search({
|
|
267
|
+
// id: { $in: offerIds },
|
|
268
|
+
// project: { id: { $eq: params.project.id } }
|
|
269
|
+
// });
|
|
270
|
+
// }
|
|
271
|
+
if (offerIdentifiers.length > 0) {
|
|
256
272
|
availableUnitPriceOffers = yield repos.offer.search({
|
|
257
|
-
|
|
273
|
+
identifier: { $in: offerIdentifiers },
|
|
258
274
|
project: { id: { $eq: params.project.id } }
|
|
259
275
|
});
|
|
260
276
|
}
|
|
261
277
|
const acceptedOffers = params.object.acceptedOffer.map((acceptedOffer) => {
|
|
262
|
-
var _a, _b, _c, _d, _e, _f;
|
|
263
|
-
const availableUnitPriceOffer = availableUnitPriceOffers.find((unitPriceOffer) =>
|
|
278
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
279
|
+
const availableUnitPriceOffer = availableUnitPriceOffers.find((unitPriceOffer) => {
|
|
280
|
+
var _a, _b;
|
|
281
|
+
const ticketCodeByUnitPriceOffer = (_b = (_a = unitPriceOffer.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'ticketCode')) === null || _b === void 0 ? void 0 : _b.value;
|
|
282
|
+
return ticketCodeByUnitPriceOffer === acceptedOffer.ticketInfo.ticketCode;
|
|
283
|
+
});
|
|
264
284
|
if (availableUnitPriceOffer === undefined) {
|
|
265
|
-
throw new factory.errors.NotFound(factory.offerType.Offer, `${acceptedOffer.
|
|
285
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, `${acceptedOffer.ticketInfo.ticketCode} not found`);
|
|
266
286
|
}
|
|
267
287
|
const { additionalProperty, itemOffered, name, ticketInfo } = acceptedOffer;
|
|
268
|
-
// if (priceSpecification === undefined) {
|
|
269
|
-
// throw new factory.errors.NotFound('priceSpecification');
|
|
270
|
-
// }
|
|
271
288
|
// priceComponentを再生成(2023-03-14~)
|
|
272
289
|
const { priceComponent, eligibleMonetaryAmount } = createPriceComponent({
|
|
273
290
|
project: { id: params.project.id },
|
|
@@ -297,20 +314,23 @@ function validateAcceptedOffers(params) {
|
|
|
297
314
|
ticketInfo.addGlasses,
|
|
298
315
|
ticketInfo.spseatAdd1
|
|
299
316
|
].reduce((a, b) => a + b, 0);
|
|
317
|
+
const usePointValue = (_b = (_a = availableUnitPriceOffer.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'usePoint')) === null || _b === void 0 ? void 0 : _b.value;
|
|
300
318
|
return Object.assign(Object.assign({ additionalProperty,
|
|
301
319
|
itemOffered,
|
|
302
320
|
name,
|
|
303
321
|
price,
|
|
304
|
-
priceSpecification, ticketInfo: Object.assign(Object.assign({}, ticketInfo), {
|
|
322
|
+
priceSpecification, ticketInfo: Object.assign(Object.assign({}, ticketInfo), {
|
|
323
|
+
// usePointを上書き(2023-03-22~)
|
|
324
|
+
usePoint: (typeof usePointValue === 'string') ? Number(usePointValue) : 0, salePrice // COAに渡す販売金額を上書き(2023-03-20~)
|
|
305
325
|
}),
|
|
306
326
|
// 以下属性については単価オファーから読む(2023-03-09~)
|
|
307
327
|
priceCurrency: availableUnitPriceOffer.priceCurrency, id: String(availableUnitPriceOffer.id), identifier: String(availableUnitPriceOffer.identifier), typeOf: availableUnitPriceOffer.typeOf }, (Array.isArray(eligibleMonetaryAmount)) ? { eligibleMonetaryAmount } : undefined), {
|
|
308
328
|
// tslint:disable-next-line:no-suspicious-comment
|
|
309
329
|
// TODO itemOfferedに完全置き換え
|
|
310
|
-
seatNumber: (
|
|
330
|
+
seatNumber: (_e = (_d = (_c = itemOffered.serviceOutput) === null || _c === void 0 ? void 0 : _c.reservedTicket) === null || _d === void 0 ? void 0 : _d.ticketedSeat) === null || _e === void 0 ? void 0 : _e.seatNumber,
|
|
311
331
|
// tslint:disable-next-line:no-suspicious-comment
|
|
312
332
|
// TODO itemOfferedに完全置き換え
|
|
313
|
-
seatSection: (
|
|
333
|
+
seatSection: (_h = (_g = (_f = itemOffered.serviceOutput) === null || _f === void 0 ? void 0 : _f.reservedTicket) === null || _g === void 0 ? void 0 : _g.ticketedSeat) === null || _h === void 0 ? void 0 : _h.seatSection
|
|
314
334
|
});
|
|
315
335
|
});
|
|
316
336
|
return { acceptedOffers };
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.306.0",
|
|
13
13
|
"@cinerino/sdk": "3.151.0-alpha.1",
|
|
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.11.0-alpha.
|
|
123
|
+
"version": "20.11.0-alpha.3"
|
|
124
124
|
}
|