@chevre/domain 24.0.0-alpha.30 → 24.0.0-alpha.32

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 (43) hide show
  1. package/lib/chevre/repo/aggregateAction.js +1 -1
  2. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -1
  3. package/lib/chevre/repo/order.js +2 -1
  4. package/lib/chevre/repo/reservation.d.ts +6 -24
  5. package/lib/chevre/repo/reservation.js +35 -48
  6. package/lib/chevre/repository.d.ts +0 -5
  7. package/lib/chevre/repository.js +1 -12
  8. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +1 -17
  9. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +1 -41
  10. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +1 -11
  11. package/lib/chevre/service/assetTransaction/reserve/start.js +2 -5
  12. package/lib/chevre/service/delivery/factory.js +0 -1
  13. package/lib/chevre/service/delivery/reservation/factory.js +8 -13
  14. package/lib/chevre/service/offer/event/authorize/factory.js +0 -38
  15. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
  16. package/lib/chevre/service/offer/event/authorize.d.ts +4 -3
  17. package/lib/chevre/service/offer/event/authorize.js +22 -21
  18. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  19. package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +5 -0
  20. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
  21. package/lib/chevre/service/order/deleteOrder.js +1 -1
  22. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +1 -2
  23. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +7 -6
  24. package/lib/chevre/service/order/placeOrder/factory/orderedItem.js +0 -20
  25. package/lib/chevre/service/order/placeOrder/factory.js +0 -1
  26. package/lib/chevre/service/report.d.ts +1 -2
  27. package/lib/chevre/service/report.js +1 -3
  28. package/lib/chevre/service/reserve/cancelReservation.js +4 -11
  29. package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
  30. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +1 -2
  31. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -0
  32. package/lib/chevre/service/reserve/searchByOrder.d.ts +1 -1
  33. package/lib/chevre/service/task/voidReserveTransaction.js +2 -0
  34. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +2 -4
  35. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -3
  36. package/lib/chevre/service/validation/validateOrder.js +1 -3
  37. package/package.json +2 -2
  38. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +0 -10
  39. package/lib/chevre/repo/mongoose/schemas/telemetry.js +0 -80
  40. package/lib/chevre/repo/telemetry.d.ts +0 -9
  41. package/lib/chevre/repo/telemetry.js +0 -14
  42. package/lib/chevre/service/report/telemetry.d.ts +0 -313
  43. package/lib/chevre/service/report/telemetry.js +0 -444
@@ -187,7 +187,7 @@ class AggregateActionRepo {
187
187
  'object.typeOf': {
188
188
  $exists: true,
189
189
  $in: [
190
- factory.reservationType.BusReservation,
190
+ // factory.reservationType.BusReservation,
191
191
  factory.reservationType.EventReservation,
192
192
  factory.reservationType.ReservationPackage
193
193
  ]
@@ -1,7 +1,7 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import * as factory from '../../../factory';
4
- type IDocType = (Omit<factory.reservation.IReservation<factory.reservationType.BusReservation>, 'id'> | Omit<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'id'>) & {
4
+ type IDocType = (Omit<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'id'>) & {
5
5
  _id: string;
6
6
  bookingAgent?: any;
7
7
  previousReservationStatus?: factory.reservationStatusType;
@@ -949,7 +949,8 @@ class OrderRepo {
949
949
  typeOf: { $eq: factory.order.OrderType.Order },
950
950
  acceptedOffers: {
951
951
  $elemMatch: {
952
- 'itemOffered.typeOf': { $in: [factory.reservationType.BusReservation, factory.reservationType.EventReservation] },
952
+ // 'itemOffered.typeOf': { $in: [factory.reservationType.BusReservation, factory.reservationType.EventReservation] },
953
+ 'itemOffered.typeOf': { $in: [factory.reservationType.EventReservation] },
953
954
  'itemOffered.id': { $eq: params.reservationId }
954
955
  }
955
956
  },
@@ -7,12 +7,10 @@ export interface IUpdatePartiallyParams {
7
7
  }
8
8
  export type ICancelResult = UpdateWriteOpResult;
9
9
  export type ICheckedInResult = UpdateWriteOpResult;
10
- export type ICreatingReservation<T extends factory.reservationType> = T extends factory.reservationType.BusReservation ? (Omit<factory.reservation.busReservation.IReservation, 'id'>) & {
11
- _id: string;
12
- } : T extends factory.reservationType.EventReservation ? (Omit<factory.reservation.eventReservation.IReservation, 'id'>) & {
10
+ export type ICreatingReservation<T extends factory.reservationType> = T extends factory.reservationType.EventReservation ? (Omit<factory.reservation.eventReservation.IReservation, 'id'>) & {
13
11
  _id: string;
14
12
  } : never;
15
- type IKeyOfProjection = keyof factory.reservation.IReservation<factory.reservationType.BusReservation | factory.reservationType.EventReservation> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf';
13
+ type IKeyOfProjection = keyof factory.reservation.IReservation<factory.reservationType.EventReservation> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf';
16
14
  export type IAttendedReservation = Pick<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'id' | 'typeOf' | 'project' | 'modifiedTime'> & {
17
15
  reservationFor: Pick<factory.reservation.IReservationFor<factory.reservationType.EventReservation>, 'id' | 'typeOf'>;
18
16
  reservedTicket: Pick<factory.reservation.ITicket, 'dateUsed'>;
@@ -23,7 +21,7 @@ export type IAttendedReservation = Pick<factory.reservation.IReservation<factory
23
21
  export declare class ReservationRepo {
24
22
  private readonly reservationModel;
25
23
  constructor(connection: Connection);
26
- static CREATE_MONGO_CONDITIONS(params: factory.reservation.ISearchConditions<factory.reservationType>): FilterQuery<import("@chevre/factory/lib/reservation/busReservation").IReservation | import("@chevre/factory/lib/reservation/event").IReservation | import("@chevre/factory/lib/reservation/reservationPackage").IReservation>[];
24
+ static CREATE_MONGO_CONDITIONS(params: factory.reservation.ISearchConditions<factory.reservationType>): FilterQuery<import("@chevre/factory/lib/reservation/event").IReservation | import("@chevre/factory/lib/reservation/reservationPackage").IReservation>[];
27
25
  /**
28
26
  * 汎用予約カウント
29
27
  */
@@ -126,23 +124,7 @@ export declare class ReservationRepo {
126
124
  $in: string[];
127
125
  };
128
126
  }): Promise<string[]>;
129
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<(Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & {
130
- _id: string;
131
- bookingAgent?: any;
132
- previousReservationStatus?: factory.reservationStatusType;
133
- } & Required<{
134
- _id: string;
135
- }> & {
136
- __v: number;
137
- }) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
138
- _id: string;
139
- bookingAgent?: any;
140
- previousReservationStatus?: factory.reservationStatusType;
141
- } & Required<{
142
- _id: string;
143
- }> & {
144
- __v: number;
145
- }), "id"> & import("./mongoose/virtuals").IVirtuals, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, {}, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<(Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & {
127
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
146
128
  _id: string;
147
129
  bookingAgent?: any;
148
130
  previousReservationStatus?: factory.reservationStatusType;
@@ -150,7 +132,7 @@ export declare class ReservationRepo {
150
132
  _id: string;
151
133
  }> & {
152
134
  __v: number;
153
- }) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
135
+ }, "id"> & import("./mongoose/virtuals").IVirtuals, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, {}, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
154
136
  _id: string;
155
137
  bookingAgent?: any;
156
138
  previousReservationStatus?: factory.reservationStatusType;
@@ -158,7 +140,7 @@ export declare class ReservationRepo {
158
140
  _id: string;
159
141
  }> & {
160
142
  __v: number;
161
- }), "id"> & import("./mongoose/virtuals").IVirtuals) | null>;
143
+ }, "id"> & import("./mongoose/virtuals").IVirtuals) | null>;
162
144
  unsetUnnecessaryFields(params: {
163
145
  filter: any;
164
146
  $unset: any;
@@ -221,35 +221,41 @@ class ReservationRepo {
221
221
  });
222
222
  }
223
223
  switch (params.typeOf) {
224
- case factory.reservationType.BusReservation:
225
- const reservationForTypeOfEq = params.reservationFor?.typeOf;
226
- if (typeof reservationForTypeOfEq === 'string') {
227
- andConditions.push({
228
- 'reservationFor.typeOf': {
229
- $exists: true,
230
- $eq: reservationForTypeOfEq
231
- }
232
- });
233
- }
234
- const reservationForIdEq = params.reservationFor?.id?.$eq;
235
- if (typeof reservationForIdEq === 'string') {
236
- andConditions.push({
237
- 'reservationFor.id': {
238
- $exists: true,
239
- $eq: reservationForIdEq
240
- }
241
- });
242
- }
243
- const reservationForIdIn = params.reservationFor?.id?.$in;
244
- if (Array.isArray(reservationForIdIn)) {
245
- andConditions.push({
246
- 'reservationFor.id': {
247
- $exists: true,
248
- $in: reservationForIdIn
249
- }
250
- });
251
- }
252
- break;
224
+ // case factory.reservationType.BusReservation:
225
+ // const reservationForTypeOfEq = params.reservationFor?.typeOf;
226
+ // if (typeof reservationForTypeOfEq === 'string') {
227
+ // andConditions.push(
228
+ // {
229
+ // 'reservationFor.typeOf': {
230
+ // $exists: true,
231
+ // $eq: reservationForTypeOfEq
232
+ // }
233
+ // }
234
+ // );
235
+ // }
236
+ // const reservationForIdEq = params.reservationFor?.id?.$eq;
237
+ // if (typeof reservationForIdEq === 'string') {
238
+ // andConditions.push(
239
+ // {
240
+ // 'reservationFor.id': {
241
+ // $exists: true,
242
+ // $eq: reservationForIdEq
243
+ // }
244
+ // }
245
+ // );
246
+ // }
247
+ // const reservationForIdIn = params.reservationFor?.id?.$in;
248
+ // if (Array.isArray(reservationForIdIn)) {
249
+ // andConditions.push(
250
+ // {
251
+ // 'reservationFor.id': {
252
+ // $exists: true,
253
+ // $in: reservationForIdIn
254
+ // }
255
+ // }
256
+ // );
257
+ // }
258
+ // break;
253
259
  case factory.reservationType.EventReservation:
254
260
  if (typeof params.reservationFor?.id === 'string') {
255
261
  andConditions.push({
@@ -876,25 +882,6 @@ class ReservationRepo {
876
882
  params.subReservation.forEach((subReservation) => {
877
883
  let setOnInsert;
878
884
  switch (subReservation.typeOf) {
879
- case factory.reservationType.BusReservation:
880
- setOnInsert = {
881
- ...subReservation,
882
- _id: subReservation.id,
883
- bookingTime: params.bookingTime,
884
- checkedIn: false,
885
- attended: false,
886
- issuedThrough: params.issuedThrough,
887
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
888
- reservationFor: params.reservationFor,
889
- reservationNumber: params.reservationNumber,
890
- reservationStatus: factory.reservationStatusType.ReservationConfirmed,
891
- modifiedTime,
892
- // providerを追加(2023-07-19~)
893
- provider: params.provider,
894
- ...(params.underName !== undefined) ? { underName: params.underName } : undefined,
895
- ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined
896
- };
897
- break;
898
885
  case factory.reservationType.EventReservation:
899
886
  setOnInsert = {
900
887
  ...subReservation,
@@ -91,7 +91,6 @@ import type { SettingRepo } from './repo/setting';
91
91
  import type { JWTSettingRepo } from './repo/setting/jwt';
92
92
  import type { StockHolderRepo } from './repo/stockHolder';
93
93
  import type { TaskRepo } from './repo/task';
94
- import type { TelemetryRepo } from './repo/telemetry';
95
94
  import type { TicketRepo } from './repo/ticket';
96
95
  import type { TransactionRepo } from './repo/transaction';
97
96
  import type { PlaceOrderRepo } from './repo/transaction/placeOrder';
@@ -509,10 +508,6 @@ export type Task = TaskRepo;
509
508
  export declare namespace Task {
510
509
  function createInstance(...params: ConstructorParameters<typeof TaskRepo>): Promise<TaskRepo>;
511
510
  }
512
- export type Telemetry = TelemetryRepo;
513
- export declare namespace Telemetry {
514
- function createInstance(...params: ConstructorParameters<typeof TelemetryRepo>): Promise<TelemetryRepo>;
515
- }
516
511
  export type Ticket = TicketRepo;
517
512
  export declare namespace Ticket {
518
513
  function createInstance(...params: ConstructorParameters<typeof TicketRepo>): Promise<TicketRepo>;
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  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.AggregateAction = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedPaymentMethod = exports.AcceptedOffer = void 0;
27
- exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = 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 = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = void 0;
27
+ exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = 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 = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = void 0;
28
28
  var AcceptedOffer;
29
29
  (function (AcceptedOffer) {
30
30
  let repo;
@@ -1081,17 +1081,6 @@ var Task;
1081
1081
  }
1082
1082
  Task.createInstance = createInstance;
1083
1083
  })(Task || (exports.Task = Task = {}));
1084
- var Telemetry;
1085
- (function (Telemetry) {
1086
- let repo;
1087
- async function createInstance(...params) {
1088
- if (repo === undefined) {
1089
- repo = (await Promise.resolve().then(() => __importStar(require('./repo/telemetry')))).TelemetryRepo;
1090
- }
1091
- return new repo(...params);
1092
- }
1093
- Telemetry.createInstance = createInstance;
1094
- })(Telemetry || (exports.Telemetry = Telemetry = {}));
1095
1084
  var Ticket;
1096
1085
  (function (Ticket) {
1097
1086
  let repo;
@@ -119,23 +119,7 @@ function createPotentialActions(params) {
119
119
  transaction.object.reservations.map((reservation) => {
120
120
  // 最適化(2022-06-06~)
121
121
  let cancelObject;
122
- if (reservation.typeOf === factory.reservationType.BusReservation) {
123
- cancelObject = {
124
- typeOf: reservation.typeOf,
125
- id: reservation.id,
126
- issuedThrough: {
127
- typeOf: reservation.issuedThrough?.typeOf
128
- },
129
- reservationFor: {
130
- typeOf: reservation.reservationFor.typeOf,
131
- id: String(reservation.reservationFor.id)
132
- },
133
- reservationNumber: reservation.reservationNumber,
134
- // ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
135
- reservationStatus: factory.reservationStatusType.ReservationConfirmed
136
- };
137
- }
138
- else if (reservation.typeOf === factory.reservationType.EventReservation) {
122
+ if (reservation.typeOf === factory.reservationType.EventReservation) {
139
123
  cancelObject = {
140
124
  typeOf: reservation.typeOf,
141
125
  id: reservation.id,
@@ -393,46 +393,6 @@ function createReservation(params) {
393
393
  };
394
394
  }
395
395
  else {
396
- return {
397
- // project: params.project,
398
- typeOf: factory.reservationType.BusReservation,
399
- id: params.id,
400
- // reservationPackage保管に移行(2023-06-06~)
401
- // issuedThrough,
402
- additionalProperty: params.additionalProperty,
403
- // bookingTime: params.reserveDate,
404
- // modifiedTime: params.reserveDate,
405
- numSeats: 1,
406
- price: price4reservation,
407
- priceCurrency: factory.priceCurrency.JPY,
408
- // reservationNumber: params.reservationNumber,
409
- // statusは不要なので削除(2023-07-19~)
410
- // reservationStatus: factory.reservationStatusType.ReservationPending,
411
- reservedTicket: params.reservedTicket,
412
- // underName: {
413
- // typeOf: params.agent.typeOf,
414
- // name: params.agent.name
415
- // },
416
- // checkedIn: false,
417
- // attended: false,
418
- ...(typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined,
419
- ...(Array.isArray(params.subReservation))
420
- ? {
421
- subReservation: params.subReservation.map((r) => {
422
- return {
423
- reservedTicket: {
424
- ticketedSeat: r.reservedTicket.ticketedSeat,
425
- typeOf: 'Ticket'
426
- }
427
- };
428
- })
429
- }
430
- : undefined,
431
- // reservationPackage保管に移行(2023-06-06~)
432
- // ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined,
433
- ...(typeof params.programMembershipUsed?.identifier === 'string')
434
- ? { programMembershipUsed: params.programMembershipUsed }
435
- : undefined
436
- };
396
+ throw new factory.errors.NotImplemented(`reservationFor not implemented. typeOf:${params.reservationFor.typeOf}`);
437
397
  }
438
398
  }
@@ -144,16 +144,6 @@ function createIssuedThrough(params) {
144
144
  };
145
145
  }
146
146
  else {
147
- const issuedThrough = {
148
- typeOf: factory.product.ProductType.Transportation,
149
- // 興行IDを追加(2022-09-08~)
150
- id: eventOffers.itemOffered.id,
151
- availableChannel,
152
- // issuedThrough.serviceTypeを連携
153
- ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
154
- };
155
- return {
156
- issuedThrough
157
- };
147
+ throw new factory.errors.NotImplemented(`reservationFor not implemented. typeOf:${params.reservationFor.typeOf}`);
158
148
  }
159
149
  }
@@ -499,11 +499,8 @@ function processLockOfferRateLimit(params) {
499
499
  }
500
500
  },
501
501
  reservationFor: {
502
- startDate: (params.reservationFor.typeOf === factory.eventType.ScreeningEvent)
503
- ? (0, moment_1.default)(params.reservationFor.startDate)
504
- .toDate()
505
- : (0, moment_1.default)(params.reservationFor.departureTime)
506
- .toDate()
502
+ startDate: (0, moment_1.default)(params.reservationFor.startDate)
503
+ .toDate()
507
504
  },
508
505
  reservationNumber: params.reservationNumber
509
506
  };
@@ -55,7 +55,6 @@ function createOwnershipInfosFromOrder(params) {
55
55
  const ownedBy = createOwnedby(params);
56
56
  const itemOfferedType = itemOffered.typeOf;
57
57
  switch (itemOfferedType) {
58
- case factory.reservationType.BusReservation:
59
58
  case factory.reservationType.EventReservation:
60
59
  const excludeCOAReservation = acceptedOffer.offeredThrough?.identifier === factory.service.webAPI.Identifier.COA;
61
60
  if (excludeCOAReservation) {
@@ -39,10 +39,6 @@ function createReservationOwnershipInfo(params) {
39
39
  ownedThrough = (0, moment_timezone_1.default)(itemOffered.reservationFor.endDate)
40
40
  .toDate();
41
41
  }
42
- else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
43
- ownedThrough = (0, moment_timezone_1.default)(itemOffered.reservationFor.arrivalTime)
44
- .toDate();
45
- }
46
42
  else {
47
43
  throw new factory.errors.NotImplemented(`itemOffered.typeOf '${itemOffered.typeOf}' not implemented`);
48
44
  }
@@ -63,15 +59,14 @@ function createReservationOwnershipInfo(params) {
63
59
  bookingService: bookingService,
64
60
  ...(typeof itemOffered.issuedThrough?.typeOf === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined
65
61
  };
66
- }
67
- else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
68
- typeOfGood = {
69
- typeOf: itemOffered.typeOf,
70
- id: itemOffered.id,
71
- reservationNumber: itemOffered.reservationNumber,
72
- bookingService: bookingService,
73
- ...(typeof itemOffered.issuedThrough?.typeOf === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined
74
- };
62
+ // } else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
63
+ // typeOfGood = {
64
+ // typeOf: itemOffered.typeOf,
65
+ // id: itemOffered.id,
66
+ // reservationNumber: itemOffered.reservationNumber,
67
+ // bookingService: bookingService,
68
+ // ...(typeof itemOffered.issuedThrough?.typeOf === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined
69
+ // };
75
70
  }
76
71
  else {
77
72
  throw new factory.errors.NotImplemented(`itemOffered.typeOf '${itemOffered.typeOf}' not implemented`);
@@ -407,44 +407,6 @@ function createReservation(params) {
407
407
  : undefined
408
408
  };
409
409
  }
410
- else if (itemOffered.typeOf === factory.reservationType.BusReservation
411
- && event.typeOf === factory.tripType.BusTrip) {
412
- // const tripByEvent = event.offers?.itemOffered.serviceOutput?.reservationFor;
413
- // if (typeof tripByEvent?.typeOf !== 'string') {
414
- // throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput.reservationFor');
415
- // }
416
- const reservationFor = {
417
- typeOf: event.typeOf,
418
- id: event.id,
419
- arrivalBusStop: event.arrivalBusStop,
420
- departureBusStop: event.departureBusStop,
421
- name: event.name,
422
- departureTime: (0, moment_1.default)(event.departureTime)
423
- .toDate(),
424
- arrivalTime: (0, moment_1.default)(event.arrivalTime)
425
- .toDate(),
426
- busName: event.busName,
427
- busNumber: event.busNumber,
428
- identifier: event.identifier
429
- };
430
- if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
431
- throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
432
- }
433
- reservationItem = {
434
- typeOf: itemOffered.typeOf,
435
- additionalProperty: itemOffered.additionalProperty,
436
- additionalTicketText: itemOffered.additionalTicketText,
437
- id: itemOffered.id,
438
- issuedThrough: params.issuedThrough,
439
- reservationNumber: params.reservationNumber,
440
- reservationFor,
441
- reservedTicket,
442
- // 使用メンバーシップがあれば追加
443
- ...(typeof itemOffered.programMembershipUsed?.typeOf === 'string')
444
- ? { programMembershipUsed: itemOffered.programMembershipUsed }
445
- : undefined
446
- };
447
- }
448
410
  else {
449
411
  throw new factory.errors.Argument('itemOffered');
450
412
  }
@@ -1,6 +1,5 @@
1
1
  import * as factory from '../../../../factory';
2
2
  import { Settings } from '../../../../settings';
3
- import type { ActionRepo } from '../../../../repo/action';
4
3
  import type { AdvanceBookingRequirementRepo } from '../../../../repo/advanceBookingRequirement';
5
4
  import type { AssetTransactionRepo } from '../../../../repo/assetTransaction';
6
5
  import type { AuthorizationRepo } from '../../../../repo/authorization';
@@ -51,7 +50,6 @@ declare function processStartReserve4chevre(params: {
51
50
  */
52
51
  maxReservationGracePeriodInDays: number;
53
52
  }): (repos: {
54
- action: ActionRepo;
55
53
  advanceBookingRequirement: AdvanceBookingRequirementRepo;
56
54
  authorization: AuthorizationRepo;
57
55
  stockHolder: StockHolderRepo;
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../../../factory';
2
2
  import { Settings } from '../../../settings';
3
- import type { ActionRepo } from '../../../repo/action';
3
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
4
4
  import type { AdvanceBookingRequirementRepo } from '../../../repo/advanceBookingRequirement';
5
5
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
6
6
  import type { AuthorizationRepo } from '../../../repo/authorization';
@@ -29,7 +29,8 @@ import type { TicketRepo } from '../../../repo/ticket';
29
29
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
30
30
  import type { TransactionNumberRepo } from '../../../repo/transactionNumber';
31
31
  interface IAuthorizeRepos {
32
- action: ActionRepo;
32
+ action?: never;
33
+ authorizeOfferAction: AuthorizeOfferActionRepo;
33
34
  advanceBookingRequirement: AdvanceBookingRequirementRepo;
34
35
  assetTransaction: AssetTransactionRepo;
35
36
  authorization: AuthorizationRepo;
@@ -98,4 +99,4 @@ declare function authorize(params: {
98
99
  }, options: IAuthorizeOptions): IAuthorizeOperation<Pick<IAuthorizeOfferAction, 'id'> & {
99
100
  result: IAuthorizeOfferAction['result'];
100
101
  }>;
101
- export { authorize };
102
+ export { IAuthorizeRepos, authorize };
@@ -63,7 +63,7 @@ function authorize(params, options) {
63
63
  event, transaction,
64
64
  instrument: { transactionNumber }
65
65
  });
66
- const action = await repos.action.start(actionAttributes);
66
+ const action = await repos.authorizeOfferAction.start(actionAttributes);
67
67
  try {
68
68
  const processStartReserveResult = await (0, processStartReserve4chevre_1.processStartReserve4chevre)({
69
69
  acceptedOffers, event,
@@ -92,7 +92,7 @@ function authorize(params, options) {
92
92
  }
93
93
  catch (error) {
94
94
  try {
95
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
95
+ await repos.authorizeOfferAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
96
96
  }
97
97
  catch (__) {
98
98
  // no op
@@ -100,7 +100,7 @@ function authorize(params, options) {
100
100
  throw error;
101
101
  }
102
102
  const result = (0, factory_1.acceptedOffers2authorizeResult)({ acceptedOffers, acceptedOffers4result, noOfferSpecified, ticketOffers });
103
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
103
+ await repos.authorizeOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
104
104
  return { id: action.id, result };
105
105
  };
106
106
  }
@@ -329,24 +329,24 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
329
329
  };
330
330
  }
331
331
  switch (typeOf) {
332
- case factory.reservationType.BusReservation:
333
- const serviceOutputAsBusReservation = {
334
- typeOf,
335
- ...(Array.isArray(additionalProperty)) ? { additionalProperty } : undefined,
336
- ...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
337
- ...(programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined,
338
- ...(Array.isArray(subReservation)) ? { subReservation } : undefined,
339
- ...(reservedTicket !== undefined) ? {
340
- reservedTicket: {
341
- typeOf: 'Ticket',
342
- // チケット識別子指定拡張(2024-04-15~)
343
- ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
344
- ...(typeof ticketedSeat?.typeOf === 'string') ? { ticketedSeat } : undefined
345
- }
346
- } : undefined
347
- };
348
- itemOfferedServiceOutput = serviceOutputAsBusReservation;
349
- break;
332
+ // case factory.reservationType.BusReservation:
333
+ // const serviceOutputAsBusReservation: factory.assetTransaction.reserve.IBusReservatonAsItemOfferedServiceOutput = {
334
+ // typeOf,
335
+ // ...(Array.isArray(additionalProperty)) ? { additionalProperty } : undefined,
336
+ // ...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
337
+ // ...(programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined,
338
+ // ...(Array.isArray(subReservation)) ? { subReservation } : undefined,
339
+ // ...(reservedTicket !== undefined) ? {
340
+ // reservedTicket: {
341
+ // typeOf: 'Ticket',
342
+ // // チケット識別子指定拡張(2024-04-15~)
343
+ // ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
344
+ // ...(typeof ticketedSeat?.typeOf === 'string') ? { ticketedSeat } : undefined
345
+ // }
346
+ // } : undefined
347
+ // };
348
+ // itemOfferedServiceOutput = serviceOutputAsBusReservation;
349
+ // break;
350
350
  case factory.reservationType.EventReservation:
351
351
  const serviceOutputAsEventReservation = {
352
352
  typeOf,
@@ -366,6 +366,7 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
366
366
  itemOfferedServiceOutput = serviceOutputAsEventReservation;
367
367
  break;
368
368
  default:
369
+ throw new factory.errors.NotImplemented(`serviceOutput not implemented. typeOf:${typeOf}`);
369
370
  // no op
370
371
  }
371
372
  }
@@ -3,6 +3,7 @@ import * as factory from '../../../factory';
3
3
  import { Settings } from '../../../settings';
4
4
  import type { ActionRepo } from '../../../repo/action';
5
5
  import type { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
6
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
6
7
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
7
8
  import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
8
9
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
@@ -14,6 +15,7 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
14
15
  interface IVoidTransactionRepos {
15
16
  action: ActionRepo;
16
17
  acceptCOAOfferAction: AcceptCOAOfferActionRepo;
18
+ authorizeOfferAction: AuthorizeOfferActionRepo;
17
19
  assetTransaction: AssetTransactionRepo;
18
20
  stockHolder: StockHolderRepo;
19
21
  offerRateLimit: OfferRateLimitRepo;
@@ -2,6 +2,7 @@ import type * as COA from '@motionpicture/coa-service';
2
2
  import * as factory from '../../../factory';
3
3
  import { Settings } from '../../../settings';
4
4
  import type { ActionRepo } from '../../../repo/action';
5
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
5
6
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
6
7
  import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
7
8
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
@@ -11,7 +12,11 @@ import type { StockHolderRepo } from '../../../repo/stockHolder';
11
12
  import type { TaskRepo } from '../../../repo/task';
12
13
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
13
14
  interface IVoidTransactionByActionIdRepos {
15
+ /**
16
+ * CancelAction開始で使用される
17
+ */
14
18
  action: ActionRepo;
19
+ authorizeOfferAction: AuthorizeOfferActionRepo;
15
20
  assetTransaction: AssetTransactionRepo;
16
21
  stockHolder: StockHolderRepo;
17
22
  offerRateLimit: OfferRateLimitRepo;
@@ -50,13 +50,13 @@ function voidTransactionByActionId(params) {
50
50
  // throw new factory.errors.Forbidden('Transaction not yours');
51
51
  // }
52
52
  const orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.purpose.id });
53
- const action = await repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
53
+ const action = await repos.authorizeOfferAction.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
54
54
  if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
55
55
  throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
56
56
  }
57
57
  // MongoDBでcompleteステータスであるにも関わらず、Chevreでは削除されている、というのが最悪の状況
58
58
  // それだけは回避するためにMongoDBを先に変更
59
- await repos.action.cancelWithVoid({ typeOf: factory.actionType.AuthorizeAction, id: params.id, cancelAction });
59
+ await repos.authorizeOfferAction.cancelWithVoid({ typeOf: factory.actionType.AuthorizeAction, id: params.id, cancelAction });
60
60
  // add orderInTransaction(2024-01-15~)
61
61
  // USE_CREATE_ORDER_ON_OFFER_ACCEPTEDの場合、orderNumber発行済のはず
62
62
  // const orderNumberByTransaction = transaction.object.orderNumber;
@@ -119,7 +119,7 @@ function deleteReservationsByOrder(order) {
119
119
  orderNumber: { $eq: order.orderNumber },
120
120
  project: { id: { $eq: order.project.id } },
121
121
  acceptedOffers: {
122
- itemOffered: { typeOf: { $in: [factory.reservationType.BusReservation, factory.reservationType.EventReservation] } }
122
+ itemOffered: { typeOf: { $in: [factory.reservationType.EventReservation] } }
123
123
  }
124
124
  });
125
125
  const reservationIds = acceptedOffers.map((o) => String(o.itemOffered.id));