@chevre/domain 21.30.0-alpha.37 → 21.30.0-alpha.38

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.
@@ -19,6 +19,7 @@ async function main() {
19
19
  const authorizationRepo = await chevre.repository.Code.createInstance(mongoose.connection);
20
20
  const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
21
21
  const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
22
+ const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
22
23
 
23
24
  await (await chevre.service.reserve.createService()).verifyToken4reservation({
24
25
  project: { id: project.id },
@@ -29,7 +30,8 @@ async function main() {
29
30
  }
30
31
  })({
31
32
  authorization: authorizationRepo,
32
- order: orderRepo
33
+ order: orderRepo,
34
+ ticket: ticketRepo
33
35
  });
34
36
  console.log('verified.');
35
37
 
@@ -4,13 +4,14 @@ import * as mongoose from 'mongoose';
4
4
  import { chevre } from '../../../lib/index';
5
5
 
6
6
  const project = { id: String(process.env.PROJECT_ID) };
7
- const CODE = '33357ca4-55cb-4b36-8d82-af8e445c53c7';
7
+ const CODE = '85de7dc1-3761-4317-80d6-b36bf0b2788f';
8
8
  // const ID = '6631d754c20be0772c217b90';
9
9
 
10
10
  async function main() {
11
11
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
12
 
13
13
  const authorizationRepo = await chevre.repository.Code.createInstance(mongoose.connection);
14
+ const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
14
15
 
15
16
  const result = await authorizationRepo.findValidOneByCode({
16
17
  project,
@@ -29,9 +30,11 @@ async function main() {
29
30
  code: CODE,
30
31
  expiresIn: 18000,
31
32
  issuer: 'https://example.com',
32
- audience: 'https://example.com'
33
+ audience: 'https://example.com',
34
+ useJti: true
33
35
  })({
34
- authorization: authorizationRepo
36
+ authorization: authorizationRepo,
37
+ ticket: ticketRepo
35
38
  });
36
39
  console.log('token:', token);
37
40
  }
@@ -0,0 +1,40 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+ const TICKET_TOKEN = 'xxx';
8
+
9
+ mongoose.Model.on('index', (...args) => {
10
+ console.error('******** index event emitted. ********\n', args);
11
+ });
12
+
13
+ async function main() {
14
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
15
+
16
+ const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
17
+ const tickets = await ticketRepo.search(
18
+ {
19
+ limit: 1,
20
+ page: 1,
21
+ sort: { dateIssued: chevre.factory.sortType.Descending },
22
+ project: {
23
+ id: { $eq: project.id }
24
+ },
25
+ ticketToken: { $eq: TICKET_TOKEN }
26
+ }
27
+ );
28
+ console.log('tickets:', tickets);
29
+ console.log(tickets.length, 'tickets found');
30
+
31
+ const issueResult = await ticketRepo.issueByTicketToken({
32
+ ticketToken: TICKET_TOKEN,
33
+ project: { id: project.id }
34
+ });
35
+ console.log('issueResult:', issueResult);
36
+ }
37
+
38
+ main()
39
+ .then(console.log)
40
+ .catch(console.error);
@@ -129,6 +129,7 @@ async function main() {
129
129
  paymentServiceProvider: await chevre.repository.PaymentServiceProvider.createInstance(mongoose.connection),
130
130
  product: await chevre.repository.Product.createInstance(mongoose.connection),
131
131
  task: await chevre.repository.Task.createInstance(mongoose.connection),
132
+ ticket: await chevre.repository.Ticket.createInstance(mongoose.connection),
132
133
  transactionNumber: await chevre.repository.TransactionNumber.createInstance(client),
133
134
  transactionProcess:
134
135
  await chevre.repository.TransactionProcess.createInstance(client, { lockExpiresInSeconds: 120 }),
@@ -0,0 +1,5 @@
1
+ import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
2
+ declare const modelName = "Ticket";
3
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
4
+ declare function createSchema(): Schema;
5
+ export { modelName, indexes, createSchema };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSchema = exports.indexes = exports.modelName = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
7
+ const modelName = 'Ticket';
8
+ exports.modelName = modelName;
9
+ const schemaDefinition = {
10
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
11
+ typeOf: { type: String, required: true },
12
+ ticketToken: { type: String, required: true },
13
+ dateIssued: { type: Date, required: true }
14
+ };
15
+ const schemaOptions = {
16
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
17
+ autoCreate: false,
18
+ collection: 'tickets',
19
+ id: true,
20
+ read: 'primary',
21
+ writeConcern: writeConcern_1.writeConcern,
22
+ strict: true,
23
+ strictQuery: false,
24
+ timestamps: false,
25
+ versionKey: false,
26
+ toJSON: {
27
+ getters: false,
28
+ virtuals: false,
29
+ minimize: false,
30
+ versionKey: false
31
+ },
32
+ toObject: {
33
+ getters: false,
34
+ virtuals: true,
35
+ minimize: false,
36
+ versionKey: false
37
+ }
38
+ };
39
+ const indexes = [
40
+ [
41
+ { dateIssued: 1 },
42
+ { name: 'searchByDateIssued' }
43
+ ],
44
+ [
45
+ { 'project.id': 1, dateIssued: 1 },
46
+ { name: 'searchByProjectId' }
47
+ ],
48
+ [
49
+ { ticketToken: 1, dateIssued: 1 },
50
+ { name: 'searchByTicketToken' }
51
+ ]
52
+ ];
53
+ exports.indexes = indexes;
54
+ /**
55
+ * チケットスキーマ
56
+ */
57
+ let schema;
58
+ function createSchema() {
59
+ if (schema === undefined) {
60
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
61
+ if (settings_1.MONGO_AUTO_INDEX) {
62
+ indexes.forEach((indexParams) => {
63
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
64
+ });
65
+ }
66
+ }
67
+ return schema;
68
+ }
69
+ exports.createSchema = createSchema;
@@ -0,0 +1,52 @@
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ interface ITicket {
4
+ /**
5
+ * チケットID(jti)
6
+ */
7
+ id: string;
8
+ project: {
9
+ id: string;
10
+ typeOf: factory.organizationType.Project;
11
+ };
12
+ typeOf: 'Ticket';
13
+ ticketToken: string;
14
+ dateIssued: Date;
15
+ }
16
+ type IIssueParams = Pick<ITicket, 'ticketToken'> & {
17
+ project: {
18
+ id: string;
19
+ };
20
+ };
21
+ interface ISearchConditions {
22
+ limit?: number;
23
+ page?: number;
24
+ sort?: {
25
+ dateIssued?: factory.sortType;
26
+ };
27
+ project?: {
28
+ id?: {
29
+ $eq?: string;
30
+ };
31
+ };
32
+ id?: {
33
+ $eq?: string;
34
+ };
35
+ ticketToken?: {
36
+ $eq?: string;
37
+ };
38
+ }
39
+ /**
40
+ * チケットリポジトリ
41
+ */
42
+ export declare class TicketRepo {
43
+ private readonly ticketModel;
44
+ constructor(connection: Connection);
45
+ static CREATE_MONGO_CONDITIONS(params: ISearchConditions): FilterQuery<ITicket>[];
46
+ /**
47
+ * 承認コードからチケットを発行する
48
+ */
49
+ issueByTicketToken(params: IIssueParams): Promise<Pick<ITicket, 'id'>>;
50
+ search(params: ISearchConditions): Promise<ITicket[]>;
51
+ }
52
+ export {};
@@ -0,0 +1,79 @@
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.TicketRepo = void 0;
13
+ const factory = require("../factory");
14
+ const settings_1 = require("../settings");
15
+ const ticket_1 = require("./mongoose/schemas/ticket");
16
+ /**
17
+ * チケットリポジトリ
18
+ */
19
+ class TicketRepo {
20
+ constructor(connection) {
21
+ this.ticketModel = connection.model(ticket_1.modelName, (0, ticket_1.createSchema)());
22
+ }
23
+ static CREATE_MONGO_CONDITIONS(params) {
24
+ var _a, _b, _c, _d;
25
+ const andConditions = [];
26
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
27
+ if (typeof projectIdEq === 'string') {
28
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
29
+ }
30
+ const idEq = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$eq;
31
+ if (typeof idEq === 'string') {
32
+ andConditions.push({ _id: { $eq: idEq } });
33
+ }
34
+ const ticketTokenEq = (_d = params.ticketToken) === null || _d === void 0 ? void 0 : _d.$eq;
35
+ if (typeof ticketTokenEq === 'string') {
36
+ andConditions.push({ ticketToken: { $eq: ticketTokenEq } });
37
+ }
38
+ return andConditions;
39
+ }
40
+ /**
41
+ * 承認コードからチケットを発行する
42
+ */
43
+ issueByTicketToken(params) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const { ticketToken, project } = params;
46
+ const creatingTicket = {
47
+ dateIssued: new Date(),
48
+ project: { id: project.id, typeOf: factory.organizationType.Project },
49
+ ticketToken,
50
+ typeOf: 'Ticket'
51
+ };
52
+ const doc = yield this.ticketModel.create(creatingTicket);
53
+ return { id: doc.id };
54
+ });
55
+ }
56
+ search(params) {
57
+ var _a;
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const conditions = TicketRepo.CREATE_MONGO_CONDITIONS(params);
60
+ const query = this.ticketModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
61
+ // __v: 0,
62
+ // createdAt: 0,
63
+ // updatedAt: 0
64
+ });
65
+ if (typeof params.limit === 'number' && params.limit > 0) {
66
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
67
+ query.limit(params.limit)
68
+ .skip(params.limit * (page - 1));
69
+ }
70
+ if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.dateIssued) !== undefined) {
71
+ query.sort({ dateIssued: params.sort.dateIssued });
72
+ }
73
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
74
+ .exec()
75
+ .then((docs) => docs.map((doc) => doc.toObject()));
76
+ });
77
+ }
78
+ }
79
+ exports.TicketRepo = TicketRepo;
@@ -56,6 +56,7 @@ import type { RedisRepository as ServiceOutputIdentifierRepo } from './repo/serv
56
56
  import type { StockHolderRepository as StockHolderRepo } from './repo/stockHolder';
57
57
  import type { MongoRepository as TaskRepo } from './repo/task';
58
58
  import type { MongoRepository as TelemetryRepo } from './repo/telemetry';
59
+ import type { TicketRepo } from './repo/ticket';
59
60
  import type { MongoRepository as TransactionRepo } from './repo/transaction';
60
61
  import type { RedisRepository as TransactionNumberRepo } from './repo/transactionNumber';
61
62
  import type { TransactionProcessRepository } from './repo/transactionProcess';
@@ -321,6 +322,10 @@ export type Telemetry = TelemetryRepo;
321
322
  export declare namespace Telemetry {
322
323
  function createInstance(...params: ConstructorParameters<typeof TelemetryRepo>): Promise<TelemetryRepo>;
323
324
  }
325
+ export type Ticket = TicketRepo;
326
+ export declare namespace Ticket {
327
+ function createInstance(...params: ConstructorParameters<typeof TicketRepo>): Promise<TicketRepo>;
328
+ }
324
329
  export type Transaction = TransactionRepo;
325
330
  export declare namespace Transaction {
326
331
  function createInstance(...params: ConstructorParameters<typeof TransactionRepo>): Promise<TransactionRepo>;
@@ -10,7 +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.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = void 0;
13
+ exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -789,6 +789,19 @@ var Telemetry;
789
789
  }
790
790
  Telemetry.createInstance = createInstance;
791
791
  })(Telemetry = exports.Telemetry || (exports.Telemetry = {}));
792
+ var Ticket;
793
+ (function (Ticket) {
794
+ let repo;
795
+ function createInstance(...params) {
796
+ return __awaiter(this, void 0, void 0, function* () {
797
+ if (repo === undefined) {
798
+ repo = (yield Promise.resolve().then(() => require('./repo/ticket'))).TicketRepo;
799
+ }
800
+ return new repo(...params);
801
+ });
802
+ }
803
+ Ticket.createInstance = createInstance;
804
+ })(Ticket = exports.Ticket || (exports.Ticket = {}));
792
805
  var Transaction;
793
806
  (function (Transaction) {
794
807
  let repo;
@@ -1,5 +1,6 @@
1
1
  import type { MongoRepository as ActionRepo } from '../repo/action';
2
2
  import type { AuthorizationRepo, ICode } from '../repo/code';
3
+ import type { TicketRepo } from '../repo/ticket';
3
4
  import * as factory from '../factory';
4
5
  type IToken = string;
5
6
  interface IPayload {
@@ -9,6 +10,7 @@ interface IPayload {
9
10
  iss: string;
10
11
  exp: number;
11
12
  version: string;
13
+ jti?: string;
12
14
  typ: string;
13
15
  }
14
16
  type IPayloadWithNoVersion = factory.authorization.IObject & {
@@ -32,8 +34,13 @@ declare function getToken(params: {
32
34
  * jtw.payload.aud
33
35
  */
34
36
  audience: string;
37
+ /**
38
+ * payload.jtiを使用するかどうか
39
+ */
40
+ useJti: boolean;
35
41
  }): (repos: {
36
42
  authorization: AuthorizationRepo;
43
+ ticket: TicketRepo;
37
44
  }) => Promise<IToken>;
38
45
  declare function verifyToken(params: {
39
46
  project: {
@@ -45,5 +52,6 @@ declare function verifyToken(params: {
45
52
  }): (repos: {
46
53
  action?: ActionRepo;
47
54
  authorization: AuthorizationRepo;
55
+ ticket: TicketRepo;
48
56
  }) => Promise<factory.authorization.IObject | import("@chevre/factory/lib/action/authorize/offer/eventService").IPurpose>;
49
57
  export { IToken, ICode, IPayload, IPayloadWithNoVersion, getToken, verifyToken };
@@ -33,23 +33,35 @@ function getToken(params) {
33
33
  project: { id: params.project.id },
34
34
  code: params.code
35
35
  });
36
+ if (typeof params.issuer !== 'string' || params.issuer.length === 0) {
37
+ throw new factory.errors.ArgumentNull('issuer');
38
+ }
39
+ let subject = authorization.id;
40
+ let typ = `${credentials_1.credentials.jwt.payloadTypPrefix}:${authorization.typeOf}`;
41
+ let jti;
42
+ if (params.useJti) {
43
+ const { id } = yield repos.ticket.issueByTicketToken({
44
+ project: { id: params.project.id },
45
+ ticketToken: params.code
46
+ });
47
+ jti = id;
48
+ // ロール承認の場合、subjectはクライアントID,typはメンバータイプ
49
+ if (authorization.object.typeOf === factory.iam.RoleType.OrganizationRole) {
50
+ subject = authorization.object.member.id;
51
+ typ = `${credentials_1.credentials.jwt.payloadTypPrefix}:${authorization.object.member.typeOf}`;
52
+ }
53
+ }
36
54
  const isAuthorize4order = authorization.object.typeOf === factory.order.OrderType.Order;
37
55
  const payload = Object.assign(Object.assign({}, (settings_1.USE_TOKEN_WITH_NO_VERSION && isAuthorize4order) ? authorization.object : undefined), {
38
56
  // sub: authorization.id, // 拡張(2024-05-01~)
39
- token_use: 'access', version: credentials_1.credentials.jwt.version,
40
- // 'chevre:typeOf': authorization.typeOf // 拡張(2024-05-01~)
41
- typ: `${credentials_1.credentials.jwt.payloadTypPrefix}:${authorization.typeOf}` // 拡張(2024-05-07~)
57
+ token_use: 'access', version: credentials_1.credentials.jwt.version, // 拡張(2024-05-02~)
58
+ typ // 拡張(2024-05-07~)
42
59
  });
43
- if (typeof params.issuer !== 'string' || params.issuer.length === 0) {
44
- throw new factory.errors.ArgumentNull('issuer');
45
- }
46
60
  return new Promise((resolve, reject) => {
47
61
  // 所有権を暗号化する
48
- jwt.sign(payload, credentials_1.credentials.jwt.secret, Object.assign({ algorithm: ALGORITHM,
62
+ jwt.sign(payload, credentials_1.credentials.jwt.secret, Object.assign(Object.assign({ algorithm: ALGORITHM,
49
63
  // issuer: credentials.jwt.issuer,
50
- issuer: params.issuer, expiresIn: params.expiresIn, subject: authorization.id }, (typeof params.audience === 'string')
51
- ? { audience: params.audience }
52
- : undefined // 拡張(2024-05-02~)
64
+ issuer: params.issuer, expiresIn: params.expiresIn, subject }, (typeof params.audience === 'string') ? { audience: params.audience } : undefined), (typeof jti === 'string') ? { jwtid: jti } : undefined // 拡張(2024-05-08~)
53
65
  ), (err, encoded) => {
54
66
  if (err instanceof Error) {
55
67
  reject(err);
@@ -68,6 +80,7 @@ function getToken(params) {
68
80
  }
69
81
  exports.getToken = getToken;
70
82
  function verifyToken(params) {
83
+ // tslint:disable-next-line:max-func-body-length
71
84
  return (repos) => __awaiter(this, void 0, void 0, function* () {
72
85
  let result;
73
86
  let payload;
@@ -134,8 +147,26 @@ function verifyToken(params) {
134
147
  typeOf: resourceTypeByPayload
135
148
  };
136
149
  }
150
+ else if (typeof payload.jti === 'string') {
151
+ // jtiに対応(2024-05-08~)
152
+ const ticket = (yield repos.ticket.search({
153
+ limit: 1,
154
+ page: 1,
155
+ project: { id: { $eq: params.project.id } },
156
+ id: { $eq: payload.jti }
157
+ })).shift();
158
+ if (ticket === undefined) {
159
+ throw new factory.errors.NotFound('Ticket');
160
+ }
161
+ // 承認を参照
162
+ const { object } = yield repos.authorization.findValidOneByCode({
163
+ project: { id: params.project.id },
164
+ code: ticket.ticketToken
165
+ });
166
+ result = object;
167
+ }
137
168
  else {
138
- // 基本的には承認を参照
169
+ // 基本的にはsubで承認を参照
139
170
  const { object } = yield repos.authorization.findValidOneById({
140
171
  project: { id: params.project.id },
141
172
  id: payload.sub
@@ -18,6 +18,7 @@ import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLi
18
18
  import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
19
19
  import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
20
20
  import type { MongoRepository as TaskRepo } from '../../../repo/task';
21
+ import type { TicketRepo } from '../../../repo/ticket';
21
22
  import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
22
23
  import type { RedisRepository as TransactionNumberRepo } from '../../../repo/transactionNumber';
23
24
  interface IAuthorizeRepos {
@@ -40,6 +41,7 @@ interface IAuthorizeRepos {
40
41
  reservation: ReservationRepo;
41
42
  seat: SeatRepo;
42
43
  task: TaskRepo;
44
+ ticket: TicketRepo;
43
45
  transaction: TransactionRepo;
44
46
  transactionNumber: TransactionNumberRepo;
45
47
  }
@@ -16,6 +16,7 @@ import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLi
16
16
  import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
17
17
  import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
18
18
  import type { MongoRepository as TaskRepo } from '../../../repo/task';
19
+ import type { TicketRepo } from '../../../repo/ticket';
19
20
  declare function processStartReserve4chevre(params: {
20
21
  acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOffer<factory.service.webAPI.Identifier.Chevre>[];
21
22
  event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
@@ -48,6 +49,7 @@ declare function processStartReserve4chevre(params: {
48
49
  reservation: ReservationRepo;
49
50
  seat: SeatRepo;
50
51
  task: TaskRepo;
52
+ ticket: TicketRepo;
51
53
  assetTransaction: AssetTransactionRepo;
52
54
  }) => Promise<{
53
55
  acceptedOffers4result: factory.action.authorize.offer.eventService.IResultAcceptedOffer[];
@@ -62,7 +62,7 @@ function validateObjectWithoutDetail(params) {
62
62
  project: params.project,
63
63
  agent: params.project,
64
64
  token: String(programMembershipUsed)
65
- })({ action: repos.action, authorization: repos.authorization });
65
+ })(repos);
66
66
  if (Array.isArray(permitOwnershipInfo)) {
67
67
  throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
68
68
  }
@@ -12,6 +12,7 @@ import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/p
12
12
  import type { MongoRepository as ProductRepo } from '../../repo/product';
13
13
  import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
14
14
  import type { MongoRepository as TaskRepo } from '../../repo/task';
15
+ import type { TicketRepo } from '../../repo/ticket';
15
16
  import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
16
17
  import type { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
17
18
  import type { TransactionProcessRepository } from '../../repo/transactionProcess';
@@ -64,6 +65,7 @@ interface IAuthorizeRepos {
64
65
  paymentServiceProvider: PaymentServiceProviderRepo;
65
66
  product: ProductRepo;
66
67
  task: TaskRepo;
68
+ ticket: TicketRepo;
67
69
  transaction: TransactionRepo;
68
70
  transactionNumber: TransactionNumberRepo;
69
71
  transactionProcess: TransactionProcessRepository;
@@ -333,7 +333,7 @@ function authorize(params) {
333
333
  const { accountId } = yield fixAccountIdIfPossible({
334
334
  object: params.object,
335
335
  project: { id: transaction.project.id }
336
- })({ action: repos.action, authorization: repos.authorization });
336
+ })(repos);
337
337
  const authorizeObject = Object.assign(Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment }), (creditCard !== undefined) ? { creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined);
338
338
  // 承認アクションを開始する
339
339
  const taskId = (_b = params.sameAs) === null || _b === void 0 ? void 0 : _b.id;
@@ -1,6 +1,7 @@
1
1
  import * as factory from '../../factory';
2
2
  import type { AuthorizationRepo } from '../../repo/code';
3
3
  import type { MongoRepository as OrderRepo } from '../../repo/order';
4
+ import type { TicketRepo } from '../../repo/ticket';
4
5
  /**
5
6
  * 予約使用のためのチケットトークンを検証する
6
7
  */
@@ -26,4 +27,5 @@ export declare function verifyToken4reservation(params: {
26
27
  }): (repos: {
27
28
  authorization: AuthorizationRepo;
28
29
  order: OrderRepo;
30
+ ticket: TicketRepo;
29
31
  }) => Promise<void>;
@@ -25,7 +25,7 @@ function verifyToken4reservation(params) {
25
25
  project: params.project,
26
26
  agent: params.agent,
27
27
  token
28
- })({ authorization: repos.authorization });
28
+ })(repos);
29
29
  }
30
30
  else if (typeof ticketToken === 'string' && ticketToken.length > 0) {
31
31
  const findValidOneByCodeResult = yield repos.authorization.findValidOneByCode({
@@ -21,6 +21,7 @@ const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
21
21
  const product_1 = require("../../repo/product");
22
22
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
23
23
  const task_1 = require("../../repo/task");
24
+ const ticket_1 = require("../../repo/ticket");
24
25
  const transaction_1 = require("../../repo/transaction");
25
26
  const transactionNumber_1 = require("../../repo/transactionNumber");
26
27
  const transactionProcess_1 = require("../../repo/transactionProcess");
@@ -52,6 +53,7 @@ function call(params) {
52
53
  paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection),
53
54
  product: new product_1.MongoRepository(settings.connection),
54
55
  task: new task_1.MongoRepository(settings.connection),
56
+ ticket: new ticket_1.TicketRepo(settings.connection),
55
57
  transaction: new transaction_1.MongoRepository(settings.connection),
56
58
  transactionNumber: new transactionNumber_1.RedisRepository(settings.redisClient),
57
59
  transactionProcess: transactionProcessRepo
@@ -7,6 +7,7 @@ import type { MongoRepository as ProductRepo } from '../../repo/product';
7
7
  import type { MongoRepository as ProjectRepo } from '../../repo/project';
8
8
  import type { MongoRepository as SellerRepo } from '../../repo/seller';
9
9
  import type { MongoRepository as TaskRepo } from '../../repo/task';
10
+ import type { TicketRepo } from '../../repo/ticket';
10
11
  import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
11
12
  import type { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
12
13
  import { IPassportValidator as IWaiterPassportValidator, moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
@@ -17,6 +18,7 @@ export interface IStartOperationRepos {
17
18
  product: ProductRepo;
18
19
  project: ProjectRepo;
19
20
  seller: SellerRepo;
21
+ ticket: TicketRepo;
20
22
  transaction: TransactionRepo;
21
23
  transactionNumber: TransactionNumberRepo;
22
24
  assetTransaction: AssetTransactionRepo;
@@ -43,6 +45,7 @@ export type IAuthorizeOperation<T> = (repos: {
43
45
  order: OrderRepo;
44
46
  product: ProductRepo;
45
47
  project: ProjectRepo;
48
+ ticket: TicketRepo;
46
49
  transaction: TransactionRepo;
47
50
  assetTransaction: AssetTransactionRepo;
48
51
  }) => Promise<T>;
@@ -377,10 +377,7 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
377
377
  project: { id: project.id },
378
378
  agent: { id: project.id, typeOf: factory.organizationType.Project },
379
379
  token: fromLocation
380
- })({
381
- action: repos.action,
382
- authorization: repos.authorization
383
- });
380
+ })(repos);
384
381
  if (Array.isArray(paymentCardOwnershipInfo)) {
385
382
  throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
386
383
  }
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.30.0-alpha.37"
113
+ "version": "21.30.0-alpha.38"
114
114
  }