@chevre/domain 23.1.0-alpha.1 → 23.1.0-alpha.11
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/assetTransaction/processReserve.ts +9 -3
- package/example/src/chevre/authorizeEventServiceOffer.ts +8 -5
- package/example/src/chevre/eventOffer/adminEventOffers.ts +67 -0
- package/example/src/chevre/member/migrateMemberIdentifier.ts +99 -0
- package/example/src/chevre/reIndex.ts +2 -2
- package/lib/chevre/repo/eventOffer.d.ts +52 -0
- package/lib/chevre/repo/eventOffer.js +191 -0
- package/lib/chevre/repo/member.d.ts +18 -1
- package/lib/chevre/repo/member.js +14 -8
- package/lib/chevre/repo/mongoose/schemas/eventOffer.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +102 -0
- package/lib/chevre/repo/mongoose/schemas/member.js +10 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +8 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +6 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +22 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +63 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +30 -30
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +10 -26
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.d.ts +23 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/verifyTicketTokenAsNeeded.js +62 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +38 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +39 -19
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +4 -3
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +42 -25
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +6 -0
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +4 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +5 -0
- package/lib/chevre/service/offer/event/authorize.js +10 -5
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +48 -0
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +123 -0
- package/lib/chevre/service/offer/event.d.ts +2 -1
- package/lib/chevre/service/offer/event.js +3 -1
- package/lib/chevre/service/offer/onEventChanged.js +29 -13
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +29 -23
- package/package.json +3 -3
|
@@ -0,0 +1,62 @@
|
|
|
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.verifyTicketTokenAsNeeded = verifyTicketTokenAsNeeded;
|
|
13
|
+
const factory = require("../../../../factory");
|
|
14
|
+
// tslint:disable-next-line:max-func-body-length
|
|
15
|
+
function verifyTicketTokenAsNeeded(params) {
|
|
16
|
+
// tslint:disable-next-line:cyclomatic-complexity
|
|
17
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
const { instrument, event } = params;
|
|
20
|
+
let acceptedEventOffer;
|
|
21
|
+
// 興行オファーチケットが指定された場合、オファーへ変換する
|
|
22
|
+
const ticketToken = (_a = instrument.find((eachInstrument) => eachInstrument.typeOf === 'Ticket')) === null || _a === void 0 ? void 0 : _a.ticketToken;
|
|
23
|
+
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
24
|
+
const placeOrderIdByInstrument = (_b = instrument.find((eachInstrument) => eachInstrument.typeOf === factory.transactionType.PlaceOrder)) === null || _b === void 0 ? void 0 : _b.id;
|
|
25
|
+
if (typeof placeOrderIdByInstrument !== 'string' || placeOrderIdByInstrument === '') {
|
|
26
|
+
throw new factory.errors.NotFound('instrument as placeOrder');
|
|
27
|
+
}
|
|
28
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
29
|
+
limit: 1,
|
|
30
|
+
page: 1,
|
|
31
|
+
project: { id: { $eq: event.project.id } },
|
|
32
|
+
ticketToken: { $eq: ticketToken }
|
|
33
|
+
}, ['ticketToken'])).shift();
|
|
34
|
+
if (ticket === undefined) {
|
|
35
|
+
throw new factory.errors.NotFound('Ticket');
|
|
36
|
+
}
|
|
37
|
+
// 承認を参照
|
|
38
|
+
const validAuthorization = yield repos.authorization.findValidOneByCode({
|
|
39
|
+
project: { id: event.project.id },
|
|
40
|
+
code: ticket.ticketToken
|
|
41
|
+
});
|
|
42
|
+
const authorizedObject = validAuthorization.object;
|
|
43
|
+
// audience検証
|
|
44
|
+
if (((_c = validAuthorization.audience) === null || _c === void 0 ? void 0 : _c.typeOf) !== factory.transactionType.PlaceOrder
|
|
45
|
+
|| validAuthorization.audience.id !== placeOrderIdByInstrument) {
|
|
46
|
+
throw new factory.errors.Argument('ticketToken', 'audience not matched with placeOrder');
|
|
47
|
+
}
|
|
48
|
+
if (authorizedObject.typeOf === factory.offerType.Offer) {
|
|
49
|
+
// イベントIDを検証
|
|
50
|
+
const eventIdMustBe = authorizedObject.itemOffered.serviceOutput.reservationFor.id;
|
|
51
|
+
if (eventIdMustBe !== event.id) {
|
|
52
|
+
throw new factory.errors.Argument('ticketToken', 'event.id not matched');
|
|
53
|
+
}
|
|
54
|
+
acceptedEventOffer = authorizedObject;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new factory.errors.Argument('ticketToken', 'must be Offer');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { acceptedEventOffer };
|
|
61
|
+
});
|
|
62
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
4
|
+
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
3
5
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
6
|
+
import type { MemberRepo } from '../../../repo/member';
|
|
4
7
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
5
8
|
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
9
|
+
import type { TicketRepo } from '../../../repo/ticket';
|
|
6
10
|
declare function validateStartRequest(params: {
|
|
7
11
|
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
12
|
+
instrument: factory.assetTransaction.reserve.IInstrument[];
|
|
8
13
|
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
9
14
|
/**
|
|
10
15
|
* アプリケーションごとのオファーを検証するかどうか
|
|
@@ -19,8 +24,40 @@ declare function validateStartRequest(params: {
|
|
|
19
24
|
id?: string;
|
|
20
25
|
};
|
|
21
26
|
}): (repos: {
|
|
27
|
+
authorization: AuthorizationRepo;
|
|
28
|
+
eventOffer: EventOfferRepo;
|
|
22
29
|
issuer: IssuerRepo;
|
|
30
|
+
member: MemberRepo;
|
|
23
31
|
memberProgram: MemberProgramRepo;
|
|
24
32
|
productOffer: ProductOfferRepo;
|
|
33
|
+
ticket: TicketRepo;
|
|
25
34
|
}) => Promise<void>;
|
|
26
|
-
|
|
35
|
+
/**
|
|
36
|
+
* アプリケーションに対して有効なイベントオファーが存在するかどうかを検証する
|
|
37
|
+
*/
|
|
38
|
+
declare function validEventOfferByApplicationExists(params: {
|
|
39
|
+
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
40
|
+
now: Date;
|
|
41
|
+
availableAt: {
|
|
42
|
+
/**
|
|
43
|
+
* 販売アプリケーションID
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* オファー承認時のticketTokenから生成されたイベントオファー
|
|
49
|
+
*/
|
|
50
|
+
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
51
|
+
/**
|
|
52
|
+
* オファー承認時の予約数
|
|
53
|
+
* 0であれば特に何も検証されない
|
|
54
|
+
*/
|
|
55
|
+
numAcceptedOffers: number;
|
|
56
|
+
}): (repos: {
|
|
57
|
+
eventOffer: EventOfferRepo;
|
|
58
|
+
issuer: IssuerRepo;
|
|
59
|
+
member: MemberRepo;
|
|
60
|
+
memberProgram: MemberProgramRepo;
|
|
61
|
+
productOffer: ProductOfferRepo;
|
|
62
|
+
}) => Promise<void>;
|
|
63
|
+
export { validateStartRequest, validEventOfferByApplicationExists };
|
|
@@ -10,10 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.validateStartRequest = validateStartRequest;
|
|
13
|
+
exports.validEventOfferByApplicationExists = validEventOfferByApplicationExists;
|
|
13
14
|
const moment = require("moment");
|
|
14
15
|
const factory = require("../../../factory");
|
|
16
|
+
const fixExtendedEventOffer_1 = require("./validateStartRequest/fixExtendedEventOffer");
|
|
15
17
|
const validateIssuedOfferIfExists_1 = require("./validateStartRequest/validateIssuedOfferIfExists");
|
|
16
18
|
const validateMemberTierIfExists_1 = require("./validateStartRequest/validateMemberTierIfExists");
|
|
19
|
+
const verifyTicketTokenAsNeeded_1 = require("./validateStartRequest/verifyTicketTokenAsNeeded");
|
|
17
20
|
function validateStartRequest(params) {
|
|
18
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
22
|
var _a;
|
|
@@ -23,11 +26,20 @@ function validateStartRequest(params) {
|
|
|
23
26
|
if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
24
27
|
throw new factory.errors.NotFound('store.id');
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
// ticketTokenから、acceptedEventOfferを生成(2025-11-18~)
|
|
30
|
+
const { acceptedEventOffer } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
27
31
|
event,
|
|
28
32
|
now,
|
|
29
33
|
availableAt: { id: params.store.id },
|
|
30
|
-
object: params.object
|
|
34
|
+
object: params.object,
|
|
35
|
+
instrument: params.instrument
|
|
36
|
+
})(repos);
|
|
37
|
+
yield validEventOfferByApplicationExists({
|
|
38
|
+
event,
|
|
39
|
+
now,
|
|
40
|
+
availableAt: { id: params.store.id },
|
|
41
|
+
acceptedEventOffer,
|
|
42
|
+
numAcceptedOffers: (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer.length : 0
|
|
31
43
|
})(repos);
|
|
32
44
|
}
|
|
33
45
|
if (params.validateEvent === true) {
|
|
@@ -36,11 +48,11 @@ function validateStartRequest(params) {
|
|
|
36
48
|
});
|
|
37
49
|
}
|
|
38
50
|
/**
|
|
39
|
-
*
|
|
51
|
+
* アプリケーションに対して有効なイベントオファーが存在するかどうかを検証する
|
|
40
52
|
*/
|
|
41
|
-
function
|
|
53
|
+
function validEventOfferByApplicationExists(params) {
|
|
42
54
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const { event, availableAt } = params;
|
|
55
|
+
const { event, availableAt, acceptedEventOffer, numAcceptedOffers } = params;
|
|
44
56
|
const acceptedDate = moment(params.now);
|
|
45
57
|
const eventOffers = event.offers;
|
|
46
58
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
@@ -67,20 +79,28 @@ function validateApplicationOffer(params) {
|
|
|
67
79
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
// support extensibleEventOffer(2025-11-11~)
|
|
83
|
+
if (eventOffers.typeOf === factory.offerType.AggregateOffer) {
|
|
84
|
+
const existingEventOffer = yield (0, fixExtendedEventOffer_1.fixExtendedEventOffer)(params)(repos);
|
|
85
|
+
// 拡張可能なオファー設定の場合のみ、オファートークンを検証する(2025-11-11~)
|
|
86
|
+
yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
|
|
87
|
+
event,
|
|
88
|
+
now: params.now,
|
|
89
|
+
eventOffer: existingEventOffer,
|
|
90
|
+
acceptedEventOffer,
|
|
91
|
+
numAcceptedOffers
|
|
92
|
+
})(repos);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// 拡張可能なオファーに場合に、有効メンバープログラムティア設定は存在しない前提
|
|
96
|
+
// 有効メンバープログラムティアが存在する場合
|
|
97
|
+
yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
|
|
98
|
+
event,
|
|
99
|
+
now: params.now,
|
|
100
|
+
makesOfferOnApplication,
|
|
101
|
+
acceptedEventOffer
|
|
102
|
+
})(repos);
|
|
103
|
+
}
|
|
84
104
|
});
|
|
85
105
|
}
|
|
86
106
|
/**
|
|
@@ -7,9 +7,6 @@ declare function createReserveTransactionStartParams(params: {
|
|
|
7
7
|
acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
|
|
8
8
|
event: {
|
|
9
9
|
id: string;
|
|
10
|
-
offers?: {
|
|
11
|
-
validForMemberTier?: factory.assetTransaction.reserve.ITokenizedMemberProgramTier;
|
|
12
|
-
};
|
|
13
10
|
};
|
|
14
11
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
15
12
|
transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'seller'>;
|
|
@@ -8,7 +8,7 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
8
8
|
const moment = require("moment");
|
|
9
9
|
const factory = require("../../../../factory");
|
|
10
10
|
function createReserveTransactionStartParams(params) {
|
|
11
|
-
var _a
|
|
11
|
+
var _a;
|
|
12
12
|
const { transaction, transactionNumber } = params;
|
|
13
13
|
const { seller } = transaction;
|
|
14
14
|
const acceptedTicketOffersWithoutDetail = (Array.isArray(params.acceptedOffers))
|
|
@@ -48,8 +48,9 @@ function createReserveTransactionStartParams(params) {
|
|
|
48
48
|
// }
|
|
49
49
|
// ]
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: {
|
|
52
|
+
id: params.event.id
|
|
53
|
+
} }, (params.broker !== undefined) ? { broker: params.broker } : undefined);
|
|
53
54
|
return {
|
|
54
55
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
55
56
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -17,7 +17,7 @@ const factory = require("../../../../../factory");
|
|
|
17
17
|
function requestedProgramMembershipUsed2permit(params) {
|
|
18
18
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b
|
|
20
|
+
var _a, _b;
|
|
21
21
|
let programMembershipUsedAsPermit;
|
|
22
22
|
const { programMembershipUsed, placeOrder } = params;
|
|
23
23
|
// discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
|
|
@@ -51,34 +51,51 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
51
51
|
const permitOwnershipInfo = object;
|
|
52
52
|
const ownedGoodType = (_a = permitOwnershipInfo.typeOfGood) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
53
53
|
if (ownedGoodType === factory.permit.PermitType.Permit) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
// discontinue(2025-11-14~)
|
|
55
|
+
throw new factory.errors.Argument('programMembershipUsed', `ownershipInfo.typeOfGood.typeOf: ${ownedGoodType} discontinued`);
|
|
56
|
+
// const issuedThroughTypeOf = permitOwnershipInfo.typeOfGood.issuedThrough?.typeOf;
|
|
57
|
+
// if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
58
|
+
// programMembershipUsedAsPermit = {
|
|
59
|
+
// identifier: permitOwnershipInfo.typeOfGood.identifier,
|
|
60
|
+
// issuedThrough: { typeOf: issuedThroughTypeOf },
|
|
61
|
+
// typeOf: factory.permit.PermitType.Permit
|
|
62
|
+
// };
|
|
63
|
+
// } else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
|
|
64
|
+
// || issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
65
|
+
// if (typeof permitOwnershipInfo.typeOfGood.issuedThrough?.id !== 'string') {
|
|
66
|
+
// throw new factory.errors.Argument(
|
|
67
|
+
// 'programMembershipUsed',
|
|
68
|
+
// 'ownershipInfo.typeOfGood.issuedThrough.id undefined'
|
|
69
|
+
// );
|
|
70
|
+
// }
|
|
71
|
+
// programMembershipUsedAsPermit = {
|
|
72
|
+
// identifier: permitOwnershipInfo.typeOfGood.identifier,
|
|
73
|
+
// issuedThrough: { id: permitOwnershipInfo.typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
74
|
+
// typeOf: factory.permit.PermitType.Permit
|
|
75
|
+
// };
|
|
76
|
+
// } else {
|
|
77
|
+
// throw new factory.errors.Argument(
|
|
78
|
+
// 'programMembershipUsed',
|
|
79
|
+
// `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`
|
|
80
|
+
// );
|
|
81
|
+
// }
|
|
82
|
+
}
|
|
83
|
+
else if (ownedGoodType === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
84
|
+
const paymentMethodId = permitOwnershipInfo.typeOfGood.serviceOutput.paymentMethodId;
|
|
85
|
+
if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
86
|
+
throw new factory.errors.Argument('programMembershipUsed', 'paymentMethodId required');
|
|
75
87
|
}
|
|
88
|
+
programMembershipUsedAsPermit = {
|
|
89
|
+
identifier: paymentMethodId,
|
|
90
|
+
issuedThrough: { typeOf: ownedGoodType },
|
|
91
|
+
typeOf: factory.permit.PermitType.Permit
|
|
92
|
+
};
|
|
76
93
|
}
|
|
77
94
|
else if (ownedGoodType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
78
95
|
// CreditCard決済の場合、決済方法所有権を受け入れる(2025-11-11~)
|
|
79
|
-
const paymentServiceId = (
|
|
96
|
+
const paymentServiceId = (_b = permitOwnershipInfo.typeOfGood) === null || _b === void 0 ? void 0 : _b.id;
|
|
80
97
|
const paymentMethodId = permitOwnershipInfo.typeOfGood.serviceOutput.paymentMethodId;
|
|
81
|
-
if (typeof
|
|
98
|
+
if (typeof paymentServiceId !== 'string' || paymentServiceId === '') {
|
|
82
99
|
throw new factory.errors.Argument('programMembershipUsed', 'paymentServiceId required');
|
|
83
100
|
}
|
|
84
101
|
if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
@@ -91,7 +108,7 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
91
108
|
};
|
|
92
109
|
}
|
|
93
110
|
else {
|
|
94
|
-
throw new factory.errors.Argument('programMembershipUsed',
|
|
111
|
+
throw new factory.errors.Argument('programMembershipUsed', `ownershipInfo.typeOfGood.typeOf: ${ownedGoodType} invalid`);
|
|
95
112
|
}
|
|
96
113
|
}
|
|
97
114
|
}
|
|
@@ -5,8 +5,10 @@ import type { AdvanceBookingRequirementRepo } from '../../../../repo/advanceBook
|
|
|
5
5
|
import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
|
|
6
6
|
import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
7
7
|
import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/event';
|
|
8
|
+
import type { EventOfferRepo } from '../../../../repo/eventOffer';
|
|
8
9
|
import { EventSeriesRepo } from '../../../../repo/eventSeries';
|
|
9
10
|
import type { IssuerRepo } from '../../../../repo/issuer';
|
|
11
|
+
import type { MemberRepo } from '../../../../repo/member';
|
|
10
12
|
import type { MemberProgramRepo } from '../../../../repo/memberProgram';
|
|
11
13
|
import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
12
14
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
@@ -28,6 +30,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
28
30
|
event: Pick<IMinimizedIndividualEvent, 'id'> & {
|
|
29
31
|
offers?: {
|
|
30
32
|
validForMemberTier?: factory.assetTransaction.reserve.ITokenizedMemberProgramTier;
|
|
33
|
+
identifier?: string;
|
|
31
34
|
};
|
|
32
35
|
};
|
|
33
36
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
@@ -41,6 +44,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
41
44
|
validateEventOfferPeriod: boolean;
|
|
42
45
|
validateEvent: boolean;
|
|
43
46
|
orderNumber: string;
|
|
47
|
+
instrument: factory.action.reserve.ITicketAsInstrument[];
|
|
44
48
|
}, options: {
|
|
45
49
|
/**
|
|
46
50
|
* 最大n日前から予約可能
|
|
@@ -52,8 +56,10 @@ declare function processStartReserve4chevre(params: {
|
|
|
52
56
|
authorization: AuthorizationRepo;
|
|
53
57
|
stockHolder: StockHolderRepo;
|
|
54
58
|
event: EventRepo;
|
|
59
|
+
eventOffer: EventOfferRepo;
|
|
55
60
|
eventSeries: EventSeriesRepo;
|
|
56
61
|
issuer: IssuerRepo;
|
|
62
|
+
member: MemberRepo;
|
|
57
63
|
memberProgram: MemberProgramRepo;
|
|
58
64
|
offer: OfferRepo;
|
|
59
65
|
offerCatalog: OfferCatalogRepo;
|
|
@@ -20,21 +20,21 @@ function processStartReserve4chevre(params, options) {
|
|
|
20
20
|
// jwt: JWTCredentials;
|
|
21
21
|
// }
|
|
22
22
|
) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
var _a, _b;
|
|
24
23
|
const { event, transaction, transactionNumber } = params;
|
|
25
24
|
let acceptedOffers4result = [];
|
|
26
25
|
// 予約取引開始
|
|
27
26
|
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
28
27
|
// object: <IObjectWithDetail>action.object,
|
|
29
|
-
acceptedOffers: params.acceptedOffers, event:
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
acceptedOffers: params.acceptedOffers, event: {
|
|
29
|
+
id: event.id
|
|
30
|
+
}, transaction,
|
|
32
31
|
transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
|
|
33
32
|
const startParamObject = yield validateObjectWithoutDetail(startParams, { id: params.transaction.id })(repos);
|
|
34
33
|
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject,
|
|
35
34
|
// discontinue preSearchedEvent(2024-07-17~)
|
|
36
35
|
// preSearchedEvent: event,
|
|
37
36
|
preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true, instrument: [
|
|
37
|
+
...params.instrument, // support Ticket(2025-11-18~)
|
|
38
38
|
{ orderNumber: params.orderNumber, typeOf: factory.order.OrderType.Order },
|
|
39
39
|
{ id: transaction.id, typeOf: transaction.typeOf }
|
|
40
40
|
] }), options)(repos, settings);
|
|
@@ -5,8 +5,10 @@ import type { AdvanceBookingRequirementRepo } from '../../../repo/advanceBooking
|
|
|
5
5
|
import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
6
6
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
7
7
|
import type { EventRepo } from '../../../repo/event';
|
|
8
|
+
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
8
9
|
import { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
10
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
11
|
+
import type { MemberRepo } from '../../../repo/member';
|
|
10
12
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
11
13
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
12
14
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
@@ -32,8 +34,10 @@ interface IAuthorizeRepos {
|
|
|
32
34
|
assetTransaction: AssetTransactionRepo;
|
|
33
35
|
authorization: AuthorizationRepo;
|
|
34
36
|
event: EventRepo;
|
|
37
|
+
eventOffer: EventOfferRepo;
|
|
35
38
|
eventSeries: EventSeriesRepo;
|
|
36
39
|
issuer: IssuerRepo;
|
|
40
|
+
member: MemberRepo;
|
|
37
41
|
memberProgram: MemberProgramRepo;
|
|
38
42
|
stockHolder: StockHolderRepo;
|
|
39
43
|
offer: OfferRepo;
|
|
@@ -76,6 +80,7 @@ declare function authorize(params: {
|
|
|
76
80
|
typeOf: factory.organizationType.Project;
|
|
77
81
|
};
|
|
78
82
|
object: IObjectWithoutDetail;
|
|
83
|
+
instrument: factory.action.reserve.ITicketAsInstrument[];
|
|
79
84
|
agent: {
|
|
80
85
|
id: string;
|
|
81
86
|
};
|
|
@@ -53,7 +53,7 @@ function authorize(params, options) {
|
|
|
53
53
|
const action = yield repos.action.start(actionAttributes);
|
|
54
54
|
try {
|
|
55
55
|
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({ acceptedOffers, event,
|
|
56
|
-
transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true, orderNumber }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined), options)(repos, settings);
|
|
56
|
+
transactionNumber, transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers, unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true, orderNumber, instrument: params.instrument }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined), options)(repos, settings);
|
|
57
57
|
acceptedOffers4result = processStartReserveResult.acceptedOffers4result;
|
|
58
58
|
// add orderInTransaction(2024-01-15~)
|
|
59
59
|
if (!noOfferSpecified) {
|
|
@@ -82,7 +82,7 @@ function authorize(params, options) {
|
|
|
82
82
|
}
|
|
83
83
|
function validateCreateRequest(params) {
|
|
84
84
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
var _a, _b
|
|
85
|
+
var _a, _b;
|
|
86
86
|
const transaction = yield repos.transaction.projectFieldsInProgressById({
|
|
87
87
|
typeOf: factory.transactionType.PlaceOrder,
|
|
88
88
|
id: params.transaction.id
|
|
@@ -98,9 +98,14 @@ function validateCreateRequest(params) {
|
|
|
98
98
|
if (typeof ((_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.id) !== 'string' || params.object.reservationFor.id.length === 0) {
|
|
99
99
|
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
const event = {
|
|
102
|
+
id: params.object.reservationFor.id,
|
|
103
|
+
typeOf: factory.eventType.ScreeningEvent // ひとまずfix(2024-07-17~)
|
|
104
|
+
// offers: {
|
|
105
|
+
// ...(typeof validForMemberTier?.token === 'string') ? { validForMemberTier } : undefined,
|
|
106
|
+
// ...(typeof eventOfferIdentifier === 'string') ? { identifier: eventOfferIdentifier } : undefined
|
|
107
|
+
// }
|
|
108
|
+
};
|
|
104
109
|
return { transaction, event };
|
|
105
110
|
});
|
|
106
111
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
4
|
+
import type { EventRepo } from '../../../repo/event';
|
|
5
|
+
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
6
|
+
import type { IssuerRepo } from '../../../repo/issuer';
|
|
7
|
+
import type { MemberRepo } from '../../../repo/member';
|
|
8
|
+
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
9
|
+
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
10
|
+
import type { TicketRepo } from '../../../repo/ticket';
|
|
11
|
+
import type { TransactionRepo } from '../../../repo/transaction';
|
|
12
|
+
declare function issueEventOfferTicket(params: {
|
|
13
|
+
now: Date;
|
|
14
|
+
audience: Pick<factory.action.authorize.offer.eventService.IPurpose, 'id'>;
|
|
15
|
+
/**
|
|
16
|
+
* イベントID
|
|
17
|
+
*/
|
|
18
|
+
eventId: string;
|
|
19
|
+
/**
|
|
20
|
+
* 拡張イベントオファーID
|
|
21
|
+
*/
|
|
22
|
+
eventOfferId?: string;
|
|
23
|
+
ticketedOffer?: Pick<factory.authorization.IOfferAsObject, 'token' | 'validForMemberTier'>;
|
|
24
|
+
author: Pick<factory.authorization.IAuthor, 'id' | 'typeOf'>;
|
|
25
|
+
project: {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
instrument: {
|
|
29
|
+
/**
|
|
30
|
+
* アプリケーションID
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}): (repos: {
|
|
35
|
+
action: ActionRepo;
|
|
36
|
+
authorization: AuthorizationRepo;
|
|
37
|
+
event: EventRepo;
|
|
38
|
+
eventOffer: EventOfferRepo;
|
|
39
|
+
issuer: IssuerRepo;
|
|
40
|
+
member: MemberRepo;
|
|
41
|
+
memberProgram: MemberProgramRepo;
|
|
42
|
+
productOffer: ProductOfferRepo;
|
|
43
|
+
ticket: TicketRepo;
|
|
44
|
+
transaction: TransactionRepo;
|
|
45
|
+
}) => Promise<{
|
|
46
|
+
ticketToken: string;
|
|
47
|
+
}>;
|
|
48
|
+
export { issueEventOfferTicket };
|