@chevre/domain 22.7.0-alpha.15 → 22.7.0-alpha.16

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,4 +1,5 @@
1
1
  // tslint:disable:no-console
2
+ import * as moment from 'moment';
2
3
  import * as mongoose from 'mongoose';
3
4
  import { call as deletePerson } from '../../../lib/chevre/service/task/deletePerson';
4
5
  import { chevre } from '../../../lib/index';
@@ -14,98 +15,132 @@ async function main() {
14
15
  }
15
16
 
16
17
  const DISCONTINUE_PEOPLE_PROJECT = process.env.USE_DISCONTINUE_PEOPLE_PROJECT;
17
-
18
- /**
19
- * 1リクエストで生成するタスク数
20
- */
21
- const NUM_TASKS = 1;
22
-
23
18
  if (typeof DISCONTINUE_PEOPLE_PROJECT === 'string' && DISCONTINUE_PEOPLE_PROJECT.length > 0) {
24
19
  const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
25
- const deletingOwnershipInfos = (await ownershipInfoRepo.projectFields({
26
- limit: NUM_TASKS,
27
- page: 1,
28
- sort: { ownedFrom: chevre.factory.sortType.Ascending },
29
- project: { id: { $eq: DISCONTINUE_PEOPLE_PROJECT } },
30
- typeOfGood: {
31
- // typeOf: { $eq: chevre.factory.permit.PermitType.Permit },
32
- issuedThrough: {
33
- typeOf: {
34
- // $eq: chevre.factory.product.ProductType.PaymentCard
35
- $eq: chevre.factory.product.ProductType.EventService
36
- }
20
+ // const deletingOwnershipInfos = (await ownershipInfoRepo.projectFields({
21
+ // limit: NUM_TASKS,
22
+ // page: 1,
23
+ // sort: { ownedFrom: chevre.factory.sortType.Ascending },
24
+ // project: { id: { $eq: DISCONTINUE_PEOPLE_PROJECT } },
25
+ // ownedBy: {
26
+ // typeOf: { $eq: chevre.factory.personType.Person }
27
+ // },
28
+ // typeOfGood: {
29
+ // issuedThrough: {
30
+ // typeOf: {
31
+ // $eq: chevre.factory.product.ProductType.EventService
32
+ // }
33
+ // }
34
+ // }
35
+ // }));
36
+ // console.log(deletingOwnershipInfos.length, 'deletingOwnershipInfos found');
37
+
38
+ const cursor = ownershipInfoRepo.getCursor(
39
+ {
40
+ // sort: { ownedFrom: chevre.factory.sortType.Ascending },
41
+ 'project.id': { $eq: DISCONTINUE_PEOPLE_PROJECT },
42
+ 'ownedBy.typeOf': {
43
+ $exists: true,
44
+ $eq: chevre.factory.personType.Person
45
+ },
46
+ 'typeOfGood.issuedThrough.typeOf': {
47
+ $exists: true,
48
+ $eq: chevre.factory.product.ProductType.EventService
49
+ },
50
+ ownedFrom: {
51
+ $lte: moment('2024-03-01T00:00:00Z')
52
+ .toDate()
37
53
  }
54
+ },
55
+ {
56
+ _id: 1,
57
+ ownedBy: 1,
58
+ ownedFrom: 1,
59
+ project: 1
38
60
  }
39
- }));
40
- console.log(deletingOwnershipInfos.length, 'deletingOwnershipInfos found');
61
+ );
62
+ console.log('docs found');
41
63
 
42
- if (deletingOwnershipInfos.length > 0) {
43
- const runsAt: Date = new Date();
44
- const userPoolId: string = setting.userPoolIdNew;
64
+ const runsAt: Date = new Date();
65
+ const userPoolId: string = setting.userPoolIdNew;
45
66
 
46
- for (const deletingOwnershipInfo of deletingOwnershipInfos) {
47
- const personId: string = (Array.isArray(deletingOwnershipInfo.ownedBy))
48
- ? deletingOwnershipInfo.ownedBy[0]?.id
49
- : deletingOwnershipInfo.ownedBy.id;
67
+ let i = 0;
68
+ // tslint:disable-next-line:max-func-body-length
69
+ await cursor.eachAsync(async (doc) => {
70
+ i += 1;
50
71
 
51
- console.log(
52
- 'deleting person...',
53
- personId, deletingOwnershipInfo.id, deletingOwnershipInfo.ownedFrom
54
- );
55
- await deletePerson({
56
- id: '',
57
- project: { typeOf: chevre.factory.organizationType.Project, id: DISCONTINUE_PEOPLE_PROJECT },
58
- name: chevre.factory.taskName.DeletePerson,
59
- status: chevre.factory.taskStatus.Ready,
60
- runsAt,
61
- remainingNumberOfTries: 10,
62
- numberOfTried: 0,
63
- data: {
64
- id: personId,
65
- agent: {
66
- id: DISCONTINUE_PEOPLE_PROJECT,
67
- typeOf: chevre.factory.organizationType.Project,
68
- name: 'example'
69
- },
70
- physically: true,
71
- userPoolId,
72
- project: { id: DISCONTINUE_PEOPLE_PROJECT },
73
- migrate: false,
74
- useUsernameAsGMOMemberId: true,
75
- executeBackground: true
76
- }
77
- })(
78
- {
79
- connection: mongoose.connection,
80
- settings: new chevre.settings.Settings({
81
- abortedTasksWithoutReport: [],
82
- numTryConfirmReserveTransaction: 10,
83
- deliverOrderLimit: 1,
84
- coa: {
85
- timeout: 20000
86
- },
87
- gmo: {
88
- timeout: 5000,
89
- timeoutBackground: 5000,
90
- useFetch: true
91
- },
92
- movieticketReserve: {
93
- timeout: 1000,
94
- timeoutCheck: 1000,
95
- minIntervalBetweenPayAndRefund: 1000,
96
- credentialsExpireInSeconds: 1000
97
- },
98
- useExperimentalFeature: false
99
- }),
100
- credentials: <any>{}
72
+ const deletingOwnershipInfo: Pick<
73
+ chevre.factory.ownershipInfo.IOwnershipInfo<any>,
74
+ 'id' | 'ownedBy' | 'ownedFrom' | 'project'
75
+ > = doc.toObject();
76
+ const personId: string = (Array.isArray(deletingOwnershipInfo.ownedBy))
77
+ ? deletingOwnershipInfo.ownedBy[0]?.id
78
+ : deletingOwnershipInfo.ownedBy.id;
79
+ console.log(deletingOwnershipInfo);
80
+
81
+ console.log(
82
+ 'deleting person...',
83
+ personId, deletingOwnershipInfo.project.id, deletingOwnershipInfo.id, deletingOwnershipInfo.ownedFrom, i
84
+ );
85
+ await deletePerson({
86
+ id: '',
87
+ project: { typeOf: chevre.factory.organizationType.Project, id: DISCONTINUE_PEOPLE_PROJECT },
88
+ name: chevre.factory.taskName.DeletePerson,
89
+ status: chevre.factory.taskStatus.Ready,
90
+ runsAt,
91
+ remainingNumberOfTries: 10,
92
+ numberOfTried: 0,
93
+ data: {
94
+ id: personId,
95
+ agent: {
96
+ id: DISCONTINUE_PEOPLE_PROJECT,
97
+ typeOf: chevre.factory.organizationType.Project,
98
+ name: 'example'
101
99
  },
102
- {
103
- executeById: false,
104
- executeByName: true
105
- }
106
- );
107
- }
108
- }
100
+ physically: true,
101
+ userPoolId,
102
+ project: { id: DISCONTINUE_PEOPLE_PROJECT },
103
+ migrate: false,
104
+ useUsernameAsGMOMemberId: true,
105
+ executeBackground: true
106
+ }
107
+ })(
108
+ {
109
+ connection: mongoose.connection,
110
+ settings: new chevre.settings.Settings({
111
+ abortedTasksWithoutReport: [],
112
+ numTryConfirmReserveTransaction: 10,
113
+ deliverOrderLimit: 1,
114
+ coa: {
115
+ timeout: 20000
116
+ },
117
+ gmo: {
118
+ timeout: 5000,
119
+ timeoutBackground: 5000,
120
+ useFetch: true
121
+ },
122
+ movieticketReserve: {
123
+ timeout: 1000,
124
+ timeoutCheck: 1000,
125
+ minIntervalBetweenPayAndRefund: 1000,
126
+ credentialsExpireInSeconds: 1000
127
+ },
128
+ useExperimentalFeature: false
129
+ }),
130
+ credentials: <any>{}
131
+ },
132
+ {
133
+ executeById: false,
134
+ executeByName: true
135
+ }
136
+ );
137
+ console.log(
138
+ 'deleted',
139
+ personId, deletingOwnershipInfo.project.id, deletingOwnershipInfo.id, deletingOwnershipInfo.ownedFrom, i
140
+ );
141
+ });
142
+
143
+ console.log(i, 'docs checked');
109
144
  }
110
145
  }
111
146
 
@@ -427,7 +427,7 @@ class OwnershipInfoRepo {
427
427
  }
428
428
  getCursor(conditions, projection) {
429
429
  return this.ownershipInfoModel.find(conditions, projection)
430
- .sort({ ownedFrom: factory.sortType.Descending })
430
+ .sort({ ownedFrom: factory.sortType.Ascending })
431
431
  .cursor();
432
432
  }
433
433
  /**
@@ -1,7 +1,5 @@
1
1
  import * as factory from '../../../../../factory';
2
- import type { ActionRepo } from '../../../../../repo/action';
3
2
  import type { AuthorizationRepo } from '../../../../../repo/authorization';
4
- import type { JWTSettingRepo } from '../../../../../repo/setting/jwt';
5
3
  import type { TicketRepo } from '../../../../../repo/ticket';
6
4
  /**
7
5
  * チケット化された適用メンバーシップをPermitに変換する
@@ -15,9 +13,7 @@ declare function requestedProgramMembershipUsed2permit(params: {
15
13
  id: string;
16
14
  };
17
15
  }): (repos: {
18
- action: ActionRepo;
19
16
  authorization: AuthorizationRepo;
20
- jwtSetting: JWTSettingRepo;
21
17
  ticket: TicketRepo;
22
18
  }) => Promise<factory.assetTransaction.reserve.IPermitIssuedThroughFaceToFace | factory.assetTransaction.reserve.IPermitIssuedThroughMembershipService | undefined>;
23
19
  export { requestedProgramMembershipUsed2permit };
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.requestedProgramMembershipUsed2permit = void 0;
13
13
  const factory = require("../../../../../factory");
14
- const CodeService = require("../../../../code");
15
14
  /**
16
15
  * チケット化された適用メンバーシップをPermitに変換する
17
16
  */
@@ -22,44 +21,45 @@ function requestedProgramMembershipUsed2permit(params) {
22
21
  // jwt: JWTCredentials;
23
22
  // }
24
23
  ) => __awaiter(this, void 0, void 0, function* () {
25
- var _a, _b, _c, _d;
24
+ var _a, _b;
26
25
  let programMembershipUsedAsPermit;
27
26
  const { programMembershipUsed, placeOrder } = params;
28
- // トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
27
+ // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
29
28
  if (typeof programMembershipUsed === 'string') {
30
- const { authorizedObject } = yield CodeService.verifyToken({
31
- project: { id: params.project.id },
32
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
33
- token: String(programMembershipUsed)
34
- })(repos);
35
- const permitOwnershipInfo = authorizedObject;
36
- if (Array.isArray(permitOwnershipInfo)) {
37
- throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
38
- }
39
- if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
40
- throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
41
- }
42
- const typeOfGood = permitOwnershipInfo.typeOfGood;
43
- if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
44
- throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
45
- }
46
- const issuedThroughTypeOf = (_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf;
47
- if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService) {
48
- throw new factory.errors.Argument('programMembershipUsed', 'must be issued through MembershipService');
49
- }
50
- if (typeof ((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
51
- throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
52
- }
53
- if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
54
- programMembershipUsedAsPermit = {
55
- identifier: typeOfGood.identifier,
56
- issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
57
- typeOf: factory.permit.PermitType.Permit
58
- };
59
- }
60
- else {
61
- throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
62
- }
29
+ throw new factory.errors.NotImplemented('programMembershipUsed as string not implemented');
30
+ // トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
31
+ // const { authorizedObject } = await CodeService.verifyToken({
32
+ // project: { id: params.project.id },
33
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
34
+ // token: String(programMembershipUsed)
35
+ // })(repos);
36
+ // const permitOwnershipInfo = authorizedObject;
37
+ // if (Array.isArray(permitOwnershipInfo)) {
38
+ // throw new factory.errors.NotImplemented('programMembershipUsed as an array not implemented');
39
+ // }
40
+ // if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
41
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
42
+ // }
43
+ // const typeOfGood = permitOwnershipInfo.typeOfGood;
44
+ // if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
45
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be Permit');
46
+ // }
47
+ // const issuedThroughTypeOf = typeOfGood.issuedThrough?.typeOf;
48
+ // if (issuedThroughTypeOf !== factory.product.ProductType.MembershipService) {
49
+ // throw new factory.errors.Argument('programMembershipUsed', 'must be issued through MembershipService');
50
+ // }
51
+ // if (typeof typeOfGood.issuedThrough?.id !== 'string') {
52
+ // throw new factory.errors.NotFound('itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
53
+ // }
54
+ // if (issuedThroughTypeOf === factory.product.ProductType.MembershipService) {
55
+ // programMembershipUsedAsPermit = {
56
+ // identifier: typeOfGood.identifier,
57
+ // issuedThrough: { id: typeOfGood.issuedThrough.id, typeOf: issuedThroughTypeOf },
58
+ // typeOf: factory.permit.PermitType.Permit
59
+ // };
60
+ // } else {
61
+ // throw new factory.errors.Argument('programMembershipUsed', `invalid issuedThrough.typeOf: ${issuedThroughTypeOf}`);
62
+ // }
63
63
  }
64
64
  else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
65
65
  const { ticketToken } = programMembershipUsed;
@@ -101,7 +101,7 @@ function requestedProgramMembershipUsed2permit(params) {
101
101
  if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
102
102
  throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
103
103
  }
104
- const issuedThroughTypeOf = (_c = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.typeOf;
104
+ const issuedThroughTypeOf = (_a = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf;
105
105
  if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
106
106
  programMembershipUsedAsPermit = {
107
107
  identifier: permitOwnershipInfo.typeOfGood.identifier,
@@ -111,7 +111,7 @@ function requestedProgramMembershipUsed2permit(params) {
111
111
  }
112
112
  else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
113
113
  || issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
114
- if (typeof ((_d = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _d === void 0 ? void 0 : _d.id) !== 'string') {
114
+ if (typeof ((_b = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.id) !== 'string') {
115
115
  throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
116
116
  }
117
117
  programMembershipUsedAsPermit = {
@@ -16,7 +16,6 @@ import type { ProductOfferRepo } from '../../../../repo/productOffer';
16
16
  import type { ProjectRepo } from '../../../../repo/project';
17
17
  import type { OfferRateLimitRepo } from '../../../../repo/rateLimit/offer';
18
18
  import type { SettingRepo } from '../../../../repo/setting';
19
- import type { JWTSettingRepo } from '../../../../repo/setting/jwt';
20
19
  import type { StockHolderRepo } from '../../../../repo/stockHolder';
21
20
  import type { TaskRepo } from '../../../../repo/task';
22
21
  import type { TicketRepo } from '../../../../repo/ticket';
@@ -45,7 +44,6 @@ declare function processStartReserve4chevre(params: {
45
44
  stockHolder: StockHolderRepo;
46
45
  event: EventRepo;
47
46
  eventSeries: EventSeriesRepo;
48
- jwtSetting: JWTSettingRepo;
49
47
  offer: OfferRepo;
50
48
  offerCatalog: OfferCatalogRepo;
51
49
  offerCatalogItem: OfferCatalogItemRepo;
@@ -18,7 +18,6 @@ import type { ProductOfferRepo } from '../../../repo/productOffer';
18
18
  import type { ProjectRepo } from '../../../repo/project';
19
19
  import type { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
20
20
  import type { SettingRepo } from '../../../repo/setting';
21
- import type { JWTSettingRepo } from '../../../repo/setting/jwt';
22
21
  import type { StockHolderRepo } from '../../../repo/stockHolder';
23
22
  import type { TaskRepo } from '../../../repo/task';
24
23
  import type { TicketRepo } from '../../../repo/ticket';
@@ -30,7 +29,6 @@ interface IAuthorizeRepos {
30
29
  authorization: AuthorizationRepo;
31
30
  event: EventRepo;
32
31
  eventSeries: EventSeriesRepo;
33
- jwtSetting: JWTSettingRepo;
34
32
  stockHolder: StockHolderRepo;
35
33
  offer: OfferRepo;
36
34
  offerCatalog: OfferCatalogRepo;
@@ -14,7 +14,6 @@ import type { PaymentServiceRepo } from '../../repo/paymentService';
14
14
  import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
15
15
  import type { ProductRepo } from '../../repo/product';
16
16
  import type { SellerPaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
17
- import type { JWTSettingRepo } from '../../repo/setting/jwt';
18
17
  import type { TaskRepo } from '../../repo/task';
19
18
  import type { TicketRepo } from '../../repo/ticket';
20
19
  import type { TransactionRepo } from '../../repo/transaction';
@@ -81,7 +80,6 @@ interface IAuthorizeRepos {
81
80
  confirmationNumber: ConfirmationNumberRepo;
82
81
  credentials: CredentialsRepo;
83
82
  event: EventRepo;
84
- jwtSetting: JWTSettingRepo;
85
83
  paymentAccepted: SellerPaymentAcceptedRepo;
86
84
  paymentService: PaymentServiceRepo;
87
85
  paymentServiceProvider: PaymentServiceProviderRepo;
@@ -15,7 +15,6 @@ exports.publishPaymentUrl = exports.processVoidPayTransaction = exports.person2u
15
15
  */
16
16
  const factory = require("../../factory");
17
17
  const PayTransactionService = require("../assetTransaction/pay");
18
- const code_1 = require("../code");
19
18
  const factory_1 = require("./any/factory");
20
19
  const fixConfirmationNumberAsNeeded_1 = require("./any/fixConfirmationNumberAsNeeded");
21
20
  const handlePrePublishedPaymentMethodIdOnAuthorizing_1 = require("./any/handlePrePublishedPaymentMethodIdOnAuthorizing");
@@ -384,7 +383,7 @@ function authorize(params) {
384
383
  const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(factory_1.createMovieTicket) : undefined;
385
384
  const { accountId } = yield fixAccountIdIfPossible({
386
385
  object: params.object, project: { id: transaction.project.id }
387
- })(repos);
386
+ })();
388
387
  const authorizeObjectIncludingPaymentMethodDetails = Object.assign(Object.assign(Object.assign(Object.assign({}, params.object), { accountId, paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment }), (creditCard !== undefined) ? { creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined);
389
388
  const { authorizeObject } = minimizeObjectIncludingPaymentMethodDetails(authorizeObjectIncludingPaymentMethodDetails);
390
389
  // 承認アクションを開始する
@@ -462,34 +461,40 @@ exports.authorize = authorize;
462
461
  * 承認しようとしているobjectからaccountIdを決定する
463
462
  */
464
463
  function fixAccountIdIfPossible(params) {
465
- return (repos
464
+ return (
465
+ // repos: {
466
+ // action: ActionRepo;
467
+ // authorization: AuthorizationRepo;
468
+ // ticket: TicketRepo;
469
+ // }
466
470
  // credentials: {
467
471
  // jwt: JWTCredentials;
468
472
  // }
469
473
  ) => __awaiter(this, void 0, void 0, function* () {
470
474
  var _a, _b;
471
- // let accountId = params.object?.accountId;
472
475
  let accountId = '';
473
476
  const fromLocation = (_a = params.object) === null || _a === void 0 ? void 0 : _a.fromLocation;
474
477
  const movieTickets = (_b = params.object) === null || _b === void 0 ? void 0 : _b.movieTickets;
475
- // トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
478
+ // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
476
479
  if (typeof fromLocation === 'string') {
477
- const { authorizedObject } = yield (0, code_1.verifyToken)({
478
- project: { id: params.project.id },
479
- agent: { id: params.project.id, typeOf: factory.organizationType.Project },
480
- token: fromLocation
481
- })(repos);
482
- const paymentCardOwnershipInfo = authorizedObject;
483
- if (Array.isArray(paymentCardOwnershipInfo)) {
484
- throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
485
- }
486
- if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
487
- throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
488
- }
489
- if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
490
- throw new factory.errors.Argument('fromLocation', 'must be Permit');
491
- }
492
- accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
480
+ throw new factory.errors.NotImplemented('object.fromLocation as string not implemented');
481
+ // トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
482
+ // const { authorizedObject } = await verifyToken({
483
+ // project: { id: params.project.id },
484
+ // agent: { id: params.project.id, typeOf: factory.organizationType.Project },
485
+ // token: fromLocation
486
+ // })(repos);
487
+ // const paymentCardOwnershipInfo = authorizedObject;
488
+ // if (Array.isArray(paymentCardOwnershipInfo)) {
489
+ // throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
490
+ // }
491
+ // if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
492
+ // throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
493
+ // }
494
+ // if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
495
+ // throw new factory.errors.Argument('fromLocation', 'must be Permit');
496
+ // }
497
+ // accountId = paymentCardOwnershipInfo.typeOfGood.identifier;
493
498
  }
494
499
  // 購入番号管理番号をaccountIdにセット(2024-03-24~)
495
500
  if (Array.isArray(movieTickets) && movieTickets.length > 0) {
@@ -10,29 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.verifyToken4reservation = void 0;
13
- // import type { JWTCredentials } from '../../credentials/jwt';
14
13
  const factory = require("../../factory");
15
- // import { verifyToken } from '../code';
16
14
  /**
17
15
  * 予約使用のためのチケットトークンを検証する
18
16
  */
19
17
  function verifyToken4reservation(params) {
20
- return (repos
21
- // credentials: {
22
- // jwt: JWTCredentials;
23
- // }
24
- ) => __awaiter(this, void 0, void 0, function* () {
25
- // JWTと承認コードの両方に対応する(2024-02-28~)
18
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
26
19
  const { ticketToken } = params.ticket;
27
20
  let payload;
28
- // if (typeof token === 'string' && token.length > 0) {
29
- // const { authorizedObject } = await verifyToken({
30
- // project: params.project,
31
- // agent: params.agent,
32
- // token
33
- // })(repos, credentials);
34
- // payload = authorizedObject;
35
- // } else
36
21
  if (typeof ticketToken === 'string' && ticketToken.length > 0) {
37
22
  const findValidOneByCodeResult = yield repos.authorization.findValidOneByCode({
38
23
  project: { id: params.project.id },
@@ -22,7 +22,6 @@ const paymentService_1 = require("../../repo/paymentService");
22
22
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
23
23
  const product_1 = require("../../repo/product");
24
24
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
25
- const jwt_1 = require("../../repo/setting/jwt");
26
25
  const task_1 = require("../../repo/task");
27
26
  const ticket_1 = require("../../repo/ticket");
28
27
  const transaction_1 = require("../../repo/transaction");
@@ -64,7 +63,6 @@ function call(params) {
64
63
  expireInSeconds: (useCredentialsRepo) ? credentialsExpireInSeconds : 0
65
64
  }),
66
65
  event: new event_1.EventRepo(connection),
67
- jwtSetting: new jwt_1.JWTSettingRepo(connection),
68
66
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
69
67
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
70
68
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
@@ -7,7 +7,6 @@ import type { ProductRepo } from '../../repo/product';
7
7
  import type { ProjectRepo } from '../../repo/project';
8
8
  import type { SellerRepo } from '../../repo/seller';
9
9
  import type { SettingRepo } from '../../repo/setting';
10
- import type { JWTSettingRepo } from '../../repo/setting/jwt';
11
10
  import type { TaskRepo } from '../../repo/task';
12
11
  import type { TicketRepo } from '../../repo/ticket';
13
12
  import type { IStartedTransaction, TransactionRepo } from '../../repo/transaction';
@@ -16,7 +15,6 @@ import { moneyTransfer as MoneyTransferFactory } from '../../factory/transaction
16
15
  export interface IStartOperationRepos {
17
16
  action: ActionRepo;
18
17
  authorization: AuthorizationRepo;
19
- jwtSetting: JWTSettingRepo;
20
18
  order: OrderRepo;
21
19
  passport: PassportRepo;
22
20
  product: ProductRepo;
@@ -46,7 +44,6 @@ export declare function start(params: IStartParams): IStartOperation<IStartedTra
46
44
  export type IAuthorizeOperation<T> = (repos: {
47
45
  action: ActionRepo;
48
46
  authorization: AuthorizationRepo;
49
- jwtSetting: JWTSettingRepo;
50
47
  order: OrderRepo;
51
48
  product: ProductRepo;
52
49
  project: ProjectRepo;
@@ -21,7 +21,6 @@ const factory_1 = require("./moneyTransfer/exportTasks/factory");
21
21
  const factory_2 = require("./moneyTransfer/factory");
22
22
  const potentialActions_1 = require("./moneyTransfer/potentialActions");
23
23
  const MoneyTransferAssetTransactionService = require("../assetTransaction/moneyTransfer");
24
- const CodeService = require("../code");
25
24
  /**
26
25
  * 取引開始
27
26
  * 通貨転送資産取引サービスを利用して転送取引を開始する
@@ -392,33 +391,35 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
392
391
  // jwt: JWTCredentials;
393
392
  // }
394
393
  ) => __awaiter(this, void 0, void 0, function* () {
395
- var _a, _b, _c;
394
+ var _a, _b;
396
395
  let fromLocation = fromLocationBeforeStart;
397
- // トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
396
+ // discontinue token as fromLocation(ticketTokenへ移行するべき)(2024-12-18~)
398
397
  if (typeof fromLocation === 'string') {
399
- const { authorizedObject } = yield CodeService.verifyToken({
400
- project: { id: project.id },
401
- agent: { id: project.id, typeOf: factory.organizationType.Project },
402
- token: fromLocation
403
- })(repos);
404
- const paymentCardOwnershipInfo = authorizedObject;
405
- if (Array.isArray(paymentCardOwnershipInfo)) {
406
- throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
407
- }
408
- if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
409
- throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
410
- }
411
- if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
412
- throw new factory.errors.Argument('fromLocation', 'must be Permit');
413
- }
414
- if (((_a = paymentCardOwnershipInfo.typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) !== factory.product.ProductType.PaymentCard) {
415
- throw new factory.errors.Argument('fromLocation', 'must be issued through PaymentCard');
416
- }
417
- fromLocation = {
418
- typeOf: paymentCardOwnershipInfo.typeOfGood.typeOf,
419
- identifier: paymentCardOwnershipInfo.typeOfGood.identifier,
420
- issuedThrough: { id: paymentCardOwnershipInfo.typeOfGood.issuedThrough.id }
421
- };
398
+ throw new factory.errors.NotImplemented('fromLocation as string not implemented');
399
+ // トークン化されたペイメントカード情報でリクエストされた場合、実ペイメントカード情報へ変換する
400
+ // const { authorizedObject } = await CodeService.verifyToken({
401
+ // project: { id: project.id },
402
+ // agent: { id: project.id, typeOf: factory.organizationType.Project },
403
+ // token: fromLocation
404
+ // })(repos);
405
+ // const paymentCardOwnershipInfo = authorizedObject;
406
+ // if (Array.isArray(paymentCardOwnershipInfo)) {
407
+ // throw new factory.errors.NotImplemented('fromLocation as an array not implemented');
408
+ // }
409
+ // if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
410
+ // throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
411
+ // }
412
+ // if (paymentCardOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
413
+ // throw new factory.errors.Argument('fromLocation', 'must be Permit');
414
+ // }
415
+ // if (paymentCardOwnershipInfo.typeOfGood.issuedThrough?.typeOf !== factory.product.ProductType.PaymentCard) {
416
+ // throw new factory.errors.Argument('fromLocation', 'must be issued through PaymentCard');
417
+ // }
418
+ // fromLocation = {
419
+ // typeOf: paymentCardOwnershipInfo.typeOfGood.typeOf,
420
+ // identifier: paymentCardOwnershipInfo.typeOfGood.identifier,
421
+ // issuedThrough: { id: paymentCardOwnershipInfo.typeOfGood.issuedThrough.id }
422
+ // };
422
423
  }
423
424
  else {
424
425
  // fromLocationが注文の場合に対応
@@ -443,7 +444,7 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
443
444
  throw new factory.errors.Argument('fromLocation', `Invalid order status '${order.orderStatus}''`);
444
445
  }
445
446
  let awardAccounts = [];
446
- const awardAccounsValue = (_c = (_b = order.identifier) === null || _b === void 0 ? void 0 : _b.find((i) => i.name === order_1.AWARD_ACCOUNTS_IDENTIFIER_NAME)) === null || _c === void 0 ? void 0 : _c.value;
447
+ const awardAccounsValue = (_b = (_a = order.identifier) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === order_1.AWARD_ACCOUNTS_IDENTIFIER_NAME)) === null || _b === void 0 ? void 0 : _b.value;
447
448
  if (typeof awardAccounsValue === 'string' && awardAccounsValue.length > 0) {
448
449
  awardAccounts = JSON.parse(awardAccounsValue);
449
450
  }
package/package.json CHANGED
@@ -112,5 +112,5 @@
112
112
  "postversion": "git push origin --tags",
113
113
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
114
114
  },
115
- "version": "22.7.0-alpha.15"
115
+ "version": "22.7.0-alpha.16"
116
116
  }