@chevre/domain 20.2.0-alpha.3 → 20.2.0-alpha.30
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 +104 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEvents.ts +20 -40
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +58 -0
- package/lib/chevre/repo/action.js +187 -0
- package/lib/chevre/repo/aggregation.d.ts +36 -0
- package/lib/chevre/repo/aggregation.js +66 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/event.d.ts +47 -13
- package/lib/chevre/repo/event.js +386 -113
- 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/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/place.d.ts +15 -1
- package/lib/chevre/repo/place.js +175 -10
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +4 -1
- package/lib/chevre/repo/project.js +9 -10
- package/lib/chevre/repo/reservation.d.ts +0 -6
- package/lib/chevre/repo/reservation.js +106 -66
- package/lib/chevre/repo/task.d.ts +31 -3
- package/lib/chevre/repo/task.js +141 -27
- package/lib/chevre/repo/transaction.d.ts +35 -0
- package/lib/chevre/repo/transaction.js +163 -0
- 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.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +40 -15
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +3 -1
- package/lib/chevre/service/aggregation/system.d.ts +86 -0
- package/lib/chevre/service/aggregation/system.js +345 -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 +2 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- 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.d.ts +7 -2
- package/lib/chevre/service/assetTransaction/reserve.js +43 -56
- package/lib/chevre/service/delivery/factory.js +1 -0
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +34 -13
- package/lib/chevre/service/offer/event/authorize.js +5 -1
- 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/factory.js +25 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +124 -9
- 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.js +36 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/payment/any.d.ts +5 -0
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/useReservation.js +2 -1
- 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.js +6 -9
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
|
@@ -67,34 +67,42 @@ function addOffers2Seat(params) {
|
|
|
67
67
|
*/
|
|
68
68
|
function searchEventSeatOffers(params) {
|
|
69
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
var _a, _b, _c, _d, _e;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
71
71
|
let offers = [];
|
|
72
|
-
|
|
72
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
73
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
|
|
74
|
+
// id: params.event.id
|
|
75
|
+
// });
|
|
76
|
+
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
73
77
|
id: params.event.id
|
|
74
78
|
});
|
|
75
79
|
// 座席指定利用可能かどうか
|
|
76
|
-
const eventOffers =
|
|
80
|
+
const eventOffers = event.offers;
|
|
77
81
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
78
82
|
if (reservedSeatsAvailable) {
|
|
79
83
|
// 座席タイプ価格仕様を検索
|
|
80
84
|
const priceSpecs = yield repos.priceSpecification.search({
|
|
81
|
-
project: { id: { $eq:
|
|
85
|
+
project: { id: { $eq: event.project.id } },
|
|
82
86
|
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
83
87
|
appliesToCategoryCode: {
|
|
84
88
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
85
89
|
}
|
|
86
90
|
});
|
|
91
|
+
// const roomBranchCode = event.location.branchCode;
|
|
92
|
+
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
93
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
94
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
87
95
|
const seats = yield repos.place.searchSeats({
|
|
88
|
-
project: { id: { $eq:
|
|
89
|
-
branchCode: { $in: (
|
|
96
|
+
project: { id: { $eq: event.project.id } },
|
|
97
|
+
branchCode: { $in: (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in },
|
|
90
98
|
containedInPlace: {
|
|
91
99
|
branchCode: {
|
|
92
|
-
$in: (
|
|
100
|
+
$in: (_j = (_h = params.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$in
|
|
93
101
|
},
|
|
94
102
|
containedInPlace: {
|
|
95
|
-
branchCode: { $eq:
|
|
103
|
+
branchCode: { $eq: roomBranchCode },
|
|
96
104
|
containedInPlace: {
|
|
97
|
-
branchCode: { $eq:
|
|
105
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
98
106
|
}
|
|
99
107
|
}
|
|
100
108
|
},
|
|
@@ -114,7 +122,7 @@ function searchEventSeatOffers(params) {
|
|
|
114
122
|
offers = seats.map((seat, index) => {
|
|
115
123
|
var _a;
|
|
116
124
|
return addOffers2Seat({
|
|
117
|
-
project:
|
|
125
|
+
project: event.project,
|
|
118
126
|
seat: seat,
|
|
119
127
|
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
120
128
|
unavailableOffers: [],
|
|
@@ -133,33 +141,41 @@ exports.searchEventSeatOffers = searchEventSeatOffers;
|
|
|
133
141
|
*/
|
|
134
142
|
function searchEventSeatOffersWithPaging(params) {
|
|
135
143
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
var _a, _b, _c, _d, _e, _f;
|
|
144
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
137
145
|
let offers = [];
|
|
138
|
-
|
|
146
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
147
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
|
|
148
|
+
// id: params.event.id
|
|
149
|
+
// });
|
|
150
|
+
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
139
151
|
id: params.event.id
|
|
140
152
|
});
|
|
141
153
|
// 座席指定利用可能かどうか
|
|
142
|
-
const eventOffers =
|
|
154
|
+
const eventOffers = event.offers;
|
|
143
155
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
144
156
|
if (reservedSeatsAvailable) {
|
|
145
157
|
// 座席タイプ価格仕様を検索
|
|
146
158
|
const priceSpecs = yield repos.priceSpecification.search({
|
|
147
|
-
project: { id: { $eq:
|
|
159
|
+
project: { id: { $eq: event.project.id } },
|
|
148
160
|
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
149
161
|
appliesToCategoryCode: {
|
|
150
162
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
151
163
|
}
|
|
152
164
|
});
|
|
153
|
-
const
|
|
165
|
+
// const roomBranchCode = event.location.branchCode;
|
|
166
|
+
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
167
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
168
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
169
|
+
const seats = yield repos.place.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
154
170
|
branchCode: {
|
|
155
|
-
$eq: (typeof ((
|
|
156
|
-
? (
|
|
171
|
+
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
172
|
+
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
|
157
173
|
: undefined
|
|
158
174
|
},
|
|
159
175
|
containedInPlace: {
|
|
160
|
-
branchCode: { $eq:
|
|
176
|
+
branchCode: { $eq: roomBranchCode },
|
|
161
177
|
containedInPlace: {
|
|
162
|
-
branchCode: { $eq:
|
|
178
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
163
179
|
}
|
|
164
180
|
}
|
|
165
181
|
} }));
|
|
@@ -177,7 +193,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
177
193
|
offers = seats.map((seat, index) => {
|
|
178
194
|
var _a;
|
|
179
195
|
return addOffers2Seat({
|
|
180
|
-
project:
|
|
196
|
+
project: event.project,
|
|
181
197
|
seat: seat,
|
|
182
198
|
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
183
199
|
unavailableOffers: [],
|
|
@@ -184,7 +184,8 @@ function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
|
184
184
|
const chevreReservationNumbers = (Array.isArray(params.order.acceptedOffers))
|
|
185
185
|
? params.order.acceptedOffers.filter((o) => {
|
|
186
186
|
var _a;
|
|
187
|
-
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
187
|
+
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
188
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
188
189
|
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.Chevre;
|
|
189
190
|
})
|
|
190
191
|
.map((o) => {
|
|
@@ -271,7 +271,8 @@ function createReturnReserveTransactionTasks(order, simpleOrder) {
|
|
|
271
271
|
// 注文アイテムから返却アクションを作成する
|
|
272
272
|
const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
|
|
273
273
|
for (const acceptedOffer of acceptedOffers) {
|
|
274
|
-
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
274
|
+
if (acceptedOffer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
275
|
+
|| acceptedOffer.itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
275
276
|
const reservation = acceptedOffer.itemOffered;
|
|
276
277
|
const reservationNumber = reservation.reservationNumber;
|
|
277
278
|
// 予約番号ごとに返却アクションを作成する
|
|
@@ -41,6 +41,22 @@ function createOrder(params) {
|
|
|
41
41
|
: undefined) });
|
|
42
42
|
return Object.assign(Object.assign({}, o), { itemOffered });
|
|
43
43
|
}
|
|
44
|
+
else if (o.itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
45
|
+
let itemOffered = o.itemOffered;
|
|
46
|
+
const reservationFor = itemOffered.reservationFor;
|
|
47
|
+
itemOffered = Object.assign(Object.assign({}, itemOffered), { reservationFor: Object.assign(Object.assign(Object.assign({}, reservationFor), (reservationFor.arrivalTime !== undefined)
|
|
48
|
+
? {
|
|
49
|
+
arrivalTime: moment(reservationFor.arrivalTime)
|
|
50
|
+
.toDate()
|
|
51
|
+
}
|
|
52
|
+
: undefined), (reservationFor.departureTime !== undefined)
|
|
53
|
+
? {
|
|
54
|
+
departureTime: moment(reservationFor.departureTime)
|
|
55
|
+
.toDate()
|
|
56
|
+
}
|
|
57
|
+
: undefined) });
|
|
58
|
+
return Object.assign(Object.assign({}, o), { itemOffered });
|
|
59
|
+
}
|
|
44
60
|
else {
|
|
45
61
|
return o;
|
|
46
62
|
}
|
|
@@ -47,7 +47,12 @@ declare function invalidatePaymentUrl(params: factory.task.IData<factory.taskNam
|
|
|
47
47
|
*/
|
|
48
48
|
declare function processVoidPayTransaction(params: factory.task.IData<factory.taskName.VoidPayTransaction>): (repos: {
|
|
49
49
|
action: ActionRepo;
|
|
50
|
+
accountingReport: AccountingReportRepo;
|
|
50
51
|
assetTransaction: AssetTransactionRepo;
|
|
52
|
+
product: ProductRepo;
|
|
53
|
+
project: ProjectRepo;
|
|
54
|
+
seller: SellerRepo;
|
|
55
|
+
task: TaskRepo;
|
|
51
56
|
transaction: TransactionRepo;
|
|
52
57
|
}) => Promise<void>;
|
|
53
58
|
interface IAuthorizeRepos {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
|
-
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
|
+
import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../repo/event';
|
|
4
4
|
import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
6
6
|
import { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
@@ -50,7 +50,7 @@ declare function checkMovieTicket(params: factory.action.check.paymentMethod.mov
|
|
|
50
50
|
declare function checkByIdentifier(params: {
|
|
51
51
|
movieTickets: IMovieTicket[];
|
|
52
52
|
seller: factory.seller.ISeller;
|
|
53
|
-
screeningEvent:
|
|
53
|
+
screeningEvent: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
54
54
|
paymentServiceId: string;
|
|
55
55
|
}): (repos: {
|
|
56
56
|
product: ProductRepo;
|
|
@@ -53,7 +53,11 @@ function checkMovieTicket(params) {
|
|
|
53
53
|
}
|
|
54
54
|
// イベント情報取得
|
|
55
55
|
let screeningEvent;
|
|
56
|
-
|
|
56
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
57
|
+
// screeningEvent = await repos.event.findById<factory.eventType.ScreeningEvent>({
|
|
58
|
+
// id: eventIds[0]
|
|
59
|
+
// });
|
|
60
|
+
screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
57
61
|
id: eventIds[0]
|
|
58
62
|
});
|
|
59
63
|
// ショップ情報取得
|
|
@@ -432,7 +436,9 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
432
436
|
if (eventIds.length !== 1) {
|
|
433
437
|
throw new factory.errors.Argument('movieTickets', 'Number of events must be 1');
|
|
434
438
|
}
|
|
435
|
-
|
|
439
|
+
// イベント取得属性最適化(2023-01-23~)
|
|
440
|
+
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
441
|
+
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
436
442
|
const seller = yield repos.seller.findById({ id: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) });
|
|
437
443
|
// 全購入管理番号のMovieTicketをマージ
|
|
438
444
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
@@ -37,17 +37,14 @@ function confirmReservation(actionAttributesList) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
+
// 廃止(2023-01-18)
|
|
41
|
+
throw new factory.errors.Forbidden(`${reservation.typeOf} not acceptable`);
|
|
40
42
|
// 予約を確定状態に変更する
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
previousReservationStatus: reservation.reservationStatus,
|
|
47
|
-
underName: reservation.underName
|
|
48
|
-
// issuedThroughは予約取引開始時に確定しているので更新不要(2022-12-21~)
|
|
49
|
-
// reservedTicket: reservation.reservedTicket
|
|
50
|
-
});
|
|
43
|
+
// await repos.reservation.confirm<factory.reservationType.EventReservation>({
|
|
44
|
+
// id: reservation.id,
|
|
45
|
+
// previousReservationStatus: reservation.reservationStatus,
|
|
46
|
+
// underName: reservation.underName
|
|
47
|
+
// });
|
|
51
48
|
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
52
49
|
// delete (<any>reservation)._id;
|
|
53
50
|
// confirmedReservations.push(reservation);
|
|
@@ -37,7 +37,8 @@ function verifyToken4reservation(params) {
|
|
|
37
37
|
}
|
|
38
38
|
const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
|
|
39
39
|
const reservationExistsInOrder = acceptedOffers.some((offer) => {
|
|
40
|
-
return offer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
40
|
+
return (offer.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
41
|
+
|| offer.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
41
42
|
&& offer.itemOffered.id === params.reservationId;
|
|
42
43
|
});
|
|
43
44
|
if (!reservationExistsInOrder) {
|
|
@@ -10,9 +10,15 @@ 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 accountingReport_1 = require("../../repo/accountingReport");
|
|
13
14
|
const action_1 = require("../../repo/action");
|
|
14
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const event_1 = require("../../repo/event");
|
|
15
17
|
const order_1 = require("../../repo/order");
|
|
18
|
+
const product_1 = require("../../repo/product");
|
|
19
|
+
const project_1 = require("../../repo/project");
|
|
20
|
+
const seller_1 = require("../../repo/seller");
|
|
21
|
+
const task_1 = require("../../repo/task");
|
|
16
22
|
const PayTransactionService = require("../assetTransaction/pay");
|
|
17
23
|
/**
|
|
18
24
|
* タスク実行関数
|
|
@@ -22,6 +28,12 @@ function call(data) {
|
|
|
22
28
|
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
23
29
|
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
24
30
|
const orderRepo = new order_1.MongoRepository(settings.connection);
|
|
31
|
+
const accountingReportRepo = new accountingReport_1.MongoRepository(settings.connection);
|
|
32
|
+
const eventRepo = new event_1.MongoRepository(settings.connection);
|
|
33
|
+
const productRepo = new product_1.MongoRepository(settings.connection);
|
|
34
|
+
const projectRepo = new project_1.MongoRepository(settings.connection);
|
|
35
|
+
const sellerRepo = new seller_1.MongoRepository(settings.connection);
|
|
36
|
+
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
25
37
|
// アクション開始
|
|
26
38
|
const action = yield actionRepo.start(data);
|
|
27
39
|
try {
|
|
@@ -38,8 +50,15 @@ function call(data) {
|
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
52
|
})({
|
|
53
|
+
action: actionRepo,
|
|
54
|
+
accountingReport: accountingReportRepo,
|
|
41
55
|
assetTransaction: assetTransactionRepo,
|
|
42
|
-
|
|
56
|
+
event: eventRepo,
|
|
57
|
+
order: orderRepo,
|
|
58
|
+
product: productRepo,
|
|
59
|
+
project: projectRepo,
|
|
60
|
+
seller: sellerRepo,
|
|
61
|
+
task: taskRepo
|
|
43
62
|
});
|
|
44
63
|
}
|
|
45
64
|
}
|
|
@@ -3,6 +3,8 @@ import * as factory from '../../factory';
|
|
|
3
3
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
4
|
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
5
5
|
import { MongoRepository as OrderRepo } from '../../repo/order';
|
|
6
|
+
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
7
|
+
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
6
8
|
/**
|
|
7
9
|
* タスク実行関数
|
|
8
10
|
*/
|
|
@@ -14,4 +16,6 @@ export declare function confirmReserveTransaction(params: factory.action.interac
|
|
|
14
16
|
action: ActionRepo;
|
|
15
17
|
assetTransaction: AssetTransactionRepo;
|
|
16
18
|
order: OrderRepo;
|
|
19
|
+
reservation: ReservationRepo;
|
|
20
|
+
task: TaskRepo;
|
|
17
21
|
}) => Promise<void>;
|
|
@@ -15,6 +15,8 @@ const factory = require("../../factory");
|
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
17
17
|
const order_1 = require("../../repo/order");
|
|
18
|
+
const reservation_1 = require("../../repo/reservation");
|
|
19
|
+
const task_1 = require("../../repo/task");
|
|
18
20
|
const ReserveTransactionService = require("../assetTransaction/reserve");
|
|
19
21
|
const credentials_1 = require("../../credentials");
|
|
20
22
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
@@ -29,7 +31,9 @@ function call(data) {
|
|
|
29
31
|
yield confirmReserveTransaction(data)({
|
|
30
32
|
action: new action_1.MongoRepository(settings.connection),
|
|
31
33
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
32
|
-
order: new order_1.MongoRepository(settings.connection)
|
|
34
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
35
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
36
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
33
37
|
});
|
|
34
38
|
});
|
|
35
39
|
}
|
|
@@ -44,9 +48,6 @@ function confirmReserveTransaction(params) {
|
|
|
44
48
|
const action = yield repos.action.start(confirmActionAttributes);
|
|
45
49
|
try {
|
|
46
50
|
let object = confirmActionAttributes.object;
|
|
47
|
-
// if (params.instrument === undefined) {
|
|
48
|
-
// params.instrument = { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.Chevre };
|
|
49
|
-
// }
|
|
50
51
|
switch (params.instrument.identifier) {
|
|
51
52
|
case factory.service.webAPI.Identifier.COA:
|
|
52
53
|
// COA本予約
|
|
@@ -72,7 +73,6 @@ function confirmReserveTransaction(params) {
|
|
|
72
73
|
object = object;
|
|
73
74
|
yield ReserveTransactionService.confirm({
|
|
74
75
|
transactionNumber: object.transactionNumber,
|
|
75
|
-
// object: object.object,
|
|
76
76
|
potentialActions: object.potentialActions
|
|
77
77
|
})(repos);
|
|
78
78
|
}
|
|
@@ -14,6 +14,7 @@ const action_1 = require("../../repo/action");
|
|
|
14
14
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
15
15
|
const event_1 = require("../../repo/event");
|
|
16
16
|
const place_1 = require("../../repo/place");
|
|
17
|
+
const seller_1 = require("../../repo/seller");
|
|
17
18
|
const EventService = require("../event");
|
|
18
19
|
/**
|
|
19
20
|
* タスク実行関数
|
|
@@ -24,7 +25,8 @@ function call(data) {
|
|
|
24
25
|
action: new action_1.MongoRepository(settings.connection),
|
|
25
26
|
categoryCode: new categoryCode_1.MongoRepository(settings.connection),
|
|
26
27
|
event: new event_1.MongoRepository(settings.connection),
|
|
27
|
-
place: new place_1.MongoRepository(settings.connection)
|
|
28
|
+
place: new place_1.MongoRepository(settings.connection),
|
|
29
|
+
seller: new seller_1.MongoRepository(settings.connection)
|
|
28
30
|
});
|
|
29
31
|
});
|
|
30
32
|
}
|
|
@@ -113,16 +113,13 @@ function abort(params) {
|
|
|
113
113
|
exports.abort = abort;
|
|
114
114
|
function notifyAbortedTasks(params) {
|
|
115
115
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
$gte: params.dateAbortedGte
|
|
120
|
-
}
|
|
121
|
-
});
|
|
116
|
+
const abortedTasks = yield repos.task.search(Object.assign({ statuses: [factory.taskStatus.Aborted], dateAborted: { $gte: params.dateAbortedGte } }, (settings_1.ABORTED_TASKS_WITHOUT_REPORT.length > 0)
|
|
117
|
+
? { name: { $nin: settings_1.ABORTED_TASKS_WITHOUT_REPORT } }
|
|
118
|
+
: undefined));
|
|
122
119
|
// 中止を報告しないタスク以外にフィルター
|
|
123
|
-
abortedTasks = abortedTasks.filter((task) => {
|
|
124
|
-
|
|
125
|
-
});
|
|
120
|
+
// abortedTasks = abortedTasks.filter((task) => {
|
|
121
|
+
// return !ABORTED_TASKS_WITHOUT_REPORT.includes(task.name);
|
|
122
|
+
// });
|
|
126
123
|
if (abortedTasks.length > 0) {
|
|
127
124
|
// 開発者へ報告
|
|
128
125
|
const message = (0, factory_1.tasks2lineNotify)({ tasks: abortedTasks });
|
|
@@ -35,37 +35,52 @@ function createReservationAcceptedOffers(params) {
|
|
|
35
35
|
}
|
|
36
36
|
exports.createReservationAcceptedOffers = createReservationAcceptedOffers;
|
|
37
37
|
function reservationOffers2orderedItem(params) {
|
|
38
|
-
var _a, _b, _c, _d;
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
39
39
|
const reservationFor = params.reservationFor;
|
|
40
40
|
const issuedThrough = params.issuedThrough;
|
|
41
|
-
if (reservationFor.typeOf
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
if (reservationFor.typeOf === factory.eventType.ScreeningEvent
|
|
42
|
+
&& issuedThrough.typeOf === factory.product.ProductType.EventService) {
|
|
43
|
+
const reservationFor4orderedItem = {
|
|
44
|
+
location: {
|
|
45
|
+
branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
46
|
+
name: (_b = reservationFor.location) === null || _b === void 0 ? void 0 : _b.name,
|
|
47
|
+
// 不要なので廃止(2022-12-19~)
|
|
48
|
+
// project: reservationFor.location?.project,
|
|
49
|
+
typeOf: (_c = reservationFor.location) === null || _c === void 0 ? void 0 : _c.typeOf
|
|
50
|
+
},
|
|
48
51
|
// 不要なので廃止(2022-12-19~)
|
|
49
|
-
// project: reservationFor.
|
|
50
|
-
typeOf:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
// project: reservationFor.project,
|
|
53
|
+
typeOf: reservationFor.typeOf,
|
|
54
|
+
id: reservationFor.id,
|
|
55
|
+
name: reservationFor.name,
|
|
56
|
+
startDate: reservationFor.startDate,
|
|
57
|
+
endDate: reservationFor.endDate
|
|
58
|
+
};
|
|
59
|
+
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
60
|
+
? { serviceType: issuedThrough.serviceType }
|
|
61
|
+
: undefined), { serviceOutput: {
|
|
62
|
+
typeOf: factory.reservationType.EventReservation,
|
|
63
|
+
reservationFor: reservationFor4orderedItem
|
|
64
|
+
} });
|
|
65
|
+
}
|
|
66
|
+
else if (reservationFor.typeOf === factory.tripType.BusTrip
|
|
67
|
+
&& issuedThrough.typeOf === factory.product.ProductType.Transportation) {
|
|
68
|
+
const reservationFor4orderedItem = {
|
|
69
|
+
typeOf: reservationFor.typeOf,
|
|
70
|
+
id: reservationFor.id,
|
|
71
|
+
departureTime: reservationFor.departureTime,
|
|
72
|
+
arrivalTime: reservationFor.arrivalTime
|
|
73
|
+
};
|
|
74
|
+
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_e = issuedThrough.serviceType) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string')
|
|
75
|
+
? { serviceType: issuedThrough.serviceType }
|
|
76
|
+
: undefined), { serviceOutput: {
|
|
77
|
+
typeOf: factory.reservationType.ReservationPackage,
|
|
78
|
+
reservationFor: reservationFor4orderedItem
|
|
79
|
+
} });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new factory.errors.ServiceUnavailable('unexpected params on reservationOffers2orderedItem');
|
|
62
83
|
}
|
|
63
|
-
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
64
|
-
? { serviceType: issuedThrough.serviceType }
|
|
65
|
-
: undefined), { serviceOutput: {
|
|
66
|
-
typeOf: factory.reservationType.EventReservation,
|
|
67
|
-
reservationFor: reservationFor4orderedItem
|
|
68
|
-
} });
|
|
69
84
|
}
|
|
70
85
|
function createProductItems(params) {
|
|
71
86
|
const acceptedOffers = [];
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export declare type ISettings = factory.project.ISettings & {
|
|
|
23
23
|
maxNumCreditCardPaymentMethod?: number;
|
|
24
24
|
};
|
|
25
25
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
26
|
+
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
27
|
+
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
26
28
|
/**
|
|
27
29
|
* グローバル設定
|
|
28
30
|
*/
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
3
|
+
exports.settings = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
4
4
|
const factory = require("./factory");
|
|
5
5
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
6
|
? process.env.INFORM_TRANSACTION_URL.split(',')
|
|
@@ -43,9 +43,14 @@ exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = 365;
|
|
|
43
43
|
/**
|
|
44
44
|
* 取引保管期間(Canceled)
|
|
45
45
|
*/
|
|
46
|
-
exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS =
|
|
46
|
+
exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS === 'string')
|
|
47
|
+
? Number(process.env.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS)
|
|
48
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
49
|
+
: 7;
|
|
47
50
|
exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
48
51
|
exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
|
|
52
|
+
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
53
|
+
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
49
54
|
/**
|
|
50
55
|
* グローバル設定
|
|
51
56
|
*/
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.283.0",
|
|
13
|
+
"@cinerino/sdk": "3.136.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.2.0-alpha.
|
|
123
|
+
"version": "20.2.0-alpha.30"
|
|
124
124
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
// const now = new Date();
|
|
13
|
-
await chevre.service.aggregation.project.aggregate({
|
|
14
|
-
project: { id: project.id },
|
|
15
|
-
reservationFor: {
|
|
16
|
-
startFrom: moment('2022-01-01T00:00:00+09:00')
|
|
17
|
-
.toDate(),
|
|
18
|
-
startThrough: moment('2022-01-31T23:59:59+09:00')
|
|
19
|
-
.toDate(),
|
|
20
|
-
}
|
|
21
|
-
})({
|
|
22
|
-
project: new chevre.repository.Project(mongoose.connection),
|
|
23
|
-
reservation: new chevre.repository.Reservation(mongoose.connection),
|
|
24
|
-
task: new chevre.repository.Task(mongoose.connection)
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
main()
|
|
29
|
-
.then(() => {
|
|
30
|
-
console.log('success!');
|
|
31
|
-
})
|
|
32
|
-
.catch(console.error);
|