@chevre/domain 24.0.0-alpha.33 → 24.0.0-alpha.35

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.
@@ -20,4 +20,13 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
20
20
  id: string;
21
21
  };
22
22
  }, inclusion: IKeyOfProjection[]): Promise<IAcceptCOAOfferAction>;
23
+ findAcceptCOAOfferActionsByPurpose(params: {
24
+ /**
25
+ * 注文取引でフィルター
26
+ */
27
+ purpose: {
28
+ typeOf: factory.transactionType;
29
+ id: string;
30
+ };
31
+ }): Promise<IAcceptCOAOfferAction[]>;
23
32
  }
@@ -58,5 +58,16 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
58
58
  }
59
59
  return doc;
60
60
  }
61
+ async findAcceptCOAOfferActionsByPurpose(params) {
62
+ return this.findAnyActionsByPurpose({
63
+ ...params,
64
+ typeOf: factory.actionType.AcceptAction,
65
+ purpose: {
66
+ typeOf: params.purpose.typeOf,
67
+ id: params.purpose.id
68
+ },
69
+ object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
70
+ });
71
+ }
61
72
  }
62
73
  exports.AcceptCOAOfferActionRepo = AcceptCOAOfferActionRepo;
@@ -56,7 +56,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
56
56
  * アクション取消
57
57
  */
58
58
  cancelWithVoid(params: {
59
- typeOf: factory.actionType.AcceptAction | factory.actionType.AuthorizeAction;
59
+ typeOf: TAction['typeOf'];
60
60
  id: string;
61
61
  cancelAction?: Pick<ICancelActionAction, 'agent' | 'sameAs' | 'startTime'>;
62
62
  }): Promise<void>;
@@ -1,10 +1,40 @@
1
1
  import * as factory from '../../factory';
2
2
  import { ActionProcessRepo } from './actionProcess';
3
- export type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction;
3
+ export type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction;
4
+ export type IAuthorizeProductOfferAction = factory.action.authorize.offer.product.IAction;
5
+ export type IAuthorizeOfferAction = IAuthorizeEventServiceOfferAction | IAuthorizeProductOfferAction;
6
+ export type IAuthorizeOfferActionWithInstrument = Pick<IAuthorizeEventServiceOfferAction | IAuthorizeProductOfferAction, 'instrument'>;
4
7
  /**
5
8
  * オファー承認リポジトリ
6
9
  */
7
10
  export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthorizeOfferAction, never> {
11
+ findAuthorizeOfferInstrumentsByIds(params: {
12
+ /**
13
+ * 注文取引
14
+ */
15
+ purpose: {
16
+ id: string;
17
+ };
18
+ /**
19
+ * アクションIDリスト
20
+ */
21
+ ids: string[];
22
+ }): Promise<IAuthorizeOfferActionWithInstrument[]>;
23
+ findAuthorizeOfferActionsByPurpose(params: {
24
+ /**
25
+ * 注文取引でフィルター
26
+ */
27
+ purpose: {
28
+ typeOf: factory.transactionType;
29
+ id: string;
30
+ };
31
+ /**
32
+ * アクションステータスでフィルター
33
+ */
34
+ actionStatus?: {
35
+ $eq?: factory.actionStatusType.CompletedActionStatus;
36
+ };
37
+ }): Promise<IAuthorizeEventServiceOfferAction[]>;
8
38
  /**
9
39
  * アクション再開
10
40
  */
@@ -26,13 +26,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.AuthorizeOfferActionRepo = void 0;
27
27
  const factory = __importStar(require("../../factory"));
28
28
  // import { MONGO_MAX_TIME_MS } from '../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
29
  const actionProcess_1 = require("./actionProcess");
32
30
  /**
33
31
  * オファー承認リポジトリ
34
32
  */
35
33
  class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
34
+ async findAuthorizeOfferInstrumentsByIds(params) {
35
+ if (!Array.isArray(params.ids)) {
36
+ throw new factory.errors.Argument('ids', 'must be Array');
37
+ }
38
+ return this.findAnyActions({
39
+ typeOf: factory.actionType.AuthorizeAction,
40
+ purpose: {
41
+ typeOf: { $in: [factory.transactionType.PlaceOrder] },
42
+ id: { $in: [params.purpose.id] }
43
+ },
44
+ object: {
45
+ typeOf: {
46
+ $in: [
47
+ factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
48
+ factory.offerType.Offer
49
+ ]
50
+ }
51
+ },
52
+ id: { $in: params.ids }
53
+ }, ['instrument']);
54
+ }
55
+ async findAuthorizeOfferActionsByPurpose(params) {
56
+ return this.findAnyActionsByPurpose({
57
+ ...params,
58
+ typeOf: factory.actionType.AuthorizeAction,
59
+ purpose: {
60
+ typeOf: params.purpose.typeOf,
61
+ id: params.purpose.id
62
+ },
63
+ object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
64
+ });
65
+ }
36
66
  /**
37
67
  * アクション再開
38
68
  */
@@ -33,4 +33,16 @@ export declare class AuthorizePaymentMethodActionRepo extends ActionProcessRepo<
33
33
  };
34
34
  sort?: factory.action.ISortOrder;
35
35
  }): Promise<IAuthorizePaymentMethodAction[]>;
36
+ findAuthorizePaymentMethodResultsById(params: {
37
+ /**
38
+ * 注文取引
39
+ */
40
+ purpose: {
41
+ id: string;
42
+ };
43
+ /**
44
+ * アクションIDリスト
45
+ */
46
+ ids: string[];
47
+ }): Promise<Pick<IAuthorizePaymentMethodAction, 'result'>[]>;
36
48
  }
@@ -46,5 +46,19 @@ class AuthorizePaymentMethodActionRepo extends actionProcess_1.ActionProcessRepo
46
46
  }
47
47
  });
48
48
  }
49
+ async findAuthorizePaymentMethodResultsById(params) {
50
+ if (!Array.isArray(params.ids)) {
51
+ throw new factory.errors.Argument('ids', 'must be Array');
52
+ }
53
+ return this.findAnyActions({
54
+ typeOf: factory.actionType.AuthorizeAction,
55
+ purpose: {
56
+ typeOf: { $in: [factory.transactionType.PlaceOrder] },
57
+ id: { $in: [params.purpose.id] }
58
+ },
59
+ object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } },
60
+ id: { $in: params.ids }
61
+ }, ['result']);
62
+ }
49
63
  }
50
64
  exports.AuthorizePaymentMethodActionRepo = AuthorizePaymentMethodActionRepo;
@@ -0,0 +1,8 @@
1
+ import * as factory from '../../factory';
2
+ import { ActionProcessRepo } from './actionProcess';
3
+ export type IAuthorizeTicketedObjectAction = factory.action.authorize.ticketedObject.IAction;
4
+ /**
5
+ * 決済とオファー以外に対する汎用承認リポジトリ
6
+ */
7
+ export declare class AuthorizeTicketedObjectActionRepo extends ActionProcessRepo<IAuthorizeTicketedObjectAction, never> {
8
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthorizeTicketedObjectActionRepo = void 0;
4
+ // import { MONGO_MAX_TIME_MS } from '../settings';
5
+ const actionProcess_1 = require("./actionProcess");
6
+ /**
7
+ * 決済とオファー以外に対する汎用承認リポジトリ
8
+ */
9
+ class AuthorizeTicketedObjectActionRepo extends actionProcess_1.ActionProcessRepo {
10
+ }
11
+ exports.AuthorizeTicketedObjectActionRepo = AuthorizeTicketedObjectActionRepo;
@@ -1,4 +1,4 @@
1
- import { FilterQuery, UpdateQuery } from 'mongoose';
1
+ import { FilterQuery } from 'mongoose';
2
2
  import * as factory from '../factory';
3
3
  import type { IDocType } from './mongoose/schemas/action';
4
4
  import { IAction, IKeyOfProjection, ActionProcessRepo, ICancelActionAction, IActionRecipe } from './action/actionProcess';
@@ -7,7 +7,7 @@ export { ICancelActionAction };
7
7
  /**
8
8
  * 汎用アクションリポジトリで開始可能なアクションタイプ
9
9
  */
10
- type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction>;
10
+ type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction>;
11
11
  type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds>>;
12
12
  /**
13
13
  * アクションリポジトリ
@@ -16,7 +16,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
16
16
  /**
17
17
  * アクション検索
18
18
  */
19
- search<T extends StartableActionType>(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;
@@ -29,7 +29,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
29
29
  /**
30
30
  * 取引に対するアクションを検索する
31
31
  */
32
- searchByPurpose<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction>(params: {
32
+ searchByPurpose<T extends factory.actionType.AuthorizeAction>(params: {
33
33
  typeOf?: T;
34
34
  purpose: {
35
35
  typeOf: factory.transactionType;
@@ -60,14 +60,6 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
60
60
  id: string;
61
61
  };
62
62
  }): Promise<void>;
63
- updateById(params: {
64
- id: string;
65
- update: any;
66
- }): Promise<void>;
67
- findByIdAndUpdate(params: {
68
- id: string;
69
- update: UpdateQuery<IAction<factory.actionType>>;
70
- }): Promise<void>;
71
63
  /**
72
64
  * イベントと入場ゲート指定で予約使用アクションを集計する
73
65
  * discontinue(2024-12-26~)
@@ -365,20 +365,33 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
365
365
  // }
366
366
  // });
367
367
  // }
368
- async updateById(params) {
369
- await this.actionModel.updateOne({ _id: { $eq: params.id } }, params.update)
370
- .exec();
371
- }
372
- async findByIdAndUpdate(params) {
373
- await this.actionModel.findOneAndUpdate({ _id: { $eq: params.id } }, params.update, { projection: { _id: 1 } })
374
- .lean()
375
- .exec()
376
- .then((doc) => {
377
- if (doc === null) {
378
- throw new factory.errors.NotFound(this.actionModel.modelName);
379
- }
380
- });
381
- }
368
+ // public async updateById(params: {
369
+ // id: string;
370
+ // update: any;
371
+ // }): Promise<void> {
372
+ // await this.actionModel.updateOne(
373
+ // { _id: { $eq: params.id } },
374
+ // params.update
375
+ // )
376
+ // .exec();
377
+ // }
378
+ // public async findByIdAndUpdate(params: {
379
+ // id: string;
380
+ // update: UpdateQuery<IAction<factory.actionType>>;
381
+ // }): Promise<void> {
382
+ // await this.actionModel.findOneAndUpdate(
383
+ // { _id: { $eq: params.id } },
384
+ // params.update,
385
+ // { projection: { _id: 1 } }
386
+ // )
387
+ // .lean<{ _id: ObjectId }>()
388
+ // .exec()
389
+ // .then((doc) => {
390
+ // if (doc === null) {
391
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
392
+ // }
393
+ // });
394
+ // }
382
395
  /**
383
396
  * イベントと入場ゲート指定で予約使用アクションを集計する
384
397
  * discontinue(2024-12-26~)
@@ -14,6 +14,7 @@ import type { AuthorizeInvoiceActionRepo } from './repo/action/authorizeInvoice'
14
14
  import type { AuthorizeOfferActionRepo } from './repo/action/authorizeOffer';
15
15
  import type { AuthorizeProductOfferActionRepo } from './repo/action/authorizeProductOffer';
16
16
  import type { AuthorizePaymentMethodActionRepo } from './repo/action/authorizePaymentMethod';
17
+ import type { AuthorizeTicketedObjectActionRepo } from './repo/action/authorizeTicketedObject';
17
18
  import type { CheckMovieTicketActionRepo } from './repo/action/checkMovieTicket';
18
19
  import type { CheckThingActionRepo } from './repo/action/checkThing';
19
20
  import type { AdditionalPropertyRepo } from './repo/additionalProperty';
@@ -155,6 +156,10 @@ export declare namespace action {
155
156
  namespace AuthorizePaymentMethod {
156
157
  function createInstance(...params: ConstructorParameters<typeof AuthorizePaymentMethodActionRepo>): Promise<AuthorizePaymentMethodActionRepo>;
157
158
  }
159
+ type AuthorizeTicketedObject = AuthorizeTicketedObjectActionRepo;
160
+ namespace AuthorizeTicketedObject {
161
+ function createInstance(...params: ConstructorParameters<typeof AuthorizeTicketedObjectActionRepo>): Promise<AuthorizeTicketedObjectActionRepo>;
162
+ }
158
163
  type CheckMovieTicket = CheckMovieTicketActionRepo;
159
164
  namespace CheckMovieTicket {
160
165
  function createInstance(...params: ConstructorParameters<typeof CheckMovieTicketActionRepo>): Promise<CheckMovieTicketActionRepo>;
@@ -170,6 +170,17 @@ var action;
170
170
  }
171
171
  AuthorizePaymentMethod.createInstance = createInstance;
172
172
  })(AuthorizePaymentMethod = action.AuthorizePaymentMethod || (action.AuthorizePaymentMethod = {}));
173
+ let AuthorizeTicketedObject;
174
+ (function (AuthorizeTicketedObject) {
175
+ let repo;
176
+ async function createInstance(...params) {
177
+ if (repo === undefined) {
178
+ repo = (await Promise.resolve().then(() => __importStar(require('./repo/action/authorizeTicketedObject')))).AuthorizeTicketedObjectActionRepo;
179
+ }
180
+ return new repo(...params);
181
+ }
182
+ AuthorizeTicketedObject.createInstance = createInstance;
183
+ })(AuthorizeTicketedObject = action.AuthorizeTicketedObject || (action.AuthorizeTicketedObject = {}));
173
184
  let CheckMovieTicket;
174
185
  (function (CheckMovieTicket) {
175
186
  let repo;
@@ -1,5 +1,5 @@
1
1
  import * as factory from '../../../factory';
2
- import type { ActionRepo } from '../../../repo/action';
2
+ import type { AuthorizeTicketedObjectActionRepo } from '../../../repo/action/authorizeTicketedObject';
3
3
  import type { AuthorizationRepo } from '../../../repo/authorization';
4
4
  import type { EventRepo } from '../../../repo/event';
5
5
  import type { EventOfferRepo } from '../../../repo/eventOffer';
@@ -9,6 +9,19 @@ import type { MemberProgramRepo } from '../../../repo/memberProgram';
9
9
  import type { ProductOfferRepo } from '../../../repo/productOffer';
10
10
  import type { TicketRepo } from '../../../repo/ticket';
11
11
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
12
+ interface IIssueEventOfferTicketRepos {
13
+ action?: never;
14
+ authorizeTicketedObjectAction: AuthorizeTicketedObjectActionRepo;
15
+ authorization: AuthorizationRepo;
16
+ event: EventRepo;
17
+ eventOffer: EventOfferRepo;
18
+ issuer: IssuerRepo;
19
+ member: MemberRepo;
20
+ memberProgram: MemberProgramRepo;
21
+ productOffer: ProductOfferRepo;
22
+ ticket: TicketRepo;
23
+ placeOrder: PlaceOrderRepo;
24
+ }
12
25
  declare function issueEventOfferTicket(params: {
13
26
  now: Date;
14
27
  audience: Pick<factory.action.authorize.offer.eventService.IPurpose, 'id'>;
@@ -31,18 +44,7 @@ declare function issueEventOfferTicket(params: {
31
44
  */
32
45
  id: string;
33
46
  };
34
- }): (repos: {
35
- action: ActionRepo;
36
- authorization: AuthorizationRepo;
37
- event: EventRepo;
38
- eventOffer: EventOfferRepo;
39
- issuer: IssuerRepo;
40
- member: MemberRepo;
41
- memberProgram: MemberProgramRepo;
42
- productOffer: ProductOfferRepo;
43
- ticket: TicketRepo;
44
- placeOrder: PlaceOrderRepo;
45
- }) => Promise<{
47
+ }): (repos: IIssueEventOfferTicketRepos) => Promise<{
46
48
  ticketToken: string;
47
49
  }>;
48
- export { issueEventOfferTicket };
50
+ export { IIssueEventOfferTicketRepos, issueEventOfferTicket };
@@ -44,7 +44,7 @@ function createOfferTicket(params) {
44
44
  id: instrument.id
45
45
  }
46
46
  };
47
- const action = await repos.action.start(actionAttributes);
47
+ const action = await repos.authorizeTicketedObjectAction.start(actionAttributes);
48
48
  let authorizations;
49
49
  try {
50
50
  authorizations = await repos.authorization.issueAuthorization([{
@@ -59,7 +59,7 @@ function createOfferTicket(params) {
59
59
  }
60
60
  catch (error) {
61
61
  try {
62
- await repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
62
+ await repos.authorizeTicketedObjectAction.giveUp({ typeOf: action.typeOf, id: action.id, error });
63
63
  }
64
64
  catch (__) {
65
65
  // 失敗したら仕方ない
@@ -67,7 +67,7 @@ function createOfferTicket(params) {
67
67
  throw error;
68
68
  }
69
69
  const result = authorizations.map(({ code, typeOf }) => ({ code, typeOf }));
70
- await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
70
+ await repos.authorizeTicketedObjectAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
71
71
  const ticketToken = authorizations.shift()?.code;
72
72
  if (typeof ticketToken !== 'string') {
73
73
  // 基本的にありえないフロー
@@ -13,6 +13,9 @@ import type { StockHolderRepo } from '../../../repo/stockHolder';
13
13
  import type { TaskRepo } from '../../../repo/task';
14
14
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
15
15
  interface IVoidTransactionRepos {
16
+ /**
17
+ * CancelAction開始で使用される
18
+ */
16
19
  action: ActionRepo;
17
20
  acceptCOAOfferAction: AcceptCOAOfferActionRepo;
18
21
  authorizeOfferAction: AuthorizeOfferActionRepo;
@@ -44,4 +47,4 @@ declare function voidTransaction(params: factory.task.IData<factory.taskName.Voi
44
47
  id: string;
45
48
  };
46
49
  }): (repos: IVoidTransactionRepos, settings: Settings) => Promise<void>;
47
- export { voidTransaction };
50
+ export { IVoidTransactionRepos, voidTransaction };
@@ -47,13 +47,13 @@ function voidTransaction(params) {
47
47
  };
48
48
  const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'object']);
49
49
  // 興行オファー承認アクション検索
50
- let authorizeActions = await repos.action.searchByPurpose({
51
- typeOf: factory.actionType.AuthorizeAction,
50
+ let authorizeActions = await repos.authorizeOfferAction.findAuthorizeOfferActionsByPurpose({
51
+ // typeOf: factory.actionType.AuthorizeAction,
52
52
  purpose: {
53
53
  typeOf: params.purpose.typeOf,
54
54
  id: params.purpose.id
55
55
  },
56
- object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
56
+ // object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
57
57
  });
58
58
  switch (transaction.status) {
59
59
  case factory.transactionStatusType.InProgress:
@@ -89,7 +89,7 @@ function voidTransaction(params) {
89
89
  }
90
90
  }
91
91
  await Promise.all(authorizeActions.map(async (action) => {
92
- await repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
92
+ await repos.authorizeOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
93
93
  switch (action.instrument.typeOf) {
94
94
  // case WebAPIIdentifier.COA:
95
95
  case factory.assetTransactionType.COAReserveTransaction:
@@ -129,23 +129,23 @@ function cancelAcceptActions(params) {
129
129
  id: params.purpose.id
130
130
  }, ['typeOf', 'status']);
131
131
  // 興行オファー承認アクション検索
132
- const completedAuthorizeActions = await repos.action.searchByPurpose({
133
- typeOf: factory.actionType.AuthorizeAction,
132
+ const completedAuthorizeActions = await repos.authorizeOfferAction.findAuthorizeOfferActionsByPurpose({
133
+ // typeOf: factory.actionType.AuthorizeAction,
134
134
  purpose: {
135
135
  typeOf: params.purpose.typeOf,
136
136
  id: params.purpose.id
137
137
  },
138
- object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
138
+ // object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
139
139
  actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
140
140
  });
141
141
  // 興行オファー採用アクション検索
142
- let acceptActions = await repos.action.searchByPurpose({
143
- typeOf: factory.actionType.AcceptAction,
142
+ let acceptActions = await repos.acceptCOAOfferAction.findAcceptCOAOfferActionsByPurpose({
143
+ // typeOf: factory.actionType.AcceptAction,
144
144
  purpose: {
145
145
  typeOf: params.purpose.typeOf,
146
146
  id: params.purpose.id
147
147
  },
148
- object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
148
+ // object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
149
149
  });
150
150
  switch (transaction.status) {
151
151
  case factory.transactionStatusType.InProgress:
@@ -173,7 +173,7 @@ function cancelAcceptActions(params) {
173
173
  }
174
174
  const { reserveService } = repos;
175
175
  await Promise.all(acceptActions.map(async (action) => {
176
- await repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
176
+ await repos.acceptCOAOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
177
177
  if (reserveService === undefined) {
178
178
  throw new factory.errors.Internal('repos.reserveService required');
179
179
  }
@@ -1,10 +1,13 @@
1
- import type { ActionRepo } from '../../../repo/action';
1
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
2
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
2
3
  import type { IPlacingOrder, OrderInTransactionRepo } from '../../../repo/orderInTransaction';
3
4
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
4
5
  import * as factory from '../../../factory';
5
6
  type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf' | 'result' | 'object' | 'seller'>;
6
7
  interface ICreatePlacingOrderFromExistingTransactionRepos {
7
- action: ActionRepo;
8
+ action?: never;
9
+ authorizeOfferAction: AuthorizeOfferActionRepo;
10
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
8
11
  orderInTransaction: OrderInTransactionRepo;
9
12
  placeOrder: PlaceOrderRepo;
10
13
  }
@@ -54,31 +54,46 @@ function createPlacingOrderFromExistingTransaction(params) {
54
54
  if (Array.isArray(authorizeActionsAsResult) && authorizeActionsAsResult.length > 0) {
55
55
  const completedAuthorizeActionIds = authorizeActionsAsResult.map(({ id }) => id);
56
56
  if (completedAuthorizeActionIds.length > 0) {
57
- authorizePaymentActions = await repos.action.search({
58
- typeOf: factory.actionType.AuthorizeAction,
59
- purpose: {
60
- typeOf: { $in: [factory.transactionType.PlaceOrder] },
61
- id: { $in: [placeOrderTransactionWithResult.id] }
62
- },
63
- object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } },
64
- id: { $in: completedAuthorizeActionIds }
65
- }, ['result']);
66
- authorizeOfferActionsWithInstrument = await repos.action.search({
67
- typeOf: factory.actionType.AuthorizeAction,
68
- purpose: {
69
- typeOf: { $in: [factory.transactionType.PlaceOrder] },
70
- id: { $in: [placeOrderTransactionWithResult.id] }
71
- },
72
- object: {
73
- typeOf: {
74
- $in: [
75
- factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
76
- factory.offerType.Offer
77
- ]
78
- }
79
- },
80
- id: { $in: completedAuthorizeActionIds }
81
- }, ['instrument']);
57
+ // authorizePaymentActions = <Pick<factory.action.authorize.paymentMethod.any.IAction, 'result'>[]>
58
+ // await repos.action.search<factory.actionType.AuthorizeAction>(
59
+ // {
60
+ // typeOf: factory.actionType.AuthorizeAction,
61
+ // purpose: {
62
+ // typeOf: { $in: [factory.transactionType.PlaceOrder] },
63
+ // id: { $in: [placeOrderTransactionWithResult.id] }
64
+ // },
65
+ // object: { typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment } },
66
+ // id: { $in: completedAuthorizeActionIds }
67
+ // },
68
+ // ['result']
69
+ // );
70
+ authorizePaymentActions = await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodResultsById({
71
+ purpose: { id: placeOrderTransactionWithResult.id },
72
+ ids: completedAuthorizeActionIds
73
+ });
74
+ // authorizeOfferActionsWithInstrument = <IAuthorizeActionWithInstrument[]>await repos.action.search<factory.actionType.AuthorizeAction>(
75
+ // {
76
+ // typeOf: factory.actionType.AuthorizeAction,
77
+ // purpose: {
78
+ // typeOf: { $in: [factory.transactionType.PlaceOrder] },
79
+ // id: { $in: [placeOrderTransactionWithResult.id] }
80
+ // },
81
+ // object: {
82
+ // typeOf: {
83
+ // $in: [
84
+ // factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
85
+ // factory.offerType.Offer
86
+ // ]
87
+ // }
88
+ // },
89
+ // id: { $in: completedAuthorizeActionIds }
90
+ // },
91
+ // ['instrument']
92
+ // );
93
+ authorizeOfferActionsWithInstrument = await repos.authorizeOfferAction.findAuthorizeOfferInstrumentsByIds({
94
+ purpose: { id: placeOrderTransactionWithResult.id },
95
+ ids: completedAuthorizeActionIds
96
+ });
82
97
  }
83
98
  }
84
99
  // orderedItem生成のためにacceptedOffersを取得
@@ -1,6 +1,8 @@
1
1
  import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
2
2
  import type { AccountingReportRepo } from '../../repo/accountingReport';
3
3
  import type { ActionRepo } from '../../repo/action';
4
+ import type { AuthorizeOfferActionRepo } from '../../repo/action/authorizeOffer';
5
+ import type { AuthorizePaymentMethodActionRepo } from '../../repo/action/authorizePaymentMethod';
4
6
  import type { OrderRepo } from '../../repo/order';
5
7
  import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
6
8
  import type { SettingRepo } from '../../repo/setting';
@@ -12,6 +14,8 @@ interface IPlaceOrderRepos {
12
14
  acceptedOffer: AcceptedOfferRepo;
13
15
  accountingReport: AccountingReportRepo;
14
16
  action: ActionRepo;
17
+ authorizeOfferAction: AuthorizeOfferActionRepo;
18
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
15
19
  order: OrderRepo;
16
20
  orderInTransaction: OrderInTransactionRepo;
17
21
  setting: SettingRepo;
@@ -42,7 +42,12 @@ function placeOrder(params) {
42
42
  project: { id: params.project.id },
43
43
  confirmationNumber: params.object.confirmationNumber,
44
44
  orderNumber: params.object.orderNumber
45
- })(repos);
45
+ })({
46
+ authorizeOfferAction: repos.authorizeOfferAction,
47
+ authorizePaymentMethodAction: repos.authorizePaymentMethodAction,
48
+ orderInTransaction: repos.orderInTransaction,
49
+ placeOrder: repos.placeOrder,
50
+ });
46
51
  // USE_ORDER_PAYMENT_DUE_ON_PLACED設定を廃止したので、必ずOrderPaymentDueのはず(2024-01-10~)
47
52
  if (order.orderStatus !== factory.orderStatus.OrderPaymentDue) {
48
53
  throw new factory.errors.Internal(`orderStatus must be ${factory.orderStatus.OrderPaymentDue}`);
@@ -4,6 +4,8 @@ exports.call = call;
4
4
  const acceptedOffer_1 = require("../../repo/acceptedOffer");
5
5
  const accountingReport_1 = require("../../repo/accountingReport");
6
6
  const action_1 = require("../../repo/action");
7
+ const authorizeOffer_1 = require("../../repo/action/authorizeOffer");
8
+ const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMethod");
7
9
  const order_1 = require("../../repo/order");
8
10
  const orderInTransaction_1 = require("../../repo/orderInTransaction");
9
11
  const setting_1 = require("../../repo/setting");
@@ -23,6 +25,8 @@ function call(data) {
23
25
  acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
24
26
  accountingReport: new accountingReport_1.AccountingReportRepo(connection),
25
27
  action: new action_1.ActionRepo(connection),
28
+ authorizeOfferAction: new authorizeOffer_1.AuthorizeOfferActionRepo(connection),
29
+ authorizePaymentMethodAction: new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection),
26
30
  order: new order_1.OrderRepo(connection),
27
31
  orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
28
32
  setting: new setting_1.SettingRepo(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.33"
102
+ "version": "24.0.0-alpha.35"
103
103
  }