@chevre/domain 26.0.0-alpha.24 → 26.0.0-alpha.26
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/acceptedOffer.d.ts +0 -7
- package/lib/chevre/repo/acceptedOffer.js +27 -27
- package/lib/chevre/repo/adminAssetTransaction.d.ts +132 -0
- package/lib/chevre/repo/adminAssetTransaction.js +504 -0
- package/lib/chevre/repo/aggregateAssetTransaction.d.ts +43 -0
- package/lib/chevre/repo/aggregateAssetTransaction.js +166 -0
- package/lib/chevre/repo/assetTransaction.d.ts +10 -235
- package/lib/chevre/repo/assetTransaction.js +48 -636
- package/lib/chevre/repo/ownershipInfo.d.ts +1 -35
- package/lib/chevre/repo/ownershipInfo.js +55 -161
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +24 -2
- package/lib/chevre/service/aggregation/system.d.ts +5 -5
- package/lib/chevre/service/aggregation/system.js +2 -2
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +10 -17
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -3
- package/lib/chevre/service/order/deleteOrder.js +0 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +1 -49
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +2 -2
- package/lib/chevre/service/order/returnOrder.d.ts +0 -2
- package/lib/chevre/service/order/returnOrder.js +8 -40
- package/lib/chevre/service/order/sendOrder.d.ts +0 -2
- package/lib/chevre/service/order/sendOrder.js +41 -55
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +3 -3
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/useReservation.js +1 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +2 -2
- package/lib/chevre/service/task/returnOrder.js +2 -5
- package/lib/chevre/service/task/returnPayTransaction.js +2 -2
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/deleteTransaction/deleteReservationsByPlaceOrder.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/validation/validateOrder.js +2 -2
- package/package.json +2 -2
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.returnOrder = returnOrder;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
// import { createMaskedCustomer } from '../../factory/order';
|
|
9
8
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
10
9
|
const factory_1 = require("../../factory");
|
|
11
10
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
@@ -19,9 +18,7 @@ function createReturnPolicy(params) {
|
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
20
|
function returnOrder(params) {
|
|
22
|
-
return async (repos
|
|
23
|
-
// settings: Settings
|
|
24
|
-
) => {
|
|
21
|
+
return async (repos) => {
|
|
25
22
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
26
23
|
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
27
24
|
}
|
|
@@ -81,14 +78,15 @@ function returnOrder(params) {
|
|
|
81
78
|
recipient,
|
|
82
79
|
typeOf: factory_1.factory.actionType.ReturnAction
|
|
83
80
|
};
|
|
84
|
-
|
|
81
|
+
const returnedOwnershipInfos = [];
|
|
85
82
|
let returnedOrder;
|
|
86
83
|
const action = await repos.action.start(returnOrderActionAttributes);
|
|
87
84
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
// ひとまず所有権管理を廃止するため、所有権返却処理は不要(2026-08-10)
|
|
86
|
+
// returnedOwnershipInfos = await processReturnOrder(order, dateReturned)({
|
|
87
|
+
// acceptedOffer: repos.acceptedOffer,
|
|
88
|
+
// ownershipInfo: repos.ownershipInfo
|
|
89
|
+
// });
|
|
92
90
|
// 注文ステータス変更
|
|
93
91
|
returnedOrder = await repos.order.returnOrder({
|
|
94
92
|
project: { id: order.project.id },
|
|
@@ -130,37 +128,7 @@ function returnOrder(params) {
|
|
|
130
128
|
...returnOrderActionAttributes,
|
|
131
129
|
id: action.id
|
|
132
130
|
}
|
|
133
|
-
})(repos
|
|
134
|
-
// settings
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function processReturnOrder(order, dateReturned) {
|
|
140
|
-
return async (repos) => {
|
|
141
|
-
const returnedOwnershipInfos = [];
|
|
142
|
-
// 所有権の所有期間変更
|
|
143
|
-
// 注文オファーリポジトリから所有権識別子を検索する(2023-12-07~)
|
|
144
|
-
const ownershipInfos = await repos.acceptedOffer.aggreateOwnershipInfosByOrder({ orderNumber: { $eq: order.orderNumber } });
|
|
145
|
-
if (Array.isArray(ownershipInfos)) {
|
|
146
|
-
await Promise.all(ownershipInfos.map(async (ownershipInfo) => {
|
|
147
|
-
const ownershipInfoReturned = await repos.ownershipInfo.findByIdentifierAndUpdateOwnedThrough({
|
|
148
|
-
project: { id: order.project.id },
|
|
149
|
-
identifier: String(ownershipInfo.identifier),
|
|
150
|
-
ownedThrough: dateReturned
|
|
151
|
-
})
|
|
152
|
-
.then((ownershipInfoByDB) => {
|
|
153
|
-
// 存在しない場合は識別子のみ保管(customer.typeOfによって存在しないこともありうる)
|
|
154
|
-
if (ownershipInfoByDB === undefined) {
|
|
155
|
-
return ownershipInfo;
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
return ownershipInfoByDB;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
returnedOwnershipInfos.push(ownershipInfoReturned);
|
|
162
|
-
}));
|
|
131
|
+
})(repos);
|
|
163
132
|
}
|
|
164
|
-
return returnedOwnershipInfos;
|
|
165
133
|
};
|
|
166
134
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
2
2
|
import type { ActionRepo } from '../../repo/action';
|
|
3
3
|
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
5
4
|
import type { SettingRepo } from '../../repo/setting';
|
|
6
5
|
import type { TaskRepo } from '../../repo/task';
|
|
7
6
|
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
@@ -10,7 +9,6 @@ interface ISendOrderRepos {
|
|
|
10
9
|
acceptedOffer: AcceptedOfferRepo;
|
|
11
10
|
action: ActionRepo;
|
|
12
11
|
order: OrderRepo;
|
|
13
|
-
ownershipInfo: OwnershipInfoRepo;
|
|
14
12
|
setting: SettingRepo;
|
|
15
13
|
task: TaskRepo;
|
|
16
14
|
placeOrder: PlaceOrderRepo;
|
|
@@ -5,33 +5,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.sendOrder = sendOrder;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
// import {
|
|
9
|
-
const factory_1 = require("../delivery/factory");
|
|
10
|
-
// import { findPlaceOrderTransaction } from './findPlaceOrderTransaction';
|
|
8
|
+
// import { createOwnershipInfosFromOrder } from '../delivery/factory';
|
|
11
9
|
const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
|
|
12
|
-
const
|
|
10
|
+
const factory_1 = require("../../factory");
|
|
13
11
|
const debug = (0, debug_1.default)('chevre-domain:service:order');
|
|
14
12
|
/**
|
|
15
13
|
* 注文を配送する
|
|
16
14
|
*/
|
|
17
15
|
function sendOrder(params) {
|
|
18
|
-
return async (repos
|
|
19
|
-
// settings: Settings
|
|
20
|
-
) => {
|
|
16
|
+
return async (repos) => {
|
|
21
17
|
if (typeof params.useOnOrderStatusChanged !== 'boolean') {
|
|
22
|
-
throw new
|
|
18
|
+
throw new factory_1.factory.errors.Argument('useOnOrderStatusChanged', 'must be boolean');
|
|
23
19
|
}
|
|
24
20
|
if (typeof params.object.acceptedOffers?.limit !== 'number') {
|
|
25
|
-
throw new
|
|
21
|
+
throw new factory_1.factory.errors.Argument('object.acceptedOffers.limit', 'must be number');
|
|
26
22
|
}
|
|
27
23
|
if (typeof params.object.acceptedOffers?.page !== 'number') {
|
|
28
|
-
throw new
|
|
24
|
+
throw new factory_1.factory.errors.Argument('object.acceptedOffers.page', 'must be number');
|
|
29
25
|
}
|
|
30
26
|
if (params.object.acceptedOffers.limit <= 0) {
|
|
31
|
-
throw new
|
|
27
|
+
throw new factory_1.factory.errors.Argument('object.acceptedOffers.limit', 'must be greater than 1');
|
|
32
28
|
}
|
|
33
29
|
if (params.object.acceptedOffers.page <= 0) {
|
|
34
|
-
throw new
|
|
30
|
+
throw new factory_1.factory.errors.Argument('object.acceptedOffers.page', 'must be greater than 1');
|
|
35
31
|
}
|
|
36
32
|
try {
|
|
37
33
|
const orderNumber = params.object.orderNumber;
|
|
@@ -49,24 +45,16 @@ function sendOrder(params) {
|
|
|
49
45
|
});
|
|
50
46
|
// プロジェクト条件検証
|
|
51
47
|
if (order.project.id !== params.project.id) {
|
|
52
|
-
throw new
|
|
48
|
+
throw new factory_1.factory.errors.NotFound('Order');
|
|
53
49
|
}
|
|
54
50
|
// 確認番号検証
|
|
55
51
|
if (order.confirmationNumber !== confirmationNumber) {
|
|
56
|
-
throw new
|
|
52
|
+
throw new factory_1.factory.errors.NotFound('Order');
|
|
57
53
|
}
|
|
58
54
|
// const maskedCustomer = createMaskedCustomer(order, { noProfile: true });
|
|
59
55
|
const simpleOrder = {
|
|
60
56
|
typeOf: order.typeOf,
|
|
61
|
-
// seller: {
|
|
62
|
-
// id: order.seller.id,
|
|
63
|
-
// typeOf: order.seller.typeOf,
|
|
64
|
-
// name: order.seller.name
|
|
65
|
-
// }, // 廃止(2024-03-06~)
|
|
66
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
|
|
67
57
|
orderNumber: order.orderNumber,
|
|
68
|
-
// price: order.price,
|
|
69
|
-
// priceCurrency: order.priceCurrency,
|
|
70
58
|
orderDate: order.orderDate
|
|
71
59
|
};
|
|
72
60
|
const { limit, page } = params.object.acceptedOffers;
|
|
@@ -77,24 +65,24 @@ function sendOrder(params) {
|
|
|
77
65
|
const sendOrderActionAttributes = {
|
|
78
66
|
agent: (typeof params.agent?.typeOf === 'string') ? params.agent : order.project,
|
|
79
67
|
object: sendOrderObject,
|
|
80
|
-
// potentialActions: {},
|
|
81
68
|
project: order.project,
|
|
82
69
|
recipient: { id: order.customer.id, typeOf: order.customer.typeOf },
|
|
83
|
-
typeOf:
|
|
70
|
+
typeOf: factory_1.factory.actionType.SendAction
|
|
84
71
|
};
|
|
85
72
|
const action = await repos.action.start(sendOrderActionAttributes);
|
|
86
|
-
let creatingOwnershipInfos = [];
|
|
87
|
-
|
|
73
|
+
// let creatingOwnershipInfos: IOwnershipInfo[] = [];
|
|
74
|
+
const createdOwnershipInfos = [];
|
|
88
75
|
let allOffersDelivered = false;
|
|
89
76
|
let acceptedOffers;
|
|
90
|
-
//
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
77
|
+
// 所有権管理はひとまず廃止(2026-08-10~)
|
|
78
|
+
// // 所有権生成を最小化(2024-03-01~)
|
|
79
|
+
// let createOwnerships = false;
|
|
80
|
+
// switch (order.customer.typeOf) {
|
|
81
|
+
// case factory.personType.Person:
|
|
82
|
+
// createOwnerships = true; // Personのみに限定(2026-03-15~)
|
|
83
|
+
// break;
|
|
84
|
+
// default:
|
|
85
|
+
// }
|
|
98
86
|
try {
|
|
99
87
|
const offerIndexBase = (limit * (page - 1));
|
|
100
88
|
const searchSlicedAcceptedOffersResult = await repos.acceptedOffer.searchSlicedAcceptedOffersByOrderNumber({
|
|
@@ -104,29 +92,27 @@ function sendOrder(params) {
|
|
|
104
92
|
});
|
|
105
93
|
acceptedOffers = searchSlicedAcceptedOffersResult.acceptedOffers;
|
|
106
94
|
debug('delivering...', order.orderNumber, params.object.acceptedOffers, 'offerIndexBase:', offerIndexBase);
|
|
107
|
-
//
|
|
108
|
-
if (createOwnerships) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
// const deliveredCount = limit * page;
|
|
124
|
-
// debug(deliveredCount, 'delivered.', order.orderNumber, params.object.acceptedOffers);
|
|
95
|
+
// 所有権管理はひとまず廃止(2026-08-10~)
|
|
96
|
+
// if (createOwnerships) {
|
|
97
|
+
// creatingOwnershipInfos = createOwnershipInfosFromOrder({
|
|
98
|
+
// order: { ...order, acceptedOffers },
|
|
99
|
+
// offerIndexBase
|
|
100
|
+
// });
|
|
101
|
+
// createdOwnershipInfos = await Promise.all(creatingOwnershipInfos.map(async (creatingOwnershipInfo) => {
|
|
102
|
+
// const { id } = await repos.ownershipInfo.createIfNotExistByIdentifier(creatingOwnershipInfo);
|
|
103
|
+
// return {
|
|
104
|
+
// id,
|
|
105
|
+
// ...(typeof creatingOwnershipInfo.identifier === 'string')
|
|
106
|
+
// ? { identifier: creatingOwnershipInfo.identifier }
|
|
107
|
+
// : undefined
|
|
108
|
+
// };
|
|
109
|
+
// }));
|
|
110
|
+
// }
|
|
125
111
|
if (acceptedOffers.length === 0) {
|
|
126
112
|
order = await repos.order.changeStatus({
|
|
127
113
|
project: { id: order.project.id },
|
|
128
114
|
orderNumber,
|
|
129
|
-
orderStatus:
|
|
115
|
+
orderStatus: factory_1.factory.orderStatus.OrderDelivered,
|
|
130
116
|
previousOrderStatus: params.object.previousOrderStatus
|
|
131
117
|
});
|
|
132
118
|
allOffersDelivered = true;
|
|
@@ -154,7 +140,7 @@ function sendOrder(params) {
|
|
|
154
140
|
orderNumber: order.orderNumber,
|
|
155
141
|
project: order.project,
|
|
156
142
|
typeOf: order.typeOf,
|
|
157
|
-
orderStatus:
|
|
143
|
+
orderStatus: factory_1.factory.orderStatus.OrderDelivered,
|
|
158
144
|
price: order.price,
|
|
159
145
|
priceCurrency: order.priceCurrency
|
|
160
146
|
}
|
|
@@ -180,7 +166,7 @@ function sendOrder(params) {
|
|
|
180
166
|
project: { id: params.project.id },
|
|
181
167
|
inclusion: ['orderStatus']
|
|
182
168
|
});
|
|
183
|
-
if (currentOrder?.orderStatus ===
|
|
169
|
+
if (currentOrder?.orderStatus === factory_1.factory.orderStatus.OrderReturned) {
|
|
184
170
|
throwsError = false;
|
|
185
171
|
}
|
|
186
172
|
if (throwsError) {
|
|
@@ -109,7 +109,7 @@ function processVoidPayTransaction(params) {
|
|
|
109
109
|
// 取引が存在すれば中止
|
|
110
110
|
const transactionNumber = action.object.paymentMethodId;
|
|
111
111
|
if (typeof transactionNumber === 'string' && transactionNumber.length > 0) {
|
|
112
|
-
const payTransaction = (await repos.assetTransaction.
|
|
112
|
+
const payTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
113
113
|
limit: 1,
|
|
114
114
|
page: 1,
|
|
115
115
|
project: { id: { $eq: action.project.id } },
|
|
@@ -39,7 +39,7 @@ function cancelPengindIfNotYet(params) {
|
|
|
39
39
|
return async (repos) => {
|
|
40
40
|
const reserveTransactionId = params.purpose.id;
|
|
41
41
|
// 予約取引を検索
|
|
42
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
42
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
43
43
|
limit: 1,
|
|
44
44
|
page: 1,
|
|
45
45
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -169,7 +169,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
169
169
|
try {
|
|
170
170
|
if (actionAttributes.object.typeOf === factory_1.factory.reservationType.ReservationPackage) {
|
|
171
171
|
// 予約取引を検索
|
|
172
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
172
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
173
173
|
limit: 1,
|
|
174
174
|
page: 1,
|
|
175
175
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -226,7 +226,7 @@ function cancelReservation(actionAttributesList) {
|
|
|
226
226
|
inclusion: ['reservationNumber', 'reservationStatus', 'project', 'reservedTicket', 'subReservation', 'reservationFor']
|
|
227
227
|
});
|
|
228
228
|
// 予約取引を検索
|
|
229
|
-
const reserveTransactions = await repos.assetTransaction.
|
|
229
|
+
const reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
230
230
|
limit: 1,
|
|
231
231
|
page: 1,
|
|
232
232
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -90,7 +90,7 @@ function reserveIfNotYet(params) {
|
|
|
90
90
|
) => {
|
|
91
91
|
let reserveTransactions = [];
|
|
92
92
|
if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
|
|
93
|
-
reserveTransactions = await repos.assetTransaction.
|
|
93
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
94
94
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
95
95
|
object: {
|
|
96
96
|
reservations: { id: { $in: params.object.ids } }
|
|
@@ -100,7 +100,7 @@ function reserveIfNotYet(params) {
|
|
|
100
100
|
debug(reserveTransactions.length, 'reserveTransactions found in reserveIfNotYet. ids:', params.object.ids, 'reserveTransactions:', JSON.stringify(reserveTransactions));
|
|
101
101
|
}
|
|
102
102
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
103
|
-
reserveTransactions = await repos.assetTransaction.
|
|
103
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
104
104
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
105
105
|
object: {
|
|
106
106
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
@@ -140,7 +140,7 @@ function reserveIfNotYet(
|
|
|
140
140
|
params, options) {
|
|
141
141
|
return async (repos) => {
|
|
142
142
|
const reservationPackage = params.object;
|
|
143
|
-
const reserveTransaction = (await repos.assetTransaction.
|
|
143
|
+
const reserveTransaction = (await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
144
144
|
limit: 1,
|
|
145
145
|
page: 1,
|
|
146
146
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
@@ -112,7 +112,7 @@ function reserveIfNotYet(params) {
|
|
|
112
112
|
) => {
|
|
113
113
|
let reserveTransactions = [];
|
|
114
114
|
if (typeof params.object.id === 'string' && params.object.id.length > 0) {
|
|
115
|
-
reserveTransactions = await repos.assetTransaction.
|
|
115
|
+
reserveTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
116
116
|
typeOf: factory_1.factory.assetTransactionType.Reserve,
|
|
117
117
|
object: {
|
|
118
118
|
reservations: { id: { $in: [params.object.id] } }
|
|
@@ -7,7 +7,7 @@ const action_1 = require("../../repo/action");
|
|
|
7
7
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
8
8
|
const authorization_1 = require("../../repo/authorization");
|
|
9
9
|
const order_1 = require("../../repo/order");
|
|
10
|
-
|
|
10
|
+
// import { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
11
11
|
const reservation_1 = require("../../repo/reservation");
|
|
12
12
|
const setting_1 = require("../../repo/setting");
|
|
13
13
|
const task_1 = require("../../repo/task");
|
|
@@ -23,7 +23,7 @@ function call(params) {
|
|
|
23
23
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
24
24
|
code: new authorization_1.AuthorizationRepo(connection),
|
|
25
25
|
order: new order_1.OrderRepo(connection),
|
|
26
|
-
ownershipInfo: new
|
|
26
|
+
// ownershipInfo: new OwnershipInfoRepo(connection),
|
|
27
27
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
28
28
|
setting: new setting_1.SettingRepo(connection),
|
|
29
29
|
task: new task_1.TaskRepo(connection)
|
|
@@ -4,7 +4,6 @@ exports.call = call;
|
|
|
4
4
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
5
5
|
const action_1 = require("../../repo/action");
|
|
6
6
|
const order_1 = require("../../repo/order");
|
|
7
|
-
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
8
7
|
const setting_1 = require("../../repo/setting");
|
|
9
8
|
const task_1 = require("../../repo/task");
|
|
10
9
|
const returnOrder_1 = require("../../repo/transaction/returnOrder");
|
|
@@ -22,12 +21,10 @@ function call(params) {
|
|
|
22
21
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
23
22
|
action: new action_1.ActionRepo(connection),
|
|
24
23
|
order: new order_1.OrderRepo(connection),
|
|
25
|
-
ownershipInfo: new
|
|
24
|
+
// ownershipInfo: new OwnershipInfoRepo(connection),
|
|
26
25
|
setting: new setting_1.SettingRepo(connection),
|
|
27
26
|
task: new task_1.TaskRepo(connection),
|
|
28
27
|
returnOrder: new returnOrder_1.ReturnOrderRepo(connection)
|
|
29
|
-
}
|
|
30
|
-
// settings
|
|
31
|
-
);
|
|
28
|
+
});
|
|
32
29
|
};
|
|
33
30
|
}
|
|
@@ -213,14 +213,14 @@ function createRefundPurpose(params, order) {
|
|
|
213
213
|
}
|
|
214
214
|
function refundTransactionAlreadyExists(params) {
|
|
215
215
|
return async (repos) => {
|
|
216
|
-
const refundTransactions = await repos.assetTransaction.
|
|
216
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
217
217
|
limit: 1,
|
|
218
218
|
page: 1,
|
|
219
219
|
project: { id: { $eq: params.project.id } },
|
|
220
220
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
221
221
|
statuses: [factory_1.factory.transactionStatusType.Confirmed],
|
|
222
222
|
object: { paymentMethodId: { $eq: params.object.paymentMethodId } }
|
|
223
|
-
}, ['_id']
|
|
223
|
+
}, ['_id']);
|
|
224
224
|
return refundTransactions.length > 0;
|
|
225
225
|
};
|
|
226
226
|
}
|
|
@@ -5,7 +5,7 @@ const factory_1 = require("../../factory");
|
|
|
5
5
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
6
6
|
const action_1 = require("../../repo/action");
|
|
7
7
|
const order_1 = require("../../repo/order");
|
|
8
|
-
|
|
8
|
+
// import { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
9
9
|
const setting_1 = require("../../repo/setting");
|
|
10
10
|
const task_1 = require("../../repo/task");
|
|
11
11
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
@@ -32,7 +32,7 @@ function call(params) {
|
|
|
32
32
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
33
33
|
action: new action_1.ActionRepo(connection),
|
|
34
34
|
order: new order_1.OrderRepo(connection),
|
|
35
|
-
ownershipInfo: new
|
|
35
|
+
// ownershipInfo: new OwnershipInfoRepo(connection),
|
|
36
36
|
setting: new setting_1.SettingRepo(connection),
|
|
37
37
|
task: new task_1.TaskRepo(connection),
|
|
38
38
|
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
package/lib/chevre/service/transaction/deleteTransaction/deletePayTransactionsByPlaceOrder.js
CHANGED
|
@@ -29,10 +29,10 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
29
29
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
30
30
|
};
|
|
31
31
|
// 返金取引も削除(2023-05-19~)
|
|
32
|
-
const refundTransactions = await repos.assetTransaction.
|
|
32
|
+
const refundTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
33
33
|
typeOf: factory_1.factory.assetTransactionType.Refund,
|
|
34
34
|
object: { paymentMethodId: { $in: payTransactionNumbers } }
|
|
35
|
-
}, ['transactionNumber']
|
|
35
|
+
}, ['transactionNumber']);
|
|
36
36
|
if (refundTransactions.length > 0) {
|
|
37
37
|
const deleteRefundAssetTransactionsResult = await repos.assetTransaction.deleteByTransactionNumber({
|
|
38
38
|
project: { id: params.transaction.project.id },
|
|
@@ -40,11 +40,11 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
40
40
|
deletedCount: deleteAssetTransactionsResult?.deletedCount
|
|
41
41
|
};
|
|
42
42
|
// 予約番号で予約取消取引を検索
|
|
43
|
-
const deletingCancelReservationTransactions = await repos.assetTransaction.
|
|
43
|
+
const deletingCancelReservationTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
44
44
|
project: { id: { $eq: params.transaction.project.id } },
|
|
45
45
|
object: { reservationNumber: { $in: reserveTransactionNumbers } },
|
|
46
46
|
typeOf: factory_1.factory.assetTransactionType.CancelReservation
|
|
47
|
-
}, ['transactionNumber']
|
|
47
|
+
}, ['transactionNumber']);
|
|
48
48
|
if (deletingCancelReservationTransactions.length > 0) {
|
|
49
49
|
// 予約取消取引も削除(2024-04-18~)
|
|
50
50
|
const deleteCancelReservationResult = await repos.assetTransaction.deleteByTransactionNumber({
|
|
@@ -128,7 +128,7 @@ function confirm(params, options) {
|
|
|
128
128
|
const payTransactionNumbers = authorizePaymentActions.map((authorizeAction) => authorizeAction.object.paymentMethodId);
|
|
129
129
|
// const payTransactionNumbers = authorizePaymentActions.map(({ instrument }) => instrument.transactionNumber);
|
|
130
130
|
if (payTransactionNumbers.length > 0) {
|
|
131
|
-
payTransactions = await repos.assetTransaction.
|
|
131
|
+
payTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
132
132
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
133
133
|
transactionNumber: { $in: payTransactionNumbers }
|
|
134
134
|
}, ['object']);
|
|
@@ -25,11 +25,11 @@ function validateOrder(params) {
|
|
|
25
25
|
});
|
|
26
26
|
let payTransactions = [];
|
|
27
27
|
if (order.paymentMethods.length > 0) {
|
|
28
|
-
payTransactions = await repos.assetTransaction.
|
|
28
|
+
payTransactions = await repos.assetTransaction.findAssetTransactionsByTypeOf({
|
|
29
29
|
project: { id: { $eq: order.project.id } },
|
|
30
30
|
typeOf: factory_1.factory.assetTransactionType.Pay,
|
|
31
31
|
transactionNumber: { $in: order.paymentMethods.map(({ paymentMethodId }) => paymentMethodId) }
|
|
32
|
-
}, []
|
|
32
|
+
}, []);
|
|
33
33
|
}
|
|
34
34
|
// 型検証
|
|
35
35
|
if (typeof order.confirmationNumber !== 'string' || order.confirmationNumber.length === 0) {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.3.0-alpha.
|
|
14
|
+
"@chevre/factory": "10.3.0-alpha.3",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "26.0.0-alpha.
|
|
91
|
+
"version": "26.0.0-alpha.26"
|
|
92
92
|
}
|