@chevre/domain 23.1.0-alpha.10 → 23.1.0-alpha.12
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/eventOffer/adminEventOffers.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts +1 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js +5 -4
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +6 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +10 -10
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +29 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +9 -9
- 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/payment/any/verifyTicketTokenAsNeeded.js +1 -18
- package/package.json +3 -3
|
@@ -16,7 +16,7 @@ async function main() {
|
|
|
16
16
|
const validThrough = moment(validFrom)
|
|
17
17
|
.add(1, 'hour')
|
|
18
18
|
.toDate();
|
|
19
|
-
const eventOffer: chevre.factory.eventOffer.IEventOffer = {
|
|
19
|
+
const eventOffer: Omit<chevre.factory.eventOffer.IEventOffer, 'id'> = {
|
|
20
20
|
typeOf: chevre.factory.offerType.Offer,
|
|
21
21
|
identifier: '20251113eventOffer',
|
|
22
22
|
itemOffered: {
|
package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.d.ts
CHANGED
|
@@ -14,10 +14,9 @@ declare function fixExtendedEventOffer(params: {
|
|
|
14
14
|
*/
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
|
-
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
18
17
|
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
19
18
|
}): (repos: {
|
|
20
19
|
eventOffer: EventOfferRepo;
|
|
21
20
|
member: MemberRepo;
|
|
22
|
-
}) => Promise<Pick<factory.eventOffer.IEventOffer, "identifier" | "itemOffered" | "typeOf" | "offeredBy" | "validFrom" | "validThrough">>;
|
|
21
|
+
}) => Promise<Pick<factory.eventOffer.IEventOffer, "identifier" | "itemOffered" | "typeOf" | "offeredBy" | "validFrom" | "validThrough" | "id">>;
|
|
23
22
|
export { fixExtendedEventOffer };
|
package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/fixExtendedEventOffer.js
CHANGED
|
@@ -21,8 +21,8 @@ function fixExtendedEventOffer(params) {
|
|
|
21
21
|
const { event, availableAt } = params;
|
|
22
22
|
const acceptedDate = moment(params.now);
|
|
23
23
|
// リクエストによるオファーコード指定が必須
|
|
24
|
-
const
|
|
25
|
-
if (typeof
|
|
24
|
+
const eventOfferIdMustBe = (_a = params.acceptedEventOffer) === null || _a === void 0 ? void 0 : _a.id;
|
|
25
|
+
if (typeof eventOfferIdMustBe !== 'string' || eventOfferIdMustBe === '') {
|
|
26
26
|
throw new factory.errors.ArgumentNull('ticket as instrument');
|
|
27
27
|
}
|
|
28
28
|
// アプリケーションIDからアプリケーションコードを参照
|
|
@@ -51,11 +51,12 @@ function fixExtendedEventOffer(params) {
|
|
|
51
51
|
validFrom: { $lte: acceptedDate.toDate() },
|
|
52
52
|
validThrough: { $gte: acceptedDate.toDate() },
|
|
53
53
|
itemOffered: { id: { $eq: event.id } }, // 対象イベント
|
|
54
|
-
|
|
54
|
+
id: { $eq: eventOfferIdMustBe }, // オファーID
|
|
55
|
+
// identifier: { $eq: eventOfferIdentifierMustBe }, // オファーコード
|
|
55
56
|
availableAtOrFrom: { identifier: { $eq: applicationIdentifier } } // アプリケーションコード
|
|
56
57
|
}, ['identifier', 'itemOffered', 'offeredBy', 'typeOf', 'validFrom', 'validThrough'])).shift();
|
|
57
58
|
if (existingEventOffer === undefined) {
|
|
58
|
-
throw new factory.errors.NotFound(`eventOffer: ${
|
|
59
|
+
throw new factory.errors.NotFound(`valid eventOffer: ${eventOfferIdMustBe}`);
|
|
59
60
|
}
|
|
60
61
|
return existingEventOffer;
|
|
61
62
|
});
|
|
@@ -7,9 +7,13 @@ import type { IssuerRepo } from '../../../../repo/issuer';
|
|
|
7
7
|
declare function validateIssuedOfferIfExists(params: {
|
|
8
8
|
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
|
|
9
9
|
now: Date;
|
|
10
|
-
|
|
11
|
-
eventOffer: Pick<factory.eventOffer.IEventOffer, 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough'>;
|
|
10
|
+
eventOffer: Pick<factory.eventOffer.IEventOffer, 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough' | 'id'>;
|
|
12
11
|
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
12
|
+
/**
|
|
13
|
+
* オファー承認時の予約数
|
|
14
|
+
* 0であれば特に何も検証されない
|
|
15
|
+
*/
|
|
16
|
+
numAcceptedOffers: number;
|
|
13
17
|
}): (repos: {
|
|
14
18
|
issuer: IssuerRepo;
|
|
15
19
|
}) => Promise<void>;
|
|
@@ -50,8 +50,8 @@ function verifyOfferToken(params) {
|
|
|
50
50
|
const OFFER_TOKEN_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ';
|
|
51
51
|
function validateOfferToken(params) {
|
|
52
52
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
var _a
|
|
54
|
-
const { event, acceptedDate, verifiedOffer, eventOffer } = params;
|
|
53
|
+
var _a;
|
|
54
|
+
const { event, acceptedDate, verifiedOffer, eventOffer, numAcceptedOffers } = params;
|
|
55
55
|
// イベント識別子一致検証
|
|
56
56
|
const itemOfferedIdentifier = verifiedOffer.itemOffered.identifier;
|
|
57
57
|
if (typeof itemOfferedIdentifier !== 'string' || itemOfferedIdentifier === '') {
|
|
@@ -101,7 +101,7 @@ function validateOfferToken(params) {
|
|
|
101
101
|
if (maxValue > NUM_ACCEPTED_OFFERS_MAX_VALUE) {
|
|
102
102
|
throw new factory.errors.Argument('ticketedOffer.token', `eligibleQuantity.maxValue must be <= ${NUM_ACCEPTED_OFFERS_MAX_VALUE}`);
|
|
103
103
|
}
|
|
104
|
-
const numAcceptedOffers =
|
|
104
|
+
// const numAcceptedOffers = params.object.acceptedOffer?.length;
|
|
105
105
|
if (typeof numAcceptedOffers === 'number' && numAcceptedOffers > 0) {
|
|
106
106
|
if (numAcceptedOffers > maxValue) {
|
|
107
107
|
throw new factory.errors.Argument('reservationFor.id', `Maximum number of offers exceeded`);
|
|
@@ -115,15 +115,15 @@ function validateOfferToken(params) {
|
|
|
115
115
|
function validateIssuedOfferIfExists(params) {
|
|
116
116
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
var _a, _b, _c;
|
|
118
|
-
const { event, eventOffer } = params;
|
|
118
|
+
const { event, eventOffer, numAcceptedOffers } = params;
|
|
119
119
|
const acceptedDate = moment(params.now);
|
|
120
120
|
const offerTokenIssuer = (_a = eventOffer.offeredBy) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
121
121
|
const offerTokenRequired = typeof offerTokenIssuer === 'string';
|
|
122
122
|
if (offerTokenRequired) {
|
|
123
|
-
const
|
|
123
|
+
const offerIdMustBe = (_b = params.acceptedEventOffer) === null || _b === void 0 ? void 0 : _b.id;
|
|
124
124
|
const offerToken = (_c = params.acceptedEventOffer) === null || _c === void 0 ? void 0 : _c.token;
|
|
125
|
-
if (typeof
|
|
126
|
-
throw new factory.errors.
|
|
125
|
+
if (typeof offerIdMustBe !== 'string' || offerIdMustBe === '') {
|
|
126
|
+
throw new factory.errors.NotFound('ticketedOffer.id');
|
|
127
127
|
}
|
|
128
128
|
if (typeof offerToken !== 'string' || offerToken === '') {
|
|
129
129
|
throw new factory.errors.ArgumentNull('object.reservationFor.offers.token');
|
|
@@ -131,8 +131,8 @@ function validateIssuedOfferIfExists(params) {
|
|
|
131
131
|
if (typeof eventOffer.identifier !== 'string' || eventOffer.identifier === '') {
|
|
132
132
|
throw new factory.errors.NotFound('eventOffer.identifier');
|
|
133
133
|
}
|
|
134
|
-
//
|
|
135
|
-
if (eventOffer.
|
|
134
|
+
// イベントオファーID一致検証
|
|
135
|
+
if (eventOffer.id !== offerIdMustBe) {
|
|
136
136
|
throw new factory.errors.Argument('object.reservationFor.offers.identifier', 'eventOffer.identifier not matched');
|
|
137
137
|
}
|
|
138
138
|
const issuer = yield repos.issuer.findByIdentifier({
|
|
@@ -152,7 +152,7 @@ function validateIssuedOfferIfExists(params) {
|
|
|
152
152
|
acceptedDate,
|
|
153
153
|
verifiedOffer,
|
|
154
154
|
eventOffer,
|
|
155
|
-
|
|
155
|
+
numAcceptedOffers
|
|
156
156
|
})();
|
|
157
157
|
}
|
|
158
158
|
});
|
|
@@ -6,7 +6,6 @@ import type { ProductOfferRepo } from '../../../../repo/productOffer';
|
|
|
6
6
|
declare function validateMemberTierIfExists(params: {
|
|
7
7
|
event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project'>;
|
|
8
8
|
now: Date;
|
|
9
|
-
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
10
9
|
makesOfferOnApplication: factory.event.screeningEvent.ISellerMakesOffer;
|
|
11
10
|
acceptedEventOffer?: factory.authorization.IOfferAsObject;
|
|
12
11
|
}): (repos: {
|
|
@@ -32,4 +32,32 @@ declare function validateStartRequest(params: {
|
|
|
32
32
|
productOffer: ProductOfferRepo;
|
|
33
33
|
ticket: TicketRepo;
|
|
34
34
|
}) => Promise<void>;
|
|
35
|
-
|
|
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,6 +10,7 @@ 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");
|
|
15
16
|
const fixExtendedEventOffer_1 = require("./validateStartRequest/fixExtendedEventOffer");
|
|
@@ -33,12 +34,12 @@ function validateStartRequest(params) {
|
|
|
33
34
|
object: params.object,
|
|
34
35
|
instrument: params.instrument
|
|
35
36
|
})(repos);
|
|
36
|
-
yield
|
|
37
|
+
yield validEventOfferByApplicationExists({
|
|
37
38
|
event,
|
|
38
39
|
now,
|
|
39
40
|
availableAt: { id: params.store.id },
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
acceptedEventOffer,
|
|
42
|
+
numAcceptedOffers: (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer.length : 0
|
|
42
43
|
})(repos);
|
|
43
44
|
}
|
|
44
45
|
if (params.validateEvent === true) {
|
|
@@ -47,11 +48,11 @@ function validateStartRequest(params) {
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
+
* アプリケーションに対して有効なイベントオファーが存在するかどうかを検証する
|
|
51
52
|
*/
|
|
52
|
-
function
|
|
53
|
+
function validEventOfferByApplicationExists(params) {
|
|
53
54
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const { event, availableAt, acceptedEventOffer } = params;
|
|
55
|
+
const { event, availableAt, acceptedEventOffer, numAcceptedOffers } = params;
|
|
55
56
|
const acceptedDate = moment(params.now);
|
|
56
57
|
const eventOffers = event.offers;
|
|
57
58
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
@@ -85,9 +86,9 @@ function validateApplicationOffer(params) {
|
|
|
85
86
|
yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
|
|
86
87
|
event,
|
|
87
88
|
now: params.now,
|
|
88
|
-
object: params.object,
|
|
89
89
|
eventOffer: existingEventOffer,
|
|
90
|
-
acceptedEventOffer
|
|
90
|
+
acceptedEventOffer,
|
|
91
|
+
numAcceptedOffers
|
|
91
92
|
})(repos);
|
|
92
93
|
}
|
|
93
94
|
else {
|
|
@@ -96,7 +97,6 @@ function validateApplicationOffer(params) {
|
|
|
96
97
|
yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
|
|
97
98
|
event,
|
|
98
99
|
now: params.now,
|
|
99
|
-
object: params.object,
|
|
100
100
|
makesOfferOnApplication,
|
|
101
101
|
acceptedEventOffer
|
|
102
102
|
})(repos);
|
|
@@ -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 };
|
|
@@ -0,0 +1,123 @@
|
|
|
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.issueEventOfferTicket = issueEventOfferTicket;
|
|
13
|
+
const moment = require("moment");
|
|
14
|
+
const factory = require("../../../factory");
|
|
15
|
+
const validateStartRequest_1 = require("../../assetTransaction/reserve/validateStartRequest");
|
|
16
|
+
function createOfferTicket(params) {
|
|
17
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
var _a;
|
|
19
|
+
const { audience, expiresInSeconds, issuedBy, object, validFrom, author, project, instrument } = params;
|
|
20
|
+
const actionAttributes = {
|
|
21
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
22
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
23
|
+
agent: author,
|
|
24
|
+
recipient: author,
|
|
25
|
+
object: [object],
|
|
26
|
+
instrument: {
|
|
27
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
28
|
+
id: instrument.id
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const action = yield repos.action.start(actionAttributes);
|
|
32
|
+
let authorizations;
|
|
33
|
+
try {
|
|
34
|
+
authorizations = yield repos.authorization.publish([{
|
|
35
|
+
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
36
|
+
object,
|
|
37
|
+
validFrom,
|
|
38
|
+
expiresInSeconds,
|
|
39
|
+
author,
|
|
40
|
+
issuedBy,
|
|
41
|
+
audience
|
|
42
|
+
}]);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
try {
|
|
46
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
47
|
+
}
|
|
48
|
+
catch (__) {
|
|
49
|
+
// 失敗したら仕方ない
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
const result = authorizations.map(({ code, typeOf }) => ({ code, typeOf }));
|
|
54
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
55
|
+
const ticketToken = (_a = authorizations.shift()) === null || _a === void 0 ? void 0 : _a.code;
|
|
56
|
+
if (typeof ticketToken !== 'string') {
|
|
57
|
+
// 基本的にありえないフロー
|
|
58
|
+
throw new factory.errors.Internal('code not published by an unexpected reason');
|
|
59
|
+
}
|
|
60
|
+
// チケット作成
|
|
61
|
+
yield repos.ticket.issueByTicketToken({
|
|
62
|
+
project: { id: project.id },
|
|
63
|
+
ticketToken,
|
|
64
|
+
issuedBy
|
|
65
|
+
});
|
|
66
|
+
return { ticketToken };
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function issueEventOfferTicket(params) {
|
|
70
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const { now, audience, eventId, eventOfferId, ticketedOffer, author, project, instrument } = params;
|
|
73
|
+
// 取引は存在するか
|
|
74
|
+
const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: factory.transactionType.PlaceOrder, id: audience.id }, ['expires', 'typeOf', 'seller']);
|
|
75
|
+
// イベントは存在するか
|
|
76
|
+
const event = yield repos.event.projectEventFieldsById({ id: eventId }, ['project', 'offers', 'identifier']);
|
|
77
|
+
// 取引番号発行
|
|
78
|
+
// const { transactionNumber } = await transactionNumberRepo.publishByTimestamp({ startDate: now });
|
|
79
|
+
const { seller } = transaction;
|
|
80
|
+
// 承認作成
|
|
81
|
+
const issuedBy = Object.assign({ id: seller.id, typeOf: seller.typeOf }, (typeof seller.name.ja === 'string') ? { name: seller.name.ja } : undefined);
|
|
82
|
+
const validForMemberTierToken = (_a = ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.validForMemberTier) === null || _a === void 0 ? void 0 : _a.token;
|
|
83
|
+
const validForMemberProgramIdentifier = (_b = ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.validForMemberTier) === null || _b === void 0 ? void 0 : _b.isTierOf.identifier;
|
|
84
|
+
const authorizationObject = Object.assign(Object.assign(Object.assign({ typeOf: factory.offerType.Offer, itemOffered: {
|
|
85
|
+
typeOf: factory.product.ProductType.EventService,
|
|
86
|
+
serviceOutput: {
|
|
87
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
88
|
+
reservationFor: { id: eventId }
|
|
89
|
+
}
|
|
90
|
+
} }, (typeof eventOfferId === 'string' && eventOfferId !== '') ? { id: eventOfferId } : undefined), (typeof (ticketedOffer === null || ticketedOffer === void 0 ? void 0 : ticketedOffer.token) === 'string' && ticketedOffer.token !== '')
|
|
91
|
+
? { token: ticketedOffer.token }
|
|
92
|
+
: undefined), (typeof validForMemberTierToken === 'string' && validForMemberTierToken !== ''
|
|
93
|
+
&& typeof validForMemberProgramIdentifier === 'string' && validForMemberProgramIdentifier !== '')
|
|
94
|
+
? {
|
|
95
|
+
validForMemberTier: {
|
|
96
|
+
token: validForMemberTierToken,
|
|
97
|
+
isTierOf: { identifier: validForMemberProgramIdentifier }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
: undefined);
|
|
101
|
+
// validations(eventId,eventOfferIdentifier,offerToken...)
|
|
102
|
+
yield (0, validateStartRequest_1.validEventOfferByApplicationExists)({
|
|
103
|
+
event,
|
|
104
|
+
now,
|
|
105
|
+
availableAt: { id: instrument.id },
|
|
106
|
+
acceptedEventOffer: authorizationObject,
|
|
107
|
+
numAcceptedOffers: 0 // オファーチケット発行時は予約数を検証しないので0でok
|
|
108
|
+
})(repos);
|
|
109
|
+
const expiresInSeconds = moment(transaction.expires)
|
|
110
|
+
.diff(now, 'seconds');
|
|
111
|
+
const { ticketToken } = yield createOfferTicket({
|
|
112
|
+
object: authorizationObject,
|
|
113
|
+
validFrom: now,
|
|
114
|
+
expiresInSeconds,
|
|
115
|
+
issuedBy,
|
|
116
|
+
audience: { id: transaction.id, typeOf: transaction.typeOf },
|
|
117
|
+
author,
|
|
118
|
+
project,
|
|
119
|
+
instrument
|
|
120
|
+
})(repos);
|
|
121
|
+
return { ticketToken };
|
|
122
|
+
});
|
|
123
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { authorize } from './event/authorize';
|
|
2
2
|
import { importCategoryCodesFromCOA, importFromCOA } from './event/importFromCOA';
|
|
3
|
+
import { issueEventOfferTicket } from './event/issueEventOfferTicket';
|
|
3
4
|
import { searchEventTicketOffers } from './event/searchEventTicketOffers';
|
|
4
5
|
import { searchOfferAppliesToMovieTicket } from './event/searchOfferAppliesToMovieTicket';
|
|
5
6
|
import { searchOfferCatalogItemAvailability } from './event/searchOfferCatalogItemAvailability';
|
|
6
7
|
import { searchOfferCatalogItems } from './event/searchOfferCatalogItems';
|
|
7
8
|
import { voidTransaction } from './event/voidTransaction';
|
|
8
|
-
export { authorize, importCategoryCodesFromCOA, importFromCOA, voidTransaction, searchEventTicketOffers, searchOfferAppliesToMovieTicket, searchOfferCatalogItemAvailability, searchOfferCatalogItems };
|
|
9
|
+
export { authorize, importCategoryCodesFromCOA, importFromCOA, issueEventOfferTicket, voidTransaction, searchEventTicketOffers, searchOfferAppliesToMovieTicket, searchOfferCatalogItemAvailability, searchOfferCatalogItems };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchOfferCatalogItems = exports.searchOfferCatalogItemAvailability = exports.searchOfferAppliesToMovieTicket = exports.searchEventTicketOffers = exports.voidTransaction = exports.importFromCOA = exports.importCategoryCodesFromCOA = exports.authorize = void 0;
|
|
3
|
+
exports.searchOfferCatalogItems = exports.searchOfferCatalogItemAvailability = exports.searchOfferAppliesToMovieTicket = exports.searchEventTicketOffers = exports.voidTransaction = exports.issueEventOfferTicket = exports.importFromCOA = exports.importCategoryCodesFromCOA = exports.authorize = void 0;
|
|
4
4
|
const authorize_1 = require("./event/authorize");
|
|
5
5
|
Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
|
|
6
6
|
const importFromCOA_1 = require("./event/importFromCOA");
|
|
7
7
|
Object.defineProperty(exports, "importCategoryCodesFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importCategoryCodesFromCOA; } });
|
|
8
8
|
Object.defineProperty(exports, "importFromCOA", { enumerable: true, get: function () { return importFromCOA_1.importFromCOA; } });
|
|
9
|
+
const issueEventOfferTicket_1 = require("./event/issueEventOfferTicket");
|
|
10
|
+
Object.defineProperty(exports, "issueEventOfferTicket", { enumerable: true, get: function () { return issueEventOfferTicket_1.issueEventOfferTicket; } });
|
|
9
11
|
const searchEventTicketOffers_1 = require("./event/searchEventTicketOffers");
|
|
10
12
|
Object.defineProperty(exports, "searchEventTicketOffers", { enumerable: true, get: function () { return searchEventTicketOffers_1.searchEventTicketOffers; } });
|
|
11
13
|
const searchOfferAppliesToMovieTicket_1 = require("./event/searchOfferAppliesToMovieTicket");
|
|
@@ -47,26 +47,9 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
47
47
|
}
|
|
48
48
|
if (authorizedObject.typeOf === 'OwnershipInfo') {
|
|
49
49
|
const { typeOfGood } = authorizedObject;
|
|
50
|
-
if (typeOfGood.typeOf === factory.permit.PermitType.Permit
|
|
50
|
+
if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
|
|
51
51
|
// discontinue(2025-11-14~)
|
|
52
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
|
-
// }
|
|
70
53
|
}
|
|
71
54
|
else if (typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
72
55
|
|| typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.2.0
|
|
15
|
-
"@cinerino/sdk": "12.8.0
|
|
14
|
+
"@chevre/factory": "5.2.0",
|
|
15
|
+
"@cinerino/sdk": "12.8.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "23.1.0-alpha.
|
|
118
|
+
"version": "23.1.0-alpha.12"
|
|
119
119
|
}
|