@chevre/domain 21.15.0-alpha.8 → 21.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/searchProjects.ts +33 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +3 -2
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/place.d.ts +7 -6
- package/lib/chevre/repo/place.js +6 -9
- package/lib/chevre/repo/project.d.ts +9 -6
- package/lib/chevre/repo/project.js +22 -55
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/offer.d.ts +2 -1
- package/lib/chevre/service/offer.js +15 -9
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +5 -7
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +6 -5
- package/lib/chevre/service/transaction/returnOrder.d.ts +2 -0
- package/lib/chevre/service/transaction/returnOrder.js +181 -59
- package/lib/chevre/settings.d.ts +2 -1
- package/lib/chevre/settings.js +27 -14
- package/package.json +3 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const project = await projectRepo.findById({
|
|
12
|
+
id: 'xxx',
|
|
13
|
+
inclusion: [],
|
|
14
|
+
exclusion: ['settings']
|
|
15
|
+
});
|
|
16
|
+
console.log('project:', project);
|
|
17
|
+
|
|
18
|
+
const projects = await projectRepo.search(
|
|
19
|
+
{
|
|
20
|
+
limit: 1,
|
|
21
|
+
page: 1,
|
|
22
|
+
id: { $eq: project.id }
|
|
23
|
+
},
|
|
24
|
+
['_id', 'name'],
|
|
25
|
+
[]
|
|
26
|
+
);
|
|
27
|
+
console.log(projects);
|
|
28
|
+
console.log(projects.length, 'projects found');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main()
|
|
32
|
+
.then(console.log)
|
|
33
|
+
.catch(console.error);
|
|
@@ -14,8 +14,8 @@ async function main() {
|
|
|
14
14
|
agent: { id: 'xxx', typeOf: chevre.factory.creativeWorkType.WebApplication },
|
|
15
15
|
object: {
|
|
16
16
|
order: [{
|
|
17
|
-
confirmationNumber: '
|
|
18
|
-
orderNumber: '
|
|
17
|
+
confirmationNumber: '60050',
|
|
18
|
+
orderNumber: 'CIN0-2033389-8046472'
|
|
19
19
|
}],
|
|
20
20
|
reason: chevre.factory.transaction.returnOrder.Reason.Customer
|
|
21
21
|
},
|
|
@@ -28,6 +28,7 @@ async function main() {
|
|
|
28
28
|
offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
29
29
|
offerItemCondition: await chevre.repository.OfferItemCondition.createInstance(mongoose.connection),
|
|
30
30
|
order: await chevre.repository.Order.createInstance(mongoose.connection),
|
|
31
|
+
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
31
32
|
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
|
|
32
33
|
seller: await chevre.repository.Seller.createInstance(mongoose.connection),
|
|
33
34
|
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection)
|
|
@@ -11,6 +11,7 @@ const schemaDefinition = {
|
|
|
11
11
|
aggregateReservation: mongoose_1.SchemaTypes.Mixed,
|
|
12
12
|
alternateName: String,
|
|
13
13
|
logo: String,
|
|
14
|
+
hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
|
|
14
15
|
name: String,
|
|
15
16
|
settings: mongoose_1.SchemaTypes.Mixed,
|
|
16
17
|
subscription: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -22,21 +22,22 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { AnyExpression, Connection } from 'mongoose';
|
|
25
|
+
import type { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
28
28
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
29
29
|
export type IMovieTheaterIncludingScreeningRooms = factory.place.movieTheater.IPlace & {
|
|
30
30
|
containsPlace: factory.place.screeningRoom.IPlace[];
|
|
31
31
|
};
|
|
32
|
+
type IKeyOfProjectionMovieTheater = keyof factory.place.movieTheater.IPlace | '_id';
|
|
32
33
|
/**
|
|
33
34
|
* 施設リポジトリ
|
|
34
35
|
*/
|
|
35
36
|
export declare class MongoRepository {
|
|
36
37
|
private readonly placeModel;
|
|
37
38
|
constructor(connection: Connection);
|
|
38
|
-
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions):
|
|
39
|
-
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions):
|
|
39
|
+
static CREATE_BUS_STOP_MONGO_CONDITIONS(params: factory.place.busStop.ISearchConditions): FilterQuery<import("@chevre/factory/lib/place/busStop").IPlace>[];
|
|
40
|
+
static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params: factory.place.movieTheater.ISearchConditions): FilterQuery<import("@chevre/factory/lib/place/movieTheater").IPlace>[];
|
|
40
41
|
static CREATE_SEARCH_SEATS_PROJECTION(params: factory.place.seat.IProjection): {
|
|
41
42
|
[field: string]: AnyExpression;
|
|
42
43
|
};
|
|
@@ -48,7 +49,7 @@ export declare class MongoRepository {
|
|
|
48
49
|
/**
|
|
49
50
|
* 施設検索
|
|
50
51
|
*/
|
|
51
|
-
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions, inclusion:
|
|
52
|
+
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions, inclusion: IKeyOfProjectionMovieTheater[], exclusion: IKeyOfProjectionMovieTheater[]): Promise<factory.place.movieTheater.IPlace[]>;
|
|
52
53
|
deleteMovieTheaterById(params: {
|
|
53
54
|
project: {
|
|
54
55
|
id: string;
|
|
@@ -284,7 +285,7 @@ export declare class MongoRepository {
|
|
|
284
285
|
typeOf: factory.placeType.ScreeningRoom;
|
|
285
286
|
}>;
|
|
286
287
|
unsetUnnecessaryFieldsFromMovieTheater(params: {
|
|
287
|
-
filter: any
|
|
288
|
+
filter: FilterQuery<any>;
|
|
288
289
|
$unset: any;
|
|
289
290
|
}): Promise<import("mongodb").UpdateResult>;
|
|
290
291
|
deleteManyByParentOrganizationId(params: {
|
|
@@ -320,6 +321,6 @@ export declare class MongoRepository {
|
|
|
320
321
|
};
|
|
321
322
|
id: string;
|
|
322
323
|
}): Promise<void>;
|
|
323
|
-
getCursor(conditions: any
|
|
324
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
324
325
|
}
|
|
325
326
|
export {};
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -24,7 +24,6 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const place_1 = require("./mongoose/schemas/place");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const settings_1 = require("../settings");
|
|
27
|
-
// const debug = createDebug('chevre-domain:repo:place');
|
|
28
27
|
/**
|
|
29
28
|
* 施設リポジトリ
|
|
30
29
|
*/
|
|
@@ -210,17 +209,17 @@ class MongoRepository {
|
|
|
210
209
|
return andConditions;
|
|
211
210
|
}
|
|
212
211
|
static CREATE_SEARCH_SEATS_PROJECTION(params) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
const includeSectionBranchCode = params['containedInPlace.branchCode'] !== 0;
|
|
213
|
+
const includeSectionName = params['containedInPlace.name'] !== 0;
|
|
214
|
+
const includeSectionTypeOf = params['containedInPlace.typeOf'] !== 0;
|
|
215
|
+
const includeScreeningRooms = params['containedInPlace.containedInPlace'] !== 0;
|
|
217
216
|
const projectStage = {
|
|
218
217
|
_id: 0,
|
|
219
218
|
typeOf: '$containsPlace.containsPlace.typeOf',
|
|
220
219
|
branchCode: '$containsPlace.containsPlace.branchCode',
|
|
221
220
|
name: '$containsPlace.containsPlace.name',
|
|
222
221
|
seatingType: '$containsPlace.containsPlace.seatingType',
|
|
223
|
-
containedInPlace: Object.assign({
|
|
222
|
+
containedInPlace: Object.assign(Object.assign(Object.assign(Object.assign({}, (includeSectionBranchCode) ? { branchCode: '$containsPlace.branchCode' } : undefined), (includeSectionName) ? { name: '$containsPlace.name' } : undefined), (includeSectionTypeOf) ? { typeOf: '$containsPlace.typeOf' } : undefined), (includeScreeningRooms)
|
|
224
223
|
? {
|
|
225
224
|
containedInPlace: {
|
|
226
225
|
typeOf: '$typeOf',
|
|
@@ -333,9 +332,7 @@ class MongoRepository {
|
|
|
333
332
|
/**
|
|
334
333
|
* 施設検索
|
|
335
334
|
*/
|
|
336
|
-
searchMovieTheaters(params,
|
|
337
|
-
// projection明示指定化(2023-06-22~)
|
|
338
|
-
inclusion, exclusion) {
|
|
335
|
+
searchMovieTheaters(params, inclusion, exclusion) {
|
|
339
336
|
var _a;
|
|
340
337
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
338
|
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
@@ -22,19 +22,20 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import type { Connection } from 'mongoose';
|
|
25
|
+
import type { Connection, FilterQuery } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
+
type IKeyOfProjection = keyof factory.project.IProject | '_id';
|
|
27
28
|
/**
|
|
28
29
|
* プロジェクトリポジトリ
|
|
29
30
|
*/
|
|
30
31
|
export declare class MongoRepository {
|
|
31
32
|
private readonly projectModel;
|
|
32
33
|
constructor(connection: Connection);
|
|
33
|
-
static CREATE_MONGO_CONDITIONS(params: factory.project.ISearchConditions):
|
|
34
|
+
static CREATE_MONGO_CONDITIONS(params: factory.project.ISearchConditions): FilterQuery<factory.project.IProject>[];
|
|
34
35
|
findById(params: {
|
|
35
36
|
id: string;
|
|
36
|
-
inclusion:
|
|
37
|
-
exclusion:
|
|
37
|
+
inclusion: IKeyOfProjection[];
|
|
38
|
+
exclusion: IKeyOfProjection[];
|
|
38
39
|
}): Promise<factory.project.IProject>;
|
|
39
40
|
findAlternateNameById(params: {
|
|
40
41
|
id: string;
|
|
@@ -42,12 +43,13 @@ export declare class MongoRepository {
|
|
|
42
43
|
/**
|
|
43
44
|
* プロジェクト検索
|
|
44
45
|
*/
|
|
45
|
-
search(conditions: factory.project.ISearchConditions, inclusion:
|
|
46
|
+
search(conditions: factory.project.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.project.IProject[]>;
|
|
46
47
|
createById(params: factory.project.IProject): Promise<factory.project.IProject>;
|
|
47
48
|
findByIdAndIUpdate(params: {
|
|
48
49
|
id: string;
|
|
49
50
|
alternateName?: string;
|
|
50
51
|
logo?: string;
|
|
52
|
+
hasMerchantReturnPolicy?: Pick<factory.project.IHasMerchantReturnPolicy, 'sameAs'>;
|
|
51
53
|
name?: string;
|
|
52
54
|
settings?: {
|
|
53
55
|
sendEmailMessage?: factory.project.ISendEmailMessageSettings;
|
|
@@ -64,5 +66,6 @@ export declare class MongoRepository {
|
|
|
64
66
|
deleteById(params: {
|
|
65
67
|
id: string;
|
|
66
68
|
}): Promise<void>;
|
|
67
|
-
getCursor(conditions:
|
|
69
|
+
getCursor(conditions: FilterQuery<factory.project.IProject>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
68
70
|
}
|
|
71
|
+
export {};
|
|
@@ -21,63 +21,36 @@ class MongoRepository {
|
|
|
21
21
|
this.projectModel = connection.model(project_1.modelName, (0, project_1.createSchema)());
|
|
22
22
|
}
|
|
23
23
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
24
|
-
|
|
24
|
+
var _a;
|
|
25
25
|
const andConditions = [];
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
27
|
+
if (typeof idEq === 'string') {
|
|
28
|
+
andConditions.push({ _id: { $eq: idEq } });
|
|
29
|
+
}
|
|
28
30
|
if (Array.isArray(params.ids)) {
|
|
29
31
|
andConditions.push({ _id: { $in: params.ids } });
|
|
30
32
|
}
|
|
31
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
32
|
-
/* istanbul ignore else */
|
|
33
33
|
if (typeof params.name === 'string' && params.name.length > 0) {
|
|
34
34
|
andConditions.push({
|
|
35
35
|
$or: [
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
$exists: true,
|
|
39
|
-
$regex: new RegExp(params.name)
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: {
|
|
44
|
-
$exists: true,
|
|
45
|
-
$regex: new RegExp(params.name)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
36
|
+
{ alternateName: { $exists: true, $regex: new RegExp(params.name) } },
|
|
37
|
+
{ name: { $exists: true, $regex: new RegExp(params.name) } }
|
|
48
38
|
]
|
|
49
39
|
});
|
|
50
40
|
}
|
|
51
41
|
return andConditions;
|
|
52
42
|
}
|
|
53
|
-
findById(params
|
|
54
|
-
// projection?: any
|
|
55
|
-
) {
|
|
43
|
+
findById(params) {
|
|
56
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
else {
|
|
64
|
-
projection = {
|
|
65
|
-
__v: 0,
|
|
66
|
-
createdAt: 0,
|
|
67
|
-
updatedAt: 0
|
|
68
|
-
};
|
|
69
|
-
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
70
|
-
params.exclusion.forEach((field) => {
|
|
71
|
-
projection[field] = 0;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const doc = yield this.projectModel.findOne({ _id: { $eq: params.id } }, projection)
|
|
76
|
-
.exec();
|
|
77
|
-
if (doc === null) {
|
|
45
|
+
const project = (yield this.search({
|
|
46
|
+
limit: 1,
|
|
47
|
+
page: 1,
|
|
48
|
+
id: { $eq: params.id }
|
|
49
|
+
}, params.inclusion, params.exclusion)).shift();
|
|
50
|
+
if (project === undefined) {
|
|
78
51
|
throw new factory.errors.NotFound(this.projectModel.modelName);
|
|
79
52
|
}
|
|
80
|
-
return
|
|
53
|
+
return project;
|
|
81
54
|
});
|
|
82
55
|
}
|
|
83
56
|
findAlternateNameById(params) {
|
|
@@ -93,11 +66,7 @@ class MongoRepository {
|
|
|
93
66
|
/**
|
|
94
67
|
* プロジェクト検索
|
|
95
68
|
*/
|
|
96
|
-
search(conditions,
|
|
97
|
-
// inclusion対応(2023-07-27~)
|
|
98
|
-
inclusion, exclusion
|
|
99
|
-
// projection?: any
|
|
100
|
-
) {
|
|
69
|
+
search(conditions, inclusion, exclusion) {
|
|
101
70
|
var _a;
|
|
102
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
72
|
const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
|
|
@@ -125,8 +94,6 @@ class MongoRepository {
|
|
|
125
94
|
query.limit(conditions.limit)
|
|
126
95
|
.skip(conditions.limit * (page - 1));
|
|
127
96
|
}
|
|
128
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
129
|
-
/* istanbul ignore else */
|
|
130
97
|
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a._id) !== undefined) {
|
|
131
98
|
query.sort({ _id: conditions.sort._id });
|
|
132
99
|
}
|
|
@@ -142,9 +109,9 @@ class MongoRepository {
|
|
|
142
109
|
});
|
|
143
110
|
}
|
|
144
111
|
findByIdAndIUpdate(params) {
|
|
145
|
-
var _a, _b, _c, _d, _e;
|
|
112
|
+
var _a, _b, _c, _d, _e, _f;
|
|
146
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
114
|
+
yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
|
|
148
115
|
? { alternateName: params.alternateName }
|
|
149
116
|
: undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_c = (_b = (_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendEmailMessage) === null || _b === void 0 ? void 0 : _b.sender) === null || _c === void 0 ? void 0 : _c.email) === 'string')
|
|
150
117
|
? {
|
|
@@ -156,10 +123,10 @@ class MongoRepository {
|
|
|
156
123
|
? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
|
|
157
124
|
: undefined), (typeof ((_e = params.subscription) === null || _e === void 0 ? void 0 : _e.useEventServiceAsProduct) === 'boolean')
|
|
158
125
|
? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
|
|
159
|
-
: undefined),
|
|
160
|
-
|
|
161
|
-
$unset: {
|
|
162
|
-
'settings.cognito
|
|
126
|
+
: undefined), (typeof ((_f = params.hasMerchantReturnPolicy) === null || _f === void 0 ? void 0 : _f.sameAs) === 'string')
|
|
127
|
+
? { 'hasMerchantReturnPolicy.sameAs': params.hasMerchantReturnPolicy.sameAs }
|
|
128
|
+
: undefined), { $unset: {
|
|
129
|
+
'settings.cognito': 1 // 廃止(2023-11-10~)
|
|
163
130
|
} }))
|
|
164
131
|
.exec();
|
|
165
132
|
});
|
|
@@ -17,7 +17,7 @@ function createPrice(params) {
|
|
|
17
17
|
name: priceSpec.name,
|
|
18
18
|
price: priceSpec.price,
|
|
19
19
|
priceCurrency: priceSpec.priceCurrency,
|
|
20
|
-
project: priceSpec.project,
|
|
20
|
+
// project: priceSpec.project,
|
|
21
21
|
typeOf: priceSpec.typeOf,
|
|
22
22
|
appliesToCategoryCode: priceSpec.appliesToCategoryCode,
|
|
23
23
|
valueAddedTaxIncluded: priceSpec.valueAddedTaxIncluded
|
|
@@ -9,6 +9,7 @@ import * as EventOfferService from './offer/event';
|
|
|
9
9
|
import * as EventServiceByCOAOfferService from './offer/eventServiceByCOA';
|
|
10
10
|
import * as MoneyTransferOfferService from './offer/moneyTransfer';
|
|
11
11
|
import * as ProductOfferService from './offer/product';
|
|
12
|
+
type ICategoryCodeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>;
|
|
12
13
|
export { EventOfferService as event, EventServiceByCOAOfferService as eventServiceByCOA, MoneyTransferOfferService as moneyTransfer, ProductOfferService as product };
|
|
13
14
|
/**
|
|
14
15
|
* 座席にオファー情報を付加する
|
|
@@ -19,7 +20,7 @@ export declare function addOffers2Seat(params: {
|
|
|
19
20
|
/**
|
|
20
21
|
* 座席区分加算料金
|
|
21
22
|
*/
|
|
22
|
-
priceSpecs:
|
|
23
|
+
priceSpecs: ICategoryCodeChargeSpecification[];
|
|
23
24
|
}): factory.place.seat.IPlaceWithOffer;
|
|
24
25
|
/**
|
|
25
26
|
* イベントに対する座席オファーを検索する
|
|
@@ -30,13 +30,19 @@ function addOffers2Seat(params) {
|
|
|
30
30
|
const seatingTypes = (Array.isArray(params.seat.seatingType))
|
|
31
31
|
? params.seat.seatingType
|
|
32
32
|
: (typeof params.seat.seatingType === 'string' && params.seat.seatingType.length > 0) ? [params.seat.seatingType] : [];
|
|
33
|
-
const priceComponent = params.priceSpecs.filter((
|
|
33
|
+
const priceComponent = params.priceSpecs.filter((priceSpec) => {
|
|
34
34
|
// 適用カテゴリーコードに座席タイプが含まれる価格仕様を検索
|
|
35
|
-
return (Array.isArray(
|
|
36
|
-
&&
|
|
35
|
+
return (Array.isArray(priceSpec.appliesToCategoryCode))
|
|
36
|
+
&& priceSpec.appliesToCategoryCode.some((categoryCode) => {
|
|
37
37
|
return seatingTypes.includes(categoryCode.codeValue);
|
|
38
|
-
// && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
|
|
39
38
|
});
|
|
39
|
+
})
|
|
40
|
+
.map(({ appliesToCategoryCode, name, price, priceCurrency, typeOf, valueAddedTaxIncluded }) => {
|
|
41
|
+
return {
|
|
42
|
+
appliesToCategoryCode,
|
|
43
|
+
// id,
|
|
44
|
+
name, price, priceCurrency, typeOf, valueAddedTaxIncluded
|
|
45
|
+
};
|
|
40
46
|
});
|
|
41
47
|
const priceSpecification = {
|
|
42
48
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
@@ -46,11 +52,11 @@ function addOffers2Seat(params) {
|
|
|
46
52
|
if (typeof params.availability === 'string') {
|
|
47
53
|
availability = params.availability;
|
|
48
54
|
}
|
|
49
|
-
return Object.assign(Object.assign({}, params.seat), { offers: [{
|
|
50
|
-
typeOf: factory.offerType.Offer,
|
|
51
|
-
availability,
|
|
52
|
-
priceSpecification
|
|
53
|
-
|
|
55
|
+
return Object.assign(Object.assign({}, params.seat), { offers: [Object.assign({
|
|
56
|
+
// typeOf: factory.offerType.Offer, // optimize(2023-11-08~)
|
|
57
|
+
availability }, (priceSpecification.priceComponent.length > 0)
|
|
58
|
+
? { priceSpecification } // priceComponentの存在する場合のみ追加(2023-11-08~)
|
|
59
|
+
: undefined)] });
|
|
54
60
|
}
|
|
55
61
|
exports.addOffers2Seat = addOffers2Seat;
|
|
56
62
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createOrder = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
|
+
const settings_1 = require("../../../settings");
|
|
5
6
|
const acceptedOffers_1 = require("./result/acceptedOffers");
|
|
6
7
|
/**
|
|
7
8
|
* 注文を生成する
|
|
@@ -85,14 +86,11 @@ function createPaymentMethods(params) {
|
|
|
85
86
|
throw new factory.errors.NotFound('authorizePaymentAction.result.paymentMethodAsObject.typeOf');
|
|
86
87
|
}
|
|
87
88
|
const paymentMethodOfInvoice = Object.assign({ identifier: paymentMethodType }, (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
88
|
-
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
|
|
89
|
+
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } } // CreditCardIFのカード通貨区分を追加(2023-08-15~)
|
|
89
90
|
: undefined);
|
|
90
|
-
paymentMethods.push(Object.assign({ accountId: resultAsInvoice.accountId, additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [], issuedThrough: resultAsInvoice.issuedThrough, name: resultAsInvoice.name, paymentMethodId: resultAsInvoice.paymentMethodId, paymentStatus: resultAsInvoice.paymentStatus, totalPaymentDue: resultAsInvoice.totalPaymentDue,
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
paymentMethod: paymentMethodOfInvoice }, {
|
|
94
|
-
typeOf: paymentMethodType // IFとして廃止だが、互換性維持対応として(2023-10-30~)
|
|
95
|
-
}));
|
|
91
|
+
paymentMethods.push(Object.assign({ accountId: resultAsInvoice.accountId, additionalProperty: (Array.isArray(resultAsInvoice.additionalProperty)) ? resultAsInvoice.additionalProperty : [], issuedThrough: resultAsInvoice.issuedThrough, name: resultAsInvoice.name, paymentMethodId: resultAsInvoice.paymentMethodId, paymentStatus: resultAsInvoice.paymentStatus, totalPaymentDue: resultAsInvoice.totalPaymentDue, paymentMethod: paymentMethodOfInvoice }, (settings_1.USE_ORDER_PAYMENT_METHOD_TYPE_OF)
|
|
92
|
+
? { typeOf: paymentMethodType } // IFとして廃止だが、互換性維持対応として(2023-10-30~)
|
|
93
|
+
: undefined));
|
|
96
94
|
});
|
|
97
95
|
// 決済方法から注文金額の計算
|
|
98
96
|
price += authorizePaymentActions
|
|
@@ -237,17 +237,18 @@ function validateNumItems(params) {
|
|
|
237
237
|
}
|
|
238
238
|
exports.validateNumItems = validateNumItems;
|
|
239
239
|
function validatePaymentMethods(params) {
|
|
240
|
-
if (typeof settings_1.
|
|
240
|
+
if (typeof settings_1.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'number') {
|
|
241
241
|
// CreditCard IFの決済方法の最大値検証
|
|
242
242
|
const creditCardPaymentMethodCount = params.order.paymentMethods.filter((p) => {
|
|
243
243
|
var _a, _b;
|
|
244
244
|
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
245
245
|
const serviceOutputAmountCurrency = (_b = (_a = p.paymentMethod) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
const isCurrencyJPY = typeof serviceOutputAmountCurrency !== 'string'
|
|
247
|
+
|| serviceOutputAmountCurrency === factory.priceCurrency.JPY;
|
|
248
|
+
return p.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard && isCurrencyJPY;
|
|
248
249
|
}).length;
|
|
249
|
-
if (creditCardPaymentMethodCount > settings_1.
|
|
250
|
-
throw new factory.errors.Argument('Transaction', (0, util_1.format)(`Number of paymentMethods issued through ${factory.service.paymentService.PaymentServiceType.CreditCard} payment service must be less than equal to %s`, settings_1.
|
|
250
|
+
if (creditCardPaymentMethodCount > settings_1.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD) {
|
|
251
|
+
throw new factory.errors.Argument('Transaction', (0, util_1.format)(`Number of paymentMethods issued through ${factory.service.paymentService.PaymentServiceType.CreditCard} payment service must be less than equal to %s`, settings_1.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD));
|
|
251
252
|
}
|
|
252
253
|
}
|
|
253
254
|
}
|
|
@@ -5,6 +5,7 @@ import type { MongoRepository as MerchantReturnPolicyRepo } from '../../repo/mer
|
|
|
5
5
|
import type { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
6
6
|
import type { MongoRepository as OfferItemConditionRepo } from '../../repo/offerItemCondition';
|
|
7
7
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
8
|
+
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
8
9
|
import type { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
9
10
|
import type { MongoRepository as SellerRepo } from '../../repo/seller';
|
|
10
11
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
@@ -15,6 +16,7 @@ export interface IStartOperationRepos {
|
|
|
15
16
|
offer: OfferRepo;
|
|
16
17
|
offerItemCondition: OfferItemConditionRepo;
|
|
17
18
|
order: OrderRepo;
|
|
19
|
+
project: ProjectRepo;
|
|
18
20
|
reservation: ReservationRepo;
|
|
19
21
|
seller: SellerRepo;
|
|
20
22
|
transaction: TransactionRepo;
|
|
@@ -8,13 +8,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
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
|
+
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
23
|
exports.exportTasksById = exports.confirm = exports.start = void 0;
|
|
13
24
|
/**
|
|
14
25
|
* 返品取引サービス
|
|
15
26
|
*/
|
|
16
27
|
const createDebug = require("debug");
|
|
28
|
+
const http_status_1 = require("http-status");
|
|
17
29
|
const moment = require("moment-timezone");
|
|
30
|
+
const request = require("request");
|
|
18
31
|
const factory = require("../../factory");
|
|
19
32
|
const factory_1 = require("./returnOrder/exportTasks/factory");
|
|
20
33
|
const potentialActions_1 = require("./returnOrder/potentialActions");
|
|
@@ -75,7 +88,12 @@ function start(params) {
|
|
|
75
88
|
}
|
|
76
89
|
const policiesByOffer = yield searchPoliciesByOffer({ offers })(repos);
|
|
77
90
|
const { usedReservationExists } = yield checkUsedReservationExists({ orders })(repos);
|
|
78
|
-
const
|
|
91
|
+
const { hasMerchantReturnPolicy } = yield repos.project.findById({
|
|
92
|
+
id: seller.project.id,
|
|
93
|
+
inclusion: ['hasMerchantReturnPolicy'],
|
|
94
|
+
exclusion: []
|
|
95
|
+
});
|
|
96
|
+
const appliedReturnPolicy = yield findApplicableReturnPolicy({
|
|
79
97
|
acceptedOffers,
|
|
80
98
|
events,
|
|
81
99
|
offerItemConditions,
|
|
@@ -83,6 +101,7 @@ function start(params) {
|
|
|
83
101
|
returningDate: now,
|
|
84
102
|
reason: params.object.reason,
|
|
85
103
|
returnPolicies,
|
|
104
|
+
returnPolicySettingsByProject: hasMerchantReturnPolicy,
|
|
86
105
|
offers,
|
|
87
106
|
policiesByOffer,
|
|
88
107
|
usedReservationExists
|
|
@@ -154,8 +173,7 @@ function fixOrders(params) {
|
|
|
154
173
|
confirmationNumbers: [params.object.order[0].confirmationNumber],
|
|
155
174
|
orderNumbers: [params.object.order[0].orderNumber]
|
|
156
175
|
}, {
|
|
157
|
-
//
|
|
158
|
-
acceptedOffers: 0,
|
|
176
|
+
// acceptedOffers: 0, // カスタム返品ポリシーに必要
|
|
159
177
|
customer: 0,
|
|
160
178
|
orderedItem: 0
|
|
161
179
|
// paymentMethods: 0 // 適用決済方法検証に必要
|
|
@@ -256,70 +274,174 @@ function searchPoliciesByOffer(params) {
|
|
|
256
274
|
return policiesByOffer;
|
|
257
275
|
});
|
|
258
276
|
}
|
|
277
|
+
function createOrder4returnPolicy(params) {
|
|
278
|
+
return {
|
|
279
|
+
orderDate: params.order.orderDate,
|
|
280
|
+
price: params.order.price,
|
|
281
|
+
acceptedOffers: (Array.isArray(params.order.acceptedOffers))
|
|
282
|
+
? params.order.acceptedOffers.map((o) => {
|
|
283
|
+
var _a;
|
|
284
|
+
if (o.itemOffered.typeOf === factory.reservationType.EventReservation) {
|
|
285
|
+
const reservation = o.itemOffered;
|
|
286
|
+
const priceComponent = (_a = o.priceSpecification) === null || _a === void 0 ? void 0 : _a.priceComponent;
|
|
287
|
+
return {
|
|
288
|
+
itemOffered: {
|
|
289
|
+
additionalProperty: reservation.additionalProperty,
|
|
290
|
+
reservationFor: {
|
|
291
|
+
doorTime: reservation.reservationFor.doorTime,
|
|
292
|
+
endDate: reservation.reservationFor.endDate,
|
|
293
|
+
startDate: reservation.reservationFor.startDate
|
|
294
|
+
// superEvent: reservation.reservationFor.superEvent
|
|
295
|
+
},
|
|
296
|
+
reservedTicket: {
|
|
297
|
+
ticketedSeat: reservation.reservedTicket.ticketedSeat
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
priceSpecification: {
|
|
301
|
+
priceComponent: (Array.isArray(priceComponent))
|
|
302
|
+
? priceComponent.map((component) => {
|
|
303
|
+
const { accounting, name, priceCurrency, valueAddedTaxIncluded } = component, postingComponent = __rest(component, ["accounting", "name", "priceCurrency", "valueAddedTaxIncluded"]);
|
|
304
|
+
return postingComponent;
|
|
305
|
+
})
|
|
306
|
+
: []
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
return {
|
|
312
|
+
priceSpecification: o.priceSpecification
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
: []
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
const TIMEOUT = 5000;
|
|
320
|
+
function getReturnPolicyByProject(params) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
return new Promise((resolve, reject) => {
|
|
323
|
+
request.post({
|
|
324
|
+
url: params.sameAs,
|
|
325
|
+
body: {
|
|
326
|
+
order: createOrder4returnPolicy({ order: params.order })
|
|
327
|
+
},
|
|
328
|
+
json: true,
|
|
329
|
+
timeout: TIMEOUT
|
|
330
|
+
}, (error, response, body) => {
|
|
331
|
+
var _a;
|
|
332
|
+
if (error instanceof Error) {
|
|
333
|
+
reject(error);
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
switch (response.statusCode) {
|
|
337
|
+
case http_status_1.OK:
|
|
338
|
+
case http_status_1.CREATED:
|
|
339
|
+
case http_status_1.ACCEPTED:
|
|
340
|
+
case http_status_1.NO_CONTENT:
|
|
341
|
+
if (typeof ((_a = body.restockingFee) === null || _a === void 0 ? void 0 : _a.value) !== 'number') {
|
|
342
|
+
reject(new Error('invalid return policy'));
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
resolve({
|
|
346
|
+
typeOf: 'MerchantReturnPolicy',
|
|
347
|
+
restockingFee: {
|
|
348
|
+
currency: factory.priceCurrency.JPY,
|
|
349
|
+
typeOf: 'MonetaryAmount',
|
|
350
|
+
value: body.restockingFee.value
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
break;
|
|
355
|
+
case http_status_1.NOT_FOUND:
|
|
356
|
+
reject(new factory.errors.Argument('Seller', 'has no applicable return policies'));
|
|
357
|
+
break;
|
|
358
|
+
default:
|
|
359
|
+
reject({
|
|
360
|
+
statusCode: response.statusCode,
|
|
361
|
+
body: body
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
}
|
|
259
369
|
/**
|
|
260
370
|
* 販売者の返品ポリシーを確認する
|
|
261
371
|
*/
|
|
262
372
|
// tslint:disable-next-line:max-func-body-length
|
|
263
373
|
function findApplicableReturnPolicy(params) {
|
|
264
|
-
var _a;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
374
|
+
var _a, _b;
|
|
375
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
376
|
+
if (params.reason === factory.transaction.returnOrder.Reason.Seller) {
|
|
377
|
+
// 販売者都合の場合、手数料なしの返金返品ポリシーを適用
|
|
378
|
+
return {
|
|
379
|
+
typeOf: 'MerchantReturnPolicy',
|
|
380
|
+
returnFees: factory.merchantReturnPolicy.ReturnFeesEnumeration.FreeReturn
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
const returnPolicies = params.returnPolicies;
|
|
384
|
+
let applicalbleReturnPolicies = [];
|
|
385
|
+
if (params.reason === factory.transaction.returnOrder.Reason.Customer) {
|
|
386
|
+
// プロジェクトの返品ポリシー設定を考慮(2023-11-14~)
|
|
387
|
+
const returnPolicySameAsByPoject = (_a = params.returnPolicySettingsByProject) === null || _a === void 0 ? void 0 : _a.sameAs;
|
|
388
|
+
if (typeof returnPolicySameAsByPoject === 'string' && returnPolicySameAsByPoject.length > 0) {
|
|
389
|
+
const returnPolicyByProject = yield getReturnPolicyByProject({
|
|
390
|
+
sameAs: returnPolicySameAsByPoject,
|
|
391
|
+
order: params.orders[0] // 同時返品可能な注文数をは1
|
|
392
|
+
});
|
|
393
|
+
applicalbleReturnPolicies.push(returnPolicyByProject);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
// 適用可能なポリシーにフィルター
|
|
397
|
+
// tslint:disable-next-line:max-func-body-length
|
|
398
|
+
applicalbleReturnPolicies = returnPolicies.filter((returnPolicy) => {
|
|
399
|
+
return isSellerReturnPolicyApplicable({
|
|
400
|
+
returnPolicy,
|
|
401
|
+
events: params.events,
|
|
402
|
+
offerItemConditions: params.offerItemConditions,
|
|
403
|
+
orders: params.orders,
|
|
404
|
+
returningDate: params.returningDate,
|
|
405
|
+
usedReservationExists: params.usedReservationExists
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
// 販売者にポリシーが存在しなければ返品不可
|
|
411
|
+
if (applicalbleReturnPolicies.length === 0) {
|
|
412
|
+
throw new factory.errors.Argument('Seller', 'has no applicable return policies');
|
|
413
|
+
}
|
|
414
|
+
// オファーの返品ポリシーから返品手数料タイプを決定する
|
|
415
|
+
const { returnFees, returnFeesMovieTicket } = validateOffersReturnPolicy({
|
|
416
|
+
acceptedOffers: params.acceptedOffers,
|
|
417
|
+
offers: params.offers,
|
|
418
|
+
policiesByOffer: params.policiesByOffer
|
|
287
419
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (restockingFee < appliedReturnPolicyRestockingFee) {
|
|
310
|
-
appliedReturnPolicy = returnPolicy;
|
|
420
|
+
// restockingFeeが最低のポリシーを自動選択
|
|
421
|
+
let appliedReturnPolicy = applicalbleReturnPolicies[0];
|
|
422
|
+
applicalbleReturnPolicies.forEach((returnPolicy) => {
|
|
423
|
+
var _a, _b;
|
|
424
|
+
const appliedReturnPolicyRestockingFeeValue = (_a = appliedReturnPolicy.restockingFee) === null || _a === void 0 ? void 0 : _a.value;
|
|
425
|
+
const restockingFeeValue = (_b = returnPolicy.restockingFee) === null || _b === void 0 ? void 0 : _b.value;
|
|
426
|
+
const appliedReturnPolicyRestockingFee = (typeof appliedReturnPolicyRestockingFeeValue === 'number')
|
|
427
|
+
? appliedReturnPolicyRestockingFeeValue
|
|
428
|
+
: 0;
|
|
429
|
+
const restockingFee = (typeof restockingFeeValue === 'number') ? restockingFeeValue : 0;
|
|
430
|
+
if (restockingFee < appliedReturnPolicyRestockingFee) {
|
|
431
|
+
appliedReturnPolicy = returnPolicy;
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
let appliedItemCondition;
|
|
435
|
+
const appliedItemConditionId = (_b = appliedReturnPolicy.itemCondition) === null || _b === void 0 ? void 0 : _b.id;
|
|
436
|
+
if (typeof appliedItemConditionId === 'string') {
|
|
437
|
+
appliedItemCondition = params.offerItemConditions.find((o) => o.id === appliedItemConditionId);
|
|
438
|
+
if (appliedItemCondition === undefined) {
|
|
439
|
+
throw new factory.errors.NotFound('OfferItemCondition');
|
|
440
|
+
}
|
|
311
441
|
}
|
|
442
|
+
return Object.assign({ merchantReturnDays: appliedReturnPolicy.merchantReturnDays, restockingFee: appliedReturnPolicy.restockingFee, returnFees,
|
|
443
|
+
returnFeesMovieTicket, typeOf: appliedReturnPolicy.typeOf }, (typeof (appliedItemCondition === null || appliedItemCondition === void 0 ? void 0 : appliedItemCondition.typeOf) === 'string') ? { itemCondition: appliedItemCondition } : undefined);
|
|
312
444
|
});
|
|
313
|
-
let appliedItemCondition;
|
|
314
|
-
const appliedItemConditionId = (_a = appliedReturnPolicy.itemCondition) === null || _a === void 0 ? void 0 : _a.id;
|
|
315
|
-
if (typeof appliedItemConditionId === 'string') {
|
|
316
|
-
appliedItemCondition = params.offerItemConditions.find((o) => o.id === appliedItemConditionId);
|
|
317
|
-
if (appliedItemCondition === undefined) {
|
|
318
|
-
throw new factory.errors.NotFound('OfferItemCondition');
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return Object.assign({ merchantReturnDays: appliedReturnPolicy.merchantReturnDays, restockingFee: appliedReturnPolicy.restockingFee, returnFees,
|
|
322
|
-
returnFeesMovieTicket, typeOf: appliedReturnPolicy.typeOf }, (typeof (appliedItemCondition === null || appliedItemCondition === void 0 ? void 0 : appliedItemCondition.typeOf) === 'string') ? { itemCondition: appliedItemCondition } : undefined);
|
|
323
445
|
}
|
|
324
446
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
325
447
|
function isSellerReturnPolicyApplicable(params) {
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as factory from './factory';
|
|
|
3
3
|
export declare const TRIGGER_WEBHOOK_MAX_RETRY_COUNT: number;
|
|
4
4
|
export declare const TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS: number;
|
|
5
5
|
export declare const ABORTED_TASKS_WITHOUT_REPORT: string[];
|
|
6
|
+
export declare const MAX_NUM_CREDIT_CARD_PAYMENT_METHOD: number;
|
|
6
7
|
/**
|
|
7
8
|
* 資産取引保管期間
|
|
8
9
|
*/
|
|
@@ -29,7 +30,6 @@ export type ISettings = factory.project.ISettings & {
|
|
|
29
30
|
maximumReservationGracePeriodInDays: number;
|
|
30
31
|
userPoolIdOld: string;
|
|
31
32
|
userPoolIdNew: string;
|
|
32
|
-
maxNumCreditCardPaymentMethod?: number;
|
|
33
33
|
useAggregateEntranceGateProjects: string[];
|
|
34
34
|
useAggregateOfferProjects: string[];
|
|
35
35
|
useOfferRateLimitProjects: string[];
|
|
@@ -42,6 +42,7 @@ export declare const USE_DELETE_EVENT_BY_ORDER: boolean;
|
|
|
42
42
|
export declare const USE_ORDER_PAYMENT_DUE_ON_PLACED: boolean;
|
|
43
43
|
export declare const USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY: boolean;
|
|
44
44
|
export declare const USE_OPTIMIZE_TICKET_OFFER: boolean;
|
|
45
|
+
export declare const USE_ORDER_PAYMENT_METHOD_TYPE_OF: boolean;
|
|
45
46
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
46
47
|
export declare const MONGO_READ_PREFERENCE: string;
|
|
47
48
|
export declare const MONGO_AUTO_INDEX: boolean;
|
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.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = 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 = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_ORDER_PAYMENT_METHOD_TYPE_OF = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = 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.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -33,9 +33,9 @@ const MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = (typeof process.env.MAXIMUM_RES
|
|
|
33
33
|
exports.ABORTED_TASKS_WITHOUT_REPORT = (typeof process.env.ABORTED_TASKS_WITHOUT_REPORT === 'string')
|
|
34
34
|
? process.env.ABORTED_TASKS_WITHOUT_REPORT.split(' ')
|
|
35
35
|
: [];
|
|
36
|
-
|
|
36
|
+
exports.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD = (typeof process.env.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'string')
|
|
37
37
|
? Number(process.env.MAX_NUM_CREDIT_CARD_PAYMENT_METHOD)
|
|
38
|
-
:
|
|
38
|
+
: 1;
|
|
39
39
|
/**
|
|
40
40
|
* 資産取引保管期間
|
|
41
41
|
*/
|
|
@@ -68,6 +68,7 @@ exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1
|
|
|
68
68
|
exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = process.env.USE_ORDER_PAYMENT_DUE_ON_PLACED === '1';
|
|
69
69
|
exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = process.env.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY === '1';
|
|
70
70
|
exports.USE_OPTIMIZE_TICKET_OFFER = process.env.USE_OPTIMIZE_TICKET_OFFER === '1';
|
|
71
|
+
exports.USE_ORDER_PAYMENT_METHOD_TYPE_OF = process.env.USE_ORDER_PAYMENT_METHOD_TYPE_OF === '1';
|
|
71
72
|
exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
|
|
72
73
|
? Number(process.env.MONGO_MAX_TIME_MS)
|
|
73
74
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -79,7 +80,9 @@ exports.MONGO_AUTO_INDEX = process.env.MONGO_AUTO_INDEX === '1';
|
|
|
79
80
|
/**
|
|
80
81
|
* グローバル設定
|
|
81
82
|
*/
|
|
82
|
-
exports.settings =
|
|
83
|
+
exports.settings = {
|
|
84
|
+
transactionWebhookUrls,
|
|
85
|
+
onEventChanged: {
|
|
83
86
|
informEvent: informEventUrls
|
|
84
87
|
.filter((url) => url.length > 0)
|
|
85
88
|
.map((url) => {
|
|
@@ -91,7 +94,8 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEvent
|
|
|
91
94
|
}
|
|
92
95
|
};
|
|
93
96
|
})
|
|
94
|
-
},
|
|
97
|
+
},
|
|
98
|
+
onOrderStatusChanged: {
|
|
95
99
|
informOrder: informOrderUrls
|
|
96
100
|
.filter((url) => url.length > 0)
|
|
97
101
|
.map((url) => {
|
|
@@ -103,7 +107,8 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEvent
|
|
|
103
107
|
}
|
|
104
108
|
};
|
|
105
109
|
})
|
|
106
|
-
},
|
|
110
|
+
},
|
|
111
|
+
onResourceUpdated: {
|
|
107
112
|
informResource: informResourceUrls
|
|
108
113
|
.filter((url) => url.length > 0)
|
|
109
114
|
.map((url) => {
|
|
@@ -115,7 +120,7 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEvent
|
|
|
115
120
|
}
|
|
116
121
|
};
|
|
117
122
|
})
|
|
118
|
-
},
|
|
123
|
+
},
|
|
119
124
|
// 廃止(2022-10-29~)
|
|
120
125
|
// onPaymentStatusChanged: {
|
|
121
126
|
// informPayment: informPaymentUrls
|
|
@@ -130,7 +135,7 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEvent
|
|
|
130
135
|
.map((url) => {
|
|
131
136
|
return { recipient: { url } };
|
|
132
137
|
})
|
|
133
|
-
},
|
|
138
|
+
},
|
|
134
139
|
// 廃止(2023-01-30~)
|
|
135
140
|
// onReservationUsed: {
|
|
136
141
|
// informAction: informUseReservationUrls
|
|
@@ -141,12 +146,20 @@ exports.settings = Object.assign(Object.assign({ transactionWebhookUrls, onEvent
|
|
|
141
146
|
// },
|
|
142
147
|
webhook: {
|
|
143
148
|
timeout: triggerWebhookTimeout
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
:
|
|
149
|
+
},
|
|
150
|
+
maximumReservationGracePeriodInDays: MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS,
|
|
151
|
+
userPoolIdOld: String(process.env.USERPOOL_ID_OLD),
|
|
152
|
+
userPoolIdNew: String(process.env.USERPOOL_ID_NEW),
|
|
153
|
+
// ...(typeof MAX_NUM_CREDIT_CARD_PAYMENT_METHOD === 'number')
|
|
154
|
+
// ? { maxNumCreditCardPaymentMethod: MAX_NUM_CREDIT_CARD_PAYMENT_METHOD }
|
|
155
|
+
// : undefined,
|
|
156
|
+
useAggregateEntranceGateProjects: (typeof process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS === 'string')
|
|
147
157
|
? process.env.USE_AGGREGATE_ENTRANCE_GATE_PROJECTS.split(' ')
|
|
148
|
-
: [],
|
|
158
|
+
: [],
|
|
159
|
+
useAggregateOfferProjects: (typeof process.env.USE_AGGREGATE_OFFER_PROJECTS === 'string')
|
|
149
160
|
? process.env.USE_AGGREGATE_OFFER_PROJECTS.split(' ')
|
|
150
|
-
: [],
|
|
161
|
+
: [],
|
|
162
|
+
useOfferRateLimitProjects: (typeof process.env.USE_OFFER_RATE_LIMIT_PROJECTS === 'string')
|
|
151
163
|
? process.env.USE_OFFER_RATE_LIMIT_PROJECTS.split(' ')
|
|
152
|
-
: []
|
|
164
|
+
: []
|
|
165
|
+
};
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
14
|
-
"@cinerino/sdk": "5.0.0
|
|
13
|
+
"@chevre/factory": "4.342.0",
|
|
14
|
+
"@cinerino/sdk": "5.0.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.2.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.2.0",
|
|
17
17
|
"@sendgrid/mail": "6.4.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.15.0
|
|
120
|
+
"version": "21.15.0"
|
|
121
121
|
}
|