@chevre/domain 20.1.0-alpha.8 → 20.1.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 (103) hide show
  1. package/example/src/chevre/deleteReservationTicketUnderNames.ts +20 -0
  2. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
  3. package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
  4. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  5. package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
  6. package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
  7. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
  8. package/example/src/chevre/searchEvents.ts +36 -16
  9. package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -4
  10. package/example/src/chevre/transaction/orderMembershipService.ts +0 -4
  11. package/lib/chevre/factory/reservedAgentIdentifireNames.d.ts +1 -0
  12. package/lib/chevre/factory/reservedAgentIdentifireNames.js +12 -0
  13. package/lib/chevre/repo/accountAction.d.ts +0 -18
  14. package/lib/chevre/repo/accountAction.js +402 -355
  15. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  16. package/lib/chevre/repo/accountTitle.js +6 -1
  17. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  18. package/lib/chevre/repo/additionalProperty.js +205 -0
  19. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  20. package/lib/chevre/repo/categoryCode.js +15 -1
  21. package/lib/chevre/repo/creativeWork.js +10 -1
  22. package/lib/chevre/repo/customer.d.ts +1 -0
  23. package/lib/chevre/repo/customer.js +5 -0
  24. package/lib/chevre/repo/event.d.ts +12 -4
  25. package/lib/chevre/repo/event.js +84 -48
  26. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  27. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  28. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  29. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  30. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  31. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  32. package/lib/chevre/repo/mongoose/model/event.js +6 -0
  33. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  34. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  35. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  36. package/lib/chevre/repo/mongoose/model/place.js +24 -0
  37. package/lib/chevre/repo/offer.js +10 -1
  38. package/lib/chevre/repo/offerCatalog.js +10 -10
  39. package/lib/chevre/repo/person.js +4 -1
  40. package/lib/chevre/repo/place.d.ts +1 -0
  41. package/lib/chevre/repo/place.js +54 -7
  42. package/lib/chevre/repo/reservation.d.ts +17 -2
  43. package/lib/chevre/repo/reservation.js +41 -1
  44. package/lib/chevre/repo/transaction.js +20 -5
  45. package/lib/chevre/repository.d.ts +6 -3
  46. package/lib/chevre/repository.js +10 -5
  47. package/lib/chevre/service/account.d.ts +0 -4
  48. package/lib/chevre/service/account.js +24 -22
  49. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  50. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  51. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  52. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  53. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  54. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  55. package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +86 -42
  56. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +7 -18
  57. package/lib/chevre/service/assetTransaction/reserve/factory.js +81 -113
  58. package/lib/chevre/service/assetTransaction/reserve.js +41 -95
  59. package/lib/chevre/service/event.js +20 -6
  60. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  61. package/lib/chevre/service/offer/event/authorize.js +65 -27
  62. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  63. package/lib/chevre/service/offer/event/factory.js +17 -12
  64. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  65. package/lib/chevre/service/offer/factory.js +7 -20
  66. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +32 -22
  67. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
  68. package/lib/chevre/service/reserve/cancelReservation.js +260 -107
  69. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  70. package/lib/chevre/service/reserve/factory.d.ts +14 -2
  71. package/lib/chevre/service/reserve/factory.js +13 -6
  72. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  73. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
  74. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  75. package/lib/chevre/service/transaction/orderProgramMembership.js +15 -28
  76. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
  77. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
  78. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  79. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  80. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  81. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  82. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  83. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  84. package/lib/chevre/service.d.ts +2 -0
  85. package/lib/chevre/service.js +2 -0
  86. package/package.json +4 -4
  87. package/example/src/chevre/accountBlanceTest.ts +0 -24
  88. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  89. package/example/src/chevre/createSeats.ts +0 -59
  90. package/example/src/chevre/deleteEvents.ts +0 -50
  91. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  92. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  93. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  94. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  95. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  96. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  97. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  98. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  99. package/example/src/chevre/renameTransaction.ts +0 -22
  100. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  101. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  102. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  103. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
@@ -60,21 +60,6 @@ function createPointAward(params) {
60
60
  return pointAward;
61
61
  }
62
62
  exports.createPointAward = createPointAward;
63
- // function createPointAwardPurposeIdentifier(params: {
64
- // assetTransaction: { typeOf: factory.assetTransactionType };
65
- // project: { id: string };
66
- // reservation: { id: string };
67
- // toLocation: { identifier: string };
68
- // }): string {
69
- // return util.format(
70
- // '%s:%s:%s:%s:%s',
71
- // params.project.id,
72
- // 'givePointAward',
73
- // params.assetTransaction.typeOf,
74
- // params.reservation.id,
75
- // params.toLocation.identifier
76
- // );
77
- // }
78
63
  function createReservedTicket(params) {
79
64
  var _a, _b, _c;
80
65
  let acceptedTicketedSeat;
@@ -131,10 +116,10 @@ function createReservedTicket(params) {
131
116
  }
132
117
  const ticketType = createTicketType({ availableOffer: params.availableOffer });
133
118
  const issuedBy = createIssuedBy({ acceptedOffer: params.acceptedOffer, availableOffer: params.availableOffer });
134
- return Object.assign({ dateIssued: params.dateIssued, issuedBy, priceCurrency: factory.priceCurrency.JPY, ticketType, typeOf: 'Ticket', underName: {
135
- typeOf: params.transaction.agent.typeOf,
136
- name: params.transaction.agent.name
137
- } }, (ticketedSeat !== undefined)
119
+ return Object.assign({ dateIssued: params.dateIssued, issuedBy,
120
+ // 不要なので廃止(2022-12-19~)
121
+ // priceCurrency: factory.priceCurrency.JPY,
122
+ ticketType, typeOf: 'Ticket' }, (ticketedSeat !== undefined)
138
123
  ? { ticketedSeat: ticketedSeat }
139
124
  : {});
140
125
  }
@@ -145,10 +130,14 @@ exports.createReservedTicket = createReservedTicket;
145
130
  function createTicketType(params) {
146
131
  var _a;
147
132
  const availableOffer = params.availableOffer;
148
- return Object.assign(Object.assign(Object.assign(Object.assign({ description: availableOffer.description, id: availableOffer.id, identifier: availableOffer.identifier, name: availableOffer.name, priceCurrency: availableOffer.priceCurrency,
133
+ return Object.assign(Object.assign(Object.assign(Object.assign({ description: availableOffer.description, id: availableOffer.id, identifier: availableOffer.identifier, name: availableOffer.name,
134
+ // 不要なので廃止(2022-12-17~)
135
+ // priceCurrency: availableOffer.priceCurrency,
149
136
  // priceSpecificationを最適化(accounting不要)
150
137
  // accounting: { typeOf: "Accounting", … }
151
- project: availableOffer.project, typeOf: availableOffer.typeOf }, (Array.isArray(availableOffer.additionalProperty)) ? { additionalProperty: availableOffer.additionalProperty } : undefined), (typeof ((_a = availableOffer.category) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string') ? { category: availableOffer.category } : undefined), (typeof availableOffer.color === 'string') ? { color: availableOffer.color } : undefined), (availableOffer.validRateLimit !== undefined) ? { validRateLimit: availableOffer.validRateLimit } : undefined);
138
+ // 不要なので廃止(2022-12-17~)
139
+ // project: availableOffer.project,
140
+ typeOf: availableOffer.typeOf }, (Array.isArray(availableOffer.additionalProperty)) ? { additionalProperty: availableOffer.additionalProperty } : undefined), (typeof ((_a = availableOffer.category) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string') ? { category: availableOffer.category } : undefined), (typeof availableOffer.color === 'string') ? { color: availableOffer.color } : undefined), (availableOffer.validRateLimit !== undefined) ? { validRateLimit: availableOffer.validRateLimit } : undefined);
152
141
  }
153
142
  function createIssuedBy(params) {
154
143
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -340,9 +329,13 @@ function createAdditionalTicketText(params) {
340
329
  }
341
330
  exports.createAdditionalTicketText = createAdditionalTicketText;
342
331
  function createReservationFor(params) {
343
- return Object.assign({ endDate: params.endDate, eventStatus: params.eventStatus, id: params.id, location: params.location, name: params.name, project: params.project, startDate: params.startDate,
344
- // 最適化(2022-05-31~)
345
- superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
332
+ return Object.assign({ endDate: params.endDate,
333
+ // 不要なので廃止(2022-12-19~)
334
+ // eventStatus: params.eventStatus,
335
+ id: params.id, location: params.location, name: params.name,
336
+ // 不要なので廃止(2022-12-19~)
337
+ // project: params.project,
338
+ startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
346
339
  ? { doorTime: params.doorTime }
347
340
  : undefined);
348
341
  }
@@ -351,7 +344,10 @@ function optimizeReservationSuperEvent(params) {
351
344
  const superEvent = params.superEvent;
352
345
  return Object.assign(Object.assign({ additionalProperty: (Array.isArray(superEvent.additionalProperty))
353
346
  ? superEvent.additionalProperty
354
- : [], id: superEvent.id, kanaName: superEvent.kanaName, location: superEvent.location, name: superEvent.name, project: superEvent.project, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.description !== undefined)
347
+ : [], id: superEvent.id, kanaName: superEvent.kanaName, location: superEvent.location, name: superEvent.name,
348
+ // 不要なので廃止(2022-12-19~)
349
+ // project: superEvent.project,
350
+ soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.description !== undefined)
355
351
  ? { description: superEvent.description }
356
352
  : undefined), (superEvent.headline !== undefined)
357
353
  ? { headline: superEvent.headline }
@@ -390,14 +386,31 @@ function createReservation(params) {
390
386
  }
391
387
  : undefined;
392
388
  const issuedThrough = Object.assign(Object.assign({ typeOf: factory.product.ProductType.EventService }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined), (typeof eventOffers.itemOffered.id === 'string') ? { id: eventOffers.itemOffered.id } : undefined);
393
- return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY,
394
- // reservationFor,
395
- reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: params.agent, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation)) ? { subReservation: params.subReservation } : undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_c = params.programMembershipUsed) === null || _c === void 0 ? void 0 : _c.identifier) === 'string')
389
+ return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
390
+ // 最適化(2022-12-19~)
391
+ // underName: params.agent,
392
+ underName: {
393
+ typeOf: params.agent.typeOf,
394
+ name: params.agent.name
395
+ }, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
396
+ ? {
397
+ subReservation: params.subReservation.map((r) => {
398
+ return {
399
+ reservedTicket: {
400
+ ticketedSeat: r.reservedTicket.ticketedSeat,
401
+ typeOf: 'Ticket'
402
+ }
403
+ };
404
+ })
405
+ }
406
+ : undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_c = params.programMembershipUsed) === null || _c === void 0 ? void 0 : _c.identifier) === 'string')
396
407
  ? { programMembershipUsed: params.programMembershipUsed }
397
408
  : undefined);
398
409
  }
399
410
  exports.createReservation = createReservation;
411
+ // tslint:disable-next-line:max-func-body-length
400
412
  function createPotentialActions(params) {
413
+ var _a;
401
414
  const transaction = params.transaction;
402
415
  const reservationFor = transaction.object.reservationFor;
403
416
  if (reservationFor === undefined) {
@@ -405,113 +418,68 @@ function createPotentialActions(params) {
405
418
  }
406
419
  // 予約アクション属性作成
407
420
  const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
408
- const reserveActionAttributes = pendingReservations.map((reservation) => {
409
- var _a, _b;
410
- const eventReservation = Object.assign(Object.assign({}, reservation), { reservationFor });
411
- if (params.object !== undefined) {
412
- // 予約属性の指定があれば上書き
413
- const confirmingReservation = params.object.reservations.find((r) => r.id === eventReservation.id);
414
- if (confirmingReservation !== undefined) {
415
- // additionalTicketText指定を廃止(2022-05-23~)
416
- // if (typeof confirmingReservation.additionalTicketText === 'string') {
417
- // eventReservation.additionalTicketText = confirmingReservation.additionalTicketText;
418
- // }
419
- // additionalProperty指定を廃止(2022-05-23~)
420
- // 追加特性の指定があれば、元の追加特性にマージ
421
- // if (Array.isArray(confirmingReservation.additionalProperty)) {
422
- // eventReservation.additionalProperty = [
423
- // ...(Array.isArray(eventReservation.additionalProperty)) ? eventReservation.additionalProperty : [],
424
- // ...confirmingReservation.additionalProperty
425
- // ];
426
- // }
427
- if (confirmingReservation.underName !== undefined) {
428
- eventReservation.underName = confirmingReservation.underName;
429
- eventReservation.reservedTicket.underName = confirmingReservation.underName;
430
- }
431
- if (confirmingReservation.reservedTicket !== undefined) {
432
- // ticketToken指定を廃止(2022-05-23~)
433
- // if (typeof confirmingReservation.reservedTicket.ticketToken === 'string') {
434
- // eventReservation.reservedTicket.ticketToken = confirmingReservation.reservedTicket.ticketToken;
435
- // }
436
- if (confirmingReservation.reservedTicket.issuedBy !== undefined) {
437
- eventReservation.reservedTicket.issuedBy = confirmingReservation.reservedTicket.issuedBy;
438
- }
439
- // reservedTicket.underName指定を廃止(2022-05-23~)
440
- // if (confirmingReservation.reservedTicket.underName !== undefined) {
441
- // eventReservation.reservedTicket.underName = confirmingReservation.reservedTicket.underName;
442
- // }
443
- }
444
- }
445
- }
421
+ let reserveActionAttributes = [];
422
+ if (pendingReservations.length > 0) {
423
+ // ReservationPackageに対応(2022-12-22~)
424
+ let underName;
446
425
  // purpose:Orderの指定があれば、underName,issuedByを調整(2022-05-23~)
447
426
  if (typeof ((_a = params.order) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
448
427
  const ordre2reservationUnderNameResult = ordre2reservationUnderName({ order: params.order });
449
- eventReservation.underName = ordre2reservationUnderNameResult.underName;
450
- eventReservation.reservedTicket.underName = ordre2reservationUnderNameResult.underName;
451
- eventReservation.reservedTicket.issuedBy = ordre2reservationUnderNameResult.issuedBy;
428
+ underName = ordre2reservationUnderNameResult.underName;
452
429
  }
453
- // const informReservationActions: factory.action.reserve.IInformReservation[] = [];
454
- const acceptedOffer4reservation = (_b = transaction.object.acceptedOffer) === null || _b === void 0 ? void 0 : _b.find((o) => { var _a, _b; return ((_b = (_a = o.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.id) === reservation.id; });
455
- const moneyTransfer = createMoneyTransferActions({
456
- acceptedOffer: acceptedOffer4reservation,
457
- reservation: eventReservation,
458
- transaction: params.transaction
430
+ const moneyTransferActions = [];
431
+ pendingReservations.forEach((reservation) => {
432
+ var _a;
433
+ const acceptedOffer4reservation = (_a = transaction.object.acceptedOffer) === null || _a === void 0 ? void 0 : _a.find((o) => { var _a, _b; return ((_b = (_a = o.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.id) === reservation.id; });
434
+ moneyTransferActions.push(...createMoneyTransferActions({
435
+ acceptedOffer: acceptedOffer4reservation,
436
+ reservation,
437
+ transaction: params.transaction,
438
+ underName
439
+ }));
459
440
  });
460
- return {
461
- project: transaction.project,
462
- typeOf: factory.actionType.ReserveAction,
463
- result: {},
464
- object: eventReservation,
465
- // プロジェクトに変更(2022-05-26~)
466
- agent: transaction.project,
467
- potentialActions: {
468
- moneyTransfer: moneyTransfer
469
- // informReservation: informReservationActions
470
- },
471
- purpose: {
472
- typeOf: transaction.typeOf,
473
- id: transaction.id
474
- }
475
- };
476
- });
441
+ const reservationPackage = Object.assign({ reservationFor, reservationNumber: pendingReservations[0].reservationNumber, reservationStatus: pendingReservations[0].reservationStatus, subReservation: pendingReservations, typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string') ? { underName } : undefined);
442
+ reserveActionAttributes = [{
443
+ project: transaction.project,
444
+ typeOf: factory.actionType.ReserveAction,
445
+ // result: {},
446
+ object: reservationPackage,
447
+ agent: transaction.project,
448
+ potentialActions: {
449
+ moneyTransfer: moneyTransferActions
450
+ },
451
+ purpose: { typeOf: transaction.typeOf, id: transaction.id }
452
+ }];
453
+ }
477
454
  return {
478
455
  reserve: reserveActionAttributes
479
456
  };
480
457
  }
481
458
  exports.createPotentialActions = createPotentialActions;
482
459
  function createReservationUnderNameIdentifier(params) {
483
- const order = params.order;
484
- const customer = order.customer;
485
460
  // 予約のunderName.identifierを決定する
486
461
  return [
487
- { name: 'orderNumber', value: order.orderNumber },
488
- // 不要なので廃止(2022-05-24~)
489
- // { name: 'transaction', value: params.transaction.id },
490
- // ↓legacy-reservationの印刷アウトプットで使用(2022-02-09廃止)
491
- // { name: 'paymentMethod', value: paymentMethodNames },
492
- ...(Array.isArray(customer.identifier)) ? customer.identifier : []
462
+ { name: 'orderNumber', value: params.order.orderNumber },
463
+ ...(Array.isArray(params.order.customer.identifier)) ? params.order.customer.identifier : []
493
464
  ];
494
465
  }
495
466
  function createReservationUnderName(params) {
496
- // 予約のunderName.identifierを決定する
497
- const defaultUnderNameIdentifiers = createReservationUnderNameIdentifier({ order: params.order });
498
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: defaultUnderNameIdentifiers, 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);
467
+ 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);
499
468
  }
500
469
  /**
501
470
  * 注文者情報を予約者情報へ変換する
502
471
  */
503
472
  function ordre2reservationUnderName(params) {
504
473
  return {
505
- issuedBy: {
506
- typeOf: params.order.seller.typeOf,
507
- name: params.order.seller.name
508
- },
474
+ // issuedBy: {
475
+ // typeOf: params.order.seller.typeOf,
476
+ // name: params.order.seller.name
477
+ // },
509
478
  underName: createReservationUnderName({ order: params.order })
510
479
  };
511
480
  }
512
481
  function createMoneyTransferActions(params) {
513
482
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
514
- // return [];
515
483
  const pointAward = (_b = (_a = params.acceptedOffer) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.pointAward;
516
484
  const moneyTransfer = [];
517
485
  // ポイント特典があれば適用
@@ -534,13 +502,13 @@ function createMoneyTransferActions(params) {
534
502
  issuedThrough: { id: String((_k = (_j = pointAward.toLocation) === null || _j === void 0 ? void 0 : _j.issuedThrough) === null || _k === void 0 ? void 0 : _k.id) }
535
503
  };
536
504
  const recipient = {
537
- typeOf: (typeof ((_l = params.reservation.underName) === null || _l === void 0 ? void 0 : _l.typeOf) === 'string')
538
- ? (_m = params.reservation.underName) === null || _m === void 0 ? void 0 : _m.typeOf
505
+ typeOf: (typeof ((_l = params.underName) === null || _l === void 0 ? void 0 : _l.typeOf) === 'string')
506
+ ? (_m = params.underName) === null || _m === void 0 ? void 0 : _m.typeOf
539
507
  : factory.personType.Person,
540
- id: (typeof ((_o = params.reservation.underName) === null || _o === void 0 ? void 0 : _o.id) === 'string')
541
- ? (_p = params.reservation.underName) === null || _p === void 0 ? void 0 : _p.id
508
+ id: (typeof ((_o = params.underName) === null || _o === void 0 ? void 0 : _o.id) === 'string')
509
+ ? (_p = params.underName) === null || _p === void 0 ? void 0 : _p.id
542
510
  : '',
543
- name: String((_q = params.reservation.underName) === null || _q === void 0 ? void 0 : _q.name)
511
+ name: String((_q = params.underName) === null || _q === void 0 ? void 0 : _q.name)
544
512
  };
545
513
  moneyTransfer.push(Object.assign(Object.assign({ project: params.transaction.project, typeOf: factory.actionType.MoneyTransfer, agent: params.transaction.project, recipient, object: {
546
514
  typeOf: factory.account.transactionType.Deposit
@@ -148,9 +148,6 @@ function addReservations(params) {
148
148
  // 予約作成(insertManyで実装)
149
149
  yield repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
150
150
  // 予約作成後処理
151
- // await Promise.all(objectSubReservations.map(async (r) => {
152
- // await onReservationCreated(transaction, r)(repos);
153
- // }));
154
151
  yield onReservationsCreated({ event })(repos);
155
152
  return transaction;
156
153
  });
@@ -528,22 +525,6 @@ function processLockSeats(params) {
528
525
  }
529
526
  });
530
527
  }
531
- /**
532
- * 予約作成時イベント
533
- */
534
- // function onReservationCreated(
535
- // __1: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>,
536
- // __2: IObjectSubReservation
537
- // ) {
538
- // return async (repos: {
539
- // task: TaskRepo;
540
- // }) => {
541
- // // const now = new Date();
542
- // const taskAttributes: factory.task.IAttributes<factory.taskName>[] = [];
543
- // // タスク保管
544
- // await repos.task.saveMany(taskAttributes);
545
- // };
546
- // }
547
528
  /**
548
529
  * 予約作成時イベント
549
530
  */
@@ -628,47 +609,31 @@ function cancel(params) {
628
609
  transactionNumber: params.transactionNumber
629
610
  });
630
611
  // 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
631
- // 一応同期的にもcancelPendingReservationを実行しておく
612
+ // 同期的にもcancelPendingReservationを実行しておく
632
613
  try {
633
614
  const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
615
+ let cancelActionAttributes = [];
634
616
  if (pendingReservations.length > 0) {
635
617
  const reservationFor = transaction.object.reservationFor;
636
618
  if (reservationFor === undefined) {
637
619
  throw new factory.errors.NotFound('transaction.object.reservationFor');
638
620
  }
639
- const actionAttributes = pendingReservations.map((reservation) => {
640
- var _a;
641
- const eventReservation = Object.assign(Object.assign({}, reservation), { reservationFor });
642
- // const informReservationActions: factory.action.reserve.IInformReservation[] = [];
643
- return {
621
+ // ReservationPackageに対応(2022-12-23~)
622
+ const reservationPackage = {
623
+ typeOf: factory.reservationType.ReservationPackage,
624
+ reservationNumber: transaction.transactionNumber,
625
+ reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
626
+ reservationStatus: pendingReservations[0].reservationStatus
627
+ };
628
+ cancelActionAttributes = [{
644
629
  project: transaction.project,
645
630
  typeOf: factory.actionType.CancelAction,
646
- purpose: {
647
- typeOf: transaction.typeOf,
648
- id: transaction.id
649
- },
650
- // プロジェクトに変更(2022-05-26~)
631
+ purpose: { typeOf: transaction.typeOf, id: transaction.id },
651
632
  agent: transaction.project,
652
- // 最適化(2022-06-06~)
653
- object: {
654
- typeOf: eventReservation.typeOf,
655
- id: eventReservation.id,
656
- issuedThrough: {
657
- typeOf: (_a = eventReservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
658
- },
659
- reservationFor: {
660
- typeOf: eventReservation.reservationFor.typeOf,
661
- id: eventReservation.reservationFor.id
662
- },
663
- reservationNumber: eventReservation.reservationNumber,
664
- reservationStatus: eventReservation.reservationStatus
665
- },
666
- potentialActions: {
667
- // informReservation: informReservationActions
668
- }
669
- };
670
- });
671
- yield (0, cancelReservation_1.cancelPendingReservation)(actionAttributes)(repos);
633
+ object: reservationPackage,
634
+ potentialActions: {}
635
+ }];
636
+ yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
672
637
  }
673
638
  }
674
639
  catch (error) {
@@ -737,65 +702,46 @@ function exportTasksById(params) {
737
702
  case factory.transactionStatusType.Canceled:
738
703
  case factory.transactionStatusType.Expired:
739
704
  const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
705
+ let cancelActionAttributes = [];
740
706
  if (pendingReservations.length > 0) {
741
707
  const reservationFor = transaction.object.reservationFor;
742
708
  if (reservationFor === undefined) {
743
709
  throw new factory.errors.NotFound('transaction.object.reservationFor');
744
710
  }
745
- const actionAttributes = pendingReservations.map((reservation) => {
746
- var _a;
747
- const eventReservation = Object.assign(Object.assign({}, reservation), { reservationFor });
748
- // const informReservationActions: factory.action.reserve.IInformReservation[] = [];
749
- return {
711
+ // ReservationPackageに対応(2022-12-23~)
712
+ const reservationPackage = {
713
+ typeOf: factory.reservationType.ReservationPackage,
714
+ reservationNumber: transaction.transactionNumber,
715
+ reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
716
+ reservationStatus: pendingReservations[0].reservationStatus
717
+ };
718
+ cancelActionAttributes = [{
750
719
  project: transaction.project,
751
720
  typeOf: factory.actionType.CancelAction,
752
- purpose: {
753
- typeOf: transaction.typeOf,
754
- id: transaction.id
755
- },
756
- // プロジェクトに変更(2022-05-26~)
721
+ purpose: { typeOf: transaction.typeOf, id: transaction.id },
757
722
  agent: transaction.project,
758
- // 最適化(2022-06-06~)
759
- object: {
760
- typeOf: eventReservation.typeOf,
761
- id: eventReservation.id,
762
- issuedThrough: {
763
- typeOf: (_a = eventReservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
764
- },
765
- reservationFor: {
766
- typeOf: eventReservation.reservationFor.typeOf,
767
- id: eventReservation.reservationFor.id
768
- },
769
- reservationNumber: eventReservation.reservationNumber,
770
- reservationStatus: eventReservation.reservationStatus
771
- },
772
- potentialActions: {
773
- // informReservation: informReservationActions
774
- }
775
- };
776
- });
777
- const cancelPendingReservationTasks = actionAttributes.map((a) => {
778
- return {
779
- project: transaction.project,
780
- name: factory.taskName.CancelPendingReservation,
781
- status: factory.taskStatus.Ready,
782
- runsAt: new Date(),
783
- remainingNumberOfTries: 10,
784
- numberOfTried: 0,
785
- executionResults: [],
786
- data: {
787
- actionAttributes: [a]
788
- }
789
- };
790
- });
791
- taskAttributes.push(...cancelPendingReservationTasks);
723
+ object: reservationPackage,
724
+ potentialActions: {}
725
+ }];
726
+ const cancelPendingReservationTask = {
727
+ project: transaction.project,
728
+ name: factory.taskName.CancelPendingReservation,
729
+ status: factory.taskStatus.Ready,
730
+ runsAt: new Date(),
731
+ remainingNumberOfTries: 10,
732
+ numberOfTried: 0,
733
+ executionResults: [],
734
+ data: {
735
+ actionAttributes: cancelActionAttributes
736
+ }
737
+ };
738
+ taskAttributes.push(cancelPendingReservationTask);
792
739
  }
793
740
  break;
794
741
  default:
795
742
  throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
796
743
  }
797
744
  return repos.task.saveMany(taskAttributes);
798
- // return Promise.all(taskAttributes.map(async (a) => repos.task.save(a)));
799
745
  });
800
746
  }
801
747
  exports.exportTasksById = exportTasksById;
@@ -419,7 +419,8 @@ function createScreeningEventFromCOA(params) {
419
419
  .toDate();
420
420
  }
421
421
  const offers = {
422
- project: { typeOf: params.project.typeOf, id: params.project.id },
422
+ // 不要なので廃止(2022-12-19~)
423
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
423
424
  typeOf: factory.offerType.Offer,
424
425
  offeredThrough: {
425
426
  typeOf: 'WebAPI',
@@ -437,7 +438,8 @@ function createScreeningEventFromCOA(params) {
437
438
  eventStatus: factory.eventStatusType.EventScheduled,
438
439
  workPerformed: params.superEvent.workPerformed,
439
440
  location: {
440
- project: { typeOf: params.project.typeOf, id: params.project.id },
441
+ // 不要なので廃止(2022-12-19~)
442
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
441
443
  typeOf: params.screenRoom.typeOf,
442
444
  branchCode: params.screenRoom.branchCode,
443
445
  name: params.screenRoom.name
@@ -475,7 +477,7 @@ function createScreeningEventAdditionalPropertyFromCOA(params) {
475
477
  return {
476
478
  coaInfo,
477
479
  additionalProperty: [
478
- { name: 'COA_ENDPOINT', value: credentials_1.credentials.coa.endpoint },
480
+ // { name: 'COA_ENDPOINT', value: credentials.coa.endpoint },
479
481
  { name: 'coaInfo', value: JSON.stringify(coaInfo) }
480
482
  ]
481
483
  };
@@ -529,7 +531,8 @@ function createScreeningEventSeriesFromCOA(params) {
529
531
  kanaName: params.filmFromCOA.titleNameKana,
530
532
  alternativeHeadline: params.filmFromCOA.titleNameShort,
531
533
  location: {
532
- project: { typeOf: params.project.typeOf, id: params.project.id },
534
+ // 不要なので廃止(2022-12-19~)
535
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
533
536
  id: (params.movieTheater.id !== undefined) ? params.movieTheater.id : '',
534
537
  branchCode: params.movieTheater.branchCode,
535
538
  name: params.movieTheater.name,
@@ -544,7 +547,8 @@ function createScreeningEventSeriesFromCOA(params) {
544
547
  videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
545
548
  soundFormat: [],
546
549
  workPerformed: {
547
- project: { typeOf: params.project.typeOf, id: params.project.id },
550
+ // 不要なので廃止(2022-12-19~)
551
+ // project: { typeOf: params.project.typeOf, id: params.project.id },
548
552
  id: `${params.movieTheater.branchCode}-${params.filmFromCOA.titleCode}`,
549
553
  identifier: params.filmFromCOA.titleCode,
550
554
  // 多言語化(2022-07-26~)
@@ -579,7 +583,7 @@ function createScreeningEventSeriesAdditionalPropertyFromCOA(params) {
579
583
  return {
580
584
  coaInfo,
581
585
  additionalProperty: [
582
- { name: 'COA_ENDPOINT', value: credentials_1.credentials.coa.endpoint },
586
+ // { name: 'COA_ENDPOINT', value: credentials.coa.endpoint },
583
587
  { name: 'coaInfo', value: JSON.stringify(coaInfo) }
584
588
  ]
585
589
  };
@@ -648,6 +652,16 @@ function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
648
652
  typeOf: 'QuantitativeValue',
649
653
  value: 1200,
650
654
  unitCode: factory.unitCode.Sec
655
+ },
656
+ availabilityStartsGraceTimeOnPOS: {
657
+ typeOf: 'QuantitativeValue',
658
+ value: -93,
659
+ unitCode: factory.unitCode.Day
660
+ },
661
+ availabilityEndsGraceTimeOnPOS: {
662
+ typeOf: 'QuantitativeValue',
663
+ value: 2678400,
664
+ unitCode: factory.unitCode.Sec
651
665
  }
652
666
  }
653
667
  };
@@ -49,11 +49,15 @@ export declare function authorize(params: {
49
49
  transaction: {
50
50
  id: string;
51
51
  };
52
+ validateEventOfferPeriod?: boolean;
52
53
  validateEvent?: boolean;
53
54
  /**
54
55
  * どの店舗に対して
55
56
  */
56
57
  store: {
58
+ /**
59
+ * 販売アプリケーションID
60
+ */
57
61
  id: string;
58
62
  };
59
63
  }): IAuthorizeOperation<IAuthorizeOfferAction>;