@chevre/domain 23.1.0-alpha.0 → 23.1.0-alpha.10
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 +23 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +62 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +2 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +24 -24
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +1 -0
- 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 +9 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +36 -16
- 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 +50 -63
- 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/onEventChanged.js +29 -13
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +1 -2
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +3 -1
- package/lib/chevre/service/payment/any/factory.d.ts +0 -1
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +37 -15
- package/lib/chevre/service/payment/any.js +6 -2
- package/package.json +3 -3
|
@@ -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,12 @@ 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
|
export { validateStartRequest };
|
|
@@ -12,8 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.validateStartRequest = validateStartRequest;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../../../factory");
|
|
15
|
+
const fixExtendedEventOffer_1 = require("./validateStartRequest/fixExtendedEventOffer");
|
|
15
16
|
const validateIssuedOfferIfExists_1 = require("./validateStartRequest/validateIssuedOfferIfExists");
|
|
16
17
|
const validateMemberTierIfExists_1 = require("./validateStartRequest/validateMemberTierIfExists");
|
|
18
|
+
const verifyTicketTokenAsNeeded_1 = require("./validateStartRequest/verifyTicketTokenAsNeeded");
|
|
17
19
|
function validateStartRequest(params) {
|
|
18
20
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
21
|
var _a;
|
|
@@ -23,11 +25,20 @@ function validateStartRequest(params) {
|
|
|
23
25
|
if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
24
26
|
throw new factory.errors.NotFound('store.id');
|
|
25
27
|
}
|
|
28
|
+
// ticketTokenから、acceptedEventOfferを生成(2025-11-18~)
|
|
29
|
+
const { acceptedEventOffer } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({
|
|
30
|
+
event,
|
|
31
|
+
now,
|
|
32
|
+
availableAt: { id: params.store.id },
|
|
33
|
+
object: params.object,
|
|
34
|
+
instrument: params.instrument
|
|
35
|
+
})(repos);
|
|
26
36
|
yield validateApplicationOffer({
|
|
27
37
|
event,
|
|
28
38
|
now,
|
|
29
39
|
availableAt: { id: params.store.id },
|
|
30
|
-
object: params.object
|
|
40
|
+
object: params.object,
|
|
41
|
+
acceptedEventOffer
|
|
31
42
|
})(repos);
|
|
32
43
|
}
|
|
33
44
|
if (params.validateEvent === true) {
|
|
@@ -40,7 +51,7 @@ function validateStartRequest(params) {
|
|
|
40
51
|
*/
|
|
41
52
|
function validateApplicationOffer(params) {
|
|
42
53
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const { event, availableAt } = params;
|
|
54
|
+
const { event, availableAt, acceptedEventOffer } = params;
|
|
44
55
|
const acceptedDate = moment(params.now);
|
|
45
56
|
const eventOffers = event.offers;
|
|
46
57
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
@@ -67,20 +78,29 @@ function validateApplicationOffer(params) {
|
|
|
67
78
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
// support extensibleEventOffer(2025-11-11~)
|
|
82
|
+
if (eventOffers.typeOf === factory.offerType.AggregateOffer) {
|
|
83
|
+
const existingEventOffer = yield (0, fixExtendedEventOffer_1.fixExtendedEventOffer)(params)(repos);
|
|
84
|
+
// 拡張可能なオファー設定の場合のみ、オファートークンを検証する(2025-11-11~)
|
|
85
|
+
yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
|
|
86
|
+
event,
|
|
87
|
+
now: params.now,
|
|
88
|
+
object: params.object,
|
|
89
|
+
eventOffer: existingEventOffer,
|
|
90
|
+
acceptedEventOffer
|
|
91
|
+
})(repos);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// 拡張可能なオファーに場合に、有効メンバープログラムティア設定は存在しない前提
|
|
95
|
+
// 有効メンバープログラムティアが存在する場合
|
|
96
|
+
yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
|
|
97
|
+
event,
|
|
98
|
+
now: params.now,
|
|
99
|
+
object: params.object,
|
|
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,
|
|
@@ -16,50 +16,13 @@ const factory = require("../../../../../factory");
|
|
|
16
16
|
*/
|
|
17
17
|
function requestedProgramMembershipUsed2permit(params) {
|
|
18
18
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
19
|
-
return (repos
|
|
20
|
-
// credentials: {
|
|
21
|
-
// jwt: JWTCredentials;
|
|
22
|
-
// }
|
|
23
|
-
) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
20
|
var _a, _b;
|
|
25
21
|
let programMembershipUsedAsPermit;
|
|
26
22
|
const { programMembershipUsed, placeOrder } = params;
|
|
27
23
|
// discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
|
|
28
24
|
if (typeof programMembershipUsed === 'string') {
|
|
29
25
|
throw new factory.errors.NotImplemented('programMembershipUsed as string not implemented');
|
|
30
|
-
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
31
|
-
// const { authorizedObject } = await CodeService.verifyToken({
|
|
32
|
-
// project: { id: params.project.id },
|
|
33
|
-
// agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
34
|
-
// token: String(programMembershipUsed)
|
|
35
|
-
// })(repos);
|
|
36
|
-
// const permitOwnershipInfo = authorizedObject;
|
|
37
|
-
// if (Array.isArray(permitOwnershipInfo)) {
|
|
38
|
-
// throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
|
|
39
|
-
// }
|
|
40
|
-
// if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
41
|
-
// throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
42
|
-
// }
|
|
43
|
-
// const typeOfGood = permitOwnershipInfo.typeOfGood;
|
|
44
|
-
// if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
45
|
-
// throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
|
|
46
|
-
// }
|
|
47
|
-
// const issuedThroughTypeOf = typeOfGood.issuedThrough?.typeOf;
|
|
48
|
-
// if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService) {
|
|
49
|
-
// throw new factory.errors.Argument('programMembershipUsed', 'must be issued through MembershipService');
|
|
50
|
-
// }
|
|
51
|
-
// if (typeof typeOfGood.issuedThrough?.id !== 'string') {
|
|
52
|
-
// throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
53
|
-
// }
|
|
54
|
-
// if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
|
|
55
|
-
// programMembershipUsedAsPermit = {
|
|
56
|
-
// identifier: typeOfGood.identifier,
|
|
57
|
-
// issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
|
|
58
|
-
// typeOf: factory.permit.PermitType.Permit
|
|
59
|
-
// };
|
|
60
|
-
// } else {
|
|
61
|
-
// throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
|
|
62
|
-
// }
|
|
63
26
|
}
|
|
64
27
|
else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
|
|
65
28
|
const { ticketToken } = programMembershipUsed;
|
|
@@ -81,47 +44,71 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
81
44
|
if (object.typeOf !== 'OwnershipInfo') {
|
|
82
45
|
throw new factory.errors.Argument('programMembershipUsed', 'invalid authorization');
|
|
83
46
|
}
|
|
84
|
-
// const ownershipInfoId = object.id;
|
|
85
|
-
// const permitOwnershipInfo = (await repos.ownershipInfo.search({
|
|
86
|
-
// limit: 1,
|
|
87
|
-
// page: 1,
|
|
88
|
-
// project: { id: { $eq: params.project.id } },
|
|
89
|
-
// ids: [ownershipInfoId],
|
|
90
|
-
// ownedFrom: now,
|
|
91
|
-
// ownedThrough: now
|
|
92
|
-
// })).shift();
|
|
93
|
-
// if (permitOwnershipInfo === undefined) {
|
|
94
|
-
// throw new factory.errors.NotFound('OwnershipInfo');
|
|
95
|
-
// }
|
|
96
47
|
// audience検証
|
|
97
48
|
if ((audience === null || audience === void 0 ? void 0 : audience.typeOf) !== factory.transactionType.PlaceOrder || audience.id !== placeOrder.id) {
|
|
98
49
|
throw new factory.errors.Argument('programMembershipUsed', 'audience not matched with placeOrder');
|
|
99
50
|
}
|
|
100
51
|
const permitOwnershipInfo = object;
|
|
101
|
-
|
|
102
|
-
|
|
52
|
+
const ownedGoodType = (_a = permitOwnershipInfo.typeOfGood) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
53
|
+
if (ownedGoodType === factory.permit.PermitType.Permit) {
|
|
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
|
+
// }
|
|
103
82
|
}
|
|
104
|
-
|
|
105
|
-
|
|
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');
|
|
87
|
+
}
|
|
106
88
|
programMembershipUsedAsPermit = {
|
|
107
|
-
identifier:
|
|
108
|
-
issuedThrough: { typeOf:
|
|
89
|
+
identifier: paymentMethodId,
|
|
90
|
+
issuedThrough: { typeOf: ownedGoodType },
|
|
109
91
|
typeOf: factory.permit.PermitType.Permit
|
|
110
92
|
};
|
|
111
93
|
}
|
|
112
|
-
else if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
94
|
+
else if (ownedGoodType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
95
|
+
// CreditCard決済の場合、決済方法所有権を受け入れる(2025-11-11~)
|
|
96
|
+
const paymentServiceId = (_b = permitOwnershipInfo.typeOfGood) === null || _b === void 0 ? void 0 : _b.id;
|
|
97
|
+
const paymentMethodId = permitOwnershipInfo.typeOfGood.serviceOutput.paymentMethodId;
|
|
98
|
+
if (typeof paymentServiceId !== 'string' || paymentServiceId === '') {
|
|
99
|
+
throw new factory.errors.Argument('programMembershipUsed', 'paymentServiceId required');
|
|
100
|
+
}
|
|
101
|
+
if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
102
|
+
throw new factory.errors.Argument('programMembershipUsed', 'paymentMethodId required');
|
|
116
103
|
}
|
|
117
104
|
programMembershipUsedAsPermit = {
|
|
118
|
-
identifier:
|
|
119
|
-
issuedThrough: { id:
|
|
105
|
+
identifier: paymentMethodId,
|
|
106
|
+
issuedThrough: { id: paymentServiceId, typeOf: ownedGoodType },
|
|
120
107
|
typeOf: factory.permit.PermitType.Permit
|
|
121
108
|
};
|
|
122
109
|
}
|
|
123
110
|
else {
|
|
124
|
-
throw new factory.errors.Argument('programMembershipUsed', `
|
|
111
|
+
throw new factory.errors.Argument('programMembershipUsed', `ownershipInfo.typeOfGood.typeOf: ${ownedGoodType} invalid`);
|
|
125
112
|
}
|
|
126
113
|
}
|
|
127
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
|
}
|
|
@@ -116,29 +116,45 @@ function createInformTasks(params, setting) {
|
|
|
116
116
|
);
|
|
117
117
|
// 最適化(2024-03-22~)
|
|
118
118
|
events4inform = screeningEvents4inform.map(({ project, organizer, typeOf, name, doorTime, endDate, eventStatus, location, startDate, superEvent, offers, id, additionalProperty, identifier }) => {
|
|
119
|
-
var _a;
|
|
120
|
-
const
|
|
121
|
-
? {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
const sellerMakesOffersAsNotification = (Array.isArray((_a = offers.seller) === null || _a === void 0 ? void 0 : _a.makesOffer))
|
|
121
|
+
? offers.seller.makesOffer.map((eventSellerMakesOffer) => {
|
|
122
|
+
return Object.assign({ availabilityEnds: eventSellerMakesOffer.availabilityEnds, availabilityStarts: eventSellerMakesOffer.availabilityStarts, validFrom: eventSellerMakesOffer.validFrom, validThrough: eventSellerMakesOffer.validThrough, availableAtOrFrom: [eventSellerMakesOffer.availableAtOrFrom] }, (typeof eventSellerMakesOffer.identifier === 'string')
|
|
123
|
+
? { identifier: eventSellerMakesOffer.identifier }
|
|
124
|
+
: undefined // support notify identifier(2025-11-01~)
|
|
125
|
+
);
|
|
126
|
+
})
|
|
127
|
+
: [];
|
|
128
|
+
let eventOfferAsNotification;
|
|
129
|
+
if (((_b = offers.offeredThrough) === null || _b === void 0 ? void 0 : _b.identifier) === factory.service.webAPI.Identifier.COA) {
|
|
130
|
+
eventOfferAsNotification = {
|
|
122
131
|
typeOf: offers.typeOf,
|
|
123
132
|
itemOffered: offers.itemOffered
|
|
124
|
-
}
|
|
125
|
-
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else if (offers.typeOf === factory.offerType.AggregateOffer) {
|
|
136
|
+
eventOfferAsNotification = {
|
|
137
|
+
typeOf: offers.typeOf,
|
|
138
|
+
itemOffered: offers.itemOffered,
|
|
139
|
+
seller: {
|
|
140
|
+
id: offers.seller.id,
|
|
141
|
+
typeOf: offers.seller.typeOf,
|
|
142
|
+
makesOffer: sellerMakesOffersAsNotification
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
eventOfferAsNotification = {
|
|
126
148
|
typeOf: offers.typeOf,
|
|
127
149
|
itemOffered: offers.itemOffered,
|
|
128
150
|
seller: {
|
|
129
151
|
id: offers.seller.id,
|
|
130
152
|
typeOf: offers.seller.typeOf,
|
|
131
153
|
// makesOfferを追加(2024-03-26~)
|
|
132
|
-
makesOffer:
|
|
133
|
-
? offers.seller.makesOffer.map((eventSellerMakesOffer) => {
|
|
134
|
-
return Object.assign({ availabilityEnds: eventSellerMakesOffer.availabilityEnds, availabilityStarts: eventSellerMakesOffer.availabilityStarts, validFrom: eventSellerMakesOffer.validFrom, validThrough: eventSellerMakesOffer.validThrough, availableAtOrFrom: [eventSellerMakesOffer.availableAtOrFrom] }, (typeof eventSellerMakesOffer.identifier === 'string')
|
|
135
|
-
? { identifier: eventSellerMakesOffer.identifier }
|
|
136
|
-
: undefined // support notify identifier(2025-11-01~)
|
|
137
|
-
);
|
|
138
|
-
})
|
|
139
|
-
: []
|
|
154
|
+
makesOffer: sellerMakesOffersAsNotification
|
|
140
155
|
}
|
|
141
156
|
};
|
|
157
|
+
}
|
|
142
158
|
return Object.assign({ project, organizer, typeOf, name, doorTime, endDate,
|
|
143
159
|
eventStatus, location, startDate, superEvent, id, additionalProperty, offers: eventOfferAsNotification }, (typeof identifier === 'string') ? { identifier } : undefined // support notify identifier(2025-11-01~)
|
|
144
160
|
);
|
|
@@ -5,7 +5,6 @@ import type { TicketRepo } from '../../../../repo/ticket';
|
|
|
5
5
|
import type { ITransactionInProgress, TransactionRepo } from '../../../../repo/transaction';
|
|
6
6
|
import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
|
|
7
7
|
import * as PayTransactionService from '../../../assetTransaction/pay';
|
|
8
|
-
import { IPermitOrInvoice } from '../verifyTicketTokenAsNeeded';
|
|
9
8
|
interface IFixTransactionNumberRepos {
|
|
10
9
|
action: ActionRepo;
|
|
11
10
|
authorization: AuthorizationRepo;
|
|
@@ -28,7 +27,7 @@ declare function fixTransactionNumber(params: {
|
|
|
28
27
|
transactionNumber: string;
|
|
29
28
|
pendingPaymentAgencyTransaction?: PayTransactionService.IPaymentAgencyTransaction;
|
|
30
29
|
creditCard?: factory.action.authorize.paymentMethod.any.ICreditCard;
|
|
31
|
-
permitOrInvoice?:
|
|
30
|
+
permitOrInvoice?: never;
|
|
32
31
|
id?: never;
|
|
33
32
|
} | {
|
|
34
33
|
/**
|
|
@@ -81,6 +81,8 @@ function fixTransactionNumber(params) {
|
|
|
81
81
|
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
82
82
|
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
83
83
|
}
|
|
84
|
-
return Object.assign(Object.assign(
|
|
84
|
+
return Object.assign(Object.assign({ transactionNumber }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined), (creditCard !== undefined) ? { creditCard } : undefined
|
|
85
|
+
// ...(permitOrInvoice !== undefined) ? { permitOrInvoice } : undefined
|
|
86
|
+
);
|
|
85
87
|
});
|
|
86
88
|
}
|
|
@@ -34,7 +34,6 @@ export declare function createMovieTicket(params: factory.action.trade.pay.IMovi
|
|
|
34
34
|
export declare function createAuthorizeResult(params: {
|
|
35
35
|
object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
|
|
36
36
|
payTransaction: Pick<factory.assetTransaction.pay.ITransaction, 'object'>;
|
|
37
|
-
permit?: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'>;
|
|
38
37
|
}): factory.action.authorize.paymentMethod.any.IResult;
|
|
39
38
|
/**
|
|
40
39
|
* 通知対象としてのアクションを最適化
|
|
@@ -11,9 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.verifyTicketTokenAsNeeded = verifyTicketTokenAsNeeded;
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
|
+
// tslint:disable-next-line:max-func-body-length
|
|
14
15
|
function verifyTicketTokenAsNeeded(params) {
|
|
16
|
+
// tslint:disable-next-line:cyclomatic-complexity
|
|
15
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a
|
|
18
|
+
var _a;
|
|
17
19
|
const { paymentServiceType, object, project } = params;
|
|
18
20
|
const { issuedThrough, ticketToken } = object;
|
|
19
21
|
let permitOrInvoice;
|
|
@@ -45,24 +47,44 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
45
47
|
}
|
|
46
48
|
if (authorizedObject.typeOf === 'OwnershipInfo') {
|
|
47
49
|
const { typeOfGood } = authorizedObject;
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
+
if (typeOfGood.typeOf === factory.permit.PermitType.Permit || typeOfGood.typeOf === 'Invoice') {
|
|
51
|
+
// discontinue(2025-11-14~)
|
|
52
|
+
throw new factory.errors.Argument('ticketToken', `typeOfGood.typeOf ${typeOfGood.typeOf} discontinued`);
|
|
53
|
+
// if (typeOfGood.issuedThrough?.typeOf !== paymentServiceType) {
|
|
54
|
+
// throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
55
|
+
// }
|
|
56
|
+
// // FaceToFace以外の場合、発行サービスIDを検証
|
|
57
|
+
// if (typeOfGood.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
58
|
+
// if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
|
|
59
|
+
// throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
// if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
|
|
63
|
+
// permitOrInvoice = { identifier: typeOfGood.identifier, typeOf: factory.permit.PermitType.Permit };
|
|
64
|
+
// } else if (typeOfGood.typeOf === 'Invoice') {
|
|
65
|
+
// // support paymentServiceType.MovieTicket(2024-11-23~)
|
|
66
|
+
// permitOrInvoice = { paymentMethodId: typeOfGood.paymentMethodId, typeOf: 'Invoice' };
|
|
67
|
+
// } else {
|
|
68
|
+
// throw new factory.errors.Argument('ticketToken', 'must be Permit or Invoice');
|
|
69
|
+
// }
|
|
50
70
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
else if (typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
72
|
+
|| typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket
|
|
73
|
+
|| typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
74
|
+
// 決済方法所有権を受け入れる(2025-11-11~)
|
|
75
|
+
if (typeOfGood.typeOf !== paymentServiceType) {
|
|
76
|
+
throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
55
77
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
permitOrInvoice = { paymentMethodId: typeOfGood.paymentMethodId, typeOf: 'Invoice' };
|
|
78
|
+
// FaceToFace以外の場合、発行サービスIDを検証
|
|
79
|
+
if (typeOfGood.typeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
80
|
+
if (typeOfGood.id !== issuedThrough.id) {
|
|
81
|
+
throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
permitOrInvoice = { paymentMethodId: typeOfGood.serviceOutput.paymentMethodId, typeOf: 'Invoice' };
|
|
63
85
|
}
|
|
64
86
|
else {
|
|
65
|
-
throw new factory.errors.Argument('ticketToken',
|
|
87
|
+
throw new factory.errors.Argument('ticketToken', `invalid typeOfGood.typeOf ${typeOfGood.typeOf}`);
|
|
66
88
|
}
|
|
67
89
|
}
|
|
68
90
|
else {
|
|
@@ -439,7 +439,7 @@ function authorize(params) {
|
|
|
439
439
|
if (typeof fixTransactionNumberResult.id === 'string') {
|
|
440
440
|
return { id: fixTransactionNumberResult.id };
|
|
441
441
|
}
|
|
442
|
-
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard
|
|
442
|
+
const { transactionNumber, pendingPaymentAgencyTransaction, creditCard } = fixTransactionNumberResult;
|
|
443
443
|
// let transactionNumber: string | undefined;
|
|
444
444
|
// let pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction | undefined;
|
|
445
445
|
// let creditCard: factory.action.authorize.paymentMethod.any.ICreditCard | undefined = params.object.creditCard;
|
|
@@ -568,7 +568,11 @@ function authorize(params) {
|
|
|
568
568
|
throw error;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
const result = (0, factory_1.createAuthorizeResult)(
|
|
571
|
+
const result = (0, factory_1.createAuthorizeResult)({
|
|
572
|
+
payTransaction,
|
|
573
|
+
object: authorizeObjectIncludingPaymentMethodDetails
|
|
574
|
+
// ...(permitOrInvoice?.typeOf === factory.permit.PermitType.Permit) ? { permit: permitOrInvoice } : undefined
|
|
575
|
+
});
|
|
572
576
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
573
577
|
return { id: action.id };
|
|
574
578
|
});
|