@chevre/domain 22.2.0-alpha.5 → 22.2.0-alpha.7
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/lib/chevre/repo/ownershipInfo.d.ts +7 -5
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +20 -20
- 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/verifyTicketTokenAsNeeded.d.ts +0 -2
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +18 -21
- package/lib/chevre/service/payment/any.d.ts +0 -2
- package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/package.json +2 -2
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import type { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export type
|
|
27
|
+
export type IOwnershipInfoWithId = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
28
30
|
/**
|
|
29
31
|
* 所有権リポジトリ
|
|
30
32
|
*/
|
|
@@ -35,16 +37,16 @@ export declare class OwnershipInfoRepo {
|
|
|
35
37
|
/**
|
|
36
38
|
* なければ作成する
|
|
37
39
|
*/
|
|
38
|
-
createIfNotExistByIdentifier(ownershipInfo:
|
|
40
|
+
createIfNotExistByIdentifier(ownershipInfo: Omit<IOwnershipInfoWithId, 'id'>): Promise<{
|
|
39
41
|
id: string;
|
|
40
42
|
}>;
|
|
41
43
|
projectFieldsById(params: {
|
|
42
44
|
id: string;
|
|
43
|
-
}, inclusion?: (keyof
|
|
45
|
+
}, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId>;
|
|
44
46
|
/**
|
|
45
47
|
* 所有権を検索する
|
|
46
48
|
*/
|
|
47
|
-
search(params: factory.ownershipInfo.ISearchConditions, projection?: any): Promise<
|
|
49
|
+
search(params: factory.ownershipInfo.ISearchConditions, projection?: any): Promise<IOwnershipInfoWithId[]>;
|
|
48
50
|
/**
|
|
49
51
|
* 識別子から所有期限を変更する
|
|
50
52
|
* 存在しない場合undefinedを返す
|
|
@@ -55,7 +57,7 @@ export declare class OwnershipInfoRepo {
|
|
|
55
57
|
};
|
|
56
58
|
identifier: string;
|
|
57
59
|
ownedThrough: Date;
|
|
58
|
-
}): Promise<
|
|
60
|
+
}): Promise<IOwnershipInfoWithId | undefined>;
|
|
59
61
|
/**
|
|
60
62
|
* 所有者の所有権を全て削除する
|
|
61
63
|
*/
|
|
@@ -2,7 +2,6 @@ import * as factory from '../../../../../factory';
|
|
|
2
2
|
import type { JWTCredentials } from '../../../../../credentials/jwt';
|
|
3
3
|
import type { ActionRepo } from '../../../../../repo/action';
|
|
4
4
|
import type { AuthorizationRepo } from '../../../../../repo/authorization';
|
|
5
|
-
import type { OwnershipInfoRepo } from '../../../../../repo/ownershipInfo';
|
|
6
5
|
import type { TicketRepo } from '../../../../../repo/ticket';
|
|
7
6
|
/**
|
|
8
7
|
* チケット化された適用メンバーシップをPermitに変換する
|
|
@@ -18,7 +17,6 @@ declare function requestedProgramMembershipUsed2permit(params: {
|
|
|
18
17
|
}): (repos: {
|
|
19
18
|
action: ActionRepo;
|
|
20
19
|
authorization: AuthorizationRepo;
|
|
21
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
22
20
|
ticket: TicketRepo;
|
|
23
21
|
}, credentials: {
|
|
24
22
|
jwt: JWTCredentials;
|
|
@@ -18,10 +18,9 @@ const CodeService = require("../../../../code");
|
|
|
18
18
|
function requestedProgramMembershipUsed2permit(params) {
|
|
19
19
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
20
20
|
return (repos, credentials) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
var _a, _b, _c, _d
|
|
21
|
+
var _a, _b, _c, _d;
|
|
22
22
|
let programMembershipUsedAsPermit;
|
|
23
23
|
const { programMembershipUsed, placeOrder } = params;
|
|
24
|
-
const now = new Date();
|
|
25
24
|
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
26
25
|
if (typeof programMembershipUsed === 'string') {
|
|
27
26
|
const { authorizedObject } = yield CodeService.verifyToken({
|
|
@@ -71,33 +70,34 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
71
70
|
throw new factory.errors.NotFound('Ticket');
|
|
72
71
|
}
|
|
73
72
|
// 承認を参照
|
|
74
|
-
const { object } = yield repos.authorization.findValidOneByCode({
|
|
73
|
+
const { audience, object } = yield repos.authorization.findValidOneByCode({
|
|
75
74
|
project: { id: params.project.id },
|
|
76
75
|
code: ticket.ticketToken
|
|
77
76
|
});
|
|
78
77
|
if (object.typeOf !== 'OwnershipInfo') {
|
|
79
78
|
throw new factory.errors.Argument('programMembershipUsed', 'invalid authorization');
|
|
80
79
|
}
|
|
81
|
-
const ownershipInfoId = object.id;
|
|
82
|
-
const permitOwnershipInfo = (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})).shift();
|
|
90
|
-
if (permitOwnershipInfo === undefined) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
//
|
|
94
|
-
if (
|
|
95
|
-
throw new factory.errors.Argument('programMembershipUsed', '
|
|
80
|
+
// const ownershipInfoId = object.id;
|
|
81
|
+
// const permitOwnershipInfo = (await repos.ownershipInfo.search({
|
|
82
|
+
// limit: 1,
|
|
83
|
+
// page: 1,
|
|
84
|
+
// project: { id: { $eq: params.project.id } },
|
|
85
|
+
// ids: [ownershipInfoId],
|
|
86
|
+
// ownedFrom: now,
|
|
87
|
+
// ownedThrough: now
|
|
88
|
+
// })).shift();
|
|
89
|
+
// if (permitOwnershipInfo === undefined) {
|
|
90
|
+
// throw new factory.errors.NotFound('OwnershipInfo');
|
|
91
|
+
// }
|
|
92
|
+
// audience検証
|
|
93
|
+
if ((audience === null || audience === void 0 ? void 0 : audience.typeOf) !== factory.transactionType.PlaceOrder || audience.id !== placeOrder.id) {
|
|
94
|
+
throw new factory.errors.Argument('programMembershipUsed', 'audience not matched with placeOrder');
|
|
96
95
|
}
|
|
96
|
+
const permitOwnershipInfo = object;
|
|
97
97
|
if (permitOwnershipInfo.typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
98
98
|
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.typeOf must be Permit');
|
|
99
99
|
}
|
|
100
|
-
const issuedThroughTypeOf = (
|
|
100
|
+
const issuedThroughTypeOf = (_c = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _c === void 0 ? void 0 : _c.typeOf;
|
|
101
101
|
if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
102
102
|
programMembershipUsedAsPermit = {
|
|
103
103
|
identifier: permitOwnershipInfo.typeOfGood.identifier,
|
|
@@ -107,7 +107,7 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
107
107
|
}
|
|
108
108
|
else if (issuedThroughTypeOf === factory.product.ProductType.MembershipService
|
|
109
109
|
|| issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
110
|
-
if (typeof ((
|
|
110
|
+
if (typeof ((_d = permitOwnershipInfo.typeOfGood.issuedThrough) === null || _d === void 0 ? void 0 : _d.id) !== 'string') {
|
|
111
111
|
throw new factory.errors.Argument('programMembershipUsed', 'ownershipInfo.typeOfGood.issuedThrough.id undefined');
|
|
112
112
|
}
|
|
113
113
|
programMembershipUsedAsPermit = {
|
|
@@ -7,7 +7,6 @@ import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/even
|
|
|
7
7
|
import type { OfferRepo } from '../../../../repo/offer';
|
|
8
8
|
import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
|
|
10
|
-
import type { OwnershipInfoRepo } from '../../../../repo/ownershipInfo';
|
|
11
10
|
import type { PaymentServiceRepo } from '../../../../repo/paymentService';
|
|
12
11
|
import type { SeatRepo } from '../../../../repo/place/seat';
|
|
13
12
|
import type { PriceSpecificationRepo } from '../../../../repo/priceSpecification';
|
|
@@ -46,7 +45,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
46
45
|
offerCatalog: OfferCatalogRepo;
|
|
47
46
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
48
47
|
offerRateLimit: OfferRateLimitRepo;
|
|
49
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
50
48
|
paymentService: PaymentServiceRepo;
|
|
51
49
|
product: ProductRepo;
|
|
52
50
|
productOffer: ProductOfferRepo;
|
|
@@ -9,7 +9,6 @@ import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
|
9
9
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
10
10
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
11
11
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
12
|
-
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
13
12
|
import type { PaymentServiceRepo } from '../../../repo/paymentService';
|
|
14
13
|
import type { SeatRepo } from '../../../repo/place/seat';
|
|
15
14
|
import type { PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
@@ -34,7 +33,6 @@ interface IAuthorizeRepos {
|
|
|
34
33
|
offerRateLimit: OfferRateLimitRepo;
|
|
35
34
|
orderInTransaction: OrderInTransactionRepo;
|
|
36
35
|
orderNumber: OrderNumberRepo;
|
|
37
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
38
36
|
paymentService: PaymentServiceRepo;
|
|
39
37
|
priceSpecification: PriceSpecificationRepo;
|
|
40
38
|
product: ProductRepo;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import type { AuthorizationRepo } from '../../../repo/authorization';
|
|
3
|
-
import type { OwnershipInfoRepo } from '../../../repo/ownershipInfo';
|
|
4
3
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
5
4
|
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
6
5
|
ticketToken?: string;
|
|
@@ -14,7 +13,6 @@ declare function verifyTicketTokenAsNeeded(params: {
|
|
|
14
13
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
15
14
|
}): (repos: {
|
|
16
15
|
authorization: AuthorizationRepo;
|
|
17
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
18
16
|
ticket: TicketRepo;
|
|
19
17
|
}) => Promise<{
|
|
20
18
|
permit: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'> | undefined;
|
|
@@ -13,7 +13,7 @@ exports.verifyTicketTokenAsNeeded = void 0;
|
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
function verifyTicketTokenAsNeeded(params) {
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
16
|
+
var _a, _b;
|
|
17
17
|
const { paymentServiceType, object, project } = params;
|
|
18
18
|
const { ticketToken } = object;
|
|
19
19
|
let permit;
|
|
@@ -41,32 +41,29 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
41
41
|
if (authorizedObject.typeOf !== 'OwnershipInfo') {
|
|
42
42
|
throw new factory.errors.Argument('ticketToken', 'must be OwnershipInfo');
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
project: { id: { $eq: params.project.id } },
|
|
49
|
-
ids: [ownershipInfoId]
|
|
50
|
-
})).shift();
|
|
51
|
-
if (permitOwnershipInfo === undefined) {
|
|
52
|
-
throw new factory.errors.NotFound('OwnershipInfo');
|
|
44
|
+
// audience検証
|
|
45
|
+
if (((_a = validAuthorization.audience) === null || _a === void 0 ? void 0 : _a.typeOf) !== factory.transactionType.PlaceOrder
|
|
46
|
+
|| validAuthorization.audience.id !== params.purpose.id) {
|
|
47
|
+
throw new factory.errors.Argument('ticketToken', 'audience not matched with placeOrder');
|
|
53
48
|
}
|
|
54
|
-
const
|
|
49
|
+
const permitOwnershipInfo = authorizedObject;
|
|
50
|
+
// const ownershipInfoId = authorizedObject.id;
|
|
51
|
+
// const permitOwnershipInfo = (await repos.ownershipInfo.search({
|
|
52
|
+
// limit: 1,
|
|
53
|
+
// page: 1,
|
|
54
|
+
// project: { id: { $eq: params.project.id } },
|
|
55
|
+
// ids: [ownershipInfoId]
|
|
56
|
+
// })).shift();
|
|
57
|
+
// if (permitOwnershipInfo === undefined) {
|
|
58
|
+
// throw new factory.errors.NotFound('OwnershipInfo');
|
|
59
|
+
// }
|
|
60
|
+
const { typeOfGood } = permitOwnershipInfo;
|
|
55
61
|
if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
56
62
|
throw new factory.errors.Argument('ticketToken', 'must be Permit');
|
|
57
63
|
}
|
|
58
|
-
if (((
|
|
64
|
+
if (((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) !== paymentServiceType) {
|
|
59
65
|
throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
60
66
|
}
|
|
61
|
-
if (!Array.isArray(ownedBy)) {
|
|
62
|
-
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy must be Array');
|
|
63
|
-
}
|
|
64
|
-
if (ownedBy[0].typeOf !== factory.transactionType.PlaceOrder) {
|
|
65
|
-
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.typeOf must be PlaceOrder');
|
|
66
|
-
}
|
|
67
|
-
if (ownedBy[0].id !== params.purpose.id) {
|
|
68
|
-
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.id not matched');
|
|
69
|
-
}
|
|
70
67
|
permit = { identifier: typeOfGood.identifier };
|
|
71
68
|
}
|
|
72
69
|
break;
|
|
@@ -10,7 +10,6 @@ import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
|
10
10
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
11
11
|
import type { ConfirmationNumberRepo } from '../../repo/confirmationNumber';
|
|
12
12
|
import type { EventRepo } from '../../repo/event';
|
|
13
|
-
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
14
13
|
import type { PaymentServiceRepo } from '../../repo/paymentService';
|
|
15
14
|
import type { PaymentServiceProviderRepo } from '../../repo/paymentServiceProvider';
|
|
16
15
|
import type { ProductRepo } from '../../repo/product';
|
|
@@ -80,7 +79,6 @@ interface IAuthorizeRepos {
|
|
|
80
79
|
authorization: AuthorizationRepo;
|
|
81
80
|
confirmationNumber: ConfirmationNumberRepo;
|
|
82
81
|
event: EventRepo;
|
|
83
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
84
82
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
85
83
|
paymentService: PaymentServiceRepo;
|
|
86
84
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
@@ -21,5 +21,7 @@ export interface IOwnershipInfoReport {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
export declare function ownershipInfo2report(params: {
|
|
24
|
-
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood
|
|
24
|
+
ownershipInfo: factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
25
27
|
}): IOwnershipInfoReport;
|
|
@@ -17,7 +17,6 @@ const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
|
17
17
|
const authorization_1 = require("../../repo/authorization");
|
|
18
18
|
const confirmationNumber_1 = require("../../repo/confirmationNumber");
|
|
19
19
|
const event_1 = require("../../repo/event");
|
|
20
|
-
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
21
20
|
const paymentService_1 = require("../../repo/paymentService");
|
|
22
21
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
23
22
|
const product_1 = require("../../repo/product");
|
|
@@ -55,7 +54,6 @@ function call(params) {
|
|
|
55
54
|
authorization: new authorization_1.AuthorizationRepo(connection),
|
|
56
55
|
confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
|
|
57
56
|
event: new event_1.EventRepo(connection),
|
|
58
|
-
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
59
57
|
paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
|
|
60
58
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
61
59
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.381.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.381.0-alpha.6",
|
|
13
13
|
"@cinerino/sdk": "10.5.0-alpha.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.4.0",
|
|
15
15
|
"@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": "22.2.0-alpha.
|
|
113
|
+
"version": "22.2.0-alpha.7"
|
|
114
114
|
}
|