@chevre/domain 20.2.0-alpha.9 → 20.2.0
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/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +116 -0
- package/example/src/chevre/attendIfNotAttended.ts +22 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +209 -0
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +20 -0
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +27 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +1 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +2 -2
- package/example/src/chevre/processReserve.ts +2 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -4
- package/example/src/chevre/searchEvents.ts +20 -41
- package/example/src/chevre/searchOffersByCatalog.ts +27 -0
- package/example/src/chevre/updateTransaction.ts +38 -0
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +77 -1
- package/lib/chevre/repo/action.js +249 -6
- package/lib/chevre/repo/aggregation.d.ts +38 -0
- package/lib/chevre/repo/aggregation.js +68 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/code.d.ts +13 -16
- package/lib/chevre/repo/code.js +33 -19
- package/lib/chevre/repo/creativeWork.js +13 -12
- package/lib/chevre/repo/event.d.ts +64 -17
- package/lib/chevre/repo/event.js +456 -156
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +4 -3
- package/lib/chevre/repo/mongoose/model/offer.js +2 -1
- package/lib/chevre/repo/mongoose/model/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/offer.d.ts +10 -0
- package/lib/chevre/repo/offer.js +47 -16
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +53 -7
- package/lib/chevre/repo/place.d.ts +26 -1
- package/lib/chevre/repo/place.js +216 -12
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +7 -1
- package/lib/chevre/repo/project.js +15 -6
- package/lib/chevre/repo/reservation.d.ts +7 -8
- package/lib/chevre/repo/reservation.js +181 -76
- package/lib/chevre/repo/task.d.ts +31 -4
- package/lib/chevre/repo/task.js +146 -33
- package/lib/chevre/repo/transaction.d.ts +57 -5
- package/lib/chevre/repo/transaction.js +228 -34
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +72 -60
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
- package/lib/chevre/service/aggregation/system.d.ts +100 -0
- package/lib/chevre/service/aggregation/system.js +409 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +0 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/registerService.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +84 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +38 -6
- package/lib/chevre/service/assetTransaction/reserve.js +120 -94
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +2 -3
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/product/factory.js +9 -3
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +35 -14
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -7
- package/lib/chevre/service/offer/event/authorize.js +33 -87
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.d.ts +3 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +14 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +95 -53
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
- package/lib/chevre/service/offer/factory.js +10 -3
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +7 -2
- package/lib/chevre/service/offer.d.ts +13 -2
- package/lib/chevre/service/offer.js +68 -46
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +23 -26
- package/lib/chevre/service/order/returnOrder.js +6 -4
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/payment/any.d.ts +9 -0
- package/lib/chevre/service/payment/any.js +16 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/product.js +5 -3
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +32 -35
- package/lib/chevre/service/reserve/useReservation.d.ts +0 -3
- package/lib/chevre/service/reserve/useReservation.js +58 -33
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/task/returnPayTransaction.js +10 -4
- package/lib/chevre/service/task.js +6 -9
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -6
- package/lib/chevre/service/transaction/placeOrder.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +3 -8
- package/lib/chevre/service/transaction/placeOrderInProgress.js +92 -107
- package/lib/chevre/service/transaction/returnOrder.js +8 -6
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +20 -12
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.d.ts +0 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.js +0 -65
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
3
|
+
exports.createPendingReservationAction = exports.createPotentialActions = exports.createReservation = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 予約取引ファクトリー
|
|
6
6
|
*/
|
|
@@ -468,7 +468,10 @@ function createPotentialActions(params) {
|
|
|
468
468
|
underName
|
|
469
469
|
}));
|
|
470
470
|
});
|
|
471
|
-
const reservationPackage = Object.assign({ reservationFor, reservationNumber: pendingReservations[0].reservationNumber, reservationStatus: pendingReservations[0].reservationStatus,
|
|
471
|
+
const reservationPackage = Object.assign({ reservationFor, reservationNumber: pendingReservations[0].reservationNumber, reservationStatus: pendingReservations[0].reservationStatus,
|
|
472
|
+
// 不要なので廃止(2023-01-19~)
|
|
473
|
+
// subReservation: pendingReservations,
|
|
474
|
+
typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string') ? { underName } : undefined);
|
|
472
475
|
reserveActionAttributes = [{
|
|
473
476
|
project: transaction.project,
|
|
474
477
|
typeOf: factory.actionType.ReserveAction,
|
|
@@ -550,3 +553,31 @@ function createMoneyTransferActions(params) {
|
|
|
550
553
|
}
|
|
551
554
|
return moneyTransfer;
|
|
552
555
|
}
|
|
556
|
+
function createPendingReservationAction(params) {
|
|
557
|
+
const transaction = params.transaction;
|
|
558
|
+
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
559
|
+
let cancelActionAttributes = [];
|
|
560
|
+
if (pendingReservations.length > 0) {
|
|
561
|
+
const reservationFor = transaction.object.reservationFor;
|
|
562
|
+
if (reservationFor === undefined) {
|
|
563
|
+
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
564
|
+
}
|
|
565
|
+
// ReservationPackageに対応(2022-12-23~)
|
|
566
|
+
const reservationPackage = {
|
|
567
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
568
|
+
reservationNumber: transaction.transactionNumber,
|
|
569
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
570
|
+
reservationStatus: pendingReservations[0].reservationStatus
|
|
571
|
+
};
|
|
572
|
+
cancelActionAttributes = [{
|
|
573
|
+
project: transaction.project,
|
|
574
|
+
typeOf: factory.actionType.CancelAction,
|
|
575
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
576
|
+
agent: transaction.project,
|
|
577
|
+
object: reservationPackage,
|
|
578
|
+
potentialActions: {}
|
|
579
|
+
}];
|
|
580
|
+
}
|
|
581
|
+
return cancelActionAttributes;
|
|
582
|
+
}
|
|
583
|
+
exports.createPendingReservationAction = createPendingReservationAction;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
3
|
+
declare function validateStartRequest(params: {
|
|
4
|
+
object: factory.assetTransaction.reserve.IObjectWithoutDetail;
|
|
5
|
+
event: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
|
|
6
|
+
validateEventOfferPeriod?: boolean;
|
|
7
|
+
validateEvent?: boolean;
|
|
8
|
+
now: Date;
|
|
9
|
+
store?: {
|
|
10
|
+
/**
|
|
11
|
+
* 販売アプリケーションID
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
}): void;
|
|
16
|
+
export { validateStartRequest };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateStartRequest = void 0;
|
|
4
|
+
const moment = require("moment");
|
|
5
|
+
const factory = require("../../../factory");
|
|
6
|
+
function validateStartRequest(params) {
|
|
7
|
+
var _a;
|
|
8
|
+
const now = params.now;
|
|
9
|
+
const event = params.event;
|
|
10
|
+
if (params.validateEventOfferPeriod === true) {
|
|
11
|
+
if (typeof ((_a = params.store) === null || _a === void 0 ? void 0 : _a.id) !== 'string') {
|
|
12
|
+
throw new factory.errors.NotFound('store.id');
|
|
13
|
+
}
|
|
14
|
+
validateEventOfferPeriod({ event, now, availableAt: { id: params.store.id } });
|
|
15
|
+
}
|
|
16
|
+
if (params.validateEvent === true) {
|
|
17
|
+
validateEvent({ event, object: params.object });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.validateStartRequest = validateStartRequest;
|
|
21
|
+
/**
|
|
22
|
+
* イベントのオファー有効期間を検証する
|
|
23
|
+
*/
|
|
24
|
+
function validateEventOfferPeriod(params) {
|
|
25
|
+
const acceptedDate = moment(params.now);
|
|
26
|
+
const eventOffers = params.event.offers;
|
|
27
|
+
// アプリケーションごとの設定を参照する(2022-11-19~)
|
|
28
|
+
const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
|
|
29
|
+
return Array.isArray(offer.availableAtOrFrom) && offer.availableAtOrFrom[0].id === params.availableAt.id;
|
|
30
|
+
});
|
|
31
|
+
if (makesOfferOnApplication === undefined) {
|
|
32
|
+
throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${params.availableAt.id}`);
|
|
33
|
+
}
|
|
34
|
+
const validFrom = makesOfferOnApplication.validFrom;
|
|
35
|
+
const validThrough = makesOfferOnApplication.validThrough;
|
|
36
|
+
// const validFrom = eventOffers?.validFrom;
|
|
37
|
+
// const validThrough = eventOffers?.validThrough;
|
|
38
|
+
if (validFrom !== undefined && validFrom !== null) {
|
|
39
|
+
if (acceptedDate.isBefore(moment(validFrom))) {
|
|
40
|
+
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid from ${validFrom}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (validThrough !== undefined && validThrough !== null) {
|
|
44
|
+
if (acceptedDate.isAfter(moment(validThrough))) {
|
|
45
|
+
throw new factory.errors.Argument('reservationFor.id', `Offer of ${params.event.id} is valid through ${validThrough}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* イベントの上限座席数を検証する
|
|
51
|
+
*/
|
|
52
|
+
function validateEvent(params) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
// const acceptedDate = moment(params.now);
|
|
55
|
+
const eventOffers = params.event.offers;
|
|
56
|
+
// const validFrom = eventOffers?.validFrom;
|
|
57
|
+
// const validThrough = eventOffers?.validThrough;
|
|
58
|
+
// if (validFrom !== undefined && validFrom !== null) {
|
|
59
|
+
// if (acceptedDate.isBefore(moment(validFrom))) {
|
|
60
|
+
// throw new factory.errors.Argument(
|
|
61
|
+
// 'reservationFor.id',
|
|
62
|
+
// `Offer of ${params.event.id} is valid from ${validFrom}`
|
|
63
|
+
// );
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
// if (validThrough !== undefined && validThrough !== null) {
|
|
67
|
+
// if (acceptedDate.isAfter(moment(validThrough))) {
|
|
68
|
+
// throw new factory.errors.Argument(
|
|
69
|
+
// 'reservationFor.id',
|
|
70
|
+
// `Offer of ${params.event.id} is valid through ${validThrough}`
|
|
71
|
+
// );
|
|
72
|
+
// }
|
|
73
|
+
// }
|
|
74
|
+
// イベントのmaxValueを検証
|
|
75
|
+
const maxValue = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.eligibleQuantity) === null || _a === void 0 ? void 0 : _a.maxValue;
|
|
76
|
+
if (typeof maxValue === 'number') {
|
|
77
|
+
const numAcceptedOffers = (_b = params.object.acceptedOffer) === null || _b === void 0 ? void 0 : _b.length;
|
|
78
|
+
if (typeof numAcceptedOffers === 'number' && numAcceptedOffers > 0) {
|
|
79
|
+
if (numAcceptedOffers > maxValue) {
|
|
80
|
+
throw new factory.errors.Argument('reservationFor.id', `Maximum number of offers exceeded`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
3
|
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
4
|
-
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
|
+
import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../repo/event';
|
|
5
5
|
import { RedisRepository as ScreeningEventAvailabilityRepo } from '../../repo/itemAvailability/screeningEvent';
|
|
6
6
|
import { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
7
7
|
import { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalog';
|
|
@@ -54,16 +54,47 @@ export declare type ITaskAndTransactionOperation<T> = (repos: {
|
|
|
54
54
|
task: TaskRepo;
|
|
55
55
|
assetTransaction: AssetTransactionRepo;
|
|
56
56
|
}) => Promise<T>;
|
|
57
|
-
|
|
57
|
+
interface IConfirmRepo {
|
|
58
|
+
action: ActionRepo;
|
|
58
59
|
assetTransaction: AssetTransactionRepo;
|
|
59
60
|
order: OrderRepo;
|
|
60
|
-
|
|
61
|
+
reservation: ReservationRepo;
|
|
62
|
+
task: TaskRepo;
|
|
63
|
+
}
|
|
64
|
+
export declare type IConfirmOperation<T> = (repos: IConfirmRepo) => Promise<T>;
|
|
65
|
+
declare type IStartParams = factory.assetTransaction.reserve.IStartParamsWithoutDetail & {
|
|
66
|
+
/**
|
|
67
|
+
* 承認アクションを介した場合に検索済のイベント
|
|
68
|
+
*/
|
|
69
|
+
preSearchedEvent?: IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>;
|
|
70
|
+
/**
|
|
71
|
+
* 承認アクションを介した場合に検索済のオファーリスト
|
|
72
|
+
*/
|
|
73
|
+
preSearchedTicketOffers?: factory.product.ITicketOffer[];
|
|
74
|
+
/**
|
|
75
|
+
* 承認アクションを介した場合に検索済の単価オファーリスト
|
|
76
|
+
*/
|
|
77
|
+
preSearchedUnitPriceOffers?: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
78
|
+
/**
|
|
79
|
+
* 販売アプリケーション
|
|
80
|
+
*/
|
|
81
|
+
availableAtOrFrom?: {
|
|
82
|
+
id?: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* イベントの販売期間を検証するかどうか
|
|
86
|
+
*/
|
|
87
|
+
validateEventOfferPeriod: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* イベントのオファー(最大予約座席数)を検証するかどうか
|
|
90
|
+
*/
|
|
91
|
+
validateEvent: boolean;
|
|
92
|
+
validateAppliesToMovieTicket: boolean;
|
|
93
|
+
};
|
|
61
94
|
/**
|
|
62
95
|
* 取引開始
|
|
63
96
|
*/
|
|
64
|
-
export declare function start(params: factory.assetTransaction.
|
|
65
|
-
validateAppliesToMovieTicket: boolean;
|
|
66
|
-
}): IStartOperation<factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>>;
|
|
97
|
+
export declare function start(params: IStartParams): IStartOperation<factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>>;
|
|
67
98
|
/**
|
|
68
99
|
* 取引確定
|
|
69
100
|
*/
|
|
@@ -81,3 +112,4 @@ export declare function cancel(params: {
|
|
|
81
112
|
export declare function exportTasksById(params: {
|
|
82
113
|
id: string;
|
|
83
114
|
}): ITaskAndTransactionOperation<factory.task.ITask<factory.taskName>[]>;
|
|
115
|
+
export {};
|
|
@@ -18,19 +18,42 @@ const pecorinoapi = require("../../pecorinoapi");
|
|
|
18
18
|
const factory = require("../../factory");
|
|
19
19
|
const OfferService = require("../offer");
|
|
20
20
|
const cancelReservation_1 = require("../reserve/cancelReservation");
|
|
21
|
+
const confirmReservation_1 = require("../reserve/confirmReservation");
|
|
21
22
|
const settings_1 = require("../../settings");
|
|
22
23
|
const factory_1 = require("./reserve/factory");
|
|
24
|
+
const validateStartRequest_1 = require("./reserve/validateStartRequest");
|
|
23
25
|
/**
|
|
24
26
|
* 取引開始
|
|
25
27
|
*/
|
|
26
28
|
function start(params) {
|
|
27
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
var _a;
|
|
30
|
+
var _a, _b, _c, _d, _e;
|
|
31
|
+
const now = new Date();
|
|
29
32
|
// 自動発行廃止(2022-05-17~)
|
|
30
33
|
const reservationNumber = params.transactionNumber;
|
|
31
34
|
if (typeof reservationNumber !== 'string' || reservationNumber.length === 0) {
|
|
32
35
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
33
36
|
}
|
|
37
|
+
// eventをfix
|
|
38
|
+
if (typeof ((_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id) !== 'string' || params.object.reservationFor.id.length === 0) {
|
|
39
|
+
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
40
|
+
}
|
|
41
|
+
let event;
|
|
42
|
+
if (typeof ((_b = params.preSearchedEvent) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') {
|
|
43
|
+
event = params.preSearchedEvent;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
event = yield repos.event.findMinimizedIndividualEventById({ id: params.object.reservationFor.id });
|
|
47
|
+
}
|
|
48
|
+
// validationを承認アクション開始前から移行(2023-01-27~)
|
|
49
|
+
(0, validateStartRequest_1.validateStartRequest)({
|
|
50
|
+
object: params.object,
|
|
51
|
+
event,
|
|
52
|
+
validateEventOfferPeriod: params.validateEventOfferPeriod,
|
|
53
|
+
validateEvent: params.validateEvent,
|
|
54
|
+
now,
|
|
55
|
+
store: { id: (_c = params.availableAtOrFrom) === null || _c === void 0 ? void 0 : _c.id }
|
|
56
|
+
});
|
|
34
57
|
const startParams = (0, factory_1.createStartParams)(Object.assign(Object.assign({}, params), { reservationNumber: reservationNumber }));
|
|
35
58
|
// 取引作成
|
|
36
59
|
let transaction;
|
|
@@ -46,10 +69,14 @@ function start(params) {
|
|
|
46
69
|
throw error;
|
|
47
70
|
}
|
|
48
71
|
// 指定があれば予約追加
|
|
49
|
-
if (typeof ((
|
|
72
|
+
if (typeof ((_d = params.object.reservationFor) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
|
|
50
73
|
transaction = yield addReservations({
|
|
51
74
|
id: transaction.id,
|
|
52
75
|
object: params.object,
|
|
76
|
+
event,
|
|
77
|
+
preSearchedTicketOffers: params.preSearchedTicketOffers,
|
|
78
|
+
preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
|
|
79
|
+
availableAtOrFrom: { id: (_e = params.availableAtOrFrom) === null || _e === void 0 ? void 0 : _e.id },
|
|
53
80
|
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
|
|
54
81
|
})(repos);
|
|
55
82
|
}
|
|
@@ -63,45 +90,58 @@ exports.start = start;
|
|
|
63
90
|
function addReservations(params) {
|
|
64
91
|
// tslint:disable-next-line:max-func-body-length
|
|
65
92
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
var _a
|
|
93
|
+
var _a;
|
|
67
94
|
const now = new Date();
|
|
68
95
|
let transaction = yield repos.assetTransaction.findById({ typeOf: factory.assetTransactionType.Reserve, id: params.id });
|
|
69
|
-
// イベント存在確認
|
|
70
|
-
if (typeof ((_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id) !== 'string' || params.object.reservationFor.id.length === 0) {
|
|
71
|
-
throw new factory.errors.ArgumentNull('object.reservationFor.id');
|
|
72
|
-
}
|
|
73
96
|
const acceptedOffers = (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer : [];
|
|
74
|
-
const event =
|
|
75
|
-
// 予約データに不要な属性は取得しない
|
|
76
|
-
aggregateReservation: 0, aggregateOffer: 0, attendeeCount: 0,
|
|
77
|
-
checkInCount: 0, maximumAttendeeCapacity: 0, remainingAttendeeCapacity: 0
|
|
78
|
-
});
|
|
97
|
+
const event = params.event;
|
|
79
98
|
if (event.typeOf !== factory.eventType.ScreeningEvent && event.typeOf !== factory.eventType.Event) {
|
|
80
99
|
throw new factory.errors.Argument('object.reservationFor.id', `invalid event type ${event.typeOf}`);
|
|
81
100
|
}
|
|
82
101
|
if (event.typeOf === factory.eventType.ScreeningEvent || event.typeOf === factory.eventType.Event) {
|
|
83
102
|
validateEvent({ now, event });
|
|
84
103
|
}
|
|
85
|
-
//
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
94
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
95
|
-
});
|
|
96
|
-
}
|
|
104
|
+
// 受け入れたオファーIDだけ取得する(2023-01-26~)
|
|
105
|
+
const acceptedOfferIds = [...new Set(acceptedOffers.map((o) => String(o.id)))];
|
|
106
|
+
let ticketOffers;
|
|
107
|
+
let availableOffers;
|
|
108
|
+
// 承認アクションを介した予約取引開始時の冗長なオファー検索処理について最適化(2023-01-27~)
|
|
109
|
+
if (Array.isArray(params.preSearchedTicketOffers) && Array.isArray(params.preSearchedUnitPriceOffers)) {
|
|
110
|
+
ticketOffers = params.preSearchedTicketOffers;
|
|
111
|
+
availableOffers = params.preSearchedUnitPriceOffers;
|
|
97
112
|
}
|
|
98
113
|
else {
|
|
99
|
-
|
|
114
|
+
// イベントオファー検索
|
|
115
|
+
const searchEventTicketOffersResult = yield OfferService.event.searchEventTicketOffers({
|
|
116
|
+
ids: acceptedOfferIds,
|
|
117
|
+
event: { id: event.id },
|
|
118
|
+
// 対応アプリケーション条件追加(2023-01-27~)
|
|
119
|
+
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
120
|
+
sort: false,
|
|
121
|
+
validateOfferRateLimit: true
|
|
122
|
+
})(repos);
|
|
123
|
+
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
124
|
+
availableOffers = searchEventTicketOffersResult.unitPriceOffers;
|
|
100
125
|
}
|
|
126
|
+
// 冗長なfindOffersByOfferCatalogId処理を削除(2023-01-26~)
|
|
127
|
+
// let availableOffers: factory.unitPriceOffer.IUnitPriceOffer[] = [];
|
|
128
|
+
// // 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
129
|
+
// const eventOffers = <factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
130
|
+
// if (typeof eventOffers?.itemOffered?.id === 'string') {
|
|
131
|
+
// const eventService = <factory.product.IProduct>await repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
132
|
+
// if (typeof eventService.hasOfferCatalog?.id === 'string') {
|
|
133
|
+
// availableOffers = await repos.offer.findOffersByOfferCatalogId({
|
|
134
|
+
// offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
135
|
+
// });
|
|
136
|
+
// }
|
|
137
|
+
// } else {
|
|
138
|
+
// throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
139
|
+
// }
|
|
101
140
|
const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event: { id: event.id } })(repos);
|
|
102
141
|
// 仮予約作成
|
|
103
142
|
const { acceptedOffers4transactionObject, objectSubReservations } = yield createAcceptedOffers4transactionObject({
|
|
104
|
-
acceptedOffers,
|
|
143
|
+
acceptedOffers,
|
|
144
|
+
ticketOffers,
|
|
105
145
|
availableOffers, now,
|
|
106
146
|
event, availableSeatOffers,
|
|
107
147
|
transaction,
|
|
@@ -215,10 +255,10 @@ function createAcceptedOffers4transactionObject(params) {
|
|
|
215
255
|
return { acceptedOffers4transactionObject, objectSubReservations };
|
|
216
256
|
});
|
|
217
257
|
}
|
|
218
|
-
// tslint:disable-next-line:max-func-body-length
|
|
219
258
|
function createReservations4transactionObject(params) {
|
|
259
|
+
// tslint:disable-next-line:max-func-body-length
|
|
220
260
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
221
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
261
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
222
262
|
// 予約番号
|
|
223
263
|
const reservationNumber = params.transaction.object.reservationNumber;
|
|
224
264
|
if (typeof reservationNumber !== 'string') {
|
|
@@ -258,18 +298,22 @@ function createReservations4transactionObject(params) {
|
|
|
258
298
|
const additionalProperty = (0, factory_1.createAdditionalProperty)({ acceptedOffer });
|
|
259
299
|
// 座席指定であれば、座席タイプチャージを検索する
|
|
260
300
|
const seatPriceComponent = [];
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (Array.isArray(
|
|
272
|
-
|
|
301
|
+
// 区分加算料金を適用しないオプションを追加(2023-01-26~)
|
|
302
|
+
const ignoreCategoryCodeChargeSpec = ((_c = ticketType.settings) === null || _c === void 0 ? void 0 : _c.ignoreCategoryCodeChargeSpec) === true;
|
|
303
|
+
if (!ignoreCategoryCodeChargeSpec) {
|
|
304
|
+
const seatSection = (_d = reservedTicket.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection;
|
|
305
|
+
const seatNumber = (_e = reservedTicket.ticketedSeat) === null || _e === void 0 ? void 0 : _e.seatNumber;
|
|
306
|
+
if (typeof seatSection === 'string' && typeof seatNumber === 'string') {
|
|
307
|
+
const offersOnSeat = (_f = params.availableSeatOffers.find((o) => {
|
|
308
|
+
var _a;
|
|
309
|
+
return o.branchCode === seatNumber && ((_a = o.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode) === seatSection;
|
|
310
|
+
})) === null || _f === void 0 ? void 0 : _f.offers;
|
|
311
|
+
if (Array.isArray(offersOnSeat)) {
|
|
312
|
+
const availableSeatOffer = offersOnSeat[0];
|
|
313
|
+
const seatPriceSpecs = (_g = availableSeatOffer === null || availableSeatOffer === void 0 ? void 0 : availableSeatOffer.priceSpecification) === null || _g === void 0 ? void 0 : _g.priceComponent;
|
|
314
|
+
if (Array.isArray(seatPriceSpecs)) {
|
|
315
|
+
seatPriceComponent.push(...seatPriceSpecs);
|
|
316
|
+
}
|
|
273
317
|
}
|
|
274
318
|
}
|
|
275
319
|
}
|
|
@@ -280,7 +324,7 @@ function createReservations4transactionObject(params) {
|
|
|
280
324
|
if (Array.isArray(availableAddOns) && Array.isArray(acceptedAddOnParams)) {
|
|
281
325
|
acceptedAddOns = availableAddOns.filter((availableAddOn) => acceptedAddOnParams.some((acceptedAddOn) => availableAddOn.id === acceptedAddOn.id));
|
|
282
326
|
}
|
|
283
|
-
const subReservation = (
|
|
327
|
+
const subReservation = (_j = (_h = acceptedOffer.itemOffered) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.subReservation;
|
|
284
328
|
const reservationId = `${reservationNumber}-${reservationIndex}`;
|
|
285
329
|
reservations.push((0, factory_1.createReservation)({
|
|
286
330
|
project: params.transaction.project,
|
|
@@ -299,7 +343,7 @@ function createReservations4transactionObject(params) {
|
|
|
299
343
|
subReservation: subReservation,
|
|
300
344
|
programMembershipUsed,
|
|
301
345
|
availableOffer: ticketType,
|
|
302
|
-
appliesToMovieTicket: (
|
|
346
|
+
appliesToMovieTicket: (_k = acceptedOffer.priceSpecification) === null || _k === void 0 ? void 0 : _k.appliesToMovieTicket,
|
|
303
347
|
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket
|
|
304
348
|
}));
|
|
305
349
|
}
|
|
@@ -537,7 +581,8 @@ function onReservationsCreated(params) {
|
|
|
537
581
|
// 集計タスク
|
|
538
582
|
yield OfferService.createAggregateScreeningEventIfNotExist({
|
|
539
583
|
project: params.event.project,
|
|
540
|
-
reservationFor: { id: params.event.id }
|
|
584
|
+
reservationFor: [{ id: params.event.id }],
|
|
585
|
+
force: false
|
|
541
586
|
})({ task: repos.task });
|
|
542
587
|
});
|
|
543
588
|
}
|
|
@@ -571,8 +616,14 @@ function confirm(params) {
|
|
|
571
616
|
typeOf: factory.assetTransactionType.Reserve,
|
|
572
617
|
id: transaction.id,
|
|
573
618
|
result: result,
|
|
574
|
-
potentialActions:
|
|
619
|
+
potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
620
|
+
? { reserve: [] }
|
|
621
|
+
: potentialActions
|
|
575
622
|
});
|
|
623
|
+
if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
624
|
+
// sync対応(2023-01-13~)
|
|
625
|
+
yield (0, confirmReservation_1.confirmReservation)(potentialActions.reserve)(repos);
|
|
626
|
+
}
|
|
576
627
|
});
|
|
577
628
|
}
|
|
578
629
|
exports.confirm = confirm;
|
|
@@ -614,34 +665,9 @@ function cancel(params) {
|
|
|
614
665
|
});
|
|
615
666
|
// 本来非同期でタスクが実行されるが、同期的に仮予約取消が実行されていないと、サービス利用側が困る可能性があるので、
|
|
616
667
|
// 同期的にもcancelPendingReservationを実行しておく
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
if (pendingReservations.length > 0) {
|
|
621
|
-
const reservationFor = transaction.object.reservationFor;
|
|
622
|
-
if (reservationFor === undefined) {
|
|
623
|
-
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
624
|
-
}
|
|
625
|
-
// ReservationPackageに対応(2022-12-23~)
|
|
626
|
-
const reservationPackage = {
|
|
627
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
628
|
-
reservationNumber: transaction.transactionNumber,
|
|
629
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
630
|
-
reservationStatus: pendingReservations[0].reservationStatus
|
|
631
|
-
};
|
|
632
|
-
cancelActionAttributes = [{
|
|
633
|
-
project: transaction.project,
|
|
634
|
-
typeOf: factory.actionType.CancelAction,
|
|
635
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id },
|
|
636
|
-
agent: transaction.project,
|
|
637
|
-
object: reservationPackage,
|
|
638
|
-
potentialActions: {}
|
|
639
|
-
}];
|
|
640
|
-
yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
catch (error) {
|
|
644
|
-
// no op
|
|
668
|
+
const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
669
|
+
if (cancelActionAttributes.length > 0) {
|
|
670
|
+
yield (0, cancelReservation_1.cancelPendingReservation)(cancelActionAttributes)(repos);
|
|
645
671
|
}
|
|
646
672
|
});
|
|
647
673
|
}
|
|
@@ -704,29 +730,29 @@ function exportTasksById(params) {
|
|
|
704
730
|
}
|
|
705
731
|
break;
|
|
706
732
|
case factory.transactionStatusType.Canceled:
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
if (reservationFor === undefined) {
|
|
713
|
-
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
714
|
-
}
|
|
715
|
-
// ReservationPackageに対応(2022-12-23~)
|
|
716
|
-
const reservationPackage = {
|
|
717
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
718
|
-
reservationNumber: transaction.transactionNumber,
|
|
719
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
720
|
-
reservationStatus: pendingReservations[0].reservationStatus
|
|
721
|
-
};
|
|
722
|
-
cancelActionAttributes = [{
|
|
733
|
+
// sync対応(2023-01-13~)
|
|
734
|
+
if (!settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
735
|
+
const cancelActionAttributes4canceled = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
736
|
+
if (cancelActionAttributes4canceled.length > 0) {
|
|
737
|
+
const cancelPendingReservationTask = {
|
|
723
738
|
project: transaction.project,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
739
|
+
name: factory.taskName.CancelPendingReservation,
|
|
740
|
+
status: factory.taskStatus.Ready,
|
|
741
|
+
runsAt: new Date(),
|
|
742
|
+
remainingNumberOfTries: 10,
|
|
743
|
+
numberOfTried: 0,
|
|
744
|
+
executionResults: [],
|
|
745
|
+
data: {
|
|
746
|
+
actionAttributes: cancelActionAttributes4canceled
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
taskAttributes.push(cancelPendingReservationTask);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
break;
|
|
753
|
+
case factory.transactionStatusType.Expired:
|
|
754
|
+
const cancelActionAttributes = (0, factory_1.createPendingReservationAction)({ transaction });
|
|
755
|
+
if (cancelActionAttributes.length > 0) {
|
|
730
756
|
const cancelPendingReservationTask = {
|
|
731
757
|
project: transaction.project,
|
|
732
758
|
name: factory.taskName.CancelPendingReservation,
|
|
@@ -33,4 +33,4 @@ export declare function exportTasks<T extends factory.assetTransactionType>(para
|
|
|
33
33
|
project: ProjectRepo;
|
|
34
34
|
task: TaskRepo;
|
|
35
35
|
assetTransaction: AssetTransactionRepo;
|
|
36
|
-
}) => Promise<(import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task
|
|
36
|
+
}) => Promise<(import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/deleteAssetTransaction").ITask | import("@chevre/factory/lib/task/deleteAuthorization").ITask | import("@chevre/factory/lib/task/deleteOrder").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/deleteMember").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask)[] | undefined>;
|
|
@@ -2,7 +2,6 @@ import { MongoRepository as ActionRepo } from '../repo/action';
|
|
|
2
2
|
import { MongoRepository as AuthorizationRepo } from '../repo/code';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
export declare type IToken = string;
|
|
5
|
-
export declare type IData = any;
|
|
6
5
|
export declare type ICode = string;
|
|
7
6
|
/**
|
|
8
7
|
* 承認を削除する
|
|
@@ -24,7 +23,7 @@ export declare function getToken(params: {
|
|
|
24
23
|
}): (repos: {
|
|
25
24
|
authorization: AuthorizationRepo;
|
|
26
25
|
}) => Promise<IToken>;
|
|
27
|
-
export declare function verifyToken
|
|
26
|
+
export declare function verifyToken(params: {
|
|
28
27
|
project: {
|
|
29
28
|
id: string;
|
|
30
29
|
};
|
|
@@ -33,4 +32,4 @@ export declare function verifyToken<T>(params: {
|
|
|
33
32
|
audience?: string[];
|
|
34
33
|
}): (repos: {
|
|
35
34
|
action?: ActionRepo;
|
|
36
|
-
}) => Promise<
|
|
35
|
+
}) => Promise<factory.authorization.IObject>;
|
|
@@ -4,5 +4,5 @@ export declare type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factor
|
|
|
4
4
|
* 注文から所有権を作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createOwnershipInfosFromOrder(params: {
|
|
7
|
-
order: factory.order.IOrder
|
|
7
|
+
order: Pick<factory.order.IOrder, 'acceptedOffers' | 'orderDate' | 'project' | 'customer' | 'orderNumber' | 'seller'>;
|
|
8
8
|
}): IOwnershipInfo[];
|
|
@@ -5,6 +5,7 @@ const moment = require("moment");
|
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
6
|
const MAX_OWNED_THROUGH = '3000-01-01T00:00:00Z';
|
|
7
7
|
function createProductOwnershipInfo(params) {
|
|
8
|
+
var _a, _b;
|
|
8
9
|
let ownershipInfo;
|
|
9
10
|
let ownedThrough;
|
|
10
11
|
// どういう期間でいくらのオファーなのか
|
|
@@ -48,9 +49,14 @@ function createProductOwnershipInfo(params) {
|
|
|
48
49
|
throw new factory.errors.NotFound('Order.acceptedOffers.priceSpecification.referenceQuantity.value');
|
|
49
50
|
}
|
|
50
51
|
const itemOffered = params.acceptedOffer.itemOffered;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
// 最適化(2023-02-01~)
|
|
53
|
+
const issuedThrough = (typeof ((_a = itemOffered.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
54
|
+
? Object.assign({ id: itemOffered.issuedThrough.id, typeOf: itemOffered.issuedThrough.typeOf }, (typeof ((_b = itemOffered.issuedThrough.serviceType) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
55
|
+
? { serviceType: itemOffered.issuedThrough.serviceType }
|
|
56
|
+
: undefined) : undefined;
|
|
57
|
+
const typeOfGood = Object.assign(Object.assign(Object.assign({
|
|
58
|
+
// project: itemOffered.project, // 最適化(2023-02-01~)
|
|
59
|
+
identifier: itemOffered.identifier, typeOf: itemOffered.typeOf }, (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') ? { issuedThrough } : undefined), (itemOffered.validFor !== undefined) ? { validFor: itemOffered.validFor } : undefined), (itemOffered.name !== undefined) ? { name: itemOffered.name } : undefined);
|
|
54
60
|
ownershipInfo = {
|
|
55
61
|
project: params.project,
|
|
56
62
|
typeOf: 'OwnershipInfo',
|
|
@@ -3,6 +3,7 @@ import { MongoRepository as CategoryCodeRepo } from '../repo/categoryCode';
|
|
|
3
3
|
import { MongoRepository as EventRepo } from '../repo/event';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../repo/place';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
6
|
+
import { MongoRepository as SellerRepo } from '../repo/seller';
|
|
6
7
|
import { MongoRepository as TaskRepo } from '../repo/task';
|
|
7
8
|
import * as factory from '../factory';
|
|
8
9
|
/**
|
|
@@ -32,6 +33,7 @@ export declare function importFromCOA(params: {
|
|
|
32
33
|
categoryCode: CategoryCodeRepo;
|
|
33
34
|
event: EventRepo;
|
|
34
35
|
place: PlaceRepo;
|
|
36
|
+
seller: SellerRepo;
|
|
35
37
|
}) => Promise<void>;
|
|
36
38
|
/**
|
|
37
39
|
* COA情報からイベントIDを作成する
|
|
@@ -49,10 +51,6 @@ export declare function updateEvent4ttts(params: {
|
|
|
49
51
|
* 旧イベントID
|
|
50
52
|
*/
|
|
51
53
|
oldEventId: string;
|
|
52
|
-
/**
|
|
53
|
-
* 旧IDを使用しない場合、IDは自動発行される
|
|
54
|
-
*/
|
|
55
|
-
useOldEventId: boolean;
|
|
56
54
|
/**
|
|
57
55
|
* イベント属性
|
|
58
56
|
*/
|