@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
@@ -2,11 +2,11 @@
2
2
  * リポジトリ
3
3
  */
4
4
  import { MongoRepository as AccountRepo } from './repo/account';
5
- import { MongoRepository as AccountActionRepo } from './repo/accountAction';
6
5
  import { MongoRepository as AccountingReportRepo } from './repo/accountingReport';
7
6
  import { MongoRepository as AccountTitleRepo } from './repo/accountTitle';
8
7
  import { MongoRepository as AccountTransactionRepo } from './repo/accountTransaction';
9
8
  import { MongoRepository as ActionRepo } from './repo/action';
9
+ import { MongoRepository as AdditionalPropertyRepo } from './repo/additionalProperty';
10
10
  import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
11
11
  import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
12
12
  import { MongoRepository as CodeRepo } from './repo/code';
@@ -49,8 +49,6 @@ export declare class Account extends AccountRepo {
49
49
  /**
50
50
  * 口座アクションリポジトリ
51
51
  */
52
- export declare class AccountAction extends AccountActionRepo {
53
- }
54
52
  /**
55
53
  * 経理レポートリポジトリ
56
54
  */
@@ -65,6 +63,11 @@ export declare class AccountTransaction extends AccountTransactionRepo {
65
63
  }
66
64
  export declare class Action extends ActionRepo {
67
65
  }
66
+ /**
67
+ * 追加特性リポジトリ
68
+ */
69
+ export declare class AdditionalProperty extends AdditionalPropertyRepo {
70
+ }
68
71
  export declare namespace action {
69
72
  class RegisterServiceInProgress extends RegisterServiceActionInProgress {
70
73
  }
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.AccountAction = exports.Account = void 0;
3
+ exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
4
4
  // tslint:disable:max-classes-per-file completed-docs
5
5
  /**
6
6
  * リポジトリ
7
7
  */
8
8
  const account_1 = require("./repo/account");
9
- const accountAction_1 = require("./repo/accountAction");
9
+ // import { MongoRepository as AccountActionRepo } from './repo/accountAction';
10
10
  const accountingReport_1 = require("./repo/accountingReport");
11
11
  const accountTitle_1 = require("./repo/accountTitle");
12
12
  const accountTransaction_1 = require("./repo/accountTransaction");
13
13
  const action_1 = require("./repo/action");
14
+ const additionalProperty_1 = require("./repo/additionalProperty");
14
15
  const assetTransaction_1 = require("./repo/assetTransaction");
15
16
  const categoryCode_1 = require("./repo/categoryCode");
16
17
  const code_1 = require("./repo/code");
@@ -54,9 +55,7 @@ exports.Account = Account;
54
55
  /**
55
56
  * 口座アクションリポジトリ
56
57
  */
57
- class AccountAction extends accountAction_1.MongoRepository {
58
- }
59
- exports.AccountAction = AccountAction;
58
+ // export class AccountAction extends AccountActionRepo { }
60
59
  /**
61
60
  * 経理レポートリポジトリ
62
61
  */
@@ -75,6 +74,12 @@ exports.AccountTransaction = AccountTransaction;
75
74
  class Action extends action_1.MongoRepository {
76
75
  }
77
76
  exports.Action = Action;
77
+ /**
78
+ * 追加特性リポジトリ
79
+ */
80
+ class AdditionalProperty extends additionalProperty_1.MongoRepository {
81
+ }
82
+ exports.AdditionalProperty = AdditionalProperty;
78
83
  var action;
79
84
  (function (action) {
80
85
  class RegisterServiceInProgress extends registerServiceInProgress_1.RedisRepository {
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import * as factory from '../factory';
6
6
  import { MongoRepository as AccountRepo } from '../repo/account';
7
- import { MongoRepository as AccountActionRepo } from '../repo/accountAction';
8
7
  import { MongoRepository as AccountTransactionRepo } from '../repo/accountTransaction';
9
8
  export declare type IOpenOperation<T> = (repos: {
10
9
  account: AccountRepo;
@@ -52,8 +51,6 @@ export declare function close(params: {
52
51
  */
53
52
  export declare function transferMoney(actionAttributes: factory.account.action.moneyTransfer.IAttributes): (repos: {
54
53
  account: AccountRepo;
55
- accountAction: AccountActionRepo;
56
- accountTransaction: AccountTransactionRepo;
57
54
  }) => Promise<void>;
58
55
  /**
59
56
  * 転送取消
@@ -66,6 +63,5 @@ export declare function cancelMoneyTransfer(params: {
66
63
  };
67
64
  }): (repos: {
68
65
  account: AccountRepo;
69
- accountAction: AccountActionRepo;
70
66
  accountTransaction: AccountTransactionRepo;
71
67
  }) => Promise<void>;
@@ -53,11 +53,13 @@ exports.close = close;
53
53
  */
54
54
  function transferMoney(actionAttributes) {
55
55
  return (repos) => __awaiter(this, void 0, void 0, function* () {
56
- let action = yield repos.accountAction.startByIdentifier(actionAttributes);
56
+ // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
57
+ // let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
57
58
  // すでに完了していれば何もしない
58
- if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
59
- return;
60
- }
59
+ // if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
60
+ // return;
61
+ // }
62
+ const action = actionAttributes;
61
63
  let fromAccountNumber;
62
64
  let toAccountNumber;
63
65
  try {
@@ -80,18 +82,17 @@ function transferMoney(actionAttributes) {
80
82
  }
81
83
  catch (error) {
82
84
  // actionにエラー結果を追加
83
- try {
84
- const actionError = Object.assign(Object.assign({}, error), { message: error.message, name: error.name });
85
- yield repos.accountAction.giveUp(action.typeOf, action.id, actionError);
86
- }
87
- catch (__) {
88
- // 失敗したら仕方ない
89
- }
85
+ // try {
86
+ // const actionError = { ...error, message: error.message, name: error.name };
87
+ // await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
88
+ // } catch (__) {
89
+ // // 失敗したら仕方ない
90
+ // }
90
91
  throw error;
91
92
  }
92
93
  // アクション完了
93
- const actionResult = {};
94
- action = yield repos.accountAction.complete(action.typeOf, action.id, actionResult);
94
+ // const actionResult: factory.account.action.moneyTransfer.IResult = {};
95
+ // action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
95
96
  });
96
97
  }
97
98
  exports.transferMoney = transferMoney;
@@ -132,16 +133,17 @@ function cancelMoneyTransfer(params) {
132
133
  : transaction.object.amount.value,
133
134
  transactionId: transaction.id
134
135
  });
136
+ // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
135
137
  // アクション取得
136
- const actions = yield repos.accountAction.searchTransferActions({
137
- purpose: {
138
- typeOf: { $eq: transaction.typeOf },
139
- id: { $eq: transaction.id }
140
- }
141
- });
142
- yield Promise.all(actions.map((action) => __awaiter(this, void 0, void 0, function* () {
143
- yield repos.accountAction.cancel(action.typeOf, action.id);
144
- })));
138
+ // const actions = await repos.accountAction.searchTransferActions({
139
+ // purpose: {
140
+ // typeOf: { $eq: transaction.typeOf },
141
+ // id: { $eq: transaction.id }
142
+ // }
143
+ // });
144
+ // await Promise.all(actions.map(async (action) => {
145
+ // await repos.accountAction.cancel(action.typeOf, action.id);
146
+ // }));
145
147
  });
146
148
  }
147
149
  exports.cancelMoneyTransfer = cancelMoneyTransfer;
@@ -3,11 +3,9 @@
3
3
  */
4
4
  import * as factory from '../../factory';
5
5
  import { MongoRepository as AccountRepo } from '../../repo/account';
6
- import { MongoRepository as AccountActionRepo } from '../../repo/accountAction';
7
6
  import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
8
7
  export declare type IStartOperation<T> = (repos: {
9
8
  account: AccountRepo;
10
- accountAction: AccountActionRepo;
11
9
  accountTransaction: AccountTransactionRepo;
12
10
  }) => Promise<T>;
13
11
  /**
@@ -14,7 +14,6 @@ exports.start = void 0;
14
14
  * 入金取引サービス
15
15
  */
16
16
  const factory = require("../../factory");
17
- const factory_1 = require("./factory");
18
17
  /**
19
18
  * 取引開始
20
19
  */
@@ -64,9 +63,10 @@ function start(params) {
64
63
  accountNumber: params.object.toLocation.accountNumber,
65
64
  transaction: pendingTransaction
66
65
  });
66
+ // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
67
67
  // アクション開始
68
- const moneyTransferActionAttributes = (0, factory_1.createMoneyTransferActionAttributes)({ transaction });
69
- yield repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
68
+ // const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
69
+ // await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
70
70
  // 結果返却
71
71
  return transaction;
72
72
  });
@@ -3,11 +3,9 @@
3
3
  */
4
4
  import * as factory from '../../factory';
5
5
  import { MongoRepository as AccountRepo } from '../../repo/account';
6
- import { MongoRepository as AccountActionRepo } from '../../repo/accountAction';
7
6
  import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
8
7
  export declare type IStartOperation<T> = (repos: {
9
8
  account: AccountRepo;
10
- accountAction: AccountActionRepo;
11
9
  accountTransaction: AccountTransactionRepo;
12
10
  }) => Promise<T>;
13
11
  /**
@@ -14,7 +14,6 @@ exports.start = void 0;
14
14
  * 転送取引サービス
15
15
  */
16
16
  const factory = require("../../factory");
17
- const factory_1 = require("./factory");
18
17
  /**
19
18
  * 取引開始
20
19
  */
@@ -96,9 +95,10 @@ function start(params) {
96
95
  accountNumber: params.object.toLocation.accountNumber,
97
96
  transaction: pendingTransaction
98
97
  });
98
+ // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
99
99
  // アクション開始
100
- const moneyTransferActionAttributes = (0, factory_1.createMoneyTransferActionAttributes)({ transaction });
101
- yield repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
100
+ // const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
101
+ // await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
102
102
  // 結果返却
103
103
  return transaction;
104
104
  });
@@ -3,11 +3,9 @@
3
3
  */
4
4
  import * as factory from '../../factory';
5
5
  import { MongoRepository as AccountRepo } from '../../repo/account';
6
- import { MongoRepository as AccountActionRepo } from '../../repo/accountAction';
7
6
  import { MongoRepository as AccountTransactionRepo } from '../../repo/accountTransaction';
8
7
  export declare type IStartOperation<T> = (repos: {
9
8
  account: AccountRepo;
10
- accountAction: AccountActionRepo;
11
9
  accountTransaction: AccountTransactionRepo;
12
10
  }) => Promise<T>;
13
11
  /**
@@ -14,7 +14,6 @@ exports.start = void 0;
14
14
  * 出金取引サービス
15
15
  */
16
16
  const factory = require("../../factory");
17
- const factory_1 = require("./factory");
18
17
  /**
19
18
  * 取引開始
20
19
  */
@@ -75,9 +74,10 @@ function start(params) {
75
74
  transaction: pendingTransaction,
76
75
  force: forcibly
77
76
  });
77
+ // 口座取引におけるAccountAction管理を廃止(2022-11-28~)
78
78
  // アクション開始
79
- const moneyTransferActionAttributes = (0, factory_1.createMoneyTransferActionAttributes)({ transaction });
80
- yield repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
79
+ // const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
80
+ // await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
81
81
  // 結果返却
82
82
  return transaction;
83
83
  });
@@ -6,11 +6,38 @@ const factory = require("../../../factory");
6
6
  * 取引開始パラメータ作成
7
7
  */
8
8
  function createStartParams(params) {
9
- const cancelReservationObject = {
10
- clientUser: params.paramsWithoutDetail.object.clientUser,
11
- transaction: params.transaction,
12
- reservations: params.reservations
13
- };
9
+ var _a;
10
+ let reserveTransactionAsObject;
11
+ let eventReservationsAsObject;
12
+ if (typeof ((_a = params.transaction) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
13
+ const reservationFor = params.transaction.object.reservationFor;
14
+ if (typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) !== 'string') {
15
+ throw new factory.errors.NotFound('transaction.object.reservationFor');
16
+ }
17
+ reserveTransactionAsObject = {
18
+ id: params.transaction.id,
19
+ transactionNumber: params.transaction.transactionNumber,
20
+ typeOf: params.transaction.typeOf,
21
+ object: {
22
+ reservationFor: {
23
+ id: reservationFor.id,
24
+ typeOf: reservationFor.typeOf
25
+ }
26
+ }
27
+ };
28
+ }
29
+ if (Array.isArray(params.reservations)) {
30
+ eventReservationsAsObject = params.reservations.map((r) => {
31
+ return {
32
+ id: r.id,
33
+ issuedThrough: r.issuedThrough,
34
+ reservationFor: { id: r.reservationFor.id, typeOf: r.reservationFor.typeOf },
35
+ reservationNumber: r.reservationNumber,
36
+ typeOf: r.typeOf
37
+ };
38
+ });
39
+ }
40
+ const cancelReservationObject = Object.assign(Object.assign({ clientUser: params.paramsWithoutDetail.object.clientUser }, (typeof (reserveTransactionAsObject === null || reserveTransactionAsObject === void 0 ? void 0 : reserveTransactionAsObject.typeOf) === 'string') ? { transaction: reserveTransactionAsObject } : undefined), (Array.isArray(eventReservationsAsObject)) ? { reservations: eventReservationsAsObject } : undefined);
14
41
  return {
15
42
  project: { id: params.project.id, typeOf: params.project.typeOf },
16
43
  transactionNumber: params.transactionNumber,
@@ -24,49 +51,66 @@ exports.createStartParams = createStartParams;
24
51
  function createPotentialActions(params) {
25
52
  var _a, _b;
26
53
  const transaction = params.transaction;
27
- let targetReservations = [];
54
+ let cancelReservationActionAttributes = [];
55
+ // 予約番号指定であれば予約番号単位でアクション生成(2022-12-27~)
28
56
  // 予約番号指定の取消取引であれば、予約取引から取消対象予約リストを作成する
29
- const reservationForByReserveTransaction = (_a = transaction.object.transaction) === null || _a === void 0 ? void 0 : _a.object.reservationFor;
30
- const subReservationByReserveTransaction = (_b = transaction.object.transaction) === null || _b === void 0 ? void 0 : _b.object.subReservation;
31
- if (reservationForByReserveTransaction !== undefined && Array.isArray(subReservationByReserveTransaction)) {
32
- targetReservations = subReservationByReserveTransaction.map((r) => {
33
- return Object.assign(Object.assign({}, r), { reservationFor: reservationForByReserveTransaction });
34
- });
35
- }
36
- else if (Array.isArray(transaction.object.reservations)) {
37
- targetReservations = transaction.object.reservations;
38
- }
39
- // 予約取消アクション属性作成
40
- const cancelReservationActionAttributes = targetReservations.map((reservation) => {
41
- var _a;
42
- // 最適化(2022-06-06~)
57
+ const reservationNumber = (_a = transaction.object.transaction) === null || _a === void 0 ? void 0 : _a.transactionNumber;
58
+ const reservationForByReserveTransaction = (_b = transaction.object.transaction) === null || _b === void 0 ? void 0 : _b.object.reservationFor;
59
+ if (reservationForByReserveTransaction !== undefined && typeof reservationNumber === 'string') {
43
60
  const cancelObject = {
44
- typeOf: reservation.typeOf,
45
- id: reservation.id,
46
- issuedThrough: {
47
- typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
48
- },
49
61
  reservationFor: {
50
- typeOf: reservation.reservationFor.typeOf,
51
- id: reservation.reservationFor.id
62
+ typeOf: reservationForByReserveTransaction.typeOf,
63
+ id: reservationForByReserveTransaction.id
52
64
  },
53
- reservationNumber: reservation.reservationNumber,
65
+ reservationNumber,
54
66
  // ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
55
- reservationStatus: factory.reservationStatusType.ReservationConfirmed
56
- };
57
- return {
58
- project: transaction.project,
59
- typeOf: factory.actionType.CancelAction,
60
- // result: {},
61
- object: cancelObject,
62
- agent: transaction.project,
63
- potentialActions: {},
64
- purpose: {
65
- typeOf: transaction.typeOf,
66
- id: transaction.id
67
- }
67
+ reservationStatus: factory.reservationStatusType.ReservationConfirmed,
68
+ typeOf: factory.reservationType.ReservationPackage
68
69
  };
69
- });
70
+ cancelReservationActionAttributes = [{
71
+ project: transaction.project,
72
+ typeOf: factory.actionType.CancelAction,
73
+ object: cancelObject,
74
+ agent: transaction.project,
75
+ potentialActions: {},
76
+ purpose: {
77
+ typeOf: transaction.typeOf,
78
+ id: transaction.id
79
+ }
80
+ }];
81
+ }
82
+ else if (Array.isArray(transaction.object.reservations)) {
83
+ // 予約取消アクション属性作成
84
+ cancelReservationActionAttributes = transaction.object.reservations.map((reservation) => {
85
+ var _a;
86
+ // 最適化(2022-06-06~)
87
+ const cancelObject = {
88
+ typeOf: reservation.typeOf,
89
+ id: reservation.id,
90
+ issuedThrough: {
91
+ typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
92
+ },
93
+ reservationFor: {
94
+ typeOf: reservation.reservationFor.typeOf,
95
+ id: reservation.reservationFor.id
96
+ },
97
+ reservationNumber: reservation.reservationNumber,
98
+ // ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
99
+ reservationStatus: factory.reservationStatusType.ReservationConfirmed
100
+ };
101
+ return {
102
+ project: transaction.project,
103
+ typeOf: factory.actionType.CancelAction,
104
+ object: cancelObject,
105
+ agent: transaction.project,
106
+ potentialActions: {},
107
+ purpose: {
108
+ typeOf: transaction.typeOf,
109
+ id: transaction.id
110
+ }
111
+ };
112
+ });
113
+ }
70
114
  return {
71
115
  cancelReservation: cancelReservationActionAttributes
72
116
  };
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPotentialActions = void 0;
4
4
  const factory = require("../../../factory");
5
5
  const order_1 = require("../../../factory/order");
6
- const USE_NEW_PRICE_SPEC_ON_INFORM_PAY_ACTION = process.env.USE_NEW_PRICE_SPEC_ON_INFORM_PAY_ACTION === '1';
7
6
  function createPayActions(params) {
8
7
  var _a;
9
8
  const payActions = [];
@@ -123,8 +122,7 @@ function createPayObjectServiceOutput(params) {
123
122
  paymentServiceOutput = movieTickets.map((movieTicket) => {
124
123
  var _a;
125
124
  const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
126
- return Object.assign({ identifier: movieTicket.identifier }, (typeof reservation4invoice.price === 'number'
127
- || typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
125
+ return Object.assign({ identifier: movieTicket.identifier }, (typeof ((_a = reservation4invoice.priceSpecification) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
128
126
  ? {
129
127
  serviceOutput: reservation4invoice
130
128
  }
@@ -139,7 +137,6 @@ function createPayObjectServiceOutput(params) {
139
137
  }
140
138
  function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType) {
141
139
  var _a, _b;
142
- let reservationPrice;
143
140
  let priceComponents4invoice = [];
144
141
  // Orderから対象予約を取得
145
142
  const reservationOffer = (_a = order === null || order === void 0 ? void 0 : order.acceptedOffers) === null || _a === void 0 ? void 0 : _a.find((o) => {
@@ -174,7 +171,6 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
174
171
  if (reservationOffer !== undefined) {
175
172
  const priceComponent = (_b = reservationOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent;
176
173
  if (Array.isArray(priceComponent)) {
177
- reservationPrice = priceComponent.reduce((a, b) => a + Number(b.price), 0);
178
174
  priceComponents4invoice = priceComponent.map((component) => {
179
175
  var _a;
180
176
  const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
@@ -194,19 +190,12 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
194
190
  });
195
191
  }
196
192
  }
197
- if (USE_NEW_PRICE_SPEC_ON_INFORM_PAY_ACTION) {
198
- return {
199
- priceSpecification: {
200
- typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
201
- priceComponent: priceComponents4invoice
202
- }
203
- };
204
- }
205
- else {
206
- return {
207
- price: reservationPrice
208
- };
209
- }
193
+ return {
194
+ priceSpecification: {
195
+ typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
196
+ priceComponent: priceComponents4invoice
197
+ }
198
+ };
210
199
  }
211
200
  function createInformPaymentActions(params) {
212
201
  var _a;