@chevre/domain 21.36.0 → 21.37.0-alpha.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/investigateSellers.ts +53 -0
- package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +10 -15
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +2 -1
- package/lib/chevre/service/reserve/checkInReservation.js +29 -30
- package/lib/chevre/service/reserve/confirmReservation.d.ts +6 -1
- package/lib/chevre/service/reserve/confirmReservation.js +72 -22
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +27 -28
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const cursor = sellerRepo.getCursor(
|
|
14
|
+
{
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
// project: 1,
|
|
18
|
+
// typeOf: 1,
|
|
19
|
+
// startDate: 1,
|
|
20
|
+
// object: 1,
|
|
21
|
+
// result: 1
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
console.log('sellers found');
|
|
25
|
+
|
|
26
|
+
let i = 0;
|
|
27
|
+
let hasPolicyCount = 0;
|
|
28
|
+
await cursor.eachAsync(async (doc) => {
|
|
29
|
+
i += 1;
|
|
30
|
+
const seller: chevre.factory.seller.ISeller = doc.toObject();
|
|
31
|
+
|
|
32
|
+
const hasMerchantReturnPolicy = seller.hasMerchantReturnPolicy;
|
|
33
|
+
if (Array.isArray(hasMerchantReturnPolicy) && hasMerchantReturnPolicy.length > 0) {
|
|
34
|
+
hasPolicyCount += 1;
|
|
35
|
+
console.log(
|
|
36
|
+
hasMerchantReturnPolicy.length,
|
|
37
|
+
hasMerchantReturnPolicy.map(({ identifier }) => identifier)
|
|
38
|
+
.join(','),
|
|
39
|
+
seller.branchCode, seller.project.id, i);
|
|
40
|
+
} else {
|
|
41
|
+
// console.log(
|
|
42
|
+
// hasMerchantReturnPolicy.length,
|
|
43
|
+
// seller.branchCode, seller.project.id, i);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
console.log(i, 'sellers checked');
|
|
48
|
+
console.log(hasPolicyCount, 'sellers have policies');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
main()
|
|
52
|
+
.then()
|
|
53
|
+
.catch(console.error);
|
|
@@ -4,7 +4,7 @@ import * as mongoose from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
6
6
|
|
|
7
|
-
const DAYS =
|
|
7
|
+
const DAYS = 365;
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
@@ -13,15 +13,18 @@ async function main() {
|
|
|
13
13
|
|
|
14
14
|
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
15
15
|
|
|
16
|
+
const startIndex = 8760;
|
|
16
17
|
// tslint:disable-next-line:no-magic-numbers
|
|
17
|
-
const hours = DAYS * 24;
|
|
18
|
+
const hours = (DAYS * 24) + startIndex;
|
|
18
19
|
// tslint:disable-next-line:no-increment-decrement no-magic-numbers
|
|
19
|
-
for (let index =
|
|
20
|
+
for (let index = startIndex; index < hours; index++) {
|
|
21
|
+
// for (let index = 0; index < hours; index++) {
|
|
20
22
|
updateResult = await actionRepo.unsetUnnecessaryFields({
|
|
21
23
|
filter: {
|
|
22
24
|
// _id: { $eq: '667379e7be9a532411c29424' },
|
|
23
|
-
typeOf: { $eq: chevre.factory.actionType.
|
|
24
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.
|
|
25
|
+
typeOf: { $eq: chevre.factory.actionType.CheckAction },
|
|
26
|
+
'object.typeOf': { $exists: true, $eq: chevre.factory.service.paymentService.PaymentServiceType.MovieTicket },
|
|
27
|
+
actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
25
28
|
startDate: {
|
|
26
29
|
$gte: moment(now)
|
|
27
30
|
.add(-(index + 1), 'hours')
|
|
@@ -32,16 +35,8 @@ async function main() {
|
|
|
32
35
|
}
|
|
33
36
|
},
|
|
34
37
|
$unset: {
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'object.amount': 1,
|
|
38
|
-
'object.issuedThrough': 1,
|
|
39
|
-
'object.description': 1,
|
|
40
|
-
'object.name': 1,
|
|
41
|
-
'object.fromLocation': 1,
|
|
42
|
-
'object.method': 1,
|
|
43
|
-
'object.creditCard': 1,
|
|
44
|
-
'object.movieTickets': 1
|
|
38
|
+
'result.purchaseNumberAuthIn': 1,
|
|
39
|
+
'result.purchaseNumberAuthResult': 1
|
|
45
40
|
}
|
|
46
41
|
});
|
|
47
42
|
console.log('unset processed.', updateResult, -(index + 1), 'hours', -index, 'hours');
|
|
@@ -89,6 +89,12 @@ export declare function createPotentialActions(params: factory.assetTransaction.
|
|
|
89
89
|
reservationPackage?: factory.action.reserve.IObject;
|
|
90
90
|
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
91
91
|
};
|
|
92
|
+
export declare function createMoneyTransferActions(params: {
|
|
93
|
+
acceptedOffer?: factory.assetTransaction.reserve.IAcceptedOffer4object;
|
|
94
|
+
reservation: Pick<factory.assetTransaction.reserve.IObjectSubReservation, 'reservedTicket'>;
|
|
95
|
+
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
96
|
+
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
97
|
+
}): import("@chevre/factory/lib/action/transfer/moneyTransfer").IAttributes[];
|
|
92
98
|
export declare function createCancelPendingReservationAction(params: {
|
|
93
99
|
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
94
100
|
}): factory.action.cancel.reservation.IAttributes | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCancelPendingReservationAction = exports.createPotentialActions = exports.createReservation = exports.createIssuedThrough = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
3
|
+
exports.createCancelPendingReservationAction = exports.createMoneyTransferActions = exports.createPotentialActions = exports.createReservation = exports.createIssuedThrough = exports.createReservationFor = exports.createAdditionalTicketText = exports.createAdditionalProperty = exports.validateAppliesToMovieTicket = exports.createReservedTicket = exports.createPointAward = exports.createStartParams = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 予約取引ファクトリー
|
|
6
6
|
*/
|
|
@@ -625,6 +625,7 @@ function createMoneyTransferActions(params) {
|
|
|
625
625
|
}
|
|
626
626
|
return moneyTransfer;
|
|
627
627
|
}
|
|
628
|
+
exports.createMoneyTransferActions = createMoneyTransferActions;
|
|
628
629
|
function createCancelPendingReservationAction(params) {
|
|
629
630
|
const transaction = params.transaction;
|
|
630
631
|
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
@@ -71,8 +71,8 @@ function reserveIfNotYet(params) {
|
|
|
71
71
|
reservations: { id: { $in: params.object.ids } }
|
|
72
72
|
},
|
|
73
73
|
statuses: [factory.transactionStatusType.Confirmed]
|
|
74
|
-
}, ['
|
|
75
|
-
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. ids:', params.object.ids);
|
|
74
|
+
}, ['transactionNumber']);
|
|
75
|
+
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. ids:', params.object.ids, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
76
76
|
}
|
|
77
77
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
78
78
|
reserveTransactions = yield repos.assetTransaction.search({
|
|
@@ -81,36 +81,35 @@ function reserveIfNotYet(params) {
|
|
|
81
81
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
82
82
|
},
|
|
83
83
|
statuses: [factory.transactionStatusType.Confirmed]
|
|
84
|
-
}, ['
|
|
85
|
-
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. reservationNumbers:', params.object.reservationNumbers);
|
|
84
|
+
}, ['transactionNumber']);
|
|
85
|
+
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. reservationNumbers:', params.object.reservationNumbers, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
86
86
|
}
|
|
87
87
|
yield Promise.all(reserveTransactions.map((reserveTransaction) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
88
|
+
yield (0, confirmReservation_1.confirmReservation)({
|
|
89
|
+
// optimize(2024-07-01~)
|
|
90
|
+
actionAttributesList: [{ object: { reservationNumber: reserveTransaction.transactionNumber } }],
|
|
91
|
+
// actionAttributesList: [{
|
|
92
|
+
// project: reserveTransaction.project,
|
|
93
|
+
// typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
|
|
94
|
+
// object: {
|
|
95
|
+
// typeOf: reserveTransaction.object.typeOf,
|
|
96
|
+
// reservationNumber: reserveTransaction.object.reservationNumber,
|
|
97
|
+
// reservationStatus: (typeof reserveTransaction.object.reservationStatus === 'string')
|
|
98
|
+
// ? reserveTransaction.object.reservationStatus
|
|
99
|
+
// : factory.reservationStatusType.ReservationPending,
|
|
100
|
+
// reservationFor: {
|
|
101
|
+
// id: String(reserveTransaction.object.reservationFor.id),
|
|
102
|
+
// typeOf: reserveTransaction.object.reservationFor.typeOf,
|
|
103
|
+
// optimized: true
|
|
104
|
+
// } // optimize(2024-01-24~)
|
|
105
|
+
// },
|
|
106
|
+
// agent: reserveTransaction.project,
|
|
107
|
+
// purpose: { typeOf: reserveTransaction.typeOf, id: reserveTransaction.id }
|
|
108
|
+
// }],
|
|
109
|
+
useOnReservationConfirmed: false,
|
|
110
|
+
byTask: false
|
|
111
|
+
})(repos);
|
|
112
|
+
debug('confirmReservation processed in reserveIfNotYet. reservationNumber:', reserveTransaction.transactionNumber);
|
|
114
113
|
})));
|
|
115
114
|
});
|
|
116
115
|
}
|
|
@@ -7,7 +7,7 @@ import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
|
7
7
|
* 予約を確定する
|
|
8
8
|
*/
|
|
9
9
|
export declare function confirmReservation(params: {
|
|
10
|
-
actionAttributesList: factory.
|
|
10
|
+
actionAttributesList: factory.task.reserve.IPotentialReserveAction[];
|
|
11
11
|
useOnReservationConfirmed: boolean;
|
|
12
12
|
byTask: boolean;
|
|
13
13
|
}): (repos: {
|
|
@@ -16,3 +16,8 @@ export declare function confirmReservation(params: {
|
|
|
16
16
|
reservation: ReservationRepo;
|
|
17
17
|
task: TaskRepo;
|
|
18
18
|
}) => Promise<void>;
|
|
19
|
+
type IReserveActionAttributes = Pick<factory.action.reserve.IAttributes, 'agent' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'typeOf'>;
|
|
20
|
+
export declare function reserveTransaction2action(params: {
|
|
21
|
+
transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
|
|
22
|
+
}): IReserveActionAttributes;
|
|
23
|
+
export {};
|
|
@@ -9,9 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.confirmReservation = void 0;
|
|
12
|
+
exports.reserveTransaction2action = exports.confirmReservation = void 0;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
+
const factory_1 = require("../assetTransaction/reserve/factory");
|
|
15
16
|
const onReservationConfirmed_1 = require("./potentialActions/onReservationConfirmed");
|
|
16
17
|
const debug = createDebug('chevre-domain:service:reserve:confirmReservation');
|
|
17
18
|
/**
|
|
@@ -20,8 +21,8 @@ const debug = createDebug('chevre-domain:service:reserve:confirmReservation');
|
|
|
20
21
|
function confirmReservation(params) {
|
|
21
22
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
23
|
if (params.actionAttributesList.length > 0) {
|
|
23
|
-
yield Promise.all(params.actionAttributesList.map((
|
|
24
|
-
yield reserveIfNotYet(
|
|
24
|
+
yield Promise.all(params.actionAttributesList.map((potentialReserveAction) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const actionAttributes = yield reserveIfNotYet(potentialReserveAction, { byTask: params.byTask })(repos);
|
|
25
26
|
if (params.useOnReservationConfirmed) {
|
|
26
27
|
yield (0, onReservationConfirmed_1.onReservationConfirmedByAction)(actionAttributes)({ task: repos.task });
|
|
27
28
|
}
|
|
@@ -48,41 +49,90 @@ function confirmReservation(params) {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
exports.confirmReservation = confirmReservation;
|
|
51
|
-
function
|
|
52
|
+
function reserveTransaction2action(params) {
|
|
53
|
+
var _a;
|
|
54
|
+
const transaction = params.transaction;
|
|
55
|
+
const reservationFor = transaction.object.reservationFor;
|
|
56
|
+
if (reservationFor === undefined) {
|
|
57
|
+
throw new factory.errors.NotFound('transaction.object.reservationFor');
|
|
58
|
+
}
|
|
59
|
+
let underName;
|
|
60
|
+
if (typeof ((_a = transaction.object.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
61
|
+
underName = transaction.object.underName;
|
|
62
|
+
}
|
|
63
|
+
const moneyTransferActions = [];
|
|
64
|
+
const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
|
|
65
|
+
pendingReservations.forEach((reservation) => {
|
|
66
|
+
var _a;
|
|
67
|
+
const acceptedOffer4reservation = (_a = transaction.object.acceptedOffer) === null || _a === void 0 ? void 0 : _a.find((o) => { var _a, _b; return ((_b = (_a = o.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.id) === reservation.id; });
|
|
68
|
+
moneyTransferActions.push(...(0, factory_1.createMoneyTransferActions)({
|
|
69
|
+
acceptedOffer: acceptedOffer4reservation,
|
|
70
|
+
reservation,
|
|
71
|
+
transaction: params.transaction,
|
|
72
|
+
underName
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
const reservationPackage = {
|
|
76
|
+
reservationFor: {
|
|
77
|
+
id: String(reservationFor.id),
|
|
78
|
+
typeOf: reservationFor.typeOf,
|
|
79
|
+
optimized: true
|
|
80
|
+
},
|
|
81
|
+
reservationNumber: transaction.object.reservationNumber,
|
|
82
|
+
reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
|
|
83
|
+
? params.transaction.object.reservationStatus
|
|
84
|
+
: factory.reservationStatusType.ReservationPending,
|
|
85
|
+
typeOf: factory.reservationType.ReservationPackage
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
project: transaction.project,
|
|
89
|
+
typeOf: factory.actionType.ReserveAction,
|
|
90
|
+
object: reservationPackage,
|
|
91
|
+
agent: transaction.project,
|
|
92
|
+
potentialActions: {
|
|
93
|
+
moneyTransfer: moneyTransferActions
|
|
94
|
+
},
|
|
95
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
exports.reserveTransaction2action = reserveTransaction2action;
|
|
99
|
+
function reserveIfNotYet(
|
|
100
|
+
// params: factory.action.reserve.IAttributes,
|
|
101
|
+
params, options) {
|
|
52
102
|
// tslint:disable-next-line:max-func-body-length
|
|
53
103
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
54
104
|
var _a, _b;
|
|
55
105
|
const reservationPackage = params.object;
|
|
106
|
+
const reserveTransaction = (yield repos.assetTransaction.search({
|
|
107
|
+
limit: 1,
|
|
108
|
+
page: 1,
|
|
109
|
+
typeOf: factory.assetTransactionType.Reserve,
|
|
110
|
+
transactionNumber: { $eq: reservationPackage.reservationNumber }
|
|
111
|
+
})).shift();
|
|
112
|
+
if (reserveTransaction === undefined) {
|
|
113
|
+
throw new factory.errors.NotFound(factory.assetTransactionType.Reserve);
|
|
114
|
+
}
|
|
115
|
+
const actionAttributes = reserveTransaction2action({ transaction: reserveTransaction });
|
|
56
116
|
// 冪等性を担保(2023-05-31~)
|
|
57
117
|
debug('searching completed reserveAction... byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
58
118
|
const completedActions = yield repos.action.search({
|
|
59
119
|
limit: 1,
|
|
60
120
|
page: 1,
|
|
61
121
|
actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
62
|
-
typeOf: { $eq:
|
|
122
|
+
typeOf: { $eq: actionAttributes.typeOf },
|
|
63
123
|
object: {
|
|
64
|
-
typeOf: { $eq:
|
|
124
|
+
typeOf: { $eq: actionAttributes.object.typeOf }
|
|
65
125
|
// reservationNumber: { $eq: params.object.reservationNumber }
|
|
66
126
|
},
|
|
67
127
|
purpose: {
|
|
68
|
-
id: { $in: [
|
|
69
|
-
typeOf: { $in: [
|
|
128
|
+
id: { $in: [actionAttributes.purpose.id] },
|
|
129
|
+
typeOf: { $in: [actionAttributes.purpose.typeOf] }
|
|
70
130
|
}
|
|
71
131
|
}, ['_id'], []);
|
|
72
132
|
debug(completedActions.length, 'completed reserveAction found. byTask:', options === null || options === void 0 ? void 0 : options.byTask, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
73
133
|
if (completedActions.length === 0) {
|
|
74
|
-
const action = yield repos.action.start(
|
|
134
|
+
const action = yield repos.action.start(actionAttributes);
|
|
75
135
|
try {
|
|
76
|
-
const reserveTransactions = yield repos.assetTransaction.search({
|
|
77
|
-
limit: 1,
|
|
78
|
-
page: 1,
|
|
79
|
-
typeOf: factory.assetTransactionType.Reserve,
|
|
80
|
-
transactionNumber: { $eq: reservationPackage.reservationNumber }
|
|
81
|
-
});
|
|
82
|
-
const reserveTransaction = reserveTransactions.shift();
|
|
83
|
-
if (reserveTransaction === undefined) {
|
|
84
|
-
throw new factory.errors.NotFound(factory.assetTransactionType.Reserve);
|
|
85
|
-
}
|
|
86
136
|
let underName;
|
|
87
137
|
// 予約取引に保管されたunderNameを使用する(2023-05-30~)
|
|
88
138
|
if (typeof ((_a = reserveTransaction.object.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
@@ -92,7 +142,7 @@ function reserveIfNotYet(params, options) {
|
|
|
92
142
|
// underName = reservationPackage.underName;
|
|
93
143
|
}
|
|
94
144
|
// ReservationPackageに対応(2022-12-22~)
|
|
95
|
-
if (
|
|
145
|
+
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
96
146
|
// Pendingの予約が存在しないバージョンに対応する(2023-05-29~)
|
|
97
147
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
98
148
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
@@ -127,7 +177,7 @@ function reserveIfNotYet(params, options) {
|
|
|
127
177
|
}
|
|
128
178
|
else {
|
|
129
179
|
// 廃止(2023-01-18)
|
|
130
|
-
throw new factory.errors.Forbidden(`${
|
|
180
|
+
throw new factory.errors.Forbidden(`${actionAttributes.object.typeOf} not acceptable`);
|
|
131
181
|
}
|
|
132
182
|
}
|
|
133
183
|
catch (error) {
|
|
@@ -139,9 +189,9 @@ function reserveIfNotYet(params, options) {
|
|
|
139
189
|
}
|
|
140
190
|
throw error;
|
|
141
191
|
}
|
|
142
|
-
// アクション完了
|
|
143
192
|
const actionResult = {};
|
|
144
193
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
145
194
|
}
|
|
195
|
+
return actionAttributes;
|
|
146
196
|
});
|
|
147
197
|
}
|
|
@@ -7,7 +7,7 @@ type IEventReservation = factory.reservation.IReservation<factory.reservationTyp
|
|
|
7
7
|
/**
|
|
8
8
|
* 予約確定後のアクション
|
|
9
9
|
*/
|
|
10
|
-
export declare function onReservationConfirmedByAction(actionAttributes: factory.action.reserve.IAttributes): (repos: {
|
|
10
|
+
export declare function onReservationConfirmedByAction(actionAttributes: Pick<factory.action.reserve.IAttributes, 'potentialActions'>): (repos: {
|
|
11
11
|
task: TaskRepo;
|
|
12
12
|
}) => Promise<void>;
|
|
13
13
|
export declare function onReservationConfirmed(confirmedReservations: IEventReservation[]): (repos: {
|
|
@@ -86,36 +86,35 @@ function reserveIfNotYet(params) {
|
|
|
86
86
|
reservations: { id: { $in: [params.object.id] } }
|
|
87
87
|
},
|
|
88
88
|
statuses: [factory.transactionStatusType.Confirmed]
|
|
89
|
-
}, ['
|
|
90
|
-
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. id:', params.object.id);
|
|
89
|
+
}, ['transactionNumber']);
|
|
90
|
+
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. id:', params.object.id, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
91
91
|
}
|
|
92
92
|
yield Promise.all(reserveTransactions.map((reserveTransaction) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
93
|
+
yield (0, confirmReservation_1.confirmReservation)({
|
|
94
|
+
// optimize(2024-07-01~)
|
|
95
|
+
actionAttributesList: [{ object: { reservationNumber: reserveTransaction.transactionNumber } }],
|
|
96
|
+
// actionAttributesList: [{
|
|
97
|
+
// project: reserveTransaction.project,
|
|
98
|
+
// typeOf: <factory.actionType.ReserveAction>factory.actionType.ReserveAction,
|
|
99
|
+
// object: {
|
|
100
|
+
// typeOf: reserveTransaction.object.typeOf,
|
|
101
|
+
// reservationNumber: reserveTransaction.object.reservationNumber,
|
|
102
|
+
// reservationStatus: (typeof reserveTransaction.object.reservationStatus === 'string')
|
|
103
|
+
// ? reserveTransaction.object.reservationStatus
|
|
104
|
+
// : factory.reservationStatusType.ReservationPending,
|
|
105
|
+
// reservationFor: {
|
|
106
|
+
// id: String(reserveTransaction.object.reservationFor.id),
|
|
107
|
+
// typeOf: reserveTransaction.object.reservationFor.typeOf,
|
|
108
|
+
// optimized: true
|
|
109
|
+
// } // optimize(2024-01-24~)
|
|
110
|
+
// },
|
|
111
|
+
// agent: reserveTransaction.project,
|
|
112
|
+
// purpose: { typeOf: reserveTransaction.typeOf, id: reserveTransaction.id }
|
|
113
|
+
// }],
|
|
114
|
+
useOnReservationConfirmed: false,
|
|
115
|
+
byTask: false
|
|
116
|
+
})(repos);
|
|
117
|
+
debug('confirmReservation processed in reserveIfNotYet. reservationNumber:', reserveTransaction.transactionNumber);
|
|
119
118
|
})));
|
|
120
119
|
});
|
|
121
120
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
13
|
+
"@chevre/factory": "4.377.0-alpha.0",
|
|
14
14
|
"@cinerino/sdk": "8.0.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
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.
|
|
113
|
+
"version": "21.37.0-alpha.0"
|
|
114
114
|
}
|