@chevre/domain 21.34.0-alpha.2 → 21.34.0-alpha.4

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.
@@ -16,13 +16,10 @@ async function main() {
16
16
  id: project.id
17
17
  },
18
18
  sameAs: {
19
- id: '664db85f9801179aabb046e5'
19
+ id: '666627d5e7fdb1e29d985675'
20
20
  },
21
21
  purpose: {
22
- id: '664db8219801179aabb04624'
23
- },
24
- options: {
25
- minimize: true
22
+ id: '666627c6e7fdb1e29d985646'
26
23
  }
27
24
  })({
28
25
  action: actionRepo,
@@ -44,7 +44,7 @@ async function main() {
44
44
  'actionRecipe already exists. step:',
45
45
  actionRecipe.step.length, payAction.project.id, payAction.id, payAction.startDate, i);
46
46
  } else {
47
- const alterTranResultByPayAction = payAction.result?.creditCardSales?.[0];
47
+ const alterTranResultByPayAction = (<any>payAction.result)?.creditCardSales?.[0];
48
48
  console.log(
49
49
  'creating recipe by alterTranResultByPayAction',
50
50
  alterTranResultByPayAction?.tranId,
@@ -10,12 +10,13 @@ async function main() {
10
10
  const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
11
11
  const cursor = actionRepo.getCursor(
12
12
  {
13
+ // _id: { $eq: '665c886886e0ee8ff5f7b3c5' },
13
14
  typeOf: { $eq: chevre.factory.actionType.PayAction },
14
15
  actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
15
16
  startDate: {
16
17
  $gte: moment()
17
18
  // tslint:disable-next-line:no-magic-numbers
18
- .add(-30, 'days')
19
+ .add(-180, 'days')
19
20
  },
20
21
  'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket }
21
22
  },
@@ -45,7 +46,7 @@ async function main() {
45
46
  actionRecipe.step.length, payAction.project.id, payAction.id, payAction.startDate, i);
46
47
  } else {
47
48
  const seatInfoSyncInByPayAction = payAction.instrument?.seatInfoSyncIn;
48
- const seatInfoSyncResultByPayAction = payAction.result?.seatInfoSyncResult;
49
+ const seatInfoSyncResultByPayAction = (<any>payAction.result)?.seatInfoSyncResult;
49
50
  console.log(
50
51
  'creating recipe by alterTranResultByPayAction',
51
52
  seatInfoSyncInByPayAction?.stCd,
@@ -10,7 +10,17 @@ async function main() {
10
10
 
11
11
  const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
12
12
 
13
- let mkknInfos = await actionRepo.searchMkknInfoByCheckMovieTicketResult({
13
+ // let mkknInfos = await actionRepo.searchMkknInfoByCheckMovieTicketResult({
14
+ // limit: 10,
15
+ // page: 1,
16
+ // id: '666171386c7acb70fd9a44ec',
17
+ // project: { id: project.id },
18
+ // purpose: { id: '6661712a6c7acb70fd9a44a8' }
19
+ // });
20
+ // console.log('mkknInfos found', mkknInfos);
21
+ // console.log(mkknInfos.length, 'infos found');
22
+
23
+ const mkknInfos = await actionRepo.searchMkknInfoByCheckRecipe({
14
24
  limit: 10,
15
25
  page: 1,
16
26
  id: '666171386c7acb70fd9a44ec',
@@ -20,27 +30,17 @@ async function main() {
20
30
  console.log('mkknInfos found', mkknInfos);
21
31
  console.log(mkknInfos.length, 'infos found');
22
32
 
23
- mkknInfos = await actionRepo.searchMkknInfoByCheckRecipe({
24
- limit: 10,
25
- page: 1,
26
- id: '666171386c7acb70fd9a44ec',
27
- project: { id: project.id },
28
- purpose: { id: '6661712a6c7acb70fd9a44a8' }
29
- });
30
- console.log('mkknInfos found', mkknInfos);
31
- console.log(mkknInfos.length, 'infos found');
32
-
33
- let ykknInfos = await actionRepo.searchYkknInfoByCheckMovieTicketResult({
34
- limit: 10,
35
- page: 1,
36
- id: '666171386c7acb70fd9a44ec',
37
- project: { id: project.id },
38
- purpose: { id: '6661712a6c7acb70fd9a44a8' }
39
- });
40
- console.log('ykknInfos found', ykknInfos);
41
- console.log(ykknInfos.length, 'infos found');
42
-
43
- ykknInfos = await actionRepo.searchYkknInfoByCheckRecipe({
33
+ // let ykknInfos = await actionRepo.searchYkknInfoByCheckMovieTicketResult({
34
+ // limit: 10,
35
+ // page: 1,
36
+ // id: '666171386c7acb70fd9a44ec',
37
+ // project: { id: project.id },
38
+ // purpose: { id: '6661712a6c7acb70fd9a44a8' }
39
+ // });
40
+ // console.log('ykknInfos found', ykknInfos);
41
+ // console.log(ykknInfos.length, 'infos found');
42
+
43
+ const ykknInfos = await actionRepo.searchYkknInfoByCheckRecipe({
44
44
  limit: 10,
45
45
  page: 1,
46
46
  id: '666171386c7acb70fd9a44ec',
@@ -69,6 +69,9 @@ export type IRecipeAsDocument = factory.recipe.IRecipe & {
69
69
  dateModified?: Date;
70
70
  };
71
71
  export type IRecipeAsActionAttributes = Pick<factory.recipe.IRecipe, 'project' | 'recipeCategory' | 'step' | 'typeOf'>;
72
+ export type IMinimizedPurchaseNumberAuthResult = Pick<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult, 'mkknmiNumSum' | 'resultInfo' | 'ykknmiNumSum'> & {
73
+ knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
74
+ };
72
75
  /**
73
76
  * アクションリポジトリ
74
77
  */
@@ -236,38 +239,6 @@ export declare class MongoRepository {
236
239
  };
237
240
  entranceGateIdentifier: string;
238
241
  }): Promise<IUseActionCountByOffer[]>;
239
- searchYkknInfoByCheckMovieTicketResult(filter: {
240
- limit: number;
241
- page: number;
242
- /**
243
- * 認証アクションID
244
- */
245
- id: string;
246
- project: {
247
- id: string;
248
- };
249
- purpose: {
250
- id: string;
251
- };
252
- }): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
253
- knyknrNo: string;
254
- })[]>;
255
- searchMkknInfoByCheckMovieTicketResult(filter: {
256
- limit: number;
257
- page: number;
258
- /**
259
- * 認証アクションID
260
- */
261
- id: string;
262
- project: {
263
- id: string;
264
- };
265
- purpose: {
266
- id: string;
267
- };
268
- }): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
269
- knyknrNo: string;
270
- })[]>;
271
242
  searchYkknInfoByCheckRecipe(filter: {
272
243
  limit: number;
273
244
  page: number;
@@ -340,6 +311,14 @@ export declare class MongoRepository {
340
311
  id: string;
341
312
  };
342
313
  }): Promise<Pick<IActionRecipe<T>, 'step' | 'recipeCategory'> | null>;
314
+ findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe(params: {
315
+ project: {
316
+ id: string;
317
+ };
318
+ recipeFor: {
319
+ id: string;
320
+ };
321
+ }): Promise<IMinimizedPurchaseNumberAuthResult | undefined>;
343
322
  aggregateAuthorizeEventServiceOfferAction(params: {
344
323
  project?: {
345
324
  id?: {
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
- const mongoose_1 = require("mongoose");
14
13
  const factory = require("../factory");
15
14
  const settings_1 = require("../settings");
16
15
  const action_1 = require("./mongoose/schemas/action");
@@ -853,78 +852,104 @@ class MongoRepository {
853
852
  .exec();
854
853
  });
855
854
  }
856
- searchYkknInfoByCheckMovieTicketResult(filter) {
857
- return __awaiter(this, void 0, void 0, function* () {
858
- const filterQuery = {
859
- _id: { $eq: new mongoose_1.Types.ObjectId(filter.id) },
860
- 'project.id': { $eq: filter.project.id },
861
- 'purpose.id': { $exists: true, $eq: filter.purpose.id },
862
- typeOf: { $eq: factory.actionType.CheckAction },
863
- actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
864
- };
865
- const projectStage = {
866
- _id: 0,
867
- knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
868
- ykknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknshTyp',
869
- eishhshkTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.eishhshkTyp',
870
- ykknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknKnshbtsmiNum',
871
- knshknhmbiUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.knshknhmbiUnip',
872
- kijUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.kijUnip'
873
- };
874
- const aggregate = this.actionModel.aggregate([
875
- { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
876
- { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo' },
877
- { $match: filterQuery },
878
- { $project: projectStage }
879
- ]);
880
- if (typeof filter.limit === 'number' && filter.limit > 0) {
881
- const page = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
882
- aggregate.limit(filter.limit * page)
883
- .skip(filter.limit * (page - 1));
884
- }
885
- return aggregate
886
- .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
887
- .exec();
888
- });
889
- }
890
- searchMkknInfoByCheckMovieTicketResult(filter) {
891
- return __awaiter(this, void 0, void 0, function* () {
892
- const filterQuery = {
893
- _id: { $eq: new mongoose_1.Types.ObjectId(filter.id) },
894
- 'project.id': { $eq: filter.project.id },
895
- 'purpose.id': { $exists: true, $eq: filter.purpose.id },
896
- typeOf: { $eq: factory.actionType.CheckAction },
897
- actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
898
- };
899
- const projectStage = {
900
- _id: 0,
901
- knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
902
- mkknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknshTyp',
903
- mkknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknKnshbtsmiNum',
904
- mkjyTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkjyTyp',
905
- yykDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.yykDt',
906
- shyJeiDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyJeiDt',
907
- shyStCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyStCd',
908
- shyScrnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyScrnCd',
909
- shySkhnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnCd',
910
- shySkhnNm: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnNm'
911
- };
912
- const aggregate = this.actionModel.aggregate([
913
- { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
914
- { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo' },
915
- { $match: filterQuery },
916
- { $project: projectStage }
917
- ]);
918
- if (typeof filter.limit === 'number' && filter.limit > 0) {
919
- const page = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
920
- aggregate.limit(filter.limit * page)
921
- .skip(filter.limit * (page - 1));
922
- }
923
- return aggregate
924
- .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
925
- .exec();
926
- });
927
- }
855
+ // public async searchYkknInfoByCheckMovieTicketResult(
856
+ // filter: {
857
+ // limit: number;
858
+ // page: number;
859
+ // /**
860
+ // * 認証アクションID
861
+ // */
862
+ // id: string;
863
+ // project: { id: string };
864
+ // purpose: { id: string };
865
+ // }
866
+ // ): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
867
+ // knyknrNo: string;
868
+ // })[]> {
869
+ // const filterQuery: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>> = {
870
+ // _id: { $eq: new Types.ObjectId(filter.id) },
871
+ // 'project.id': { $eq: filter.project.id },
872
+ // 'purpose.id': { $exists: true, $eq: filter.purpose.id },
873
+ // typeOf: { $eq: factory.actionType.CheckAction },
874
+ // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
875
+ // };
876
+ // const projectStage: { [field: string]: AnyExpression } = {
877
+ // _id: 0,
878
+ // knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
879
+ // ykknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknshTyp',
880
+ // eishhshkTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.eishhshkTyp',
881
+ // ykknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.ykknKnshbtsmiNum',
882
+ // knshknhmbiUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.knshknhmbiUnip',
883
+ // kijUnip: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo.kijUnip'
884
+ // };
885
+ // const aggregate = this.actionModel.aggregate<surfrockFactory.service.auth.purchaseNumberAuth.IValidTicket & {
886
+ // knyknrNo: string;
887
+ // }>([
888
+ // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
889
+ // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo' },
890
+ // { $match: filterQuery },
891
+ // { $project: projectStage }
892
+ // ]);
893
+ // if (typeof filter.limit === 'number' && filter.limit > 0) {
894
+ // const page: number = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
895
+ // aggregate.limit(filter.limit * page)
896
+ // .skip(filter.limit * (page - 1));
897
+ // }
898
+ // return aggregate
899
+ // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
900
+ // .exec();
901
+ // }
902
+ // public async searchMkknInfoByCheckMovieTicketResult(
903
+ // filter: {
904
+ // limit: number;
905
+ // page: number;
906
+ // /**
907
+ // * 認証アクションID
908
+ // */
909
+ // id: string;
910
+ // project: { id: string };
911
+ // purpose: { id: string };
912
+ // }
913
+ // ): Promise<(surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
914
+ // knyknrNo: string;
915
+ // })[]> {
916
+ // const filterQuery: FilterQuery<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>> = {
917
+ // _id: { $eq: new Types.ObjectId(filter.id) },
918
+ // 'project.id': { $eq: filter.project.id },
919
+ // 'purpose.id': { $exists: true, $eq: filter.purpose.id },
920
+ // typeOf: { $eq: factory.actionType.CheckAction },
921
+ // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
922
+ // };
923
+ // const projectStage: { [field: string]: AnyExpression } = {
924
+ // _id: 0,
925
+ // knyknrNo: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.knyknrNo',
926
+ // mkknshTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknshTyp',
927
+ // mkknKnshbtsmiNum: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkknKnshbtsmiNum',
928
+ // mkjyTyp: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.mkjyTyp',
929
+ // yykDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.yykDt',
930
+ // shyJeiDt: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyJeiDt',
931
+ // shyStCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyStCd',
932
+ // shyScrnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shyScrnCd',
933
+ // shySkhnCd: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnCd',
934
+ // shySkhnNm: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo.shySkhnNm'
935
+ // };
936
+ // const aggregate = this.actionModel.aggregate<surfrockFactory.service.auth.purchaseNumberAuth.INvalidTicket & {
937
+ // knyknrNo: string;
938
+ // }>([
939
+ // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut' },
940
+ // { $unwind: '$result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo' },
941
+ // { $match: filterQuery },
942
+ // { $project: projectStage }
943
+ // ]);
944
+ // if (typeof filter.limit === 'number' && filter.limit > 0) {
945
+ // const page: number = (typeof filter.page === 'number' && filter.page > 0) ? filter.page : 1;
946
+ // aggregate.limit(filter.limit * page)
947
+ // .skip(filter.limit * (page - 1));
948
+ // }
949
+ // return aggregate
950
+ // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
951
+ // .exec();
952
+ // }
928
953
  searchYkknInfoByCheckRecipe(filter) {
929
954
  return __awaiter(this, void 0, void 0, function* () {
930
955
  const filterQuery = {
@@ -1103,6 +1128,26 @@ class MongoRepository {
1103
1128
  // return result;
1104
1129
  });
1105
1130
  }
1131
+ findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe(params) {
1132
+ var _a, _b, _c;
1133
+ return __awaiter(this, void 0, void 0, function* () {
1134
+ const recipe = yield this.actionRecipeModel.findOne({
1135
+ 'project.id': { $eq: params.project.id },
1136
+ 'recipeFor.id': { $eq: params.recipeFor.id }
1137
+ }, {
1138
+ project: 0,
1139
+ typeOf: 0,
1140
+ recipeCategory: 0,
1141
+ recipeFor: 0,
1142
+ dateCreated: 0,
1143
+ dateModified: 0,
1144
+ 'step.itemListElement.itemListElement.afterMedia.knyknrNoInfoOut.ykknInfo': 0,
1145
+ 'step.itemListElement.itemListElement.afterMedia.knyknrNoInfoOut.mkknInfo': 0
1146
+ }, { lean: true })
1147
+ .exec();
1148
+ return (_c = (_b = (_a = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.afterMedia;
1149
+ });
1150
+ }
1106
1151
  aggregateAuthorizeEventServiceOfferAction(params) {
1107
1152
  return __awaiter(this, void 0, void 0, function* () {
1108
1153
  const statuses = yield Promise.all([
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import * as factory from '../../factory';
5
5
  import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
6
- import type { MongoRepository as ActionRepo } from '../../repo/action';
6
+ import type { IMinimizedPurchaseNumberAuthResult, MongoRepository as ActionRepo } from '../../repo/action';
7
7
  import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
8
8
  import type { AuthorizationRepo } from '../../repo/code';
9
9
  import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
@@ -182,7 +182,7 @@ interface IFindCheckActionResult {
182
182
  message?: string;
183
183
  };
184
184
  result?: {
185
- purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
185
+ purchaseNumberAuthResult: IMinimizedPurchaseNumberAuthResult;
186
186
  };
187
187
  }
188
188
  interface IFindAcceptActionResult {
@@ -239,12 +239,6 @@ declare function findCheckAction(params: {
239
239
  */
240
240
  id: string;
241
241
  };
242
- options: {
243
- /**
244
- * 最小化すると、ykknInfo,mkknInfoを返さない
245
- */
246
- minimize: boolean;
247
- };
248
242
  }): (repos: {
249
243
  action: ActionRepo;
250
244
  task: TaskRepo;
@@ -551,28 +551,11 @@ function findCheckAction(params) {
551
551
  if (((_b = authorizeAction.purpose) === null || _b === void 0 ? void 0 : _b.id) !== params.purpose.id) {
552
552
  throw new factory.errors.NotFound('Action');
553
553
  }
554
- const authorizeActionWithResult = yield repos.action.findById({ id: authorizeAction.id, typeOf: factory.actionType.CheckAction }, [], [
555
- 'agent',
556
- 'purpose',
557
- 'object',
558
- 'startDate',
559
- 'endDate',
560
- 'actionStatus',
561
- 'typeOf',
562
- 'project',
563
- 'sameAs',
564
- '_id',
565
- ...(params.options.minimize === true)
566
- ? [
567
- 'result.purchaseNumberAuthResult.knyknrNoInfoOut.ykknInfo',
568
- 'result.purchaseNumberAuthResult.knyknrNoInfoOut.mkknInfo'
569
- ]
570
- : []
571
- ]);
572
- let purchaseNumberAuthResult;
573
- if ((authorizeActionWithResult === null || authorizeActionWithResult === void 0 ? void 0 : authorizeActionWithResult.result) !== undefined) {
574
- purchaseNumberAuthResult = authorizeActionWithResult.result.purchaseNumberAuthResult;
575
- }
554
+ // result from recipe(2024-06-10~)
555
+ const purchaseNumberAuthResult = yield repos.action.findIMinimizedPurchaseNumberAuthResultByCheckMovieTicketRecipe({
556
+ project: { id: params.project.id },
557
+ recipeFor: { id: authorizeAction.id }
558
+ });
576
559
  action = Object.assign(Object.assign({ id: authorizeAction.id, actionStatus: authorizeAction.actionStatus }, (authorizeAction.error !== undefined)
577
560
  ? {
578
561
  error: (Array.isArray(authorizeAction.error))
@@ -79,7 +79,9 @@ function payCreditCard(params) {
79
79
  }
80
80
  throw error;
81
81
  }
82
- const actionResult = { creditCardSales: alterTranResults };
82
+ const actionResult = {
83
+ // creditCardSales: alterTranResults // discontinue(2024-06-10~)
84
+ };
83
85
  action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
84
86
  yield (0, onPaid_1.onPaid)(action)(repos);
85
87
  return action;
@@ -105,7 +105,7 @@ function refundCreditCard(params, options) {
105
105
  }
106
106
  throw error;
107
107
  }
108
- const actionResult = { alterTranResult };
108
+ const actionResult = {}; // optimize(2024-06-10~)
109
109
  action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
110
110
  yield (0, onRefund_1.onRefund)(action)(repos);
111
111
  return action;
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.checkMovieTicket = void 0;
13
13
  const errorHandler_1 = require("../../../errorHandler");
14
14
  const factory = require("../../../factory");
15
- const settings_1 = require("../../../settings");
16
15
  const factory_1 = require("./factory");
17
16
  const processPurchaseNumberAuth_1 = require("./processPurchaseNumberAuth");
18
17
  /**
@@ -100,7 +99,9 @@ function checkMovieTicket(params) {
100
99
  purchaseNumberAuthIn: processPurchaseNumberAuthResult.purchaseNumberAuthIn,
101
100
  purchaseNumberAuthResult: processPurchaseNumberAuthResult.purchaseNumberAuthResult
102
101
  };
103
- yield repos.action.completeWithVoid(Object.assign({ typeOf: actionAttributes.typeOf, id: action.id, result }, (settings_1.USE_EXPERIMENTAL_FEATURE) ? { recipe } : undefined));
102
+ yield repos.action.completeWithVoid({
103
+ typeOf: actionAttributes.typeOf, id: action.id, result, recipe
104
+ });
104
105
  return { result: processPurchaseNumberAuthResult };
105
106
  });
106
107
  }
@@ -84,11 +84,14 @@ function payMovieTicket(params) {
84
84
  }
85
85
  throw errors;
86
86
  }
87
- const seatInfoSyncResult = processSeatInfoSyncResult.seatInfoSyncResult;
88
- const result = Object.assign({}, (seatInfoSyncResult !== undefined
89
- && seatInfoSyncResult.zskyykResult !== undefined)
90
- ? { seatInfoSyncResult: seatInfoSyncResult }
91
- : undefined);
87
+ // const seatInfoSyncResult = processSeatInfoSyncResult.seatInfoSyncResult;
88
+ const result = {
89
+ // discontinue(2024-06-10~)
90
+ // ...(seatInfoSyncResult !== undefined
91
+ // && (<factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult).zskyykResult !== undefined)
92
+ // ? { seatInfoSyncResult: <factory.action.trade.pay.ISeatInfoSyncResult>seatInfoSyncResult }
93
+ // : undefined
94
+ };
92
95
  action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result, recipe }));
93
96
  yield (0, onPaid_1.onPaid)(action)(repos);
94
97
  return action;
@@ -97,11 +97,15 @@ function refundMovieTicket(params) {
97
97
  else {
98
98
  // add recipe(2024-06-04~)
99
99
  recipe = (0, factory_1.processSeatInfoSyncResult2refundRecipe)(Object.assign(Object.assign({ project: { id: params.project.id } }, (processSeatInfoSyncResult !== undefined) ? { processSeatInfoSyncResult } : undefined), (processSeatInfoSyncCancelResult !== undefined) ? { processSeatInfoSyncCancelResult } : undefined));
100
- const actionResult = Object.assign(Object.assign({}, ((processSeatInfoSyncResult === null || processSeatInfoSyncResult === void 0 ? void 0 : processSeatInfoSyncResult.seatInfoSyncResult) !== undefined)
101
- ? { seatInfoSyncResult: processSeatInfoSyncResult.seatInfoSyncResult }
102
- : undefined), ((processSeatInfoSyncCancelResult === null || processSeatInfoSyncCancelResult === void 0 ? void 0 : processSeatInfoSyncCancelResult.seatInfoSyncCancelResult) !== undefined)
103
- ? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
104
- : undefined);
100
+ const actionResult = {
101
+ // ...(seatInfoSyncIn !== undefined) ? { seatInfoSyncIn } : undefined, // instrumentへ移行(2024-04-30~)
102
+ // ...(processSeatInfoSyncResult?.seatInfoSyncResult !== undefined) // discontinue(2024-06-10~)
103
+ // ? { seatInfoSyncResult: processSeatInfoSyncResult.seatInfoSyncResult }
104
+ // : undefined,
105
+ // ...(processSeatInfoSyncCancelResult?.seatInfoSyncCancelResult !== undefined) // discontinue(2024-06-10~)
106
+ // ? { seatInfoSyncCancelResult: processSeatInfoSyncCancelResult.seatInfoSyncCancelResult }
107
+ // : undefined
108
+ };
105
109
  action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult, recipe }));
106
110
  }
107
111
  yield (0, onRefund_1.onRefund)(action)(repos);
@@ -110,7 +114,7 @@ function refundMovieTicket(params) {
110
114
  exports.refundMovieTicket = refundMovieTicket;
111
115
  function createSeatInfoSyncInOnRefund(params) {
112
116
  return (repos) => __awaiter(this, void 0, void 0, function* () {
113
- var _a;
117
+ var _a, _b, _c, _d;
114
118
  // 本アクションに対応するPayActionを取り出す
115
119
  // 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
116
120
  const payAction = yield repos.action.findPayAction({
@@ -127,9 +131,19 @@ function createSeatInfoSyncInOnRefund(params) {
127
131
  if (payAction === undefined) {
128
132
  throw new factory.errors.NotFound('PayAction');
129
133
  }
130
- const seatInfoSyncInOnPay = (_a = payAction.instrument) === null || _a === void 0 ? void 0 : _a.seatInfoSyncIn;
134
+ const recipe = yield repos.action.findRecipeByAction({
135
+ project: { id: params.project.id },
136
+ recipeFor: { id: payAction.id }
137
+ });
138
+ // const seatInfoSyncInOnPay: surfrock.factory.service.seat.seatInfoSync.ISeatInfoSyncIn | undefined =
139
+ // payAction.instrument?.seatInfoSyncIn;
140
+ let seatInfoSyncInOnPay = (_c = (_b = (_a = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.beforeMedia;
141
+ if (seatInfoSyncInOnPay === undefined && ((_d = payAction.instrument) === null || _d === void 0 ? void 0 : _d.seatInfoSyncIn) !== undefined) {
142
+ seatInfoSyncInOnPay = payAction.instrument.seatInfoSyncIn; // compatibility
143
+ }
131
144
  if (seatInfoSyncInOnPay === undefined) {
132
- throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
145
+ // throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
146
+ throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
133
147
  }
134
148
  let seatInfoSyncIn;
135
149
  // 着券時のseatInfoSyncInに対してtrkshFlgだけ変更してリクエストする
@@ -140,7 +154,7 @@ function createSeatInfoSyncInOnRefund(params) {
140
154
  }
141
155
  function createSeatInfoSyncCancelInOnRefund(params) {
142
156
  return (repos) => __awaiter(this, void 0, void 0, function* () {
143
- var _a;
157
+ var _a, _b, _c, _d;
144
158
  // 本アクションに対応するPayActionを取り出す
145
159
  // 例えばtimeoutが原因でCompletedActionStatusでない場合、外部サービス側では着券済の可能性もあるので、そこを考慮する
146
160
  const payAction = yield repos.action.findPayAction({
@@ -157,9 +171,19 @@ function createSeatInfoSyncCancelInOnRefund(params) {
157
171
  if (payAction === undefined) {
158
172
  throw new factory.errors.NotFound('PayAction');
159
173
  }
160
- const seatInfoSyncInOnPay = (_a = payAction.instrument) === null || _a === void 0 ? void 0 : _a.seatInfoSyncIn;
174
+ const recipe = yield repos.action.findRecipeByAction({
175
+ project: { id: params.project.id },
176
+ recipeFor: { id: payAction.id }
177
+ });
178
+ // const seatInfoSyncInOnPay: surfrock.factory.service.seat.seatInfoSync.ISeatInfoSyncIn | undefined =
179
+ // payAction.instrument?.seatInfoSyncIn;
180
+ let seatInfoSyncInOnPay = (_c = (_b = (_a = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.beforeMedia;
181
+ if (seatInfoSyncInOnPay === undefined && ((_d = payAction.instrument) === null || _d === void 0 ? void 0 : _d.seatInfoSyncIn) !== undefined) {
182
+ seatInfoSyncInOnPay = payAction.instrument.seatInfoSyncIn; // compatibility
183
+ }
161
184
  if (seatInfoSyncInOnPay === undefined) {
162
- throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
185
+ // throw new factory.errors.NotFound('PayAction.instrument?.seatInfoSyncIn');
186
+ throw new factory.errors.NotFound('PayAction.recipe.step.itemListElement.itemListElement.beforeMedia');
163
187
  }
164
188
  let seatInfoSyncCancelIn;
165
189
  seatInfoSyncCancelIn = {
@@ -114,12 +114,11 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
114
114
  exports.validateMovieTicket = validateMovieTicket;
115
115
  function checkByIdentifierIfNotYet(params) {
116
116
  return (repos) => __awaiter(this, void 0, void 0, function* () {
117
- var _a;
117
+ var _a, _b;
118
118
  let checkResult;
119
119
  if (params.useCheckByIdentifierIfNotYet === true) {
120
120
  // すでにCheckActionが存在すれば認証しない(2023-06-06~)
121
- debug('searching alreadyCheckedActions...movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
122
- const alreadyCheckedAction = yield repos.action.search({
121
+ const alreadyCheckedAction = (yield repos.action.search({
123
122
  limit: 1,
124
123
  page: 1,
125
124
  sort: { startDate: factory.sortType.Descending },
@@ -135,9 +134,22 @@ function checkByIdentifierIfNotYet(params) {
135
134
  }
136
135
  }
137
136
  }
138
- }, ['result'], []);
139
- debug('alreadyCheckedAction found', alreadyCheckedAction, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
140
- checkResult = (_a = alreadyCheckedAction.shift()) === null || _a === void 0 ? void 0 : _a.result;
137
+ }, ['_id'], [])).shift();
138
+ if (alreadyCheckedAction !== undefined) {
139
+ const recipe = yield repos.action.findRecipeByAction({
140
+ project: { id: params.screeningEvent.project.id },
141
+ recipeFor: { id: alreadyCheckedAction.id }
142
+ });
143
+ const directionPurchaseNumberAuth = (_b = (_a = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0];
144
+ if (directionPurchaseNumberAuth !== undefined) {
145
+ debug('alreadyCheckedAction.directionPurchaseNumberAuth found', directionPurchaseNumberAuth.typeOf, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
146
+ const { beforeMedia, afterMedia } = directionPurchaseNumberAuth;
147
+ if (beforeMedia !== undefined && afterMedia !== undefined) {
148
+ checkResult = { purchaseNumberAuthIn: beforeMedia, purchaseNumberAuthResult: afterMedia };
149
+ }
150
+ }
151
+ // checkResult = alreadyCheckedAction.shift()?.result;
152
+ }
141
153
  }
142
154
  if (checkResult === undefined) {
143
155
  debug('checkByIdentifier processing because movieTickets not checked yet...', checkResult);
@@ -1,4 +1,4 @@
1
- import type { IOperationExecute } from '../task';
1
+ import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../task';
2
2
  import * as factory from '../../factory';
3
3
  import { MongoRepository as AcceptedOfferRepo } from '../../repo/acceptedOffer';
4
4
  import { MongoRepository as ActionRepo } from '../../repo/action';
@@ -9,11 +9,15 @@ import { MongoRepository as TaskRepo } from '../../repo/task';
9
9
  /**
10
10
  * タスク実行関数
11
11
  */
12
- export declare function call(data: factory.task.IData<factory.taskName.ConfirmReserveTransaction>): IOperationExecute<void>;
12
+ export declare function call(params: Pick<factory.task.ITask<factory.taskName.ConfirmReserveTransaction>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
13
13
  /**
14
14
  * 予約を確定する
15
15
  */
16
- export declare function confirmReserveTransaction(params: factory.task.IData<factory.taskName.ConfirmReserveTransaction>, options: {
16
+ export declare function confirmReserveTransaction(params: factory.task.IData<factory.taskName.ConfirmReserveTransaction> & {
17
+ sameAs?: {
18
+ id: string;
19
+ };
20
+ }, options: {
17
21
  sendOrder: boolean;
18
22
  useOnOrderStatusChanged: boolean;
19
23
  }): (repos: {
@@ -28,9 +28,9 @@ const debug = createDebug('chevre-domain:service:task');
28
28
  /**
29
29
  * タスク実行関数
30
30
  */
31
- function call(data) {
31
+ function call(params) {
32
32
  return (settings) => __awaiter(this, void 0, void 0, function* () {
33
- yield confirmReserveTransaction(data, {
33
+ yield confirmReserveTransaction(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id } }), {
34
34
  sendOrder: true,
35
35
  useOnOrderStatusChanged: true
36
36
  })({
@@ -149,7 +149,10 @@ function confirmReserveTransaction(params, options) {
149
149
  default:
150
150
  confirmActionObject = params.object;
151
151
  }
152
- const confirmActionAttributes = Object.assign(Object.assign({}, params), { object: confirmActionObject });
152
+ const { agent, project, purpose, typeOf, sameAs } = params;
153
+ const confirmActionAttributes = Object.assign({ agent, project, purpose, typeOf, object: confirmActionObject }, (typeof (sameAs === null || sameAs === void 0 ? void 0 : sameAs.id) === 'string') // link confirmReserveAction.sameAs(2024-06-10~)
154
+ ? { sameAs: { id: sameAs.id, typeOf: 'Task' } }
155
+ : undefined);
153
156
  const action = yield repos.action.start(confirmActionAttributes);
154
157
  let updReserveResult;
155
158
  let recipe;
@@ -186,7 +189,7 @@ function confirmReserveTransaction(params, options) {
186
189
  }
187
190
  throw error;
188
191
  }
189
- const result = { updReserveResult };
192
+ const result = Object.assign({}, (!settings_1.USE_EXPERIMENTAL_FEATURE && updReserveResult !== undefined) ? { updReserveResult } : {});
190
193
  yield repos.action.completeWithVoid(Object.assign({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result }, (settings_1.USE_EXPERIMENTAL_FEATURE && recipe !== undefined) ? { recipe } : undefined // add recipe(2024-06-08~)
191
194
  ));
192
195
  // sendOrder連携(2024-01-11~)
@@ -112,6 +112,7 @@ function execute(task) {
112
112
  case factory.taskName.Refund:
113
113
  case factory.taskName.VoidPayTransaction:
114
114
  case factory.taskName.VoidReserveTransaction:
115
+ case factory.taskName.ConfirmReserveTransaction:
115
116
  callResult = yield call(task)(settings, options);
116
117
  break;
117
118
  default:
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.374.0-alpha.10",
13
+ "@chevre/factory": "4.374.0-alpha.12",
14
14
  "@cinerino/sdk": "7.1.0",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.34.0-alpha.2"
113
+ "version": "21.34.0-alpha.4"
114
114
  }