@chevre/domain 22.14.0-alpha.9 → 23.0.0-alpha.1
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/{createEventBySchedule.ts → addEventBySchedule.ts} +2 -2
- package/example/src/chevre/aggregateEventPublicFields.ts +1 -1
- package/example/src/chevre/aggregation/createAggregateEventTasks.ts +2 -2
- package/example/src/chevre/authorizeEventServiceOffer.ts +119 -0
- package/example/src/chevre/checkEventDuration.ts +1 -1
- package/example/src/chevre/findAnyEventById.ts +1 -1
- package/example/src/chevre/findReservationByCode.ts +0 -1
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +92 -0
- package/example/src/chevre/reIndex.ts +3 -1
- package/example/src/chevre/roles/addAdminProductOfferPermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -2
- package/example/src/chevre/updateEventPartiallyById.ts +1 -1
- package/lib/chevre/factory/event.d.ts +2 -4
- package/lib/chevre/repo/accountingReport.d.ts +4 -4
- package/lib/chevre/repo/accountingReport.js +1 -1
- package/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +65 -47
- package/lib/chevre/repo/event.d.ts +47 -51
- package/lib/chevre/repo/event.js +13 -112
- package/lib/chevre/repo/eventSeries.d.ts +14 -14
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -6
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.js +13 -14
- package/lib/chevre/repo/mongoose/schemas/product.js +14 -4
- package/lib/chevre/repo/mongoose/schemas/{offer/event.d.ts → productOffer.d.ts} +6 -3
- package/lib/chevre/repo/mongoose/schemas/{offer/event.js → productOffer.js} +26 -29
- package/lib/chevre/repo/mongoose/schemas/seller.js +17 -6
- package/lib/chevre/repo/productOffer.d.ts +36 -61
- package/lib/chevre/repo/productOffer.js +163 -157
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -15
- package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +2 -6
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -19
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +1 -3
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +1 -6
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -4
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +3 -3
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +57 -32
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/checkAvailability.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/onEventChanged.js +2 -19
- package/lib/chevre/service/offer/product.d.ts +0 -3
- package/lib/chevre/service/offer/product.js +29 -38
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +2 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -2
- package/lib/chevre/service/task/checkResource.d.ts +2 -2
- package/lib/chevre/service/task/checkResource.js +8 -6
- package/lib/chevre/service/task/createAccountingReport.d.ts +2 -2
- package/lib/chevre/service/task/createAccountingReport.js +15 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +2 -1
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -6
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/lib/chevre/service/validation/validateEvent.js +1 -1
- package/package.json +3 -3
- package/example/src/chevre/eventOffer/adminEventOffers.ts +0 -67
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +0 -48
- package/example/src/chevre/upsertMoviesByIdentifier.ts +0 -58
- package/lib/chevre/repo/offer/event.d.ts +0 -38
- package/lib/chevre/repo/offer/event.js +0 -142
|
@@ -13,7 +13,6 @@ exports.validateStartRequest = validateStartRequest;
|
|
|
13
13
|
const jwt = require("jsonwebtoken");
|
|
14
14
|
const moment = require("moment");
|
|
15
15
|
const factory = require("../../../factory");
|
|
16
|
-
const ROLE_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
17
16
|
function verifyOfferedByToken(params) {
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
let result;
|
|
@@ -55,9 +54,9 @@ function validateStartRequest(params) {
|
|
|
55
54
|
if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
56
55
|
throw new factory.errors.NotFound('store.id');
|
|
57
56
|
}
|
|
58
|
-
const
|
|
57
|
+
const tokenizedMemberProgramTier = (_c = (_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.offers) === null || _c === void 0 ? void 0 : _c.validForMemberTier;
|
|
59
58
|
yield validateEventOfferPeriod(Object.assign({ event,
|
|
60
|
-
now, availableAt: { id: params.store.id } }, (typeof
|
|
59
|
+
now, availableAt: { id: params.store.id } }, (typeof (tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token) === 'string') ? { tokenizedMemberProgramTier } : undefined))(repos);
|
|
61
60
|
}
|
|
62
61
|
if (params.validateEvent === true) {
|
|
63
62
|
validateEvent({ event, object: params.object });
|
|
@@ -67,7 +66,7 @@ function validateStartRequest(params) {
|
|
|
67
66
|
function validateMemberTier(params) {
|
|
68
67
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
69
68
|
var _a, _b, _c, _d, _e;
|
|
70
|
-
const { acceptedDate, event,
|
|
69
|
+
const { acceptedDate, event, verifiedValidForMemberTier, memberProgramIdentifierMustBe, aggregateOfferIdentifier } = params;
|
|
71
70
|
const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
72
71
|
const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
|
|
73
72
|
if (typeof tierIdentifier !== 'string') {
|
|
@@ -79,28 +78,41 @@ function validateMemberTier(params) {
|
|
|
79
78
|
if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
|
|
80
79
|
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program not matched');
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const sellerId = event.offers.seller.id;
|
|
82
|
+
if (typeof sellerId !== 'string' || sellerId === '') {
|
|
83
|
+
throw new factory.errors.NotFound('event.offers.seller.id');
|
|
84
|
+
}
|
|
85
|
+
// 有効なプロダクトオファーを検証
|
|
86
|
+
const productOfferForMemberTier = (yield repos.productOffer.findProductOffers({
|
|
84
87
|
limit: 1,
|
|
85
88
|
page: 1,
|
|
86
89
|
project: { id: { $eq: event.project.id } },
|
|
87
|
-
availableAtOrFrom: { id: { $eq: availableAt.id } },
|
|
88
|
-
itemOffered: {
|
|
89
|
-
validForMemberTier: { identifier: { $eq: tierIdentifier } }
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
validThroughMoment = moment(eventOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
|
|
97
|
-
validFromMoment = moment(eventOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
|
|
98
|
-
if (acceptedDate.isBefore(validFromMoment)) {
|
|
99
|
-
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid from ${validFromMoment}`);
|
|
100
|
-
}
|
|
101
|
-
if (acceptedDate.isAfter(validThroughMoment)) {
|
|
102
|
-
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid through ${validThroughMoment}`);
|
|
90
|
+
// availableAtOrFrom: { id: { $eq: availableAt.id } },
|
|
91
|
+
itemOffered: { identifier: { $eq: aggregateOfferIdentifier } }, // オファーコレクションコード
|
|
92
|
+
validForMemberTier: { identifier: { $eq: tierIdentifier } },
|
|
93
|
+
validFrom: { $lte: acceptedDate.toDate() },
|
|
94
|
+
validThrough: { $gte: acceptedDate.toDate() },
|
|
95
|
+
offeredBy: { id: { $eq: sellerId } } // オファー提供者も検証する
|
|
96
|
+
}, ['identifier'])).shift();
|
|
97
|
+
if (productOfferForMemberTier === undefined) {
|
|
98
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, 'valid product offers for member tier not found');
|
|
103
99
|
}
|
|
100
|
+
// let validThroughMoment: moment.Moment;
|
|
101
|
+
// let validFromMoment: moment.Moment;
|
|
102
|
+
// validThroughMoment = moment(productOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
|
|
103
|
+
// validFromMoment = moment(productOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
|
|
104
|
+
// if (acceptedDate.isBefore(validFromMoment)) {
|
|
105
|
+
// throw new factory.errors.Argument(
|
|
106
|
+
// 'reservationFor.offers.validForMemberTier',
|
|
107
|
+
// `the offer id valid from ${validFromMoment}`
|
|
108
|
+
// );
|
|
109
|
+
// }
|
|
110
|
+
// if (acceptedDate.isAfter(validThroughMoment)) {
|
|
111
|
+
// throw new factory.errors.Argument(
|
|
112
|
+
// 'reservationFor.offers.validForMemberTier',
|
|
113
|
+
// `the offer id valid through ${validThroughMoment}`
|
|
114
|
+
// );
|
|
115
|
+
// }
|
|
104
116
|
});
|
|
105
117
|
}
|
|
106
118
|
/**
|
|
@@ -109,18 +121,18 @@ function validateMemberTier(params) {
|
|
|
109
121
|
function validateEventOfferPeriod(params) {
|
|
110
122
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
111
123
|
var _a, _b;
|
|
112
|
-
const { event, availableAt,
|
|
124
|
+
const { event, availableAt, tokenizedMemberProgramTier } = params;
|
|
113
125
|
const acceptedDate = moment(params.now);
|
|
114
126
|
const eventOffers = event.offers;
|
|
115
127
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
116
128
|
const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
|
|
117
129
|
var _a, _b;
|
|
118
130
|
// support non-array(2024-10-11~)
|
|
119
|
-
return (Array.isArray(offer.availableAtOrFrom) && ((_a = offer.availableAtOrFrom.at(0)) === null || _a === void 0 ? void 0 : _a.id) ===
|
|
120
|
-
|| (!Array.isArray(offer.availableAtOrFrom) && ((_b = offer.availableAtOrFrom) === null || _b === void 0 ? void 0 : _b.id) ===
|
|
131
|
+
return (Array.isArray(offer.availableAtOrFrom) && ((_a = offer.availableAtOrFrom.at(0)) === null || _a === void 0 ? void 0 : _a.id) === availableAt.id)
|
|
132
|
+
|| (!Array.isArray(offer.availableAtOrFrom) && ((_b = offer.availableAtOrFrom) === null || _b === void 0 ? void 0 : _b.id) === availableAt.id);
|
|
121
133
|
});
|
|
122
134
|
if (makesOfferOnApplication === undefined) {
|
|
123
|
-
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${
|
|
135
|
+
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${availableAt.id}`);
|
|
124
136
|
}
|
|
125
137
|
const validFrom = makesOfferOnApplication.validFrom;
|
|
126
138
|
const validThrough = makesOfferOnApplication.validThrough;
|
|
@@ -136,11 +148,24 @@ function validateEventOfferPeriod(params) {
|
|
|
136
148
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
137
149
|
}
|
|
138
150
|
}
|
|
151
|
+
// 有効メンバープログラムティアが存在する場合
|
|
139
152
|
// support validForMemberTier(2025-05-14~)
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
153
|
+
const validForMemberTierExists = ((_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.typeOf) === 'MemberProgramTier';
|
|
154
|
+
if (validForMemberTierExists) {
|
|
155
|
+
const validForMemberTierToken = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token;
|
|
156
|
+
const memberProgramIdentifierMustBe = (_b = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.isTierOf) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
157
|
+
// ティアトークンが必須
|
|
142
158
|
if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
|
|
143
|
-
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier');
|
|
159
|
+
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.token');
|
|
160
|
+
}
|
|
161
|
+
// メンバープログラムコード指定が必須
|
|
162
|
+
if (typeof memberProgramIdentifierMustBe !== 'string' || memberProgramIdentifierMustBe === '') {
|
|
163
|
+
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.isTierOf.identifier');
|
|
164
|
+
}
|
|
165
|
+
// 有効メンバープログラムティアが存在する場合、オファーコレクションコードが必須
|
|
166
|
+
const aggregateOfferIdentifier = eventOffers.identifier;
|
|
167
|
+
if (typeof aggregateOfferIdentifier !== 'string' || aggregateOfferIdentifier === '') {
|
|
168
|
+
throw new factory.errors.NotFound('makesOfferOnApplication.identifier');
|
|
144
169
|
}
|
|
145
170
|
// トークン検証
|
|
146
171
|
const memberProgram = (yield repos.memberProgram.projectMemberPrograms({
|
|
@@ -150,7 +175,7 @@ function validateEventOfferPeriod(params) {
|
|
|
150
175
|
identifier: { $eq: memberProgramIdentifierMustBe }
|
|
151
176
|
})).shift();
|
|
152
177
|
if (memberProgram === undefined) {
|
|
153
|
-
throw new factory.errors.NotFound('MemberProgram');
|
|
178
|
+
throw new factory.errors.NotFound('MemberProgram', `MemberProgram '${memberProgramIdentifierMustBe}' not found`);
|
|
154
179
|
}
|
|
155
180
|
const issuer = yield repos.issuer.findByIdentifier({
|
|
156
181
|
project: { id: params.event.project.id },
|
|
@@ -165,8 +190,8 @@ function validateEventOfferPeriod(params) {
|
|
|
165
190
|
token: validForMemberTierToken
|
|
166
191
|
});
|
|
167
192
|
yield validateMemberTier({
|
|
168
|
-
event,
|
|
169
|
-
memberProgramIdentifierMustBe
|
|
193
|
+
event, acceptedDate, verifiedValidForMemberTier,
|
|
194
|
+
memberProgramIdentifierMustBe, aggregateOfferIdentifier
|
|
170
195
|
})(repos);
|
|
171
196
|
}
|
|
172
197
|
});
|
|
@@ -8,7 +8,7 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
8
8
|
event: {
|
|
9
9
|
id: string;
|
|
10
10
|
offers?: {
|
|
11
|
-
validForMemberTier?:
|
|
11
|
+
validForMemberTier?: factory.assetTransaction.reserve.ITokenizedMemberProgramTier;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
@@ -16,7 +16,7 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
16
16
|
transactionNumber: string;
|
|
17
17
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
18
18
|
declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
19
|
-
event: Pick<IMinimizedIndividualEvent
|
|
19
|
+
event: Pick<IMinimizedIndividualEvent, 'id'>;
|
|
20
20
|
instrument: {
|
|
21
21
|
/**
|
|
22
22
|
* 予約取引番号
|
|
@@ -48,8 +48,8 @@ function createReserveTransactionStartParams(params) {
|
|
|
48
48
|
// }
|
|
49
49
|
// ]
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: Object.assign({ id: params.event.id }, (typeof
|
|
51
|
+
const validForMemberTier = (_b = params.event.offers) === null || _b === void 0 ? void 0 : _b.validForMemberTier;
|
|
52
|
+
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: Object.assign({ id: params.event.id }, (typeof (validForMemberTier === null || validForMemberTier === void 0 ? void 0 : validForMemberTier.token) === 'string') ? { offers: { validForMemberTier } } : undefined) }, (params.broker !== undefined) ? { broker: params.broker } : undefined);
|
|
53
53
|
return {
|
|
54
54
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
55
55
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -8,7 +8,6 @@ import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/even
|
|
|
8
8
|
import { EventSeriesRepo } from '../../../../repo/eventSeries';
|
|
9
9
|
import type { IssuerRepo } from '../../../../repo/issuer';
|
|
10
10
|
import type { MemberProgramRepo } from '../../../../repo/memberProgram';
|
|
11
|
-
import type { EventOfferRepo } from '../../../../repo/offer/event';
|
|
12
11
|
import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
13
12
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
14
13
|
import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
@@ -26,9 +25,9 @@ import type { TicketRepo } from '../../../../repo/ticket';
|
|
|
26
25
|
import { IResultAcceptedOffer } from './factory';
|
|
27
26
|
declare function processStartReserve4chevre(params: {
|
|
28
27
|
acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
|
|
29
|
-
event: Pick<IMinimizedIndividualEvent
|
|
28
|
+
event: Pick<IMinimizedIndividualEvent, 'id'> & {
|
|
30
29
|
offers?: {
|
|
31
|
-
validForMemberTier?:
|
|
30
|
+
validForMemberTier?: factory.assetTransaction.reserve.ITokenizedMemberProgramTier;
|
|
32
31
|
};
|
|
33
32
|
};
|
|
34
33
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
@@ -53,7 +52,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
53
52
|
authorization: AuthorizationRepo;
|
|
54
53
|
stockHolder: StockHolderRepo;
|
|
55
54
|
event: EventRepo;
|
|
56
|
-
eventOffer: EventOfferRepo;
|
|
57
55
|
eventSeries: EventSeriesRepo;
|
|
58
56
|
issuer: IssuerRepo;
|
|
59
57
|
memberProgram: MemberProgramRepo;
|
|
@@ -20,13 +20,13 @@ function processStartReserve4chevre(params, options) {
|
|
|
20
20
|
// jwt: JWTCredentials;
|
|
21
21
|
// }
|
|
22
22
|
) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a;
|
|
23
|
+
var _a, _b;
|
|
24
24
|
const { event, transaction, transactionNumber } = params;
|
|
25
25
|
let acceptedOffers4result = [];
|
|
26
26
|
// 予約取引開始
|
|
27
27
|
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
28
28
|
// object: <IObjectWithDetail>action.object,
|
|
29
|
-
acceptedOffers: params.acceptedOffers, event: Object.assign({ id: event.id }, (typeof ((_a = event.offers) === null || _a === void 0 ? void 0 : _a.validForMemberTier) === 'string')
|
|
29
|
+
acceptedOffers: params.acceptedOffers, event: Object.assign({ id: event.id }, (typeof ((_b = (_a = event.offers) === null || _a === void 0 ? void 0 : _a.validForMemberTier) === null || _b === void 0 ? void 0 : _b.token) === 'string')
|
|
30
30
|
? { offers: { validForMemberTier: event.offers.validForMemberTier } }
|
|
31
31
|
: undefined), transaction,
|
|
32
32
|
transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
|
|
@@ -8,7 +8,6 @@ import type { EventRepo } from '../../../repo/event';
|
|
|
8
8
|
import { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
9
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
10
10
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
11
|
-
import type { EventOfferRepo } from '../../../repo/offer/event';
|
|
12
11
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
13
12
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
14
13
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
@@ -33,7 +32,6 @@ interface IAuthorizeRepos {
|
|
|
33
32
|
assetTransaction: AssetTransactionRepo;
|
|
34
33
|
authorization: AuthorizationRepo;
|
|
35
34
|
event: EventRepo;
|
|
36
|
-
eventOffer: EventOfferRepo;
|
|
37
35
|
eventSeries: EventSeriesRepo;
|
|
38
36
|
issuer: IssuerRepo;
|
|
39
37
|
memberProgram: MemberProgramRepo;
|
|
@@ -99,8 +99,8 @@ function validateCreateRequest(params) {
|
|
|
99
99
|
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
100
100
|
}
|
|
101
101
|
// support validForMemberTier(2025-05-14~)
|
|
102
|
-
const
|
|
103
|
-
const event = Object.assign({ id: params.object.reservationFor.id, typeOf: factory.eventType.ScreeningEvent }, (typeof
|
|
102
|
+
const validForMemberTier = (_c = params.object.reservationFor.offers) === null || _c === void 0 ? void 0 : _c.validForMemberTier;
|
|
103
|
+
const event = Object.assign({ id: params.object.reservationFor.id, typeOf: factory.eventType.ScreeningEvent }, (typeof (validForMemberTier === null || validForMemberTier === void 0 ? void 0 : validForMemberTier.token) === 'string') ? { offers: { validForMemberTier } } : undefined);
|
|
104
104
|
return { transaction, event };
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -2,7 +2,7 @@ import type { IMinimizedIndividualEvent } from '../../../repo/event';
|
|
|
2
2
|
import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
3
3
|
import * as factory from '../../../factory';
|
|
4
4
|
declare function checkAvailability(params: {
|
|
5
|
-
event: Pick<IMinimizedIndividualEvent
|
|
5
|
+
event: Pick<IMinimizedIndividualEvent, 'startDate' | 'project'>;
|
|
6
6
|
unitPriceOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
7
7
|
}): (repos: {
|
|
8
8
|
offerRateLimit: OfferRateLimitRepo;
|
|
@@ -213,7 +213,7 @@ function getUnacceptedPaymentMethodByEvent(params) {
|
|
|
213
213
|
*/
|
|
214
214
|
function searchEventTicketOffers(params) {
|
|
215
215
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
const eventType = params.event.typeOf;
|
|
216
|
+
// const eventType = params.event.typeOf;
|
|
217
217
|
// optimize projection(2024-07-17~)
|
|
218
218
|
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, [
|
|
219
219
|
'project', 'typeOf', 'startDate',
|
|
@@ -197,7 +197,7 @@ function getUnacceptedPaymentMethodByEvent(params) {
|
|
|
197
197
|
*/
|
|
198
198
|
function searchOffersByIds(params) {
|
|
199
199
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
const eventType = params.event.typeOf;
|
|
200
|
+
// const eventType = params.event.typeOf;
|
|
201
201
|
// optimize projection(2024-07-17~)
|
|
202
202
|
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, [
|
|
203
203
|
'project', 'typeOf', 'startDate',
|
|
@@ -32,7 +32,7 @@ export declare function responseBody2acceptedOffers4result(params: {
|
|
|
32
32
|
};
|
|
33
33
|
responseBody: IResponseBody;
|
|
34
34
|
acceptedOffer: IAcceptedOffer4COA[];
|
|
35
|
-
event: Pick<IMinimizedIndividualEvent
|
|
35
|
+
event: Pick<IMinimizedIndividualEvent, 'coaInfo' | 'doorTime' | 'endDate' | 'id' | 'location' | 'startDate' | 'superEvent' | 'typeOf' | 'identifier' | 'name'>;
|
|
36
36
|
seller: Pick<factory.transaction.placeOrder.ISeller, 'typeOf' | 'name'>;
|
|
37
37
|
bookingTime: Date;
|
|
38
38
|
totalPrice: number;
|
|
@@ -52,7 +52,7 @@ function onEventChanged(params) {
|
|
|
52
52
|
// no op
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (params.typeOf === factory.eventType.
|
|
55
|
+
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
56
56
|
if (repos.pendingReservation !== undefined) {
|
|
57
57
|
// sync pendingReservations.expires(2025-05-08~)
|
|
58
58
|
yield syncEventEndDate2pendingReservations({
|
|
@@ -105,24 +105,7 @@ function createInformTasks(params, setting) {
|
|
|
105
105
|
let events4inform;
|
|
106
106
|
// const informEvents = settings.onEventChanged.informEvent;
|
|
107
107
|
const informEvents = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
|
|
108
|
-
if (params.typeOf === factory.eventType.
|
|
109
|
-
const eventsFromDB = yield repos.event.projectEventFields({
|
|
110
|
-
id: { $in: params.ids },
|
|
111
|
-
typeOf: params.typeOf
|
|
112
|
-
}, [
|
|
113
|
-
'project', 'organizer', 'typeOf', 'name', 'doorTime', 'endDate',
|
|
114
|
-
'eventStatus', 'location', 'startDate', 'additionalProperty'
|
|
115
|
-
] // inclusion(2024-07-30~)
|
|
116
|
-
);
|
|
117
|
-
// 最適化(2024-03-26~)
|
|
118
|
-
events4inform = eventsFromDB.map(({ project, organizer, typeOf, name, doorTime, endDate, eventStatus, location, startDate, id, additionalProperty }) => {
|
|
119
|
-
return {
|
|
120
|
-
project, organizer, typeOf, name, doorTime, endDate,
|
|
121
|
-
eventStatus, location, startDate, id, additionalProperty
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
108
|
+
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
126
109
|
const screeningEvents4inform = yield repos.event.projectEventFields({
|
|
127
110
|
id: { $in: params.ids },
|
|
128
111
|
typeOf: params.typeOf
|
|
@@ -8,7 +8,6 @@ import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
|
8
8
|
import type { OrderNumberRepo } from '../../repo/orderNumber';
|
|
9
9
|
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
10
10
|
import type { ProductRepo } from '../../repo/product';
|
|
11
|
-
import type { ProductOfferRepo } from '../../repo/productOffer';
|
|
12
11
|
import type { ProjectRepo } from '../../repo/project';
|
|
13
12
|
import type { ServiceOutputRepo } from '../../repo/serviceOutput';
|
|
14
13
|
import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
|
|
@@ -24,7 +23,6 @@ export interface IAuthorizeOperationRepos {
|
|
|
24
23
|
orderNumber: OrderNumberRepo;
|
|
25
24
|
ownershipInfo: OwnershipInfoRepo;
|
|
26
25
|
product: ProductRepo;
|
|
27
|
-
productOffer: ProductOfferRepo;
|
|
28
26
|
project: ProjectRepo;
|
|
29
27
|
serviceOutput: ServiceOutputRepo;
|
|
30
28
|
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
|
|
@@ -65,7 +63,6 @@ export declare function search(params: {
|
|
|
65
63
|
offer: OfferRepo;
|
|
66
64
|
offerCatalog: OfferCatalogRepo;
|
|
67
65
|
product: ProductRepo;
|
|
68
|
-
productOffer: ProductOfferRepo;
|
|
69
66
|
}) => Promise<{
|
|
70
67
|
offers: factory.product.ITicketOffer[];
|
|
71
68
|
product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
|
|
@@ -13,7 +13,6 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
|
|
|
13
13
|
exports.search = search;
|
|
14
14
|
exports.authorize = authorize;
|
|
15
15
|
exports.voidTransaction = voidTransaction;
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../factory");
|
|
18
17
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
19
18
|
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
@@ -28,8 +27,8 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = 'Already registered';
|
|
|
28
27
|
*/
|
|
29
28
|
function search(params) {
|
|
30
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
// const now = moment();
|
|
31
31
|
var _a;
|
|
32
|
-
const now = moment();
|
|
33
32
|
const searchProductsResult = yield repos.product.projectFields({
|
|
34
33
|
limit: 1,
|
|
35
34
|
page: 1,
|
|
@@ -47,28 +46,24 @@ function search(params) {
|
|
|
47
46
|
|| product.typeOf === factory.product.ProductType.PaymentCard) {
|
|
48
47
|
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
49
48
|
if (typeof sellerId === 'string') {
|
|
50
|
-
//
|
|
51
|
-
//
|
|
49
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
50
|
+
// const productOffers = await repos.productOffer.search({
|
|
51
|
+
// project: { id: { $eq: params.project.id } },
|
|
52
|
+
// itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
53
|
+
// seller: { id: { $eq: sellerId } }
|
|
54
|
+
// });
|
|
55
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
56
|
+
// return o.seller?.id === sellerId
|
|
57
|
+
// && o.validFrom !== undefined
|
|
58
|
+
// && moment(o.validFrom)
|
|
59
|
+
// .isSameOrBefore(now)
|
|
60
|
+
// && o.validThrough !== undefined
|
|
61
|
+
// && moment(o.validThrough)
|
|
62
|
+
// .isSameOrAfter(now);
|
|
63
|
+
// });
|
|
64
|
+
// if (!hasValidOffer) {
|
|
52
65
|
// return { offers: [], product };
|
|
53
66
|
// }
|
|
54
|
-
const productOffers = yield repos.productOffer.search({
|
|
55
|
-
project: { id: { $eq: params.project.id } },
|
|
56
|
-
itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
57
|
-
seller: { id: { $eq: sellerId } }
|
|
58
|
-
});
|
|
59
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
60
|
-
var _a;
|
|
61
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
|
|
62
|
-
&& o.validFrom !== undefined
|
|
63
|
-
&& moment(o.validFrom)
|
|
64
|
-
.isSameOrBefore(now)
|
|
65
|
-
&& o.validThrough !== undefined
|
|
66
|
-
&& moment(o.validThrough)
|
|
67
|
-
.isSameOrAfter(now);
|
|
68
|
-
});
|
|
69
|
-
if (!hasValidOffer) {
|
|
70
|
-
return { offers: [], product };
|
|
71
|
-
}
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
@@ -282,7 +277,7 @@ function processVoidRegisterServiceTransaction(params) {
|
|
|
282
277
|
* 受け入れらたオファーの内容を検証
|
|
283
278
|
*/
|
|
284
279
|
function validateAcceptedOffers(params) {
|
|
285
|
-
return (
|
|
280
|
+
return (__) => __awaiter(this, void 0, void 0, function* () {
|
|
286
281
|
let acceptedOfferWithoutDetail = params.object;
|
|
287
282
|
if (!Array.isArray(acceptedOfferWithoutDetail)) {
|
|
288
283
|
acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
|
|
@@ -297,22 +292,18 @@ function validateAcceptedOffers(params) {
|
|
|
297
292
|
typeOf: params.seller.typeOf
|
|
298
293
|
};
|
|
299
294
|
// 販売者を検証
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
//
|
|
295
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
296
|
+
// const productOffers = await repos.productOffer.search({
|
|
297
|
+
// project: { id: { $eq: params.product.project.id } },
|
|
298
|
+
// itemOffered: { id: { $eq: String(params.product.id) } },
|
|
299
|
+
// seller: { id: { $eq: params.seller.id } }
|
|
300
|
+
// });
|
|
301
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
302
|
+
// return o.seller?.id === params.seller.id;
|
|
303
|
+
// });
|
|
304
|
+
// if (!hasValidOffer) {
|
|
305
|
+
// throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
303
306
|
// }
|
|
304
|
-
const productOffers = yield repos.productOffer.search({
|
|
305
|
-
project: { id: { $eq: params.product.project.id } },
|
|
306
|
-
itemOffered: { id: { $eq: String(params.product.id) } },
|
|
307
|
-
seller: { id: { $eq: params.seller.id } }
|
|
308
|
-
});
|
|
309
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
310
|
-
var _a;
|
|
311
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
|
|
312
|
-
});
|
|
313
|
-
if (!hasValidOffer) {
|
|
314
|
-
throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
315
|
-
}
|
|
316
307
|
// 利用可能なチケットオファーであれば受け入れる
|
|
317
308
|
return Promise.all(acceptedOfferWithoutDetail.map((offerWithoutDetail) => {
|
|
318
309
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
// import { createMaskedCustomer } from '../../factory/order';
|
|
16
15
|
function createAccountingReportIfNotExist(params) {
|
|
17
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
const order4report = createOrder4report(params);
|
|
@@ -116,8 +116,8 @@ function createCreateAccountingReportTask(order) {
|
|
|
116
116
|
numberOfTried: 0,
|
|
117
117
|
executionResults: [],
|
|
118
118
|
data: {
|
|
119
|
-
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
-
project: { id: order.project.id }
|
|
119
|
+
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
+
// project: { id: order.project.id }
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
return [task];
|
|
@@ -127,7 +127,7 @@ function createCheckResourceTask(order) {
|
|
|
127
127
|
orderNumber: order.orderNumber,
|
|
128
128
|
typeOf: order.typeOf
|
|
129
129
|
},
|
|
130
|
-
project: order.project,
|
|
130
|
+
// project: order.project,
|
|
131
131
|
typeOf: factory.actionType.CheckAction
|
|
132
132
|
};
|
|
133
133
|
const taskIdentifier = util.format('%s:%s:%s:%s', order.project.id, factory.taskName.CheckResource, order.typeOf, order.orderNumber);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as surfrock from '@surfrock/sdk';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
4
|
-
type IEvent4seatInfoSync = Pick<IMinimizedIndividualEvent
|
|
5
|
-
location: Pick<factory.event.
|
|
4
|
+
type IEvent4seatInfoSync = Pick<IMinimizedIndividualEvent, 'id' | 'coaInfo' | 'startDate'> & {
|
|
5
|
+
location: Pick<factory.event.screeningEvent.ILocation, 'branchCode'>;
|
|
6
6
|
offers: {
|
|
7
7
|
offeredThrough?: factory.event.screeningEvent.IOfferedThrough | factory.event.screeningEvent.IOffer4COA['offeredThrough'];
|
|
8
8
|
};
|
|
@@ -8,7 +8,7 @@ interface ICheckResult {
|
|
|
8
8
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
9
9
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
10
10
|
}
|
|
11
|
-
type IEvent4checkByIdentifier = Pick<IMinimizedIndividualEvent
|
|
11
|
+
type IEvent4checkByIdentifier = Pick<IMinimizedIndividualEvent, 'id' | 'typeOf' | 'project' | 'coaInfo' | 'startDate'> & {
|
|
12
12
|
offers: {
|
|
13
13
|
offeredThrough?: factory.event.screeningEvent.IOfferedThrough | factory.event.screeningEvent.IOffer4COA['offeredThrough'];
|
|
14
14
|
};
|
|
@@ -28,8 +28,7 @@ function useReservation(params) {
|
|
|
28
28
|
// const ticketToken = params?.instrument?.ticketToken;
|
|
29
29
|
if (Array.isArray(params.instrument)) {
|
|
30
30
|
for (const eachInstrument of params.instrument) {
|
|
31
|
-
if (eachInstrument.typeOf ===
|
|
32
|
-
&& typeof eachInstrument.ticketToken === 'string') {
|
|
31
|
+
if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
|
|
33
32
|
ticketToken = eachInstrument.ticketToken;
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -62,7 +61,7 @@ function useReservation(params) {
|
|
|
62
61
|
};
|
|
63
62
|
// extend instrument to array(2025-02-18~)
|
|
64
63
|
const instrument = [
|
|
65
|
-
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf:
|
|
64
|
+
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf: 'Ticket' }),
|
|
66
65
|
// support orderAsInstrument(2025-02-18~)
|
|
67
66
|
...(Array.isArray(params.instrument))
|
|
68
67
|
? params.instrument.filter(({ typeOf }) => typeOf === factory.order.OrderType.Order)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as factory from '../../factory';
|
|
2
1
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
3
2
|
import type { OrderRepo } from '../../repo/order';
|
|
4
3
|
import type { TicketRepo } from '../../repo/ticket';
|
|
@@ -12,7 +11,6 @@ export declare function verifyToken4reservation(params: {
|
|
|
12
11
|
seller?: {
|
|
13
12
|
id?: string;
|
|
14
13
|
};
|
|
15
|
-
agent: factory.action.check.token.IAgent;
|
|
16
14
|
reservationId: string;
|
|
17
15
|
ticket: {
|
|
18
16
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.checkResource.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|