@chevre/domain 22.14.0-alpha.2 → 22.14.0-alpha.20
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/authorizeEventServiceOffer.ts +119 -0
- package/example/src/chevre/findReservationByCode.ts +0 -1
- 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/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +65 -47
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/mongoose/schemas/productOffer.d.ts +36 -0
- package/lib/chevre/repo/mongoose/schemas/{offer/event.js → productOffer.js} +9 -53
- package/lib/chevre/repo/note.d.ts +15 -3
- package/lib/chevre/repo/note.js +19 -1
- package/lib/chevre/repo/productOffer.d.ts +60 -65
- package/lib/chevre/repo/productOffer.js +121 -163
- package/lib/chevre/repo/task.js +2 -2
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -15
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +79 -57
- package/lib/chevre/service/event.js +10 -2
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -3
- 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/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/deleteOrder.js +1 -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/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.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +3 -2
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +1 -1
- package/lib/chevre/service/task/deletePerson.js +11 -10
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +13 -6
- package/lib/chevre/service/task/onResourceUpdated.js +1 -2
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +9 -9
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/package.json +2 -2
- package/example/src/chevre/eventOffer/adminEventOffers.ts +0 -67
- package/example/src/chevre/migrateDeleteTransactionTasks.ts +0 -132
- package/example/src/chevre/optimizeDeleteTransactionTasks.ts +0 -119
- package/example/src/chevre/upsertMoviesByIdentifier.ts +0 -58
- package/lib/chevre/repo/mongoose/schemas/offer/event.d.ts +0 -10
- 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,36 @@ 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
|
-
const
|
|
81
|
+
// 有効なプロダクトオファーを検証
|
|
82
|
+
const productOfferForMemberTier = (yield repos.productOffer.findProductOffers({
|
|
84
83
|
limit: 1,
|
|
85
84
|
page: 1,
|
|
86
85
|
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
|
-
let validFromMoment;
|
|
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}`);
|
|
86
|
+
// availableAtOrFrom: { id: { $eq: availableAt.id } },
|
|
87
|
+
itemOffered: { identifier: { $eq: aggregateOfferIdentifier } }, // オファーコレクションコード
|
|
88
|
+
validForMemberTier: { identifier: { $eq: tierIdentifier } },
|
|
89
|
+
validFrom: { $lte: acceptedDate.toDate() },
|
|
90
|
+
validThrough: { $gte: acceptedDate.toDate() }
|
|
91
|
+
}, ['identifier'])).shift();
|
|
92
|
+
if (productOfferForMemberTier === undefined) {
|
|
93
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, 'product offer for member tier not found');
|
|
103
94
|
}
|
|
95
|
+
// let validThroughMoment: moment.Moment;
|
|
96
|
+
// let validFromMoment: moment.Moment;
|
|
97
|
+
// validThroughMoment = moment(productOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
|
|
98
|
+
// validFromMoment = moment(productOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
|
|
99
|
+
// if (acceptedDate.isBefore(validFromMoment)) {
|
|
100
|
+
// throw new factory.errors.Argument(
|
|
101
|
+
// 'reservationFor.offers.validForMemberTier',
|
|
102
|
+
// `the offer id valid from ${validFromMoment}`
|
|
103
|
+
// );
|
|
104
|
+
// }
|
|
105
|
+
// if (acceptedDate.isAfter(validThroughMoment)) {
|
|
106
|
+
// throw new factory.errors.Argument(
|
|
107
|
+
// 'reservationFor.offers.validForMemberTier',
|
|
108
|
+
// `the offer id valid through ${validThroughMoment}`
|
|
109
|
+
// );
|
|
110
|
+
// }
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
113
|
/**
|
|
@@ -108,19 +115,19 @@ function validateMemberTier(params) {
|
|
|
108
115
|
*/
|
|
109
116
|
function validateEventOfferPeriod(params) {
|
|
110
117
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
var _a
|
|
112
|
-
const { event, availableAt,
|
|
118
|
+
var _a;
|
|
119
|
+
const { event, availableAt, tokenizedMemberProgramTier } = params;
|
|
113
120
|
const acceptedDate = moment(params.now);
|
|
114
121
|
const eventOffers = event.offers;
|
|
115
122
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
116
123
|
const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
|
|
117
124
|
var _a, _b;
|
|
118
125
|
// 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) ===
|
|
126
|
+
return (Array.isArray(offer.availableAtOrFrom) && ((_a = offer.availableAtOrFrom.at(0)) === null || _a === void 0 ? void 0 : _a.id) === availableAt.id)
|
|
127
|
+
|| (!Array.isArray(offer.availableAtOrFrom) && ((_b = offer.availableAtOrFrom) === null || _b === void 0 ? void 0 : _b.id) === availableAt.id);
|
|
121
128
|
});
|
|
122
129
|
if (makesOfferOnApplication === undefined) {
|
|
123
|
-
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${
|
|
130
|
+
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${availableAt.id}`);
|
|
124
131
|
}
|
|
125
132
|
const validFrom = makesOfferOnApplication.validFrom;
|
|
126
133
|
const validThrough = makesOfferOnApplication.validThrough;
|
|
@@ -136,38 +143,53 @@ function validateEventOfferPeriod(params) {
|
|
|
136
143
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
137
144
|
}
|
|
138
145
|
}
|
|
146
|
+
// 有効メンバープログラムティアが存在する場合
|
|
139
147
|
// support validForMemberTier(2025-05-14~)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
if (makesOfferOnApplication.typeOf === factory.offerType.AggregateOffer) {
|
|
149
|
+
const validForMemberTierExists = makesOfferOnApplication.validForMemberTier.typeOf === 'MemberProgramTier';
|
|
150
|
+
if (validForMemberTierExists) {
|
|
151
|
+
const validForMemberTierToken = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.token;
|
|
152
|
+
const memberProgramIdentifierMustBe = (_a = tokenizedMemberProgramTier === null || tokenizedMemberProgramTier === void 0 ? void 0 : tokenizedMemberProgramTier.isTierOf) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
153
|
+
// ティアトークンが必須
|
|
154
|
+
if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
|
|
155
|
+
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.token');
|
|
156
|
+
}
|
|
157
|
+
// メンバープログラムコード指定が必須
|
|
158
|
+
if (typeof memberProgramIdentifierMustBe !== 'string' || memberProgramIdentifierMustBe === '') {
|
|
159
|
+
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier.isTierOf.identifier');
|
|
160
|
+
}
|
|
161
|
+
// 有効メンバープログラムティアが存在する場合、オファーコレクションコードが必須
|
|
162
|
+
const aggregateOfferIdentifier = makesOfferOnApplication.identifier;
|
|
163
|
+
if (typeof aggregateOfferIdentifier !== 'string' || aggregateOfferIdentifier === '') {
|
|
164
|
+
throw new factory.errors.NotFound('makesOfferOnApplication.identifier');
|
|
165
|
+
}
|
|
166
|
+
// トークン検証
|
|
167
|
+
const memberProgram = (yield repos.memberProgram.projectMemberPrograms({
|
|
168
|
+
limit: 1,
|
|
169
|
+
page: 1,
|
|
170
|
+
project: { id: { $eq: params.event.project.id } },
|
|
171
|
+
identifier: { $eq: memberProgramIdentifierMustBe }
|
|
172
|
+
})).shift();
|
|
173
|
+
if (memberProgram === undefined) {
|
|
174
|
+
throw new factory.errors.NotFound('MemberProgram', `MemberProgram '${memberProgramIdentifierMustBe}' not found`);
|
|
175
|
+
}
|
|
176
|
+
const issuer = yield repos.issuer.findByIdentifier({
|
|
177
|
+
project: { id: params.event.project.id },
|
|
178
|
+
identifier: memberProgram.hostingOrganization.identifier
|
|
179
|
+
});
|
|
180
|
+
if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
|
|
181
|
+
throw new factory.errors.NotFound('issuer.tokenSecret');
|
|
182
|
+
}
|
|
183
|
+
const verifiedValidForMemberTier = yield verifyOfferedByToken({
|
|
184
|
+
secret: issuer.tokenSecret,
|
|
185
|
+
issuer: issuer.url,
|
|
186
|
+
token: validForMemberTierToken
|
|
187
|
+
});
|
|
188
|
+
yield validateMemberTier({
|
|
189
|
+
event, acceptedDate, verifiedValidForMemberTier,
|
|
190
|
+
memberProgramIdentifierMustBe, aggregateOfferIdentifier
|
|
191
|
+
})(repos);
|
|
161
192
|
}
|
|
162
|
-
const verifiedValidForMemberTier = yield verifyOfferedByToken({
|
|
163
|
-
secret: issuer.tokenSecret,
|
|
164
|
-
issuer: issuer.url,
|
|
165
|
-
token: validForMemberTierToken
|
|
166
|
-
});
|
|
167
|
-
yield validateMemberTier({
|
|
168
|
-
event, availableAt, acceptedDate, verifiedValidForMemberTier,
|
|
169
|
-
memberProgramIdentifierMustBe
|
|
170
|
-
})(repos);
|
|
171
193
|
}
|
|
172
194
|
});
|
|
173
195
|
}
|
|
@@ -63,7 +63,8 @@ function importFromCOA(params) {
|
|
|
63
63
|
object: Object.assign(Object.assign({}, params), { startDate: `${moment(targetImportFrom) // debug(2024-04-26~)
|
|
64
64
|
.toISOString()}/${moment(targetImportThrough)
|
|
65
65
|
.toISOString()}`, superEvent: { location: { branchCode: params.locationBranchCode } }, typeOf: factory.eventType.ScreeningEvent }),
|
|
66
|
-
instrument
|
|
66
|
+
instrument,
|
|
67
|
+
targetCollection: { typeOf: factory.eventType.ScreeningEvent }
|
|
67
68
|
};
|
|
68
69
|
const action = yield repos.action.start(actionAttributes);
|
|
69
70
|
let savedScreeningEventsCount = 0;
|
|
@@ -150,7 +151,8 @@ function processUpdateMovieTheater(params) {
|
|
|
150
151
|
theaterCode: params.locationBranchCode,
|
|
151
152
|
typeOf: 'WebAPI',
|
|
152
153
|
identifier: factory.service.webAPI.Identifier.COA
|
|
153
|
-
}
|
|
154
|
+
},
|
|
155
|
+
targetCollection: { typeOf: factory.placeType.MovieTheater }
|
|
154
156
|
};
|
|
155
157
|
const action = yield repos.action.start(actionAttributes);
|
|
156
158
|
let seller;
|
|
@@ -345,6 +347,12 @@ function createScreeningEvents(params) {
|
|
|
345
347
|
// tslint:disable-next-line:max-func-body-length
|
|
346
348
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
347
349
|
const project = params.project;
|
|
350
|
+
if (typeof params.instrument.begin !== 'string') {
|
|
351
|
+
throw new factory.errors.ArgumentNull('instrument.begin');
|
|
352
|
+
}
|
|
353
|
+
if (typeof params.instrument.end !== 'string') {
|
|
354
|
+
throw new factory.errors.ArgumentNull('instrument.end');
|
|
355
|
+
}
|
|
348
356
|
// COAからイベント取得;
|
|
349
357
|
const schedulesFromCOA = yield repos.masterService.schedule({
|
|
350
358
|
theaterCode: params.instrument.theaterCode,
|
|
@@ -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>;
|
|
@@ -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';
|
|
@@ -28,7 +27,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
28
27
|
acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
|
|
29
28
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, '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
|
}
|
|
@@ -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);
|
|
@@ -44,7 +44,7 @@ function deleteOrder(params) {
|
|
|
44
44
|
// 経理レポート削除
|
|
45
45
|
yield repos.accountingReport.deleteByOrderNumber({ mainEntity: { orderNumber: order.orderNumber } });
|
|
46
46
|
// メモ削除(2024-02-15~)
|
|
47
|
-
yield repos.note.
|
|
47
|
+
yield repos.note.deleteNotesByAbout({
|
|
48
48
|
about: {
|
|
49
49
|
id: order.id,
|
|
50
50
|
typeOf: factory.order.OrderType.Order
|
|
@@ -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);
|
|
@@ -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>;
|
|
@@ -24,17 +24,19 @@ const validateOrder_1 = require("../validation/validateOrder");
|
|
|
24
24
|
/**
|
|
25
25
|
* タスク実行関数
|
|
26
26
|
*/
|
|
27
|
-
function call(
|
|
27
|
+
function call(params) {
|
|
28
28
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient }) {
|
|
29
29
|
if (redisClient === undefined) {
|
|
30
30
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
31
31
|
}
|
|
32
32
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
33
|
+
const { data } = params;
|
|
33
34
|
const actionAttributes = {
|
|
34
|
-
agent: { id:
|
|
35
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
35
36
|
object: data.object,
|
|
36
|
-
project: { id:
|
|
37
|
-
typeOf: factory.actionType.CheckAction
|
|
37
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
38
|
+
typeOf: factory.actionType.CheckAction,
|
|
39
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
|
|
38
40
|
};
|
|
39
41
|
const action = yield actionRepo.start(actionAttributes);
|
|
40
42
|
const objectTypeOf = data.object.typeOf;
|
|
@@ -43,7 +45,7 @@ function call(data) {
|
|
|
43
45
|
case factory.order.OrderType.Order:
|
|
44
46
|
yield (0, validateOrder_1.validateOrder)({
|
|
45
47
|
orderNumber: data.object.orderNumber,
|
|
46
|
-
project: { id:
|
|
48
|
+
project: { id: params.project.id }
|
|
47
49
|
})({
|
|
48
50
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
49
51
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -56,7 +58,7 @@ function call(data) {
|
|
|
56
58
|
case factory.eventType.ScreeningEvent:
|
|
57
59
|
yield (0, validateEvent_1.validateEvent)({
|
|
58
60
|
id: data.object.id,
|
|
59
|
-
project: { id:
|
|
61
|
+
project: { id: params.project.id }
|
|
60
62
|
})({
|
|
61
63
|
event: new event_1.EventRepo(connection),
|
|
62
64
|
stockHolder: new stockHolder_1.StockHolderRepo({ connection })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.CreateAccountingReport>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|