@chevre/domain 22.2.0-alpha.0 → 22.2.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/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +52 -21
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +9 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +23 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +109 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +9 -30
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
- package/package.json +2 -2
|
@@ -271,43 +271,70 @@ function validateAdvanceBookingRequirement(params) {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
function validateProgramMembershipUsed(params) {
|
|
274
|
-
// tslint:disable-next-line:max-func-body-length
|
|
274
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
275
275
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
var _a, _b, _c;
|
|
276
|
+
var _a, _b, _c, _d, _e;
|
|
277
277
|
const now = new Date();
|
|
278
278
|
let programMembershipUsed;
|
|
279
279
|
const requestedProgramMembershipUsed = (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed;
|
|
280
280
|
if (typeof requestedProgramMembershipUsed === 'string') {
|
|
281
|
-
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be
|
|
281
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be permit');
|
|
282
|
+
}
|
|
283
|
+
if ((requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.typeOf) === 'Ticket') {
|
|
284
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'must be permit');
|
|
282
285
|
}
|
|
283
286
|
const programMembershipUsedIdentifier = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.identifier;
|
|
284
287
|
const issuedThroughId = (_c = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.issuedThrough) === null || _c === void 0 ? void 0 : _c.id;
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
const issuedThroughTypeOf = (_d = requestedProgramMembershipUsed === null || requestedProgramMembershipUsed === void 0 ? void 0 : requestedProgramMembershipUsed.issuedThrough) === null || _d === void 0 ? void 0 : _d.typeOf;
|
|
289
|
+
if (typeof programMembershipUsedIdentifier === 'string') {
|
|
290
|
+
if (typeof issuedThroughId !== 'string' || issuedThroughId === '') {
|
|
287
291
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
288
292
|
}
|
|
289
293
|
let permitIssuedThrough;
|
|
290
294
|
// まずメンバーシップを検索して、存在しなければCreditCardを検索(どちらが発行元サービスか不明なので)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
|
|
296
|
+
permitIssuedThrough = (yield repos.product.searchProducts({
|
|
297
|
+
limit: 1,
|
|
298
|
+
page: 1,
|
|
299
|
+
id: { $eq: issuedThroughId },
|
|
300
|
+
typeOf: { $eq: factory.product.ProductType.MembershipService }
|
|
301
|
+
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
302
|
+
if (permitIssuedThrough === undefined) {
|
|
303
|
+
throw new factory.errors.NotFound(factory.product.ProductType.MembershipService);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
298
307
|
permitIssuedThrough = (yield repos.paymentService.searchPaymentServices({
|
|
299
308
|
limit: 1,
|
|
300
309
|
page: 1,
|
|
301
310
|
id: { $eq: issuedThroughId },
|
|
302
311
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
303
312
|
}, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
313
|
+
if (permitIssuedThrough === undefined) {
|
|
314
|
+
throw new factory.errors.NotFound(factory.service.paymentService.PaymentServiceType.CreditCard);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
else if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
318
|
+
// プロダクトは存在しないので特に検証なし
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
304
322
|
}
|
|
305
323
|
if (typeof (permitIssuedThrough === null || permitIssuedThrough === void 0 ? void 0 : permitIssuedThrough.typeOf) !== 'string') {
|
|
306
324
|
throw new factory.errors.NotFound(`Permit issuer service [${issuedThroughId}]`);
|
|
307
325
|
}
|
|
308
|
-
// permitIssuedThrough =
|
|
309
|
-
// await repos.product.findById({ id: issuedThroughId }, ['_id', 'typeOf', 'project', 'serviceType', 'serviceOutput'], []);
|
|
310
326
|
switch (permitIssuedThrough.typeOf) {
|
|
327
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
328
|
+
// 問答無用に受け入れる
|
|
329
|
+
programMembershipUsed = {
|
|
330
|
+
typeOf: factory.permit.PermitType.Permit,
|
|
331
|
+
identifier: programMembershipUsedIdentifier,
|
|
332
|
+
issuedThrough: {
|
|
333
|
+
id: '',
|
|
334
|
+
typeOf: permitIssuedThrough.typeOf
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
break;
|
|
311
338
|
// 発行サービスがCreditCardのケースに対応(2023-09-01~)
|
|
312
339
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
313
340
|
// 決済サービスのserviceOutputにPermitが存在すれば、設定されたメンバーシップ区分のPermitをprogramMembershipUsedとして適用する
|
|
@@ -320,7 +347,6 @@ function validateProgramMembershipUsed(params) {
|
|
|
320
347
|
}
|
|
321
348
|
if ((issuedThroughServiceType === null || issuedThroughServiceType === void 0 ? void 0 : issuedThroughServiceType.typeOf) === 'CategoryCode') {
|
|
322
349
|
programMembershipUsed = {
|
|
323
|
-
project: permitIssuedThrough.project,
|
|
324
350
|
typeOf: factory.permit.PermitType.Permit,
|
|
325
351
|
identifier: programMembershipUsedIdentifier,
|
|
326
352
|
issuedThrough: {
|
|
@@ -354,12 +380,17 @@ function validateProgramMembershipUsed(params) {
|
|
|
354
380
|
.isBefore(moment(now))) {
|
|
355
381
|
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', 'unavailable programMembership');
|
|
356
382
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
383
|
+
if (((_e = permitIssuedThrough.serviceType) === null || _e === void 0 ? void 0 : _e.typeOf) === 'CategoryCode') {
|
|
384
|
+
programMembershipUsed = {
|
|
385
|
+
typeOf: serviceOutput.typeOf,
|
|
386
|
+
identifier: programMembershipUsedIdentifier,
|
|
387
|
+
issuedThrough: {
|
|
388
|
+
id: permitIssuedThrough.id,
|
|
389
|
+
serviceType: permitIssuedThrough.serviceType,
|
|
390
|
+
typeOf: permitIssuedThrough.typeOf
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
363
394
|
break;
|
|
364
395
|
default:
|
|
365
396
|
throw new factory.errors.Argument('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed', `${permitIssuedThrough.typeOf} not implemented`);
|
|
@@ -197,11 +197,18 @@ function validateEligibleMembershipType(params) {
|
|
|
197
197
|
// 使用メンバーシップがeligibleMembershipに含まれればよい
|
|
198
198
|
const eligibleMembershipType = params.availableOffer.eligibleMembershipType;
|
|
199
199
|
if (Array.isArray(eligibleMembershipType)) {
|
|
200
|
-
if (
|
|
200
|
+
if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) !== factory.permit.PermitType.Permit) {
|
|
201
201
|
throw new factory.errors.Argument('programMembershipUsed', 'programMembership required');
|
|
202
202
|
}
|
|
203
|
+
const { identifier, issuedThrough } = programMembershipUsed;
|
|
204
|
+
if (typeof identifier !== 'string' || identifier === '') {
|
|
205
|
+
throw new factory.errors.Argument('programMembershipUsed', 'programMembership.identifier required');
|
|
206
|
+
}
|
|
203
207
|
// programMembershipUsed.issuedThrough.serviceTypeで検証する
|
|
204
|
-
const isEligible = eligibleMembershipType.some((membershipType) =>
|
|
208
|
+
const isEligible = eligibleMembershipType.some((membershipType) =>
|
|
209
|
+
// FaceToFaceについては問答無用に受け入れる(2024-08-14~)
|
|
210
|
+
issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace
|
|
211
|
+
|| membershipType.codeValue === issuedThrough.serviceType.codeValue);
|
|
205
212
|
if (!isEligible) {
|
|
206
213
|
throw new factory.errors.Argument('programMembershipUsed', `${programMembershipUsed.identifier} is not eligible for the offer ${params.availableOffer.id}`);
|
|
207
214
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as factory from '../../../../../factory';
|
|
2
|
+
import type { JWTCredentials } from '../../../../../credentials/jwt';
|
|
3
|
+
import type { ActionRepo } from '../../../../../repo/action';
|
|
4
|
+
import type { AuthorizationRepo } from '../../../../../repo/authorization';
|
|
5
|
+
import type { OwnershipInfoRepo } from '../../../../../repo/ownershipInfo';
|
|
6
|
+
import type { TicketRepo } from '../../../../../repo/ticket';
|
|
7
|
+
/**
|
|
8
|
+
* チケット化された適用メンバーシップをPermitに変換する
|
|
9
|
+
*/
|
|
10
|
+
declare function requestedProgramMembershipUsed2permit(params: {
|
|
11
|
+
project: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
programMembershipUsed?: factory.assetTransaction.reserve.IAcceptedProgramMembershipUsed;
|
|
15
|
+
}): (repos: {
|
|
16
|
+
action: ActionRepo;
|
|
17
|
+
authorization: AuthorizationRepo;
|
|
18
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
19
|
+
ticket: TicketRepo;
|
|
20
|
+
}, credentials: {
|
|
21
|
+
jwt: JWTCredentials;
|
|
22
|
+
}) => Promise<factory.assetTransaction.reserve.IProgramMembershipUsedAsPermit | undefined>;
|
|
23
|
+
export { requestedProgramMembershipUsed2permit };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.requestedProgramMembershipUsed2permit = void 0;
|
|
13
|
+
const factory = require("../../../../../factory");
|
|
14
|
+
const CodeService = require("../../../../code");
|
|
15
|
+
/**
|
|
16
|
+
* チケット化された適用メンバーシップをPermitに変換する
|
|
17
|
+
*/
|
|
18
|
+
// tslint:disable-next-line:max-func-body-length
|
|
19
|
+
function requestedProgramMembershipUsed2permit(params) {
|
|
20
|
+
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
let programMembershipUsedAsPermit;
|
|
23
|
+
const { programMembershipUsed } = params;
|
|
24
|
+
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
25
|
+
if (typeof programMembershipUsed === 'string') {
|
|
26
|
+
const { authorizedObject } = yield CodeService.verifyToken({
|
|
27
|
+
project: { id: params.project.id },
|
|
28
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
29
|
+
token: String(programMembershipUsed)
|
|
30
|
+
})(repos, credentials);
|
|
31
|
+
const permitOwnershipInfo = authorizedObject;
|
|
32
|
+
if (Array.isArray(permitOwnershipInfo)) {
|
|
33
|
+
throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
|
|
34
|
+
}
|
|
35
|
+
if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
36
|
+
throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
37
|
+
}
|
|
38
|
+
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
39
|
+
throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
|
|
40
|
+
}
|
|
41
|
+
const typeOfGood = permitOwnershipInfo.typeOfGood;
|
|
42
|
+
if (typeof ((_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
43
|
+
throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
44
|
+
}
|
|
45
|
+
const issuedThroughTypeOf = typeOfGood.issuedThrough.typeOf;
|
|
46
|
+
if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService
|
|
47
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.CreditCard
|
|
48
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
49
|
+
throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
50
|
+
}
|
|
51
|
+
programMembershipUsedAsPermit = {
|
|
52
|
+
identifier: String(typeOfGood.identifier),
|
|
53
|
+
issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
54
|
+
typeOf: factory.permit.PermitType.Permit
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
|
|
58
|
+
const { ticketToken } = programMembershipUsed;
|
|
59
|
+
if (typeof ticketToken === 'string') {
|
|
60
|
+
const ticket = (yield repos.ticket.search({
|
|
61
|
+
limit: 1,
|
|
62
|
+
page: 1,
|
|
63
|
+
project: { id: { $eq: params.project.id } },
|
|
64
|
+
ticketToken: { $eq: ticketToken }
|
|
65
|
+
})).shift();
|
|
66
|
+
if (ticket === undefined) {
|
|
67
|
+
throw new factory.errors.NotFound('Ticket');
|
|
68
|
+
}
|
|
69
|
+
// 承認を参照
|
|
70
|
+
const { object } = yield repos.authorization.findValidOneByCode({
|
|
71
|
+
project: { id: params.project.id },
|
|
72
|
+
code: ticket.ticketToken
|
|
73
|
+
});
|
|
74
|
+
if (object.typeOf !== 'OwnershipInfo') {
|
|
75
|
+
throw new factory.errors.Argument('programMembershipUsed', 'invalid authorization');
|
|
76
|
+
}
|
|
77
|
+
const ownershipInfoId = object.id;
|
|
78
|
+
const permitOwnershipInfo = (yield repos.ownershipInfo.search({
|
|
79
|
+
limit: 1,
|
|
80
|
+
page: 1,
|
|
81
|
+
project: { id: { $eq: params.project.id } },
|
|
82
|
+
ids: [ownershipInfoId]
|
|
83
|
+
})).shift();
|
|
84
|
+
if (permitOwnershipInfo === undefined) {
|
|
85
|
+
throw new factory.errors.NotFound('OwnershipInfo');
|
|
86
|
+
}
|
|
87
|
+
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
88
|
+
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
|
|
89
|
+
}
|
|
90
|
+
if (typeof ((_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
|
|
91
|
+
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
|
|
92
|
+
}
|
|
93
|
+
const issuedThroughTypeOf = permitOwnershipInfo.typeOfGood.issuedThrough.typeOf;
|
|
94
|
+
if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService
|
|
95
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.CreditCard
|
|
96
|
+
&& issuedThroughTypeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
97
|
+
throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
98
|
+
}
|
|
99
|
+
programMembershipUsedAsPermit = {
|
|
100
|
+
identifier: permitOwnershipInfo.typeOfGood.identifier,
|
|
101
|
+
issuedThrough: { id: permitOwnershipInfo.typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
102
|
+
typeOf: factory.permit.PermitType.Permit
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return programMembershipUsedAsPermit;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.requestedProgramMembershipUsed2permit = requestedProgramMembershipUsed2permit;
|
|
@@ -7,6 +7,7 @@ import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/even
|
|
|
7
7
|
import type { OfferRepo } from '../../../../repo/offer';
|
|
8
8
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
10
|
+
import type { OwnershipInfoRepo } from '../../../../repo/ownershipInfo';
|
|
10
11
|
import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
11
12
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
12
13
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
@@ -45,6 +46,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
45
46
|
offerCatalog: OfferCatalogRepo;
|
|
46
47
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
47
48
|
offerRateLimit: OfferRateLimitRepo;
|
|
49
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
48
50
|
paymentService: PaymentServiceRepo;
|
|
49
51
|
product: ProductRepo;
|
|
50
52
|
productOffer: ProductOfferRepo;
|
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.processStartReserve4chevre = void 0;
|
|
13
13
|
const factory = require("../../../../factory");
|
|
14
14
|
const ReserveTransactionService = require("../../../assetTransaction/reserve");
|
|
15
|
-
const CodeService = require("../../../code");
|
|
16
15
|
const factory_1 = require("./factory");
|
|
16
|
+
const requestedProgramMembershipUsed2permit_1 = require("./processStartReserve4chevre/requestedProgramMembershipUsed2permit");
|
|
17
17
|
function processStartReserve4chevre(params, options) {
|
|
18
18
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const { event, transaction, transactionNumber } = params;
|
|
@@ -46,39 +46,18 @@ function processStartReserve4chevre(params, options) {
|
|
|
46
46
|
exports.processStartReserve4chevre = processStartReserve4chevre;
|
|
47
47
|
function validateObjectWithoutDetail(params) {
|
|
48
48
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
var _a, _b, _c
|
|
49
|
+
var _a, _b, _c;
|
|
50
50
|
const objectWithoutDetail = params.object;
|
|
51
51
|
if (Array.isArray(objectWithoutDetail.acceptedOffer)) {
|
|
52
52
|
const validatedAcceptedOffersWithoutDetail = [];
|
|
53
53
|
for (let acceptedOffer of objectWithoutDetail.acceptedOffer) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})(repos, credentials);
|
|
62
|
-
const permitOwnershipInfo = authorizedObject;
|
|
63
|
-
if (Array.isArray(permitOwnershipInfo)) {
|
|
64
|
-
throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
|
|
65
|
-
}
|
|
66
|
-
if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
67
|
-
throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
68
|
-
}
|
|
69
|
-
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
70
|
-
throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
|
|
71
|
-
}
|
|
72
|
-
const typeOfGood = permitOwnershipInfo.typeOfGood;
|
|
73
|
-
const issuedThroughId = (_c = typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.id;
|
|
74
|
-
if (typeof issuedThroughId !== 'string' || issuedThroughId.length === 0) {
|
|
75
|
-
throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
76
|
-
}
|
|
77
|
-
programMembershipUsed = {
|
|
78
|
-
identifier: String(typeOfGood.identifier),
|
|
79
|
-
issuedThrough: { id: issuedThroughId }
|
|
80
|
-
};
|
|
81
|
-
acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_d = acceptedOffer.itemOffered) === null || _d === void 0 ? void 0 : _d.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed }) }) });
|
|
54
|
+
const programMembershipUsedAsPermit = yield (0, requestedProgramMembershipUsed2permit_1.requestedProgramMembershipUsed2permit)({
|
|
55
|
+
project: { id: params.project.id },
|
|
56
|
+
programMembershipUsed: (_b = (_a = acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.programMembershipUsed
|
|
57
|
+
})(repos, credentials);
|
|
58
|
+
// 適用メンバーシップがあればacceptedOfferを強制的に上書き
|
|
59
|
+
if (programMembershipUsedAsPermit !== undefined) {
|
|
60
|
+
acceptedOffer = Object.assign(Object.assign({}, acceptedOffer), { itemOffered: Object.assign(Object.assign({}, acceptedOffer.itemOffered), { serviceOutput: Object.assign(Object.assign({}, (_c = acceptedOffer.itemOffered) === null || _c === void 0 ? void 0 : _c.serviceOutput), { typeOf: factory.reservationType.EventReservation, programMembershipUsed: programMembershipUsedAsPermit }) }) });
|
|
82
61
|
}
|
|
83
62
|
validatedAcceptedOffersWithoutDetail.push(acceptedOffer);
|
|
84
63
|
}
|
|
@@ -9,6 +9,7 @@ import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
10
10
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
11
11
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
12
|
+
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
12
13
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
13
14
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
14
15
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
@@ -33,6 +34,7 @@ interface IAuthorizeRepos {
|
|
|
33
34
|
offerRateLimit: OfferRateLimitRepo;
|
|
34
35
|
orderInTransaction: OrderInTransactionRepo;
|
|
35
36
|
orderNumber: OrderNumberRepo;
|
|
37
|
+
ownershipInfo: OwnershipInfoRepo;
|
|
36
38
|
paymentService: PaymentServiceRepo;
|
|
37
39
|
priceSpecification: PriceSpecificationRepo;
|
|
38
40
|
product: ProductRepo;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.381.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.381.0-alpha.2",
|
|
13
13
|
"@cinerino/sdk": "10.5.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.4.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "22.2.0-alpha.
|
|
113
|
+
"version": "22.2.0-alpha.1"
|
|
114
114
|
}
|