@chevre/domain 21.30.0-alpha.26 → 21.30.0-alpha.28
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/{findValidObjectByAuthorizationCode.ts → findValidAuthorization.ts} +11 -4
- package/example/src/chevre/transaction/processPlaceOrder.ts +1 -0
- package/lib/chevre/credentials.d.ts +8 -0
- package/lib/chevre/credentials.js +14 -1
- package/lib/chevre/repo/code.d.ts +12 -3
- package/lib/chevre/repo/code.js +26 -6
- package/lib/chevre/repository.d.ts +3 -3
- package/lib/chevre/repository.js +1 -1
- package/lib/chevre/service/code.d.ts +19 -5
- package/lib/chevre/service/code.js +22 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/processStartReserve4chevre.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +2 -0
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/reserve/findByCode.d.ts +1 -1
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +1 -1
- package/lib/chevre/service/reserve/verifyToken4reservation.js +1 -1
- package/lib/chevre/service/task/authorizePayment.js +2 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +3 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +4 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/confirm.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.d.ts +2 -2
- package/package.json +1 -1
package/example/src/chevre/{findValidObjectByAuthorizationCode.ts → findValidAuthorization.ts}
RENAMED
|
@@ -5,24 +5,31 @@ import { chevre } from '../../../lib/index';
|
|
|
5
5
|
|
|
6
6
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
const CODE = '33357ca4-55cb-4b36-8d82-af8e445c53c7';
|
|
8
|
+
// const ID = '6631d754c20be0772c217b90';
|
|
8
9
|
|
|
9
10
|
async function main() {
|
|
10
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const authorizationRepo = await chevre.repository.Code.createInstance(mongoose.connection);
|
|
13
14
|
|
|
14
|
-
const result = await
|
|
15
|
+
const result = await authorizationRepo.findValidOneByCode({
|
|
15
16
|
project,
|
|
16
17
|
code: CODE
|
|
17
18
|
});
|
|
18
19
|
console.log('result:', result);
|
|
19
20
|
|
|
21
|
+
// const result = await authorizationRepo.findValidOneById({
|
|
22
|
+
// project,
|
|
23
|
+
// id: ID
|
|
24
|
+
// });
|
|
25
|
+
// console.log('result:', result);
|
|
26
|
+
|
|
20
27
|
const token = await (await chevre.service.code.createService()).getToken({
|
|
21
28
|
project,
|
|
22
29
|
code: CODE,
|
|
23
|
-
expiresIn:
|
|
30
|
+
expiresIn: 18000
|
|
24
31
|
})({
|
|
25
|
-
authorization:
|
|
32
|
+
authorization: authorizationRepo
|
|
26
33
|
});
|
|
27
34
|
console.log('token:', token);
|
|
28
35
|
}
|
|
@@ -122,6 +122,7 @@ async function main() {
|
|
|
122
122
|
accountingReport: await chevre.repository.AccountingReport.createInstance(mongoose.connection),
|
|
123
123
|
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
124
124
|
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
125
|
+
authorization: await chevre.repository.Code.createInstance(mongoose.connection),
|
|
125
126
|
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
126
127
|
paymentAccepted: await chevre.repository.SellerPaymentAccepted.createInstance(mongoose.connection),
|
|
127
128
|
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
@@ -54,6 +54,19 @@ exports.credentials = {
|
|
|
54
54
|
},
|
|
55
55
|
jwt: {
|
|
56
56
|
secret: process.env.TOKEN_SECRET,
|
|
57
|
-
|
|
57
|
+
// RESOURCE_SERVER_IDENTIFIERとは分離して指定可能に拡張(2024-05-02~)
|
|
58
|
+
/**
|
|
59
|
+
* トークン発行時の発行者
|
|
60
|
+
*/
|
|
61
|
+
issuer: (typeof process.env.TOKEN_ISSUER_BY_AUTHORIZATION === 'string')
|
|
62
|
+
? process.env.TOKEN_ISSUER_BY_AUTHORIZATION
|
|
63
|
+
: process.env.RESOURCE_SERVER_IDENTIFIER,
|
|
64
|
+
/**
|
|
65
|
+
* トークン検証時の発行者リスト
|
|
66
|
+
*/
|
|
67
|
+
issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
68
|
+
? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
69
|
+
: [],
|
|
70
|
+
version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02' // 追加(2024-05-02~)
|
|
58
71
|
}
|
|
59
72
|
};
|
|
@@ -6,9 +6,9 @@ type IFindValidOneResult = Pick<factory.authorization.IAuthorization, 'object' |
|
|
|
6
6
|
id: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 承認リポジトリ
|
|
10
10
|
*/
|
|
11
|
-
export declare class
|
|
11
|
+
export declare class AuthorizationRepo {
|
|
12
12
|
private readonly authorizationModel;
|
|
13
13
|
constructor(connection: Connection);
|
|
14
14
|
static CREATE_MONGO_CONDITIONS(params: factory.authorization.ISearchConditions): FilterQuery<factory.authorization.IAuthorization>[];
|
|
@@ -25,7 +25,7 @@ export declare class MongoRepository {
|
|
|
25
25
|
expiresInSeconds: number;
|
|
26
26
|
}[]): Promise<factory.authorization.IAuthorization[]>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* コードで有効な承認を参照する
|
|
29
29
|
*/
|
|
30
30
|
findValidOneByCode(params: {
|
|
31
31
|
project: {
|
|
@@ -33,6 +33,15 @@ export declare class MongoRepository {
|
|
|
33
33
|
};
|
|
34
34
|
code: ICode;
|
|
35
35
|
}): Promise<IFindValidOneResult>;
|
|
36
|
+
/**
|
|
37
|
+
* 有効な承認を参照する
|
|
38
|
+
*/
|
|
39
|
+
findValidOneById(params: {
|
|
40
|
+
project: {
|
|
41
|
+
id: string;
|
|
42
|
+
};
|
|
43
|
+
id: string;
|
|
44
|
+
}): Promise<Pick<IFindValidOneResult, 'object'>>;
|
|
36
45
|
search(params: factory.authorization.ISearchConditions): Promise<factory.authorization.IAuthorization[]>;
|
|
37
46
|
/**
|
|
38
47
|
* 有効期限を一定期間過ぎた承認を削除する
|
package/lib/chevre/repo/code.js
CHANGED
|
@@ -9,16 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.AuthorizationRepo = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const uuid = require("uuid");
|
|
15
15
|
const factory = require("../factory");
|
|
16
16
|
const authorization_1 = require("./mongoose/schemas/authorization");
|
|
17
17
|
const settings_1 = require("../settings");
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 承認リポジトリ
|
|
20
20
|
*/
|
|
21
|
-
class
|
|
21
|
+
class AuthorizationRepo {
|
|
22
22
|
constructor(connection) {
|
|
23
23
|
this.authorizationModel = connection.model(authorization_1.modelName, (0, authorization_1.createSchema)());
|
|
24
24
|
}
|
|
@@ -109,7 +109,7 @@ class MongoRepository {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* コードで有効な承認を参照する
|
|
113
113
|
*/
|
|
114
114
|
findValidOneByCode(params) {
|
|
115
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -130,10 +130,30 @@ class MongoRepository {
|
|
|
130
130
|
return { id, object, typeOf };
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* 有効な承認を参照する
|
|
135
|
+
*/
|
|
136
|
+
findValidOneById(params) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const now = new Date();
|
|
139
|
+
const doc = yield this.authorizationModel.findOne({
|
|
140
|
+
'project.id': { $eq: params.project.id },
|
|
141
|
+
_id: { $eq: String(params.id) },
|
|
142
|
+
validFrom: { $lte: now },
|
|
143
|
+
validUntil: { $gte: now }
|
|
144
|
+
}, { object: 1, _id: 0 })
|
|
145
|
+
.lean() // projection的にleanで十分
|
|
146
|
+
.exec();
|
|
147
|
+
if (doc === null) {
|
|
148
|
+
throw new factory.errors.NotFound(this.authorizationModel.modelName);
|
|
149
|
+
}
|
|
150
|
+
return doc;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
133
153
|
search(params) {
|
|
134
154
|
var _a;
|
|
135
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
const conditions =
|
|
156
|
+
const conditions = AuthorizationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
137
157
|
const query = this.authorizationModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
138
158
|
__v: 0,
|
|
139
159
|
createdAt: 0,
|
|
@@ -193,4 +213,4 @@ class MongoRepository {
|
|
|
193
213
|
});
|
|
194
214
|
}
|
|
195
215
|
}
|
|
196
|
-
exports.
|
|
216
|
+
exports.AuthorizationRepo = AuthorizationRepo;
|
|
@@ -13,7 +13,7 @@ import type { MongoRepository as AggregateReservationRepo } from './repo/aggrega
|
|
|
13
13
|
import type { MongoRepository as AggregationRepo } from './repo/aggregation';
|
|
14
14
|
import type { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
|
|
15
15
|
import type { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
|
|
16
|
-
import type {
|
|
16
|
+
import type { AuthorizationRepo } from './repo/code';
|
|
17
17
|
import type { MongoRepository as CommentRepo } from './repo/comment';
|
|
18
18
|
import type { MongoRepository as CreativeWorkRepo } from './repo/creativeWork';
|
|
19
19
|
import type { MongoRepository as CustomerRepo } from './repo/customer';
|
|
@@ -112,9 +112,9 @@ export type CategoryCode = CategoryCodeRepo;
|
|
|
112
112
|
export declare namespace CategoryCode {
|
|
113
113
|
function createInstance(...params: ConstructorParameters<typeof CategoryCodeRepo>): Promise<CategoryCodeRepo>;
|
|
114
114
|
}
|
|
115
|
-
export type Code =
|
|
115
|
+
export type Code = AuthorizationRepo;
|
|
116
116
|
export declare namespace Code {
|
|
117
|
-
function createInstance(...params: ConstructorParameters<typeof
|
|
117
|
+
function createInstance(...params: ConstructorParameters<typeof AuthorizationRepo>): Promise<AuthorizationRepo>;
|
|
118
118
|
}
|
|
119
119
|
export type Comment = CommentRepo;
|
|
120
120
|
export declare namespace Comment {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -173,7 +173,7 @@ var Code;
|
|
|
173
173
|
function createInstance(...params) {
|
|
174
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
175
175
|
if (repo === undefined) {
|
|
176
|
-
repo = (yield Promise.resolve().then(() => require('./repo/code'))).
|
|
176
|
+
repo = (yield Promise.resolve().then(() => require('./repo/code'))).AuthorizationRepo;
|
|
177
177
|
}
|
|
178
178
|
return new repo(...params);
|
|
179
179
|
});
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import type { MongoRepository as ActionRepo } from '../repo/action';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizationRepo } from '../repo/code';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type IToken = string;
|
|
5
|
+
type ICode = string;
|
|
6
|
+
interface IPayload {
|
|
7
|
+
sub: string;
|
|
8
|
+
token_use: string;
|
|
9
|
+
iss: string;
|
|
10
|
+
exp: number;
|
|
11
|
+
version: string;
|
|
12
|
+
'chevre:typeOf': factory.authorization.IAuthorization['typeOf'];
|
|
13
|
+
}
|
|
14
|
+
type IPayloadWithNoVersion = factory.authorization.IObject & {
|
|
15
|
+
version?: never;
|
|
16
|
+
'chevre:typeOf'?: never;
|
|
17
|
+
};
|
|
6
18
|
/**
|
|
7
19
|
* コードをトークンに変換する
|
|
8
20
|
*/
|
|
9
|
-
|
|
21
|
+
declare function getToken(params: {
|
|
10
22
|
project: {
|
|
11
23
|
id: string;
|
|
12
24
|
};
|
|
@@ -15,7 +27,7 @@ export declare function getToken(params: {
|
|
|
15
27
|
}): (repos: {
|
|
16
28
|
authorization: AuthorizationRepo;
|
|
17
29
|
}) => Promise<IToken>;
|
|
18
|
-
|
|
30
|
+
declare function verifyToken(params: {
|
|
19
31
|
project: {
|
|
20
32
|
id: string;
|
|
21
33
|
};
|
|
@@ -24,4 +36,6 @@ export declare function verifyToken(params: {
|
|
|
24
36
|
audience?: string[];
|
|
25
37
|
}): (repos: {
|
|
26
38
|
action?: ActionRepo;
|
|
39
|
+
authorization: AuthorizationRepo;
|
|
27
40
|
}) => Promise<factory.authorization.IObject>;
|
|
41
|
+
export { IToken, ICode, IPayload, IPayloadWithNoVersion, getToken, verifyToken };
|
|
@@ -35,7 +35,7 @@ function getToken(params) {
|
|
|
35
35
|
// 所有権を暗号化する
|
|
36
36
|
jwt.sign(Object.assign(Object.assign({}, authorization.object), {
|
|
37
37
|
// sub: authorization.id, // 拡張(2024-05-01~)
|
|
38
|
-
token_use: 'access', 'chevre:typeOf': authorization.typeOf // 拡張(2024-05-01~)
|
|
38
|
+
token_use: 'access', version: credentials_1.credentials.jwt.version, 'chevre:typeOf': authorization.typeOf // 拡張(2024-05-01~)
|
|
39
39
|
}), credentials_1.credentials.jwt.secret, {
|
|
40
40
|
issuer: credentials_1.credentials.jwt.issuer,
|
|
41
41
|
expiresIn: params.expiresIn,
|
|
@@ -60,6 +60,7 @@ exports.getToken = getToken;
|
|
|
60
60
|
function verifyToken(params) {
|
|
61
61
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
62
62
|
let result;
|
|
63
|
+
let payload;
|
|
63
64
|
let action;
|
|
64
65
|
if (repos.action !== undefined) {
|
|
65
66
|
const actionAttributes = {
|
|
@@ -74,8 +75,11 @@ function verifyToken(params) {
|
|
|
74
75
|
action = (yield repos.action.start(actionAttributes));
|
|
75
76
|
}
|
|
76
77
|
try {
|
|
77
|
-
|
|
78
|
-
jwt.verify(params.token, credentials_1.credentials.jwt.secret, Object.assign({
|
|
78
|
+
payload = yield new Promise((resolve, reject) => {
|
|
79
|
+
jwt.verify(params.token, credentials_1.credentials.jwt.secret, Object.assign({
|
|
80
|
+
// 互換性維持のために複数対応(2024-05-02~)
|
|
81
|
+
// issuer: credentials.jwt.issuer,
|
|
82
|
+
issuer: credentials_1.credentials.jwt.issuers }, (Array.isArray(params.audience)) ? { audience: params.audience } : undefined), (err, decoded) => {
|
|
79
83
|
if (err instanceof Error) {
|
|
80
84
|
reject(err);
|
|
81
85
|
}
|
|
@@ -101,7 +105,21 @@ function verifyToken(params) {
|
|
|
101
105
|
throw error;
|
|
102
106
|
}
|
|
103
107
|
if (repos.action !== undefined && action !== undefined) {
|
|
104
|
-
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result:
|
|
108
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: payload });
|
|
109
|
+
}
|
|
110
|
+
// token.payloadが承認のケースに対応(2024-05-02~)
|
|
111
|
+
if (typeof payload.version === 'string') {
|
|
112
|
+
if (typeof payload.sub !== 'string' || payload.sub.length === 0) {
|
|
113
|
+
throw new factory.errors.Unauthorized(`invalid token [sub:${payload.sub}]`);
|
|
114
|
+
}
|
|
115
|
+
const { object } = yield repos.authorization.findValidOneById({
|
|
116
|
+
project: { id: params.project.id },
|
|
117
|
+
id: payload.sub
|
|
118
|
+
});
|
|
119
|
+
result = object;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
result = payload;
|
|
105
123
|
}
|
|
106
124
|
return result;
|
|
107
125
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
3
3
|
import type { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../../repo/code';
|
|
4
5
|
import type { MongoRepository as EventRepo } from '../../../repo/event';
|
|
5
6
|
import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
6
7
|
import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
@@ -22,6 +23,7 @@ import type { RedisRepository as TransactionNumberRepo } from '../../../repo/tra
|
|
|
22
23
|
interface IAuthorizeRepos {
|
|
23
24
|
action: ActionRepo;
|
|
24
25
|
assetTransaction: AssetTransactionRepo;
|
|
26
|
+
authorization: AuthorizationRepo;
|
|
25
27
|
event: EventRepo;
|
|
26
28
|
stockHolder: StockHolderRepo;
|
|
27
29
|
offer: OfferRepo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
3
3
|
import type { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../../repo/code';
|
|
4
5
|
import type { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../repo/event';
|
|
5
6
|
import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
6
7
|
import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
@@ -32,6 +33,7 @@ declare function processStartReserve4chevre(params: {
|
|
|
32
33
|
stockHoldUntilDaysAfterEventEnd: number;
|
|
33
34
|
}): (repos: {
|
|
34
35
|
action: ActionRepo;
|
|
36
|
+
authorization: AuthorizationRepo;
|
|
35
37
|
stockHolder: StockHolderRepo;
|
|
36
38
|
event: EventRepo;
|
|
37
39
|
offer: OfferRepo;
|
|
@@ -62,7 +62,7 @@ function validateObjectWithoutDetail(params) {
|
|
|
62
62
|
project: params.project,
|
|
63
63
|
agent: params.project,
|
|
64
64
|
token: String(programMembershipUsed)
|
|
65
|
-
})({ action: repos.action });
|
|
65
|
+
})({ action: repos.action, authorization: repos.authorization });
|
|
66
66
|
if (permitOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
67
67
|
throw new factory.errors.Argument('programMembershipUsed', 'must be OwnershipInfo');
|
|
68
68
|
}
|
|
@@ -5,6 +5,7 @@ import * as factory from '../../factory';
|
|
|
5
5
|
import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
6
6
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
7
7
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
8
|
+
import type { AuthorizationRepo } from '../../repo/code';
|
|
8
9
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
9
10
|
import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
|
|
10
11
|
import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
@@ -56,6 +57,7 @@ interface IAuthorizeRepos {
|
|
|
56
57
|
accountingReport: AccountingReportRepo;
|
|
57
58
|
action: ActionRepo;
|
|
58
59
|
assetTransaction: AssetTransactionRepo;
|
|
60
|
+
authorization: AuthorizationRepo;
|
|
59
61
|
event: EventRepo;
|
|
60
62
|
paymentAccepted: PaymentAcceptedRepo;
|
|
61
63
|
paymentService: PaymentServiceRepo;
|
|
@@ -333,7 +333,7 @@ function authorize(params) {
|
|
|
333
333
|
const { accountId } = yield fixAccountIdIfPossible({
|
|
334
334
|
object: params.object,
|
|
335
335
|
project: { id: transaction.project.id }
|
|
336
|
-
})({ action: repos.action });
|
|
336
|
+
})({ action: repos.action, authorization: repos.authorization });
|
|
337
337
|
const authorizeObject = 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);
|
|
338
338
|
// 承認アクションを開始する
|
|
339
339
|
const taskId = (_b = params.sameAs) === null || _b === void 0 ? void 0 : _b.id;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizationRepo } from '../../repo/code';
|
|
3
3
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
4
4
|
import type { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
5
5
|
type AvailableReservationType = factory.reservationType.BusReservation | factory.reservationType.EventReservation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizationRepo } from '../../repo/code';
|
|
3
3
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
4
4
|
/**
|
|
5
5
|
* 予約使用のためのチケットトークンを検証する
|
|
@@ -25,7 +25,7 @@ function verifyToken4reservation(params) {
|
|
|
25
25
|
project: params.project,
|
|
26
26
|
agent: params.agent,
|
|
27
27
|
token
|
|
28
|
-
})({});
|
|
28
|
+
})({ authorization: repos.authorization });
|
|
29
29
|
}
|
|
30
30
|
else if (typeof ticketToken === 'string' && ticketToken.length > 0) {
|
|
31
31
|
const findValidOneByCodeResult = yield repos.authorization.findValidOneByCode({
|
|
@@ -14,6 +14,7 @@ const factory = require("../../factory");
|
|
|
14
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
|
+
const code_1 = require("../../repo/code");
|
|
17
18
|
const event_1 = require("../../repo/event");
|
|
18
19
|
const paymentService_1 = require("../../repo/paymentService");
|
|
19
20
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
@@ -44,6 +45,7 @@ function call(params) {
|
|
|
44
45
|
accountingReport: new accountingReport_1.MongoRepository(settings.connection),
|
|
45
46
|
action: actionRepo,
|
|
46
47
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
48
|
+
authorization: new code_1.AuthorizationRepo(settings.connection),
|
|
47
49
|
event: new event_1.MongoRepository(settings.connection),
|
|
48
50
|
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
49
51
|
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
@@ -30,7 +30,7 @@ function call(data) {
|
|
|
30
30
|
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
31
31
|
action: new action_1.MongoRepository(settings.connection),
|
|
32
32
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
33
|
-
code: new code_1.
|
|
33
|
+
code: new code_1.AuthorizationRepo(settings.connection),
|
|
34
34
|
event: new event_1.MongoRepository(settings.connection),
|
|
35
35
|
order: new order_1.MongoRepository(settings.connection),
|
|
36
36
|
ownershipInfo: new ownershipInfo_1.MongoRepository(settings.connection),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
3
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
|
+
import type { AuthorizationRepo } from '../../repo/code';
|
|
4
5
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
5
6
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
6
7
|
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
@@ -11,6 +12,7 @@ import type { RedisRepository as TransactionNumberRepo } from '../../repo/transa
|
|
|
11
12
|
import { IPassportValidator as IWaiterPassportValidator, moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
|
|
12
13
|
export interface IStartOperationRepos {
|
|
13
14
|
action: ActionRepo;
|
|
15
|
+
authorization: AuthorizationRepo;
|
|
14
16
|
order: OrderRepo;
|
|
15
17
|
product: ProductRepo;
|
|
16
18
|
project: ProjectRepo;
|
|
@@ -37,6 +39,7 @@ export type IStartParams = MoneyTransferFactory.IStartParams;
|
|
|
37
39
|
export declare function start(params: IStartParams): IStartOperation<factory.transaction.moneyTransfer.ITransaction>;
|
|
38
40
|
export type IAuthorizeOperation<T> = (repos: {
|
|
39
41
|
action: ActionRepo;
|
|
42
|
+
authorization: AuthorizationRepo;
|
|
40
43
|
order: OrderRepo;
|
|
41
44
|
product: ProductRepo;
|
|
42
45
|
project: ProjectRepo;
|
|
@@ -377,7 +377,10 @@ function validateFromLocation(project, fromLocationBeforeStart, issuedThrough) {
|
|
|
377
377
|
project: { id: project.id },
|
|
378
378
|
agent: { id: project.id, typeOf: factory.organizationType.Project },
|
|
379
379
|
token: fromLocation
|
|
380
|
-
})({
|
|
380
|
+
})({
|
|
381
|
+
action: repos.action,
|
|
382
|
+
authorization: repos.authorization
|
|
383
|
+
});
|
|
381
384
|
if (paymentCardOwnershipInfo.typeOf !== 'OwnershipInfo') {
|
|
382
385
|
throw new factory.errors.Argument('fromLocation', 'must be OwnershipInfo');
|
|
383
386
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MongoRepository as ActionRepo } from '../../../repo/action';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AuthorizationRepo } from '../../../repo/code';
|
|
3
3
|
import type { RedisRepository as ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
4
4
|
import type { MongoRepository as EmailMessageRepo } from '../../../repo/emailMessage';
|
|
5
5
|
import type { MessageRepo } from '../../../repo/message';
|
|
@@ -11,7 +11,7 @@ import * as factory from '../../../factory';
|
|
|
11
11
|
import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
|
|
12
12
|
interface IConfirmOperationRepos {
|
|
13
13
|
action: ActionRepo;
|
|
14
|
-
authorization:
|
|
14
|
+
authorization: AuthorizationRepo;
|
|
15
15
|
emailMessage?: EmailMessageRepo;
|
|
16
16
|
message: MessageRepo;
|
|
17
17
|
project: ProjectRepo;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuthorizationRepo } from '../../../repo/code';
|
|
2
2
|
declare function publishCode(params: {
|
|
3
3
|
project: {
|
|
4
4
|
id: string;
|
|
@@ -9,6 +9,6 @@ declare function publishCode(params: {
|
|
|
9
9
|
validFrom: Date;
|
|
10
10
|
expiresInSeconds: number;
|
|
11
11
|
}): (repos: {
|
|
12
|
-
authorization:
|
|
12
|
+
authorization: AuthorizationRepo;
|
|
13
13
|
}) => Promise<string>;
|
|
14
14
|
export { publishCode };
|
package/package.json
CHANGED