@chevre/domain 21.4.0-alpha.3 → 21.4.0-alpha.31
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/cleanActions.ts +23 -0
- package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
- package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
- package/example/src/chevre/migrateEventOrganizer.ts +125 -0
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
- package/example/src/chevre/migrateReservationProvider.ts +119 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchPermissions.ts +7 -15
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.d.ts +25 -4
- package/lib/chevre/repo/event.js +122 -60
- package/lib/chevre/repo/member.d.ts +76 -1
- package/lib/chevre/repo/member.js +82 -20
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
- package/lib/chevre/repo/mongoose/schemas/member.js +12 -6
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/place.d.ts +57 -16
- package/lib/chevre/repo/place.js +112 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/seller.d.ts +18 -5
- package/lib/chevre/repo/seller.js +53 -46
- package/lib/chevre/repo/stockHolder.d.ts +2 -77
- package/lib/chevre/repo/stockHolder.js +200 -476
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
- package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +11 -0
- package/lib/chevre/service/event/createEvent.js +112 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +26 -26
- package/lib/chevre/service/iam.d.ts +5 -0
- package/lib/chevre/service/iam.js +7 -19
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +16 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +14 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +7 -7
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
- package/example/src/chevre/searchHoldReservations.ts +0 -38
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { MongoRepository as MemberRepo } from '../repo/member';
|
|
5
5
|
import { MongoRepository as RoleRepo } from '../repo/role';
|
|
6
|
+
import * as factory from '../factory';
|
|
6
7
|
export type IPermission = string;
|
|
7
8
|
/**
|
|
8
9
|
* プロジェクトメンバーの権限を検索する
|
|
@@ -13,6 +14,10 @@ export declare function searchPermissions(params: {
|
|
|
13
14
|
};
|
|
14
15
|
member: {
|
|
15
16
|
id: string;
|
|
17
|
+
memberOf: {
|
|
18
|
+
id: string;
|
|
19
|
+
typeOf: factory.organizationType.Corporation | factory.organizationType.Project;
|
|
20
|
+
};
|
|
16
21
|
};
|
|
17
22
|
}): (repos: {
|
|
18
23
|
member: MemberRepo;
|
|
@@ -18,30 +18,18 @@ function searchPermissions(params) {
|
|
|
18
18
|
let permissions = [];
|
|
19
19
|
const hasRole = yield repos.member.aggregateRoleNames({
|
|
20
20
|
project: { id: { $eq: params.project.id } },
|
|
21
|
-
member: {
|
|
21
|
+
member: {
|
|
22
|
+
id: { $eq: params.member.id },
|
|
23
|
+
memberOf: {
|
|
24
|
+
id: { $eq: params.member.memberOf.id },
|
|
25
|
+
typeOf: { $eq: params.member.memberOf.typeOf }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
22
28
|
});
|
|
23
29
|
if (hasRole.length > 0) {
|
|
24
30
|
permissions = yield repos.role.aggregatePermissions({ roleName: { $in: hasRole.map((r) => r.roleName) } });
|
|
25
31
|
}
|
|
26
32
|
return { hasRole, permissions };
|
|
27
|
-
// let permissions: IPermission[] = [];
|
|
28
|
-
// const projectMembers = await repos.member.search({
|
|
29
|
-
// project: { id: { $eq: params.project.id } },
|
|
30
|
-
// member: { id: { $eq: params.member.id } }
|
|
31
|
-
// });
|
|
32
|
-
// // 持っているロールを検索
|
|
33
|
-
// const roleNames = projectMembers.reduce<string[]>(
|
|
34
|
-
// (a, b) => [...a, ...(Array.isArray(b.member.hasRole)) ? b.member.hasRole.map((r) => r.roleName) : []],
|
|
35
|
-
// []
|
|
36
|
-
// );
|
|
37
|
-
// const roles = await repos.role.search({ roleName: { $in: roleNames } });
|
|
38
|
-
// // 権限をまとめる
|
|
39
|
-
// permissions = roles.reduce<string[]>(
|
|
40
|
-
// (a, b) => [...a, ...b.permissions],
|
|
41
|
-
// []
|
|
42
|
-
// );
|
|
43
|
-
// permissions = [...new Set(permissions)];
|
|
44
|
-
// return { roleNames, permissions };
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
35
|
exports.searchPermissions = searchPermissions;
|
|
@@ -322,7 +322,7 @@ function getIssuedThroughIdByAction(params) {
|
|
|
322
322
|
function createPermitServiceCredentials(params) {
|
|
323
323
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
324
324
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
325
|
-
const paymentCardService = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
325
|
+
const paymentCardService = yield repos.product.findById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
326
326
|
const permitServiceEndpoint = (_a = paymentCardService.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
327
327
|
const permitServiceAuthorizeServerDomain = (_c = (_b = paymentCardService.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
328
328
|
const permitServiceClientId = (_e = (_d = paymentCardService.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -67,7 +67,8 @@ function authorize(params) {
|
|
|
67
67
|
unitPriceOffers,
|
|
68
68
|
validateEvent: params.validateEvent === true,
|
|
69
69
|
validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
70
|
-
|
|
70
|
+
// 完全廃止(2023-07-19~)
|
|
71
|
+
// disablePendingReservations: params.disablePendingReservations,
|
|
71
72
|
useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber,
|
|
72
73
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
73
74
|
})(repos);
|
|
@@ -165,7 +166,10 @@ function processStartReserve4chevre(params) {
|
|
|
165
166
|
// requestBody = startParams;
|
|
166
167
|
const startParamObject = yield validateObjectWithoutDetail(startParams)(repos);
|
|
167
168
|
// 予約取引開始
|
|
168
|
-
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true,
|
|
169
|
+
const startReserveTransactionResult = yield ReserveTransactionService.start(Object.assign(Object.assign({}, startParams), { object: startParamObject, preSearchedEvent: event, preSearchedTicketOffers: params.ticketOffers, preSearchedUnitPriceOffers: params.unitPriceOffers, availableAtOrFrom: { id: params.availableAtOrFrom.id }, validateEvent: params.validateEvent, validateEventOfferPeriod: params.validateEventOfferPeriod, validateAppliesToMovieTicket: true,
|
|
170
|
+
// 完全廃止(2023-07-19~)
|
|
171
|
+
// disablePendingReservations: params.disablePendingReservations,
|
|
172
|
+
useHoldStockByTransactionNumber: params.useHoldStockByTransactionNumber, stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd }))(repos);
|
|
169
173
|
responseBody = startReserveTransactionResult.transaction;
|
|
170
174
|
// 予約取引からオファー情報を生成する
|
|
171
175
|
acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
|
|
@@ -18,7 +18,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
19
|
let catalogId;
|
|
20
20
|
if (typeof ((_a = params.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
21
|
-
const eventService = yield repos.product.findById({ id: (_b = params.itemOffered) === null || _b === void 0 ? void 0 : _b.id });
|
|
21
|
+
const eventService = yield repos.product.findById({ id: (_b = params.itemOffered) === null || _b === void 0 ? void 0 : _b.id }, ['hasOfferCatalog'], []);
|
|
22
22
|
if (typeof ((_c = eventService.hasOfferCatalog) === null || _c === void 0 ? void 0 : _c.id) === 'string') {
|
|
23
23
|
catalogId = eventService.hasOfferCatalog.id;
|
|
24
24
|
}
|
|
@@ -53,7 +53,21 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
53
53
|
let videoFormatTypes = [];
|
|
54
54
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
55
55
|
// 取得属性最適化(2023-01-25~)
|
|
56
|
-
const superEvent
|
|
56
|
+
// const superEvent: Pick<factory.event.IEvent<factory.eventType.ScreeningEventSeries>, 'soundFormat' | 'videoFormat'> =
|
|
57
|
+
// await repos.event.findById<factory.eventType.ScreeningEventSeries>(
|
|
58
|
+
// { id: event.superEvent.id },
|
|
59
|
+
// { soundFormat: 1, videoFormat: 1 }
|
|
60
|
+
// );
|
|
61
|
+
const superEvents = yield repos.event.search({
|
|
62
|
+
limit: 1,
|
|
63
|
+
page: 1,
|
|
64
|
+
id: { $eq: event.superEvent.id },
|
|
65
|
+
typeOf: factory.eventType.ScreeningEventSeries
|
|
66
|
+
}, { soundFormat: 1, videoFormat: 1 });
|
|
67
|
+
const superEvent = superEvents.shift();
|
|
68
|
+
if (superEvent === undefined) {
|
|
69
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
70
|
+
}
|
|
57
71
|
soundFormatTypes = (Array.isArray(superEvent.soundFormat)) ? superEvent.soundFormat.map((f) => f.typeOf) : [];
|
|
58
72
|
videoFormatTypes = (Array.isArray(superEvent.videoFormat)) ? superEvent.videoFormat.map((f) => f.typeOf) : [];
|
|
59
73
|
}
|
|
@@ -4,7 +4,7 @@ export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
4
4
|
export type IAcceptedOffer4COA = factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>;
|
|
5
5
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
6
6
|
acceptedOffers: factory.action.authorize.offer.seatReservation.IAcceptedOffer<factory.service.webAPI.Identifier.COA>[];
|
|
7
|
-
event:
|
|
7
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
8
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
9
9
|
}): factory.action.authorize.offer.seatReservation.IAttributes<WebAPIIdentifier.COA>;
|
|
10
10
|
/**
|
|
@@ -18,7 +18,7 @@ function searchProductOffers(params) {
|
|
|
18
18
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
var _a;
|
|
20
20
|
// プロダクト検索
|
|
21
|
-
const productWithOffers = yield repos.product.findById({ id: params.itemOffered.id });
|
|
21
|
+
const productWithOffers = yield repos.product.findById({ id: params.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
22
22
|
const offerCatalogId = (_a = productWithOffers.hasOfferCatalog) === null || _a === void 0 ? void 0 : _a.id;
|
|
23
23
|
if (typeof offerCatalogId !== 'string') {
|
|
24
24
|
return [];
|
|
@@ -14,6 +14,7 @@ const order_1 = require("../../factory/order");
|
|
|
14
14
|
const factory_1 = require("../delivery/factory");
|
|
15
15
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
16
16
|
const factory = require("../../factory");
|
|
17
|
+
// tslint:disable-next-line:max-func-body-length
|
|
17
18
|
function returnOrder(params) {
|
|
18
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
20
|
const orderNumber = params.object.orderNumber;
|
|
@@ -21,7 +22,12 @@ function returnOrder(params) {
|
|
|
21
22
|
? params.object.dateReturned
|
|
22
23
|
: new Date();
|
|
23
24
|
const returner = params.agent;
|
|
24
|
-
let order = yield repos.order.findByOrderNumber({
|
|
25
|
+
let order = yield repos.order.findByOrderNumber({
|
|
26
|
+
orderNumber,
|
|
27
|
+
project: { id: params.project.id },
|
|
28
|
+
inclusion: [],
|
|
29
|
+
exclusion: []
|
|
30
|
+
});
|
|
25
31
|
// プロジェクト条件検証
|
|
26
32
|
if (order.project.id !== params.project.id) {
|
|
27
33
|
throw new factory.errors.NotFound('Order');
|
|
@@ -59,6 +65,7 @@ function returnOrder(params) {
|
|
|
59
65
|
returnedOwnershipInfos = yield processReturnOrder(order, dateReturned)({ ownershipInfo: repos.ownershipInfo });
|
|
60
66
|
// 注文ステータス変更
|
|
61
67
|
order = yield repos.order.returnOrder({
|
|
68
|
+
project: { id: order.project.id },
|
|
62
69
|
orderNumber,
|
|
63
70
|
dateReturned,
|
|
64
71
|
returner
|
|
@@ -31,7 +31,12 @@ function sendOrder(params) {
|
|
|
31
31
|
orderNumber
|
|
32
32
|
})({ transaction: repos.transaction });
|
|
33
33
|
// 注文取得
|
|
34
|
-
let order = yield repos.order.findByOrderNumber({
|
|
34
|
+
let order = yield repos.order.findByOrderNumber({
|
|
35
|
+
orderNumber,
|
|
36
|
+
project: { id: params.project.id },
|
|
37
|
+
inclusion: [],
|
|
38
|
+
exclusion: []
|
|
39
|
+
});
|
|
35
40
|
// プロジェクト条件検証
|
|
36
41
|
if (order.project.id !== params.project.id) {
|
|
37
42
|
throw new factory.errors.NotFound('Order');
|
|
@@ -69,6 +74,7 @@ function sendOrder(params) {
|
|
|
69
74
|
return repos.ownershipInfo.createIfNotExistByIdentifier(ownershipInfo);
|
|
70
75
|
})));
|
|
71
76
|
order = yield repos.order.changeStatus({
|
|
77
|
+
project: { id: order.project.id },
|
|
72
78
|
orderNumber,
|
|
73
79
|
orderStatus: factory.orderStatus.OrderDelivered,
|
|
74
80
|
previousOrderStatus: factory.orderStatus.OrderProcessing
|
|
@@ -98,6 +104,7 @@ function sendOrder(params) {
|
|
|
98
104
|
// すでにOrderReturnedだった場合、OrderDelivered->OrderReturnedの処理自体は成功しているので、後処理を続行する
|
|
99
105
|
const currentOrder = yield repos.order.findByOrderNumber({
|
|
100
106
|
orderNumber: params.object.orderNumber,
|
|
107
|
+
project: { id: params.project.id },
|
|
101
108
|
inclusion: ['orderStatus'],
|
|
102
109
|
exclusion: []
|
|
103
110
|
});
|
|
@@ -521,7 +521,15 @@ function processChangeTransaction(params) {
|
|
|
521
521
|
function getGMOInfoFromSeller(params) {
|
|
522
522
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
523
523
|
var _a, _b, _c, _d;
|
|
524
|
-
const
|
|
524
|
+
const sellers = yield repos.seller.search({
|
|
525
|
+
limit: 1,
|
|
526
|
+
page: 1,
|
|
527
|
+
id: { $eq: String(params.seller.id) }
|
|
528
|
+
}, ['paymentAccepted', 'project'], []);
|
|
529
|
+
const seller = sellers.shift();
|
|
530
|
+
if (seller === undefined) {
|
|
531
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
532
|
+
}
|
|
525
533
|
const paymentAccepted = (_a = seller.paymentAccepted) === null || _a === void 0 ? void 0 : _a.some((a) => a.paymentMethodType === params.paymentMethodType);
|
|
526
534
|
if (paymentAccepted !== true) {
|
|
527
535
|
throw new factory.errors.Argument('transaction', 'payment not accepted');
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as surfrock from '@surfrock/sdk';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
+
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
4
|
export declare function createSeatInfoSyncIn(params: {
|
|
4
5
|
paymentMethodType: string;
|
|
5
6
|
paymentMethodId: string;
|
|
6
7
|
movieTickets: factory.action.trade.pay.IMovieTicket[];
|
|
7
|
-
event: factory.
|
|
8
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
8
9
|
purpose: factory.action.trade.pay.IPurpose;
|
|
9
10
|
seller: Pick<factory.seller.ISeller, 'paymentAccepted'>;
|
|
10
11
|
credentials: {
|
|
@@ -52,7 +52,15 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
52
52
|
if (typeof sellerId !== 'string') {
|
|
53
53
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const sellers = yield repos.seller.search({
|
|
56
|
+
limit: 1,
|
|
57
|
+
page: 1,
|
|
58
|
+
id: { $eq: sellerId }
|
|
59
|
+
}, ['paymentAccepted', 'project'], []);
|
|
60
|
+
const seller = sellers.shift();
|
|
61
|
+
if (seller === undefined) {
|
|
62
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
63
|
+
}
|
|
56
64
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
57
65
|
if (paymentAccepted !== true) {
|
|
58
66
|
throw new factory.errors.Argument('recipient', 'payment not accepted');
|
|
@@ -27,6 +27,7 @@ const onRefund_1 = require("./any/onRefund");
|
|
|
27
27
|
/**
|
|
28
28
|
* MovieTicket認証
|
|
29
29
|
*/
|
|
30
|
+
// tslint:disable-next-line:max-func-body-length
|
|
30
31
|
function checkMovieTicket(params) {
|
|
31
32
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -58,7 +59,15 @@ function checkMovieTicket(params) {
|
|
|
58
59
|
id: eventIds[0]
|
|
59
60
|
});
|
|
60
61
|
// ショップ情報取得
|
|
61
|
-
const
|
|
62
|
+
const sellers = yield repos.seller.search({
|
|
63
|
+
limit: 1,
|
|
64
|
+
page: 1,
|
|
65
|
+
id: { $eq: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id }
|
|
66
|
+
}, ['paymentAccepted', 'project'], []);
|
|
67
|
+
const seller = sellers.shift();
|
|
68
|
+
if (seller === undefined) {
|
|
69
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
70
|
+
}
|
|
62
71
|
const paymentAccepted = (_f = seller.paymentAccepted) === null || _f === void 0 ? void 0 : _f.some((a) => a.paymentMethodType === paymentMethodType);
|
|
63
72
|
if (paymentAccepted !== true) {
|
|
64
73
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
@@ -302,7 +311,15 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
302
311
|
// イベント取得属性最適化(2023-01-23~)
|
|
303
312
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
304
313
|
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
305
|
-
const
|
|
314
|
+
const sellers = yield repos.seller.search({
|
|
315
|
+
limit: 1,
|
|
316
|
+
page: 1,
|
|
317
|
+
id: { $eq: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) }
|
|
318
|
+
}, ['paymentAccepted', 'project'], []);
|
|
319
|
+
const seller = sellers.shift();
|
|
320
|
+
if (seller === undefined) {
|
|
321
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
322
|
+
}
|
|
306
323
|
// 全購入管理番号のMovieTicketをマージ
|
|
307
324
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
308
325
|
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
@@ -75,9 +75,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
75
75
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
76
76
|
}
|
|
77
77
|
// プロダクトから通貨区分を取得
|
|
78
|
-
const paymentCatdProduct = yield repos.product.findById({
|
|
79
|
-
id: paymentServiceId
|
|
80
|
-
});
|
|
78
|
+
const paymentCatdProduct = yield repos.product.findById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
81
79
|
const currency = (_e = (_d = paymentCatdProduct.serviceOutput) === null || _d === void 0 ? void 0 : _d.amount) === null || _e === void 0 ? void 0 : _e.currency;
|
|
82
80
|
if (typeof currency !== 'string') {
|
|
83
81
|
throw new factory.errors.NotFound('product.serviceOutput.amount.currency');
|
|
@@ -23,22 +23,15 @@ function cancelPendingReservation(actionAttributes) {
|
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
var _a;
|
|
25
25
|
const now = new Date();
|
|
26
|
-
|
|
26
|
+
const canceledReservations = [];
|
|
27
27
|
const { reserveTransaction } = yield cancelPengindIfNotYet(actionAttributes, now)(repos);
|
|
28
28
|
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
29
29
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
30
30
|
// Pendingが存在しない場合は検索しても無駄(2023-06-05~)
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
typeOf: factory.reservationType.EventReservation
|
|
36
|
-
});
|
|
37
|
-
canceledReservations = canceledReservations.map((r) => {
|
|
38
|
-
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
39
|
-
delete r._id;
|
|
40
|
-
return r;
|
|
41
|
-
});
|
|
33
|
+
// 完全廃止(2023-07-19~)
|
|
34
|
+
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
37
|
yield (0, onReservationCanceled_1.onReservationCanceled)(canceledReservations, false, {
|
|
@@ -48,7 +41,7 @@ function cancelPendingReservation(actionAttributes) {
|
|
|
48
41
|
});
|
|
49
42
|
}
|
|
50
43
|
exports.cancelPendingReservation = cancelPendingReservation;
|
|
51
|
-
function cancelPengindIfNotYet(params,
|
|
44
|
+
function cancelPengindIfNotYet(params, __) {
|
|
52
45
|
// tslint:disable-next-line:max-func-body-length
|
|
53
46
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
47
|
const actionAttributes = params;
|
|
@@ -83,7 +76,7 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
83
76
|
// アクション開始
|
|
84
77
|
const action = yield repos.action.start(actionAttributes);
|
|
85
78
|
const actionObject = actionAttributes.object;
|
|
86
|
-
let cancelResult;
|
|
79
|
+
// let cancelResult: ICancelResult | undefined;
|
|
87
80
|
try {
|
|
88
81
|
if (reserveTransaction !== undefined) {
|
|
89
82
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
@@ -126,12 +119,8 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
126
119
|
// disablePendingReservationsの場合は処理不要(2023-06-05~)
|
|
127
120
|
}
|
|
128
121
|
else {
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
reservationNumber: actionObject.reservationNumber,
|
|
132
|
-
previousReservationStatus: actionObject.reservationStatus,
|
|
133
|
-
modifiedTime: now
|
|
134
|
-
});
|
|
122
|
+
// 完全廃止(2023-07-19~)
|
|
123
|
+
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
135
124
|
}
|
|
136
125
|
}
|
|
137
126
|
else {
|
|
@@ -152,17 +141,15 @@ function cancelPengindIfNotYet(params, now) {
|
|
|
152
141
|
throw error;
|
|
153
142
|
}
|
|
154
143
|
// アクション完了
|
|
155
|
-
const actionResult =
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
} : undefined
|
|
144
|
+
const actionResult = {
|
|
145
|
+
// ...(cancelResult !== undefined) ? {
|
|
146
|
+
// cancelResult: {
|
|
147
|
+
// matchedCount: cancelResult.matchedCount,
|
|
148
|
+
// modifiedCount: cancelResult.modifiedCount
|
|
149
|
+
// }
|
|
150
|
+
// } : undefined
|
|
164
151
|
// canceledReservationId: canceledReservation?.id
|
|
165
|
-
|
|
152
|
+
};
|
|
166
153
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
167
154
|
}
|
|
168
155
|
return { reserveTransaction };
|
|
@@ -51,7 +51,7 @@ exports.confirmReservation = confirmReservation;
|
|
|
51
51
|
function reserveIfNotYet(params, options) {
|
|
52
52
|
// tslint:disable-next-line:max-func-body-length
|
|
53
53
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
var _a;
|
|
54
|
+
var _a, _b;
|
|
55
55
|
const reservationPackage = params.object;
|
|
56
56
|
// 冪等性を担保(2023-05-31~)
|
|
57
57
|
debug('searching completed reserveAction... byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
@@ -97,50 +97,34 @@ function reserveIfNotYet(params, options) {
|
|
|
97
97
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
98
98
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
99
99
|
const subReservations = reserveTransaction.object.subReservation;
|
|
100
|
-
|
|
100
|
+
const issuedThrough = reserveTransaction.object.issuedThrough;
|
|
101
|
+
if (Array.isArray(subReservations)
|
|
102
|
+
&& typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) === 'string'
|
|
103
|
+
&& typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') {
|
|
101
104
|
// confirmManyに変更(2023-06-13~)
|
|
102
105
|
const confirmManyIfNotExistResult = yield repos.reservation.confirmManyIfNotExist({
|
|
106
|
+
provider: (typeof ((_b = reserveTransaction.object.provider) === null || _b === void 0 ? void 0 : _b.id) === 'string')
|
|
107
|
+
? reserveTransaction.object.provider
|
|
108
|
+
: { id: reserveTransaction.agent.id, typeOf: factory.organizationType.Corporation },
|
|
103
109
|
subReservation: subReservations,
|
|
110
|
+
issuedThrough,
|
|
104
111
|
reservationFor,
|
|
105
112
|
underName,
|
|
106
|
-
broker: reserveTransaction.object.broker
|
|
107
|
-
issuedThrough: reserveTransaction.object.issuedThrough
|
|
113
|
+
broker: reserveTransaction.object.broker
|
|
108
114
|
});
|
|
109
115
|
debug('confirmManyIfNotExistResult:', confirmManyIfNotExistResult, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
110
|
-
// await Promise.all(subReservations.map(async (subReservation) => {
|
|
111
|
-
// await repos.reservation.confirmByIdIfNotExist({
|
|
112
|
-
// reservation: subReservation,
|
|
113
|
-
// reservationFor,
|
|
114
|
-
// underName,
|
|
115
|
-
// broker: reserveTransaction.object.broker,
|
|
116
|
-
// issuedThrough: reserveTransaction.object.issuedThrough
|
|
117
|
-
// });
|
|
118
|
-
// }));
|
|
119
116
|
}
|
|
120
117
|
}
|
|
121
118
|
else {
|
|
122
|
-
//
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
underName,
|
|
127
|
-
broker: reserveTransaction.object.broker,
|
|
128
|
-
issuedThrough: reserveTransaction.object.issuedThrough
|
|
129
|
-
});
|
|
119
|
+
// 旧予約取引に対して本処理が走る可能性がなくはないが、
|
|
120
|
+
// それらについては実質Confirmedの予約はすでに存在するはずなので、何もしない
|
|
121
|
+
// 完全廃止(2023-07-19~)
|
|
122
|
+
// throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
130
123
|
}
|
|
131
124
|
}
|
|
132
125
|
else {
|
|
133
126
|
// 廃止(2023-01-18)
|
|
134
127
|
throw new factory.errors.Forbidden(`${reservationPackage.typeOf} not acceptable`);
|
|
135
|
-
// 予約を確定状態に変更する
|
|
136
|
-
// await repos.reservation.confirm<factory.reservationType.EventReservation>({
|
|
137
|
-
// id: reservation.id,
|
|
138
|
-
// previousReservationStatus: reservation.reservationStatus,
|
|
139
|
-
// underName: reservation.underName
|
|
140
|
-
// });
|
|
141
|
-
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
142
|
-
// delete (<any>reservation)._id;
|
|
143
|
-
// confirmedReservations.push(reservation);
|
|
144
128
|
}
|
|
145
129
|
}
|
|
146
130
|
catch (error) {
|
|
@@ -26,8 +26,10 @@ function verifyToken4reservation(params) {
|
|
|
26
26
|
case factory.order.OrderType.Order:
|
|
27
27
|
// reservationIdを含む注文の存在を確認するだけでよい(2023-01-31~)
|
|
28
28
|
const order = yield repos.order.findByOrderNumberAndReservationId({
|
|
29
|
+
project: { id: params.project.id },
|
|
29
30
|
orderNumber: payload.orderNumber,
|
|
30
|
-
reservationId: params.reservationId
|
|
31
|
+
reservationId: params.reservationId,
|
|
32
|
+
seller: params.seller
|
|
31
33
|
});
|
|
32
34
|
// ステータス検証
|
|
33
35
|
switch (order.orderStatus) {
|
|
@@ -4,4 +4,4 @@ export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
|
4
4
|
/**
|
|
5
5
|
* タスク実行関数
|
|
6
6
|
*/
|
|
7
|
-
export declare function call(data: factory.task.
|
|
7
|
+
export declare function call(data: factory.task.createEvent.IData): IOperation<void>;
|
|
@@ -10,14 +10,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const action_1 = require("../../repo/action");
|
|
14
|
+
const event_1 = require("../../repo/event");
|
|
13
15
|
const place_1 = require("../../repo/place");
|
|
16
|
+
const task_1 = require("../../repo/task");
|
|
17
|
+
const EventService = require("../event");
|
|
14
18
|
/**
|
|
15
19
|
* タスク実行関数
|
|
16
20
|
*/
|
|
17
21
|
function call(data) {
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield EventService.createEvent(data)({
|
|
24
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
25
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
26
|
+
place: new place_1.MongoRepository(settings.connection),
|
|
27
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
28
|
+
});
|
|
21
29
|
});
|
|
22
30
|
}
|
|
23
31
|
exports.call = call;
|
|
@@ -28,7 +28,15 @@ const CodeService = require("../code");
|
|
|
28
28
|
*/
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: params.seller.id }
|
|
35
|
+
}, ['name', 'typeOf'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const passport = yield (0, validation_1.validateWaiterPassport)(params);
|
|
33
41
|
// 金額をfix
|
|
34
42
|
const amount = params.object.amount;
|
|
@@ -112,7 +112,7 @@ function getCreditCardPaymentServiceChannel(params) {
|
|
|
112
112
|
throw new factory.errors.NotFound('PaymentService');
|
|
113
113
|
}
|
|
114
114
|
// IDで検索いないとavailableChannelを取得できない
|
|
115
|
-
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) });
|
|
115
|
+
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) }, ['availableChannel'], []);
|
|
116
116
|
const availableChannel = paymentService === null || paymentService === void 0 ? void 0 : paymentService.availableChannel;
|
|
117
117
|
if (typeof (availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.serviceUrl) !== 'string') {
|
|
118
118
|
throw new factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
|
|
@@ -29,12 +29,15 @@ exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
var _a;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: params.seller.id }
|
|
36
|
+
}, ['name', 'project', 'typeOf', 'makesOffer'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
38
41
|
let makesOfferFromClient;
|
|
39
42
|
// 販売者オファー検証(2022-10-14~)
|
|
40
43
|
if (params.validateSeller === true) {
|
|
@@ -29,9 +29,15 @@ function start(params) {
|
|
|
29
29
|
const now = new Date();
|
|
30
30
|
const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
|
|
31
31
|
// sellerはorderから自動取得
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: String(orders[0].seller.id) }
|
|
36
|
+
}, ['name', 'project', 'hasMerchantReturnPolicy', 'typeOf'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
35
41
|
yield validateOrder({ orders })(repos);
|
|
36
42
|
let offers = [];
|
|
37
43
|
if (offerIds.length > 0) {
|