@chevre/domain 21.4.0-alpha.8 → 21.4.0-alpha.9
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/seller.d.ts +4 -3
- package/lib/chevre/repo/seller.js +40 -38
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +1 -1
|
@@ -34,10 +34,8 @@ export declare class MongoRepository {
|
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions): any[];
|
|
35
35
|
/**
|
|
36
36
|
* 特定販売者検索
|
|
37
|
+
* searchに置き換え(2023-07-13~)
|
|
37
38
|
*/
|
|
38
|
-
findById(conditions: {
|
|
39
|
-
id: string;
|
|
40
|
-
}, inclusion: string[], exclusion: string[]): Promise<ISeller>;
|
|
41
39
|
/**
|
|
42
40
|
* 販売者を保管する
|
|
43
41
|
*/
|
|
@@ -73,6 +71,9 @@ export declare class MongoRepository {
|
|
|
73
71
|
* 販売者を削除する
|
|
74
72
|
*/
|
|
75
73
|
deleteById(params: {
|
|
74
|
+
project: {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
76
77
|
id: string;
|
|
77
78
|
}): Promise<void>;
|
|
78
79
|
/**
|
|
@@ -128,37 +128,39 @@ class MongoRepository {
|
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* 特定販売者検索
|
|
131
|
+
* searchに置き換え(2023-07-13~)
|
|
131
132
|
*/
|
|
132
|
-
findById(
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
// public async findById(
|
|
134
|
+
// conditions: {
|
|
135
|
+
// id: string;
|
|
136
|
+
// },
|
|
137
|
+
// inclusion: string[],
|
|
138
|
+
// exclusion: string[]
|
|
139
|
+
// ): Promise<ISeller> {
|
|
140
|
+
// let projection: { [key: string]: number } = {};
|
|
141
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
142
|
+
// inclusion.forEach((field) => {
|
|
143
|
+
// projection[field] = 1;
|
|
144
|
+
// });
|
|
145
|
+
// } else {
|
|
146
|
+
// projection = {
|
|
147
|
+
// __v: 0,
|
|
148
|
+
// createdAt: 0,
|
|
149
|
+
// updatedAt: 0
|
|
150
|
+
// };
|
|
151
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
152
|
+
// exclusion.forEach((field) => {
|
|
153
|
+
// projection[field] = 0;
|
|
154
|
+
// });
|
|
155
|
+
// }
|
|
156
|
+
// }
|
|
157
|
+
// const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
|
|
158
|
+
// .exec();
|
|
159
|
+
// if (doc === null) {
|
|
160
|
+
// throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
161
|
+
// }
|
|
162
|
+
// return doc.toObject();
|
|
163
|
+
// }
|
|
162
164
|
/**
|
|
163
165
|
* 販売者を保管する
|
|
164
166
|
*/
|
|
@@ -172,7 +174,10 @@ class MongoRepository {
|
|
|
172
174
|
else {
|
|
173
175
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
174
176
|
const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
|
|
175
|
-
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
177
|
+
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
178
|
+
_id: params.id,
|
|
179
|
+
'project.id': { $eq: project.id }
|
|
180
|
+
}, updateFields, { upsert: false, new: true })
|
|
176
181
|
.exec();
|
|
177
182
|
if (doc === null) {
|
|
178
183
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
@@ -182,12 +187,6 @@ class MongoRepository {
|
|
|
182
187
|
return organization;
|
|
183
188
|
});
|
|
184
189
|
}
|
|
185
|
-
// public async count(params: factory.seller.ISearchConditions): Promise<number> {
|
|
186
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
187
|
-
// return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
188
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
189
|
-
// .exec();
|
|
190
|
-
// }
|
|
191
190
|
/**
|
|
192
191
|
* 販売者検索
|
|
193
192
|
*/
|
|
@@ -270,7 +269,10 @@ class MongoRepository {
|
|
|
270
269
|
*/
|
|
271
270
|
deleteById(params) {
|
|
272
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
-
yield this.organizationModel.findOneAndRemove({
|
|
272
|
+
yield this.organizationModel.findOneAndRemove({
|
|
273
|
+
_id: params.id,
|
|
274
|
+
'project.id': { $eq: params.project.id }
|
|
275
|
+
})
|
|
274
276
|
.exec();
|
|
275
277
|
});
|
|
276
278
|
}
|
|
@@ -28,7 +28,15 @@ function validateAccount(params) {
|
|
|
28
28
|
if (typeof sellerId !== 'string') {
|
|
29
29
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: sellerId }
|
|
35
|
+
}, ['paymentAccepted'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
33
41
|
if (paymentAccepted !== true) {
|
|
34
42
|
throw new factory.errors.Argument('recipient', `payment not accepted`);
|
|
@@ -210,7 +210,15 @@ function validateSeller(params) {
|
|
|
210
210
|
if (typeof sellerId !== 'string') {
|
|
211
211
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const sellers = yield repos.seller.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $eq: sellerId }
|
|
217
|
+
}, ['paymentAccepted'], []);
|
|
218
|
+
const seller = sellers.shift();
|
|
219
|
+
if (seller === undefined) {
|
|
220
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
|
+
}
|
|
214
222
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
215
223
|
if (typeof paymentMethodType !== 'string') {
|
|
216
224
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -521,7 +521,15 @@ function processChangeTransaction(params) {
|
|
|
521
521
|
function getGMOInfoFromSeller(params) {
|
|
522
522
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
523
523
|
var _a, _b, _c, _d;
|
|
524
|
-
const
|
|
524
|
+
const sellers = yield repos.seller.search({
|
|
525
|
+
limit: 1,
|
|
526
|
+
page: 1,
|
|
527
|
+
id: { $eq: String(params.seller.id) }
|
|
528
|
+
}, ['paymentAccepted', 'project'], []);
|
|
529
|
+
const seller = sellers.shift();
|
|
530
|
+
if (seller === undefined) {
|
|
531
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
532
|
+
}
|
|
525
533
|
const paymentAccepted = (_a = seller.paymentAccepted) === null || _a === void 0 ? void 0 : _a.some((a) => a.paymentMethodType === params.paymentMethodType);
|
|
526
534
|
if (paymentAccepted !== true) {
|
|
527
535
|
throw new factory.errors.Argument('transaction', 'payment not accepted');
|
|
@@ -52,7 +52,15 @@ function validateMovieTicket(params, paymentServiceId, useCheckMovieTicketBefore
|
|
|
52
52
|
if (typeof sellerId !== 'string') {
|
|
53
53
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const sellers = yield repos.seller.search({
|
|
56
|
+
limit: 1,
|
|
57
|
+
page: 1,
|
|
58
|
+
id: { $eq: sellerId }
|
|
59
|
+
}, ['paymentAccepted', 'project'], []);
|
|
60
|
+
const seller = sellers.shift();
|
|
61
|
+
if (seller === undefined) {
|
|
62
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
63
|
+
}
|
|
56
64
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
57
65
|
if (paymentAccepted !== true) {
|
|
58
66
|
throw new factory.errors.Argument('recipient', 'payment not accepted');
|
|
@@ -27,6 +27,7 @@ const onRefund_1 = require("./any/onRefund");
|
|
|
27
27
|
/**
|
|
28
28
|
* MovieTicket認証
|
|
29
29
|
*/
|
|
30
|
+
// tslint:disable-next-line:max-func-body-length
|
|
30
31
|
function checkMovieTicket(params) {
|
|
31
32
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -58,7 +59,15 @@ function checkMovieTicket(params) {
|
|
|
58
59
|
id: eventIds[0]
|
|
59
60
|
});
|
|
60
61
|
// ショップ情報取得
|
|
61
|
-
const
|
|
62
|
+
const sellers = yield repos.seller.search({
|
|
63
|
+
limit: 1,
|
|
64
|
+
page: 1,
|
|
65
|
+
id: { $eq: (_e = params.object[0]) === null || _e === void 0 ? void 0 : _e.seller.id }
|
|
66
|
+
}, ['paymentAccepted', 'project'], []);
|
|
67
|
+
const seller = sellers.shift();
|
|
68
|
+
if (seller === undefined) {
|
|
69
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
70
|
+
}
|
|
62
71
|
const paymentAccepted = (_f = seller.paymentAccepted) === null || _f === void 0 ? void 0 : _f.some((a) => a.paymentMethodType === paymentMethodType);
|
|
63
72
|
if (paymentAccepted !== true) {
|
|
64
73
|
throw new factory.errors.Argument('transactionId', 'payment not accepted');
|
|
@@ -302,7 +311,15 @@ function payActionParams2seatInfoSyncIn(params) {
|
|
|
302
311
|
// イベント取得属性最適化(2023-01-23~)
|
|
303
312
|
// const event = await repos.event.findById<factory.eventType.ScreeningEvent>({ id: eventIds[0] });
|
|
304
313
|
const event = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
305
|
-
const
|
|
314
|
+
const sellers = yield repos.seller.search({
|
|
315
|
+
limit: 1,
|
|
316
|
+
page: 1,
|
|
317
|
+
id: { $eq: String((_d = params.recipient) === null || _d === void 0 ? void 0 : _d.id) }
|
|
318
|
+
}, ['paymentAccepted', 'project'], []);
|
|
319
|
+
const seller = sellers.shift();
|
|
320
|
+
if (seller === undefined) {
|
|
321
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
322
|
+
}
|
|
306
323
|
// 全購入管理番号のMovieTicketをマージ
|
|
307
324
|
const movieTickets = params.object.reduce((a, b) => [...a, ...(Array.isArray(b.movieTickets)) ? b.movieTickets : []], []);
|
|
308
325
|
const sellerCredentials = yield (0, getCredentials_1.getCredentials)({ paymentMethodType, seller, paymentServiceId })(repos);
|
|
@@ -28,7 +28,15 @@ const CodeService = require("../code");
|
|
|
28
28
|
*/
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: params.seller.id }
|
|
35
|
+
}, ['name', 'typeOf'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const passport = yield (0, validation_1.validateWaiterPassport)(params);
|
|
33
41
|
// 金額をfix
|
|
34
42
|
const amount = params.object.amount;
|
|
@@ -29,12 +29,15 @@ exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
|
29
29
|
function start(params) {
|
|
30
30
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
var _a;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: params.seller.id }
|
|
36
|
+
}, ['name', 'project', 'typeOf', 'makesOffer'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
38
41
|
let makesOfferFromClient;
|
|
39
42
|
// 販売者オファー検証(2022-10-14~)
|
|
40
43
|
if (params.validateSeller === true) {
|
|
@@ -29,9 +29,15 @@ function start(params) {
|
|
|
29
29
|
const now = new Date();
|
|
30
30
|
const { acceptedOffers, eventIds, offerIds, orders } = yield fixOrders(params)(repos);
|
|
31
31
|
// sellerはorderから自動取得
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const sellers = yield repos.seller.search({
|
|
33
|
+
limit: 1,
|
|
34
|
+
page: 1,
|
|
35
|
+
id: { $eq: String(orders[0].seller.id) }
|
|
36
|
+
}, ['name', 'project', 'hasMerchantReturnPolicy', 'typeOf'], []);
|
|
37
|
+
const seller = sellers.shift();
|
|
38
|
+
if (seller === undefined) {
|
|
39
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
40
|
+
}
|
|
35
41
|
yield validateOrder({ orders })(repos);
|
|
36
42
|
let offers = [];
|
|
37
43
|
if (offerIds.length > 0) {
|
package/package.json
CHANGED