@chevre/domain 24.0.0-alpha.24 → 24.0.0-alpha.25

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.
@@ -1,8 +1,19 @@
1
1
  import * as factory from '../../factory';
2
- import { IActionRecipe, ActionProcessRepo } from './actionProcess';
2
+ import { IKeyOfProjection, IActionRecipe, ActionProcessRepo } from './actionProcess';
3
3
  export type IAcceptPayAction = factory.action.accept.pay.IAction;
4
4
  /**
5
5
  * 決済採用リポジトリ
6
6
  */
7
7
  export declare class AcceptPayActionRepo extends ActionProcessRepo<IAcceptPayAction, IActionRecipe<factory.recipe.RecipeCategory.publishPaymentUrl>> {
8
+ /**
9
+ * 注文取引から検索する
10
+ */
11
+ findAcceptActionsByPurpose(params: {
12
+ project: {
13
+ id: string;
14
+ };
15
+ purpose: {
16
+ id: string;
17
+ };
18
+ }, inclusion: IKeyOfProjection[]): Promise<IAcceptPayAction[]>;
8
19
  }
@@ -1,7 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.AcceptPayActionRepo = void 0;
4
- // import { MONGO_MAX_TIME_MS } from '../settings';
27
+ const factory = __importStar(require("../../factory"));
28
+ const settings_1 = require("../../settings");
5
29
  // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
6
30
  // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
7
31
  const actionProcess_1 = require("./actionProcess");
@@ -9,5 +33,40 @@ const actionProcess_1 = require("./actionProcess");
9
33
  * 決済採用リポジトリ
10
34
  */
11
35
  class AcceptPayActionRepo extends actionProcess_1.ActionProcessRepo {
36
+ /**
37
+ * 注文取引から検索する
38
+ */
39
+ async findAcceptActionsByPurpose(params, inclusion) {
40
+ const andConditions = [
41
+ { typeOf: { $eq: factory.actionType.AcceptAction } },
42
+ { 'project.id': { $eq: params.project.id } },
43
+ { 'object.typeOf': { $exists: true, $eq: factory.assetTransactionType.Pay } },
44
+ { 'purpose.id': { $exists: true, $eq: params.purpose.id } }
45
+ ];
46
+ let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
47
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
48
+ positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
49
+ }
50
+ const projection = {
51
+ _id: 0,
52
+ id: { $toString: '$_id' },
53
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
54
+ };
55
+ const query = this.actionModel.find({ $and: andConditions }, projection);
56
+ // if (typeof params.limit === 'number' && params.limit > 0) {
57
+ // const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
58
+ // query.limit(params.limit)
59
+ // .skip(params.limit * (page - 1));
60
+ // }
61
+ // /* istanbul ignore else */
62
+ // if (params.sort?.startDate !== undefined) {
63
+ // query.sort({ startDate: params.sort.startDate });
64
+ // }
65
+ // const explainResult = await (<any>query).explain();
66
+ // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
67
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
68
+ .lean()
69
+ .exec();
70
+ }
12
71
  }
13
72
  exports.AcceptPayActionRepo = AcceptPayActionRepo;
@@ -0,0 +1,27 @@
1
+ import * as factory from '../../factory';
2
+ import { ActionProcessRepo } from './actionProcess';
3
+ export type IAuthorizePaymentMethodAction = factory.action.authorize.paymentMethod.any.IAction;
4
+ export type IActionRecipe = never;
5
+ /**
6
+ * 決済承認リポジトリ
7
+ */
8
+ export declare class AuthorizePaymentMethodActionRepo extends ActionProcessRepo<IAuthorizePaymentMethodAction, IActionRecipe> {
9
+ /**
10
+ * 取引に対するアクションを検索する
11
+ */
12
+ findAuthorizePaymentMethodActionsByPurpose(params: {
13
+ purpose: {
14
+ typeOf: factory.transactionType;
15
+ id: string;
16
+ };
17
+ object?: {
18
+ paymentMethodId?: {
19
+ $eq?: string;
20
+ };
21
+ };
22
+ actionStatus?: {
23
+ $eq?: factory.actionStatusType.CompletedActionStatus;
24
+ };
25
+ sort?: factory.action.ISortOrder;
26
+ }): Promise<IAuthorizePaymentMethodAction[]>;
27
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.AuthorizePaymentMethodActionRepo = void 0;
27
+ const factory = __importStar(require("../../factory"));
28
+ const settings_1 = require("../../settings");
29
+ // import { createSchema, IModel as IActionModel, modelName } from './mongoose/schemas/action';
30
+ // import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
31
+ const actionProcess_1 = require("./actionProcess");
32
+ /**
33
+ * 決済承認リポジトリ
34
+ */
35
+ class AuthorizePaymentMethodActionRepo extends actionProcess_1.ActionProcessRepo {
36
+ /**
37
+ * 取引に対するアクションを検索する
38
+ */
39
+ async findAuthorizePaymentMethodActionsByPurpose(params) {
40
+ const andConditions = [
41
+ { typeOf: { $eq: factory.actionType.AuthorizeAction } },
42
+ { 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf } },
43
+ { 'purpose.id': { $exists: true, $eq: params.purpose.id } },
44
+ { 'object.typeOf': { $exists: true, $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } }
45
+ ];
46
+ const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
47
+ if (typeof objectPaymentMethodIdEq === 'string') {
48
+ andConditions.push({ 'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq } });
49
+ }
50
+ const actionStatusEq = params.actionStatus?.$eq;
51
+ if (typeof actionStatusEq === 'string') {
52
+ andConditions.push({ actionStatus: { $eq: actionStatusEq } });
53
+ }
54
+ const positiveProjectionFields = [
55
+ 'project',
56
+ 'actionStatus',
57
+ 'typeOf',
58
+ 'description',
59
+ 'agent',
60
+ 'recipient',
61
+ 'result',
62
+ 'error',
63
+ 'object',
64
+ 'startDate',
65
+ 'endDate',
66
+ 'purpose',
67
+ 'potentialActions',
68
+ 'instrument',
69
+ 'location',
70
+ 'sameAs',
71
+ 'cancelAction',
72
+ 'identifier'
73
+ ];
74
+ const projection = {
75
+ _id: 0,
76
+ id: { $toString: '$_id' },
77
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
78
+ };
79
+ const query = this.actionModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
80
+ if (typeof params.sort?.startDate === 'number') {
81
+ query.sort({ startDate: params.sort.startDate });
82
+ }
83
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
84
+ .lean()
85
+ .exec();
86
+ }
87
+ }
88
+ exports.AuthorizePaymentMethodActionRepo = AuthorizePaymentMethodActionRepo;
@@ -16,7 +16,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
16
16
  /**
17
17
  * アクション検索
18
18
  */
19
- search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
19
+ search<T extends StartableActionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
20
20
  findPayAction(params: {
21
21
  project: {
22
22
  id: string;
@@ -12,6 +12,7 @@ import type { AcceptCOAOfferActionRepo } from './repo/action/acceptCOAOffer';
12
12
  import type { AcceptPayActionRepo } from './repo/action/acceptPay';
13
13
  import type { AuthorizeInvoiceActionRepo } from './repo/action/authorizeInvoice';
14
14
  import type { AuthorizeOfferActionRepo } from './repo/action/authorizeOffer';
15
+ import type { AuthorizePaymentMethodActionRepo } from './repo/action/authorizePaymentMethod';
15
16
  import type { CheckMovieTicketActionRepo } from './repo/action/checkMovieTicket';
16
17
  import type { CheckThingActionRepo } from './repo/action/checkThing';
17
18
  import type { AdditionalPropertyRepo } from './repo/additionalProperty';
@@ -147,6 +148,10 @@ export declare namespace action {
147
148
  namespace AuthorizeOffer {
148
149
  function createInstance(...params: ConstructorParameters<typeof AuthorizeOfferActionRepo>): Promise<AuthorizeOfferActionRepo>;
149
150
  }
151
+ type AuthorizePaymentMethodAction = AuthorizePaymentMethodActionRepo;
152
+ namespace AuthorizePaymentMethodAction {
153
+ function createInstance(...params: ConstructorParameters<typeof AuthorizePaymentMethodActionRepo>): Promise<AuthorizePaymentMethodActionRepo>;
154
+ }
150
155
  type CheckMovieTicket = CheckMovieTicketActionRepo;
151
156
  namespace CheckMovieTicket {
152
157
  function createInstance(...params: ConstructorParameters<typeof CheckMovieTicketActionRepo>): Promise<CheckMovieTicketActionRepo>;
@@ -148,6 +148,17 @@ var action;
148
148
  }
149
149
  AuthorizeOffer.createInstance = createInstance;
150
150
  })(AuthorizeOffer = action.AuthorizeOffer || (action.AuthorizeOffer = {}));
151
+ let AuthorizePaymentMethodAction;
152
+ (function (AuthorizePaymentMethodAction) {
153
+ let repo;
154
+ async function createInstance(...params) {
155
+ if (repo === undefined) {
156
+ repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/authorizePaymentMethod')))).AuthorizePaymentMethodActionRepo;
157
+ }
158
+ return new repo(...params);
159
+ }
160
+ AuthorizePaymentMethodAction.createInstance = createInstance;
161
+ })(AuthorizePaymentMethodAction = action.AuthorizePaymentMethodAction || (action.AuthorizePaymentMethodAction = {}));
151
162
  let CheckMovieTicket;
152
163
  (function (CheckMovieTicket) {
153
164
  let repo;
@@ -5,6 +5,7 @@ import type { AccountingReportRepo } from '../../../repo/accountingReport';
5
5
  import type { ActionRepo } from '../../../repo/action';
6
6
  import type { CheckMovieTicketActionRepo } from '../../../repo/action/checkMovieTicket';
7
7
  import type { AuthorizeInvoiceActionRepo } from '../../../repo/action/authorizeInvoice';
8
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
8
9
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
9
10
  import type { AuthorizationRepo } from '../../../repo/authorization';
10
11
  import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
@@ -28,6 +29,7 @@ interface IAuthorizeRepos {
28
29
  action: ActionRepo;
29
30
  checkMovieTicketAction: CheckMovieTicketActionRepo;
30
31
  authorizeInvoiceAction: AuthorizeInvoiceActionRepo;
32
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
31
33
  assetTransaction: AssetTransactionRepo;
32
34
  authorization: AuthorizationRepo;
33
35
  confirmationNumber: ConfirmationNumberRepo;
@@ -112,7 +112,7 @@ function authorize(params) {
112
112
  identifier: uniqueActionIdentifier, // add unique identifier(2025-02-25~)
113
113
  ...(typeof taskId === 'string') ? { sameAs: { id: taskId, typeOf: 'Task' } } : undefined // タスク関連付け(2024-04-22~)
114
114
  };
115
- const action = await repos.action.start(actionAttributes);
115
+ const action = await repos.authorizePaymentMethodAction.start(actionAttributes);
116
116
  let payTransaction;
117
117
  try {
118
118
  const startParams = (0, factory_1.creatPayTransactionStartParams)({
@@ -139,7 +139,7 @@ function authorize(params) {
139
139
  }
140
140
  catch (error) {
141
141
  try {
142
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
142
+ await repos.authorizePaymentMethodAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
143
143
  }
144
144
  catch (__) {
145
145
  // no op
@@ -158,7 +158,14 @@ function authorize(params) {
158
158
  project: actionAttributes.project,
159
159
  id: action.id,
160
160
  purpose: actionAttributes.purpose
161
- })(repos);
161
+ })({
162
+ authorizePaymentMethodAction: repos.authorizePaymentMethodAction,
163
+ accountingReport: repos.accountingReport,
164
+ assetTransaction: repos.assetTransaction,
165
+ task: repos.task,
166
+ placeOrder: repos.placeOrder,
167
+ // transaction: TransactionRepo;
168
+ });
162
169
  }
163
170
  }
164
171
  // 複数対応(決済代行IFの場合、0:ChevreError,1:rawError)(2024-03-27~)
@@ -174,7 +181,7 @@ function authorize(params) {
174
181
  object: authorizeObjectIncludingPaymentMethodDetails,
175
182
  invoiceByTicketToken
176
183
  });
177
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
184
+ await repos.authorizePaymentMethodAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
178
185
  return { id: action.id };
179
186
  };
180
187
  }
@@ -1,5 +1,5 @@
1
1
  import * as factory from '../../../factory';
2
- import type { ActionRepo } from '../../../repo/action';
2
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
3
3
  import type { TaskRepo } from '../../../repo/task';
4
4
  interface IFindAuthorizeActionResult {
5
5
  /**
@@ -18,6 +18,10 @@ interface IFindAuthorizeActionResult {
18
18
  message?: string;
19
19
  };
20
20
  }
21
+ interface IFindAuthorizeActionRepos {
22
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
23
+ task: TaskRepo;
24
+ }
21
25
  declare function findAuthorizeAction(params: {
22
26
  project: {
23
27
  id: string;
@@ -34,8 +38,5 @@ declare function findAuthorizeAction(params: {
34
38
  */
35
39
  id: string;
36
40
  };
37
- }): (repos: {
38
- action: ActionRepo;
39
- task: TaskRepo;
40
- }) => Promise<IFindAuthorizeActionResult>;
41
- export { findAuthorizeAction, };
41
+ }): (repos: IFindAuthorizeActionRepos) => Promise<IFindAuthorizeActionResult>;
42
+ export { IFindAuthorizeActionRepos, findAuthorizeAction, };
@@ -55,7 +55,7 @@ function findAuthorizeAction(params) {
55
55
  break;
56
56
  default:
57
57
  // タスクがReadyでなければアクション検索
58
- const authorizeAction = (await repos.action.searchBySameAs({
58
+ const authorizeAction = (await repos.authorizePaymentMethodAction.searchBySameAs({
59
59
  sameAs: { id: { $eq: task.id } },
60
60
  typeOf: { $eq: factory.actionType.AuthorizeAction }
61
61
  // purpose: { id: { $eq: String(params.purpose.id) } }
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { AccountingReportRepo } from '../../../repo/accountingReport';
3
- import type { ActionRepo } from '../../../repo/action';
3
+ import type { AcceptPayActionRepo } from '../../../repo/action/acceptPay';
4
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
5
  import type { PaymentServiceRepo } from '../../../repo/paymentService';
6
6
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
@@ -9,7 +9,8 @@ import type { TaskRepo } from '../../../repo/task';
9
9
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
10
10
  interface IInvalidatePaymentUrlRepos {
11
11
  accountingReport: AccountingReportRepo;
12
- action: ActionRepo;
12
+ action?: never;
13
+ acceptPayAction: AcceptPayActionRepo;
13
14
  assetTransaction: AssetTransactionRepo;
14
15
  paymentAccepted: SellerPaymentAcceptedRepo;
15
16
  paymentService: PaymentServiceRepo;
@@ -47,15 +47,17 @@ function invalidatePaymentUrl(params) {
47
47
  // }
48
48
  // }
49
49
  // support multiple accept actions(2025-02-25~)
50
- let acceptPayActions = await repos.action.search({
51
- project: { id: { $eq: transaction.project.id } },
52
- typeOf: { $eq: factory.actionType.AcceptAction },
53
- // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }, // all statuses(2025-02-26~)
54
- purpose: { id: { $in: [transaction.id] } },
55
- object: {
56
- // transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
57
- typeOf: { $eq: factory.assetTransactionType.Pay }
58
- }
50
+ let acceptPayActions = await repos.acceptPayAction.findAcceptActionsByPurpose({
51
+ // project: { id: { $eq: transaction.project.id } },
52
+ // typeOf: { $eq: factory.actionType.AcceptAction },
53
+ // // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }, // all statuses(2025-02-26~)
54
+ // purpose: { id: { $in: [transaction.id] } },
55
+ // object: {
56
+ // // transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
57
+ // typeOf: { $eq: factory.assetTransactionType.Pay }
58
+ // }
59
+ project: { id: transaction.project.id },
60
+ purpose: { id: transaction.id },
59
61
  }, ['object']);
60
62
  switch (transaction.status) {
61
63
  case factory.transactionStatusType.InProgress:
@@ -1,11 +1,12 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { AccountingReportRepo } from '../../../repo/accountingReport';
3
- import type { ActionRepo } from '../../../repo/action';
3
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
4
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
5
  import type { TaskRepo } from '../../../repo/task';
6
6
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
7
7
  interface IProcessVoidPayTransactionRepos {
8
- action: ActionRepo;
8
+ action?: never;
9
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
9
10
  accountingReport: AccountingReportRepo;
10
11
  assetTransaction: AssetTransactionRepo;
11
12
  task: TaskRepo;
@@ -48,7 +48,7 @@ function processVoidPayTransaction(params) {
48
48
  // 承認アクションを取得
49
49
  let authorizeActions;
50
50
  if (typeof params.id === 'string') {
51
- const authorizeAction = await repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
51
+ const authorizeAction = await repos.authorizePaymentMethodAction.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
52
52
  // 取引内のアクションかどうか確認
53
53
  if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
54
54
  throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
@@ -56,10 +56,10 @@ function processVoidPayTransaction(params) {
56
56
  authorizeActions = [authorizeAction];
57
57
  }
58
58
  else {
59
- authorizeActions = await repos.action.searchByPurpose({
60
- typeOf: factory.actionType.AuthorizeAction,
59
+ authorizeActions = await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
60
+ // typeOf: factory.actionType.AuthorizeAction,
61
61
  purpose: { typeOf: transaction.typeOf, id: transaction.id },
62
- object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } }
62
+ // object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } }
63
63
  });
64
64
  switch (transaction.status) {
65
65
  case factory.transactionStatusType.InProgress:
@@ -94,7 +94,7 @@ function processVoidPayTransaction(params) {
94
94
  for (const action of authorizeActions) {
95
95
  // 失敗するケースがあっても、残りが少なくとも処理されるようにエラーハンドリング
96
96
  try {
97
- await repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
97
+ await repos.authorizePaymentMethodAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
98
98
  // 取引が存在すれば中止
99
99
  const transactionNumber = action.object.paymentMethodId;
100
100
  if (typeof transactionNumber === 'string' && transactionNumber.length > 0) {
@@ -1,6 +1,7 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { AccountingReportRepo } from '../../../repo/accountingReport';
3
- import type { ActionRepo } from '../../../repo/action';
3
+ import type { AcceptPayActionRepo } from '../../../repo/action/acceptPay';
4
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
4
5
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
5
6
  import type { PaymentServiceRepo } from '../../../repo/paymentService';
6
7
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
@@ -20,7 +21,9 @@ declare function voidPayTransaction(params: factory.task.IData<factory.taskName.
20
21
  };
21
22
  }): (repos: {
22
23
  accountingReport: AccountingReportRepo;
23
- action: ActionRepo;
24
+ action?: never;
25
+ acceptPayAction: AcceptPayActionRepo;
26
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
24
27
  assetTransaction: AssetTransactionRepo;
25
28
  paymentAccepted: SellerPaymentAcceptedRepo;
26
29
  paymentService: PaymentServiceRepo;
@@ -30,6 +30,7 @@ const accountingReport_1 = require("../../repo/accountingReport");
30
30
  const action_1 = require("../../repo/action");
31
31
  const checkMovieTicket_1 = require("../../repo/action/checkMovieTicket");
32
32
  const authorizeInvoice_1 = require("../../repo/action/authorizeInvoice");
33
+ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMethod");
33
34
  const assetTransaction_1 = require("../../repo/assetTransaction");
34
35
  const authorization_1 = require("../../repo/authorization");
35
36
  const confirmationNumber_1 = require("../../repo/confirmationNumber");
@@ -63,7 +64,8 @@ function call(params) {
63
64
  return;
64
65
  }
65
66
  let callResult;
66
- const actionRepo = new action_1.ActionRepo(connection);
67
+ // const actionRepo = new ActionRepo(connection);
68
+ const authorizePaymentMethodActionRepo = new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection);
67
69
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
68
70
  const paymentServiceId = params.data.object.issuedThrough.id;
69
71
  const credentialsExpireInSeconds = settings.movieticketReserve.credentialsExpireInSeconds;
@@ -77,9 +79,10 @@ function call(params) {
77
79
  })({
78
80
  acceptedPaymentMethod: new acceptedPaymentMethod_1.AcceptedPaymentMethodRepo(connection),
79
81
  accountingReport: new accountingReport_1.AccountingReportRepo(connection),
80
- action: actionRepo,
82
+ action: new action_1.ActionRepo(connection),
81
83
  checkMovieTicketAction: new checkMovieTicket_1.CheckMovieTicketActionRepo(connection),
82
84
  authorizeInvoiceAction: new authorizeInvoice_1.AuthorizeInvoiceActionRepo(connection),
85
+ authorizePaymentMethodAction: authorizePaymentMethodActionRepo,
83
86
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
84
87
  authorization: new authorization_1.AuthorizationRepo(connection),
85
88
  confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo({ connection }),
@@ -107,7 +110,7 @@ function call(params) {
107
110
  catch (error) {
108
111
  let throwsError = true;
109
112
  // アクションが存在すればタスクを実行済扱いにする
110
- const action = (await actionRepo.searchBySameAs({
113
+ const action = (await authorizePaymentMethodActionRepo.searchBySameAs({
111
114
  sameAs: { id: { $eq: params.id } },
112
115
  purpose: { id: { $eq: params.data.purpose.id } },
113
116
  typeOf: { $eq: factory.actionType.AuthorizeAction }
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const accountingReport_1 = require("../../repo/accountingReport");
5
- const action_1 = require("../../repo/action");
5
+ // import { ActionRepo } from '../../repo/action';
6
+ const acceptPay_1 = require("../../repo/action/acceptPay");
7
+ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMethod");
6
8
  const assetTransaction_1 = require("../../repo/assetTransaction");
7
9
  const paymentService_1 = require("../../repo/paymentService");
8
10
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
@@ -22,7 +24,9 @@ function call(params) {
22
24
  sameAs: { id: params.id }
23
25
  })({
24
26
  accountingReport: new accountingReport_1.AccountingReportRepo(connection),
25
- action: new action_1.ActionRepo(connection),
27
+ // action: new ActionRepo(connection),
28
+ acceptPayAction: new acceptPay_1.AcceptPayActionRepo(connection),
29
+ authorizePaymentMethodAction: new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection),
26
30
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
27
31
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
28
32
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
package/package.json CHANGED
@@ -99,5 +99,5 @@
99
99
  "postversion": "git push origin --tags",
100
100
  "prepublishOnly": "npm run clean && npm run build"
101
101
  },
102
- "version": "24.0.0-alpha.24"
102
+ "version": "24.0.0-alpha.25"
103
103
  }