@chevre/domain 23.1.0-alpha.0 → 23.1.0-alpha.2

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.
Files changed (24) hide show
  1. package/example/src/chevre/assetTransaction/processReserve.ts +1 -0
  2. package/example/src/chevre/authorizeEventServiceOffer.ts +1 -0
  3. package/lib/chevre/repo/eventOffer.d.ts +52 -0
  4. package/lib/chevre/repo/eventOffer.js +185 -0
  5. package/lib/chevre/repo/mongoose/schemas/eventOffer.d.ts +10 -0
  6. package/lib/chevre/repo/mongoose/schemas/eventOffer.js +98 -0
  7. package/lib/chevre/repository.d.ts +5 -0
  8. package/lib/chevre/repository.js +15 -2
  9. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -0
  10. package/lib/chevre/service/assetTransaction/reserve/start.js +1 -0
  11. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +1 -1
  12. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +9 -9
  13. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +2 -0
  14. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +38 -14
  15. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +38 -68
  16. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
  17. package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
  18. package/lib/chevre/service/offer/onEventChanged.js +29 -13
  19. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +1 -2
  20. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +3 -1
  21. package/lib/chevre/service/payment/any/factory.d.ts +0 -1
  22. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +29 -13
  23. package/lib/chevre/service/payment/any.js +6 -2
  24. package/package.json +3 -3
@@ -99,6 +99,7 @@ async function main() {
99
99
  project: await chevre.repository.Project.createInstance(mongoose.connection),
100
100
  stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection }),
101
101
  event: await chevre.repository.Event.createInstance(mongoose.connection),
102
+ eventOffer: await chevre.repository.EventOffer.createInstance(mongoose.connection),
102
103
  eventSeries: await chevre.repository.EventSeries.createInstance(mongoose.connection),
103
104
  issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
104
105
  memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
@@ -54,6 +54,7 @@ async function main() {
54
54
  assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
55
55
  authorization: await chevre.repository.Authorization.createInstance(mongoose.connection),
56
56
  event: await chevre.repository.Event.createInstance(mongoose.connection),
57
+ eventOffer: await chevre.repository.EventOffer.createInstance(mongoose.connection),
57
58
  eventSeries: await chevre.repository.EventSeries.createInstance(mongoose.connection),
58
59
  issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
59
60
  memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
@@ -0,0 +1,52 @@
1
+ import type { BulkWriteResult, DeleteResult } from 'mongodb';
2
+ import { Connection, FilterQuery } from 'mongoose';
3
+ import * as factory from '../factory';
4
+ import { IDocType } from './mongoose/schemas/eventOffer';
5
+ type IUnset = {
6
+ [key in keyof IDocType]?: 1;
7
+ };
8
+ type IDocWithId = IDocType & {
9
+ id: string;
10
+ };
11
+ type IKeyOfProjection = keyof IDocType;
12
+ /**
13
+ * イベントオファーリポジトリ
14
+ */
15
+ export declare class EventOfferRepo {
16
+ private readonly eventOfferModel;
17
+ constructor(connection: Connection);
18
+ static CREATE_MONGO_CONDITIONS(params: factory.eventOffer.ISearchConditions): FilterQuery<IDocType>[];
19
+ findEventOffers(params: factory.eventOffer.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IDocWithId[]>;
20
+ /**
21
+ * オファーコードとイベントIDをキーにして冪等置換
22
+ */
23
+ upsertEventOffersByIdentifier(params: {
24
+ $set: Pick<IDocType, 'identifier' | 'itemOffered' | 'offeredBy' | 'seller' | 'project' | 'typeOf' | 'validFrom' | 'validThrough'> & {
25
+ id?: never;
26
+ };
27
+ $unset: IUnset;
28
+ }[], options: {
29
+ /**
30
+ * falseの場合setOnInsertのみ
31
+ * trueの場合setのみ
32
+ */
33
+ update: boolean;
34
+ }): Promise<{
35
+ bulkWriteResult: BulkWriteResult;
36
+ modifiedProductOffers: {
37
+ id: string;
38
+ }[];
39
+ } | void>;
40
+ /**
41
+ * 販売者の提供するイベントオファーを削除する
42
+ */
43
+ deleteEventOffersBySeller(params: {
44
+ project: {
45
+ id: string;
46
+ };
47
+ seller: {
48
+ id: string;
49
+ };
50
+ }): Promise<DeleteResult>;
51
+ }
52
+ export {};
@@ -0,0 +1,185 @@
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.EventOfferRepo = void 0;
13
+ const factory = require("../factory");
14
+ const settings_1 = require("../settings");
15
+ const eventOffer_1 = require("./mongoose/schemas/eventOffer");
16
+ const AVAILABLE_PROJECT_FIELDS = [
17
+ 'identifier',
18
+ 'project',
19
+ 'itemOffered',
20
+ 'offeredBy',
21
+ 'typeOf',
22
+ 'validFrom',
23
+ 'validThrough',
24
+ 'availableAtOrFrom',
25
+ 'seller'
26
+ ];
27
+ /**
28
+ * イベントオファーリポジトリ
29
+ */
30
+ class EventOfferRepo {
31
+ constructor(connection) {
32
+ this.eventOfferModel = connection.model(eventOffer_1.modelName, (0, eventOffer_1.createSchema)());
33
+ }
34
+ static CREATE_MONGO_CONDITIONS(params) {
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
36
+ const andConditions = [];
37
+ const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
38
+ if (typeof idEq === 'string') {
39
+ andConditions.push({ _id: { $eq: idEq } });
40
+ }
41
+ const projectIdEq = (_c = (_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === null || _c === void 0 ? void 0 : _c.$eq;
42
+ if (typeof projectIdEq === 'string') {
43
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
44
+ }
45
+ const identifierEq = (_d = params.identifier) === null || _d === void 0 ? void 0 : _d.$eq;
46
+ if (typeof identifierEq === 'string') {
47
+ andConditions.push({ identifier: { $eq: identifierEq } });
48
+ }
49
+ const identifierIn = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$in;
50
+ if (Array.isArray(identifierIn)) {
51
+ andConditions.push({ identifier: { $in: identifierIn } });
52
+ }
53
+ const itemOfferedIdEq = (_g = (_f = params.itemOffered) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.$eq;
54
+ if (typeof itemOfferedIdEq === 'string') {
55
+ andConditions.push({ 'itemOffered.id': { $eq: itemOfferedIdEq } });
56
+ }
57
+ const itemOfferedIdIn = (_j = (_h = params.itemOffered) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.$in;
58
+ if (Array.isArray(itemOfferedIdIn)) {
59
+ andConditions.push({ 'itemOffered.id': { $in: itemOfferedIdIn } });
60
+ }
61
+ const offeredByIdEq = (_l = (_k = params.offeredBy) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
62
+ if (typeof offeredByIdEq === 'string') {
63
+ andConditions.push({ 'offeredBy.id': { $exists: true, $eq: offeredByIdEq } });
64
+ }
65
+ const sellerByIdEq = (_o = (_m = params.seller) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$eq;
66
+ if (typeof sellerByIdEq === 'string') {
67
+ andConditions.push({ 'seller.id': { $eq: sellerByIdEq } });
68
+ }
69
+ const validFromLte = (_p = params.validFrom) === null || _p === void 0 ? void 0 : _p.$lte;
70
+ if (validFromLte instanceof Date) {
71
+ andConditions.push({ validFrom: { $lte: validFromLte } });
72
+ }
73
+ const validThroughGte = (_q = params.validThrough) === null || _q === void 0 ? void 0 : _q.$gte;
74
+ if (validThroughGte instanceof Date) {
75
+ andConditions.push({ validThrough: { $gte: validThroughGte } });
76
+ }
77
+ return andConditions;
78
+ }
79
+ findEventOffers(params, inclusion) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ var _a;
82
+ const conditions = EventOfferRepo.CREATE_MONGO_CONDITIONS(params);
83
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
84
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
85
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
86
+ }
87
+ else {
88
+ throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
89
+ }
90
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
91
+ const query = this.eventOfferModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
92
+ if (typeof ((_a = params.sort) === null || _a === void 0 ? void 0 : _a.validFrom) === 'number') {
93
+ query.sort({ validFrom: params.sort.validFrom });
94
+ }
95
+ if (typeof params.limit === 'number' && params.limit > 0) {
96
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
97
+ query.limit(params.limit)
98
+ .skip(params.limit * (page - 1));
99
+ }
100
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
101
+ .lean()
102
+ .exec();
103
+ });
104
+ }
105
+ /**
106
+ * オファーコードとイベントIDをキーにして冪等置換
107
+ */
108
+ upsertEventOffersByIdentifier(params, options) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ const { update } = options;
111
+ const bulkWriteOps = [];
112
+ const queryFilters = [];
113
+ if (Array.isArray(params)) {
114
+ params.forEach(({ $set, $unset }) => {
115
+ const { identifier, itemOffered, offeredBy, seller, project, validFrom, validThrough } = $set;
116
+ if (typeof identifier !== 'string' || identifier === '') {
117
+ throw new factory.errors.ArgumentNull('identifier');
118
+ }
119
+ if (typeof itemOffered.id !== 'string' || itemOffered.id === '') {
120
+ throw new factory.errors.ArgumentNull('itemOffered.id');
121
+ }
122
+ // リソースのユニークネスを保証するfilter
123
+ const filter = {
124
+ 'project.id': { $eq: project.id },
125
+ 'itemOffered.id': { $eq: itemOffered.id },
126
+ identifier: { $eq: identifier }
127
+ };
128
+ queryFilters.push({
129
+ 'project.id': { $eq: project.id },
130
+ 'itemOffered.id': { $eq: itemOffered.id },
131
+ identifier: { $eq: identifier }
132
+ });
133
+ if (update === true) {
134
+ const setFields = Object.assign({ validFrom,
135
+ validThrough }, (typeof (offeredBy === null || offeredBy === void 0 ? void 0 : offeredBy.identifier) === 'string') ? { offeredBy } : undefined);
136
+ const updateFilter = Object.assign({ $set: setFields }, ($unset !== undefined) ? { $unset } : undefined);
137
+ const updateOne = {
138
+ filter,
139
+ update: updateFilter,
140
+ upsert: false
141
+ };
142
+ bulkWriteOps.push({ updateOne });
143
+ }
144
+ else {
145
+ const setOnInsert = Object.assign({ itemOffered, identifier, project, seller, typeOf: factory.offerType.Offer, validFrom,
146
+ validThrough }, (typeof (offeredBy === null || offeredBy === void 0 ? void 0 : offeredBy.identifier) === 'string') ? { offeredBy } : undefined);
147
+ const updateFilter = {
148
+ $setOnInsert: setOnInsert
149
+ };
150
+ const updateOne = {
151
+ filter,
152
+ update: updateFilter,
153
+ upsert: true
154
+ };
155
+ bulkWriteOps.push({ updateOne });
156
+ }
157
+ });
158
+ }
159
+ if (bulkWriteOps.length > 0) {
160
+ const bulkWriteResult = yield this.eventOfferModel.bulkWrite(bulkWriteOps, { ordered: false });
161
+ // modifiedの場合upsertedIdsに含まれないので、idを検索する
162
+ const modifiedProductOffers = yield this.eventOfferModel.find({ $or: queryFilters }, {
163
+ _id: 0,
164
+ id: { $toString: '$_id' }
165
+ })
166
+ .lean()
167
+ .exec();
168
+ return { bulkWriteResult, modifiedProductOffers };
169
+ }
170
+ });
171
+ }
172
+ /**
173
+ * 販売者の提供するイベントオファーを削除する
174
+ */
175
+ deleteEventOffersBySeller(params) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ return this.eventOfferModel.deleteMany({
178
+ 'project.id': { $eq: params.project.id },
179
+ 'seller.id': { $eq: params.seller.id }
180
+ })
181
+ .exec();
182
+ });
183
+ }
184
+ }
185
+ exports.EventOfferRepo = EventOfferRepo;
@@ -0,0 +1,10 @@
1
+ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
+ import * as factory from '../../../factory';
3
+ type IDocType = factory.eventOffer.IEventOffer;
4
+ type IModel = Model<IDocType>;
5
+ type ISchemaDefinition = SchemaDefinition<IDocType>;
6
+ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
7
+ declare const modelName = "EventOffer";
8
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
9
+ declare function createSchema(): ISchema;
10
+ export { createSchema, IDocType, IModel, indexes, modelName };
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modelName = exports.indexes = void 0;
4
+ exports.createSchema = createSchema;
5
+ const mongoose_1 = require("mongoose");
6
+ const settings_1 = require("../../../settings");
7
+ const writeConcern_1 = require("../writeConcern");
8
+ const modelName = 'EventOffer';
9
+ exports.modelName = modelName;
10
+ const schemaDefinition = {
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
+ seller: { type: mongoose_1.SchemaTypes.Mixed, required: true },
13
+ typeOf: { type: String, required: true },
14
+ identifier: { type: String, required: true },
15
+ itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
16
+ validFrom: { type: Date, required: true },
17
+ validThrough: { type: Date, required: true },
18
+ availableAtOrFrom: { type: mongoose_1.SchemaTypes.Mixed, required: true },
19
+ offeredBy: { type: mongoose_1.SchemaTypes.Mixed, required: false }
20
+ // availability: { type: String, required: true }
21
+ };
22
+ const schemaOptions = {
23
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
24
+ autoCreate: false,
25
+ collection: 'eventOffers',
26
+ id: true,
27
+ read: settings_1.MONGO_READ_PREFERENCE,
28
+ writeConcern: writeConcern_1.writeConcern,
29
+ strict: true,
30
+ strictQuery: false,
31
+ timestamps: false,
32
+ versionKey: false,
33
+ toJSON: {
34
+ getters: false,
35
+ virtuals: false,
36
+ minimize: false,
37
+ versionKey: false
38
+ },
39
+ toObject: {
40
+ getters: false,
41
+ virtuals: true,
42
+ minimize: false,
43
+ versionKey: false
44
+ }
45
+ };
46
+ const indexes = [
47
+ // [
48
+ // { validFrom: 1 },
49
+ // { name: 'validFrom' }
50
+ // ],
51
+ // [
52
+ // {
53
+ // 'project.id': 1,
54
+ // 'itemOffered.id': 1,
55
+ // identifier: 1
56
+ // },
57
+ // {
58
+ // name: 'uniqueByItemOfferedAndIdentifier',
59
+ // unique: true
60
+ // }
61
+ // ],
62
+ // [
63
+ // { 'project.id': 1, validFrom: 1 },
64
+ // { name: 'projectId' }
65
+ // ],
66
+ // [
67
+ // { identifier: 1, validFrom: 1 },
68
+ // { name: 'identifier' }
69
+ // ],
70
+ // [
71
+ // { 'itemOffered.id': 1, validFrom: 1 },
72
+ // { name: 'itemOfferedId' }
73
+ // ],
74
+ // [
75
+ // { 'seller.id': 1, validFrom: 1 },
76
+ // { name: 'sellerId' }
77
+ // ],
78
+ // [
79
+ // { validThrough: 1, validFrom: 1 },
80
+ // { name: 'validThrough' }
81
+ // ]
82
+ ];
83
+ exports.indexes = indexes;
84
+ /**
85
+ * 拡張イベントオファースキーマ
86
+ */
87
+ let schema;
88
+ function createSchema() {
89
+ if (schema === undefined) {
90
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
91
+ if (settings_1.MONGO_AUTO_INDEX) {
92
+ indexes.forEach((indexParams) => {
93
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
94
+ });
95
+ }
96
+ }
97
+ return schema;
98
+ }
@@ -23,6 +23,7 @@ import type { CustomerRepo } from './repo/customer';
23
23
  import type { CustomerTypeRepo } from './repo/customerType';
24
24
  import type { EmailMessageRepo } from './repo/emailMessage';
25
25
  import type { EventRepo } from './repo/event';
26
+ import type { EventOfferRepo } from './repo/eventOffer';
26
27
  import type { EventSellerMakesOfferRepo } from './repo/eventSellerMakesOffer';
27
28
  import type { EventSeriesRepo } from './repo/eventSeries';
28
29
  import type { IdentityRepo } from './repo/identity';
@@ -181,6 +182,10 @@ export type Event = EventRepo;
181
182
  export declare namespace Event {
182
183
  function createInstance(...params: ConstructorParameters<typeof EventRepo>): Promise<EventRepo>;
183
184
  }
185
+ export type EventOffer = EventOfferRepo;
186
+ export declare namespace EventOffer {
187
+ function createInstance(...params: ConstructorParameters<typeof EventOfferRepo>): Promise<EventOfferRepo>;
188
+ }
184
189
  export type EventSellerMakesOffer = EventSellerMakesOfferRepo;
185
190
  export declare namespace EventSellerMakesOffer {
186
191
  function createInstance(...params: ConstructorParameters<typeof EventSellerMakesOfferRepo>): Promise<EventSellerMakesOfferRepo>;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Person = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = void 0;
12
+ exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
+ exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -310,6 +310,19 @@ var Event;
310
310
  }
311
311
  Event.createInstance = createInstance;
312
312
  })(Event || (exports.Event = Event = {}));
313
+ var EventOffer;
314
+ (function (EventOffer) {
315
+ let repo;
316
+ function createInstance(...params) {
317
+ return __awaiter(this, void 0, void 0, function* () {
318
+ if (repo === undefined) {
319
+ repo = (yield Promise.resolve().then(() => require('./repo/eventOffer'))).EventOfferRepo;
320
+ }
321
+ return new repo(...params);
322
+ });
323
+ }
324
+ EventOffer.createInstance = createInstance;
325
+ })(EventOffer || (exports.EventOffer = EventOffer = {}));
313
326
  var EventSellerMakesOffer;
314
327
  (function (EventSellerMakesOffer) {
315
328
  let repo;
@@ -3,6 +3,7 @@ import { Settings } from '../../../settings';
3
3
  import type { AdvanceBookingRequirementRepo } from '../../../repo/advanceBookingRequirement';
4
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
5
  import type { EventRepo } from '../../../repo/event';
6
+ import type { EventOfferRepo } from '../../../repo/eventOffer';
6
7
  import type { EventSeriesRepo } from '../../../repo/eventSeries';
7
8
  import type { IssuerRepo } from '../../../repo/issuer';
8
9
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
@@ -23,6 +24,7 @@ interface IStartOperationRepos {
23
24
  advanceBookingRequirement: AdvanceBookingRequirementRepo;
24
25
  stockHolder: StockHolderRepo;
25
26
  event: EventRepo;
27
+ eventOffer: EventOfferRepo;
26
28
  eventSeries: EventSeriesRepo;
27
29
  issuer: IssuerRepo;
28
30
  memberProgram: MemberProgramRepo;
@@ -47,6 +47,7 @@ function start(params, options) {
47
47
  now,
48
48
  store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id }
49
49
  })({
50
+ eventOffer: repos.eventOffer,
50
51
  issuer: repos.issuer,
51
52
  memberProgram: repos.memberProgram,
52
53
  productOffer: repos.productOffer
@@ -8,7 +8,7 @@ declare function validateIssuedOfferIfExists(params: {
8
8
  event: Pick<IMinimizedIndividualEvent, 'offers' | 'id' | 'project' | 'identifier'>;
9
9
  now: Date;
10
10
  object: factory.assetTransaction.reserve.IObjectWithoutDetail;
11
- makesOfferOnApplication: factory.event.screeningEvent.ISellerMakesOffer;
11
+ eventOffer: Pick<factory.eventOffer.IEventOffer, 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough'>;
12
12
  }): (repos: {
13
13
  issuer: IssuerRepo;
14
14
  }) => Promise<void>;
@@ -51,7 +51,7 @@ 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
53
  var _a, _b;
54
- const { event, acceptedDate, verifiedOffer, makesOfferOnApplication } = params;
54
+ const { event, acceptedDate, verifiedOffer, eventOffer } = params;
55
55
  // イベント識別子一致検証
56
56
  const itemOfferedIdentifier = verifiedOffer.itemOffered.identifier;
57
57
  if (typeof itemOfferedIdentifier !== 'string' || itemOfferedIdentifier === '') {
@@ -69,7 +69,7 @@ function validateOfferToken(params) {
69
69
  if (typeof applicationOfferIdentifier !== 'string' || applicationOfferIdentifier === '') {
70
70
  throw new factory.errors.Argument('reservationFor.offers.token', 'identifier must be string');
71
71
  }
72
- const applicationOfferIdentifierMustBe = makesOfferOnApplication.identifier;
72
+ const applicationOfferIdentifierMustBe = eventOffer.identifier;
73
73
  if (typeof applicationOfferIdentifierMustBe !== 'string') {
74
74
  throw new factory.errors.NotFound('makesOffer.identifier');
75
75
  }
@@ -115,9 +115,9 @@ 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, _d, _e;
118
- const { event, makesOfferOnApplication } = params;
118
+ const { event, eventOffer } = params;
119
119
  const acceptedDate = moment(params.now);
120
- const offerTokenIssuer = (_a = makesOfferOnApplication.offeredBy) === null || _a === void 0 ? void 0 : _a.identifier;
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
123
  const offerIdentifierMustBe = (_c = (_b = params.object.reservationFor) === null || _b === void 0 ? void 0 : _b.offers) === null || _c === void 0 ? void 0 : _c.identifier;
@@ -128,12 +128,12 @@ function validateIssuedOfferIfExists(params) {
128
128
  if (typeof offerToken !== 'string' || offerToken === '') {
129
129
  throw new factory.errors.ArgumentNull('object.reservationFor.offers.token');
130
130
  }
131
- if (typeof makesOfferOnApplication.identifier !== 'string' || makesOfferOnApplication.identifier === '') {
132
- throw new factory.errors.NotFound('seller.makesOffer.identifier');
131
+ if (typeof eventOffer.identifier !== 'string' || eventOffer.identifier === '') {
132
+ throw new factory.errors.NotFound('eventOffer.identifier');
133
133
  }
134
134
  // アプリケーションオファーコード一致検証
135
- if (makesOfferOnApplication.identifier !== offerIdentifierMustBe) {
136
- throw new factory.errors.Argument('object.reservationFor.offers.identifier', 'offers.identifier not matched');
135
+ if (eventOffer.identifier !== offerIdentifierMustBe) {
136
+ throw new factory.errors.Argument('object.reservationFor.offers.identifier', 'eventOffer.identifier not matched');
137
137
  }
138
138
  const issuer = yield repos.issuer.findByIdentifier({
139
139
  project: { id: event.project.id },
@@ -151,7 +151,7 @@ function validateIssuedOfferIfExists(params) {
151
151
  event,
152
152
  acceptedDate,
153
153
  verifiedOffer,
154
- makesOfferOnApplication,
154
+ eventOffer,
155
155
  object: params.object
156
156
  })();
157
157
  }
@@ -1,5 +1,6 @@
1
1
  import * as factory from '../../../factory';
2
2
  import { IMinimizedIndividualEvent } from '../../../factory/event';
3
+ import type { EventOfferRepo } from '../../../repo/eventOffer';
3
4
  import type { IssuerRepo } from '../../../repo/issuer';
4
5
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
5
6
  import type { ProductOfferRepo } from '../../../repo/productOffer';
@@ -19,6 +20,7 @@ declare function validateStartRequest(params: {
19
20
  id?: string;
20
21
  };
21
22
  }): (repos: {
23
+ eventOffer: EventOfferRepo;
22
24
  issuer: IssuerRepo;
23
25
  memberProgram: MemberProgramRepo;
24
26
  productOffer: ProductOfferRepo;
@@ -40,6 +40,7 @@ function validateStartRequest(params) {
40
40
  */
41
41
  function validateApplicationOffer(params) {
42
42
  return (repos) => __awaiter(this, void 0, void 0, function* () {
43
+ var _a, _b;
43
44
  const { event, availableAt } = params;
44
45
  const acceptedDate = moment(params.now);
45
46
  const eventOffers = event.offers;
@@ -67,20 +68,43 @@ function validateApplicationOffer(params) {
67
68
  throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
68
69
  }
69
70
  }
70
- // 有効メンバープログラムティアが存在する場合
71
- yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
72
- event,
73
- now: params.now,
74
- object: params.object,
75
- makesOfferOnApplication
76
- })(repos);
77
- // オファートークン検証(2025-10-21~)
78
- yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
79
- event,
80
- now: params.now,
81
- object: params.object,
82
- makesOfferOnApplication
83
- })(repos);
71
+ // support extensibleEventOffer(2025-11-11~)
72
+ if (eventOffers.typeOf === factory.offerType.AggregateOffer) {
73
+ // リクエストによるオファーコード指定が必須
74
+ const eventOfferIdentifierMustBe = (_b = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.offers) === null || _b === void 0 ? void 0 : _b.identifier;
75
+ if (typeof eventOfferIdentifierMustBe !== 'string' || eventOfferIdentifierMustBe === '') {
76
+ throw new factory.errors.ArgumentNull('reservationFor.offers.identifier');
77
+ }
78
+ const existingEventOffer = (yield repos.eventOffer.findEventOffers({
79
+ limit: 1,
80
+ page: 1,
81
+ project: { id: { $eq: event.project.id } }, // プロジェクト
82
+ validFrom: { $lte: acceptedDate.toDate() },
83
+ validThrough: { $gte: acceptedDate.toDate() },
84
+ itemOffered: { id: { $eq: event.id } }, // 対象イベント
85
+ identifier: { $eq: eventOfferIdentifierMustBe } // オファーコード
86
+ }, ['identifier', 'itemOffered', 'offeredBy', 'typeOf', 'validFrom', 'validThrough'])).shift();
87
+ if (existingEventOffer === undefined) {
88
+ throw new factory.errors.NotFound(`eventOffer: ${eventOfferIdentifierMustBe}`);
89
+ }
90
+ // 拡張可能なオファー設定の場合のみ、オファートークンを検証する(2025-11-11~)
91
+ yield (0, validateIssuedOfferIfExists_1.validateIssuedOfferIfExists)({
92
+ event,
93
+ now: params.now,
94
+ object: params.object,
95
+ eventOffer: existingEventOffer
96
+ })(repos);
97
+ }
98
+ else {
99
+ // 拡張可能なオファーに場合に、有効メンバープログラムティア設定は存在しない前提
100
+ // 有効メンバープログラムティアが存在する場合
101
+ yield (0, validateMemberTierIfExists_1.validateMemberTierIfExists)({
102
+ event,
103
+ now: params.now,
104
+ object: params.object,
105
+ makesOfferOnApplication
106
+ })(repos);
107
+ }
84
108
  });
85
109
  }
86
110
  /**
@@ -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* () {
24
- var _a, _b;
19
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
20
+ var _a, _b, _c, _d;
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,54 @@ 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
- if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
102
- throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
103
- }
104
- const issuedThroughTypeOf = (_a = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf;
105
- if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
106
- programMembershipUsedAsPermit = {
107
- identifier: permitOwnershipInfo.typeOfGood.identifier,
108
- issuedThrough: { typeOf: issuedThroughTypeOf },
109
- typeOf: factory.permit.PermitType.Permit
110
- };
52
+ const ownedGoodType = (_a = permitOwnershipInfo.typeOfGood) === null || _a === void 0 ? void 0 : _a.typeOf;
53
+ if (ownedGoodType === factory.permit.PermitType.Permit) {
54
+ const issuedThroughTypeOf = (_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf;
55
+ if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
56
+ programMembershipUsedAsPermit = {
57
+ identifier: permitOwnershipInfo.typeOfGood.identifier,
58
+ issuedThrough: { typeOf: issuedThroughTypeOf },
59
+ typeOf: factory.permit.PermitType.Permit
60
+ };
61
+ }
62
+ else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
63
+ || issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
64
+ if (typeof ((_c = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.id) !== 'string') {
65
+ throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
66
+ }
67
+ programMembershipUsedAsPermit = {
68
+ identifier: permitOwnershipInfo.typeOfGood.identifier,
69
+ issuedThrough: { id: permitOwnershipInfo.typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
70
+ typeOf: factory.permit.PermitType.Permit
71
+ };
72
+ }
73
+ else {
74
+ throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
75
+ }
111
76
  }
112
- else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
113
- || issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
114
- if (typeof ((_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
115
- throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
77
+ else if (ownedGoodType === factory.service.paymentService.PaymentServiceType.CreditCard) {
78
+ // CreditCard決済の場合、決済方法所有権を受け入れる(2025-11-11~)
79
+ const paymentServiceId = (_d = permitOwnershipInfo.typeOfGood) === null || _d === void 0 ? void 0 : _d.id;
80
+ const paymentMethodId = permitOwnershipInfo.typeOfGood.serviceOutput.paymentMethodId;
81
+ if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
82
+ throw new factory.errors.Argument('programMembershipUsed', 'paymentServiceId required');
83
+ }
84
+ if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
85
+ throw new factory.errors.Argument('programMembershipUsed', 'paymentMethodId required');
116
86
  }
117
87
  programMembershipUsedAsPermit = {
118
- identifier: permitOwnershipInfo.typeOfGood.identifier,
119
- issuedThrough: { id: permitOwnershipInfo.typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
88
+ identifier: paymentMethodId,
89
+ issuedThrough: { id: paymentServiceId, typeOf: ownedGoodType },
120
90
  typeOf: factory.permit.PermitType.Permit
121
91
  };
122
92
  }
123
93
  else {
124
- throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
94
+ throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
125
95
  }
126
96
  }
127
97
  }
@@ -5,6 +5,7 @@ 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';
10
11
  import type { MemberProgramRepo } from '../../../../repo/memberProgram';
@@ -52,6 +53,7 @@ declare function processStartReserve4chevre(params: {
52
53
  authorization: AuthorizationRepo;
53
54
  stockHolder: StockHolderRepo;
54
55
  event: EventRepo;
56
+ eventOffer: EventOfferRepo;
55
57
  eventSeries: EventSeriesRepo;
56
58
  issuer: IssuerRepo;
57
59
  memberProgram: MemberProgramRepo;
@@ -5,6 +5,7 @@ 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';
10
11
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
@@ -32,6 +33,7 @@ interface IAuthorizeRepos {
32
33
  assetTransaction: AssetTransactionRepo;
33
34
  authorization: AuthorizationRepo;
34
35
  event: EventRepo;
36
+ eventOffer: EventOfferRepo;
35
37
  eventSeries: EventSeriesRepo;
36
38
  issuer: IssuerRepo;
37
39
  memberProgram: MemberProgramRepo;
@@ -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 eventOfferAsNotification = (((_a = offers.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.COA)
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: (Array.isArray(offers.seller.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?: IPermitOrInvoice;
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(Object.assign({ transactionNumber }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined), (creditCard !== undefined) ? { creditCard } : undefined), (permitOrInvoice !== undefined) ? { permitOrInvoice } : undefined);
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
  * 通知対象としてのアクションを最適化
@@ -45,24 +45,40 @@ function verifyTicketTokenAsNeeded(params) {
45
45
  }
46
46
  if (authorizedObject.typeOf === 'OwnershipInfo') {
47
47
  const { typeOfGood } = authorizedObject;
48
- if (((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) !== paymentServiceType) {
49
- throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
48
+ if (typeOfGood.typeOf === factory.permit.PermitType.Permit || typeOfGood.typeOf === 'Invoice') {
49
+ if (((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) !== paymentServiceType) {
50
+ throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
51
+ }
52
+ // FaceToFace以外の場合、発行サービスIDを検証
53
+ if (typeOfGood.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
54
+ if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
55
+ throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
56
+ }
57
+ }
58
+ if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
59
+ permitOrInvoice = { identifier: typeOfGood.identifier, typeOf: factory.permit.PermitType.Permit };
60
+ }
61
+ else if (typeOfGood.typeOf === 'Invoice') {
62
+ // support paymentServiceType.MovieTicket(2024-11-23~)
63
+ permitOrInvoice = { paymentMethodId: typeOfGood.paymentMethodId, typeOf: 'Invoice' };
64
+ }
65
+ else {
66
+ throw new factory.errors.Argument('ticketToken', 'must be Permit or Invoice');
67
+ }
50
68
  }
51
- // FaceToFace以外の場合、発行サービスIDを検証
52
- if (typeOfGood.issuedThrough.typeOf !== factory.service.paymentService.PaymentServiceType.FaceToFace) {
53
- if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
69
+ else if (typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
70
+ || typeOfGood.typeOf === factory.service.paymentService.PaymentServiceType.MovieTicket) {
71
+ // 決済方法所有権を受け入れる(2025-11-11~)
72
+ if (typeOfGood.typeOf !== paymentServiceType) {
73
+ throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
74
+ }
75
+ if (typeOfGood.id !== issuedThrough.id) {
54
76
  throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
55
77
  }
56
- }
57
- if (typeOfGood.typeOf === factory.permit.PermitType.Permit) {
58
- permitOrInvoice = { identifier: typeOfGood.identifier, typeOf: factory.permit.PermitType.Permit };
59
- }
60
- else if (typeOfGood.typeOf === 'Invoice') {
61
- // support paymentServiceType.MovieTicket(2024-11-23~)
62
- permitOrInvoice = { paymentMethodId: typeOfGood.paymentMethodId, typeOf: 'Invoice' };
78
+ permitOrInvoice = { paymentMethodId: typeOfGood.serviceOutput.paymentMethodId, typeOf: 'Invoice' };
63
79
  }
64
80
  else {
65
- throw new factory.errors.Argument('ticketToken', 'must be Permit or Invoice');
81
+ throw new factory.errors.Argument('ticketToken', `invalid typeOfGood.typeOf ${typeOfGood.typeOf}`);
66
82
  }
67
83
  }
68
84
  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, permitOrInvoice } = fixTransactionNumberResult;
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)(Object.assign({ payTransaction, object: authorizeObjectIncludingPaymentMethodDetails }, ((permitOrInvoice === null || permitOrInvoice === void 0 ? void 0 : permitOrInvoice.typeOf) === factory.permit.PermitType.Permit) ? { permit: permitOrInvoice } : undefined));
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
  });
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-alpha.5",
15
- "@cinerino/sdk": "12.7.0-alpha.1",
14
+ "@chevre/factory": "5.2.0-alpha.7",
15
+ "@cinerino/sdk": "12.7.0-alpha.3",
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.0"
118
+ "version": "23.1.0-alpha.2"
119
119
  }