@chevre/domain 22.2.0-alpha.2 → 22.2.0-alpha.21
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/findValidAuthorization.ts +1 -2
- package/example/src/chevre/playAroundTicket.ts +3 -2
- package/example/src/chevre/{projectReservationFields.ts → projectFields.ts} +10 -8
- package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts} +4 -4
- package/example/src/chevre/searchProjects.ts +9 -4
- package/example/src/chevre/searchSellersByAggregate.ts +3 -3
- package/example/src/chevre/unsetUnnecessaryFields.ts +4 -30
- package/lib/chevre/repo/authorization.d.ts +3 -1
- package/lib/chevre/repo/authorization.js +21 -10
- package/lib/chevre/repo/categoryCode.d.ts +14 -2
- package/lib/chevre/repo/categoryCode.js +41 -19
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +21 -23
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +12 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +5 -12
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.js +21 -23
- package/lib/chevre/repo/ownershipInfo.d.ts +10 -6
- package/lib/chevre/repo/ownershipInfo.js +75 -19
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +108 -58
- package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
- package/lib/chevre/repo/product.d.ts +2 -2
- package/lib/chevre/repo/product.js +67 -33
- package/lib/chevre/repo/project.d.ts +4 -4
- package/lib/chevre/repo/project.js +69 -28
- package/lib/chevre/repo/seller.d.ts +10 -12
- package/lib/chevre/repo/seller.js +61 -27
- package/lib/chevre/repo/ticket.d.ts +3 -2
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/aggregation/project.js +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -3
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +3 -3
- package/lib/chevre/service/assetTransaction/registerService.js +4 -6
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +26 -23
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
- package/lib/chevre/service/code.d.ts +0 -4
- package/lib/chevre/service/code.js +21 -17
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/moneyTransfer.js +2 -4
- package/lib/chevre/service/notification.js +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +34 -6
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +22 -22
- 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/offer/event/importFromCOA/factory.d.ts +3 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
- package/lib/chevre/service/offer/product.d.ts +1 -1
- package/lib/chevre/service/offer/product.js +4 -6
- package/lib/chevre/service/order/sendOrder.js +9 -5
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -6
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -34
- package/lib/chevre/service/payment/any.d.ts +3 -3
- package/lib/chevre/service/payment/any.js +15 -7
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +36 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/package.json +3 -3
- package/example/src/chevre/searchProducts.ts +0 -28
|
@@ -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({
|
|
@@ -61,43 +60,44 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
61
60
|
else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
|
|
62
61
|
const { ticketToken } = programMembershipUsed;
|
|
63
62
|
if (typeof ticketToken === 'string') {
|
|
64
|
-
const ticket = (yield repos.ticket.
|
|
63
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
65
64
|
limit: 1,
|
|
66
65
|
page: 1,
|
|
67
66
|
project: { id: { $eq: params.project.id } },
|
|
68
67
|
ticketToken: { $eq: ticketToken }
|
|
69
|
-
})).shift();
|
|
68
|
+
}, ['ticketToken'])).shift();
|
|
70
69
|
if (ticket === undefined) {
|
|
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;
|
|
@@ -4,6 +4,8 @@ declare function coaTicket2offer(params: {
|
|
|
4
4
|
theaterCode: string;
|
|
5
5
|
ticketResult: COA.factory.master.ITicketResult;
|
|
6
6
|
defaultCurrencyType?: factory.categoryCode.ICategoryCode;
|
|
7
|
-
defaultMembershipType?: factory.categoryCode.ICategoryCode
|
|
7
|
+
defaultMembershipType?: factory.categoryCode.ICategoryCode & {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
8
10
|
}): factory.aggregateOffer.ISubOffer;
|
|
9
11
|
export { coaTicket2offer };
|
|
@@ -15,7 +15,7 @@ const factory_1 = require("./importFromCOA/factory");
|
|
|
15
15
|
function importFromCOA(params) {
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
// 通貨区分検索
|
|
18
|
-
const currencyTypes = yield repos.categoryCode.
|
|
18
|
+
const currencyTypes = yield repos.categoryCode.projectFields({
|
|
19
19
|
limit: 1,
|
|
20
20
|
page: 1,
|
|
21
21
|
project: { id: { $eq: params.project.id } },
|
|
@@ -23,7 +23,7 @@ function importFromCOA(params) {
|
|
|
23
23
|
}, [], []);
|
|
24
24
|
const defaultCurrencyType = currencyTypes.shift();
|
|
25
25
|
// メンバーシップ区分検索
|
|
26
|
-
const membershipTypes = yield repos.categoryCode.
|
|
26
|
+
const membershipTypes = yield repos.categoryCode.projectFields({
|
|
27
27
|
limit: 1,
|
|
28
28
|
page: 1,
|
|
29
29
|
project: { id: { $eq: params.project.id } },
|
|
@@ -18,10 +18,8 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
18
18
|
// tslint:disable-next-line:max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
-
// let eventService: Pick<factory.product.IProduct, 'hasOfferCatalog' | 'project'> | undefined;
|
|
22
21
|
let catalogId;
|
|
23
|
-
|
|
24
|
-
const eventService = (yield repos.product.searchProducts({
|
|
22
|
+
const eventService = (yield repos.product.projectFields({
|
|
25
23
|
limit: 1,
|
|
26
24
|
page: 1,
|
|
27
25
|
id: { $eq: String((_a = params.itemOffered) === null || _a === void 0 ? void 0 : _a.id) }
|
|
@@ -380,9 +378,7 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
380
378
|
const eventOffers = event.offers;
|
|
381
379
|
let catalogId;
|
|
382
380
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
383
|
-
|
|
384
|
-
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
385
|
-
const eventService = (yield repos.product.searchProducts({
|
|
381
|
+
const eventService = (yield repos.product.projectFields({
|
|
386
382
|
limit: 1,
|
|
387
383
|
page: 1,
|
|
388
384
|
id: { $eq: eventOffers.itemOffered.id }
|
|
@@ -438,9 +434,7 @@ function searchOfferCatalogItems(params) {
|
|
|
438
434
|
const eventOffers = event.offers;
|
|
439
435
|
let catalogId;
|
|
440
436
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
441
|
-
|
|
442
|
-
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
443
|
-
const eventService = (yield repos.product.searchProducts({
|
|
437
|
+
const eventService = (yield repos.product.projectFields({
|
|
444
438
|
limit: 1,
|
|
445
439
|
page: 1,
|
|
446
440
|
id: { $eq: eventOffers.itemOffered.id }
|
|
@@ -508,9 +502,7 @@ function searchOfferCatalogItemAvailability(params) {
|
|
|
508
502
|
const eventOffers = event.offers;
|
|
509
503
|
let catalogId;
|
|
510
504
|
if (typeof ((_a = eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
511
|
-
|
|
512
|
-
// await repos.product.findProductById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
513
|
-
const eventService = (yield repos.product.searchProducts({
|
|
505
|
+
const eventService = (yield repos.product.projectFields({
|
|
514
506
|
limit: 1,
|
|
515
507
|
page: 1,
|
|
516
508
|
id: { $eq: eventOffers.itemOffered.id }
|
|
@@ -53,15 +53,15 @@ function authorize(params) {
|
|
|
53
53
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
54
54
|
] // optimize(2024-07-18~)
|
|
55
55
|
);
|
|
56
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.
|
|
56
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
57
57
|
project: { id: { $eq: transaction.project.id } },
|
|
58
58
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
59
59
|
}, [], []);
|
|
60
|
-
const seatingTypes = yield repos.categoryCode.
|
|
60
|
+
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
61
61
|
project: { id: { $eq: transaction.project.id } },
|
|
62
62
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
63
63
|
}, [], []);
|
|
64
|
-
const videoFormatTypes = yield repos.categoryCode.
|
|
64
|
+
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
65
65
|
project: { id: { $eq: transaction.project.id } },
|
|
66
66
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
67
67
|
}, [], []);
|
|
@@ -77,15 +77,15 @@ function changeOffers(params) {
|
|
|
77
77
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
78
78
|
] // optimize(2024-07-18~)
|
|
79
79
|
);
|
|
80
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.
|
|
80
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
81
81
|
project: { id: { $eq: transaction.project.id } },
|
|
82
82
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
83
83
|
}, [], []);
|
|
84
|
-
const seatingTypes = yield repos.categoryCode.
|
|
84
|
+
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
85
85
|
project: { id: { $eq: transaction.project.id } },
|
|
86
86
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
87
87
|
}, [], []);
|
|
88
|
-
const videoFormatTypes = yield repos.categoryCode.
|
|
88
|
+
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
89
89
|
project: { id: { $eq: transaction.project.id } },
|
|
90
90
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
91
91
|
}, [], []);
|
|
@@ -19,9 +19,7 @@ function searchProductOffers(params) {
|
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
var _a, _b;
|
|
21
21
|
// プロダクト検索
|
|
22
|
-
|
|
23
|
-
// await repos.product.findProductById({ id: params.itemOffered.id }, ['hasOfferCatalog', 'project'], []);
|
|
24
|
-
const productWithOffers = (yield repos.product.searchProducts({
|
|
22
|
+
const productWithOffers = (yield repos.product.projectFields({
|
|
25
23
|
limit: 1,
|
|
26
24
|
page: 1,
|
|
27
25
|
id: { $eq: params.itemOffered.id }
|
|
@@ -68,7 +68,7 @@ export declare function search(params: {
|
|
|
68
68
|
productOffer: ProductOfferRepo;
|
|
69
69
|
}) => Promise<{
|
|
70
70
|
offers: factory.product.ITicketOffer[];
|
|
71
|
-
product:
|
|
71
|
+
product: factory.product.IProduct;
|
|
72
72
|
}>;
|
|
73
73
|
export type IAuthorizeOfferAction = factory.action.authorize.offer.product.IAction;
|
|
74
74
|
/**
|
|
@@ -27,7 +27,7 @@ function search(params) {
|
|
|
27
27
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
var _a;
|
|
29
29
|
const now = moment();
|
|
30
|
-
const searchProductsResult = yield repos.product.
|
|
30
|
+
const searchProductsResult = yield repos.product.projectFields({
|
|
31
31
|
limit: 1,
|
|
32
32
|
page: 1,
|
|
33
33
|
project: { id: { $eq: params.project.id } },
|
|
@@ -172,7 +172,7 @@ function fixProductAndOffers(params) {
|
|
|
172
172
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
173
173
|
var _a, _b, _c;
|
|
174
174
|
const productId = String((_b = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.id);
|
|
175
|
-
const searchProductsResult = yield repos.product.
|
|
175
|
+
const searchProductsResult = yield repos.product.projectFields({
|
|
176
176
|
limit: 1,
|
|
177
177
|
page: 1,
|
|
178
178
|
project: { id: { $eq: params.project.id } },
|
|
@@ -344,9 +344,7 @@ function checkIfRegistered(params) {
|
|
|
344
344
|
// メンバーシップについては、登録済かどうか確認する
|
|
345
345
|
if (params.product.typeOf === factory.product.ProductType.MembershipService) {
|
|
346
346
|
// プロダクトによって発行されたPermitを所有していれば、登録済
|
|
347
|
-
const searchOwnershipInfosResult = yield repos.ownershipInfo.
|
|
348
|
-
// iss: params.iss,
|
|
349
|
-
// project: { id: { $eq: params.project.id } },
|
|
347
|
+
const searchOwnershipInfosResult = yield repos.ownershipInfo.projectFields({
|
|
350
348
|
limit: 1,
|
|
351
349
|
page: 1,
|
|
352
350
|
ownedBy: { id: params.agent.id },
|
|
@@ -359,7 +357,7 @@ function checkIfRegistered(params) {
|
|
|
359
357
|
},
|
|
360
358
|
ownedFrom: params.now,
|
|
361
359
|
ownedThrough: params.now
|
|
362
|
-
});
|
|
360
|
+
}, []);
|
|
363
361
|
const ownershipInfos = searchOwnershipInfosResult;
|
|
364
362
|
if (ownershipInfos.length > 0) {
|
|
365
363
|
// Already registered
|
|
@@ -86,7 +86,8 @@ function sendOrder(params) {
|
|
|
86
86
|
typeOf: factory.actionType.SendAction
|
|
87
87
|
};
|
|
88
88
|
const action = yield repos.action.start(sendOrderActionAttributes);
|
|
89
|
-
let
|
|
89
|
+
let creatingOwnershipInfos = [];
|
|
90
|
+
let createdOwnershipInfos = [];
|
|
90
91
|
let allOffersDelivered = false;
|
|
91
92
|
let acceptedOffers;
|
|
92
93
|
// 所有権生成を最小化(2024-03-01~)
|
|
@@ -111,12 +112,15 @@ function sendOrder(params) {
|
|
|
111
112
|
debug('delivering...', order.orderNumber, acceptedOffers.map((offer) => `${offer.itemOffered.id}`), params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
|
|
112
113
|
// 所有権作成
|
|
113
114
|
if (createOwnerships) {
|
|
114
|
-
|
|
115
|
+
creatingOwnershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
115
116
|
order: Object.assign(Object.assign({}, order), { acceptedOffers }),
|
|
116
117
|
offerIndexBase
|
|
117
118
|
});
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
createdOwnershipInfos = yield Promise.all(creatingOwnershipInfos.map((creatingOwnershipInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
120
|
+
const { id } = yield repos.ownershipInfo.createIfNotExistByIdentifier(creatingOwnershipInfo);
|
|
121
|
+
return Object.assign({ id }, (typeof creatingOwnershipInfo.identifier === 'string')
|
|
122
|
+
? { identifier: creatingOwnershipInfo.identifier }
|
|
123
|
+
: undefined);
|
|
120
124
|
})));
|
|
121
125
|
}
|
|
122
126
|
// const deliveredCount = limit * page;
|
|
@@ -140,7 +144,7 @@ function sendOrder(params) {
|
|
|
140
144
|
}
|
|
141
145
|
throw error;
|
|
142
146
|
}
|
|
143
|
-
const result =
|
|
147
|
+
const result = createdOwnershipInfos;
|
|
144
148
|
yield repos.action.completeWithVoid({ typeOf: sendOrderActionAttributes.typeOf, id: action.id, result: result });
|
|
145
149
|
debug('allOffersDelivered?:', allOffersDelivered, order.orderNumber);
|
|
146
150
|
if (params.useOnOrderStatusChanged) {
|
|
@@ -1,20 +1,15 @@
|
|
|
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
|
-
type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail & {
|
|
6
|
-
ticketToken?: string;
|
|
7
|
-
};
|
|
8
4
|
declare function verifyTicketTokenAsNeeded(params: {
|
|
9
5
|
project: {
|
|
10
6
|
id: string;
|
|
11
7
|
};
|
|
12
|
-
object: IObjectWithoutDetail
|
|
8
|
+
object: Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'issuedThrough' | 'ticketToken'>;
|
|
13
9
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
14
10
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
15
11
|
}): (repos: {
|
|
16
12
|
authorization: AuthorizationRepo;
|
|
17
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
18
13
|
ticket: TicketRepo;
|
|
19
14
|
}) => Promise<{
|
|
20
15
|
permit: Pick<factory.ownershipInfo.IPermitAsGood, 'identifier'> | undefined;
|
|
@@ -13,22 +13,21 @@ 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
|
-
const { ticketToken } = object;
|
|
18
|
+
const { issuedThrough, ticketToken } = object;
|
|
19
19
|
let permit;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const ticket = (yield repos.ticket.search({
|
|
20
|
+
// メンバーシップチケットが指定された場合、メンバーシップコードへ変換する
|
|
21
|
+
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
22
|
+
switch (paymentServiceType) {
|
|
23
|
+
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
24
|
+
case factory.service.paymentService.PaymentServiceType.FaceToFace:
|
|
25
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
27
26
|
limit: 1,
|
|
28
27
|
page: 1,
|
|
29
28
|
project: { id: { $eq: project.id } },
|
|
30
29
|
ticketToken: { $eq: ticketToken }
|
|
31
|
-
})).shift();
|
|
30
|
+
}, ['ticketToken'])).shift();
|
|
32
31
|
if (ticket === undefined) {
|
|
33
32
|
throw new factory.errors.NotFound('Ticket');
|
|
34
33
|
}
|
|
@@ -37,41 +36,34 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
37
36
|
project: { id: params.project.id },
|
|
38
37
|
code: ticket.ticketToken
|
|
39
38
|
});
|
|
40
|
-
authorizedObject = validAuthorization.object;
|
|
39
|
+
const authorizedObject = validAuthorization.object;
|
|
41
40
|
if (authorizedObject.typeOf !== 'OwnershipInfo') {
|
|
42
41
|
throw new factory.errors.Argument('ticketToken', 'must be OwnershipInfo');
|
|
43
42
|
}
|
|
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');
|
|
43
|
+
// audience検証
|
|
44
|
+
if (((_a = validAuthorization.audience) === null || _a === void 0 ? void 0 : _a.typeOf) !== factory.transactionType.PlaceOrder
|
|
45
|
+
|| validAuthorization.audience.id !== params.purpose.id) {
|
|
46
|
+
throw new factory.errors.Argument('ticketToken', 'audience not matched with placeOrder');
|
|
53
47
|
}
|
|
54
|
-
const {
|
|
48
|
+
const { typeOfGood } = authorizedObject;
|
|
55
49
|
if (typeOfGood.typeOf !== factory.permit.PermitType.Permit) {
|
|
56
50
|
throw new factory.errors.Argument('ticketToken', 'must be Permit');
|
|
57
51
|
}
|
|
58
|
-
if (((
|
|
52
|
+
if (((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) !== paymentServiceType) {
|
|
59
53
|
throw new factory.errors.Argument('ticketToken', 'paymentServiceType not matched');
|
|
60
54
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (ownedBy[0].id !== params.purpose.id) {
|
|
68
|
-
throw new factory.errors.Argument('ticketToken', 'ownershipInfo.ownedBy.id not matched');
|
|
55
|
+
// CreditCardの場合、発行サービスIDを検証
|
|
56
|
+
if (typeOfGood.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
57
|
+
if (typeOfGood.issuedThrough.id !== issuedThrough.id) {
|
|
58
|
+
throw new factory.errors.Argument('ticketToken', 'issuedThrough.id not matched');
|
|
59
|
+
}
|
|
69
60
|
}
|
|
70
61
|
permit = { identifier: typeOfGood.identifier };
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
// no op
|
|
65
|
+
throw new factory.errors.NotImplemented(`ticketToken issued through ${paymentServiceType} not implemented`);
|
|
66
|
+
}
|
|
75
67
|
}
|
|
76
68
|
return { permit };
|
|
77
69
|
});
|
|
@@ -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;
|
|
@@ -97,9 +95,11 @@ type IAuthorizeOperation<T> = (repos: IAuthorizeRepos, settings: Settings, crede
|
|
|
97
95
|
interface IPublishPaymentUrlRepos {
|
|
98
96
|
action: ActionRepo;
|
|
99
97
|
assetTransaction: AssetTransactionRepo;
|
|
98
|
+
authorization: AuthorizationRepo;
|
|
100
99
|
paymentAccepted: SellerPaymentAcceptedRepo;
|
|
101
100
|
paymentService: PaymentServiceRepo;
|
|
102
101
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
102
|
+
ticket: TicketRepo;
|
|
103
103
|
transaction: TransactionRepo;
|
|
104
104
|
transactionNumber: TransactionNumberRepo;
|
|
105
105
|
}
|
|
@@ -117,7 +117,7 @@ declare function publishPaymentUrl(params: {
|
|
|
117
117
|
agent: {
|
|
118
118
|
id: string;
|
|
119
119
|
};
|
|
120
|
-
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
|
|
120
|
+
object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod' | 'ticketToken'>;
|
|
121
121
|
purpose: factory.action.authorize.paymentMethod.any.IPurpose;
|
|
122
122
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
123
123
|
location: factory.action.trade.pay.ILocation;
|
|
@@ -228,16 +228,24 @@ exports.processVoidPayTransaction = processVoidPayTransaction;
|
|
|
228
228
|
function publishPaymentUrl(params) {
|
|
229
229
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
230
230
|
var _a;
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
const { paymentServiceType, purpose, project } = params;
|
|
232
|
+
if (purpose.typeOf !== factory.transactionType.PlaceOrder) {
|
|
233
|
+
throw new factory.errors.NotImplemented(`purpose.typeOf '${purpose.typeOf} not implemented'`);
|
|
233
234
|
}
|
|
234
235
|
try {
|
|
235
|
-
const transaction = yield repos.transaction.findInProgressById({ typeOf:
|
|
236
|
-
const paymentServiceType = params.paymentServiceType;
|
|
236
|
+
const transaction = yield repos.transaction.findInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
|
|
237
237
|
// 取引番号生成
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
});
|
|
238
|
+
let transactionNumber;
|
|
239
|
+
// support ticketToken(2024-08-21~)
|
|
240
|
+
const { permit } = yield (0, verifyTicketTokenAsNeeded_1.verifyTicketTokenAsNeeded)({ project, object: params.object, paymentServiceType, purpose })(repos);
|
|
241
|
+
const paymentMethodIdByPermit = permit === null || permit === void 0 ? void 0 : permit.identifier;
|
|
242
|
+
if (typeof paymentMethodIdByPermit === 'string') {
|
|
243
|
+
transactionNumber = paymentMethodIdByPermit;
|
|
244
|
+
}
|
|
245
|
+
if (typeof transactionNumber !== 'string') {
|
|
246
|
+
const publishTransactionNumberResult = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
247
|
+
transactionNumber = publishTransactionNumberResult.transactionNumber;
|
|
248
|
+
}
|
|
241
249
|
let result;
|
|
242
250
|
// URL発行
|
|
243
251
|
const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
|
|
@@ -79,9 +79,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
79
79
|
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
80
80
|
}
|
|
81
81
|
// プロダクトから通貨区分を取得
|
|
82
|
-
|
|
83
|
-
// await repos.product.findProductById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
84
|
-
const paymentCatdProduct = (yield repos.product.searchProducts({
|
|
82
|
+
const paymentCatdProduct = (yield repos.product.projectFields({
|
|
85
83
|
limit: 1,
|
|
86
84
|
page: 1,
|
|
87
85
|
id: { $eq: paymentServiceId },
|
|
@@ -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),
|
|
@@ -67,22 +67,26 @@ function onAuthorizationCreated(params) {
|
|
|
67
67
|
}
|
|
68
68
|
break;
|
|
69
69
|
case 'OwnershipInfo':
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
70
|
+
// 所有権に対する承認はいったん廃止したので、所有権のケースは処理不要(2024-08-21~)
|
|
71
|
+
reservationIds = [];
|
|
72
|
+
// const ownershipInfoId = authorization.object.id;
|
|
73
|
+
// if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
|
|
74
|
+
// const ownershipInfo = <Pick<factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>, 'id' | 'typeOfGood'>>
|
|
75
|
+
// await repos.ownershipInfo.projectFieldsById({ id: ownershipInfoId }, ['typeOfGood']);
|
|
76
|
+
// // 予約に対する所有権であれば発券
|
|
77
|
+
// if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
|
|
78
|
+
// || ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
|
|
79
|
+
// const reservationId = String(ownershipInfo.typeOfGood.id);
|
|
80
|
+
// reservationIds = [reservationId];
|
|
81
|
+
// const { reservationFor } = <{ reservationFor: { id: string } }>await repos.reservation.projectFieldsById<
|
|
82
|
+
// factory.reservationType.EventReservation | factory.reservationType.BusReservation
|
|
83
|
+
// >({
|
|
84
|
+
// id: reservationId,
|
|
85
|
+
// inclusion: ['reservationFor.id']
|
|
86
|
+
// });
|
|
87
|
+
// reservationForIds = [String(reservationFor.id)];
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
86
90
|
break;
|
|
87
91
|
default:
|
|
88
92
|
// no op
|
|
@@ -343,10 +343,10 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
343
343
|
const action = yield repos.action.start(deleteActionAttributes);
|
|
344
344
|
try {
|
|
345
345
|
// カタログからプロダクト検索
|
|
346
|
-
const productsWithCatalog = yield repos.product.
|
|
346
|
+
const productsWithCatalog = yield repos.product.projectFields({
|
|
347
347
|
project: { id: { $eq: params.project.id } },
|
|
348
348
|
hasOfferCatalog: { id: { $eq: catalogId } }
|
|
349
|
-
}, ['
|
|
349
|
+
}, ['id'], []);
|
|
350
350
|
let deleteEventResult;
|
|
351
351
|
let updateOfferResult;
|
|
352
352
|
if (productsWithCatalog.length > 0) {
|