@chevre/domain 21.6.0-alpha.9 → 21.7.0-alpha.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/migrateMovieAvailabilityStarts.ts +27 -25
- package/example/src/chevre/searchSellers.ts +28 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -11
- package/lib/chevre/repo/creativeWork.d.ts +4 -0
- package/lib/chevre/repo/creativeWork.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +0 -9
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +3 -3
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.js +12 -0
- package/lib/chevre/repo/seller.js +14 -2
- package/lib/chevre/service/assetTransaction/refund/factory.js +13 -4
- package/lib/chevre/service/assetTransaction/reserve.js +31 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +7 -3
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
3
|
import * as mongoose from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
@@ -15,7 +15,7 @@ async function main() {
|
|
|
15
15
|
|
|
16
16
|
const cursor = creativeWorkRepo.getCursor(
|
|
17
17
|
{
|
|
18
|
-
'offers.availabilityEnds': { $exists: true }
|
|
18
|
+
// 'offers.availabilityEnds': { $exists: true }
|
|
19
19
|
},
|
|
20
20
|
{}
|
|
21
21
|
);
|
|
@@ -23,8 +23,8 @@ async function main() {
|
|
|
23
23
|
|
|
24
24
|
let i = 0;
|
|
25
25
|
let updateCount = 0;
|
|
26
|
-
let datePublishedUndefinedCount = 0;
|
|
27
|
-
let datePublishedIsAfterNowCount = 0;
|
|
26
|
+
// let datePublishedUndefinedCount = 0;
|
|
27
|
+
// let datePublishedIsAfterNowCount = 0;
|
|
28
28
|
await cursor.eachAsync(async (doc) => {
|
|
29
29
|
i += 1;
|
|
30
30
|
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
@@ -35,30 +35,32 @@ async function main() {
|
|
|
35
35
|
if (!(createdAt instanceof Date)) {
|
|
36
36
|
throw new Error('createdAt not Date');
|
|
37
37
|
}
|
|
38
|
-
const alreadyMigrated = availabilityStarts instanceof Date
|
|
38
|
+
const alreadyMigrated = availabilityStarts instanceof Date
|
|
39
|
+
&& moment(availabilityStarts)
|
|
40
|
+
.isSame(moment(createdAt)
|
|
41
|
+
.tz('Asia/Tokyo')
|
|
42
|
+
.startOf('day')
|
|
43
|
+
);
|
|
39
44
|
|
|
40
45
|
if (alreadyMigrated) {
|
|
41
|
-
console.log(
|
|
46
|
+
console.log(
|
|
47
|
+
'already exist...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, createdAt, i);
|
|
42
48
|
|
|
43
|
-
if (moment(movie.datePublished)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// throw new Error(`movie.datePublished isAfter now ${movie.project.id} ${movie.id} ${movie.identifier} ${movie.datePublished}`);
|
|
48
|
-
|
|
49
|
-
}
|
|
49
|
+
// if (moment(movie.datePublished)
|
|
50
|
+
// .isAfter(moment())) {
|
|
51
|
+
// datePublishedIsAfterNowCount += 1;
|
|
52
|
+
// }
|
|
50
53
|
} else {
|
|
51
|
-
if (movie.datePublished === undefined) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
54
|
+
// if (movie.datePublished === undefined) {
|
|
55
|
+
// console.error('movie.datePublished undefined', movie.project.id, movie.id, movie.identifier, i);
|
|
56
|
+
// // throw new Error('movie.datePublished undefined');
|
|
57
|
+
// datePublishedUndefinedCount += 1;
|
|
58
|
+
// }
|
|
56
59
|
|
|
57
|
-
availabilityStarts = (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.toDate();
|
|
60
|
+
availabilityStarts = moment(createdAt)
|
|
61
|
+
.tz('Asia/Tokyo')
|
|
62
|
+
.startOf('day')
|
|
63
|
+
.toDate();
|
|
62
64
|
console.log('updating movie...', movie.project.id, movie.id, movie.identifier, availabilityStarts, availabilityEnds, i);
|
|
63
65
|
await creativeWorkRepo.saveMovie(<any>{
|
|
64
66
|
id: String(movie.id),
|
|
@@ -71,8 +73,8 @@ async function main() {
|
|
|
71
73
|
|
|
72
74
|
console.log(i, 'creativeWorks checked');
|
|
73
75
|
console.log(updateCount, 'creativeWorks updated');
|
|
74
|
-
console.log(datePublishedUndefinedCount, 'datePublishedUndefinedCount');
|
|
75
|
-
console.log(datePublishedIsAfterNowCount, 'datePublishedIsAfterNowCount');
|
|
76
|
+
// console.log(datePublishedUndefinedCount, 'datePublishedUndefinedCount');
|
|
77
|
+
// console.log(datePublishedIsAfterNowCount, 'datePublishedIsAfterNowCount');
|
|
76
78
|
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
|
+
|
|
11
|
+
const sellerRepo = new chevre.repository.Seller(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const sellers = await sellerRepo.search(
|
|
14
|
+
{
|
|
15
|
+
project: { id: { $eq: project.id } },
|
|
16
|
+
paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
17
|
+
hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
18
|
+
},
|
|
19
|
+
['name'],
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
console.log('sellers found', sellers);
|
|
23
|
+
console.log(sellers.length, 'sellers found');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
main()
|
|
27
|
+
.then()
|
|
28
|
+
.catch(console.error);
|
|
@@ -6,26 +6,20 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
let updateResult: any;
|
|
12
|
-
updateResult = await
|
|
13
|
-
filter: { 'offers.acceptedPaymentMethod': { $exists: true } },
|
|
14
|
-
$unset: { 'offers.acceptedPaymentMethod': 1 }
|
|
15
|
-
});
|
|
16
|
-
console.log('events unset', updateResult);
|
|
17
|
-
|
|
18
|
-
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
12
|
+
updateResult = await creativeWorkRepo.unsetUnnecessaryFields({
|
|
19
13
|
filter: { 'offers.project': { $exists: true } },
|
|
20
14
|
$unset: { 'offers.project': 1 }
|
|
21
15
|
});
|
|
22
|
-
console.log('
|
|
16
|
+
console.log('unset processed.', updateResult);
|
|
23
17
|
|
|
24
|
-
updateResult = await
|
|
18
|
+
updateResult = await creativeWorkRepo.unsetUnnecessaryFields({
|
|
25
19
|
filter: { 'offers.priceCurrency': { $exists: true } },
|
|
26
20
|
$unset: { 'offers.priceCurrency': 1 }
|
|
27
21
|
});
|
|
28
|
-
console.log('
|
|
22
|
+
console.log('unset processed.', updateResult);
|
|
29
23
|
}
|
|
30
24
|
|
|
31
25
|
main()
|
|
@@ -55,4 +55,8 @@ export declare class MongoRepository {
|
|
|
55
55
|
};
|
|
56
56
|
}): Promise<void>;
|
|
57
57
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
58
|
+
unsetUnnecessaryFields(params: {
|
|
59
|
+
filter: any;
|
|
60
|
+
$unset: any;
|
|
61
|
+
}): Promise<import("mongodb").UpdateResult>;
|
|
58
62
|
}
|
|
@@ -265,5 +265,11 @@ class MongoRepository {
|
|
|
265
265
|
.sort({ identifier: factory.sortType.Ascending })
|
|
266
266
|
.cursor();
|
|
267
267
|
}
|
|
268
|
+
unsetUnnecessaryFields(params) {
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
return this.creativeWorkModel.updateMany(params.filter, { $unset: params.$unset })
|
|
271
|
+
.exec();
|
|
272
|
+
});
|
|
273
|
+
}
|
|
268
274
|
}
|
|
269
275
|
exports.MongoRepository = MongoRepository;
|
|
@@ -55,18 +55,15 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
55
55
|
typeOf: string;
|
|
56
56
|
name?: any;
|
|
57
57
|
project?: any;
|
|
58
|
-
alternateName?: string | undefined;
|
|
59
58
|
description?: string | undefined;
|
|
60
59
|
additionalProperty?: any;
|
|
61
60
|
identifier?: string | undefined;
|
|
62
61
|
duration?: string | undefined;
|
|
63
62
|
alternativeHeadline?: string | undefined;
|
|
64
|
-
copyrightHolder?: any;
|
|
65
63
|
copyrightYear?: number | undefined;
|
|
66
64
|
datePublished?: Date | undefined;
|
|
67
65
|
distributor?: any;
|
|
68
66
|
headline?: string | undefined;
|
|
69
|
-
license?: string | undefined;
|
|
70
67
|
thumbnailUrl?: string | undefined;
|
|
71
68
|
contentRating?: string | undefined;
|
|
72
69
|
offers?: any;
|
|
@@ -74,18 +71,15 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
74
71
|
typeOf: string;
|
|
75
72
|
name?: any;
|
|
76
73
|
project?: any;
|
|
77
|
-
alternateName?: string | undefined;
|
|
78
74
|
description?: string | undefined;
|
|
79
75
|
additionalProperty?: any;
|
|
80
76
|
identifier?: string | undefined;
|
|
81
77
|
duration?: string | undefined;
|
|
82
78
|
alternativeHeadline?: string | undefined;
|
|
83
|
-
copyrightHolder?: any;
|
|
84
79
|
copyrightYear?: number | undefined;
|
|
85
80
|
datePublished?: Date | undefined;
|
|
86
81
|
distributor?: any;
|
|
87
82
|
headline?: string | undefined;
|
|
88
|
-
license?: string | undefined;
|
|
89
83
|
thumbnailUrl?: string | undefined;
|
|
90
84
|
contentRating?: string | undefined;
|
|
91
85
|
offers?: any;
|
|
@@ -93,18 +87,15 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
93
87
|
typeOf: string;
|
|
94
88
|
name?: any;
|
|
95
89
|
project?: any;
|
|
96
|
-
alternateName?: string | undefined;
|
|
97
90
|
description?: string | undefined;
|
|
98
91
|
additionalProperty?: any;
|
|
99
92
|
identifier?: string | undefined;
|
|
100
93
|
duration?: string | undefined;
|
|
101
94
|
alternativeHeadline?: string | undefined;
|
|
102
|
-
copyrightHolder?: any;
|
|
103
95
|
copyrightYear?: number | undefined;
|
|
104
96
|
datePublished?: Date | undefined;
|
|
105
97
|
distributor?: any;
|
|
106
98
|
headline?: string | undefined;
|
|
107
|
-
license?: string | undefined;
|
|
108
99
|
thumbnailUrl?: string | undefined;
|
|
109
100
|
contentRating?: string | undefined;
|
|
110
101
|
offers?: any;
|
|
@@ -16,15 +16,15 @@ const schema = new mongoose_1.Schema({
|
|
|
16
16
|
},
|
|
17
17
|
identifier: String,
|
|
18
18
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
-
alternateName: String,
|
|
19
|
+
// alternateName: String,
|
|
20
20
|
alternativeHeadline: String,
|
|
21
21
|
description: String,
|
|
22
|
-
copyrightHolder:
|
|
22
|
+
// copyrightHolder: SchemaTypes.Mixed,
|
|
23
23
|
copyrightYear: Number,
|
|
24
24
|
datePublished: Date,
|
|
25
25
|
distributor: mongoose_1.SchemaTypes.Mixed,
|
|
26
26
|
headline: String,
|
|
27
|
-
license: String,
|
|
27
|
+
// license: String,
|
|
28
28
|
thumbnailUrl: String,
|
|
29
29
|
duration: String,
|
|
30
30
|
contentRating: String,
|
|
@@ -67,6 +67,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
67
67
|
color?: any;
|
|
68
68
|
validFrom?: Date | undefined;
|
|
69
69
|
category?: any;
|
|
70
|
+
advanceBookingRequirement?: any;
|
|
70
71
|
availability?: string | undefined;
|
|
71
72
|
hasMerchantReturnPolicy?: any;
|
|
72
73
|
priceSpecification?: any;
|
|
@@ -97,6 +98,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
97
98
|
color?: any;
|
|
98
99
|
validFrom?: Date | undefined;
|
|
99
100
|
category?: any;
|
|
101
|
+
advanceBookingRequirement?: any;
|
|
100
102
|
availability?: string | undefined;
|
|
101
103
|
hasMerchantReturnPolicy?: any;
|
|
102
104
|
priceSpecification?: any;
|
|
@@ -127,6 +129,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
127
129
|
color?: any;
|
|
128
130
|
validFrom?: Date | undefined;
|
|
129
131
|
category?: any;
|
|
132
|
+
advanceBookingRequirement?: any;
|
|
130
133
|
availability?: string | undefined;
|
|
131
134
|
hasMerchantReturnPolicy?: any;
|
|
132
135
|
priceSpecification?: any;
|
|
@@ -18,6 +18,7 @@ const schema = new mongoose_1.Schema({
|
|
|
18
18
|
category: mongoose_1.SchemaTypes.Mixed,
|
|
19
19
|
color: mongoose_1.SchemaTypes.Mixed,
|
|
20
20
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
21
|
+
advanceBookingRequirement: mongoose_1.SchemaTypes.Mixed,
|
|
21
22
|
alternateName: mongoose_1.SchemaTypes.Mixed,
|
|
22
23
|
// acceptedPaymentMethod: SchemaTypes.Mixed, // 削除(2023-02-27~)
|
|
23
24
|
addOn: [mongoose_1.SchemaTypes.Mixed],
|
|
@@ -75,6 +75,18 @@ schema.index({ additionalProperty: 1, branchCode: 1 }, {
|
|
|
75
75
|
additionalProperty: { $exists: true }
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
+
schema.index({ 'paymentAccepted.paymentMethodType': 1, branchCode: 1 }, {
|
|
79
|
+
name: 'searchByPaymentAccepted',
|
|
80
|
+
partialFilterExpression: {
|
|
81
|
+
'paymentAccepted.paymentMethodType': { $exists: true }
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
schema.index({ 'hasMerchantReturnPolicy.applicablePaymentMethod': 1, branchCode: 1 }, {
|
|
85
|
+
name: 'searchByHasMerchantReturnPolicyApplicablePaymentMethod',
|
|
86
|
+
partialFilterExpression: {
|
|
87
|
+
'hasMerchantReturnPolicy.applicablePaymentMethod': { $exists: true }
|
|
88
|
+
}
|
|
89
|
+
});
|
|
78
90
|
schema.index({ 'hasMerchantReturnPolicy.itemCondition.id': 1, branchCode: 1 }, {
|
|
79
91
|
name: 'searchByHasMerchantReturnPolicyItemConditionId',
|
|
80
92
|
partialFilterExpression: {
|
|
@@ -34,7 +34,7 @@ class MongoRepository {
|
|
|
34
34
|
}
|
|
35
35
|
// tslint:disable-next-line:max-func-body-length
|
|
36
36
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
38
38
|
// MongoDB検索条件
|
|
39
39
|
const andConditions = [];
|
|
40
40
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -120,7 +120,19 @@ class MongoRepository {
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const paymentAcceptedEq = (_p = (_o = params.paymentAccepted) === null || _o === void 0 ? void 0 : _o.paymentMethodType) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
124
|
+
if (typeof paymentAcceptedEq === 'string') {
|
|
125
|
+
andConditions.push({
|
|
126
|
+
'paymentAccepted.paymentMethodType': { $exists: true, $eq: paymentAcceptedEq }
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const hasMerchantReturnApplicablePaymentMethodEq = (_r = (_q = params.hasMerchantReturnPolicy) === null || _q === void 0 ? void 0 : _q.applicablePaymentMethod) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
130
|
+
if (typeof hasMerchantReturnApplicablePaymentMethodEq === 'string') {
|
|
131
|
+
andConditions.push({
|
|
132
|
+
'hasMerchantReturnPolicy.applicablePaymentMethod': { $exists: true, $eq: hasMerchantReturnApplicablePaymentMethodEq }
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const hasMerchantReturnPolicyItemConditionIdEq = (_u = (_t = (_s = params.hasMerchantReturnPolicy) === null || _s === void 0 ? void 0 : _s.itemCondition) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
124
136
|
if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
|
|
125
137
|
andConditions.push({
|
|
126
138
|
'hasMerchantReturnPolicy.itemCondition.id': {
|
|
@@ -6,7 +6,7 @@ exports.createStartParams = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
function createStartParams(params) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
10
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
11
11
|
if (typeof paymentMethodType !== 'string') {
|
|
12
12
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -19,6 +19,17 @@ function createStartParams(params) {
|
|
|
19
19
|
const name = (_d = params.object.paymentMethod) === null || _d === void 0 ? void 0 : _d.name;
|
|
20
20
|
const informPaymentParams = createInformPaymentParams({ paymentService: params.paymentService });
|
|
21
21
|
const accountId = (_f = (_e = params.payAction.object[0]) === null || _e === void 0 ? void 0 : _e.paymentMethod) === null || _f === void 0 ? void 0 : _f.accountId;
|
|
22
|
+
// 手数料は、CreditCardIFかつカード通貨区分が存在しない場合のみ設定すればよい
|
|
23
|
+
let refundFee;
|
|
24
|
+
if (((_g = params.paymentService) === null || _g === void 0 ? void 0 : _g.typeOf) === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
25
|
+
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
26
|
+
const paymentServiceOutputAmountCurrency = (_j = (_h = params.paymentService.serviceOutput) === null || _h === void 0 ? void 0 : _h.amount) === null || _j === void 0 ? void 0 : _j.currency;
|
|
27
|
+
if (typeof paymentServiceOutputAmountCurrency !== 'string') {
|
|
28
|
+
if (typeof params.object.refundFee === 'number') {
|
|
29
|
+
refundFee = params.object.refundFee;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
22
33
|
return {
|
|
23
34
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
24
35
|
transactionNumber: params.transactionNumber,
|
|
@@ -29,9 +40,7 @@ function createStartParams(params) {
|
|
|
29
40
|
? params.payAction.object[0].id
|
|
30
41
|
: '', onPaymentStatusChanged: { informPayment: informPaymentParams }, paymentMethod: Object.assign({ additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [], name: (typeof name === 'string') ? name : paymentMethodType, paymentMethodId: paymentMethodId, typeOf: paymentMethodType }, (Array.isArray(params.payAction.object) && params.payAction.object.length > 0)
|
|
31
42
|
? { totalPaymentDue: params.payAction.object[0].paymentMethod.totalPaymentDue }
|
|
32
|
-
: undefined) }, (typeof
|
|
33
|
-
? { refundFee: params.object.refundFee }
|
|
34
|
-
: undefined),
|
|
43
|
+
: undefined) }, (typeof refundFee === 'number') ? { refundFee } : undefined),
|
|
35
44
|
expires: params.expires
|
|
36
45
|
};
|
|
37
46
|
}
|
|
@@ -339,6 +339,14 @@ function createReservations4transactionObject(params) {
|
|
|
339
339
|
if (ticketType === undefined) {
|
|
340
340
|
throw new factory.errors.NotFound(ticketOffer.typeOf);
|
|
341
341
|
}
|
|
342
|
+
if (settings_1.USE_ADVANCE_BOOKING_REQUIREMENT) {
|
|
343
|
+
// 事前予約要件検証(2023-08-10~)
|
|
344
|
+
validateAdvanceBookingRequirement({
|
|
345
|
+
unitPriceOffer: ticketType,
|
|
346
|
+
now: params.now,
|
|
347
|
+
reservationFor: params.event
|
|
348
|
+
});
|
|
349
|
+
}
|
|
342
350
|
const programMembershipUsed = yield validateProgramMembershipUsed({
|
|
343
351
|
acceptedOffer,
|
|
344
352
|
project: params.transaction.project
|
|
@@ -484,6 +492,29 @@ function getAcceptedSeatNumbersAndSeatSections(params) {
|
|
|
484
492
|
acceptedSeatSections
|
|
485
493
|
};
|
|
486
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* 事前予約要件を検証する
|
|
497
|
+
*/
|
|
498
|
+
function validateAdvanceBookingRequirement(params) {
|
|
499
|
+
var _a, _b;
|
|
500
|
+
const advanceBookingRequirementMinValue = (_a = params.unitPriceOffer.advanceBookingRequirement) === null || _a === void 0 ? void 0 : _a.minValue;
|
|
501
|
+
const advanceBookingRequirementUnitCode = (_b = params.unitPriceOffer.advanceBookingRequirement) === null || _b === void 0 ? void 0 : _b.unitCode;
|
|
502
|
+
if (typeof advanceBookingRequirementMinValue === 'number' && typeof advanceBookingRequirementUnitCode === 'string') {
|
|
503
|
+
if (advanceBookingRequirementMinValue < 0) {
|
|
504
|
+
throw new factory.errors.NotImplemented('negative value as advanceBookingRequirement.minValue not implemented');
|
|
505
|
+
}
|
|
506
|
+
if (advanceBookingRequirementUnitCode !== factory.unitCode.Sec) {
|
|
507
|
+
throw new factory.errors.NotImplemented(`only ${factory.unitCode.Sec} implemented`);
|
|
508
|
+
}
|
|
509
|
+
const reservationForMustStartAfter = moment(params.now)
|
|
510
|
+
.add(advanceBookingRequirementMinValue, 'seconds');
|
|
511
|
+
const requirementSatisfied = moment(params.reservationFor.startDate)
|
|
512
|
+
.isSameOrAfter(reservationForMustStartAfter);
|
|
513
|
+
if (!requirementSatisfied) {
|
|
514
|
+
throw new factory.errors.Argument('acceptedOffer.id', 'advanceBookingRequirement not satisfied');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
487
518
|
function validateProgramMembershipUsed(params) {
|
|
488
519
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
489
520
|
var _a, _b, _c;
|
|
@@ -211,11 +211,15 @@ function validateNumItems(params) {
|
|
|
211
211
|
}
|
|
212
212
|
exports.validateNumItems = validateNumItems;
|
|
213
213
|
function validatePaymentMethods(params) {
|
|
214
|
-
debug('processing validatePaymentMethods...maxNumCreditCardPaymentMethod:', settings_1.settings.maxNumCreditCardPaymentMethod);
|
|
215
214
|
if (typeof settings_1.settings.maxNumCreditCardPaymentMethod === 'number') {
|
|
216
215
|
// CreditCard IFの決済方法の最大値検証
|
|
217
|
-
const creditCardPaymentMethodCount = params.order.paymentMethods.filter((p) =>
|
|
218
|
-
|
|
216
|
+
const creditCardPaymentMethodCount = params.order.paymentMethods.filter((p) => {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
219
|
+
const serviceOutputAmountCurrency = (_b = (_a = p.issuedThrough.serviceOutput) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
220
|
+
return p.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
221
|
+
&& typeof serviceOutputAmountCurrency !== 'string';
|
|
222
|
+
}).length;
|
|
219
223
|
if (creditCardPaymentMethodCount > settings_1.settings.maxNumCreditCardPaymentMethod) {
|
|
220
224
|
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.settings.maxNumCreditCardPaymentMethod));
|
|
221
225
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
39
39
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
40
40
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
41
41
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
42
|
+
export declare const USE_ADVANCE_BOOKING_REQUIREMENT: boolean;
|
|
42
43
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
43
44
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
44
45
|
/**
|
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_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = 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')
|
|
@@ -71,6 +71,7 @@ exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_
|
|
|
71
71
|
// export const USE_NEW_STOCK_HOLDER_REPO_IDS: string[] = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
72
72
|
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
73
73
|
// : [];
|
|
74
|
+
exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
|
|
74
75
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
75
76
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
76
77
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.325.0-alpha.0",
|
|
13
|
+
"@cinerino/sdk": "3.163.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@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.
|
|
120
|
+
"version": "21.7.0-alpha.0"
|
|
121
121
|
}
|