@chevre/domain 20.1.0-alpha.5 → 20.1.0-alpha.50

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 (119) 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 +53 -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 +42 -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 +9 -19
  57. package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
  58. package/lib/chevre/service/assetTransaction/reserve.js +41 -95
  59. package/lib/chevre/service/delivery/factory.js +2 -1
  60. package/lib/chevre/service/event.js +20 -6
  61. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  62. package/lib/chevre/service/offer/event/authorize.js +65 -27
  63. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  64. package/lib/chevre/service/offer/event/factory.js +17 -12
  65. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  66. package/lib/chevre/service/offer/factory.js +7 -20
  67. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +11 -3
  68. package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
  69. package/lib/chevre/service/order/placeOrder.js +13 -5
  70. package/lib/chevre/service/order/returnOrder.js +2 -1
  71. package/lib/chevre/service/order/sendOrder.js +2 -1
  72. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
  73. package/lib/chevre/service/reserve/cancelReservation.js +260 -107
  74. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  75. package/lib/chevre/service/reserve/factory.d.ts +14 -2
  76. package/lib/chevre/service/reserve/factory.js +13 -6
  77. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  78. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
  79. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  80. package/lib/chevre/service/transaction/orderProgramMembership.js +15 -31
  81. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
  82. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +20 -4
  83. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  84. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  85. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  86. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  87. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +2 -1
  88. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
  89. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  90. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  91. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  92. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  93. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  94. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -1
  95. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  96. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -1
  97. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  98. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  99. package/lib/chevre/service/transaction.js +1 -14
  100. package/lib/chevre/service.d.ts +2 -0
  101. package/lib/chevre/service.js +2 -0
  102. package/package.json +4 -4
  103. package/example/src/chevre/accountBlanceTest.ts +0 -24
  104. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  105. package/example/src/chevre/createSeats.ts +0 -59
  106. package/example/src/chevre/deleteEvents.ts +0 -50
  107. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  108. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  109. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  110. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  111. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  112. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  113. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  114. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  115. package/example/src/chevre/renameTransaction.ts +0 -22
  116. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  117. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  118. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  119. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
@@ -911,6 +911,19 @@ class MongoRepository {
911
911
  return doc.toObject();
912
912
  });
913
913
  }
914
+ confirmByReservationNumber(params) {
915
+ return __awaiter(this, void 0, void 0, function* () {
916
+ const conditions = {
917
+ reservationNumber: { $eq: String(params.reservationNumber) },
918
+ reservationStatus: { $eq: params.previousReservationStatus }
919
+ };
920
+ const update = Object.assign({ reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined
921
+ // ...(params.reservedTicket !== undefined) ? { reservedTicket: params.reservedTicket } : undefined
922
+ );
923
+ yield this.reservationModel.updateMany(conditions, update)
924
+ .exec();
925
+ });
926
+ }
914
927
  /**
915
928
  * 予約取消
916
929
  */
@@ -921,7 +934,7 @@ class MongoRepository {
921
934
  : undefined);
922
935
  const update = Object.assign(Object.assign({}, (typeof params.previousReservationStatus === 'string')
923
936
  ? { previousReservationStatus: params.previousReservationStatus }
924
- : undefined), { reservationStatus: factory.reservationStatusType.ReservationCancelled, modifiedTime: params.now });
937
+ : undefined), { reservationStatus: factory.reservationStatusType.ReservationCancelled, modifiedTime: params.modifiedTime });
925
938
  const doc = yield this.reservationModel.findOneAndUpdate(conditions, update, { new: true })
926
939
  .select({ __v: 0, createdAt: 0, updatedAt: 0 })
927
940
  .exec();
@@ -939,6 +952,21 @@ class MongoRepository {
939
952
  return doc.toObject();
940
953
  });
941
954
  }
955
+ /**
956
+ * 予約取消
957
+ */
958
+ cancelByReservationNumber(params) {
959
+ return __awaiter(this, void 0, void 0, function* () {
960
+ const conditions = Object.assign({ reservationNumber: { $eq: String(params.reservationNumber) } }, (typeof params.previousReservationStatus === 'string')
961
+ ? { reservationStatus: params.previousReservationStatus }
962
+ : undefined);
963
+ const update = Object.assign(Object.assign({}, (typeof params.previousReservationStatus === 'string')
964
+ ? { previousReservationStatus: params.previousReservationStatus }
965
+ : undefined), { reservationStatus: factory.reservationStatusType.ReservationCancelled, modifiedTime: params.modifiedTime });
966
+ return this.reservationModel.updateMany(conditions, update)
967
+ .exec();
968
+ });
969
+ }
942
970
  /**
943
971
  * 発券する
944
972
  */
@@ -1059,5 +1087,17 @@ class MongoRepository {
1059
1087
  .then((docs) => docs.map((doc) => doc._id.toString()));
1060
1088
  });
1061
1089
  }
1090
+ deleteReservedTicketUnderName() {
1091
+ return __awaiter(this, void 0, void 0, function* () {
1092
+ const conditions = {
1093
+ 'reservedTicket.underName': { $exists: true }
1094
+ };
1095
+ const update = {
1096
+ $unset: { 'reservedTicket.underName': 1 }
1097
+ };
1098
+ return this.reservationModel.updateMany(conditions, update)
1099
+ .exec();
1100
+ });
1101
+ }
1062
1102
  }
1063
1103
  exports.MongoRepository = MongoRepository;
@@ -247,7 +247,24 @@ class MongoRepository {
247
247
  */
248
248
  start(params) {
249
249
  return __awaiter(this, void 0, void 0, function* () {
250
- return this.transactionModel.create(Object.assign(Object.assign({ typeOf: params.typeOf }, params), { status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
250
+ const startDate = new Date();
251
+ let expires;
252
+ if (params.typeOf === factory.transactionType.PlaceOrder
253
+ || params.typeOf === factory.transactionType.ReturnOrder) {
254
+ // expiresInSecondsの指定があれば優先して適用する(2022-11-25~)
255
+ if (typeof params.expiresInSeconds === 'number' && params.expiresInSeconds > 0) {
256
+ expires = moment(startDate)
257
+ .add(params.expiresInSeconds, 'seconds')
258
+ .toDate();
259
+ }
260
+ else {
261
+ throw new factory.errors.ArgumentNull('expiresInSeconds');
262
+ }
263
+ }
264
+ else {
265
+ expires = params.expires;
266
+ }
267
+ return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate, endDate: undefined, expires, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
251
268
  .then((doc) => doc.toObject());
252
269
  });
253
270
  }
@@ -433,8 +450,7 @@ class MongoRepository {
433
450
  return __awaiter(this, void 0, void 0, function* () {
434
451
  yield this.transactionModel.findByIdAndUpdate(params.id, {
435
452
  tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
436
- tasksExportedAt: moment()
437
- .toDate()
453
+ tasksExportedAt: new Date()
438
454
  })
439
455
  .exec();
440
456
  });
@@ -460,8 +476,7 @@ class MongoRepository {
460
476
  */
461
477
  cancel(params) {
462
478
  return __awaiter(this, void 0, void 0, function* () {
463
- const endDate = moment()
464
- .toDate();
479
+ const endDate = new Date();
465
480
  // 進行中ステータスの取引を中止する
466
481
  const doc = yield this.transactionModel.findOneAndUpdate({
467
482
  typeOf: params.typeOf,
@@ -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 = [];
@@ -17,7 +16,8 @@ function createPayActions(params) {
17
16
  seller: params.order.seller,
18
17
  // mask
19
18
  customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
20
- confirmationNumber: params.order.confirmationNumber,
19
+ // IOrderへ移行(2022-11-17~)
20
+ // confirmationNumber: params.order.confirmationNumber,
21
21
  orderNumber: params.order.orderNumber,
22
22
  price: params.order.price,
23
23
  priceCurrency: params.order.priceCurrency,
@@ -122,8 +122,7 @@ function createPayObjectServiceOutput(params) {
122
122
  paymentServiceOutput = movieTickets.map((movieTicket) => {
123
123
  var _a;
124
124
  const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
125
- return Object.assign({ identifier: movieTicket.identifier }, (typeof reservation4invoice.price === 'number'
126
- || 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')
127
126
  ? {
128
127
  serviceOutput: reservation4invoice
129
128
  }
@@ -138,7 +137,6 @@ function createPayObjectServiceOutput(params) {
138
137
  }
139
138
  function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType) {
140
139
  var _a, _b;
141
- let reservationPrice;
142
140
  let priceComponents4invoice = [];
143
141
  // Orderから対象予約を取得
144
142
  const reservationOffer = (_a = order === null || order === void 0 ? void 0 : order.acceptedOffers) === null || _a === void 0 ? void 0 : _a.find((o) => {
@@ -173,7 +171,6 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
173
171
  if (reservationOffer !== undefined) {
174
172
  const priceComponent = (_b = reservationOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent;
175
173
  if (Array.isArray(priceComponent)) {
176
- reservationPrice = priceComponent.reduce((a, b) => a + Number(b.price), 0);
177
174
  priceComponents4invoice = priceComponent.map((component) => {
178
175
  var _a;
179
176
  const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
@@ -193,19 +190,12 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
193
190
  });
194
191
  }
195
192
  }
196
- if (USE_NEW_PRICE_SPEC_ON_INFORM_PAY_ACTION) {
197
- return {
198
- priceSpecification: {
199
- typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
200
- priceComponent: priceComponents4invoice
201
- }
202
- };
203
- }
204
- else {
205
- return {
206
- price: reservationPrice
207
- };
208
- }
193
+ return {
194
+ priceSpecification: {
195
+ typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
196
+ priceComponent: priceComponents4invoice
197
+ }
198
+ };
209
199
  }
210
200
  function createInformPaymentActions(params) {
211
201
  var _a;