@chevre/domain 20.1.0-alpha.3 → 20.1.0-alpha.30

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 (97) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  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/migrateEventSeriesAdditionalProperties.ts +96 -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/lib/chevre/repo/accountAction.d.ts +0 -18
  10. package/lib/chevre/repo/accountAction.js +402 -355
  11. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  12. package/lib/chevre/repo/accountTitle.js +6 -1
  13. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  14. package/lib/chevre/repo/additionalProperty.js +205 -0
  15. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  16. package/lib/chevre/repo/categoryCode.js +15 -1
  17. package/lib/chevre/repo/creativeWork.js +10 -1
  18. package/lib/chevre/repo/customer.d.ts +1 -0
  19. package/lib/chevre/repo/customer.js +5 -0
  20. package/lib/chevre/repo/event.d.ts +9 -4
  21. package/lib/chevre/repo/event.js +69 -48
  22. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  23. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  24. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  25. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  26. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  27. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  28. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  29. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  30. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  31. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  32. package/lib/chevre/repo/mongoose/model/place.js +42 -0
  33. package/lib/chevre/repo/offer.js +10 -1
  34. package/lib/chevre/repo/offerCatalog.js +10 -10
  35. package/lib/chevre/repo/place.d.ts +1 -0
  36. package/lib/chevre/repo/place.js +54 -7
  37. package/lib/chevre/repo/transaction.js +20 -5
  38. package/lib/chevre/repository.d.ts +6 -3
  39. package/lib/chevre/repository.js +10 -5
  40. package/lib/chevre/service/account.d.ts +0 -4
  41. package/lib/chevre/service/account.js +24 -22
  42. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  43. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  44. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  45. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  46. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  47. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  48. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -20
  49. package/lib/chevre/service/delivery/factory.js +2 -1
  50. package/lib/chevre/service/event.js +12 -2
  51. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  52. package/lib/chevre/service/offer/event/authorize.js +46 -10
  53. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +0 -1
  54. package/lib/chevre/service/offer/factory.js +7 -20
  55. package/lib/chevre/service/offer.js +6 -6
  56. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +5 -3
  57. package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
  58. package/lib/chevre/service/order/placeOrder.js +17 -7
  59. package/lib/chevre/service/order/returnOrder.js +2 -1
  60. package/lib/chevre/service/order/sendOrder.js +4 -2
  61. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  62. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  63. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  64. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  65. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  66. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  67. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  68. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +4 -2
  69. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  70. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  71. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  72. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  73. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  74. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  75. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  76. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  77. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  78. package/lib/chevre/service/transaction.js +1 -14
  79. package/package.json +4 -4
  80. package/example/src/chevre/accountBlanceTest.ts +0 -24
  81. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  82. package/example/src/chevre/createSeats.ts +0 -59
  83. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  84. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  85. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  86. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  87. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  88. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  89. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  90. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  91. package/example/src/chevre/renameTransaction.ts +0 -22
  92. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  93. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  94. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  95. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
  96. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
  97. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
@@ -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
  });
@@ -3,20 +3,21 @@ 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 = [];
10
9
  const payObject = createPayObject(params);
11
10
  const informPaymentActions = createInformPaymentActions(params);
12
11
  if (payObject !== undefined) {
12
+ const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
13
13
  const simpleOrder = {
14
14
  // project: params.order.project,
15
15
  typeOf: params.order.typeOf,
16
16
  seller: params.order.seller,
17
17
  // mask
18
- customer: (0, order_1.createMaskedCustomer)(params.order),
19
- confirmationNumber: params.order.confirmationNumber,
18
+ customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
19
+ // IOrderへ移行(2022-11-17~)
20
+ // confirmationNumber: params.order.confirmationNumber,
20
21
  orderNumber: params.order.orderNumber,
21
22
  price: params.order.price,
22
23
  priceCurrency: params.order.priceCurrency,
@@ -121,8 +122,7 @@ function createPayObjectServiceOutput(params) {
121
122
  paymentServiceOutput = movieTickets.map((movieTicket) => {
122
123
  var _a;
123
124
  const reservation4invoice = movieTicket2reservation4invoice(movieTicket, order, String(paymentMethodType));
124
- return Object.assign({ identifier: movieTicket.identifier }, (typeof reservation4invoice.price === 'number'
125
- || 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')
126
126
  ? {
127
127
  serviceOutput: reservation4invoice
128
128
  }
@@ -137,7 +137,6 @@ function createPayObjectServiceOutput(params) {
137
137
  }
138
138
  function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType) {
139
139
  var _a, _b;
140
- let reservationPrice;
141
140
  let priceComponents4invoice = [];
142
141
  // Orderから対象予約を取得
143
142
  const reservationOffer = (_a = order === null || order === void 0 ? void 0 : order.acceptedOffers) === null || _a === void 0 ? void 0 : _a.find((o) => {
@@ -172,7 +171,6 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
172
171
  if (reservationOffer !== undefined) {
173
172
  const priceComponent = (_b = reservationOffer.priceSpecification) === null || _b === void 0 ? void 0 : _b.priceComponent;
174
173
  if (Array.isArray(priceComponent)) {
175
- reservationPrice = priceComponent.reduce((a, b) => a + Number(b.price), 0);
176
174
  priceComponents4invoice = priceComponent.map((component) => {
177
175
  var _a;
178
176
  const accounting = (typeof ((_a = component.accounting) === null || _a === void 0 ? void 0 : _a.accountsReceivable) === 'number')
@@ -192,19 +190,12 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
192
190
  });
193
191
  }
194
192
  }
195
- if (USE_NEW_PRICE_SPEC_ON_INFORM_PAY_ACTION) {
196
- return {
197
- priceSpecification: {
198
- typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
199
- priceComponent: priceComponents4invoice
200
- }
201
- };
202
- }
203
- else {
204
- return {
205
- price: reservationPrice
206
- };
207
- }
193
+ return {
194
+ priceSpecification: {
195
+ typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
196
+ priceComponent: priceComponents4invoice
197
+ }
198
+ };
208
199
  }
209
200
  function createInformPaymentActions(params) {
210
201
  var _a;
@@ -63,7 +63,8 @@ function createAcquiredFrom(params) {
63
63
  // 最低限の情報に絞る
64
64
  const seller = params.order.seller;
65
65
  return {
66
- project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
66
+ // 最適化(2022-11-15~)
67
+ // project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
67
68
  id: seller.id,
68
69
  typeOf: seller.typeOf,
69
70
  name: (typeof seller.name === 'string')
@@ -475,7 +475,7 @@ function createScreeningEventAdditionalPropertyFromCOA(params) {
475
475
  return {
476
476
  coaInfo,
477
477
  additionalProperty: [
478
- { name: 'COA_ENDPOINT', value: credentials_1.credentials.coa.endpoint },
478
+ // { name: 'COA_ENDPOINT', value: credentials.coa.endpoint },
479
479
  { name: 'coaInfo', value: JSON.stringify(coaInfo) }
480
480
  ]
481
481
  };
@@ -579,7 +579,7 @@ function createScreeningEventSeriesAdditionalPropertyFromCOA(params) {
579
579
  return {
580
580
  coaInfo,
581
581
  additionalProperty: [
582
- { name: 'COA_ENDPOINT', value: credentials_1.credentials.coa.endpoint },
582
+ // { name: 'COA_ENDPOINT', value: credentials.coa.endpoint },
583
583
  { name: 'coaInfo', value: JSON.stringify(coaInfo) }
584
584
  ]
585
585
  };
@@ -648,6 +648,16 @@ function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
648
648
  typeOf: 'QuantitativeValue',
649
649
  value: 1200,
650
650
  unitCode: factory.unitCode.Sec
651
+ },
652
+ availabilityStartsGraceTimeOnPOS: {
653
+ typeOf: 'QuantitativeValue',
654
+ value: -93,
655
+ unitCode: factory.unitCode.Day
656
+ },
657
+ availabilityEndsGraceTimeOnPOS: {
658
+ typeOf: 'QuantitativeValue',
659
+ value: 2678400,
660
+ unitCode: factory.unitCode.Sec
651
661
  }
652
662
  }
653
663
  };
@@ -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>;
@@ -23,7 +23,7 @@ function authorize(params) {
23
23
  // tslint:disable-next-line:max-func-body-length
24
24
  return (repos) => __awaiter(this, void 0, void 0, function* () {
25
25
  const now = new Date();
26
- const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(Object.assign(Object.assign({}, params), { now }))({ event: repos.event, transaction: repos.transaction });
26
+ const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(Object.assign(Object.assign({}, params), { now, store: params.store }))({ event: repos.event, transaction: repos.transaction });
27
27
  const acceptedOffers = yield validateAcceptedOffers({
28
28
  object: params.object,
29
29
  event,
@@ -121,12 +121,11 @@ function validateCreateRequest(params) {
121
121
  }
122
122
  const bookingServiceIdentifire = offeredThrough.identifier;
123
123
  if (bookingServiceIdentifire === factory.service.webAPI.Identifier.Chevre) {
124
+ if (params.validateEventOfferPeriod === true) {
125
+ validateEventOfferPeriod({ event, now, availableAt: { id: params.store.id } });
126
+ }
124
127
  if (params.validateEvent === true) {
125
- validateEvent({
126
- event,
127
- now,
128
- object: params.object
129
- });
128
+ validateEvent({ event, object: params.object });
130
129
  }
131
130
  }
132
131
  return { transaction, event, bookingServiceIdentifire };
@@ -204,12 +203,23 @@ function validateObjectWithoutDetail(params) {
204
203
  return objectWithoutDetail;
205
204
  });
206
205
  }
207
- function validateEvent(params) {
208
- var _a, _b;
206
+ /**
207
+ * イベントのオファー有効期間を検証する
208
+ */
209
+ function validateEventOfferPeriod(params) {
209
210
  const acceptedDate = moment(params.now);
210
211
  const eventOffers = params.event.offers;
211
- const validFrom = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.validFrom;
212
- const validThrough = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.validThrough;
212
+ // アプリケーションごとの設定を参照する(2022-11-19~)
213
+ const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
214
+ return Array.isArray(offer.availableAtOrFrom) && offer.availableAtOrFrom[0].id === params.availableAt.id;
215
+ });
216
+ if (makesOfferOnApplication === undefined) {
217
+ throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${params.availableAt.id}`);
218
+ }
219
+ const validFrom = makesOfferOnApplication.validFrom;
220
+ const validThrough = makesOfferOnApplication.validThrough;
221
+ // const validFrom = eventOffers?.validFrom;
222
+ // const validThrough = eventOffers?.validThrough;
213
223
  if (validFrom !== undefined && validFrom !== null) {
214
224
  if (acceptedDate.isBefore(moment(validFrom))) {
215
225
  throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid from ${validFrom}`);
@@ -220,6 +230,32 @@ function validateEvent(params) {
220
230
  throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
221
231
  }
222
232
  }
233
+ }
234
+ /**
235
+ * イベントの上限座席数を検証する
236
+ */
237
+ function validateEvent(params) {
238
+ var _a, _b;
239
+ // const acceptedDate = moment(params.now);
240
+ const eventOffers = params.event.offers;
241
+ // const validFrom = eventOffers?.validFrom;
242
+ // const validThrough = eventOffers?.validThrough;
243
+ // if (validFrom !== undefined && validFrom !== null) {
244
+ // if (acceptedDate.isBefore(moment(validFrom))) {
245
+ // throw new factory.errors.Argument(
246
+ // 'reservationFor.id',
247
+ // `Offer of ${params.event.id} is valid from ${validFrom}`
248
+ // );
249
+ // }
250
+ // }
251
+ // if (validThrough !== undefined && validThrough !== null) {
252
+ // if (acceptedDate.isAfter(moment(validThrough))) {
253
+ // throw new factory.errors.Argument(
254
+ // 'reservationFor.id',
255
+ // `Offer of ${params.event.id} is valid through ${validThrough}`
256
+ // );
257
+ // }
258
+ // }
223
259
  // イベントのmaxValueを検証
224
260
  const maxValue = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.eligibleQuantity) === null || _a === void 0 ? void 0 : _a.maxValue;
225
261
  if (typeof maxValue === 'number') {
@@ -82,7 +82,6 @@ function responseBody2acceptedOffers4result(params) {
82
82
  coaInfo = event.coaInfo;
83
83
  }
84
84
  else {
85
- // const coaEndpointProperty = event.additionalProperty.find((p) => p.name === 'COA_ENDPOINT');
86
85
  const coaInfoProperty = (_a = event.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((p) => p.name === 'coaInfo');
87
86
  coaInfo = (coaInfoProperty !== undefined) ? JSON.parse(coaInfoProperty.value) : undefined;
88
87
  }
@@ -13,7 +13,6 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.createCompoundPriceSpec4event = void 0;
15
15
  const factory = require("../../factory");
16
- const USE_MULTIPLE_MOVIE_TICKET_CHARGE = process.env.USE_MULTIPLE_MOVIE_TICKET_CHARGE === '1';
17
16
  function categoryCodeChargePriceSpec2component(params) {
18
17
  var _a;
19
18
  return Object.assign({ id: params.id, typeOf: params.typeOf, name: params.name, price: params.price, priceCurrency: params.priceCurrency, valueAddedTaxIncluded: params.valueAddedTaxIncluded, appliesToCategoryCode: params.appliesToCategoryCode }, (typeof ((_a = params.accounting) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { accounting: params.accounting } : undefined);
@@ -35,25 +34,13 @@ function createCompoundPriceSpec4event(params) {
35
34
  if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
36
35
  unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
37
36
  // すべての上映方式に該当する加算料金を追加(2022-10-29~)
38
- if (USE_MULTIPLE_MOVIE_TICKET_CHARGE) {
39
- const mvtkSpecs4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.filter((s) => {
40
- var _a;
41
- return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
42
- && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
43
- && params.videoFormatTypes.includes(s.appliesToVideoFormat);
44
- });
45
- mvtkPriceComponents.push(...mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component));
46
- }
47
- else {
48
- const mvtkSpec4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.find((s) => {
49
- var _a;
50
- return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
51
- && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType;
52
- });
53
- if (mvtkSpec4appliesToMovieTicket !== undefined) {
54
- mvtkPriceComponents.push(mvtkChargePriceSpec2component(mvtkSpec4appliesToMovieTicket));
55
- }
56
- }
37
+ const mvtkSpecs4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.filter((s) => {
38
+ var _a;
39
+ return ((_a = s.appliesToMovieTicket.serviceOutput) === null || _a === void 0 ? void 0 : _a.typeOf) === appliesToMovieTicket.serviceOutput.typeOf
40
+ && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
41
+ && params.videoFormatTypes.includes(s.appliesToVideoFormat);
42
+ });
43
+ mvtkPriceComponents.push(...mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component));
57
44
  });
58
45
  }
59
46
  else {
@@ -40,12 +40,11 @@ function addOffers2Seat(params) {
40
40
  && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
41
41
  });
42
42
  }));
43
+ // 最適化(2022-11-15~)
43
44
  const priceSpecification = {
44
- // 不要な属性を除外(2022-11-02~)
45
- // project: params.project,
46
45
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
47
- priceCurrency: factory.priceCurrency.JPY,
48
- valueAddedTaxIncluded: true,
46
+ // priceCurrency: factory.priceCurrency.JPY,
47
+ // valueAddedTaxIncluded: true,
49
48
  priceComponent: priceComponent
50
49
  };
51
50
  let availability = (unavailableOffer !== undefined)
@@ -55,9 +54,10 @@ function addOffers2Seat(params) {
55
54
  availability = params.availability;
56
55
  }
57
56
  return Object.assign(Object.assign({}, params.seat), { offers: [{
58
- project: params.project,
57
+ // 最適化(2022-11-15~)
58
+ // project: params.project,
59
59
  typeOf: factory.offerType.Offer,
60
- priceCurrency: factory.priceCurrency.JPY,
60
+ // priceCurrency: factory.priceCurrency.JPY,
61
61
  availability: availability,
62
62
  priceSpecification: priceSpecification
63
63
  }] });
@@ -33,7 +33,7 @@ function getOrderWithToken(params) {
33
33
  ? {
34
34
  id: params.order.customer.id,
35
35
  name: '****',
36
- project: params.order.customer.project,
36
+ // project: params.order.customer.project,
37
37
  typeOf: params.order.customer.typeOf
38
38
  }
39
39
  : {
@@ -42,7 +42,8 @@ function getOrderWithToken(params) {
42
42
  };
43
43
  const seller4orderToken = {
44
44
  id: params.order.seller.id,
45
- project: params.order.seller.project,
45
+ // 最適化(2022-11-15~)
46
+ // project: params.order.seller.project,
46
47
  typeOf: params.order.seller.typeOf
47
48
  };
48
49
  const order4token = {
@@ -50,7 +51,8 @@ function getOrderWithToken(params) {
50
51
  typeOf: params.order.typeOf,
51
52
  seller: seller4orderToken,
52
53
  customer: customer4orderToken,
53
- confirmationNumber: params.order.confirmationNumber,
54
+ // IOrderへ移行(2022-11-17~)
55
+ // confirmationNumber: params.order.confirmationNumber,
54
56
  orderNumber: params.order.orderNumber,
55
57
  price: params.order.price,
56
58
  priceCurrency: params.order.priceCurrency,
@@ -24,12 +24,13 @@ const TOKEN_EXPIRES_IN = 604800;
24
24
  function onOrderStatusChanged(params) {
25
25
  return (repos) => __awaiter(this, void 0, void 0, function* () {
26
26
  let tasks = [];
27
+ const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
27
28
  const simpleOrder = {
28
- // project: params.order.project,
29
29
  typeOf: params.order.typeOf,
30
30
  seller: params.order.seller,
31
- customer: (0, order_1.createMaskedCustomer)(params.order),
32
- confirmationNumber: params.order.confirmationNumber,
31
+ customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
32
+ // IOrderへ移行(2022-11-17~)
33
+ // confirmationNumber: params.order.confirmationNumber,
33
34
  orderNumber: params.order.orderNumber,
34
35
  price: params.order.price,
35
36
  priceCurrency: params.order.priceCurrency,
@@ -118,7 +119,7 @@ function createConfirmPayTransactionTasks(order, simpleOrder) {
118
119
  typeOf: factory.actionType.ConfirmAction,
119
120
  object: [{ typeOf: factory.assetTransactionType.Pay, transactionNumber: paymentMethod.paymentMethodId }],
120
121
  agent: order.project,
121
- purpose: simpleOrder,
122
+ purpose: Object.assign(Object.assign({}, simpleOrder), { confirmationNumber: order.confirmationNumber }),
122
123
  instrument: {
123
124
  typeOf: 'WebAPI',
124
125
  identifier: factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre