@chevre/domain 20.4.0-alpha.16 → 20.4.0-alpha.17
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.
- package/example/src/chevre/searchEventTicketOffers.ts +1 -1
- package/lib/chevre/repo/mongoose/model/offer.js +12 -0
- package/lib/chevre/repo/offer.d.ts +1 -0
- package/lib/chevre/repo/offer.js +15 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -0
- package/lib/chevre/service/offer/event/authorize.js +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +21 -34
- package/lib/chevre/service/offer/factory.js +11 -14
- package/lib/chevre/service/payment/any/factory.js +28 -2
- package/package.json +3 -3
|
@@ -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: '
|
|
25
|
+
event: { id: 'ale6qiedi' },
|
|
26
26
|
onlyValid: true,
|
|
27
27
|
sort: false,
|
|
28
28
|
validateOfferRateLimit: true,
|
|
@@ -196,6 +196,18 @@ schema.index({ additionalProperty: 1, 'priceSpecification.price': 1 }, {
|
|
|
196
196
|
additionalProperty: { $exists: true }
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
|
+
schema.index({ validFrom: 1, 'priceSpecification.price': 1 }, {
|
|
200
|
+
name: 'searchByValidFrom',
|
|
201
|
+
partialFilterExpression: {
|
|
202
|
+
validFrom: { $exists: true }
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
schema.index({ validThrough: 1, 'priceSpecification.price': 1 }, {
|
|
206
|
+
name: 'searchByValidThrough',
|
|
207
|
+
partialFilterExpression: {
|
|
208
|
+
validThrough: { $exists: true }
|
|
209
|
+
}
|
|
210
|
+
});
|
|
199
211
|
mongoose.model(modelName, schema)
|
|
200
212
|
.on('index',
|
|
201
213
|
// tslint:disable-next-line:no-single-line-block-comment
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -310,6 +310,20 @@ class MongoRepository {
|
|
|
310
310
|
}
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
+
if (params.onlyValid === true) {
|
|
314
|
+
const now = new Date();
|
|
315
|
+
andConditions.push({
|
|
316
|
+
$or: [
|
|
317
|
+
{ validFrom: { $exists: false } },
|
|
318
|
+
{ validFrom: { $exists: true, $lte: now } }
|
|
319
|
+
]
|
|
320
|
+
}, {
|
|
321
|
+
$or: [
|
|
322
|
+
{ validThrough: { $exists: false } },
|
|
323
|
+
{ validThrough: { $exists: true, $gte: now } }
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
313
327
|
return andConditions;
|
|
314
328
|
}
|
|
315
329
|
/**
|
|
@@ -356,7 +370,7 @@ class MongoRepository {
|
|
|
356
370
|
serviceType: { $exists: false }
|
|
357
371
|
}
|
|
358
372
|
: undefined)
|
|
359
|
-
} }), (typeof params.limit === 'number' && typeof params.page === 'number')
|
|
373
|
+
}, onlyValid: params.onlyValid === true }), (typeof params.limit === 'number' && typeof params.page === 'number')
|
|
360
374
|
? { sort: { _id: factory.sortType.Ascending } }
|
|
361
375
|
: undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
|
|
362
376
|
offers = yield this.search(searchOffersConditions);
|
|
@@ -117,6 +117,7 @@ function addReservations(params) {
|
|
|
117
117
|
event: { id: event.id },
|
|
118
118
|
// 対応アプリケーション条件追加(2023-01-27~)
|
|
119
119
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
120
|
+
onlyValid: true,
|
|
120
121
|
sort: false,
|
|
121
122
|
addSortIndex: false,
|
|
122
123
|
validateOfferRateLimit: true
|
|
@@ -35,7 +35,7 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
35
35
|
const transportation = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
36
36
|
if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
37
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, sort: params.sort }, (!params.sort)
|
|
38
|
+
excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
|
|
39
39
|
? {
|
|
40
40
|
limit: params.limit,
|
|
41
41
|
page: params.page
|
|
@@ -81,14 +81,6 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
// paging処理を追加(2023-02-21~)
|
|
85
|
-
if (params.sort) {
|
|
86
|
-
if (typeof params.limit === 'number' && typeof params.page === 'number') {
|
|
87
|
-
const start = params.limit * (params.page - 1);
|
|
88
|
-
const end = params.limit * params.page;
|
|
89
|
-
availableOffers = availableOffers.slice(start, end);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
84
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
93
85
|
let sortIndex;
|
|
94
86
|
if (params.addSortIndex) {
|
|
@@ -157,7 +149,7 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
157
149
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
158
150
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
159
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,
|
|
160
|
-
excludeAppliesToMovieTicket, sort: params.sort }, (!params.sort)
|
|
152
|
+
excludeAppliesToMovieTicket, onlyValid: params.onlyValid === true, sort: params.sort }, (!params.sort)
|
|
161
153
|
? {
|
|
162
154
|
limit: params.limit,
|
|
163
155
|
page: params.page
|
|
@@ -222,14 +214,6 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
222
214
|
}
|
|
223
215
|
});
|
|
224
216
|
}
|
|
225
|
-
// paging処理を追加(2023-02-21~)
|
|
226
|
-
if (params.sort) {
|
|
227
|
-
if (typeof params.limit === 'number' && typeof params.page === 'number') {
|
|
228
|
-
const start = params.limit * (params.page - 1);
|
|
229
|
-
const end = params.limit * params.page;
|
|
230
|
-
availableOffers = availableOffers.slice(start, end);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
217
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
234
218
|
let sortIndex;
|
|
235
219
|
if (params.addSortIndex) {
|
|
@@ -420,7 +404,8 @@ function searchEventTicketOffers(params) {
|
|
|
420
404
|
page: params.page,
|
|
421
405
|
sort: params.sort,
|
|
422
406
|
addSortIndex: params.addSortIndex,
|
|
423
|
-
validateOfferRateLimit: params.validateOfferRateLimit
|
|
407
|
+
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
408
|
+
onlyValid: params.onlyValid === true
|
|
424
409
|
})(repos);
|
|
425
410
|
offers = searchOffersResult.ticketOffers;
|
|
426
411
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -434,7 +419,8 @@ function searchEventTicketOffers(params) {
|
|
|
434
419
|
page: params.page,
|
|
435
420
|
sort: params.sort,
|
|
436
421
|
addSortIndex: params.addSortIndex,
|
|
437
|
-
validateOfferRateLimit: params.validateOfferRateLimit
|
|
422
|
+
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
423
|
+
onlyValid: params.onlyValid === true
|
|
438
424
|
})(repos);
|
|
439
425
|
offers = searchOffersResult.ticketOffers;
|
|
440
426
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -451,21 +437,22 @@ function searchEventTicketOffers(params) {
|
|
|
451
437
|
// && o.availableAtOrFrom.some((availableApplication) => availableApplication.id === specifiedStoreId);
|
|
452
438
|
// });
|
|
453
439
|
// }
|
|
440
|
+
// mongo条件へ移行(2023-02-24~)
|
|
454
441
|
// 有効期間を適用
|
|
455
|
-
if (params.onlyValid === true) {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
442
|
+
// if (params.onlyValid === true) {
|
|
443
|
+
// offers = offers.filter((o) => {
|
|
444
|
+
// let isvalid = true;
|
|
445
|
+
// if (o.validFrom !== undefined && moment(o.validFrom)
|
|
446
|
+
// .isAfter(now)) {
|
|
447
|
+
// isvalid = false;
|
|
448
|
+
// }
|
|
449
|
+
// if (o.validThrough !== undefined && moment(o.validThrough)
|
|
450
|
+
// .isBefore(now)) {
|
|
451
|
+
// isvalid = false;
|
|
452
|
+
// }
|
|
453
|
+
// return isvalid;
|
|
454
|
+
// });
|
|
455
|
+
// }
|
|
469
456
|
for (const offer of offers) {
|
|
470
457
|
if (Array.isArray(offer.addOn)) {
|
|
471
458
|
// store.idでのフィルターをmongoに移行(2023-01-27~)
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createCompoundPriceSpec4event = void 0;
|
|
15
4
|
const factory = require("../../factory");
|
|
@@ -102,8 +91,16 @@ function createCompoundPriceSpec4event(params) {
|
|
|
102
91
|
valueAddedTaxIncluded: true,
|
|
103
92
|
priceComponent
|
|
104
93
|
};
|
|
105
|
-
//
|
|
106
|
-
const
|
|
107
|
-
|
|
94
|
+
// 必要な属性のみに限定(2023-02-24~)
|
|
95
|
+
// const { project, ...unitOfferFields4ticketOffer } = params.offer;
|
|
96
|
+
const { name, description, alternateName, color, typeOf, id, addOn, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered } = params.offer;
|
|
97
|
+
return Object.assign({
|
|
98
|
+
// ...unitOfferFields4ticketOffer,
|
|
99
|
+
name, description, alternateName, color, typeOf, id,
|
|
100
|
+
addOn, availability, availableAtOrFrom, category,
|
|
101
|
+
eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation,
|
|
102
|
+
priceCurrency,
|
|
103
|
+
validFrom, validThrough, validRateLimit, additionalProperty,
|
|
104
|
+
identifier, itemOffered, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined);
|
|
108
105
|
}
|
|
109
106
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -13,8 +13,9 @@ function creatPayTransactionStartParams(params) {
|
|
|
13
13
|
const accountId = (typeof params.accountId === 'string')
|
|
14
14
|
? params.accountId
|
|
15
15
|
: (typeof params.object.accountId === 'string') ? params.object.accountId : undefined;
|
|
16
|
+
// movieTickets最適化(2023-02-24~)
|
|
17
|
+
const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(createMovieTicket) : undefined;
|
|
16
18
|
return Object.assign(Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
|
|
17
|
-
// Sellerに変更(2022-05-30~)
|
|
18
19
|
typeOf: params.transaction.seller.typeOf,
|
|
19
20
|
id: String(params.transaction.seller.id),
|
|
20
21
|
name: (typeof params.transaction.seller.name === 'string')
|
|
@@ -38,7 +39,7 @@ function creatPayTransactionStartParams(params) {
|
|
|
38
39
|
typeOf: params.paymentServiceType,
|
|
39
40
|
// 決済サービスIDを連携(2022-04-12~)
|
|
40
41
|
id: issuedThroughId,
|
|
41
|
-
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: params.object.paymentMethod, amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(
|
|
42
|
+
paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: params.object.paymentMethod, amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined)
|
|
42
43
|
}, expires: expires }, (typeof confirmationNumber === 'string')
|
|
43
44
|
? {
|
|
44
45
|
purpose: {
|
|
@@ -51,6 +52,31 @@ function creatPayTransactionStartParams(params) {
|
|
|
51
52
|
: undefined);
|
|
52
53
|
}
|
|
53
54
|
exports.creatPayTransactionStartParams = creatPayTransactionStartParams;
|
|
55
|
+
function createMovieTicket(params) {
|
|
56
|
+
const serviceOutput = {
|
|
57
|
+
reservationFor: {
|
|
58
|
+
typeOf: params.serviceOutput.reservationFor.typeOf,
|
|
59
|
+
id: params.serviceOutput.reservationFor.id
|
|
60
|
+
},
|
|
61
|
+
reservedTicket: {
|
|
62
|
+
ticketedSeat: {
|
|
63
|
+
typeOf: factory.placeType.Seat,
|
|
64
|
+
seatNumber: params.serviceOutput.reservedTicket.ticketedSeat.seatNumber,
|
|
65
|
+
seatRow: params.serviceOutput.reservedTicket.ticketedSeat.seatRow,
|
|
66
|
+
seatSection: params.serviceOutput.reservedTicket.ticketedSeat.seatSection
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
72
|
+
typeOf: params.typeOf,
|
|
73
|
+
identifier: params.identifier,
|
|
74
|
+
accessCode: params.accessCode,
|
|
75
|
+
category: { codeValue: params.category.codeValue },
|
|
76
|
+
serviceType: params.serviceType,
|
|
77
|
+
serviceOutput
|
|
78
|
+
};
|
|
79
|
+
}
|
|
54
80
|
function createAuthorizeResult(params) {
|
|
55
81
|
var _a, _b, _c, _d;
|
|
56
82
|
const payTransactionObject = params.payTransaction.object;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.140.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.14",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.15",
|
|
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.
|
|
123
|
+
"version": "20.4.0-alpha.17"
|
|
124
124
|
}
|