@chevre/domain 22.10.0-alpha.6 → 22.10.0-alpha.8
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 +2 -1
- package/example/src/signPayload.ts +5 -5
- package/lib/chevre/repo/event.d.ts +1 -1
- package/lib/chevre/repo/event.js +4 -27
- package/lib/chevre/repo/mongoose/schemas/offer/event.d.ts +2 -31
- package/lib/chevre/repo/mongoose/schemas/offer/event.js +6 -3
- package/lib/chevre/repo/offer/event.d.ts +1 -34
- package/lib/chevre/repo/offer/event.js +5 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +5 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +63 -58
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +5 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +3 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +3 -2
- package/package.json +3 -3
|
@@ -45,7 +45,8 @@ async function main() {
|
|
|
45
45
|
},
|
|
46
46
|
availableAtOrFrom: { id: 'xxx' },
|
|
47
47
|
validFrom: new Date(),
|
|
48
|
-
validThrough: new Date()
|
|
48
|
+
validThrough: new Date(),
|
|
49
|
+
validForMemberTier: { identifier: 'xxx', typeOf: 'MemberProgramTier' }
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
console.log('created.');
|
|
@@ -4,11 +4,11 @@ import * as jwt from 'jsonwebtoken';
|
|
|
4
4
|
async function main(): Promise<void> {
|
|
5
5
|
const payload = {
|
|
6
6
|
member: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
memberOf: {
|
|
8
|
+
identifier: 'DefaultTier',
|
|
9
|
+
isTierOf: {
|
|
10
|
+
identifier: 'DefaultMemberProgram'
|
|
11
|
+
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
};
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -525,14 +525,15 @@ class EventRepo {
|
|
|
525
525
|
savedEventId = id;
|
|
526
526
|
}
|
|
527
527
|
else {
|
|
528
|
-
const upsert = params.upsert === true;
|
|
528
|
+
// const upsert: boolean = params.upsert === true;
|
|
529
|
+
const upsert = false; // always false(2025-05-15~)
|
|
529
530
|
doc = yield this.eventModel.findOneAndUpdate({
|
|
530
531
|
_id: { $eq: params.id },
|
|
531
532
|
typeOf: { $eq: typeOf }
|
|
532
533
|
}, Object.assign({
|
|
533
534
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
534
535
|
$setOnInsert: Object.assign({ typeOf,
|
|
535
|
-
project }, (identifier !==
|
|
536
|
+
project }, (typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true, projection: { _id: 1 } })
|
|
536
537
|
.lean()
|
|
537
538
|
.exec();
|
|
538
539
|
savedEventId = params.id;
|
|
@@ -567,7 +568,6 @@ class EventRepo {
|
|
|
567
568
|
_id: p.id,
|
|
568
569
|
typeOf: p.attributes.typeOf
|
|
569
570
|
},
|
|
570
|
-
// upsertの場合、createがありうるので属性を除外しない
|
|
571
571
|
update: Object.assign({ $setOnInsert: Object.assign(Object.assign({ typeOf: p.attributes.typeOf, project: p.attributes.project }, (typeof p.attributes.identifier === 'string')
|
|
572
572
|
? { identifier: p.attributes.identifier } : undefined), (typeof p.attributes.remainingAttendeeCapacity === 'number')
|
|
573
573
|
? { remainingAttendeeCapacity: p.attributes.remainingAttendeeCapacity }
|
|
@@ -578,29 +578,6 @@ class EventRepo {
|
|
|
578
578
|
}
|
|
579
579
|
else if (p.attributes.typeOf === factory.eventType.ScreeningEventSeries) {
|
|
580
580
|
throw new factory.errors.Internal('typeOf: ScreeningEventSeries discontinued');
|
|
581
|
-
// 上書き禁止属性を除外(2022-08-24~)
|
|
582
|
-
// const { identifier, project, typeOf, ...updateFields } = p.attributes;
|
|
583
|
-
// bulkWriteOps.push({
|
|
584
|
-
// updateOne: {
|
|
585
|
-
// filter: {
|
|
586
|
-
// _id: p.id,
|
|
587
|
-
// typeOf: p.attributes.typeOf
|
|
588
|
-
// },
|
|
589
|
-
// // upsertの場合、createがありうるので属性を除外しない
|
|
590
|
-
// update: {
|
|
591
|
-
// $setOnInsert: {
|
|
592
|
-
// typeOf: p.attributes.typeOf,
|
|
593
|
-
// project: p.attributes.project,
|
|
594
|
-
// ...(typeof p.attributes.identifier === 'string')
|
|
595
|
-
// ? { identifier: p.attributes.identifier } : undefined
|
|
596
|
-
// },
|
|
597
|
-
// $set: updateFields,
|
|
598
|
-
// // $unsetに対応(2022-08-31~)
|
|
599
|
-
// ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
|
|
600
|
-
// },
|
|
601
|
-
// upsert
|
|
602
|
-
// }
|
|
603
|
-
// });
|
|
604
581
|
}
|
|
605
582
|
});
|
|
606
583
|
}
|
|
@@ -627,7 +604,7 @@ class EventRepo {
|
|
|
627
604
|
// upsertの場合、createがありうるので属性を除外しない
|
|
628
605
|
{
|
|
629
606
|
$setOnInsert: Object.assign({ _id: id, typeOf,
|
|
630
|
-
project }, (identifier !==
|
|
607
|
+
project }, (typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined),
|
|
631
608
|
$set: updateFields
|
|
632
609
|
}, { upsert: true, new: true, projection: { _id: 1 } })
|
|
633
610
|
.lean()
|
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../../factory';
|
|
3
|
-
|
|
4
|
-
isTierOf: {
|
|
5
|
-
/**
|
|
6
|
-
* メンバープログラムコード
|
|
7
|
-
*/
|
|
8
|
-
identifier: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
interface IOfferAvailableAtOrFrom {
|
|
12
|
-
id: string;
|
|
13
|
-
}
|
|
14
|
-
type ISellerMakesOffer = Pick<factory.event.screeningEvent.ISellerMakesOffer, 'typeOf' | 'validFrom' | 'validThrough'> & {
|
|
15
|
-
availableAtOrFrom: IOfferAvailableAtOrFrom;
|
|
16
|
-
};
|
|
17
|
-
export interface IDocType extends ISellerMakesOffer {
|
|
18
|
-
project: {
|
|
19
|
-
id: string;
|
|
20
|
-
typeOf: factory.organizationType.Project;
|
|
21
|
-
};
|
|
22
|
-
seller: {
|
|
23
|
-
id: string;
|
|
24
|
-
typeOf: factory.organizationType.Organization;
|
|
25
|
-
};
|
|
26
|
-
itemOffered: {
|
|
27
|
-
id: string;
|
|
28
|
-
typeOf: factory.eventType.ScreeningEvent;
|
|
29
|
-
};
|
|
30
|
-
identifier: string;
|
|
31
|
-
validForMemberTier?: IMemberProgramTier;
|
|
32
|
-
}
|
|
3
|
+
type IDocType = factory.eventOffer.IEventOfferForMemberTier;
|
|
33
4
|
type IModel = Model<IDocType>;
|
|
34
5
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
35
6
|
type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
|
|
36
7
|
declare const modelName = "Offer.Event";
|
|
37
8
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
38
9
|
declare function createSchema(): ISchema;
|
|
39
|
-
export { createSchema, IModel, indexes, modelName };
|
|
10
|
+
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.modelName = exports.indexes = void 0;
|
|
4
4
|
exports.createSchema = createSchema;
|
|
5
5
|
const mongoose_1 = require("mongoose");
|
|
6
|
-
const writeConcern_1 = require("../../writeConcern");
|
|
7
6
|
const settings_1 = require("../../../../settings");
|
|
7
|
+
const writeConcern_1 = require("../../writeConcern");
|
|
8
8
|
const modelName = 'Offer.Event';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
@@ -44,9 +44,12 @@ const schemaOptions = {
|
|
|
44
44
|
};
|
|
45
45
|
const indexes = [
|
|
46
46
|
[
|
|
47
|
-
{ 'project.id': 1, identifier: 1 },
|
|
48
47
|
{
|
|
49
|
-
|
|
48
|
+
'itemOffered.id': 1,
|
|
49
|
+
identifier: 1
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'uniqueByItemOfferedAndIdentifier',
|
|
50
53
|
unique: true
|
|
51
54
|
}
|
|
52
55
|
],
|
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
import { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
import { IDocType } from '../mongoose/schemas/offer/event';
|
|
4
|
-
|
|
5
|
-
limit?: number;
|
|
6
|
-
page?: number;
|
|
7
|
-
sort?: {
|
|
8
|
-
validFrom?: factory.sortType;
|
|
9
|
-
};
|
|
10
|
-
project?: {
|
|
11
|
-
id?: {
|
|
12
|
-
$eq?: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
seller?: {
|
|
16
|
-
id?: {
|
|
17
|
-
$eq?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
id?: {
|
|
21
|
-
$eq?: string;
|
|
22
|
-
$in?: string[];
|
|
23
|
-
};
|
|
24
|
-
identifier?: {
|
|
25
|
-
$eq?: string;
|
|
26
|
-
};
|
|
27
|
-
itemOffered?: {
|
|
28
|
-
id?: {
|
|
29
|
-
$eq?: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
availableAtOrFrom?: {
|
|
33
|
-
id?: {
|
|
34
|
-
$eq?: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
}
|
|
4
|
+
type ISearchConditions = factory.eventOffer.ISearchConditions;
|
|
38
5
|
export type ISavingOffer = Pick<IDocType, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'project' | 'seller' | 'typeOf' | 'validForMemberTier' | 'validFrom' | 'validThrough'> & {
|
|
39
6
|
id?: never;
|
|
40
7
|
};
|
|
@@ -33,7 +33,7 @@ class EventOfferRepo {
|
|
|
33
33
|
}
|
|
34
34
|
// tslint:disable-next-line:max-func-body-length
|
|
35
35
|
static CREATE_FILTER_QUERY(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
37
37
|
const andConditions = [];
|
|
38
38
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
39
39
|
if (typeof projectIdEq === 'string') {
|
|
@@ -63,6 +63,10 @@ class EventOfferRepo {
|
|
|
63
63
|
if (typeof availableAtOrFromIdEq === 'string') {
|
|
64
64
|
andConditions.push({ 'availableAtOrFrom.id': { $eq: availableAtOrFromIdEq } });
|
|
65
65
|
}
|
|
66
|
+
const validForMemberTierIdentifierEq = (_o = (_m = params.validForMemberTier) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
|
|
67
|
+
if (typeof validForMemberTierIdentifierEq === 'string') {
|
|
68
|
+
andConditions.push({ 'validForMemberTier.identifier': { $exists: true, $eq: validForMemberTierIdentifierEq } });
|
|
69
|
+
}
|
|
66
70
|
return andConditions;
|
|
67
71
|
}
|
|
68
72
|
save(params) {
|
|
@@ -5,6 +5,8 @@ import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
|
5
5
|
import type { EventRepo } from '../../../repo/event';
|
|
6
6
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
7
7
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
8
|
+
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
9
|
+
import type { EventOfferRepo } from '../../../repo/offer/event';
|
|
8
10
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
9
11
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
10
12
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
@@ -22,8 +24,10 @@ interface IStartOperationRepos {
|
|
|
22
24
|
advanceBookingRequirement: AdvanceBookingRequirementRepo;
|
|
23
25
|
stockHolder: StockHolderRepo;
|
|
24
26
|
event: EventRepo;
|
|
27
|
+
eventOffer: EventOfferRepo;
|
|
25
28
|
eventSeries: EventSeriesRepo;
|
|
26
29
|
issuer: IssuerRepo;
|
|
30
|
+
memberProgram: MemberProgramRepo;
|
|
27
31
|
offer: OfferRepo;
|
|
28
32
|
offerCatalog: OfferCatalogRepo;
|
|
29
33
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
@@ -46,7 +46,11 @@ function start(params, options) {
|
|
|
46
46
|
validateEvent: params.validateEvent,
|
|
47
47
|
now,
|
|
48
48
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id }
|
|
49
|
-
})({
|
|
49
|
+
})({
|
|
50
|
+
eventOffer: repos.eventOffer,
|
|
51
|
+
issuer: repos.issuer,
|
|
52
|
+
memberProgram: repos.memberProgram
|
|
53
|
+
});
|
|
50
54
|
// objectに必要な情報をそろえる
|
|
51
55
|
const { acceptedOffers4transactionObject, objectSubReservations } = yield createObjectAttributes({
|
|
52
56
|
// reservationFor: startParams.object.reservationFor,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
3
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
4
|
+
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
5
|
+
import type { EventOfferRepo } from '../../../repo/offer/event';
|
|
4
6
|
declare function validateStartRequest(params: {
|
|
5
7
|
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
6
8
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>, 'offers' | 'id' | 'project'>;
|
|
@@ -14,6 +16,8 @@ declare function validateStartRequest(params: {
|
|
|
14
16
|
id?: string;
|
|
15
17
|
};
|
|
16
18
|
}): (repos: {
|
|
19
|
+
eventOffer: EventOfferRepo;
|
|
17
20
|
issuer: IssuerRepo;
|
|
21
|
+
memberProgram: MemberProgramRepo;
|
|
18
22
|
}) => Promise<void>;
|
|
19
23
|
export { validateStartRequest };
|
|
@@ -55,56 +55,53 @@ function validateStartRequest(params) {
|
|
|
55
55
|
if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
56
56
|
throw new factory.errors.NotFound('store.id');
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const validForMemberTierToken = (_c = (_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.offers) === null || _c === void 0 ? void 0 : _c.validForMemberTier;
|
|
59
59
|
yield validateEventOfferPeriod(Object.assign({ event,
|
|
60
|
-
now, availableAt: { id: params.store.id } }, (typeof
|
|
60
|
+
now, availableAt: { id: params.store.id } }, (typeof validForMemberTierToken === 'string') ? { validForMemberTierToken } : undefined))(repos);
|
|
61
61
|
}
|
|
62
62
|
if (params.validateEvent === true) {
|
|
63
63
|
validateEvent({ event, object: params.object });
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
if (acceptedDate.isAfter(roleEndMoment)) {
|
|
106
|
-
throw new factory.errors.Argument('reservationFor.offers.offeredBy', `the specified role ends at ${roleStartDateStr}`);
|
|
107
|
-
}
|
|
67
|
+
function validateMemberTier(params) {
|
|
68
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
var _a, _b, _c, _d, _e;
|
|
70
|
+
const { acceptedDate, event, availableAt, verifiedValidForMemberTier, memberProgramIdentifierMustBe } = params;
|
|
71
|
+
const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
72
|
+
const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
|
|
73
|
+
if (typeof tierIdentifier !== 'string') {
|
|
74
|
+
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'tier identifier must be string');
|
|
75
|
+
}
|
|
76
|
+
if (typeof memberProgramIdentifier !== 'string') {
|
|
77
|
+
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program must be string');
|
|
78
|
+
}
|
|
79
|
+
if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
|
|
80
|
+
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program not matched');
|
|
81
|
+
}
|
|
82
|
+
// イベントオファーを検索して有効期間検証
|
|
83
|
+
const eventOfferForMemberTier = (yield repos.eventOffer.projectFields({
|
|
84
|
+
limit: 1,
|
|
85
|
+
page: 1,
|
|
86
|
+
project: { id: { $eq: event.project.id } },
|
|
87
|
+
availableAtOrFrom: { id: { $eq: availableAt.id } },
|
|
88
|
+
itemOffered: { id: { $eq: event.id } },
|
|
89
|
+
validForMemberTier: { identifier: { $eq: tierIdentifier } }
|
|
90
|
+
}, ['validFrom', 'validThrough'])).shift();
|
|
91
|
+
if (eventOfferForMemberTier === undefined) {
|
|
92
|
+
throw new factory.errors.NotFound(factory.offerType.Offer, 'event offer for member tier not found');
|
|
93
|
+
}
|
|
94
|
+
let validThroughMoment;
|
|
95
|
+
let validFromMoment;
|
|
96
|
+
validThroughMoment = moment(eventOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
|
|
97
|
+
validFromMoment = moment(eventOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
|
|
98
|
+
if (acceptedDate.isBefore(validFromMoment)) {
|
|
99
|
+
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid from ${validFromMoment}`);
|
|
100
|
+
}
|
|
101
|
+
if (acceptedDate.isAfter(validThroughMoment)) {
|
|
102
|
+
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid through ${validThroughMoment}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
108
105
|
}
|
|
109
106
|
/**
|
|
110
107
|
* イベントのオファー有効期間を検証する
|
|
@@ -112,9 +109,9 @@ function validateOfferedBy(params) {
|
|
|
112
109
|
function validateEventOfferPeriod(params) {
|
|
113
110
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
114
111
|
var _a, _b;
|
|
112
|
+
const { event, availableAt, validForMemberTierToken } = params;
|
|
115
113
|
const acceptedDate = moment(params.now);
|
|
116
|
-
const eventOffers =
|
|
117
|
-
const { offeredByToken } = params;
|
|
114
|
+
const eventOffers = event.offers;
|
|
118
115
|
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
119
116
|
const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
|
|
120
117
|
var _a, _b;
|
|
@@ -139,30 +136,38 @@ function validateEventOfferPeriod(params) {
|
|
|
139
136
|
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
140
137
|
}
|
|
141
138
|
}
|
|
142
|
-
// support
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
throw new factory.errors.Internal('offeredBy.member.identifier undefined');
|
|
148
|
-
}
|
|
149
|
-
if (typeof offeredByToken !== 'string' || offeredByToken === '') {
|
|
150
|
-
throw new factory.errors.ArgumentNull('reservationFor.offers.offeredBy');
|
|
139
|
+
// support validForMemberTier(2025-05-14~)
|
|
140
|
+
const memberProgramIdentifierMustBe = (_b = (_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.isTierOf) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
141
|
+
if (typeof memberProgramIdentifierMustBe === 'string') {
|
|
142
|
+
if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
|
|
143
|
+
throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier');
|
|
151
144
|
}
|
|
152
145
|
// トークン検証
|
|
146
|
+
const memberProgram = (yield repos.memberProgram.search({
|
|
147
|
+
limit: 1,
|
|
148
|
+
page: 1,
|
|
149
|
+
project: { id: { $eq: params.event.project.id } },
|
|
150
|
+
identifier: { $eq: memberProgramIdentifierMustBe }
|
|
151
|
+
})).shift();
|
|
152
|
+
if (memberProgram === undefined) {
|
|
153
|
+
throw new factory.errors.NotFound('MemberProgram');
|
|
154
|
+
}
|
|
153
155
|
const issuer = yield repos.issuer.findByIdentifier({
|
|
154
156
|
project: { id: params.event.project.id },
|
|
155
|
-
identifier:
|
|
157
|
+
identifier: memberProgram.hostingOrganization.identifier
|
|
156
158
|
});
|
|
157
159
|
if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
|
|
158
160
|
throw new factory.errors.NotFound('issuer.tokenSecret');
|
|
159
161
|
}
|
|
160
|
-
const
|
|
162
|
+
const verifiedValidForMemberTier = yield verifyOfferedByToken({
|
|
161
163
|
secret: issuer.tokenSecret,
|
|
162
164
|
issuer: issuer.url,
|
|
163
|
-
token:
|
|
165
|
+
token: validForMemberTierToken
|
|
164
166
|
});
|
|
165
|
-
|
|
167
|
+
yield validateMemberTier({
|
|
168
|
+
event, availableAt, acceptedDate, verifiedValidForMemberTier,
|
|
169
|
+
memberProgramIdentifierMustBe
|
|
170
|
+
})(repos);
|
|
166
171
|
}
|
|
167
172
|
});
|
|
168
173
|
}
|
|
@@ -48,8 +48,8 @@ function createReserveTransactionStartParams(params) {
|
|
|
48
48
|
// }
|
|
49
49
|
// ]
|
|
50
50
|
};
|
|
51
|
-
const
|
|
52
|
-
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: Object.assign({ id: params.event.id }, (typeof
|
|
51
|
+
const validForMemberTierToken = (_b = params.event.offers) === null || _b === void 0 ? void 0 : _b.validForMemberTier;
|
|
52
|
+
const object = Object.assign({ acceptedOffer: acceptedTicketOffersWithoutDetail, reservationFor: Object.assign({ id: params.event.id }, (typeof validForMemberTierToken === 'string') ? { offers: { validForMemberTier: validForMemberTierToken } } : undefined) }, (params.broker !== undefined) ? { broker: params.broker } : undefined);
|
|
53
53
|
return {
|
|
54
54
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
55
55
|
typeOf: factory.assetTransactionType.Reserve,
|
|
@@ -7,6 +7,8 @@ import type { AuthorizationRepo } from '../../../../repo/authorization';
|
|
|
7
7
|
import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/event';
|
|
8
8
|
import { EventSeriesRepo } from '../../../../repo/eventSeries';
|
|
9
9
|
import type { IssuerRepo } from '../../../../repo/issuer';
|
|
10
|
+
import type { MemberProgramRepo } from '../../../../repo/memberProgram';
|
|
11
|
+
import type { EventOfferRepo } from '../../../../repo/offer/event';
|
|
10
12
|
import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
11
13
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
12
14
|
import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
@@ -26,7 +28,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
26
28
|
acceptedOffers: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail[];
|
|
27
29
|
event: Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id'> & {
|
|
28
30
|
offers?: {
|
|
29
|
-
|
|
31
|
+
validForMemberTier?: string;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
@@ -51,8 +53,10 @@ declare function processStartReserve4chevre(params: {
|
|
|
51
53
|
authorization: AuthorizationRepo;
|
|
52
54
|
stockHolder: StockHolderRepo;
|
|
53
55
|
event: EventRepo;
|
|
56
|
+
eventOffer: EventOfferRepo;
|
|
54
57
|
eventSeries: EventSeriesRepo;
|
|
55
58
|
issuer: IssuerRepo;
|
|
59
|
+
memberProgram: MemberProgramRepo;
|
|
56
60
|
offer: OfferRepo;
|
|
57
61
|
offerCatalog: OfferCatalogRepo;
|
|
58
62
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
@@ -26,7 +26,9 @@ function processStartReserve4chevre(params, options) {
|
|
|
26
26
|
// 予約取引開始
|
|
27
27
|
const startParams = (0, factory_1.createReserveTransactionStartParams)(Object.assign({ project: transaction.project,
|
|
28
28
|
// object: <IObjectWithDetail>action.object,
|
|
29
|
-
acceptedOffers: params.acceptedOffers, event: Object.assign({ id: event.id }, (typeof ((_a = event.offers) === null || _a === void 0 ? void 0 : _a.
|
|
29
|
+
acceptedOffers: params.acceptedOffers, event: Object.assign({ id: event.id }, (typeof ((_a = event.offers) === null || _a === void 0 ? void 0 : _a.validForMemberTier) === 'string')
|
|
30
|
+
? { offers: { validForMemberTier: event.offers.validForMemberTier } }
|
|
31
|
+
: undefined), transaction,
|
|
30
32
|
transactionNumber }, (params.broker !== undefined) ? { broker: params.broker } : undefined));
|
|
31
33
|
const startParamObject = yield validateObjectWithoutDetail(startParams, { id: params.transaction.id })(repos);
|
|
32
34
|
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject,
|
|
@@ -7,6 +7,8 @@ import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
|
7
7
|
import type { EventRepo } from '../../../repo/event';
|
|
8
8
|
import { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
9
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
10
|
+
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
11
|
+
import type { EventOfferRepo } from '../../../repo/offer/event';
|
|
10
12
|
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
11
13
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
12
14
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
@@ -31,8 +33,10 @@ interface IAuthorizeRepos {
|
|
|
31
33
|
assetTransaction: AssetTransactionRepo;
|
|
32
34
|
authorization: AuthorizationRepo;
|
|
33
35
|
event: EventRepo;
|
|
36
|
+
eventOffer: EventOfferRepo;
|
|
34
37
|
eventSeries: EventSeriesRepo;
|
|
35
38
|
issuer: IssuerRepo;
|
|
39
|
+
memberProgram: MemberProgramRepo;
|
|
36
40
|
stockHolder: StockHolderRepo;
|
|
37
41
|
offer: OfferRepo;
|
|
38
42
|
offerCatalog: OfferCatalogRepo;
|
|
@@ -98,8 +98,9 @@ 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
|
-
const
|
|
101
|
+
// support validForMemberTier(2025-05-14~)
|
|
102
|
+
const validForMemberTierToken = (_c = params.object.reservationFor.offers) === null || _c === void 0 ? void 0 : _c.validForMemberTier;
|
|
103
|
+
const event = Object.assign({ id: params.object.reservationFor.id, typeOf: factory.eventType.ScreeningEvent }, (typeof validForMemberTierToken === 'string') ? { offers: { validForMemberTier: validForMemberTierToken } } : undefined);
|
|
103
104
|
return { transaction, event };
|
|
104
105
|
});
|
|
105
106
|
}
|
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": "4.394.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "10.21.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.394.0-alpha.3",
|
|
15
|
+
"@cinerino/sdk": "10.21.0-alpha.38",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"postversion": "git push origin --tags",
|
|
114
114
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
115
115
|
},
|
|
116
|
-
"version": "22.10.0-alpha.
|
|
116
|
+
"version": "22.10.0-alpha.8"
|
|
117
117
|
}
|