@chevre/domain 21.37.0-alpha.8 → 21.37.0

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 (73) hide show
  1. package/example/src/chevre/processOrder.ts +87 -0
  2. package/example/src/chevre/transaction/processPlaceOrder.ts +17 -143
  3. package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
  4. package/lib/chevre/factory/transaction.d.ts +1 -4
  5. package/lib/chevre/repo/passport.d.ts +39 -0
  6. package/lib/chevre/repo/passport.js +134 -0
  7. package/lib/chevre/repo/task.d.ts +9 -0
  8. package/lib/chevre/repo/task.js +23 -2
  9. package/lib/chevre/repository.d.ts +5 -0
  10. package/lib/chevre/repository.js +15 -2
  11. package/lib/chevre/service/accountTransaction/deposit.js +0 -1
  12. package/lib/chevre/service/accountTransaction/transfer.js +0 -1
  13. package/lib/chevre/service/accountTransaction/withdraw.js +0 -1
  14. package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +22 -0
  15. package/lib/chevre/service/assetTransaction/reserve/cancel.js +41 -0
  16. package/lib/chevre/service/assetTransaction/reserve/confirm/factory.d.ts +8 -0
  17. package/lib/chevre/service/assetTransaction/reserve/confirm/factory.js +94 -0
  18. package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +19 -0
  19. package/lib/chevre/service/assetTransaction/reserve/confirm.js +93 -0
  20. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +15 -0
  21. package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +99 -0
  22. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +28 -0
  23. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +405 -0
  24. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +15 -0
  25. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +40 -0
  26. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +54 -0
  27. package/lib/chevre/service/assetTransaction/reserve/{factory.js → start/factory/createReservation.js} +3 -222
  28. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +22 -0
  29. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +90 -0
  30. package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.d.ts +1 -1
  31. package/lib/chevre/service/assetTransaction/reserve/{factory → start/factory}/price.js +1 -1
  32. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +74 -0
  33. package/lib/chevre/service/assetTransaction/reserve/start.js +570 -0
  34. package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -128
  35. package/lib/chevre/service/assetTransaction/reserve.js +9 -1047
  36. package/lib/chevre/service/offer/event/{defaultOffer.d.ts → authorize/defaultOffer.d.ts} +1 -1
  37. package/lib/chevre/service/offer/event/{defaultOffer.js → authorize/defaultOffer.js} +1 -1
  38. package/lib/chevre/service/offer/event/{factory.d.ts → authorize/factory.d.ts} +13 -20
  39. package/lib/chevre/service/offer/event/{factory.js → authorize/factory.js} +72 -146
  40. package/lib/chevre/service/offer/event/{processStartReserve4chevre.d.ts → authorize/processStartReserve4chevre.d.ts} +19 -19
  41. package/lib/chevre/service/offer/event/{processStartReserve4chevre.js → authorize/processStartReserve4chevre.js} +8 -13
  42. package/lib/chevre/service/offer/event/authorize.d.ts +1 -1
  43. package/lib/chevre/service/offer/event/authorize.js +104 -128
  44. package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +9 -0
  45. package/lib/chevre/service/offer/event/importFromCOA/factory.js +67 -0
  46. package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
  47. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +0 -3
  48. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +3 -3
  49. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +4 -4
  50. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +16 -0
  51. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.js +168 -0
  52. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -5
  53. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +4 -135
  54. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
  55. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
  56. package/lib/chevre/service/order.d.ts +2 -2
  57. package/lib/chevre/service/order.js +2 -1
  58. package/lib/chevre/service/transaction/moneyTransfer.d.ts +3 -2
  59. package/lib/chevre/service/transaction/moneyTransfer.js +1 -2
  60. package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.d.ts +10 -0
  61. package/lib/chevre/service/transaction/placeOrderInProgress/start/factory.js +36 -0
  62. package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +6 -1
  63. package/lib/chevre/service/transaction/placeOrderInProgress/start.js +26 -12
  64. package/lib/chevre/service/validation/validateOrder.js +1 -1
  65. package/lib/chevre/settings.d.ts +1 -0
  66. package/lib/chevre/settings.js +5 -1
  67. package/package.json +3 -3
  68. package/example/src/chevre/migrateAuthorizeEventServiceOfferResult.ts +0 -163
  69. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +0 -96
  70. package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +0 -2
  71. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +0 -29
  72. package/lib/chevre/service/transaction/validation.d.ts +0 -14
  73. package/lib/chevre/service/transaction/validation.js +0 -101
@@ -1,72 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPotentialActions = exports.createReservation = exports.createIssuedThrough = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
4
- /**
5
- * 予約取引ファクトリー
6
- */
3
+ exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createReservation = exports.createAdditionalTicketText = exports.createAdditionalProperty = void 0;
7
4
  const moment = require("moment");
8
5
  const util = require("util");
9
- const factory = require("../../../factory");
10
- const accountTransactionIdentifier_1 = require("../../../factory/accountTransactionIdentifier");
11
- const price_1 = require("./factory/price");
12
- function createStartParams(params) {
13
- var _a;
14
- const reservationNumber = params.reservationNumber;
15
- const provider = {
16
- id: params.provider.id,
17
- typeOf: factory.organizationType.Corporation
18
- };
19
- // reservationFor,issuedThrough保管をaddReservationsから移行(2024-07-01~)
20
- const reservationFor = createReservationFor(params.event, true);
21
- const { issuedThrough } = createIssuedThrough({ reservationFor: params.event });
22
- const reservationPackage = Object.assign({ issuedThrough,
23
- provider,
24
- reservationFor, reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, disablePendingReservations: true, useHoldStockByTransactionNumber: true, typeOf: factory.reservationType.ReservationPackage }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined);
25
- return {
26
- project: { id: params.project.id, typeOf: factory.organizationType.Project },
27
- typeOf: factory.assetTransactionType.Reserve,
28
- transactionNumber: reservationNumber,
29
- agent: params.agent,
30
- object: reservationPackage,
31
- expires: params.expires
32
- };
33
- }
34
- exports.createStartParams = createStartParams;
35
- /**
36
- * ポイント特典を作成する
37
- */
38
- function createPointAward(params) {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
40
- let pointAward;
41
- const pointAwardAmount = (_b = (_a = params.offer.itemOffered) === null || _a === void 0 ? void 0 : _a.pointAward) === null || _b === void 0 ? void 0 : _b.amount;
42
- const pointAwardDescription = (_d = (_c = params.offer.itemOffered) === null || _c === void 0 ? void 0 : _c.pointAward) === null || _d === void 0 ? void 0 : _d.description;
43
- const pointAwardToLocationIdentifier = (_g = (_f = (_e = params.acceptedOffer.itemOffered) === null || _e === void 0 ? void 0 : _e.pointAward) === null || _f === void 0 ? void 0 : _f.toLocation) === null || _g === void 0 ? void 0 : _g.identifier;
44
- const pointAwardToLocationIssuedThroughId = (_k = (_j = (_h = params.acceptedOffer.itemOffered) === null || _h === void 0 ? void 0 : _h.pointAward) === null || _j === void 0 ? void 0 : _j.toLocation) === null || _k === void 0 ? void 0 : _k.issuedThrough.id;
45
- const pointAwardRecipient = (_m = (_l = params.acceptedOffer.itemOffered) === null || _l === void 0 ? void 0 : _l.pointAward) === null || _m === void 0 ? void 0 : _m.recipient;
46
- // const pointAwardPurposeIdentifier = params.acceptedOffer.itemOffered?.pointAward?.purpose?.identifier;
47
- // オファーのpointAward設定が適切にされていれば、指定されたtoLocationを反映する
48
- if (typeof (pointAwardAmount === null || pointAwardAmount === void 0 ? void 0 : pointAwardAmount.value) === 'number'
49
- && typeof (pointAwardAmount === null || pointAwardAmount === void 0 ? void 0 : pointAwardAmount.currency) === 'string'
50
- && typeof pointAwardToLocationIdentifier === 'string'
51
- && typeof pointAwardToLocationIssuedThroughId === 'string') {
52
- // ここで識別子を作成する(入金のユニークネスが保証される)
53
- const purposeIdentifier = (0, accountTransactionIdentifier_1.createPointAwardPurposeIdentifier4reservation)({
54
- assetTransaction: { typeOf: factory.assetTransactionType.Reserve },
55
- project: { id: params.project.id },
56
- reservation: { id: params.reservation.id },
57
- toLocation: { identifier: pointAwardToLocationIdentifier }
58
- });
59
- pointAward = Object.assign(Object.assign({ amount: pointAwardAmount, purpose: { identifier: purposeIdentifier }, toLocation: {
60
- typeOf: factory.permit.PermitType.Permit,
61
- identifier: pointAwardToLocationIdentifier,
62
- issuedThrough: { id: pointAwardToLocationIssuedThroughId }
63
- }, typeOf: factory.actionType.MoneyTransfer }, (typeof pointAwardDescription === 'string') ? { description: pointAwardDescription } : undefined), (pointAwardRecipient !== undefined) ? { recipient: pointAwardRecipient } : undefined
64
- // ...(typeof pointAwardPurposeIdentifier === 'string') ? { purpose: { identifier: pointAwardPurposeIdentifier } } : undefined
65
- );
66
- }
67
- return pointAward;
68
- }
69
- exports.createPointAward = createPointAward;
6
+ const factory = require("../../../../../factory");
7
+ const price_1 = require("./price");
70
8
  function createTicketIdentifier(params) {
71
9
  var _a, _b, _c, _d;
72
10
  // チケット識別子の規定値を作成
@@ -350,72 +288,6 @@ function createAdditionalTicketText(params) {
350
288
  return (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.additionalTicketText;
351
289
  }
352
290
  exports.createAdditionalTicketText = createAdditionalTicketText;
353
- function createReservationFor(params, useOptimizeReservation) {
354
- var _a, _b;
355
- if (params.typeOf === factory.eventType.ScreeningEvent) {
356
- return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params, useOptimizeReservation), typeOf: params.typeOf }, (params.doorTime instanceof Date)
357
- ? { doorTime: params.doorTime }
358
- : undefined);
359
- }
360
- else {
361
- const tripByEvent = (_b = (_a = params.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservationFor;
362
- if (typeof (tripByEvent === null || tripByEvent === void 0 ? void 0 : tripByEvent.typeOf) !== 'string') {
363
- throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput?.reservationFor');
364
- }
365
- return Object.assign(Object.assign({}, tripByEvent), { arrivalTime: params.endDate, id: params.id, name: params.name, departureTime: params.startDate });
366
- }
367
- }
368
- exports.createReservationFor = createReservationFor;
369
- function optimizeReservationSuperEvent(params, useOptimizeReservation) {
370
- const superEvent = params.superEvent;
371
- return Object.assign(Object.assign({ id: superEvent.id,
372
- // kanaName: superEvent.kanaName, // 廃止(2024-01-26~)
373
- location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
374
- ? { headline: superEvent.headline }
375
- : undefined), (useOptimizeReservation)
376
- ? {}
377
- : {
378
- additionalProperty: (Array.isArray(superEvent.additionalProperty))
379
- ? superEvent.additionalProperty
380
- : []
381
- });
382
- }
383
- function createIssuedThrough(params) {
384
- var _a;
385
- const eventOffers = params.reservationFor.offers;
386
- // offersは必ず存在するはず
387
- if (eventOffers === undefined) {
388
- throw new factory.errors.NotFound('reservationFor.offers');
389
- }
390
- const serviceTypeOfIssuedThrough = (typeof ((_a = eventOffers.itemOffered.serviceType) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string')
391
- ? {
392
- codeValue: eventOffers.itemOffered.serviceType.codeValue,
393
- inCodeSet: {
394
- typeOf: 'CategoryCodeSet',
395
- identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
396
- },
397
- typeOf: 'CategoryCode'
398
- }
399
- : undefined;
400
- const availableChannel = eventOffers.itemOffered.availableChannel;
401
- if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
402
- const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.EventService,
403
- // 興行IDを追加(2022-09-08~)
404
- id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
405
- return {
406
- issuedThrough
407
- };
408
- }
409
- else {
410
- const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.Transportation,
411
- // 興行IDを追加(2022-09-08~)
412
- id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
413
- return {
414
- issuedThrough
415
- };
416
- }
417
- }
418
- exports.createIssuedThrough = createIssuedThrough;
419
291
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
420
292
  function createReservation(params) {
421
293
  var _a, _b;
@@ -491,94 +363,3 @@ function createReservation(params) {
491
363
  }
492
364
  }
493
365
  exports.createReservation = createReservation;
494
- // tslint:disable-next-line:max-func-body-length
495
- function createPotentialActions(params) {
496
- // const transaction = params.transaction;
497
- // const reservationFor = transaction.object.reservationFor;
498
- // if (reservationFor === undefined) {
499
- // throw new factory.errors.NotFound('transaction.object.reservationFor');
500
- // }
501
- var _a;
502
- // discontinue(2024-07-01~)
503
- // const useOptimizeReservation: boolean = !USE_OPTIMIZE_RESERVATION_EXCEPTIONS.includes(transaction.project.id);
504
- // 予約アクション属性作成
505
- // const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
506
- // let reserveActionAttributes: factory.action.reserve.IAttributes[] = [];
507
- // let reservationPackage: factory.action.reserve.IObject | undefined;
508
- let underName;
509
- // purpose:Orderの指定があれば、underName,issuedByを調整(2022-05-23~)
510
- if (typeof ((_a = params.order) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
511
- const ordre2reservationUnderNameResult = ordre2reservationUnderName({ order: params.order });
512
- underName = ordre2reservationUnderNameResult.underName;
513
- }
514
- // if (pendingReservations.length > 0) {
515
- // const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
516
- // pendingReservations.forEach((reservation) => {
517
- // const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
518
- // (o) => o.itemOffered?.serviceOutput?.id === reservation.id
519
- // );
520
- // moneyTransferActions.push(...createMoneyTransferActions({
521
- // acceptedOffer: acceptedOffer4reservation,
522
- // reservation,
523
- // transaction: params.transaction,
524
- // underName
525
- // }));
526
- // });
527
- // reservationPackage = {
528
- // reservationFor: {
529
- // id: String(reservationFor.id),
530
- // typeOf: reservationFor.typeOf,
531
- // optimized: true
532
- // }, // optimize(2024-01-24~)
533
- // reservationNumber: transaction.object.reservationNumber,
534
- // reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
535
- // ? params.transaction.object.reservationStatus
536
- // : factory.reservationStatusType.ReservationPending,
537
- // typeOf: factory.reservationType.ReservationPackage
538
- // };
539
- // reserveActionAttributes = [{
540
- // project: transaction.project,
541
- // typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
542
- // object: reservationPackage,
543
- // agent: transaction.project,
544
- // potentialActions: {
545
- // moneyTransfer: moneyTransferActions
546
- // },
547
- // purpose: { typeOf: transaction.typeOf, id: transaction.id }
548
- // }];
549
- // }
550
- return {
551
- potentialActions: {
552
- // reserve: reserveActionAttributes // discontinue(2024-07-01~)
553
- },
554
- // reservationPackage,
555
- underName
556
- };
557
- }
558
- exports.createPotentialActions = createPotentialActions;
559
- /**
560
- * 予約のunderName.identifierを決定する
561
- */
562
- function createReservationUnderNameIdentifier(params) {
563
- // 必要最低限の識別子のみ継承する(2024-03-16~)
564
- let identifiersFromCustomer = (Array.isArray(params.order.customer.identifier)) ? params.order.customer.identifier : [];
565
- // if (params.useOptimizeReservation) {
566
- // identifiersFromCustomer = identifiersFromCustomer.filter(({ name }) => name === 'clientId');
567
- // }
568
- identifiersFromCustomer = identifiersFromCustomer.filter(({ name }) => name === 'clientId');
569
- return [
570
- { name: 'orderNumber', value: params.order.orderNumber },
571
- ...identifiersFromCustomer
572
- ];
573
- }
574
- function createReservationUnderName(params) {
575
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: createReservationUnderNameIdentifier({ order: params.order }), name: String(params.order.customer.name), typeOf: params.order.customer.typeOf }, (typeof params.order.customer.address === 'string') ? { address: params.order.customer.address } : undefined), (typeof params.order.customer.age === 'string') ? { age: params.order.customer.age } : undefined), (typeof params.order.customer.email === 'string') ? { email: params.order.customer.email } : undefined), (typeof params.order.customer.familyName === 'string') ? { familyName: params.order.customer.familyName } : undefined), (typeof params.order.customer.gender === 'string') ? { gender: params.order.customer.gender } : undefined), (typeof params.order.customer.givenName === 'string') ? { givenName: params.order.customer.givenName } : undefined), (typeof params.order.customer.id === 'string') ? { id: params.order.customer.id } : undefined), (typeof params.order.customer.telephone === 'string') ? { telephone: params.order.customer.telephone } : undefined), (typeof params.order.customer.url === 'string') ? { url: params.order.customer.url } : undefined);
576
- }
577
- /**
578
- * 注文者情報を予約者情報へ変換する
579
- */
580
- function ordre2reservationUnderName(params) {
581
- return {
582
- underName: createReservationUnderName({ order: params.order })
583
- };
584
- }
@@ -0,0 +1,22 @@
1
+ import * as factory from '../../../../../factory';
2
+ import { IMinimizedIndividualEvent } from '../../../../../factory/event';
3
+ type IObject = factory.assetTransaction.reserve.IObject & {
4
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
5
+ reservationFor: factory.assetTransaction.reserve.IReservationFor;
6
+ };
7
+ type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
8
+ declare function createStartParams(params: factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
9
+ provider: {
10
+ /**
11
+ * 販売者ID
12
+ */
13
+ id: string;
14
+ };
15
+ reservationNumber: string;
16
+ event: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
17
+ acceptedOffers4transactionObject: factory.assetTransaction.reserve.IAcceptedOffer4object[];
18
+ objectSubReservations: IObjectSubReservation[];
19
+ }): factory.assetTransaction.IStartParams<factory.assetTransactionType.Reserve> & {
20
+ object: IObject;
21
+ };
22
+ export { createStartParams };
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createStartParams = void 0;
4
+ const factory = require("../../../../../factory");
5
+ function createStartParams(params) {
6
+ var _a;
7
+ const { reservationNumber, acceptedOffers4transactionObject, objectSubReservations, agent, expires, project } = params;
8
+ const provider = {
9
+ id: params.provider.id,
10
+ typeOf: factory.organizationType.Corporation
11
+ };
12
+ // reservationFor,issuedThrough保管をaddReservationsから移行(2024-07-01~)
13
+ const reservationFor = createReservationFor(params.event, true);
14
+ const { issuedThrough } = createIssuedThrough({ reservationFor: params.event });
15
+ const reservationPackage = Object.assign({ issuedThrough,
16
+ provider,
17
+ reservationFor, reservationNumber: reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, disablePendingReservations: true, useHoldStockByTransactionNumber: true, typeOf: factory.reservationType.ReservationPackage, acceptedOffer: acceptedOffers4transactionObject, subReservation: objectSubReservations }, (typeof ((_a = params.object.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.object.broker } : undefined);
18
+ return {
19
+ project: { id: project.id, typeOf: factory.organizationType.Project },
20
+ typeOf: factory.assetTransactionType.Reserve,
21
+ transactionNumber: reservationNumber,
22
+ agent, expires,
23
+ object: reservationPackage
24
+ };
25
+ }
26
+ exports.createStartParams = createStartParams;
27
+ function createReservationFor(params, useOptimizeReservation) {
28
+ var _a, _b;
29
+ if (params.typeOf === factory.eventType.ScreeningEvent) {
30
+ return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params, useOptimizeReservation), typeOf: params.typeOf }, (params.doorTime instanceof Date)
31
+ ? { doorTime: params.doorTime }
32
+ : undefined);
33
+ }
34
+ else {
35
+ const tripByEvent = (_b = (_a = params.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservationFor;
36
+ if (typeof (tripByEvent === null || tripByEvent === void 0 ? void 0 : tripByEvent.typeOf) !== 'string') {
37
+ throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput?.reservationFor');
38
+ }
39
+ return Object.assign(Object.assign({}, tripByEvent), { arrivalTime: params.endDate, id: params.id, name: params.name, departureTime: params.startDate });
40
+ }
41
+ }
42
+ function optimizeReservationSuperEvent(params, useOptimizeReservation) {
43
+ const superEvent = params.superEvent;
44
+ return Object.assign(Object.assign({ id: superEvent.id,
45
+ // kanaName: superEvent.kanaName, // 廃止(2024-01-26~)
46
+ location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
47
+ ? { headline: superEvent.headline }
48
+ : undefined), (useOptimizeReservation)
49
+ ? {}
50
+ : {
51
+ additionalProperty: (Array.isArray(superEvent.additionalProperty))
52
+ ? superEvent.additionalProperty
53
+ : []
54
+ });
55
+ }
56
+ function createIssuedThrough(params) {
57
+ var _a;
58
+ const eventOffers = params.reservationFor.offers;
59
+ // offersは必ず存在するはず
60
+ if (eventOffers === undefined) {
61
+ throw new factory.errors.NotFound('reservationFor.offers');
62
+ }
63
+ const serviceTypeOfIssuedThrough = (typeof ((_a = eventOffers.itemOffered.serviceType) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string')
64
+ ? {
65
+ codeValue: eventOffers.itemOffered.serviceType.codeValue,
66
+ inCodeSet: {
67
+ typeOf: 'CategoryCodeSet',
68
+ identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
69
+ },
70
+ typeOf: 'CategoryCode'
71
+ }
72
+ : undefined;
73
+ const availableChannel = eventOffers.itemOffered.availableChannel;
74
+ if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
75
+ const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.EventService,
76
+ // 興行IDを追加(2022-09-08~)
77
+ id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
78
+ return {
79
+ issuedThrough
80
+ };
81
+ }
82
+ else {
83
+ const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.Transportation,
84
+ // 興行IDを追加(2022-09-08~)
85
+ id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
86
+ return {
87
+ issuedThrough
88
+ };
89
+ }
90
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 予約価格ファクトリー
3
3
  */
4
- import * as factory from '../../../../factory';
4
+ import * as factory from '../../../../../factory';
5
5
  export type IAcceptedAddOn = Pick<factory.offer.IAddOn, 'id' | 'identifier' | 'itemOffered' | 'priceCurrency' | 'typeOf' | 'validFrom' | 'validThrough'> & {
6
6
  priceSpecification: factory.product.ITicketUnitPriceComponent;
7
7
  };
@@ -4,7 +4,7 @@ exports.createPrice = void 0;
4
4
  /**
5
5
  * 予約価格ファクトリー
6
6
  */
7
- const factory = require("../../../../factory");
7
+ const factory = require("../../../../../factory");
8
8
  function createPrice(params) {
9
9
  // acceptedAddOnsがあればアドオンに対する単価仕様を価格構成に追加
10
10
  const unitPriceSpecsAppliedToAddOn = createUnitPriceSpecsAppliedToAddOn(params);
@@ -0,0 +1,74 @@
1
+ import * as factory from '../../../factory';
2
+ import type { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
3
+ import type { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../repo/event';
4
+ import type { MongoRepository as OfferRepo } from '../../../repo/offer';
5
+ import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
6
+ import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
7
+ import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
8
+ import type { MongoRepository as SeatRepo } from '../../../repo/place/seat';
9
+ import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
10
+ import type { MongoRepository as ProductRepo } from '../../../repo/product';
11
+ import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
12
+ import type { MongoRepository as ProjectRepo } from '../../../repo/project';
13
+ import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
14
+ import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
15
+ import type { MongoRepository as TaskRepo } from '../../../repo/task';
16
+ interface IStartOperationRepos {
17
+ stockHolder: StockHolderRepo;
18
+ event: EventRepo;
19
+ offer: OfferRepo;
20
+ offerCatalog: OfferCatalogRepo;
21
+ offerCatalogItem: OfferCatalogItemRepo;
22
+ offerRateLimit: OfferRateLimitRepo;
23
+ paymentService: PaymentServiceRepo;
24
+ product: ProductRepo;
25
+ productOffer: ProductOfferRepo;
26
+ priceSpecification: PriceSpecificationRepo;
27
+ project: ProjectRepo;
28
+ seat: SeatRepo;
29
+ task: TaskRepo;
30
+ assetTransaction: AssetTransactionRepo;
31
+ }
32
+ type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
33
+ type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
34
+ type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
35
+ /**
36
+ * 承認アクションを介した場合に検索済のイベント
37
+ */
38
+ preSearchedEvent?: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
39
+ /**
40
+ * 承認アクションを介した場合に検索済のオファーリスト
41
+ */
42
+ preSearchedTicketOffers?: factory.product.ITicketOffer[];
43
+ /**
44
+ * 承認アクションを介した場合に検索済の単価オファーリスト
45
+ */
46
+ preSearchedUnitPriceOffers?: factory.unitPriceOffer.IUnitPriceOffer[];
47
+ /**
48
+ * 販売アプリケーション
49
+ */
50
+ availableAtOrFrom?: {
51
+ id?: string;
52
+ };
53
+ /**
54
+ * イベントの販売期間を検証するかどうか
55
+ */
56
+ validateEventOfferPeriod: boolean;
57
+ /**
58
+ * イベントのオファー(最大予約座席数)を検証するかどうか
59
+ */
60
+ validateEvent: boolean;
61
+ validateAppliesToMovieTicket: boolean;
62
+ };
63
+ /**
64
+ * 取引開始
65
+ */
66
+ declare function start(params: IStartParams & {
67
+ stockHoldUntilDaysAfterEventEnd: number;
68
+ }): IStartOperation<{
69
+ transaction: Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>, 'id'>;
70
+ objectSubReservations: IObjectSubReservation[];
71
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
72
+ reservationFor: factory.assetTransaction.reserve.IReservationFor;
73
+ }>;
74
+ export { start };