@chevre/domain 22.9.0-alpha.23 → 22.9.0-alpha.24
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/action.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +9 -0
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +48 -58
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/reserve/confirmReservation.d.ts +0 -5
- package/lib/chevre/service/reserve/confirmReservation.js +3 -10
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -1
- package/package.json +4 -4
|
@@ -773,7 +773,9 @@ class ActionRepo {
|
|
|
773
773
|
{ 'object.orderNumber': { $exists: true, $eq: params.orderNumber } },
|
|
774
774
|
{ 'purpose.orderNumber': { $exists: true, $eq: params.orderNumber } },
|
|
775
775
|
// consider inform returnAction(2025-01-22~)
|
|
776
|
-
{ 'about.orderNumber': { $exists: true, $eq: params.orderNumber } }
|
|
776
|
+
{ 'about.orderNumber': { $exists: true, $eq: params.orderNumber } },
|
|
777
|
+
// consider reserveAction,cancelReservationAction(2025-02-17~)
|
|
778
|
+
{ 'instrument.orderNumber': { $exists: true, $eq: params.orderNumber } }
|
|
777
779
|
]
|
|
778
780
|
};
|
|
779
781
|
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(AVAILABLE_PROJECT_FIELDS.map((key) => ([key, 1]))));
|
|
@@ -400,6 +400,15 @@ const indexes = [
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
],
|
|
403
|
+
[
|
|
404
|
+
{ 'instrument.orderNumber': 1, startDate: -1 },
|
|
405
|
+
{
|
|
406
|
+
name: 'instrumentOrderNumber',
|
|
407
|
+
partialFilterExpression: {
|
|
408
|
+
'instrument.orderNumber': { $exists: true }
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
],
|
|
403
412
|
[
|
|
404
413
|
{ 'object.transactionNumber': 1, startDate: -1 },
|
|
405
414
|
{
|
|
@@ -4,7 +4,7 @@ import * as factory from '../../../factory';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare function createStartParams(params: {
|
|
6
6
|
paramsWithoutDetail: factory.assetTransaction.cancelReservation.IStartParamsWithoutDetail & {
|
|
7
|
-
instrument: factory.
|
|
7
|
+
instrument: factory.action.cancel.reservation.IInstrument[];
|
|
8
8
|
};
|
|
9
9
|
project: factory.assetTransaction.IProject;
|
|
10
10
|
transactionNumber: string;
|
|
@@ -76,70 +76,60 @@ function createPotentialActions(params) {
|
|
|
76
76
|
reservationStatus: factory.reservationStatusType.ReservationConfirmed,
|
|
77
77
|
typeOf: factory.reservationType.ReservationPackage
|
|
78
78
|
};
|
|
79
|
-
cancelReservationActionAttributes = [{
|
|
80
|
-
project: transaction.project,
|
|
81
|
-
typeOf: factory.actionType.CancelAction,
|
|
82
|
-
object: cancelObject,
|
|
83
|
-
agent: transaction.project,
|
|
84
|
-
purpose: {
|
|
79
|
+
cancelReservationActionAttributes = [Object.assign({ project: transaction.project, typeOf: factory.actionType.CancelAction, object: cancelObject, agent: transaction.project, purpose: {
|
|
85
80
|
typeOf: transaction.typeOf,
|
|
86
81
|
id: transaction.id
|
|
87
|
-
}
|
|
88
|
-
|
|
82
|
+
} }, (Array.isArray(transaction.instrument)) ? { instrument: transaction.instrument } : undefined // add(2025-02-17~)
|
|
83
|
+
)];
|
|
89
84
|
}
|
|
90
85
|
else if (Array.isArray(transaction.object.reservations)) {
|
|
91
86
|
// 予約取消アクション属性作成
|
|
92
|
-
cancelReservationActionAttributes =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
else if (reservation.typeOf === factory.reservationType.EventReservation) {
|
|
113
|
-
cancelObject = {
|
|
114
|
-
typeOf: reservation.typeOf,
|
|
115
|
-
id: reservation.id,
|
|
116
|
-
issuedThrough: {
|
|
117
|
-
typeOf: (_b = reservation.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf
|
|
118
|
-
},
|
|
119
|
-
reservationFor: {
|
|
120
|
-
typeOf: reservation.reservationFor.typeOf,
|
|
121
|
-
id: String(reservation.reservationFor.id)
|
|
122
|
-
},
|
|
123
|
-
reservationNumber: reservation.reservationNumber,
|
|
124
|
-
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
125
|
-
reservationStatus: factory.reservationStatusType.ReservationConfirmed
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
throw new factory.errors.NotImplemented(`reservation.typeOf ${reservation.typeOf} not imeplemented`);
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
project: transaction.project,
|
|
133
|
-
typeOf: factory.actionType.CancelAction,
|
|
134
|
-
object: cancelObject,
|
|
135
|
-
agent: transaction.project,
|
|
136
|
-
potentialActions: {},
|
|
137
|
-
purpose: {
|
|
138
|
-
typeOf: transaction.typeOf,
|
|
139
|
-
id: transaction.id
|
|
87
|
+
cancelReservationActionAttributes =
|
|
88
|
+
transaction.object.reservations.map((reservation) => {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
// 最適化(2022-06-06~)
|
|
91
|
+
let cancelObject;
|
|
92
|
+
if (reservation.typeOf === factory.reservationType.BusReservation) {
|
|
93
|
+
cancelObject = {
|
|
94
|
+
typeOf: reservation.typeOf,
|
|
95
|
+
id: reservation.id,
|
|
96
|
+
issuedThrough: {
|
|
97
|
+
typeOf: (_a = reservation.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf
|
|
98
|
+
},
|
|
99
|
+
reservationFor: {
|
|
100
|
+
typeOf: reservation.reservationFor.typeOf,
|
|
101
|
+
id: String(reservation.reservationFor.id)
|
|
102
|
+
},
|
|
103
|
+
reservationNumber: reservation.reservationNumber,
|
|
104
|
+
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
105
|
+
reservationStatus: factory.reservationStatusType.ReservationConfirmed
|
|
106
|
+
};
|
|
140
107
|
}
|
|
141
|
-
|
|
142
|
-
|
|
108
|
+
else if (reservation.typeOf === factory.reservationType.EventReservation) {
|
|
109
|
+
cancelObject = {
|
|
110
|
+
typeOf: reservation.typeOf,
|
|
111
|
+
id: reservation.id,
|
|
112
|
+
issuedThrough: {
|
|
113
|
+
typeOf: (_b = reservation.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf
|
|
114
|
+
},
|
|
115
|
+
reservationFor: {
|
|
116
|
+
typeOf: reservation.reservationFor.typeOf,
|
|
117
|
+
id: String(reservation.reservationFor.id)
|
|
118
|
+
},
|
|
119
|
+
reservationNumber: reservation.reservationNumber,
|
|
120
|
+
// ReservationConfirmed->ReservationCancelledのみ処理されるように保証する
|
|
121
|
+
reservationStatus: factory.reservationStatusType.ReservationConfirmed
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
throw new factory.errors.NotImplemented(`reservation.typeOf ${reservation.typeOf} not imeplemented`);
|
|
126
|
+
}
|
|
127
|
+
return Object.assign({ project: transaction.project, typeOf: factory.actionType.CancelAction, object: cancelObject, agent: transaction.project, potentialActions: {}, purpose: {
|
|
128
|
+
typeOf: transaction.typeOf,
|
|
129
|
+
id: transaction.id
|
|
130
|
+
} }, (Array.isArray(transaction.instrument)) ? { instrument: transaction.instrument } : undefined // add(2025-02-17~)
|
|
131
|
+
);
|
|
132
|
+
});
|
|
143
133
|
}
|
|
144
134
|
return {
|
|
145
135
|
cancelReservation: cancelReservationActionAttributes
|
|
@@ -11,7 +11,7 @@ export type IStartParams = factory.assetTransaction.cancelReservation.IStartPara
|
|
|
11
11
|
seller: {
|
|
12
12
|
id?: string;
|
|
13
13
|
};
|
|
14
|
-
instrument: factory.
|
|
14
|
+
instrument: factory.action.cancel.reservation.IInstrument[];
|
|
15
15
|
};
|
|
16
16
|
export declare function validateStartParams(params: IStartParams): (repos: {
|
|
17
17
|
reservation: ReservationRepo;
|
|
@@ -18,8 +18,3 @@ export declare function confirmReservation(params: {
|
|
|
18
18
|
setting: SettingRepo;
|
|
19
19
|
task: TaskRepo;
|
|
20
20
|
}) => Promise<void>;
|
|
21
|
-
type IReserveActionAttributes = Pick<factory.action.reserve.IAttributes, 'agent' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'typeOf'>;
|
|
22
|
-
export declare function reserveTransaction2action(params: {
|
|
23
|
-
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
24
|
-
}): IReserveActionAttributes;
|
|
25
|
-
export {};
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.confirmReservation = confirmReservation;
|
|
13
|
-
exports.reserveTransaction2action = reserveTransaction2action;
|
|
14
13
|
const createDebug = require("debug");
|
|
15
14
|
const factory = require("../../factory");
|
|
16
15
|
const factory_1 = require("./factory");
|
|
@@ -91,16 +90,10 @@ function reserveTransaction2action(params) {
|
|
|
91
90
|
: factory.reservationStatusType.ReservationPending,
|
|
92
91
|
typeOf: factory.reservationType.ReservationPackage
|
|
93
92
|
};
|
|
94
|
-
return {
|
|
95
|
-
project: transaction.project,
|
|
96
|
-
typeOf: factory.actionType.ReserveAction,
|
|
97
|
-
object: reservationPackage,
|
|
98
|
-
agent: transaction.project,
|
|
99
|
-
potentialActions: {
|
|
93
|
+
return Object.assign({ project: transaction.project, typeOf: factory.actionType.ReserveAction, object: reservationPackage, agent: transaction.project, potentialActions: {
|
|
100
94
|
moneyTransfer: moneyTransferActions
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
};
|
|
95
|
+
}, purpose: { typeOf: transaction.typeOf, id: transaction.id } }, (Array.isArray(transaction.instrument)) ? { instrument: transaction.instrument } : undefined // add(2025-02-17~)
|
|
96
|
+
);
|
|
104
97
|
}
|
|
105
98
|
function reserveIfNotYet(
|
|
106
99
|
// params: factory.action.reserve.IAttributes,
|
|
@@ -110,6 +110,10 @@ function returnReserve(params) {
|
|
|
110
110
|
}
|
|
111
111
|
function processCancelReservation4chevre(params, returnAction) {
|
|
112
112
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const orderAsInstrument = {
|
|
114
|
+
orderNumber: returnAction.purpose.orderNumber,
|
|
115
|
+
typeOf: factory.order.OrderType.Order
|
|
116
|
+
};
|
|
113
117
|
// まず取引番号発行
|
|
114
118
|
const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
115
119
|
yield CancelReservationTransactionService.startAndConfirm({
|
|
@@ -130,7 +134,7 @@ function processCancelReservation4chevre(params, returnAction) {
|
|
|
130
134
|
.add(1, 'minutes')
|
|
131
135
|
.toDate(),
|
|
132
136
|
seller: {}, // 販売者条件必要なし
|
|
133
|
-
instrument: [returnAction] // add instrument(2025-02-17~)
|
|
137
|
+
instrument: [returnAction, orderAsInstrument] // add instrument(2025-02-17~)
|
|
134
138
|
})(repos);
|
|
135
139
|
});
|
|
136
140
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.393.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.393.0-alpha.20",
|
|
15
15
|
"@cinerino/sdk": "10.21.0-alpha.15",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -107,10 +107,10 @@
|
|
|
107
107
|
"test": "npm run check && npm run coverage",
|
|
108
108
|
"tslint": "tslint --project tsconfig.json -c tslint.json --exclude \"**/*.spec.ts\" \"src/**/*.ts\"",
|
|
109
109
|
"eslint": "eslint src/**/*.ts",
|
|
110
|
-
"preversion": "npm run clean && npm run build && npm run doc",
|
|
110
|
+
"preversion": "npm run clean && npm run build && npm test && npm run doc",
|
|
111
111
|
"version": "git add -A",
|
|
112
112
|
"postversion": "git push origin --tags",
|
|
113
|
-
"prepublishOnly": "npm run clean && npm run build && npm run doc"
|
|
113
|
+
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
114
114
|
},
|
|
115
|
-
"version": "22.9.0-alpha.
|
|
115
|
+
"version": "22.9.0-alpha.24"
|
|
116
116
|
}
|