@chevre/domain 24.0.0-alpha.37 → 24.0.0-alpha.38

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.
@@ -130,7 +130,8 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
130
130
  };
131
131
  object?: {
132
132
  typeOf?: {
133
- $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
133
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.action.authorize.offer.eventService.ObjectType.AggregateOffer | factory.offerType.AggregateOffer;
134
+ $in?: (factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.offer.eventService.ObjectType.AggregateOffer)[];
134
135
  };
135
136
  paymentMethodId?: {
136
137
  $eq?: string;
@@ -723,6 +723,10 @@ class ActionProcessRepo {
723
723
  if (typeof objectTypeOfEq === 'string') {
724
724
  andConditions.push({ 'object.typeOf': { $exists: true, $eq: objectTypeOfEq } });
725
725
  }
726
+ const objectTypeOfIn = params.object?.typeOf?.$in;
727
+ if (Array.isArray(objectTypeOfIn)) {
728
+ andConditions.push({ 'object.typeOf': { $exists: true, $in: objectTypeOfIn } });
729
+ }
726
730
  if (typeof params.typeOf === 'string') {
727
731
  andConditions.push({ typeOf: { $eq: params.typeOf } });
728
732
  }
@@ -20,6 +20,9 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
20
20
  */
21
21
  ids: string[];
22
22
  }): Promise<IAuthorizeOfferActionWithInstrument[]>;
23
+ /**
24
+ * 注文取引から興行オファー承認アクションを参照する
25
+ */
23
26
  findAuthorizeOfferActionsByPurpose(params: {
24
27
  /**
25
28
  * 注文取引でフィルター
@@ -35,6 +38,24 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
35
38
  $eq?: factory.actionStatusType.CompletedActionStatus;
36
39
  };
37
40
  }): Promise<IAuthorizeEventServiceOfferAction[]>;
41
+ /**
42
+ * 注文取引から汎用オファー承認アクションを参照する
43
+ */
44
+ findAuthorizeAnyOfferActionsByPurpose(params: {
45
+ /**
46
+ * 注文取引でフィルター
47
+ */
48
+ purpose: {
49
+ typeOf: factory.transactionType;
50
+ id: string;
51
+ };
52
+ /**
53
+ * アクションステータスでフィルター
54
+ */
55
+ actionStatus?: {
56
+ $eq?: factory.actionStatusType.CompletedActionStatus;
57
+ };
58
+ }): Promise<IAuthorizeOfferAction[]>;
38
59
  /**
39
60
  * アクション再開
40
61
  */
@@ -45,13 +45,16 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
45
45
  typeOf: {
46
46
  $in: [
47
47
  factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
48
- factory.offerType.AggregateOffer
48
+ factory.action.authorize.offer.eventService.ObjectType.AggregateOffer
49
49
  ]
50
50
  }
51
51
  },
52
52
  id: { $in: params.ids }
53
53
  }, ['instrument']);
54
54
  }
55
+ /**
56
+ * 注文取引から興行オファー承認アクションを参照する
57
+ */
55
58
  async findAuthorizeOfferActionsByPurpose(params) {
56
59
  return this.findAnyActionsByPurpose({
57
60
  ...params,
@@ -63,6 +66,27 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
63
66
  object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
64
67
  });
65
68
  }
69
+ /**
70
+ * 注文取引から汎用オファー承認アクションを参照する
71
+ */
72
+ async findAuthorizeAnyOfferActionsByPurpose(params) {
73
+ return this.findAnyActionsByPurpose({
74
+ ...params,
75
+ typeOf: factory.actionType.AuthorizeAction,
76
+ purpose: {
77
+ typeOf: params.purpose.typeOf,
78
+ id: params.purpose.id
79
+ },
80
+ object: {
81
+ typeOf: {
82
+ $in: [
83
+ factory.action.authorize.offer.eventService.ObjectType.SeatReservation,
84
+ factory.action.authorize.offer.eventService.ObjectType.AggregateOffer
85
+ ]
86
+ }
87
+ }
88
+ });
89
+ }
66
90
  /**
67
91
  * アクション再開
68
92
  */
@@ -40,7 +40,7 @@ class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo
40
40
  ...params,
41
41
  typeOf: factory.actionType.AuthorizeAction,
42
42
  object: {
43
- typeOf: { $eq: factory.offerType.AggregateOffer }
43
+ typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.AggregateOffer }
44
44
  }
45
45
  });
46
46
  return authorizeActions.filter((a) =>
@@ -48,7 +48,7 @@ class AuthorizeProductOfferActionRepo extends actionProcess_1.ActionProcessRepo
48
48
  // && a.object.length > 0
49
49
  // // && a.object[0].typeOf === factory.offerType.Offer
50
50
  // && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
51
- a.object.typeOf === factory.offerType.AggregateOffer
51
+ a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
52
52
  && availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0);
53
53
  }
54
54
  }
@@ -37,7 +37,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
37
37
  };
38
38
  object?: {
39
39
  typeOf?: {
40
- $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.offerType.AggregateOffer;
40
+ $eq?: factory.action.authorize.offer.eventService.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment | factory.action.authorize.offer.product.ObjectType.AggregateOffer;
41
41
  };
42
42
  paymentMethodId?: {
43
43
  $eq?: string;
@@ -80,7 +80,7 @@ function createRegisterServiceStartParams(params) {
80
80
  function createActionAttributes(params) {
81
81
  const transaction = params.transaction;
82
82
  const actionObject = {
83
- typeOf: factory.offerType.AggregateOffer,
83
+ typeOf: factory.action.authorize.offer.product.ObjectType.AggregateOffer,
84
84
  itemOffered: {
85
85
  id: params.acceptedOffer[0].itemOffered.id,
86
86
  typeOf: params.acceptedOffer[0].itemOffered.typeOf
@@ -250,7 +250,7 @@ function voidTransaction(params) {
250
250
  // && a.object.length > 0
251
251
  // && a.object[0].typeOf === factory.offerType.Offer
252
252
  // && availableProductTypes.indexOf(a.object[0].itemOffered.typeOf) >= 0
253
- a.object.typeOf === factory.offerType.AggregateOffer
253
+ a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
254
254
  && availableProductTypes_1.availableProductTypes.indexOf(a.object.itemOffered.typeOf) >= 0));
255
255
  }
256
256
  await Promise.all(authorizeActions.map(async (action) => {
@@ -1,4 +1,6 @@
1
1
  import type { ActionRepo } from '../../../repo/action';
2
+ import type { AuthorizePaymentMethodActionRepo } from '../../../repo/action/authorizePaymentMethod';
3
+ import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
2
4
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
3
5
  import type { AuthorizationRepo } from '../../../repo/authorization';
4
6
  import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
@@ -13,6 +15,8 @@ import * as factory from '../../../factory';
13
15
  import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
14
16
  interface IConfirmOperationRepos {
15
17
  action: ActionRepo;
18
+ authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
19
+ authorizeOfferAction: AuthorizeOfferActionRepo;
16
20
  assetTransaction: AssetTransactionRepo;
17
21
  authorization: AuthorizationRepo;
18
22
  emailMessage?: EmailMessageRepo;
@@ -57,4 +61,4 @@ interface IConfirmResult {
57
61
  * 注文取引を確定する
58
62
  */
59
63
  declare function confirm(params: IConfirmParams, options: IConfirmOptions): IConfirmOperation<IConfirmResult>;
60
- export { confirm };
64
+ export { IConfirmOperationRepos, confirm };
@@ -263,7 +263,7 @@ function dissolveAuthorizeActions(completedAuthorizeActions) {
263
263
  }
264
264
  serialNumber = assetTransactionNumber;
265
265
  }
266
- else if (a.object.typeOf === factory.offerType.AggregateOffer
266
+ else if (a.object.typeOf === factory.action.authorize.offer.product.ObjectType.AggregateOffer
267
267
  && a.instrument?.typeOf === factory.assetTransactionType.RegisterService) {
268
268
  authorizeProductOfferActions.push(a);
269
269
  serialNumber = a.instrument.transactionNumber;
@@ -420,15 +420,33 @@ function searchAcceptPayActions(params) {
420
420
  function searchAuthorizeActions(params) {
421
421
  return async (repos) => {
422
422
  // 取引に対する全ての承認アクションをマージ
423
- let authorizeActions = await repos.action.searchByPurpose({
424
- typeOf: factory.actionType.AuthorizeAction,
425
- purpose: {
426
- typeOf: factory.transactionType.PlaceOrder,
427
- id: params.id
428
- },
429
- // Completedに絞る(2023-05-16~)
430
- actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
431
- });
423
+ // let authorizeActions = <IAuthorizeOfferOrPaymentAction[]>await repos.action.searchByPurpose({
424
+ // typeOf: factory.actionType.AuthorizeAction,
425
+ // purpose: {
426
+ // typeOf: factory.transactionType.PlaceOrder,
427
+ // id: params.id
428
+ // },
429
+ // // Completedに絞る(2023-05-16~)
430
+ // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
431
+ // });
432
+ let authorizeActions = [
433
+ ...await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
434
+ purpose: {
435
+ typeOf: factory.transactionType.PlaceOrder,
436
+ id: params.id
437
+ },
438
+ // Completedに絞る(2023-05-16~)
439
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
440
+ }),
441
+ ...await repos.authorizeOfferAction.findAuthorizeAnyOfferActionsByPurpose({
442
+ purpose: {
443
+ typeOf: factory.transactionType.PlaceOrder,
444
+ id: params.id
445
+ },
446
+ // Completedに絞る(2023-05-16~)
447
+ actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
448
+ }),
449
+ ];
432
450
  // 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
433
451
  authorizeActions = authorizeActions.filter((a) => {
434
452
  return (a.endDate instanceof Date) && (0, moment_1.default)(a.endDate)
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "6.0.0-alpha.1",
14
+ "@chevre/factory": "6.0.0-alpha.2",
15
15
  "@cinerino/sdk": "13.2.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -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.37"
102
+ "version": "24.0.0-alpha.38"
103
103
  }