@chevre/domain 24.0.0-alpha.0 → 24.0.0-alpha.2

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 (93) hide show
  1. package/lib/chevre/repo/acceptedPaymentMethod.js +1 -1
  2. package/lib/chevre/repo/additionalProperty.js +1 -1
  3. package/lib/chevre/repo/aggregateOffer.js +1 -1
  4. package/lib/chevre/repo/confirmationNumber.js +2 -4
  5. package/lib/chevre/repo/creativeWork.js +1 -1
  6. package/lib/chevre/repo/eventOffer.js +1 -1
  7. package/lib/chevre/repo/eventSeries.js +1 -1
  8. package/lib/chevre/repo/identity.js +1 -2
  9. package/lib/chevre/repo/issuer.js +2 -4
  10. package/lib/chevre/repo/message.js +1 -1
  11. package/lib/chevre/repo/note.js +1 -1
  12. package/lib/chevre/repo/noteAboutOrder.js +1 -1
  13. package/lib/chevre/repo/offer/unitPriceInCatalog.js +1 -1
  14. package/lib/chevre/repo/offerItemCondition.js +1 -1
  15. package/lib/chevre/repo/order.js +1 -1
  16. package/lib/chevre/repo/orderInTransaction.js +1 -2
  17. package/lib/chevre/repo/orderNumber.js +2 -4
  18. package/lib/chevre/repo/place/movieTheater.js +1 -1
  19. package/lib/chevre/repo/place/seat.js +1 -1
  20. package/lib/chevre/repo/product.js +1 -1
  21. package/lib/chevre/repo/productOffer.js +1 -1
  22. package/lib/chevre/repo/project.js +1 -1
  23. package/lib/chevre/repo/reservation.js +1 -1
  24. package/lib/chevre/repo/role.js +1 -2
  25. package/lib/chevre/repo/seller.js +1 -1
  26. package/lib/chevre/repo/serviceOutputIdentifier.js +2 -4
  27. package/lib/chevre/repo/transactionNumber.js +2 -4
  28. package/lib/chevre/repo/trip.js +1 -2
  29. package/lib/chevre/service/account.js +14 -21
  30. package/lib/chevre/service/accountTransaction/deposit.js +2 -8
  31. package/lib/chevre/service/accountTransaction/transfer.js +2 -8
  32. package/lib/chevre/service/accountTransaction/withdraw.js +2 -8
  33. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +24 -32
  34. package/lib/chevre/service/assetTransaction/cancelReservationCOA.js +2 -4
  35. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -23
  36. package/lib/chevre/service/assetTransaction/pay/check.js +6 -11
  37. package/lib/chevre/service/assetTransaction/pay/confirm.js +1 -2
  38. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +1 -1
  39. package/lib/chevre/service/assetTransaction/refund.js +13 -20
  40. package/lib/chevre/service/assetTransaction/registerService.js +1 -7
  41. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +2 -4
  42. package/lib/chevre/service/assetTransaction/reserveCOA.js +2 -4
  43. package/lib/chevre/service/delivery/product/factory.js +1 -2
  44. package/lib/chevre/service/delivery/reservation/factory.js +1 -2
  45. package/lib/chevre/service/event/saveScreeningEvents.js +1 -0
  46. package/lib/chevre/service/event.js +0 -1
  47. package/lib/chevre/service/moneyTransfer.js +2 -2
  48. package/lib/chevre/service/notification/factory.js +1 -1
  49. package/lib/chevre/service/notification/notifyByEmail.js +50 -56
  50. package/lib/chevre/service/notification/sendEmailMessage.js +2 -3
  51. package/lib/chevre/service/notification/triggerWebhook.js +32 -37
  52. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +1 -2
  53. package/lib/chevre/service/offer/event/authorize.js +1 -1
  54. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +1 -2
  55. package/lib/chevre/service/offer/moneyTransfer/authorize.js +47 -54
  56. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +7 -13
  57. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +1 -1
  58. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +1 -1
  59. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +1 -1
  60. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -1
  61. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -1
  62. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +1 -1
  63. package/lib/chevre/service/order/onOrderUpdated.js +1 -2
  64. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -2
  65. package/lib/chevre/service/order/returnOrder.js +1 -1
  66. package/lib/chevre/service/payment/any/fixOrderAsNeeded.js +1 -2
  67. package/lib/chevre/service/payment/any.js +1 -2
  68. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -2
  69. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
  70. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -2
  71. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3dsResult2recipe.d.ts +1 -1
  72. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCardResult2recipe.d.ts +1 -1
  73. package/lib/chevre/service/payment/creditCard/factory.d.ts +1 -1
  74. package/lib/chevre/service/payment/movieTicket/authorize.js +1 -1
  75. package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -4
  76. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +4 -6
  77. package/lib/chevre/service/payment/movieTicket/voidTransaction.js +1 -2
  78. package/lib/chevre/service/payment/paymentCard.js +2 -4
  79. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -6
  80. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -2
  81. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +3 -6
  82. package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
  83. package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
  84. package/lib/chevre/service/task/pay.js +1 -2
  85. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  86. package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
  87. package/lib/chevre/service/transaction/moneyTransfer.js +11 -19
  88. package/lib/chevre/service/transaction/placeOrder/confirm/publishCode.js +1 -1
  89. package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -4
  90. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -2
  91. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -2
  92. package/lib/chevre/service/transaction/returnOrder/preStart/getReturnPolicyByProject.js +1 -1
  93. package/package.json +5 -14
@@ -37,7 +37,7 @@ const debug = (0, debug_1.default)('chevre-domain:service:order');
37
37
  function onOrderPaymentDue(params) {
38
38
  return async (repos) => {
39
39
  debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
40
- let tasks = [];
40
+ let tasks;
41
41
  // const maskedCustomer = createMaskedCustomer(params.order, { noProfile: true });
42
42
  const simpleOrder = {
43
43
  typeOf: params.order.typeOf,
@@ -43,7 +43,7 @@ function onOrderProcessing(params) {
43
43
  const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
44
44
  const { numTryConfirmReserveTransaction } = settings;
45
45
  debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
46
- let tasks = [];
46
+ let tasks;
47
47
  let creatingCheckResourceTask;
48
48
  const sendEmailMessageByOnOrderProcessing = params.placeOrderTransaction?.potentialActions?.order?.onOrderProcessing?.sendEmailMessage;
49
49
  switch (params.order.orderStatus) {
@@ -43,7 +43,7 @@ function onOrderReturned(params) {
43
43
  ) => {
44
44
  const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
45
45
  debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
46
- let tasks = [];
46
+ let tasks;
47
47
  // const maskedCustomer = createMaskedCustomer(params.order, { noProfile: true });
48
48
  const simpleOrder = {
49
49
  typeOf: params.order.typeOf,
@@ -32,8 +32,7 @@ function onOrderUpdated(params) {
32
32
  // settings: Settings
33
33
  ) => {
34
34
  const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onOrderStatusChanged']);
35
- let tasks = [];
36
- tasks = (0, factory_1.createInformTasks)({
35
+ const tasks = (0, factory_1.createInformTasks)({
37
36
  typeOf: factory.order.OrderType.Order,
38
37
  orderNumber: params.orderNumber,
39
38
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
@@ -30,7 +30,6 @@ function createPlacingOrderFromExistingTransaction(params) {
30
30
  return async (repos) => {
31
31
  const confirmationNumber = String(params.confirmationNumber);
32
32
  const orderNumber = params.orderNumber;
33
- let order;
34
33
  const placeOrderTransactions = await repos.transaction.projectFields({
35
34
  limit: 1,
36
35
  page: 1,
@@ -102,7 +101,7 @@ function createPlacingOrderFromExistingTransaction(params) {
102
101
  throw error;
103
102
  }
104
103
  }
105
- order = (0, factory_1.createPlacingOrder)({ transaction: placeOrderTransactionWithResult, authorizePaymentActions, acceptedOffers });
104
+ const order = (0, factory_1.createPlacingOrder)({ transaction: placeOrderTransactionWithResult, authorizePaymentActions, acceptedOffers });
106
105
  return { order, placeOrderTransaction: placeOrderTransactionWithResult, serialNumbers };
107
106
  };
108
107
  }
@@ -105,7 +105,7 @@ function returnOrder(params) {
105
105
  recipient,
106
106
  typeOf: factory.actionType.ReturnAction
107
107
  };
108
- let returnedOwnershipInfos = [];
108
+ let returnedOwnershipInfos;
109
109
  let returnedOrder;
110
110
  const action = await repos.action.start(returnOrderActionAttributes);
111
111
  try {
@@ -33,9 +33,8 @@ function fixOrderAsNeeded(params) {
33
33
  // publish always(2025-02-12~)
34
34
  // MovieTicketの場合、確認番号を発行(着券に連携するため)(2024-05-27~)
35
35
  // let confirmationNumber: string | undefined;
36
- let confirmationNumber;
37
36
  // if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.MovieTicket) {
38
- confirmationNumber = await (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
37
+ const confirmationNumber = await (0, publishConfirmationNumberIfNotExist_1.publishConfirmationNumberIfNotExist)({
39
38
  id: params.purpose.id,
40
39
  status: { $in: [factory.transactionStatusType.InProgress] },
41
40
  object: { orderDate }
@@ -370,7 +370,6 @@ function publishPaymentUrl(params) {
370
370
  // const publishTransactionNumberResult = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
371
371
  // transactionNumber = publishTransactionNumberResult.transactionNumber;
372
372
  // }
373
- let result;
374
373
  // URL発行
375
374
  const authorizeObject = {
376
375
  ...params.object,
@@ -393,7 +392,7 @@ function publishPaymentUrl(params) {
393
392
  ...(typeof ticketToken === 'string') ? { ticketToken } : undefined
394
393
  });
395
394
  const taskId = params.sameAs?.id;
396
- result = await PayTransactionService.publishPaymentUrl(startParams, {
395
+ const result = await PayTransactionService.publishPaymentUrl(startParams, {
397
396
  purposeAsTransaction: { id: transaction.id },
398
397
  executor: (typeof taskId === 'string') ? { id: taskId } : {} // タスク関連付け(2024-05-22~)
399
398
  })(repos, settings);
@@ -94,7 +94,6 @@ function processAuthorizeCreditCard(params) {
94
94
  siteId: params.availableChannel.credentials?.siteId,
95
95
  sitePass: params.availableChannel.credentials?.sitePass
96
96
  };
97
- let action;
98
97
  let recipe = (0, processAuthorizeCreditCardResult2recipe_1.processAuthorizeCreditCardResult2recipe)({
99
98
  project: { id: params.project.id },
100
99
  result: { entryTranArgs }
@@ -110,7 +109,7 @@ function processAuthorizeCreditCard(params) {
110
109
  sameAs: { id: params.payTransaction.id, typeOf: factory.assetTransactionType.Pay }
111
110
  };
112
111
  // add action(2024-06-12~)
113
- action = await repos.action.start(actionAttributes, { recipe });
112
+ const action = await repos.action.start(actionAttributes, { recipe });
114
113
  try {
115
114
  entryTranResult = await repos.creditCardService.entryTran(entryTranArgs);
116
115
  execTranArgs = {
@@ -1,4 +1,4 @@
1
- import * as GMO from '@motionpicture/gmo-service';
1
+ import type * as GMO from '@motionpicture/gmo-service';
2
2
  import { ActionRepo } from '../../../../repo/action';
3
3
  import * as factory from '../../../../factory';
4
4
  interface ICreditCardPaymentAgencyTransaction3ds {
@@ -32,7 +32,6 @@ function processAuthorizeCreditCard3ds(params) {
32
32
  const { accessId, accessPass } = entryTranResult;
33
33
  const secureTran2Args = { accessId, accessPass };
34
34
  let secureTran2Result;
35
- let action;
36
35
  let recipe = (0, processAuthorizeCreditCard3dsResult2recipe_1.processAuthorizeCreditCard3dsResult2recipe)({
37
36
  project: { id: params.project.id },
38
37
  result: { secureTran2Args }
@@ -48,7 +47,7 @@ function processAuthorizeCreditCard3ds(params) {
48
47
  sameAs: { id: params.payTransaction.id, typeOf: factory.assetTransactionType.Pay }
49
48
  };
50
49
  // add action(2024-06-12~)
51
- action = await repos.action.start(actionAttributes, { recipe });
50
+ const action = await repos.action.start(actionAttributes, { recipe });
52
51
  try {
53
52
  secureTran2Result = await repos.creditCardService.secureTran2(secureTran2Args);
54
53
  }
@@ -1,4 +1,4 @@
1
- import * as GMO from '@motionpicture/gmo-service';
1
+ import type * as GMO from '@motionpicture/gmo-service';
2
2
  import * as factory from '../../../../factory';
3
3
  interface IProcessAuthorizeCreditCard3dsResult {
4
4
  secureTran2Args?: GMO.factory.credit.ISecureTran2Args;
@@ -1,4 +1,4 @@
1
- import * as GMO from '@motionpicture/gmo-service';
1
+ import type * as GMO from '@motionpicture/gmo-service';
2
2
  import * as factory from '../../../../factory';
3
3
  interface IProcessAuthorizeCreditCardResult {
4
4
  entryTranArgs?: GMO.factory.credit.IEntryTranArgs;
@@ -1,4 +1,4 @@
1
- import * as GMO from '@motionpicture/gmo-service';
1
+ import type * as GMO from '@motionpicture/gmo-service';
2
2
  import * as factory from '../../../factory';
3
3
  interface IProcessAlterTranResult {
4
4
  searchTradeArgs?: GMO.factory.credit.ISearchTradeArgs & GMO.factory.credit.IOptionalSiteArgs;
@@ -35,7 +35,7 @@ const validation_1 = require("./validation");
35
35
  function authorize(params, transaction, paymentServiceId, options) {
36
36
  return async (repos, settings) => {
37
37
  let accountId;
38
- let accountsReceivablesByServiceType = [];
38
+ let accountsReceivablesByServiceType;
39
39
  try {
40
40
  // MovieTicket決済の場合、認証
41
41
  const validateMovieTicketResult = await (0, validation_1.validateMovieTicket)(params, paymentServiceId, options.checkedAction, options.purpose)(repos, settings);
@@ -33,8 +33,6 @@ const factory = __importStar(require("../../../factory"));
33
33
  const getCredentials_1 = require("./getCredentials");
34
34
  function processPurchaseNumberAuth(params) {
35
35
  return async (repos, settings) => {
36
- let purchaseNumberAuthIn;
37
- let purchaseNumberAuthResult;
38
36
  // movieTickets.typeOfへの依存廃止(2024-03-15~)
39
37
  // MovieTicket系統の決済方法タイプは動的
40
38
  // const paymentMethodType = params.movieTickets[0]?.typeOf;
@@ -77,7 +75,7 @@ function processPurchaseNumberAuth(params) {
77
75
  seller: { id: String(params.seller.id), project: { id: params.screeningEvent.project.id } },
78
76
  paymentServiceId: params.paymentServiceId
79
77
  })(repos);
80
- purchaseNumberAuthIn = {
78
+ const purchaseNumberAuthIn = {
81
79
  kgygishCd: sellerCredentials.kgygishCd,
82
80
  jhshbtsCd: surfrock.factory.service.auth.purchaseNumberAuth.InformationTypeCode.All,
83
81
  knyknrNoInfoIn: knyknrNoInfoIn,
@@ -99,7 +97,7 @@ function processPurchaseNumberAuth(params) {
99
97
  endpoint: String(availableChannel.serviceUrl),
100
98
  auth: mvtkReserveAuthClient
101
99
  }, { timeout: settings.movieticketReserve.timeoutCheck });
102
- purchaseNumberAuthResult = await authService.purchaseNumberAuth(purchaseNumberAuthIn);
100
+ const purchaseNumberAuthResult = await authService.purchaseNumberAuth(purchaseNumberAuthIn);
103
101
  return { purchaseNumberAuthIn, purchaseNumberAuthResult };
104
102
  };
105
103
  }
@@ -152,8 +152,8 @@ function refundMovieTicket(params, options) {
152
152
  catch (__) {
153
153
  // 失敗したら仕方ない
154
154
  }
155
- error = (0, errorHandler_1.handleMvtkReserveError)({ ...error, message: message });
156
- throw error;
155
+ const handledError = (0, errorHandler_1.handleMvtkReserveError)({ ...error, message: message });
156
+ throw handledError;
157
157
  }
158
158
  // アクションとしてはFailedだが後続処理を実行するケースに対応(2024-03-21~)
159
159
  const seatInfoSyncResultAsError = processSeatInfoSyncResult?.seatInfoSyncResultAsError;
@@ -196,9 +196,8 @@ function createSeatInfoSyncInOnRefund(params) {
196
196
  if (seatInfoSyncInOnPay === undefined) {
197
197
  throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
198
198
  }
199
- let seatInfoSyncIn;
200
199
  // 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
201
- seatInfoSyncIn = {
200
+ const seatInfoSyncIn = {
202
201
  ...seatInfoSyncInOnPay,
203
202
  trkshFlg: surfrock.factory.service.seat.seatInfoSync.DeleteFlag.True // 取消フラグ
204
203
  };
@@ -215,8 +214,7 @@ function createSeatInfoSyncCancelInOnRefund(params) {
215
214
  if (seatInfoSyncInOnPay === undefined) {
216
215
  throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
217
216
  }
218
- let seatInfoSyncCancelIn;
219
- seatInfoSyncCancelIn = {
217
+ const seatInfoSyncCancelIn = {
220
218
  kgygishCd: seatInfoSyncInOnPay.kgygishCd,
221
219
  kgysystmzskyykNo: seatInfoSyncInOnPay.kgygishSstmZskyykNo,
222
220
  kgysystmzskyykNoIkktsCnclFlg: '1',
@@ -52,7 +52,6 @@ function voidTransaction(params) {
52
52
  }
53
53
  });
54
54
  if (payAction !== undefined) {
55
- let refundAction;
56
55
  const seller = transaction.recipient;
57
56
  if (typeof seller?.id !== 'string') {
58
57
  throw new factory.errors.NotFound('payTransaction.recipient');
@@ -60,7 +59,7 @@ function voidTransaction(params) {
60
59
  if (payAction.purpose.typeOf !== factory.order.OrderType.Order) {
61
60
  throw new factory.errors.Internal(`unexpected payAction.purpose.typeOf ${payAction.purpose.typeOf}`);
62
61
  }
63
- refundAction = {
62
+ const refundAction = {
64
63
  project: transaction.project,
65
64
  typeOf: factory.actionType.RefundAction,
66
65
  object: [{
@@ -149,7 +149,6 @@ function validatePaymentMethod(params, paymentServiceId) {
149
149
  }
150
150
  function processAccountTransaction(params) {
151
151
  return async (repos) => {
152
- let pendingTransaction;
153
152
  const defaultName = `${factory.assetTransactionType.Pay} Transaction ${params.transactionNumber}`;
154
153
  const agent = {
155
154
  // ...params.agent,
@@ -186,7 +185,7 @@ function processAccountTransaction(params) {
186
185
  })
187
186
  });
188
187
  // ひとまず出金取引に限定
189
- pendingTransaction = await accountTransactionService.start({
188
+ const pendingTransaction = await accountTransactionService.start({
190
189
  transactionNumber: params.transactionNumber,
191
190
  project: { typeOf: params.project.typeOf, id: params.project.id },
192
191
  typeOf: factory.account.transactionType.Withdraw,
@@ -303,8 +302,7 @@ function refundPaymentCard(params) {
303
302
  transactionNumber: paymentMethodId
304
303
  });
305
304
  // accountNumberをpendingTransactionから取得する
306
- let accountNumber;
307
- accountNumber = payTransaction.object.pendingTransaction?.object.fromLocation?.accountNumber;
305
+ const accountNumber = payTransaction.object.pendingTransaction?.object.fromLocation?.accountNumber;
308
306
  if (typeof accountNumber !== 'string') {
309
307
  throw new factory.errors.ArgumentNull('serviceOutput.paymentAccount.accountNumber');
310
308
  }
@@ -48,14 +48,10 @@ function onReservationUsed(attendedReservation, action) {
48
48
  const informReservations = setting?.onReservationStatusChanged?.informReservation;
49
49
  const informTaskRunsAt = now;
50
50
  // support notification.reservation.IUseAction(2024-11-11~)
51
- let action4inform;
52
- let reservation4inform;
53
- // let reservation4inform: factory.notification.reservation.IReservation4informUsed
54
- // | factory.notification.reservation.IUseAction;
55
51
  const useForTheFirstTime = attendedReservation.reservedTicket.dateUsed !== undefined
56
52
  && (0, moment_1.default)(action.startDate)
57
53
  .isSame((0, moment_1.default)(attendedReservation.reservedTicket.dateUsed), 'milliseconds');
58
- reservation4inform = {
54
+ const reservation4inform = {
59
55
  typeOf: attendedReservation.typeOf,
60
56
  id: attendedReservation.id,
61
57
  // dateUsedの通知は初使用時のみで十分(2024-11-27~)
@@ -66,7 +62,7 @@ function onReservationUsed(attendedReservation, action) {
66
62
  }
67
63
  : undefined
68
64
  };
69
- action4inform = {
65
+ const action4inform = {
70
66
  typeOf: action.typeOf,
71
67
  project: action.project,
72
68
  id: action.id,
@@ -146,7 +146,6 @@ function createConfirmObject4COAByOrder(params) {
146
146
  }
147
147
  function fixOrderAsPurpose(params) {
148
148
  return async (repos) => {
149
- let order;
150
149
  const purposeOrderNumber = params.purpose.orderNumber;
151
150
  const orders = await repos.order.projectFields({
152
151
  limit: 1,
@@ -154,7 +153,7 @@ function fixOrderAsPurpose(params) {
154
153
  project: { id: { $eq: params.project.id } },
155
154
  orderNumbers: [purposeOrderNumber]
156
155
  }, { inclusion: ['customer', 'orderNumber', 'typeOf'] });
157
- order = orders.shift();
156
+ const order = orders.shift();
158
157
  if (order === undefined) {
159
158
  throw new factory.errors.NotFound('Order as purpose');
160
159
  }
@@ -40,21 +40,18 @@ function deleteResourcesByProduct(params) {
40
40
  let deleteResult;
41
41
  const action = await repos.action.start(deleteActionAttributes);
42
42
  try {
43
- let deleteEventResult;
44
- let updateOfferResult;
45
- let deleteNoteResult;
46
43
  // 興行を設定されたイベント削除
47
- deleteEventResult = await repos.event.deleteManyEventsByItemOfferedId({
44
+ const deleteEventResult = await repos.event.deleteManyEventsByItemOfferedId({
48
45
  project: { id: params.project.id },
49
46
  offers: { itemOffered: { id: { $in: [productId] } } }
50
47
  });
51
48
  // アドオンから除外
52
- updateOfferResult = await repos.aggregateOffer.pullAddOns({
49
+ const updateOfferResult = await repos.aggregateOffer.pullAddOns({
53
50
  project: { id: params.project.id },
54
51
  addOn: { itemOffered: { id: { $in: [productId] } } }
55
52
  });
56
53
  // メモを削除(2025-09-18~)
57
- deleteNoteResult = await repos.note.deleteNotesByAbout({
54
+ const deleteNoteResult = await repos.note.deleteNotesByAbout({
58
55
  about: { id: productId, typeOf: params.typeOf }
59
56
  });
60
57
  deleteResult = { deleteEventResult, updateOfferResult, deleteNoteResult };
@@ -34,7 +34,7 @@ function createInformOfferCatalogTasks(params, setting) {
34
34
  if (params.ids.length === 0) {
35
35
  return;
36
36
  }
37
- let offerCatalogs = [];
37
+ let offerCatalogs;
38
38
  if (params.isOfferCatalogItem) {
39
39
  offerCatalogs = await repos.offerCatalogItem.projectFields({ id: { $in: params.ids } }, ['identifier', 'name', 'numberOfItems', 'project', 'typeOf']);
40
40
  }
@@ -46,7 +46,7 @@ function syncOfferCatalog(params) {
46
46
  }
47
47
  else {
48
48
  for (const offerCatalogId of params.ids) {
49
- let offerCatalogs = [];
49
+ let offerCatalogs;
50
50
  if (params.isOfferCatalogItem) {
51
51
  offerCatalogs = await repos.offerCatalogItem.projectFields({ id: { $in: [offerCatalogId] } }, ['id', 'itemListElementTypeOf']);
52
52
  }
@@ -47,8 +47,7 @@ function call(params) {
47
47
  if (redisClient === undefined) {
48
48
  throw new factory.errors.Argument('settings', 'redisClient required');
49
49
  }
50
- let payActionAttributes;
51
- payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
50
+ const payActionAttributes = await (0, payByTask_1.payTask2payActionAttributes)({
52
51
  ...params.data,
53
52
  sameAs: { id: params.id, typeOf: 'Task' } // タスクIDを関連付け(2024-04-20~)
54
53
  })({
@@ -91,7 +91,7 @@ function call(params) {
91
91
  reserveService
92
92
  }, settings);
93
93
  }
94
- catch (error) {
94
+ catch (error) { // eslint-disable-line no-useless-catch
95
95
  throw error;
96
96
  }
97
97
  finally {
@@ -60,7 +60,7 @@ function createDeleteTransactionTasksByAgentId(params) {
60
60
  inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
61
61
  });
62
62
  const deleteAt = new Date();
63
- let deleteTransactionTasks = [];
63
+ let deleteTransactionTasks;
64
64
  switch (transactionTypeOf) {
65
65
  case factory.transactionType.PlaceOrder:
66
66
  deleteTransactionTasks = transactions.map((transaction) => {
@@ -72,23 +72,17 @@ function start(params) {
72
72
  const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
73
73
  // 取引開始
74
74
  const startParams = (0, factory_2.createStartParams)(params, passport, seller, amount, fromLocation, toLocation, transactionNumber);
75
- let transaction;
76
- try {
77
- transaction = await repos.transaction.start(startParams);
78
- await authorizePaymentCard({
79
- transaction: {
80
- ...transaction,
81
- object: startParams.object,
82
- seller: startParams.seller,
83
- agent: startParams.agent,
84
- project: startParams.project,
85
- typeOf: startParams.typeOf
86
- }
87
- })(repos);
88
- }
89
- catch (error) {
90
- throw error;
91
- }
75
+ const transaction = await repos.transaction.start(startParams);
76
+ await authorizePaymentCard({
77
+ transaction: {
78
+ ...transaction,
79
+ object: startParams.object,
80
+ seller: startParams.seller,
81
+ agent: startParams.agent,
82
+ project: startParams.project,
83
+ typeOf: startParams.typeOf
84
+ }
85
+ })(repos);
92
86
  return transaction;
93
87
  };
94
88
  }
@@ -467,7 +461,6 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
467
461
  else {
468
462
  // fromLocationが注文の場合に対応
469
463
  if (fromLocation.typeOf === factory.order.OrderType.Order) {
470
- fromLocation = fromLocation;
471
464
  // 注文検索
472
465
  const orders = await repos.order.projectFields({
473
466
  limit: 1,
@@ -523,7 +516,6 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
523
516
  else {
524
517
  // fromLocationが注文の場合に対応
525
518
  if (toLocation.typeOf === factory.order.OrderType.Order) {
526
- toLocation = toLocation;
527
519
  // 注文検索
528
520
  const orders = await repos.order.projectFields({
529
521
  limit: 1,
@@ -33,7 +33,7 @@ function publishCode(params) {
33
33
  };
34
34
  const issuedBy = { id: params.object.seller.id, typeOf: factory.organizationType.Corporation };
35
35
  let authorizations;
36
- try {
36
+ try { // eslint-disable-line no-useless-catch
37
37
  authorizations = await repos.authorization.issueAuthorization([{
38
38
  project: { id: params.project.id, typeOf: factory.organizationType.Project },
39
39
  object: authorizationObject,
@@ -115,12 +115,11 @@ function confirm(params, options) {
115
115
  author: { id: transaction.agent.id, typeOf: transaction.agent.typeOf }
116
116
  })(repos);
117
117
  }
118
- let acceptedOffers;
119
118
  const {
120
119
  // acceptedOffersFromAuthorizeAction, // discontinue(2024-06-17~)
121
120
  authorizePaymentActions, authorizeEventServiceOfferActions, authorizeMoneyTansferActions, authorizeProductOfferActions, serialNumbers } = dissolveAuthorizeActions(completedAuthorizeActions);
122
121
  // orderInTransactionから検索する(2024-03-04~)
123
- acceptedOffers = (await repos.orderInTransaction.findAcceptedOffersByOrderNumber({ orderNumber: { $eq: orderNumber } }))
122
+ const acceptedOffers = (await repos.orderInTransaction.findAcceptedOffersByOrderNumber({ orderNumber: { $eq: orderNumber } }))
124
123
  .filter(({ serialNumber }) => typeof serialNumber === 'string' && serialNumbers.includes(serialNumber));
125
124
  // authorizePaymentActionsからpayTransactionsを参照(2024-06-20~)
126
125
  let payTransactions = [];
@@ -446,7 +445,6 @@ function searchAuthorizeActions(params) {
446
445
  function createConfirmationNumber(params) {
447
446
  const confirmationNumber = params.transaction.object.confirmationNumber;
448
447
  let url = '';
449
- let identifier = [];
450
448
  // 取引に確認番号が保管されていなければ、確認番号を発行
451
449
  if (typeof confirmationNumber !== 'string') {
452
450
  // 事前に発行済なはずなので、ありえないフロー
@@ -462,7 +460,7 @@ function createConfirmationNumber(params) {
462
460
  url = params.result.order.url(params.order);
463
461
  }
464
462
  // 識別子の指定があれば上書き
465
- identifier = [
463
+ const identifier = [
466
464
  ...(Array.isArray(params.result.order.identifier)) ? params.result.order.identifier : [],
467
465
  // 取引に指定があれば追加
468
466
  ...(Array.isArray(params.transaction.object.identifier)) ? params.transaction.object.identifier : []
@@ -67,8 +67,7 @@ function validateStartRequest(params) {
67
67
  if (typeof clientId !== 'string' || clientId.length === 0) {
68
68
  throw new factory.errors.ArgumentNull('client_id');
69
69
  }
70
- let projectMakesOffer;
71
- projectMakesOffer = (await repos.projectMakesOffer.search({
70
+ const projectMakesOffer = (await repos.projectMakesOffer.search({
72
71
  limit: 1,
73
72
  page: 1,
74
73
  offeredBy: { id: { $eq: params.project.id } },
@@ -32,9 +32,8 @@ const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
32
32
  async function createPotentialActions(params,
33
33
  // settings: Settings
34
34
  setting) {
35
- let returnOrderActions = [];
36
35
  const emailMessages = [];
37
- returnOrderActions = await Promise.all(params.orders.map(async (order) => {
36
+ const returnOrderActions = await Promise.all(params.orders.map(async (order) => {
38
37
  let returnOrderParams = params.potentialActions?.returnOrder;
39
38
  // 互換性維持対応
40
39
  if (!Array.isArray(returnOrderParams)) {
@@ -72,7 +72,7 @@ const TIMEOUT = 5000;
72
72
  */
73
73
  async function getReturnPolicyByProject(params) {
74
74
  // implement with fetch(2024-01-20~)
75
- try {
75
+ try { // eslint-disable-line no-useless-catch
76
76
  const { identifier, sameAs } = params;
77
77
  const res = await fetch(sameAs, {
78
78
  method: 'POST',
package/package.json CHANGED
@@ -15,7 +15,6 @@
15
15
  "@cinerino/sdk": "13.0.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
18
- "@rollup/rollup-linux-x64-gnu": "^4.57.1",
19
18
  "@sendgrid/client": "8.1.4",
20
19
  "@surfrock/sdk": "1.4.0-alpha.1",
21
20
  "debug": "^3.2.7",
@@ -45,30 +44,24 @@
45
44
  "@types/mocha": "10.0.7",
46
45
  "@types/moment-timezone": "^0.5.30",
47
46
  "@types/node": "22.19.7",
48
- "@types/power-assert": "^1.5.3",
49
47
  "@types/pug": "2.0.10",
50
48
  "@types/sinon": "^4.3.3",
51
49
  "@types/sinon-mongoose": "^1.3.11",
52
50
  "@types/uniqid": "^4.1.3",
53
51
  "@types/uuid": "^3.4.10",
54
52
  "@vitest/coverage-v8": "4.0.18",
55
- "coveralls": "^3.1.0",
56
53
  "csvtojson": "^2.0.10",
57
54
  "dependency-cruiser": "17.3.8",
58
55
  "eslint": "9.39.2",
59
56
  "googleapis": "^85.0.0",
60
57
  "jose": "6.0.12",
61
58
  "json2csv": "4.5.4",
62
- "mocha": "10.6.0",
63
59
  "mongoose": "8.0.4",
64
- "nyc": "17.0.0",
65
- "power-assert": "^1.6.1",
66
60
  "redis": "4.6.5",
67
61
  "rimraf": "^2.7.1",
68
62
  "sinon": "4.5.0",
69
63
  "sinon-mongoose": "^2.3.0",
70
64
  "size-limit": "12.0.0",
71
- "ts-node": "^10.9.1",
72
65
  "typescript": "5.6.3",
73
66
  "typescript-eslint": "8.55.0",
74
67
  "vitest": "4.0.18"
@@ -96,21 +89,19 @@
96
89
  "scripts": {
97
90
  "build": "tsc",
98
91
  "build:example": "tsc --watch --project tsconfig.example.json --declaration false",
92
+ "check:all": "npm run clean && npm run build && npm run depcruise && npm run size && npm test",
99
93
  "clean": "rimraf ./lib \"npm-debug.log*\" ./doc ./coverage ./.nyc_output ./example/dst",
100
94
  "depcruise": "depcruise src",
101
95
  "doc": "echo \"implementing...\" && exit 0",
102
96
  "eslint": "eslint \"src/**/*.ts\"",
103
- "mocha": "mocha",
104
- "nyc": "nyc mocha \"src/**/*.spec.ts\"",
105
- "coverage:nyc": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
106
97
  "coverage": "vitest run --coverage",
107
- "test": "npm run eslint && npm run coverage && npm run coverage:nyc",
108
- "preversion": "npm run clean && npm run build && npm run depcruise && npm run size && npm test && npm run doc",
98
+ "test": "npm run eslint && npm run coverage",
99
+ "preversion": "npm run check:all",
109
100
  "size": "size-limit",
110
101
  "version": "git add -A",
111
102
  "vitest": "vitest",
112
103
  "postversion": "git push origin --tags",
113
- "prepublishOnly": "npm run clean && npm run build && npm run depcruise && npm run size && npm test && npm run doc"
104
+ "prepublishOnly": "npm run clean && npm run build"
114
105
  },
115
- "version": "24.0.0-alpha.0"
106
+ "version": "24.0.0-alpha.2"
116
107
  }