@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.
- package/example/src/chevre/deleteDiscontinuedPeople.ts +119 -84
- package/lib/chevre/repo/ownershipInfo.js +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +38 -38
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/payment/any.d.ts +0 -2
- package/lib/chevre/service/payment/any.js +26 -21
- package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -16
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +0 -3
- package/lib/chevre/service/transaction/moneyTransfer.js +28 -27
- package/package.json +1 -1
|
@@ -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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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(
|
|
61
|
+
);
|
|
62
|
+
console.log('docs found');
|
|
41
63
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const userPoolId: string = setting.userPoolIdNew;
|
|
64
|
+
const runsAt: Date = new Date();
|
|
65
|
+
const userPoolId: string = setting.userPoolIdNew;
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
104
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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 = (
|
|
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 ((
|
|
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
|
-
})(
|
|
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 (
|
|
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
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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
|
|
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
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
fromLocation
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
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 = (
|
|
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