@chevre/domain 21.2.0-alpha.74 → 21.2.0-alpha.76
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.
|
@@ -63,7 +63,7 @@ export declare class MongoRepository {
|
|
|
63
63
|
*/
|
|
64
64
|
$nin?: factory.taskName[];
|
|
65
65
|
};
|
|
66
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").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/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteMember").ITask | import("@chevre/factory/lib/task/deleteTransaction").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/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/triggerWebhook").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, "id" | "name" | "status">[]>;
|
|
66
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").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/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteMember").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").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/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/triggerWebhook").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, "id" | "name" | "status">[]>;
|
|
67
67
|
retry(params: {
|
|
68
68
|
intervalInMinutes: number;
|
|
69
69
|
}): Promise<void>;
|
|
@@ -135,12 +135,20 @@ function addReservations(params) {
|
|
|
135
135
|
})(repos);
|
|
136
136
|
// 予約イベント最適化
|
|
137
137
|
const reservationFor = (0, factory_1.createReservationFor)(event);
|
|
138
|
-
const minimizedObjectSubReservations
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
// const minimizedObjectSubReservations: factory.assetTransaction.reserve.IMinimizedObjectSubReservation[] =
|
|
139
|
+
// objectSubReservations.map((r) => {
|
|
140
|
+
// return {
|
|
141
|
+
// id: r.id,
|
|
142
|
+
// typeOf: r.typeOf,
|
|
143
|
+
// reservedTicket: {
|
|
144
|
+
// ticketType: r.reservedTicket.ticketType,
|
|
145
|
+
// ...(typeof r.reservedTicket.ticketedSeat?.typeOf === 'string')
|
|
146
|
+
// ? { ticketedSeat: r.reservedTicket.ticketedSeat }
|
|
147
|
+
// : undefined
|
|
148
|
+
// },
|
|
149
|
+
// ...(Array.isArray(r.subReservation)) ? { subReservation: r.subReservation } : undefined
|
|
150
|
+
// };
|
|
151
|
+
// });
|
|
144
152
|
// 取引に予約追加
|
|
145
153
|
let lockedOfferRateLimitKeys = [];
|
|
146
154
|
try {
|
|
@@ -152,9 +160,7 @@ function addReservations(params) {
|
|
|
152
160
|
acceptedOffer: acceptedOffers4transactionObject,
|
|
153
161
|
reservationFor,
|
|
154
162
|
// subReservationにreservationForを保管しない(2021-10-19~)
|
|
155
|
-
subReservation:
|
|
156
|
-
? objectSubReservations
|
|
157
|
-
: minimizedObjectSubReservations
|
|
163
|
+
subReservation: objectSubReservations
|
|
158
164
|
// subReservation: minimizedObjectSubReservations
|
|
159
165
|
}
|
|
160
166
|
});
|
|
@@ -177,9 +183,9 @@ function addReservations(params) {
|
|
|
177
183
|
if (transaction.object.disablePendingReservations !== true) {
|
|
178
184
|
// 予約作成(insertManyで実装)
|
|
179
185
|
yield repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
180
|
-
// 予約作成後処理
|
|
181
|
-
yield onReservationsCreated({ event })(repos);
|
|
182
186
|
}
|
|
187
|
+
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
188
|
+
yield onReservationsCreated({ event })(repos);
|
|
183
189
|
return { transaction, objectSubReservations };
|
|
184
190
|
});
|
|
185
191
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { IConnectionSettings } from '../task';
|
|
3
|
+
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* タスク実行関数
|
|
6
|
+
*/
|
|
7
|
+
export declare function call(data: factory.task.onAuthorizationCreated.IData): IOperation<void>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const code_1 = require("../../repo/code");
|
|
15
|
+
const order_1 = require("../../repo/order");
|
|
16
|
+
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
17
|
+
const reservation_1 = require("../../repo/reservation");
|
|
18
|
+
const task_1 = require("../../repo/task");
|
|
19
|
+
const reserve_1 = require("../reserve");
|
|
20
|
+
/**
|
|
21
|
+
* タスク実行関数
|
|
22
|
+
*/
|
|
23
|
+
function call(data) {
|
|
24
|
+
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield onAuthorizationCreated(data)({
|
|
26
|
+
code: new code_1.MongoRepository(settings.connection),
|
|
27
|
+
order: new order_1.MongoRepository(settings.connection),
|
|
28
|
+
ownershipInfo: new ownershipInfo_1.MongoRepository(settings.connection),
|
|
29
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
30
|
+
task: new task_1.MongoRepository(settings.connection)
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.call = call;
|
|
35
|
+
function onAuthorizationCreated(params) {
|
|
36
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
// 発券対象予約ID
|
|
38
|
+
let reservationIds = [];
|
|
39
|
+
// 発券対象予約番号
|
|
40
|
+
let reservationNumbers = [];
|
|
41
|
+
// 発券対象イベントID
|
|
42
|
+
let reservationForIds = [];
|
|
43
|
+
const authorizationObject = yield repos.code.findOne({
|
|
44
|
+
code: params.code,
|
|
45
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project }
|
|
46
|
+
});
|
|
47
|
+
switch (authorizationObject.typeOf) {
|
|
48
|
+
case factory.order.OrderType.Order:
|
|
49
|
+
// 注文検索
|
|
50
|
+
const orderNumber = authorizationObject.orderNumber;
|
|
51
|
+
if (typeof orderNumber === 'string' && orderNumber.length > 0) {
|
|
52
|
+
// 最適化(2023-01-28~)
|
|
53
|
+
const order = yield repos.order.findByOrderNumber({
|
|
54
|
+
orderNumber,
|
|
55
|
+
inclusion: ['acceptedOffers'],
|
|
56
|
+
exclusion: []
|
|
57
|
+
});
|
|
58
|
+
const acceptedOffers = (Array.isArray(order.acceptedOffers)) ? order.acceptedOffers : [];
|
|
59
|
+
reservationNumbers = acceptedOffers
|
|
60
|
+
.filter((o) => o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
61
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
62
|
+
.map((o) => o.itemOffered.reservationNumber);
|
|
63
|
+
reservationNumbers = [...new Set(reservationNumbers)];
|
|
64
|
+
reservationForIds = acceptedOffers
|
|
65
|
+
.filter((o) => o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
66
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
67
|
+
.map((o) => String(o.itemOffered.reservationFor.id));
|
|
68
|
+
reservationForIds = [...new Set(reservationForIds)];
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
case 'OwnershipInfo':
|
|
72
|
+
// 所有権検索
|
|
73
|
+
const ownershipInfoId = authorizationObject.id;
|
|
74
|
+
if (typeof ownershipInfoId === 'string' && ownershipInfoId.length > 0) {
|
|
75
|
+
const ownershipInfo = yield repos.ownershipInfo.findById({ id: ownershipInfoId });
|
|
76
|
+
// 座席予約に対する所有権であれば発券
|
|
77
|
+
if (ownershipInfo.typeOfGood.typeOf === factory.reservationType.EventReservation
|
|
78
|
+
|| ownershipInfo.typeOfGood.typeOf === factory.reservationType.BusReservation) {
|
|
79
|
+
const reservationId = String(ownershipInfo.typeOfGood.id);
|
|
80
|
+
reservationIds = [reservationId];
|
|
81
|
+
const reservation = yield repos.reservation.findById({ id: reservationId });
|
|
82
|
+
reservationForIds = [String(reservation.reservationFor.id)];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
// no op
|
|
88
|
+
}
|
|
89
|
+
yield (0, reserve_1.checkInRerservation)({
|
|
90
|
+
project: { id: params.project.id },
|
|
91
|
+
object: {
|
|
92
|
+
ids: reservationIds,
|
|
93
|
+
reservationNumbers: reservationNumbers,
|
|
94
|
+
reservationFor: { ids: reservationForIds }
|
|
95
|
+
}
|
|
96
|
+
})({
|
|
97
|
+
reservation: repos.reservation,
|
|
98
|
+
task: repos.task
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.15",
|
|
13
13
|
"@cinerino/sdk": "3.157.0-alpha.2",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.76"
|
|
121
121
|
}
|