@chevre/domain 21.27.0-alpha.2 → 21.27.0-alpha.3
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/transaction/processPlaceOrder.ts +1 -2
- package/lib/chevre/service/reserve/factory.d.ts +6 -5
- package/lib/chevre/service/reserve/factory.js +13 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +1 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/start.js +1 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +8 -11
- package/lib/chevre/settings.d.ts +0 -1
- package/lib/chevre/settings.js +1 -2
- package/package.json +1 -1
|
@@ -37,8 +37,7 @@ async function main() {
|
|
|
37
37
|
object: {
|
|
38
38
|
clientUser: <any>{ client_id: CLIENT_ID }
|
|
39
39
|
},
|
|
40
|
-
seller: { id: '59d20831e53ebc2b4e774466' }
|
|
41
|
-
validateEligibleCustomerType: false
|
|
40
|
+
seller: { id: '59d20831e53ebc2b4e774466' }
|
|
42
41
|
})({
|
|
43
42
|
member: await chevre.repository.Member.createInstance(mongoose.connection),
|
|
44
43
|
projectMakesOffer: await chevre.repository.ProjectMakesOffer.createInstance(mongoose.connection),
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
type IEventReservation = factory.reservation.IReservation<factory.reservationType.EventReservation>;
|
|
3
|
-
|
|
3
|
+
type IMaskedUnderName = Pick<factory.reservation.IUnderName<factory.reservationType.EventReservation>, 'id' | 'typeOf'>;
|
|
4
|
+
type IEventReservationUnderNameMasked = Omit<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'underName'> & {
|
|
5
|
+
underName?: IMaskedUnderName;
|
|
6
|
+
};
|
|
7
|
+
export declare function maskUnderName(reservation: IEventReservation): IEventReservationUnderNameMasked;
|
|
4
8
|
export interface IProject {
|
|
5
9
|
id: string;
|
|
6
10
|
typeOf: factory.organizationType.Project;
|
|
@@ -15,12 +19,9 @@ export interface IReservationPackage4informConfirmed {
|
|
|
15
19
|
reservationNumber: string;
|
|
16
20
|
reservationStatus: factory.reservationStatusType;
|
|
17
21
|
subReservation: ISubReservation[];
|
|
18
|
-
underName?:
|
|
22
|
+
underName?: IMaskedUnderName;
|
|
19
23
|
typeOf: factory.reservationType.ReservationPackage;
|
|
20
24
|
}
|
|
21
|
-
/**
|
|
22
|
-
* 確定予約通知
|
|
23
|
-
*/
|
|
24
25
|
/**
|
|
25
26
|
* 予約取消通知
|
|
26
27
|
*/
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
|
|
4
|
-
const MASKED_PROFILE = '****';
|
|
5
4
|
function maskUnderName(reservation) {
|
|
6
5
|
var _a;
|
|
7
6
|
const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// ReservationPackage通知アクションのobject.underNameを最小化(2024-03-19~)
|
|
8
|
+
// ? {
|
|
9
|
+
// ...reservation.underName,
|
|
10
|
+
// email: MASKED_PROFILE,
|
|
11
|
+
// telephone: MASKED_PROFILE,
|
|
12
|
+
// name: MASKED_PROFILE,
|
|
13
|
+
// familyName: MASKED_PROFILE,
|
|
14
|
+
// givenName: MASKED_PROFILE,
|
|
15
|
+
// // identifierも隠蔽(2022-12-27~)
|
|
16
|
+
// identifier: []
|
|
17
|
+
// }
|
|
18
|
+
? { id: reservation.underName.id, typeOf: reservation.underName.typeOf }
|
|
19
|
+
: undefined;
|
|
11
20
|
return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
|
|
12
21
|
}
|
|
13
22
|
exports.maskUnderName = maskUnderName;
|
|
@@ -32,9 +32,7 @@ const informReservations = settings_1.settings.onReservationStatusChanged.inform
|
|
|
32
32
|
/**
|
|
33
33
|
* 予約確定後のアクション
|
|
34
34
|
*/
|
|
35
|
-
function onReservationConfirmedByAction(actionAttributes
|
|
36
|
-
// confirmedReservation: IEventReservation
|
|
37
|
-
) {
|
|
35
|
+
function onReservationConfirmedByAction(actionAttributes) {
|
|
38
36
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
39
37
|
const potentialActions = actionAttributes.potentialActions;
|
|
40
38
|
const now = new Date();
|
|
@@ -81,7 +79,6 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
81
79
|
var _a, _b;
|
|
82
80
|
const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
83
81
|
// ReservationPackage通知に変更(2022-12-24~)
|
|
84
|
-
// const informObject: IInformObject = confirmedReservations.map(maskUnderName);
|
|
85
82
|
const informObject = [Object.assign({ project: confirmedReservations[0].project, reservationFor: confirmedReservations[0].reservationFor, reservationNumber: confirmedReservations[0].reservationNumber, reservationStatus: confirmedReservations[0].reservationStatus, subReservation: confirmedReservations.map((r) => {
|
|
86
83
|
const { broker, project, reservationFor, reservationNumber, reservationStatus, underName } = r, subReservation = __rest(r, ["broker", "project", "reservationFor", "reservationNumber", "reservationStatus", "underName"]);
|
|
87
84
|
return subReservation;
|
|
@@ -11,9 +11,7 @@ interface IStartOperationRepos {
|
|
|
11
11
|
transaction: TransactionRepo;
|
|
12
12
|
}
|
|
13
13
|
type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
14
|
-
type IStartParams = PlaceOrderFactory.IStartParams
|
|
15
|
-
validateEligibleCustomerType: boolean;
|
|
16
|
-
};
|
|
14
|
+
type IStartParams = PlaceOrderFactory.IStartParams;
|
|
17
15
|
/**
|
|
18
16
|
* 取引開始
|
|
19
17
|
*/
|
|
@@ -22,8 +22,7 @@ function start(params) {
|
|
|
22
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
var _a;
|
|
24
24
|
const { passport, customerType } = yield (0, validation_1.validateWaiterPassport)(params);
|
|
25
|
-
const { memeberOfPayload, sellerMakesOffer, seller } = yield (0, validateStartRequest_1.validateStartRequest)(Object.assign({ project: { id: params.project.id }, seller: { id: params.seller.id }, clientUser: params.object.clientUser, memberOfToken: params.agent.memberOfToken }, (
|
|
26
|
-
&& typeof (passport === null || passport === void 0 ? void 0 : passport.scope) === 'string') ? { customerType } : undefined))(repos);
|
|
25
|
+
const { memeberOfPayload, sellerMakesOffer, seller } = yield (0, validateStartRequest_1.validateStartRequest)(Object.assign({ project: { id: params.project.id }, seller: { id: params.seller.id }, clientUser: params.object.clientUser, memberOfToken: params.agent.memberOfToken }, (typeof (passport === null || passport === void 0 ? void 0 : passport.scope) === 'string') ? { customerType } : undefined))(repos);
|
|
27
26
|
const expiresInSeconds = (_a = sellerMakesOffer.eligibleTransactionDuration) === null || _a === void 0 ? void 0 : _a.maxValue;
|
|
28
27
|
if (typeof expiresInSeconds !== 'number') {
|
|
29
28
|
throw new factory.errors.NotFound('eligibleTransactionDuration.maxValue');
|
package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js
CHANGED
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.validateStartRequest = void 0;
|
|
13
13
|
const jwt = require("jsonwebtoken");
|
|
14
14
|
const factory = require("../../../../factory");
|
|
15
|
-
const settings_1 = require("../../../../settings");
|
|
16
15
|
function verifyMembershipToken(params) {
|
|
17
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
let result;
|
|
@@ -58,16 +57,14 @@ function validateStartRequest(params) {
|
|
|
58
57
|
throw new factory.errors.ArgumentNull('client_id');
|
|
59
58
|
}
|
|
60
59
|
let projectMakesOffer;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
throw new factory.errors.Argument('project', 'project makes no offers');
|
|
70
|
-
}
|
|
60
|
+
projectMakesOffer = (yield repos.projectMakesOffer.search({
|
|
61
|
+
limit: 1,
|
|
62
|
+
page: 1,
|
|
63
|
+
offeredBy: { id: { $eq: params.project.id } },
|
|
64
|
+
availableAtOrFrom: { id: { $eq: clientId } }
|
|
65
|
+
})).shift();
|
|
66
|
+
if (projectMakesOffer === undefined) {
|
|
67
|
+
throw new factory.errors.Argument('project', 'project makes no offers');
|
|
71
68
|
}
|
|
72
69
|
const seller = (yield repos.seller.search({
|
|
73
70
|
limit: 1,
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ export declare const USE_DELETE_EVENT_BY_ORDER: boolean;
|
|
|
39
39
|
export declare const USE_OPTIMIZE_TICKET_OFFER: boolean;
|
|
40
40
|
export declare const USE_FETCH_API: boolean;
|
|
41
41
|
export declare const USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING: boolean;
|
|
42
|
-
export declare const USE_VALIDATE_PROJECT_MAKES_OFFER: boolean;
|
|
43
42
|
export declare const USE_OWNERSHIP_INFO_BY_WEB_APPLICATION: boolean;
|
|
44
43
|
export declare const USE_CHECK_RESOURCE_TASK: boolean;
|
|
45
44
|
export declare const USE_OPTIMIZE_RESERVATION_EXCEPTIONS: string[];
|
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.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_RESERVATION_EXCEPTIONS = exports.USE_CHECK_RESOURCE_TASK = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.
|
|
3
|
+
exports.settings = exports.DELIVER_ORDER_LIMIT = exports.MONGO_AUTO_INDEX = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_RESERVATION_EXCEPTIONS = exports.USE_CHECK_RESOURCE_TASK = exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = exports.USE_FETCH_API = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_DELETE_EVENT_BY_ORDER = 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.MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const factory = require("./factory");
|
|
5
5
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
6
6
|
? process.env.INFORM_TRANSACTION_URL.split(' ')
|
|
@@ -63,7 +63,6 @@ exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1
|
|
|
63
63
|
exports.USE_OPTIMIZE_TICKET_OFFER = process.env.USE_OPTIMIZE_TICKET_OFFER === '1';
|
|
64
64
|
exports.USE_FETCH_API = process.env.USE_FETCH_API === '1';
|
|
65
65
|
exports.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING = process.env.USE_SEND_EMAIL_MESSAGE_ON_ORDER_PROCESSING === '1';
|
|
66
|
-
exports.USE_VALIDATE_PROJECT_MAKES_OFFER = process.env.USE_VALIDATE_PROJECT_MAKES_OFFER === '1';
|
|
67
66
|
exports.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION = process.env.USE_OWNERSHIP_INFO_BY_WEB_APPLICATION === '1';
|
|
68
67
|
exports.USE_CHECK_RESOURCE_TASK = process.env.USE_CHECK_RESOURCE_TASK === '1';
|
|
69
68
|
exports.USE_OPTIMIZE_RESERVATION_EXCEPTIONS = (typeof process.env.USE_OPTIMIZE_RESERVATION_EXCEPTIONS === 'string')
|
package/package.json
CHANGED