@chevre/domain 20.1.0 → 20.2.0-alpha.1
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/lib/chevre/repo/event.js +4 -0
- package/lib/chevre/repo/mongoose/model/trip.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/trip.js +51 -0
- package/lib/chevre/repo/place.js +1 -1
- package/lib/chevre/repo/reservation.js +3 -0
- package/lib/chevre/repo/trip.d.ts +54 -0
- package/lib/chevre/repo/trip.js +222 -0
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -2
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +39 -17
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -3
- package/lib/chevre/service/assetTransaction/reserve/factory.js +57 -32
- package/lib/chevre/service/assetTransaction/reserve.js +14 -10
- package/lib/chevre/service/delivery/reservation/factory.js +24 -6
- package/lib/chevre/service/offer/event/factory.js +35 -38
- package/lib/chevre/service/reserve/cancelReservation.js +7 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +9 -6
- package/package.json +2 -2
package/lib/chevre/repo/event.js
CHANGED
|
@@ -130,6 +130,10 @@ class MongoRepository {
|
|
|
130
130
|
}
|
|
131
131
|
let params;
|
|
132
132
|
switch (conditions.typeOf) {
|
|
133
|
+
case factory.eventType.Event:
|
|
134
|
+
// no op
|
|
135
|
+
// params = conditions;
|
|
136
|
+
break;
|
|
133
137
|
case factory.eventType.ScreeningEvent:
|
|
134
138
|
params = conditions;
|
|
135
139
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
declare const modelName = "Trip";
|
|
3
|
+
/**
|
|
4
|
+
* トリップスキーマ
|
|
5
|
+
*/
|
|
6
|
+
declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
|
|
7
|
+
export { modelName, schema };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.modelName = void 0;
|
|
4
|
+
const mongoose = require("mongoose");
|
|
5
|
+
const modelName = 'Trip';
|
|
6
|
+
exports.modelName = modelName;
|
|
7
|
+
const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
8
|
+
/**
|
|
9
|
+
* トリップスキーマ
|
|
10
|
+
*/
|
|
11
|
+
const schema = new mongoose.Schema({
|
|
12
|
+
project: mongoose.SchemaTypes.Mixed,
|
|
13
|
+
typeOf: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
}, {
|
|
18
|
+
collection: 'trips',
|
|
19
|
+
id: true,
|
|
20
|
+
read: 'primaryPreferred',
|
|
21
|
+
writeConcern: writeConcern,
|
|
22
|
+
strict: false,
|
|
23
|
+
useNestedStrict: true,
|
|
24
|
+
timestamps: {
|
|
25
|
+
createdAt: 'createdAt',
|
|
26
|
+
updatedAt: 'updatedAt'
|
|
27
|
+
},
|
|
28
|
+
toJSON: {
|
|
29
|
+
getters: false,
|
|
30
|
+
virtuals: false,
|
|
31
|
+
minimize: false,
|
|
32
|
+
versionKey: false
|
|
33
|
+
},
|
|
34
|
+
toObject: {
|
|
35
|
+
getters: false,
|
|
36
|
+
virtuals: true,
|
|
37
|
+
minimize: false,
|
|
38
|
+
versionKey: false
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
exports.schema = schema;
|
|
42
|
+
mongoose.model(modelName, schema)
|
|
43
|
+
.on('index',
|
|
44
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
(error) => {
|
|
47
|
+
if (error !== undefined) {
|
|
48
|
+
// tslint:disable-next-line:no-console
|
|
49
|
+
console.error(error);
|
|
50
|
+
}
|
|
51
|
+
});
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -35,7 +35,7 @@ class MongoRepository {
|
|
|
35
35
|
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
|
|
36
36
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
37
37
|
// MongoDB検索条件
|
|
38
|
-
const andConditions = [];
|
|
38
|
+
const andConditions = [{ typeOf: { $eq: factory.placeType.MovieTheater } }];
|
|
39
39
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
40
40
|
if (typeof projectIdEq === 'string') {
|
|
41
41
|
andConditions.push({
|
|
@@ -232,6 +232,9 @@ class MongoRepository {
|
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
switch (params.typeOf) {
|
|
235
|
+
case factory.reservationType.BusReservation:
|
|
236
|
+
// no op
|
|
237
|
+
break;
|
|
235
238
|
case factory.reservationType.EventReservation:
|
|
236
239
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
237
240
|
/* istanbul ignore else */
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../factory';
|
|
3
|
+
export declare type ISearchConditions<T extends factory.tripType> = factory.trip.ISearchConditions<T>;
|
|
4
|
+
export interface IAttributes4patchUpdate<T extends factory.tripType> {
|
|
5
|
+
typeOf: T;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* トリップリポジトリ
|
|
9
|
+
*/
|
|
10
|
+
export declare class MongoRepository {
|
|
11
|
+
private readonly tripModel;
|
|
12
|
+
constructor(connection: Connection);
|
|
13
|
+
static CREATE_MONGO_CONDITIONS<T extends factory.tripType>(conditions: ISearchConditions<T>): any[];
|
|
14
|
+
createMany<T extends factory.tripType>(params: factory.trip.ITrip<T>[]): Promise<factory.trip.ITrip<T>[]>;
|
|
15
|
+
updatePartiallyById<T extends factory.tripType>(params: {
|
|
16
|
+
id: string;
|
|
17
|
+
attributes: IAttributes4patchUpdate<T>;
|
|
18
|
+
}): Promise<factory.trip.ITrip<T>>;
|
|
19
|
+
/**
|
|
20
|
+
* イベントを保管する
|
|
21
|
+
*/
|
|
22
|
+
save<T extends factory.tripType>(params: {
|
|
23
|
+
id?: string;
|
|
24
|
+
attributes: factory.trip.ITrip<T>;
|
|
25
|
+
$unset?: {
|
|
26
|
+
[key: string]: number;
|
|
27
|
+
};
|
|
28
|
+
upsert?: boolean;
|
|
29
|
+
}): Promise<factory.trip.ITrip<T>>;
|
|
30
|
+
saveMany<T extends factory.tripType>(params: {
|
|
31
|
+
id?: string;
|
|
32
|
+
attributes: factory.trip.ITrip<T>;
|
|
33
|
+
$unset?: {
|
|
34
|
+
[key: string]: number;
|
|
35
|
+
};
|
|
36
|
+
upsert?: boolean;
|
|
37
|
+
}[]): Promise<void>;
|
|
38
|
+
search<T extends factory.tripType>(params: ISearchConditions<T>, projection?: {
|
|
39
|
+
[key: string]: number;
|
|
40
|
+
}): Promise<factory.trip.ITrip<T>[]>;
|
|
41
|
+
findById<T extends factory.tripType>(params: {
|
|
42
|
+
id: string;
|
|
43
|
+
}, projection?: {
|
|
44
|
+
[key: string]: number;
|
|
45
|
+
}): Promise<factory.trip.ITrip<T>>;
|
|
46
|
+
deleteById(params: {
|
|
47
|
+
id: string;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
deleteByProject(params: {
|
|
50
|
+
project: {
|
|
51
|
+
id: string;
|
|
52
|
+
};
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.MongoRepository = void 0;
|
|
24
|
+
const factory = require("../factory");
|
|
25
|
+
const trip_1 = require("./mongoose/model/trip");
|
|
26
|
+
/**
|
|
27
|
+
* トリップリポジトリ
|
|
28
|
+
*/
|
|
29
|
+
class MongoRepository {
|
|
30
|
+
constructor(connection) {
|
|
31
|
+
this.tripModel = connection.model(trip_1.modelName);
|
|
32
|
+
}
|
|
33
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
34
|
+
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
37
|
+
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
38
|
+
if (typeof projectIdEq === 'string') {
|
|
39
|
+
andConditions.push({
|
|
40
|
+
'project.id': { $eq: projectIdEq }
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const idIn = (_c = conditions.id) === null || _c === void 0 ? void 0 : _c.$in;
|
|
44
|
+
if (Array.isArray(idIn)) {
|
|
45
|
+
andConditions.push({
|
|
46
|
+
_id: { $in: idIn }
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return andConditions;
|
|
50
|
+
}
|
|
51
|
+
createMany(params) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const docs = yield this.tripModel.insertMany(params.map((p) => {
|
|
54
|
+
return Object.assign({}, p);
|
|
55
|
+
}));
|
|
56
|
+
return docs.map((doc) => doc.toObject());
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
updatePartiallyById(params) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
let doc;
|
|
62
|
+
const _a = params.attributes, { typeOf } = _a, updateFields = __rest(_a, ["typeOf"]);
|
|
63
|
+
doc = yield this.tripModel.findOneAndUpdate({
|
|
64
|
+
_id: params.id,
|
|
65
|
+
typeOf: params.attributes.typeOf
|
|
66
|
+
}, {
|
|
67
|
+
$set: updateFields
|
|
68
|
+
}, { upsert: false, new: true })
|
|
69
|
+
.exec();
|
|
70
|
+
if (doc === null) {
|
|
71
|
+
throw new factory.errors.NotFound(this.tripModel.modelName);
|
|
72
|
+
}
|
|
73
|
+
return doc.toObject();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* イベントを保管する
|
|
78
|
+
*/
|
|
79
|
+
save(params) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
let doc;
|
|
82
|
+
if (typeof params.id !== 'string') {
|
|
83
|
+
doc = yield this.tripModel.create(Object.assign({}, params.attributes));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const upsert = params.upsert === true;
|
|
87
|
+
// 上書き禁止属性を除外
|
|
88
|
+
const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
89
|
+
doc = yield this.tripModel.findOneAndUpdate({
|
|
90
|
+
_id: params.id,
|
|
91
|
+
typeOf: params.attributes.typeOf
|
|
92
|
+
}, Object.assign({ $setOnInsert: {
|
|
93
|
+
typeOf: params.attributes.typeOf,
|
|
94
|
+
project: params.attributes.project,
|
|
95
|
+
identifier: params.attributes.identifier
|
|
96
|
+
}, $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), { upsert, new: true })
|
|
97
|
+
.exec();
|
|
98
|
+
}
|
|
99
|
+
if (doc === null) {
|
|
100
|
+
throw new factory.errors.NotFound(this.tripModel.modelName);
|
|
101
|
+
}
|
|
102
|
+
return doc.toObject();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
saveMany(params) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const bulkWriteOps = [];
|
|
108
|
+
if (Array.isArray(params)) {
|
|
109
|
+
params.forEach((p) => {
|
|
110
|
+
if (typeof p.id !== 'string') {
|
|
111
|
+
bulkWriteOps.push({
|
|
112
|
+
insertOne: {
|
|
113
|
+
document: Object.assign({}, p.attributes)
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const upsert = p.upsert === true;
|
|
119
|
+
if (p.attributes.typeOf === factory.tripType.BusTrip) {
|
|
120
|
+
// 上書き禁止属性を除外
|
|
121
|
+
const _a = p.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
122
|
+
bulkWriteOps.push({
|
|
123
|
+
updateOne: {
|
|
124
|
+
filter: {
|
|
125
|
+
_id: p.id,
|
|
126
|
+
typeOf: p.attributes.typeOf
|
|
127
|
+
},
|
|
128
|
+
// upsertの場合、createがありうるので属性を除外しない
|
|
129
|
+
update: Object.assign({ $setOnInsert: {
|
|
130
|
+
typeOf: p.attributes.typeOf,
|
|
131
|
+
project: p.attributes.project,
|
|
132
|
+
identifier: p.attributes.identifier
|
|
133
|
+
// ...(typeof p.attributes.remainingAttendeeCapacity === 'number')
|
|
134
|
+
// ? { remainingAttendeeCapacity: p.attributes.remainingAttendeeCapacity }
|
|
135
|
+
// : undefined
|
|
136
|
+
}, $set: updateFields }, (p.$unset !== undefined) ? { $unset: p.$unset } : undefined),
|
|
137
|
+
upsert
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else if (p.attributes.typeOf === factory.tripType.BusTripSeries) {
|
|
142
|
+
// 上書き禁止属性を除外
|
|
143
|
+
const _b = p.attributes, { identifier, project, typeOf } = _b, updateFields = __rest(_b, ["identifier", "project", "typeOf"]);
|
|
144
|
+
bulkWriteOps.push({
|
|
145
|
+
updateOne: {
|
|
146
|
+
filter: {
|
|
147
|
+
_id: p.id,
|
|
148
|
+
typeOf: p.attributes.typeOf
|
|
149
|
+
},
|
|
150
|
+
// upsertの場合、createがありうるので属性を除外しない
|
|
151
|
+
update: Object.assign({ $setOnInsert: {
|
|
152
|
+
typeOf: p.attributes.typeOf,
|
|
153
|
+
project: p.attributes.project,
|
|
154
|
+
identifier: p.attributes.identifier
|
|
155
|
+
}, $set: updateFields }, (p.$unset !== undefined) ? { $unset: p.$unset } : undefined),
|
|
156
|
+
upsert
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (bulkWriteOps.length > 0) {
|
|
164
|
+
yield this.tripModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
search(params, projection) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
171
|
+
const query = this.tripModel.find({ $and: conditions }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
|
|
172
|
+
if (typeof params.limit === 'number') {
|
|
173
|
+
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
174
|
+
query.limit(params.limit)
|
|
175
|
+
.skip(params.limit * (page - 1));
|
|
176
|
+
}
|
|
177
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
178
|
+
/* istanbul ignore else */
|
|
179
|
+
if (params.sort !== undefined) {
|
|
180
|
+
query.sort(params.sort);
|
|
181
|
+
}
|
|
182
|
+
// const explainResult = await query.explain()
|
|
183
|
+
// .exec();
|
|
184
|
+
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
185
|
+
// console.log(explainResult[0].executionStats.allPlansExecution);
|
|
186
|
+
// console.log(explainResult[0].queryPlanner?.winningPlan);
|
|
187
|
+
// console.log(explainResult[0].queryPlanner?.winningPlan?.inputStage?.inputStage?.inputStage);
|
|
188
|
+
// console.log(explainResult);
|
|
189
|
+
// return [];
|
|
190
|
+
return query.setOptions({ maxTimeMS: 10000 })
|
|
191
|
+
.exec()
|
|
192
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
findById(params, projection) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const doc = yield this.tripModel.findOne({
|
|
198
|
+
_id: params.id
|
|
199
|
+
}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
|
|
200
|
+
.exec();
|
|
201
|
+
if (doc === null) {
|
|
202
|
+
throw new factory.errors.NotFound(this.tripModel.modelName);
|
|
203
|
+
}
|
|
204
|
+
return doc.toObject();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
deleteById(params) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
yield this.tripModel.findOneAndDelete({ _id: params.id })
|
|
210
|
+
.exec();
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
deleteByProject(params) {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
yield this.tripModel.deleteMany({
|
|
216
|
+
'project.id': { $eq: params.project.id }
|
|
217
|
+
})
|
|
218
|
+
.exec();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.MongoRepository = MongoRepository;
|
|
@@ -36,6 +36,7 @@ import { MongoRepository as TaskRepo } from './repo/task';
|
|
|
36
36
|
import { MongoRepository as TelemetryRepo } from './repo/telemetry';
|
|
37
37
|
import { MongoRepository as TransactionRepo } from './repo/transaction';
|
|
38
38
|
import { RedisRepository as TransactionNumberRepo } from './repo/transactionNumber';
|
|
39
|
+
import { MongoRepository as TripRepo } from './repo/trip';
|
|
39
40
|
import { RedisRepository as RegisterServiceActionInProgress } from './repo/action/registerServiceInProgress';
|
|
40
41
|
import { RedisRepository as ConfirmationNumberRepo } from './repo/confirmationNumber';
|
|
41
42
|
import { RedisRepository as OrderNumberRepo } from './repo/orderNumber';
|
|
@@ -184,6 +185,8 @@ export declare class Transaction extends TransactionRepo {
|
|
|
184
185
|
}
|
|
185
186
|
export declare class TransactionNumber extends TransactionNumberRepo {
|
|
186
187
|
}
|
|
188
|
+
export declare class Trip extends TripRepo {
|
|
189
|
+
}
|
|
187
190
|
export declare namespace itemAvailability {
|
|
188
191
|
class ScreeningEvent extends ScreeningEventItemAvailabilityRepo {
|
|
189
192
|
}
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = exports.itemAvailability = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
3
|
+
exports.rateLimit = exports.itemAvailability = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.OfferCatalog = exports.Offer = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
4
4
|
// tslint:disable:max-classes-per-file completed-docs
|
|
5
5
|
/**
|
|
6
6
|
* リポジトリ
|
|
7
7
|
*/
|
|
8
8
|
const account_1 = require("./repo/account");
|
|
9
|
-
// import { MongoRepository as AccountActionRepo } from './repo/accountAction';
|
|
10
9
|
const accountingReport_1 = require("./repo/accountingReport");
|
|
11
10
|
const accountTitle_1 = require("./repo/accountTitle");
|
|
12
11
|
const accountTransaction_1 = require("./repo/accountTransaction");
|
|
@@ -41,6 +40,7 @@ const task_1 = require("./repo/task");
|
|
|
41
40
|
const telemetry_1 = require("./repo/telemetry");
|
|
42
41
|
const transaction_1 = require("./repo/transaction");
|
|
43
42
|
const transactionNumber_1 = require("./repo/transactionNumber");
|
|
43
|
+
const trip_1 = require("./repo/trip");
|
|
44
44
|
const registerServiceInProgress_1 = require("./repo/action/registerServiceInProgress");
|
|
45
45
|
const confirmationNumber_1 = require("./repo/confirmationNumber");
|
|
46
46
|
const orderNumber_1 = require("./repo/orderNumber");
|
|
@@ -230,6 +230,9 @@ exports.Transaction = Transaction;
|
|
|
230
230
|
class TransactionNumber extends transactionNumber_1.RedisRepository {
|
|
231
231
|
}
|
|
232
232
|
exports.TransactionNumber = TransactionNumber;
|
|
233
|
+
class Trip extends trip_1.MongoRepository {
|
|
234
|
+
}
|
|
235
|
+
exports.Trip = Trip;
|
|
233
236
|
var itemAvailability;
|
|
234
237
|
(function (itemAvailability) {
|
|
235
238
|
class ScreeningEvent extends screeningEvent_1.RedisRepository {
|
|
@@ -20,7 +20,7 @@ function createStartParams(params) {
|
|
|
20
20
|
typeOf: params.transaction.typeOf,
|
|
21
21
|
object: {
|
|
22
22
|
reservationFor: {
|
|
23
|
-
id: reservationFor.id,
|
|
23
|
+
id: String(reservationFor.id),
|
|
24
24
|
typeOf: reservationFor.typeOf
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -60,7 +60,7 @@ function createPotentialActions(params) {
|
|
|
60
60
|
const cancelObject = {
|
|
61
61
|
reservationFor: {
|
|
62
62
|
typeOf: reservationForByReserveTransaction.typeOf,
|
|
63
|
-
id: reservationForByReserveTransaction.id
|
|
63
|
+
id: String(reservationForByReserveTransaction.id)
|
|
64
64
|
},
|
|
65
65
|
reservationNumber,
|
|
66
66
|
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
@@ -82,22 +82,44 @@ function createPotentialActions(params) {
|
|
|
82
82
|
else if (Array.isArray(transaction.object.reservations)) {
|
|
83
83
|
// 予約取消アクション属性作成
|
|
84
84
|
cancelReservationActionAttributes = transaction.object.reservations.map((reservation) => {
|
|
85
|
-
var _a;
|
|
85
|
+
var _a, _b;
|
|
86
86
|
// 最適化(2022-06-06~)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
87
|
+
let cancelObject;
|
|
88
|
+
if (reservation.typeOf === factory.reservationType.BusReservation) {
|
|
89
|
+
cancelObject = {
|
|
90
|
+
typeOf: reservation.typeOf,
|
|
91
|
+
id: reservation.id,
|
|
92
|
+
issuedThrough: {
|
|
93
|
+
typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
|
|
94
|
+
},
|
|
95
|
+
reservationFor: {
|
|
96
|
+
typeOf: reservation.reservationFor.typeOf,
|
|
97
|
+
id: String(reservation.reservationFor.id)
|
|
98
|
+
},
|
|
99
|
+
reservationNumber: reservation.reservationNumber,
|
|
100
|
+
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
101
|
+
reservationStatus: factory.reservationStatusType.ReservationConfirmed
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
else if (reservation.typeOf === factory.reservationType.EventReservation) {
|
|
105
|
+
cancelObject = {
|
|
106
|
+
typeOf: reservation.typeOf,
|
|
107
|
+
id: reservation.id,
|
|
108
|
+
issuedThrough: {
|
|
109
|
+
typeOf: (_b = reservation.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf
|
|
110
|
+
},
|
|
111
|
+
reservationFor: {
|
|
112
|
+
typeOf: reservation.reservationFor.typeOf,
|
|
113
|
+
id: String(reservation.reservationFor.id)
|
|
114
|
+
},
|
|
115
|
+
reservationNumber: reservation.reservationNumber,
|
|
116
|
+
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
117
|
+
reservationStatus: factory.reservationStatusType.ReservationConfirmed
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
throw new factory.errors.NotImplemented(`reservation.typeOf ${reservation.typeOf} not imeplemented`);
|
|
122
|
+
}
|
|
101
123
|
return {
|
|
102
124
|
project: transaction.project,
|
|
103
125
|
typeOf: factory.actionType.CancelAction,
|
|
@@ -18,7 +18,6 @@ export declare function createReservedTicket(params: {
|
|
|
18
18
|
acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
|
|
19
19
|
availableOffer: factory.unitPriceOffer.IUnitPriceOffer;
|
|
20
20
|
dateIssued: Date;
|
|
21
|
-
event: factory.event.screeningEvent.IEvent;
|
|
22
21
|
reservedSeatsOnly: boolean;
|
|
23
22
|
screeningRoomSections?: factory.place.screeningRoomSection.IPlace[];
|
|
24
23
|
availableSeatOffers: factory.place.seat.IPlaceWithOffer[];
|
|
@@ -43,7 +42,7 @@ export declare function createAdditionalTicketText(params: {
|
|
|
43
42
|
reservedTicket: factory.reservation.ITicket;
|
|
44
43
|
}): string | undefined;
|
|
45
44
|
export declare type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
46
|
-
export declare function createReservationFor(params: factory.event.screeningEvent.IEvent): factory.assetTransaction.reserve.IReservationFor;
|
|
45
|
+
export declare function createReservationFor(params: factory.event.screeningEvent.IEvent | factory.event.event.IEvent): factory.assetTransaction.reserve.IReservationFor;
|
|
47
46
|
export declare function createReservation(params: {
|
|
48
47
|
project: {
|
|
49
48
|
id: string;
|
|
@@ -54,7 +53,7 @@ export declare function createReservation(params: {
|
|
|
54
53
|
agent: factory.assetTransaction.reserve.IAgent;
|
|
55
54
|
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
56
55
|
reservationNumber: string;
|
|
57
|
-
reservationFor: factory.event.screeningEvent.IEvent;
|
|
56
|
+
reservationFor: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
58
57
|
reservedTicket: factory.reservation.ITicket;
|
|
59
58
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
60
59
|
additionalTicketText?: string;
|
|
@@ -329,15 +329,19 @@ function createAdditionalTicketText(params) {
|
|
|
329
329
|
}
|
|
330
330
|
exports.createAdditionalTicketText = createAdditionalTicketText;
|
|
331
331
|
function createReservationFor(params) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
?
|
|
340
|
-
:
|
|
332
|
+
var _a, _b;
|
|
333
|
+
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
334
|
+
return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
|
|
335
|
+
? { doorTime: params.doorTime }
|
|
336
|
+
: undefined);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
const tripByEvent = (_b = (_a = params.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservationFor;
|
|
340
|
+
if (typeof (tripByEvent === null || tripByEvent === void 0 ? void 0 : tripByEvent.typeOf) !== 'string') {
|
|
341
|
+
throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput?.reservationFor');
|
|
342
|
+
}
|
|
343
|
+
return Object.assign(Object.assign({}, tripByEvent), { arrivalTime: params.endDate, id: params.id, name: params.name, departureTime: params.startDate });
|
|
344
|
+
}
|
|
341
345
|
}
|
|
342
346
|
exports.createReservationFor = createReservationFor;
|
|
343
347
|
function optimizeReservationSuperEvent(params) {
|
|
@@ -353,8 +357,9 @@ function optimizeReservationSuperEvent(params) {
|
|
|
353
357
|
? { headline: superEvent.headline }
|
|
354
358
|
: undefined);
|
|
355
359
|
}
|
|
360
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
356
361
|
function createReservation(params) {
|
|
357
|
-
var _a, _b, _c;
|
|
362
|
+
var _a, _b, _c, _d, _e;
|
|
358
363
|
// 適用メンバーシップ確認
|
|
359
364
|
validateEligibleMembershipType({
|
|
360
365
|
availableOffer: params.availableOffer,
|
|
@@ -381,31 +386,51 @@ function createReservation(params) {
|
|
|
381
386
|
typeOf: 'CategoryCodeSet',
|
|
382
387
|
identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
|
|
383
388
|
},
|
|
384
|
-
// project: params.project,
|
|
385
389
|
typeOf: 'CategoryCode'
|
|
386
390
|
}
|
|
387
391
|
: undefined;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
392
|
+
if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
|
|
393
|
+
const issuedThrough = Object.assign(Object.assign({ typeOf: factory.product.ProductType.EventService }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined), (typeof eventOffers.itemOffered.id === 'string') ? { id: eventOffers.itemOffered.id } : undefined);
|
|
394
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
|
|
395
|
+
// 最適化(2022-12-19~)
|
|
396
|
+
underName: {
|
|
397
|
+
typeOf: params.agent.typeOf,
|
|
398
|
+
name: params.agent.name
|
|
399
|
+
}, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
|
|
400
|
+
? {
|
|
401
|
+
subReservation: params.subReservation.map((r) => {
|
|
402
|
+
return {
|
|
403
|
+
reservedTicket: {
|
|
404
|
+
ticketedSeat: r.reservedTicket.ticketedSeat,
|
|
405
|
+
typeOf: 'Ticket'
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
: undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_c = params.programMembershipUsed) === null || _c === void 0 ? void 0 : _c.identifier) === 'string')
|
|
411
|
+
? { programMembershipUsed: params.programMembershipUsed }
|
|
412
|
+
: undefined);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
const issuedThrough = Object.assign(Object.assign({ typeOf: factory.product.ProductType.Transportation }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined), (typeof eventOffers.itemOffered.id === 'string') ? { id: eventOffers.itemOffered.id } : undefined);
|
|
416
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: {
|
|
417
|
+
typeOf: params.agent.typeOf,
|
|
418
|
+
name: params.agent.name
|
|
419
|
+
}, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
|
|
420
|
+
? {
|
|
421
|
+
subReservation: params.subReservation.map((r) => {
|
|
422
|
+
return {
|
|
423
|
+
reservedTicket: {
|
|
424
|
+
ticketedSeat: r.reservedTicket.ticketedSeat,
|
|
425
|
+
typeOf: 'Ticket'
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
: undefined), (typeof ((_d = params.broker) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_e = params.programMembershipUsed) === null || _e === void 0 ? void 0 : _e.identifier) === 'string')
|
|
431
|
+
? { programMembershipUsed: params.programMembershipUsed }
|
|
432
|
+
: undefined);
|
|
433
|
+
}
|
|
409
434
|
}
|
|
410
435
|
exports.createReservation = createReservation;
|
|
411
436
|
// tslint:disable-next-line:max-func-body-length
|
|
@@ -76,7 +76,12 @@ function addReservations(params) {
|
|
|
76
76
|
aggregateReservation: 0, aggregateOffer: 0, attendeeCount: 0,
|
|
77
77
|
checkInCount: 0, maximumAttendeeCapacity: 0, remainingAttendeeCapacity: 0
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
if (event.typeOf !== factory.eventType.ScreeningEvent && event.typeOf !== factory.eventType.Event) {
|
|
80
|
+
throw new factory.errors.Argument('object.reservationFor.id', `invalid event type ${event.typeOf}`);
|
|
81
|
+
}
|
|
82
|
+
if (event.typeOf === factory.eventType.ScreeningEvent || event.typeOf === factory.eventType.Event) {
|
|
83
|
+
validateEvent({ now, event });
|
|
84
|
+
}
|
|
80
85
|
// イベントオファー検索
|
|
81
86
|
const ticketOffers = yield OfferService.event.searchEventTicketOffers({ event: { id: event.id } })(repos);
|
|
82
87
|
let availableOffers = [];
|
|
@@ -91,11 +96,7 @@ function addReservations(params) {
|
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
else {
|
|
94
|
-
// hasOfferCatalog参照廃止(2022-09-02~)
|
|
95
99
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
96
|
-
// if (typeof event.hasOfferCatalog?.id === 'string') {
|
|
97
|
-
// availableOffers = await repos.offer.findOffersByOfferCatalogId({ offerCatalog: { id: event.hasOfferCatalog.id } });
|
|
98
|
-
// }
|
|
99
100
|
}
|
|
100
101
|
const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event: { id: event.id } })(repos);
|
|
101
102
|
// 仮予約作成
|
|
@@ -247,7 +248,7 @@ function createReservations4transactionObject(params) {
|
|
|
247
248
|
acceptedOffer: acceptedOffer,
|
|
248
249
|
availableOffer: ticketType,
|
|
249
250
|
dateIssued: params.now,
|
|
250
|
-
event: params.event,
|
|
251
|
+
// event: params.event,
|
|
251
252
|
reservedSeatsOnly,
|
|
252
253
|
availableSeatOffers: params.availableSeatOffers,
|
|
253
254
|
ticketOffer: ticketOffer,
|
|
@@ -446,8 +447,11 @@ function processLockOfferRateLimit(params) {
|
|
|
446
447
|
}
|
|
447
448
|
},
|
|
448
449
|
reservationFor: {
|
|
449
|
-
startDate:
|
|
450
|
-
.
|
|
450
|
+
startDate: (params.reservationFor.typeOf === factory.eventType.ScreeningEvent)
|
|
451
|
+
? moment(params.reservationFor.startDate)
|
|
452
|
+
.toDate()
|
|
453
|
+
: moment(params.reservationFor.departureTime)
|
|
454
|
+
.toDate()
|
|
451
455
|
},
|
|
452
456
|
reservationNumber: reservation.reservationNumber
|
|
453
457
|
};
|
|
@@ -622,7 +626,7 @@ function cancel(params) {
|
|
|
622
626
|
const reservationPackage = {
|
|
623
627
|
typeOf: factory.reservationType.ReservationPackage,
|
|
624
628
|
reservationNumber: transaction.transactionNumber,
|
|
625
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
629
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
626
630
|
reservationStatus: pendingReservations[0].reservationStatus
|
|
627
631
|
};
|
|
628
632
|
cancelActionAttributes = [{
|
|
@@ -712,7 +716,7 @@ function exportTasksById(params) {
|
|
|
712
716
|
const reservationPackage = {
|
|
713
717
|
typeOf: factory.reservationType.ReservationPackage,
|
|
714
718
|
reservationNumber: transaction.transactionNumber,
|
|
715
|
-
reservationFor: { typeOf: reservationFor.typeOf, id: reservationFor.id },
|
|
719
|
+
reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
716
720
|
reservationStatus: pendingReservations[0].reservationStatus
|
|
717
721
|
};
|
|
718
722
|
cancelActionAttributes = [{
|
|
@@ -4,14 +4,24 @@ exports.createReservationOwnershipInfo = void 0;
|
|
|
4
4
|
const moment = require("moment-timezone");
|
|
5
5
|
const factory = require("../../../factory");
|
|
6
6
|
function createReservationOwnershipInfo(params) {
|
|
7
|
-
var _a;
|
|
7
|
+
var _a, _b;
|
|
8
8
|
const itemOffered = params.acceptedOffer.itemOffered;
|
|
9
9
|
let ownershipInfo;
|
|
10
10
|
// イベント予約に対する所有権の有効期限はイベント終了日時までで十分だろう
|
|
11
11
|
// 現時点では所有権対象がイベント予約のみなので、これで問題ないが、
|
|
12
12
|
// 対象が他に広がれば、有効期間のコントロールは別でしっかり行う必要があるだろう
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
let ownedThrough;
|
|
14
|
+
if (itemOffered.typeOf === factory.reservationType.EventReservation) {
|
|
15
|
+
ownedThrough = moment(itemOffered.reservationFor.endDate)
|
|
16
|
+
.toDate();
|
|
17
|
+
}
|
|
18
|
+
else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
19
|
+
ownedThrough = moment(itemOffered.reservationFor.arrivalTime)
|
|
20
|
+
.toDate();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new factory.errors.NotImplemented(`itemOffered.typeOf '${itemOffered.typeOf}' not implemented`);
|
|
24
|
+
}
|
|
15
25
|
let bookingService = params.acceptedOffer.offeredThrough;
|
|
16
26
|
if (bookingService === undefined) {
|
|
17
27
|
// デフォルトブッキングサービスはChevre
|
|
@@ -35,6 +45,16 @@ function createReservationOwnershipInfo(params) {
|
|
|
35
45
|
};
|
|
36
46
|
}
|
|
37
47
|
else {
|
|
48
|
+
let typeOfGood;
|
|
49
|
+
if (itemOffered.typeOf === factory.reservationType.EventReservation) {
|
|
50
|
+
typeOfGood = Object.assign({ typeOf: itemOffered.typeOf, id: itemOffered.id, reservationNumber: itemOffered.reservationNumber, bookingService: bookingService }, (typeof ((_a = itemOffered.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined);
|
|
51
|
+
}
|
|
52
|
+
else if (itemOffered.typeOf === factory.reservationType.BusReservation) {
|
|
53
|
+
typeOfGood = Object.assign({ typeOf: itemOffered.typeOf, id: itemOffered.id, reservationNumber: itemOffered.reservationNumber, bookingService: bookingService }, (typeof ((_b = itemOffered.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: itemOffered.issuedThrough } : undefined);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
throw new factory.errors.NotImplemented(`itemOffered.typeOf '${itemOffered.typeOf}' not implemented`);
|
|
57
|
+
}
|
|
38
58
|
ownershipInfo = {
|
|
39
59
|
project: params.project,
|
|
40
60
|
typeOf: 'OwnershipInfo',
|
|
@@ -44,9 +64,7 @@ function createReservationOwnershipInfo(params) {
|
|
|
44
64
|
acquiredFrom: params.acquiredFrom,
|
|
45
65
|
ownedFrom: params.ownedFrom,
|
|
46
66
|
ownedThrough: ownedThrough,
|
|
47
|
-
typeOfGood
|
|
48
|
-
? { issuedThrough: itemOffered.issuedThrough }
|
|
49
|
-
: undefined)
|
|
67
|
+
typeOfGood
|
|
50
68
|
};
|
|
51
69
|
}
|
|
52
70
|
return ownershipInfo;
|
|
@@ -209,58 +209,55 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
|
|
|
209
209
|
/**
|
|
210
210
|
* 注文データの予約を生成する
|
|
211
211
|
*/
|
|
212
|
+
// tslint:disable-next-line:max-func-body-length
|
|
212
213
|
function createReservation(params) {
|
|
213
214
|
var _a;
|
|
214
215
|
const itemOffered = params.itemOffered;
|
|
215
216
|
const event = params.event;
|
|
216
|
-
|
|
217
|
-
// 不要なので廃止(2022-12-19~)
|
|
218
|
-
// project: event.superEvent.workPerformed.project,
|
|
219
|
-
typeOf: event.superEvent.workPerformed.typeOf, id: event.superEvent.workPerformed.id, identifier: event.superEvent.workPerformed.identifier, name: event.superEvent.workPerformed.name }, (typeof event.superEvent.workPerformed.duration === 'string')
|
|
220
|
-
? { duration: event.superEvent.workPerformed.duration }
|
|
221
|
-
: undefined);
|
|
222
|
-
const reservationFor = {
|
|
223
|
-
// 不要なので廃止(2022-12-19~)
|
|
224
|
-
// project: event.project,
|
|
225
|
-
typeOf: event.typeOf,
|
|
226
|
-
// 予約のreservationForは最適化されているので、additionalPropertyは存在しない
|
|
227
|
-
// additionalProperty: itemOffered.reservationFor.additionalProperty,
|
|
228
|
-
// 不要なので廃止(2022-12-19~)
|
|
229
|
-
// eventStatus: event.eventStatus,
|
|
230
|
-
id: event.id,
|
|
231
|
-
location: event.location,
|
|
232
|
-
name: event.name,
|
|
233
|
-
doorTime: moment(event.doorTime)
|
|
234
|
-
.toDate(),
|
|
235
|
-
endDate: moment(event.endDate)
|
|
236
|
-
.toDate(),
|
|
237
|
-
startDate: moment(event.startDate)
|
|
238
|
-
.toDate(),
|
|
239
|
-
// 最適化(2022-05-31~)
|
|
240
|
-
superEvent: Object.assign(Object.assign({
|
|
241
|
-
// 不要なので廃止(2022-12-19~)
|
|
242
|
-
// project: event.superEvent.project,
|
|
243
|
-
typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
|
|
244
|
-
// 廃止(superEvent.workPerformedへ完全移行)
|
|
245
|
-
// workPerformed: {},
|
|
246
|
-
};
|
|
217
|
+
let reservationItem;
|
|
247
218
|
const reservedTicket = Object.assign({ typeOf: itemOffered.reservedTicket.typeOf, ticketType: {
|
|
248
|
-
// 不要なので廃止(2022-12-17~)
|
|
249
|
-
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
250
219
|
typeOf: itemOffered.reservedTicket.ticketType.typeOf,
|
|
251
220
|
id: itemOffered.reservedTicket.ticketType.id,
|
|
252
221
|
identifier: itemOffered.reservedTicket.ticketType.identifier,
|
|
253
222
|
name: itemOffered.reservedTicket.ticketType.name,
|
|
254
223
|
description: itemOffered.reservedTicket.ticketType.description,
|
|
255
224
|
additionalProperty: itemOffered.reservedTicket.ticketType.additionalProperty
|
|
256
|
-
// 不要なので廃止(2022-12-17~)
|
|
257
|
-
// priceCurrency: itemOffered.reservedTicket.ticketType.priceCurrency
|
|
258
225
|
} }, (itemOffered.reservedTicket.ticketedSeat !== undefined)
|
|
259
226
|
? { ticketedSeat: itemOffered.reservedTicket.ticketedSeat }
|
|
260
227
|
: undefined);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
:
|
|
228
|
+
if (itemOffered.typeOf === factory.reservationType.EventReservation
|
|
229
|
+
&& event.typeOf === factory.eventType.ScreeningEvent) {
|
|
230
|
+
const workPerformed = Object.assign({ typeOf: event.superEvent.workPerformed.typeOf, id: event.superEvent.workPerformed.id, identifier: event.superEvent.workPerformed.identifier, name: event.superEvent.workPerformed.name }, (typeof event.superEvent.workPerformed.duration === 'string')
|
|
231
|
+
? { duration: event.superEvent.workPerformed.duration }
|
|
232
|
+
: undefined);
|
|
233
|
+
const reservationFor = {
|
|
234
|
+
typeOf: event.typeOf,
|
|
235
|
+
id: event.id,
|
|
236
|
+
location: event.location,
|
|
237
|
+
name: event.name,
|
|
238
|
+
doorTime: moment(event.doorTime)
|
|
239
|
+
.toDate(),
|
|
240
|
+
endDate: moment(event.endDate)
|
|
241
|
+
.toDate(),
|
|
242
|
+
startDate: moment(event.startDate)
|
|
243
|
+
.toDate(),
|
|
244
|
+
// 最適化(2022-05-31~)
|
|
245
|
+
superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
|
|
246
|
+
// 廃止(superEvent.workPerformedへ完全移行)
|
|
247
|
+
// workPerformed: {},
|
|
248
|
+
};
|
|
249
|
+
reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor: reservationFor, reservedTicket: reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
250
|
+
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
251
|
+
: undefined);
|
|
252
|
+
}
|
|
253
|
+
else if (itemOffered.typeOf === factory.reservationType.BusReservation
|
|
254
|
+
&& event.typeOf === factory.eventType.Event) {
|
|
255
|
+
throw new factory.errors.NotImplemented(`${itemOffered.typeOf} not impelemented`);
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
throw new factory.errors.Argument('itemOffered');
|
|
259
|
+
}
|
|
260
|
+
return reservationItem;
|
|
264
261
|
}
|
|
265
262
|
function coaTicket2offer(params) {
|
|
266
263
|
var _a, _b;
|
|
@@ -62,7 +62,7 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
62
62
|
id: cancelingSubReservation.id,
|
|
63
63
|
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
64
64
|
subReservation: cancelingSubReservation.subReservation,
|
|
65
|
-
reservationFor: { id: reservationFor.id }
|
|
65
|
+
reservationFor: { id: String(reservationFor.id) }
|
|
66
66
|
},
|
|
67
67
|
expectedHolder: reserveTransactionId
|
|
68
68
|
})(repos);
|
|
@@ -197,7 +197,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
197
197
|
id: cancelingSubReservation.id,
|
|
198
198
|
reservedTicket: cancelingSubReservation.reservedTicket,
|
|
199
199
|
subReservation: cancelingSubReservation.subReservation,
|
|
200
|
-
reservationFor: { id: reservationFor.id }
|
|
200
|
+
reservationFor: { id: String(reservationFor.id) }
|
|
201
201
|
},
|
|
202
202
|
expectedHolder: reserveTransaction.id
|
|
203
203
|
})(repos);
|
|
@@ -384,8 +384,11 @@ function processUnlockOfferRateLimit(params) {
|
|
|
384
384
|
}
|
|
385
385
|
},
|
|
386
386
|
reservationFor: {
|
|
387
|
-
startDate:
|
|
388
|
-
.
|
|
387
|
+
startDate: (params.reservationFor.typeOf === factory.eventType.ScreeningEvent)
|
|
388
|
+
? moment(params.reservationFor.startDate)
|
|
389
|
+
.toDate()
|
|
390
|
+
: moment(params.reservationFor.departureTime)
|
|
391
|
+
.toDate()
|
|
389
392
|
},
|
|
390
393
|
reservationNumber: reservation.reservationNumber
|
|
391
394
|
};
|
|
@@ -20,8 +20,8 @@ function createReservationAcceptedOffers(params) {
|
|
|
20
20
|
const reservationFor = resultAcceptedOffers[0].itemOffered.reservationFor;
|
|
21
21
|
const issuedThrough = resultAcceptedOffers[0].itemOffered.issuedThrough;
|
|
22
22
|
if (typeof (issuedThrough === null || issuedThrough === void 0 ? void 0 : issuedThrough.typeOf) === 'string') {
|
|
23
|
-
if (!eventIds.includes(reservationFor.id)) {
|
|
24
|
-
eventIds.push(reservationFor.id);
|
|
23
|
+
if (!eventIds.includes(String(reservationFor.id))) {
|
|
24
|
+
eventIds.push(String(reservationFor.id));
|
|
25
25
|
const orderedItem = reservationOffers2orderedItem({ reservationFor, issuedThrough });
|
|
26
26
|
orderedItems.push({
|
|
27
27
|
typeOf: 'OrderItem',
|
|
@@ -38,6 +38,9 @@ function reservationOffers2orderedItem(params) {
|
|
|
38
38
|
var _a, _b, _c, _d;
|
|
39
39
|
const reservationFor = params.reservationFor;
|
|
40
40
|
const issuedThrough = params.issuedThrough;
|
|
41
|
+
if (reservationFor.typeOf !== factory.eventType.ScreeningEvent) {
|
|
42
|
+
throw new factory.errors.NotImplemented(`reservationFor.typeOf '${reservationFor.typeOf}' not implemented`);
|
|
43
|
+
}
|
|
41
44
|
const reservationFor4orderedItem = {
|
|
42
45
|
location: {
|
|
43
46
|
branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
@@ -54,10 +57,10 @@ function reservationOffers2orderedItem(params) {
|
|
|
54
57
|
startDate: reservationFor.startDate,
|
|
55
58
|
endDate: reservationFor.endDate
|
|
56
59
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
if (issuedThrough.typeOf !== factory.product.ProductType.EventService) {
|
|
61
|
+
throw new factory.errors.NotImplemented(`issuedThrough.typeOf '${issuedThrough.typeOf}' not implemented`);
|
|
62
|
+
}
|
|
63
|
+
return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
61
64
|
? { serviceType: issuedThrough.serviceType }
|
|
62
65
|
: undefined), { serviceOutput: {
|
|
63
66
|
typeOf: factory.reservationType.EventReservation,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.281.0-alpha.1",
|
|
13
13
|
"@cinerino/sdk": "3.135.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.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.
|
|
123
|
+
"version": "20.2.0-alpha.1"
|
|
124
124
|
}
|