@chevre/domain 21.17.0-alpha.9 → 21.17.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/adminSellerPaymentAccepted.ts +60 -0
- package/example/src/chevre/isPaymentAcceptedBySeller.ts +24 -0
- package/example/src/chevre/saveOfferCatalogItem.ts +40 -0
- package/example/src/chevre/searchAggregateOffers.ts +11 -8
- package/example/src/chevre/searchOffers.ts +15 -7
- package/example/src/chevre/searchOrderAcceptedOffers.ts +38 -0
- package/lib/chevre/repo/action.d.ts +4 -4
- package/lib/chevre/repo/action.js +1 -1
- package/lib/chevre/repo/aggregateOffer.js +39 -17
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +25 -11
- package/lib/chevre/repo/offer.d.ts +17 -1
- package/lib/chevre/repo/offer.js +46 -21
- package/lib/chevre/repo/offerCatalogItem.d.ts +8 -2
- package/lib/chevre/repo/offerCatalogItem.js +5 -5
- package/lib/chevre/repo/order.d.ts +7 -6
- package/lib/chevre/repo/order.js +52 -28
- package/lib/chevre/repo/seller.d.ts +4 -23
- package/lib/chevre/repo/seller.js +3 -38
- package/lib/chevre/repo/sellerPaymentAccepted.d.ts +54 -0
- package/lib/chevre/repo/sellerPaymentAccepted.js +132 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +14 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +20 -24
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -8
- package/lib/chevre/service/assetTransaction/pay.js +26 -14
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize.js +10 -13
- package/lib/chevre/service/offer/event/defaultOffer.d.ts +1 -1
- package/lib/chevre/service/offer/event/defaultOffer.js +5 -17
- package/lib/chevre/service/offer/event/factory.d.ts +6 -6
- package/lib/chevre/service/offer/event/factory.js +1 -1
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +10 -6
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -5
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA.d.ts +3 -3
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/payment/any.d.ts +5 -6
- package/lib/chevre/service/payment/any.js +3 -6
- package/lib/chevre/service/payment/creditCard.d.ts +6 -6
- package/lib/chevre/service/payment/creditCard.js +22 -14
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -4
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +0 -1
- package/lib/chevre/service/payment/movieTicket/factory.js +4 -8
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +21 -13
- package/lib/chevre/service/payment/movieTicket.d.ts +4 -6
- package/lib/chevre/service/payment/movieTicket.js +37 -34
- package/lib/chevre/service/payment.d.ts +4 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -2
- package/lib/chevre/service/task/pay.js +3 -2
- package/lib/chevre/service/task/refund.js +3 -2
- package/lib/chevre/service/task/voidPayTransaction.js +3 -2
- package/lib/chevre/service/task/voidPayment.js +3 -2
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +0 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +0 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +1 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +1 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +34 -34
- package/lib/chevre/service/transaction/placeOrderInProgress.js +3 -3
- package/package.json +3 -3
- package/example/src/chevre/aggregateSellerPaymentAccepted.ts +0 -27
- package/example/src/handlePhoneNumber.ts +0 -13
- package/example/src/retryConnectMongo.ts +0 -82
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MongoRepository = void 0;
|
|
13
|
+
const mongoose_1 = require("mongoose");
|
|
14
|
+
const seller_1 = require("./mongoose/schemas/seller");
|
|
15
|
+
const factory = require("../factory");
|
|
16
|
+
const settings_1 = require("../settings");
|
|
17
|
+
/**
|
|
18
|
+
* 販売者対応決済方法リポジトリ
|
|
19
|
+
*/
|
|
20
|
+
class MongoRepository {
|
|
21
|
+
constructor(connection) {
|
|
22
|
+
this.sellerModel = connection.model(seller_1.modelName, (0, seller_1.createSchema)());
|
|
23
|
+
}
|
|
24
|
+
search(params) {
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const matchStages = [];
|
|
28
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
29
|
+
if (typeof projectIdEq === 'string') {
|
|
30
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
31
|
+
}
|
|
32
|
+
const sellerIdEq = (_d = (_c = params.seller) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
33
|
+
if (typeof sellerIdEq === 'string') {
|
|
34
|
+
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(sellerIdEq) } } });
|
|
35
|
+
}
|
|
36
|
+
const codeValueEq = (_e = params.codeValue) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
37
|
+
if (typeof codeValueEq === 'string') {
|
|
38
|
+
matchStages.push({ $match: { 'paymentAccepted.paymentMethodType': { $exists: true, $eq: codeValueEq } } });
|
|
39
|
+
}
|
|
40
|
+
const aggregate = this.sellerModel.aggregate([
|
|
41
|
+
{
|
|
42
|
+
$unwind: {
|
|
43
|
+
path: '$paymentAccepted'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
...matchStages,
|
|
47
|
+
{ $sort: { 'paymentAccepted.paymentMethodType': factory.sortType.Ascending } },
|
|
48
|
+
{
|
|
49
|
+
$project: {
|
|
50
|
+
_id: 0,
|
|
51
|
+
codeValue: '$paymentAccepted.paymentMethodType',
|
|
52
|
+
seller: { id: { $toString: '$_id' } }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]);
|
|
56
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
57
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
58
|
+
aggregate.limit(params.limit * page)
|
|
59
|
+
.skip(params.limit * (page - 1));
|
|
60
|
+
}
|
|
61
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
62
|
+
.exec();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
create(params) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
let doc = yield this.sellerModel.findOne({
|
|
68
|
+
'project.id': { $eq: params.project.id },
|
|
69
|
+
_id: { $eq: params.seller.id }
|
|
70
|
+
}, { _id: 1 })
|
|
71
|
+
.exec();
|
|
72
|
+
if (doc === null) {
|
|
73
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
74
|
+
}
|
|
75
|
+
const creatingPaymentAccepted = {
|
|
76
|
+
paymentMethodType: params.codeValue
|
|
77
|
+
};
|
|
78
|
+
doc = yield this.sellerModel.findOneAndUpdate({
|
|
79
|
+
'project.id': { $eq: params.project.id },
|
|
80
|
+
_id: { $eq: params.seller.id },
|
|
81
|
+
'paymentAccepted.paymentMethodType': { $ne: params.codeValue }
|
|
82
|
+
}, {
|
|
83
|
+
$push: { paymentAccepted: creatingPaymentAccepted }
|
|
84
|
+
}, {
|
|
85
|
+
projection: { _id: 1 }
|
|
86
|
+
})
|
|
87
|
+
.exec();
|
|
88
|
+
if (doc === null) {
|
|
89
|
+
throw new factory.errors.AlreadyInUse('paymentAccepted', ['paymentMethodType']);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
deleteOne(params) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const doc = yield this.sellerModel.findOneAndUpdate({
|
|
96
|
+
'project.id': { $eq: params.project.id },
|
|
97
|
+
_id: { $eq: params.seller.id },
|
|
98
|
+
'paymentAccepted.paymentMethodType': { $exists: true, $eq: params.codeValue }
|
|
99
|
+
}, {
|
|
100
|
+
$pull: { paymentAccepted: { paymentMethodType: params.codeValue } }
|
|
101
|
+
}, {
|
|
102
|
+
projection: { _id: 1 }
|
|
103
|
+
})
|
|
104
|
+
.exec();
|
|
105
|
+
if (doc === null) {
|
|
106
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
isAcceptedBySeller(params) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const aggregate = this.sellerModel.aggregate([
|
|
113
|
+
{
|
|
114
|
+
$unwind: { path: '$paymentAccepted' }
|
|
115
|
+
},
|
|
116
|
+
{ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(params.seller.id) } } },
|
|
117
|
+
{ $match: { 'paymentAccepted.paymentMethodType': { $exists: true, $eq: params.codeValue } } },
|
|
118
|
+
{
|
|
119
|
+
$project: {
|
|
120
|
+
_id: 0,
|
|
121
|
+
codeValue: '$paymentAccepted.paymentMethodType'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
])
|
|
125
|
+
.limit(1)
|
|
126
|
+
.skip(0);
|
|
127
|
+
return (yield aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
128
|
+
.exec()).length > 0;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.MongoRepository = MongoRepository;
|
|
@@ -37,6 +37,7 @@ import type { RedisRepository as OfferRateLimitRepo } from './repo/rateLimit/off
|
|
|
37
37
|
import type { MongoRepository as ReservationRepo } from './repo/reservation';
|
|
38
38
|
import type { MongoRepository as RoleRepo } from './repo/role';
|
|
39
39
|
import type { MongoRepository as SellerRepo } from './repo/seller';
|
|
40
|
+
import type { MongoRepository as SellerPaymentAcceptedRepo } from './repo/sellerPaymentAccepted';
|
|
40
41
|
import type { MongoRepository as ServiceOutputRepo } from './repo/serviceOutput';
|
|
41
42
|
import type { RedisRepository as ServiceOutputIdentifierRepo } from './repo/serviceOutputIdentifier';
|
|
42
43
|
import type { StockHolderRepository as StockHolderRepo } from './repo/stockHolder';
|
|
@@ -219,6 +220,10 @@ export type Seller = SellerRepo;
|
|
|
219
220
|
export declare namespace Seller {
|
|
220
221
|
function createInstance(...params: ConstructorParameters<typeof SellerRepo>): Promise<SellerRepo>;
|
|
221
222
|
}
|
|
223
|
+
export type SellerPaymentAccepted = SellerPaymentAcceptedRepo;
|
|
224
|
+
export declare namespace SellerPaymentAccepted {
|
|
225
|
+
function createInstance(...params: ConstructorParameters<typeof SellerPaymentAcceptedRepo>): Promise<SellerPaymentAcceptedRepo>;
|
|
226
|
+
}
|
|
222
227
|
export type ServiceOutput = ServiceOutputRepo;
|
|
223
228
|
export declare namespace ServiceOutput {
|
|
224
229
|
function createInstance(...params: ConstructorParameters<typeof ServiceOutputRepo>): Promise<ServiceOutputRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.ProductOffer = exports.Product = exports.PriceSpecification = exports.place = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
12
|
+
exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.ProductOffer = exports.Product = exports.PriceSpecification = exports.place = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
13
13
|
var Account;
|
|
14
14
|
(function (Account) {
|
|
15
15
|
let repo;
|
|
@@ -539,6 +539,19 @@ var Seller;
|
|
|
539
539
|
}
|
|
540
540
|
Seller.createInstance = createInstance;
|
|
541
541
|
})(Seller = exports.Seller || (exports.Seller = {}));
|
|
542
|
+
var SellerPaymentAccepted;
|
|
543
|
+
(function (SellerPaymentAccepted) {
|
|
544
|
+
let repo;
|
|
545
|
+
function createInstance(...params) {
|
|
546
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
547
|
+
if (repo === undefined) {
|
|
548
|
+
repo = (yield Promise.resolve().then(() => require('./repo/sellerPaymentAccepted'))).MongoRepository;
|
|
549
|
+
}
|
|
550
|
+
return new repo(...params);
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
SellerPaymentAccepted.createInstance = createInstance;
|
|
554
|
+
})(SellerPaymentAccepted = exports.SellerPaymentAccepted || (exports.SellerPaymentAccepted = {}));
|
|
542
555
|
var ServiceOutput;
|
|
543
556
|
(function (ServiceOutput) {
|
|
544
557
|
let repo;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ペイメントカード決済取引バリデーション
|
|
3
3
|
*/
|
|
4
|
-
import type { MongoRepository as
|
|
4
|
+
import type { MongoRepository as PaymentAcceptedRepo } from '../../../../repo/sellerPaymentAccepted';
|
|
5
5
|
import * as factory from '../../../../factory';
|
|
6
6
|
export declare function validateAccount(params: factory.assetTransaction.pay.IStartParamsWithoutDetail): (repos: {
|
|
7
|
-
|
|
7
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
8
8
|
}) => Promise<void>;
|
|
@@ -13,7 +13,7 @@ exports.validateAccount = void 0;
|
|
|
13
13
|
const factory = require("../../../../factory");
|
|
14
14
|
function validateAccount(params) {
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b, _c
|
|
16
|
+
var _a, _b, _c;
|
|
17
17
|
// 引き出し口座の存在を確認する
|
|
18
18
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
19
19
|
if (typeof paymentMethodType !== 'string') {
|
|
@@ -28,31 +28,27 @@ function validateAccount(params) {
|
|
|
28
28
|
if (typeof sellerId !== 'string') {
|
|
29
29
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
30
30
|
}
|
|
31
|
-
const sellers =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
31
|
+
// const sellers = <Pick<factory.seller.ISeller, 'paymentAccepted'>[]>await repos.seller.search(
|
|
32
|
+
// {
|
|
33
|
+
// limit: 1,
|
|
34
|
+
// page: 1,
|
|
35
|
+
// id: { $eq: sellerId }
|
|
36
|
+
// },
|
|
37
|
+
// ['paymentAccepted'],
|
|
38
|
+
// []
|
|
39
|
+
// );
|
|
40
|
+
// const seller = sellers.shift();
|
|
41
|
+
// if (seller === undefined) {
|
|
42
|
+
// throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
43
|
+
// }
|
|
44
|
+
// const paymentAccepted = seller.paymentAccepted?.some((a) => a.paymentMethodType === paymentMethodType);
|
|
45
|
+
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
46
|
+
seller: { id: sellerId },
|
|
47
|
+
codeValue: paymentMethodType
|
|
48
|
+
});
|
|
41
49
|
if (paymentAccepted !== true) {
|
|
42
|
-
throw new factory.errors.Argument('recipient', `payment not accepted`);
|
|
50
|
+
throw new factory.errors.Argument('recipient', `payment not accepted [${paymentMethodType}]`);
|
|
43
51
|
}
|
|
44
|
-
// ↓Pecorino側で口座存在確認、口座ステータス検証を実行しているので、必要なし
|
|
45
|
-
// const accounts = await repos.account.search({
|
|
46
|
-
// limit: 1,
|
|
47
|
-
// page: 1,
|
|
48
|
-
// project: { id: { $eq: params.project.id } },
|
|
49
|
-
// accountNumber: { $eq: accountNumber },
|
|
50
|
-
// statuses: [factory.accountStatusType.Opened]
|
|
51
|
-
// });
|
|
52
|
-
// const account = accounts.shift();
|
|
53
|
-
// if (account === undefined) {
|
|
54
|
-
// throw new factory.errors.NotFound('Account', `Account '${accountNumber}' not found`);
|
|
55
|
-
// }
|
|
56
52
|
});
|
|
57
53
|
}
|
|
58
54
|
exports.validateAccount = validateAccount;
|
|
@@ -12,18 +12,18 @@ import type { MongoRepository as PaymentServiceProviderRepo } from '../../repo/p
|
|
|
12
12
|
import type { CognitoRepository as PersonRepo } from '../../repo/person';
|
|
13
13
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
14
14
|
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
15
|
-
import type { MongoRepository as
|
|
15
|
+
import type { MongoRepository as PaymentAcceptedRepo } from '../../repo/sellerPaymentAccepted';
|
|
16
16
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
17
17
|
import * as MovieTicketPayment from '../payment/movieTicket';
|
|
18
18
|
export interface IStartOperationRepos {
|
|
19
19
|
accountingReport: AccountingReportRepo;
|
|
20
20
|
action: ActionRepo;
|
|
21
21
|
event: EventRepo;
|
|
22
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
22
23
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
23
24
|
person: PersonRepo;
|
|
24
25
|
product: ProductRepo;
|
|
25
26
|
project: ProjectRepo;
|
|
26
|
-
seller: SellerRepo;
|
|
27
27
|
assetTransaction: AssetTransactionRepo;
|
|
28
28
|
task: TaskRepo;
|
|
29
29
|
}
|
|
@@ -34,7 +34,6 @@ export interface ICancelRepos {
|
|
|
34
34
|
assetTransaction: AssetTransactionRepo;
|
|
35
35
|
product: ProductRepo;
|
|
36
36
|
project: ProjectRepo;
|
|
37
|
-
seller: SellerRepo;
|
|
38
37
|
task: TaskRepo;
|
|
39
38
|
}
|
|
40
39
|
export type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>;
|
|
@@ -46,7 +45,6 @@ export interface IConfirmRepos {
|
|
|
46
45
|
order: OrderRepo;
|
|
47
46
|
product: ProductRepo;
|
|
48
47
|
project: ProjectRepo;
|
|
49
|
-
seller: SellerRepo;
|
|
50
48
|
task: TaskRepo;
|
|
51
49
|
}
|
|
52
50
|
export type IConfirmOperation<T> = (repos: IConfirmRepos) => Promise<T>;
|
|
@@ -57,24 +55,24 @@ export type IExportTasksOperation<T> = (repos: {
|
|
|
57
55
|
export type ICheckOperation<T> = (repos: {
|
|
58
56
|
action: ActionRepo;
|
|
59
57
|
event: EventRepo;
|
|
58
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
60
59
|
product: ProductRepo;
|
|
61
60
|
project: ProjectRepo;
|
|
62
|
-
seller: SellerRepo;
|
|
63
61
|
}) => Promise<T>;
|
|
64
62
|
export type IPublishPaymentUrlOperation<T> = (repos: {
|
|
63
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
65
64
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
66
65
|
person: PersonRepo;
|
|
67
66
|
product: ProductRepo;
|
|
68
67
|
project: ProjectRepo;
|
|
69
|
-
seller: SellerRepo;
|
|
70
68
|
}) => Promise<T>;
|
|
71
69
|
export type IInvalidatePaymentUrlOperation<T> = (repos: {
|
|
72
70
|
accountingReport: AccountingReportRepo;
|
|
73
71
|
action: ActionRepo;
|
|
72
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
74
73
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
75
74
|
product: ProductRepo;
|
|
76
75
|
project: ProjectRepo;
|
|
77
|
-
seller: SellerRepo;
|
|
78
76
|
task: TaskRepo;
|
|
79
77
|
assetTransaction: AssetTransactionRepo;
|
|
80
78
|
}) => Promise<T>;
|
|
@@ -134,8 +132,8 @@ export declare function exportTasksById(params: {
|
|
|
134
132
|
export declare function searchGMOTrade(params: {
|
|
135
133
|
transactionNumber: string;
|
|
136
134
|
}): (repos: {
|
|
135
|
+
paymentAccepted: PaymentAcceptedRepo;
|
|
137
136
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
138
137
|
product: ProductRepo;
|
|
139
|
-
seller: SellerRepo;
|
|
140
138
|
assetTransaction: AssetTransactionRepo;
|
|
141
139
|
}) => Promise<GMO.factory.credit.ISearchTradeResult>;
|
|
@@ -203,20 +203,24 @@ function fixPaymentService(params) {
|
|
|
203
203
|
}
|
|
204
204
|
function validateSeller(params) {
|
|
205
205
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
var _a, _b
|
|
206
|
+
var _a, _b;
|
|
207
207
|
const sellerId = (_a = params.recipient) === null || _a === void 0 ? void 0 : _a.id;
|
|
208
208
|
if (typeof sellerId !== 'string') {
|
|
209
209
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
210
210
|
}
|
|
211
|
-
const sellers =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
211
|
+
// const sellers = <Pick<factory.seller.ISeller, 'paymentAccepted'>[]>await repos.seller.search(
|
|
212
|
+
// {
|
|
213
|
+
// limit: 1,
|
|
214
|
+
// page: 1,
|
|
215
|
+
// id: { $eq: sellerId }
|
|
216
|
+
// },
|
|
217
|
+
// ['paymentAccepted'],
|
|
218
|
+
// []
|
|
219
|
+
// );
|
|
220
|
+
// const seller = sellers.shift();
|
|
221
|
+
// if (seller === undefined) {
|
|
222
|
+
// throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
223
|
+
// }
|
|
220
224
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
221
225
|
if (typeof paymentMethodType !== 'string') {
|
|
222
226
|
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
@@ -225,17 +229,25 @@ function validateSeller(params) {
|
|
|
225
229
|
if (params.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
226
230
|
if (paymentMethodType.length > 0) {
|
|
227
231
|
// 販売者の対応決済方法かどうか確認
|
|
228
|
-
const paymentAccepted =
|
|
232
|
+
// const paymentAccepted = seller.paymentAccepted?.some((a) => a.paymentMethodType === paymentMethodType);
|
|
233
|
+
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
234
|
+
seller: { id: sellerId },
|
|
235
|
+
codeValue: paymentMethodType
|
|
236
|
+
});
|
|
229
237
|
if (paymentAccepted !== true) {
|
|
230
|
-
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
238
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted [${paymentMethodType}]`);
|
|
231
239
|
}
|
|
232
240
|
}
|
|
233
241
|
}
|
|
234
242
|
else {
|
|
235
243
|
// 販売者の対応決済方法かどうか確認
|
|
236
|
-
const paymentAccepted =
|
|
244
|
+
// const paymentAccepted = seller.paymentAccepted?.some((a) => a.paymentMethodType === paymentMethodType);
|
|
245
|
+
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
246
|
+
seller: { id: sellerId },
|
|
247
|
+
codeValue: paymentMethodType
|
|
248
|
+
});
|
|
237
249
|
if (paymentAccepted !== true) {
|
|
238
|
-
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
250
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted [${paymentMethodType}]`);
|
|
239
251
|
}
|
|
240
252
|
}
|
|
241
253
|
});
|
|
@@ -35,7 +35,7 @@ interface IAuthorizeRepos {
|
|
|
35
35
|
transactionNumber: TransactionNumberRepo;
|
|
36
36
|
}
|
|
37
37
|
type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
|
|
38
|
-
type IAuthorizeOfferAction = factory.action.authorize.offer.
|
|
38
|
+
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
39
39
|
/**
|
|
40
40
|
* イベントオファー承認
|
|
41
41
|
*/
|
|
@@ -64,6 +64,6 @@ declare function authorize(params: {
|
|
|
64
64
|
/**
|
|
65
65
|
* オファーID指定なしに座席をおさえる場合true
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
noOfferSpecified: boolean;
|
|
68
68
|
}): IAuthorizeOperation<IAuthorizeOfferAction>;
|
|
69
69
|
export { authorize };
|
|
@@ -21,6 +21,7 @@ const factory_1 = require("./factory");
|
|
|
21
21
|
function authorize(params) {
|
|
22
22
|
// tslint:disable-next-line:max-func-body-length
|
|
23
23
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const noOfferSpecified = params.noOfferSpecified === true;
|
|
24
25
|
const { transaction, event, bookingServiceIdentifire } = yield validateCreateRequest(params)({ event: repos.event, transaction: repos.transaction });
|
|
25
26
|
const { acceptedOffers, ticketOffers, unitPriceOffers } = yield validateAcceptedOffers({
|
|
26
27
|
object: params.object,
|
|
@@ -28,7 +29,7 @@ function authorize(params) {
|
|
|
28
29
|
seller: { typeOf: transaction.seller.typeOf, id: String(transaction.seller.id) },
|
|
29
30
|
transaction,
|
|
30
31
|
store: params.store,
|
|
31
|
-
|
|
32
|
+
noOfferSpecified
|
|
32
33
|
})(repos);
|
|
33
34
|
let acceptedOffers4result = [];
|
|
34
35
|
let transactionNumber;
|
|
@@ -96,16 +97,12 @@ function authorize(params) {
|
|
|
96
97
|
}
|
|
97
98
|
throw error;
|
|
98
99
|
}
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
requestBody: {},
|
|
106
|
-
responseBody: {},
|
|
107
|
-
acceptedOffers: acceptedOffers4result
|
|
108
|
-
};
|
|
100
|
+
const result = Object.assign({ priceCurrency: acceptedOffers[0].priceCurrency, amount: [], requestBody: {}, responseBody: {} }, (!noOfferSpecified) // オファー指定の場合のみ金額計算(2023-11-27~)
|
|
101
|
+
? {
|
|
102
|
+
price: (0, factory_1.acceptedOffers2amount)({ acceptedOffers: acceptedOffers4result }),
|
|
103
|
+
acceptedOffers: acceptedOffers4result
|
|
104
|
+
}
|
|
105
|
+
: undefined);
|
|
109
106
|
return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
|
|
110
107
|
});
|
|
111
108
|
}
|
|
@@ -146,7 +143,7 @@ function validateAcceptedOffers(params) {
|
|
|
146
143
|
let ticketOffers;
|
|
147
144
|
let unitPriceOffers;
|
|
148
145
|
let acceptedOffersWithoutDetail = params.object.acceptedOffer;
|
|
149
|
-
if (params.
|
|
146
|
+
if (params.noOfferSpecified === true) {
|
|
150
147
|
if (Array.isArray(acceptedOffersWithoutDetail)) {
|
|
151
148
|
acceptedOffersWithoutDetail = acceptedOffersWithoutDetail.map((offerWithoutDetail) => {
|
|
152
149
|
return Object.assign(Object.assign({}, offerWithoutDetail), { id: defaultOffer_1.DEFAULT_OFFER_ID });
|
|
@@ -156,7 +153,7 @@ function validateAcceptedOffers(params) {
|
|
|
156
153
|
const offerIds = (Array.isArray(acceptedOffersWithoutDetail))
|
|
157
154
|
? [...new Set(acceptedOffersWithoutDetail.map((o) => o.id))]
|
|
158
155
|
: [];
|
|
159
|
-
if (params.
|
|
156
|
+
if (params.noOfferSpecified === true) {
|
|
160
157
|
if (Array.isArray(acceptedOffersWithoutDetail)) {
|
|
161
158
|
acceptedOffersWithoutDetail = acceptedOffersWithoutDetail.map((offerWithoutDetail) => {
|
|
162
159
|
return Object.assign(Object.assign({}, offerWithoutDetail), { id: defaultOffer_1.DEFAULT_OFFER_ID });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
-
declare const DEFAULT_OFFER_ID = "
|
|
2
|
+
declare const DEFAULT_OFFER_ID = "****AUTOMATICALLY_APPLIED****";
|
|
3
3
|
declare const DEFAULT_TICKET_OFFER: factory.product.ITicketOffer;
|
|
4
4
|
declare const DEFAULT_AVAILABLE_OFFER: factory.unitPriceOffer.IUnitPriceOffer;
|
|
5
5
|
export { DEFAULT_OFFER_ID, DEFAULT_TICKET_OFFER, DEFAULT_AVAILABLE_OFFER };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_AVAILABLE_OFFER = exports.DEFAULT_TICKET_OFFER = exports.DEFAULT_OFFER_ID = void 0;
|
|
4
4
|
const factory = require("../../../factory");
|
|
5
|
-
const DEFAULT_OFFER_ID = '
|
|
5
|
+
const DEFAULT_OFFER_ID = '****AUTOMATICALLY_APPLIED****';
|
|
6
6
|
exports.DEFAULT_OFFER_ID = DEFAULT_OFFER_ID;
|
|
7
|
-
const DEFAULT_OFFER_IDENTIFIER = '
|
|
8
|
-
const DEFAULT_OFFER_NAME = '
|
|
7
|
+
const DEFAULT_OFFER_IDENTIFIER = '****AUTOMATICALLY_APPLIED****';
|
|
8
|
+
const DEFAULT_OFFER_NAME = '****AUTOMATICALLY_APPLIED****';
|
|
9
9
|
const unitPriceSpecification = {
|
|
10
10
|
typeOf: factory.priceSpecificationType.UnitPriceSpecification,
|
|
11
11
|
name: { ja: DEFAULT_OFFER_NAME, en: DEFAULT_OFFER_NAME },
|
|
@@ -17,23 +17,16 @@ const unitPriceSpecification = {
|
|
|
17
17
|
value: 1,
|
|
18
18
|
unitCode: factory.unitCode.C62
|
|
19
19
|
}
|
|
20
|
-
// accounting: {}
|
|
21
20
|
};
|
|
22
21
|
const DEFAULT_TICKET_OFFER = {
|
|
23
22
|
name: { ja: DEFAULT_OFFER_NAME, en: DEFAULT_OFFER_NAME },
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// color: 'rgb(117, 148, 188)',
|
|
23
|
+
description: { ja: DEFAULT_OFFER_NAME, en: DEFAULT_OFFER_NAME },
|
|
24
|
+
additionalProperty: [],
|
|
27
25
|
typeOf: factory.offerType.Offer,
|
|
28
26
|
id: DEFAULT_OFFER_ID,
|
|
29
27
|
priceCurrency: factory.priceCurrency.JPY,
|
|
30
28
|
identifier: DEFAULT_OFFER_IDENTIFIER,
|
|
31
29
|
itemOffered: { typeOf: factory.product.ProductType.EventService },
|
|
32
|
-
// eligibleQuantity: {
|
|
33
|
-
// typeOf: 'QuantitativeValue',
|
|
34
|
-
// unitCode: chevre.factory.unitCode.C62,
|
|
35
|
-
// maxValue: 6
|
|
36
|
-
// },
|
|
37
30
|
priceSpecification: {
|
|
38
31
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
39
32
|
priceCurrency: factory.priceCurrency.JPY,
|
|
@@ -41,11 +34,6 @@ const DEFAULT_TICKET_OFFER = {
|
|
|
41
34
|
priceComponent: [unitPriceSpecification]
|
|
42
35
|
},
|
|
43
36
|
availability: factory.itemAvailability.InStock
|
|
44
|
-
// sortIndex: 0,
|
|
45
|
-
// offerIndex: 0,
|
|
46
|
-
// parentOffer: {
|
|
47
|
-
// id: '1001'
|
|
48
|
-
// }
|
|
49
37
|
};
|
|
50
38
|
exports.DEFAULT_TICKET_OFFER = DEFAULT_TICKET_OFFER;
|
|
51
39
|
const DEFAULT_AVAILABLE_OFFER = {
|
|
@@ -3,8 +3,8 @@ import * as factory from '../../../factory';
|
|
|
3
3
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
4
4
|
export type IReservationFor = factory.reservation.IReservationFor<factory.reservationType.EventReservation>;
|
|
5
5
|
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
6
|
-
export type IObjectWithoutDetail = factory.action.authorize.offer.
|
|
7
|
-
export type IObjectWithDetail = factory.action.authorize.offer.
|
|
6
|
+
export type IObjectWithoutDetail = factory.action.authorize.offer.eventService.IObjectWithoutDetail4chevre;
|
|
7
|
+
export type IObjectWithDetail = factory.action.authorize.offer.eventService.IObject<factory.service.webAPI.Identifier.Chevre>;
|
|
8
8
|
export declare function createReserveTransactionStartParams(params: {
|
|
9
9
|
project: {
|
|
10
10
|
id: string;
|
|
@@ -14,17 +14,17 @@ export declare function createReserveTransactionStartParams(params: {
|
|
|
14
14
|
transactionNumber: string;
|
|
15
15
|
}): factory.assetTransaction.reserve.IStartParamsWithoutDetail;
|
|
16
16
|
export declare function createAuthorizeSeatReservationActionAttributes(params: {
|
|
17
|
-
acceptedOffers: factory.action.authorize.offer.
|
|
17
|
+
acceptedOffers: factory.action.authorize.offer.eventService.IAcceptedOffer4chevre[];
|
|
18
18
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
19
|
-
pendingTransaction?: factory.action.authorize.offer.
|
|
19
|
+
pendingTransaction?: factory.action.authorize.offer.eventService.IChevrePendingTransaction | undefined;
|
|
20
20
|
transaction: factory.transaction.ITransaction<factory.transactionType.PlaceOrder>;
|
|
21
21
|
broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
|
|
22
|
-
}): factory.action.authorize.offer.
|
|
22
|
+
}): factory.action.authorize.offer.eventService.IAttributes<factory.service.webAPI.Identifier.Chevre>;
|
|
23
23
|
export declare function acceptedOffers2amount(params: {
|
|
24
24
|
acceptedOffers: IResultAcceptedOffer[];
|
|
25
25
|
}): number;
|
|
26
26
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
27
|
-
type IResultAcceptedOffer = factory.action.authorize.offer.
|
|
27
|
+
type IResultAcceptedOffer = factory.action.authorize.offer.eventService.IResultAcceptedOffer;
|
|
28
28
|
export declare function responseBody2acceptedOffers4result(params: {
|
|
29
29
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
30
30
|
objectSubReservations: IObjectSubReservation[];
|
|
@@ -96,7 +96,7 @@ function createAuthorizeSeatReservationActionAttributes(params) {
|
|
|
96
96
|
return {
|
|
97
97
|
project: transaction.project,
|
|
98
98
|
typeOf: factory.actionType.AuthorizeAction,
|
|
99
|
-
object: Object.assign(Object.assign({ typeOf: factory.action.authorize.offer.
|
|
99
|
+
object: Object.assign(Object.assign({ typeOf: factory.action.authorize.offer.eventService.ObjectType.SeatReservation, event: authorizeObjectEvent,
|
|
100
100
|
// ↓不要なので廃止(2022-06-07~)
|
|
101
101
|
// reservationFor: { id: event.id },
|
|
102
102
|
acceptedOffer: acceptedOffers }, (params.pendingTransaction !== undefined) ? { pendingTransaction: params.pendingTransaction } : undefined), (params.broker !== undefined) ? { broker: params.broker } : undefined),
|
|
@@ -13,7 +13,7 @@ import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLi
|
|
|
13
13
|
import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
14
14
|
import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
15
15
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
16
|
-
type IAuthorizeOfferAction = factory.action.authorize.offer.
|
|
16
|
+
type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
|
|
17
17
|
declare function processStartReserve4chevre(params: {
|
|
18
18
|
action: IAuthorizeOfferAction;
|
|
19
19
|
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
|
|
@@ -44,6 +44,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
44
44
|
task: TaskRepo;
|
|
45
45
|
assetTransaction: AssetTransactionRepo;
|
|
46
46
|
}) => Promise<{
|
|
47
|
-
acceptedOffers4result: import("@chevre/factory/lib/action/authorize/offer/
|
|
47
|
+
acceptedOffers4result: import("@chevre/factory/lib/action/authorize/offer/eventService").IResultAcceptedOffer[];
|
|
48
48
|
}>;
|
|
49
49
|
export { processStartReserve4chevre };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
|
-
import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
2
|
+
import type { IPriceSpecificationConditionsOnSearchWithSortIndex, MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
4
|
import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
5
5
|
import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
@@ -41,7 +41,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
41
41
|
* 有効期間内のみかどうか
|
|
42
42
|
*/
|
|
43
43
|
onlyValid: boolean;
|
|
44
|
-
priceSpecification:
|
|
44
|
+
priceSpecification: IPriceSpecificationConditionsOnSearchWithSortIndex;
|
|
45
45
|
includedInDataCatalog: {
|
|
46
46
|
id: string;
|
|
47
47
|
};
|