@chevre/domain 21.37.0-alpha.7 → 21.37.0-alpha.8
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/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +20 -1
- package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +5 -4
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.js +1 -3
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +0 -2
- package/package.json +2 -2
|
@@ -57,6 +57,7 @@ export declare class MongoRepository {
|
|
|
57
57
|
* 取引を開始する
|
|
58
58
|
*/
|
|
59
59
|
start<T extends factory.assetTransactionType>(params: factory.assetTransaction.IStartParams<T>): Promise<factory.assetTransaction.ITransaction<T>>;
|
|
60
|
+
startWithMinimalResponse<T extends factory.assetTransactionType>(params: factory.assetTransaction.IStartParams<T>): Promise<Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType>, 'id'>>;
|
|
60
61
|
findById<T extends factory.assetTransactionType>(params: {
|
|
61
62
|
typeOf: T;
|
|
62
63
|
id: string;
|
|
@@ -299,7 +299,9 @@ class MongoRepository {
|
|
|
299
299
|
/**
|
|
300
300
|
* 取引を開始する
|
|
301
301
|
*/
|
|
302
|
-
start(params
|
|
302
|
+
start(params
|
|
303
|
+
// ): Promise<Pick<factory.assetTransaction.ITransaction<T>, 'id'>> {
|
|
304
|
+
) {
|
|
303
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
304
306
|
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportAction: {
|
|
305
307
|
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
@@ -307,6 +309,23 @@ class MongoRepository {
|
|
|
307
309
|
.then((doc) => doc.toObject());
|
|
308
310
|
});
|
|
309
311
|
}
|
|
312
|
+
startWithMinimalResponse(params) {
|
|
313
|
+
var _a, _b;
|
|
314
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
315
|
+
const { typeOf } = params;
|
|
316
|
+
const creatingTransaction = Object.assign(Object.assign({}, params), { typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(),
|
|
317
|
+
// endDate: undefined,
|
|
318
|
+
tasksExportAction: {
|
|
319
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
320
|
+
} });
|
|
321
|
+
const result = yield this.transactionModel.insertMany(creatingTransaction, { ordered: false, rawResult: true });
|
|
322
|
+
const id = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
323
|
+
if (typeof id !== 'string') {
|
|
324
|
+
throw new factory.errors.Internal('assetTransaction not saved');
|
|
325
|
+
}
|
|
326
|
+
return { id };
|
|
327
|
+
});
|
|
328
|
+
}
|
|
310
329
|
findById(params, inclusion) {
|
|
311
330
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
331
|
let projection = {};
|
|
@@ -22,7 +22,7 @@ export declare function start(params: factory.assetTransaction.cancelReservation
|
|
|
22
22
|
seller: {
|
|
23
23
|
id?: string;
|
|
24
24
|
};
|
|
25
|
-
}): IStartOperation<factory.assetTransaction.cancelReservation.ITransaction
|
|
25
|
+
}): IStartOperation<Pick<factory.assetTransaction.cancelReservation.ITransaction, 'id'>>;
|
|
26
26
|
/**
|
|
27
27
|
* 取引確定
|
|
28
28
|
*/
|
|
@@ -24,7 +24,7 @@ export type IExportTasksOperation<T> = (repos: {
|
|
|
24
24
|
/**
|
|
25
25
|
* 取引開始
|
|
26
26
|
*/
|
|
27
|
-
export declare function start(params: factory.assetTransaction.refund.IStartParamsWithoutDetail): IStartOperation<factory.assetTransaction.refund.ITransaction
|
|
27
|
+
export declare function start(params: factory.assetTransaction.refund.IStartParamsWithoutDetail): IStartOperation<Pick<factory.assetTransaction.refund.ITransaction, 'id'>>;
|
|
28
28
|
/**
|
|
29
29
|
* 取引確定
|
|
30
30
|
*/
|
|
@@ -71,13 +71,14 @@ function start(params) {
|
|
|
71
71
|
validateAppliesToMovieTicket: params.validateAppliesToMovieTicket,
|
|
72
72
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
73
73
|
})(repos);
|
|
74
|
-
//
|
|
75
|
-
const transaction =
|
|
74
|
+
// reimplement using startWithMinimalResponse(2024-07-02~)
|
|
75
|
+
// const transaction = await repos.assetTransaction.start<factory.assetTransactionType.Reserve>(startParams);
|
|
76
|
+
const { id } = yield repos.assetTransaction.startWithMinimalResponse(startParams);
|
|
76
77
|
// let objectSubReservations: IObjectSubReservation[] = [];
|
|
77
78
|
// const addReservationsResult = await addReservations({
|
|
78
79
|
yield addReservations({
|
|
79
80
|
reservationFor: startParams.object.reservationFor,
|
|
80
|
-
transaction: { id
|
|
81
|
+
transaction: { id, transactionNumber: reservationNumber },
|
|
81
82
|
event,
|
|
82
83
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd,
|
|
83
84
|
acceptedOffers4transactionObject, objectSubReservations
|
|
@@ -85,7 +86,7 @@ function start(params) {
|
|
|
85
86
|
// transaction = addReservationsResult.transaction;
|
|
86
87
|
// objectSubReservations = addReservationsResult.objectSubReservations;
|
|
87
88
|
return {
|
|
88
|
-
transaction: { id
|
|
89
|
+
transaction: { id },
|
|
89
90
|
objectSubReservations,
|
|
90
91
|
// issuedThrough: addReservationsResult.issuedThrough
|
|
91
92
|
issuedThrough: startParams.object.issuedThrough
|
|
@@ -15,7 +15,6 @@ import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
|
15
15
|
import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
|
|
16
16
|
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
17
17
|
import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
18
|
-
import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
19
18
|
import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
20
19
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
21
20
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
@@ -38,7 +37,6 @@ interface IAuthorizeRepos {
|
|
|
38
37
|
product: ProductRepo;
|
|
39
38
|
productOffer: ProductOfferRepo;
|
|
40
39
|
project: ProjectRepo;
|
|
41
|
-
reservation: ReservationRepo;
|
|
42
40
|
seat: SeatRepo;
|
|
43
41
|
task: TaskRepo;
|
|
44
42
|
ticket: TicketRepo;
|
|
@@ -62,9 +62,7 @@ function authorize(params) {
|
|
|
62
62
|
// case factory.service.webAPI.Identifier.COA:
|
|
63
63
|
// break;
|
|
64
64
|
case factory.service.webAPI.Identifier.Chevre:
|
|
65
|
-
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({
|
|
66
|
-
// action,
|
|
67
|
-
acceptedOffer: acceptedOffers, event,
|
|
65
|
+
const processStartReserveResult = yield (0, processStartReserve4chevre_1.processStartReserve4chevre)(Object.assign({ acceptedOffer: acceptedOffers, event,
|
|
68
66
|
transactionNumber,
|
|
69
67
|
transaction, availableAtOrFrom: { id: params.store.id }, ticketOffers,
|
|
70
68
|
unitPriceOffers, validateEvent: params.validateEvent === true, validateEventOfferPeriod: params.validateEventOfferPeriod === true,
|
|
@@ -13,7 +13,6 @@ import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
|
13
13
|
import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
|
|
14
14
|
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
15
15
|
import type { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
|
|
16
|
-
import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
17
16
|
import type { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
18
17
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
19
18
|
import type { TicketRepo } from '../../../repo/ticket';
|
|
@@ -45,7 +44,6 @@ declare function processStartReserve4chevre(params: {
|
|
|
45
44
|
productOffer: ProductOfferRepo;
|
|
46
45
|
priceSpecification: PriceSpecificationRepo;
|
|
47
46
|
project: ProjectRepo;
|
|
48
|
-
reservation: ReservationRepo;
|
|
49
47
|
seat: SeatRepo;
|
|
50
48
|
task: TaskRepo;
|
|
51
49
|
ticket: TicketRepo;
|
package/package.json
CHANGED
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"mocha": "mocha",
|
|
104
104
|
"nyc": "nyc mocha \"src/**/*.spec.ts\"",
|
|
105
105
|
"coverage": "npm run nyc && nyc report --reporter=text-lcov | coveralls",
|
|
106
|
-
"test": "npm run check",
|
|
106
|
+
"test": "npm run check && npm run coverage",
|
|
107
107
|
"tslint": "tslint --project tsconfig.json -c tslint.json --exclude \"**/*.spec.ts\" \"src/**/*.ts\"",
|
|
108
108
|
"preversion": "npm run clean && npm run build && npm test && npm run doc",
|
|
109
109
|
"version": "git add -A",
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.37.0-alpha.
|
|
113
|
+
"version": "21.37.0-alpha.8"
|
|
114
114
|
}
|