@chevre/domain 21.20.0-alpha.2 → 21.20.0-alpha.20
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/onAssetTransactionStatusChanged.ts +36 -0
- package/example/src/chevre/retryTasks.ts +39 -0
- package/example/src/chevre/searchOrders.ts +13 -15
- package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +28 -0
- package/example/src/chevre/sendOrder.ts +37 -0
- package/example/src/chevre/transaction/processAcceptOffer.ts +48 -0
- package/example/src/chevre/transaction/processPlaceOrder.ts +82 -53
- package/lib/chevre/repo/acceptedOffer.d.ts +21 -1
- package/lib/chevre/repo/acceptedOffer.js +32 -2
- package/lib/chevre/repo/action.d.ts +3 -3
- package/lib/chevre/repo/action.js +4 -6
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/order.js +20 -11
- package/lib/chevre/repo/order.js +28 -9
- package/lib/chevre/repo/orderInTransaction.d.ts +27 -0
- package/lib/chevre/repo/orderInTransaction.js +77 -0
- package/lib/chevre/repo/task.d.ts +0 -2
- package/lib/chevre/repo/task.js +56 -46
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +15 -2
- package/lib/chevre/service/assetTransaction/pay.d.ts +0 -10
- package/lib/chevre/service/assetTransaction/pay.js +4 -4
- package/lib/chevre/service/code.js +1 -1
- package/lib/chevre/service/delivery.js +2 -2
- package/lib/chevre/service/event/createEvent.js +1 -1
- package/lib/chevre/service/event.js +2 -2
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/notification.js +2 -5
- package/lib/chevre/service/offer/any.d.ts +29 -0
- package/lib/chevre/service/offer/any.js +55 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
- package/lib/chevre/service/offer/event/authorize.js +11 -0
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
- package/lib/chevre/service/offer/event/cancel.js +12 -1
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +12 -5
- package/lib/chevre/service/offer/eventServiceByCOA.js +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +6 -1
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +2 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +1 -1
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.js +3 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +11 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +113 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +18 -19
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +38 -25
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +11 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +45 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +86 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +18 -12
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +3 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -1
- package/lib/chevre/service/order/placeOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.js +28 -29
- package/lib/chevre/service/order/returnOrder.js +25 -16
- package/lib/chevre/service/order/sendOrder.d.ts +5 -0
- package/lib/chevre/service/order/sendOrder.js +68 -30
- package/lib/chevre/service/payment/any.d.ts +6 -8
- package/lib/chevre/service/payment/any.js +46 -10
- package/lib/chevre/service/payment/creditCard.d.ts +9 -8
- package/lib/chevre/service/payment/creditCard.js +102 -133
- package/lib/chevre/service/payment/faceToFace.d.ts +0 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -0
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +0 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +0 -6
- package/lib/chevre/service/payment/movieTicket.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +0 -2
- package/lib/chevre/service/payment/paymentCard.js +6 -6
- package/lib/chevre/service/payment.js +1 -1
- package/lib/chevre/service/product.js +1 -1
- package/lib/chevre/service/reserve/cancelReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -2
- package/lib/chevre/service/reserve/useReservation.js +4 -4
- package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +42 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
- package/lib/chevre/service/task/placeOrder.js +9 -10
- package/lib/chevre/service/task/returnOrder.js +0 -3
- package/lib/chevre/service/task/returnPayTransaction.js +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +1 -1
- package/lib/chevre/service/task/sendOrder.js +8 -4
- package/lib/chevre/service/task/voidPayTransaction.js +2 -2
- package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +6 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +32 -0
- package/lib/chevre/service/transaction/returnOrder/preStart.js +632 -0
- package/lib/chevre/service/transaction/returnOrder.d.ts +8 -6
- package/lib/chevre/service/transaction/returnOrder.js +4 -616
- package/lib/chevre/settings.d.ts +3 -1
- package/lib/chevre/settings.js +7 -2
- package/package.json +3 -3
|
@@ -4,7 +4,6 @@ import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTr
|
|
|
4
4
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
5
5
|
import type { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
6
6
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
7
|
-
import { IUseReservationAction } from './potentialActions/onReservationUsed';
|
|
8
7
|
/**
|
|
9
8
|
* 予約使用
|
|
10
9
|
*/
|
|
@@ -33,4 +32,4 @@ export declare function useReservation(params: {
|
|
|
33
32
|
order: OrderRepo;
|
|
34
33
|
reservation: ReservationRepo;
|
|
35
34
|
task: TaskRepo;
|
|
36
|
-
}) => Promise<
|
|
35
|
+
}) => Promise<void>;
|
|
@@ -68,7 +68,7 @@ function useReservation(params) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
: undefined);
|
|
71
|
-
|
|
71
|
+
const action = yield repos.action.start(actionAttributes);
|
|
72
72
|
// ひとまず予約数:1に限定する
|
|
73
73
|
if (actionAttributes.object.length !== 1) {
|
|
74
74
|
throw new factory.errors.Argument('object', 'number of using reservations must be 1');
|
|
@@ -88,9 +88,9 @@ function useReservation(params) {
|
|
|
88
88
|
throw error;
|
|
89
89
|
}
|
|
90
90
|
// アクション完了
|
|
91
|
-
|
|
92
|
-
yield (0, onReservationUsed_1.onReservationUsed)(
|
|
93
|
-
return action;
|
|
91
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
92
|
+
yield (0, onReservationUsed_1.onReservationUsed)(attendedReservation)({ task: repos.task });
|
|
93
|
+
// return action;
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
exports.useReservation = useReservation;
|
|
@@ -33,6 +33,8 @@ function verifyToken4reservation(params) {
|
|
|
33
33
|
});
|
|
34
34
|
// ステータス検証
|
|
35
35
|
switch (order.orderStatus) {
|
|
36
|
+
case factory.orderStatus.OrderProcessing: // OrderProcessingも許可(2024-01-10~)
|
|
37
|
+
case factory.orderStatus.OrderInTransit: // OrderInTransitも許可(2024-01-12~)
|
|
36
38
|
case factory.orderStatus.OrderDelivered:
|
|
37
39
|
break;
|
|
38
40
|
default:
|
|
@@ -78,7 +78,7 @@ function confirmRegisterServiceTransaction(params) {
|
|
|
78
78
|
}
|
|
79
79
|
// アクション完了
|
|
80
80
|
const result = {};
|
|
81
|
-
yield repos.action.
|
|
81
|
+
yield repos.action.completeWithVoid({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result });
|
|
82
82
|
yield onRegistered(confirmActionAttributes)(repos);
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -12,7 +12,10 @@ export declare function call(data: factory.task.IData<factory.taskName.ConfirmRe
|
|
|
12
12
|
/**
|
|
13
13
|
* 予約を確定する
|
|
14
14
|
*/
|
|
15
|
-
export declare function confirmReserveTransaction(params: factory.action.interact.confirm.reservation.IAttributes<factory.service.webAPI.Identifier
|
|
15
|
+
export declare function confirmReserveTransaction(params: factory.action.interact.confirm.reservation.IAttributes<factory.service.webAPI.Identifier>, options: {
|
|
16
|
+
sendOrder: boolean;
|
|
17
|
+
useOnOrderStatusChanged: boolean;
|
|
18
|
+
}): (repos: {
|
|
16
19
|
action: ActionRepo;
|
|
17
20
|
assetTransaction: AssetTransactionRepo;
|
|
18
21
|
order: OrderRepo;
|
|
@@ -28,7 +28,10 @@ const coaAuthClient = new COA.auth.RefreshToken({
|
|
|
28
28
|
*/
|
|
29
29
|
function call(data) {
|
|
30
30
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
yield confirmReserveTransaction(data
|
|
31
|
+
yield confirmReserveTransaction(data, {
|
|
32
|
+
sendOrder: true,
|
|
33
|
+
useOnOrderStatusChanged: true
|
|
34
|
+
})({
|
|
32
35
|
action: new action_1.MongoRepository(settings.connection),
|
|
33
36
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
34
37
|
order: new order_1.MongoRepository(settings.connection),
|
|
@@ -41,7 +44,7 @@ exports.call = call;
|
|
|
41
44
|
/**
|
|
42
45
|
* 予約を確定する
|
|
43
46
|
*/
|
|
44
|
-
function confirmReserveTransaction(params) {
|
|
47
|
+
function confirmReserveTransaction(params, options) {
|
|
45
48
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
46
49
|
// アクション開始
|
|
47
50
|
const confirmActionAttributes = params;
|
|
@@ -88,7 +91,43 @@ function confirmReserveTransaction(params) {
|
|
|
88
91
|
}
|
|
89
92
|
// アクション完了
|
|
90
93
|
const result = {};
|
|
91
|
-
yield repos.action.
|
|
94
|
+
yield repos.action.completeWithVoid({ typeOf: confirmActionAttributes.typeOf, id: action.id, result: result });
|
|
95
|
+
// sendOrder連携(2024-01-11~)
|
|
96
|
+
yield onConfirmed(params, options)({
|
|
97
|
+
task: repos.task
|
|
98
|
+
});
|
|
92
99
|
});
|
|
93
100
|
}
|
|
94
101
|
exports.confirmReserveTransaction = confirmReserveTransaction;
|
|
102
|
+
function onConfirmed(params, options) {
|
|
103
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (options.sendOrder === true) {
|
|
105
|
+
// タスク冪等作成
|
|
106
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
107
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
108
|
+
object: {
|
|
109
|
+
typeOf: params.object.typeOf,
|
|
110
|
+
transactionNumber: params.object.transactionNumber,
|
|
111
|
+
status: factory.transactionStatusType.Confirmed
|
|
112
|
+
},
|
|
113
|
+
purpose: {
|
|
114
|
+
confirmationNumber: '',
|
|
115
|
+
orderNumber: params.purpose.orderNumber,
|
|
116
|
+
typeOf: factory.order.OrderType.Order
|
|
117
|
+
},
|
|
118
|
+
useOnOrderStatusChanged: options.useOnOrderStatusChanged === true
|
|
119
|
+
};
|
|
120
|
+
const onAssetTransactionStatusChangedTask = {
|
|
121
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
122
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
123
|
+
status: factory.taskStatus.Ready,
|
|
124
|
+
runsAt: new Date(),
|
|
125
|
+
remainingNumberOfTries: 10,
|
|
126
|
+
numberOfTried: 0,
|
|
127
|
+
executionResults: [],
|
|
128
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
129
|
+
};
|
|
130
|
+
yield repos.task.createOnAssetTransactionStatusChangedTaskIfNotExist(onAssetTransactionStatusChangedTask, { emitImmediately: true });
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
@@ -128,7 +128,7 @@ function deleteResourcesByScreeningEventSeries(params) {
|
|
|
128
128
|
}
|
|
129
129
|
throw error;
|
|
130
130
|
}
|
|
131
|
-
yield repos.action.
|
|
131
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -162,7 +162,7 @@ function deleteResourcesByScreeningRoom(params) {
|
|
|
162
162
|
}
|
|
163
163
|
throw error;
|
|
164
164
|
}
|
|
165
|
-
yield repos.action.
|
|
165
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
function deleteResourcesByMovieTheater(params) {
|
|
@@ -206,7 +206,7 @@ function deleteResourcesByMovieTheater(params) {
|
|
|
206
206
|
}
|
|
207
207
|
throw error;
|
|
208
208
|
}
|
|
209
|
-
yield repos.action.
|
|
209
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
}
|
|
@@ -269,7 +269,7 @@ function deleteResourcesBySeller(params) {
|
|
|
269
269
|
}
|
|
270
270
|
throw error;
|
|
271
271
|
}
|
|
272
|
-
yield repos.action.
|
|
272
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
}
|
|
@@ -309,7 +309,7 @@ function deleteResourcesByAggregateOffer(params) {
|
|
|
309
309
|
}
|
|
310
310
|
throw error;
|
|
311
311
|
}
|
|
312
|
-
yield repos.action.
|
|
312
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
}
|
|
@@ -369,7 +369,7 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
369
369
|
}
|
|
370
370
|
throw error;
|
|
371
371
|
}
|
|
372
|
-
yield repos.action.
|
|
372
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
375
|
}
|
|
@@ -411,7 +411,7 @@ function deleteResourcesByProduct(params) {
|
|
|
411
411
|
}
|
|
412
412
|
throw error;
|
|
413
413
|
}
|
|
414
|
-
yield repos.action.
|
|
414
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
417
|
}
|
|
@@ -14,6 +14,7 @@ const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
|
14
14
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
15
15
|
const action_1 = require("../../repo/action");
|
|
16
16
|
const order_1 = require("../../repo/order");
|
|
17
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
17
18
|
const task_1 = require("../../repo/task");
|
|
18
19
|
const transaction_1 = require("../../repo/transaction");
|
|
19
20
|
const OrderService = require("../order");
|
|
@@ -21,17 +22,15 @@ const OrderService = require("../order");
|
|
|
21
22
|
* タスク実行関数
|
|
22
23
|
*/
|
|
23
24
|
function call(data) {
|
|
24
|
-
return (
|
|
25
|
-
// if (settings.redisClient === undefined) {
|
|
26
|
-
// throw new factory.errors.Argument('settings', 'redisClient required');
|
|
27
|
-
// }
|
|
25
|
+
return ({ connection }) => __awaiter(this, void 0, void 0, function* () {
|
|
28
26
|
yield OrderService.placeOrder(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
29
|
-
acceptedOffer: new acceptedOffer_1.MongoRepository(
|
|
30
|
-
accountingReport: new accountingReport_1.MongoRepository(
|
|
31
|
-
action: new action_1.MongoRepository(
|
|
32
|
-
order: new order_1.MongoRepository(
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
acceptedOffer: new acceptedOffer_1.MongoRepository(connection),
|
|
28
|
+
accountingReport: new accountingReport_1.MongoRepository(connection),
|
|
29
|
+
action: new action_1.MongoRepository(connection),
|
|
30
|
+
order: new order_1.MongoRepository(connection),
|
|
31
|
+
orderInTransaction: new orderInTransaction_1.MongoRepository(connection),
|
|
32
|
+
task: new task_1.MongoRepository(connection),
|
|
33
|
+
transaction: new transaction_1.MongoRepository(connection)
|
|
35
34
|
});
|
|
36
35
|
});
|
|
37
36
|
}
|
|
@@ -22,9 +22,6 @@ const returnOrder_1 = require("../order/returnOrder");
|
|
|
22
22
|
*/
|
|
23
23
|
function call(data) {
|
|
24
24
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
// if (settings.redisClient === undefined) {
|
|
26
|
-
// throw new factory.errors.Argument('settings', 'redisClient required');
|
|
27
|
-
// }
|
|
28
25
|
yield (0, returnOrder_1.returnOrder)(Object.assign(Object.assign({}, data), { useOnOrderStatusChanged: true }))({
|
|
29
26
|
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
30
27
|
action: new action_1.MongoRepository(settings.connection),
|
|
@@ -111,7 +111,7 @@ function returnPayTransaction(params) {
|
|
|
111
111
|
throw error;
|
|
112
112
|
}
|
|
113
113
|
const result = { refundTransaction };
|
|
114
|
-
yield repos.action.
|
|
114
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
115
115
|
// 潜在アクション
|
|
116
116
|
yield onRefund(refundActionAttributes)({ task: repos.task });
|
|
117
117
|
});
|
|
@@ -68,7 +68,7 @@ function cancelReservation(params) {
|
|
|
68
68
|
}
|
|
69
69
|
throw error;
|
|
70
70
|
}
|
|
71
|
-
yield repos.action.
|
|
71
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function processCancelReservation4coa(params) {
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
13
14
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
14
15
|
const action_1 = require("../../repo/action");
|
|
15
16
|
const order_1 = require("../../repo/order");
|
|
@@ -22,10 +23,13 @@ const OrderService = require("../order");
|
|
|
22
23
|
*/
|
|
23
24
|
function call(data) {
|
|
24
25
|
return (settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var _a;
|
|
27
|
+
yield OrderService.sendOrder(Object.assign(Object.assign({}, data), { object: Object.assign(Object.assign({}, data.object), { previousOrderStatus: (typeof data.object.previousOrderStatus === 'string')
|
|
28
|
+
? data.object.previousOrderStatus
|
|
29
|
+
: factory.orderStatus.OrderProcessing, acceptedOffers: (typeof ((_a = data.object.acceptedOffers) === null || _a === void 0 ? void 0 : _a.limit) === 'number')
|
|
30
|
+
? data.object.acceptedOffers
|
|
31
|
+
: { limit: 50, page: 1 } // 互換性維持対応として指定がない場合に対応
|
|
32
|
+
}), useOnOrderStatusChanged: true }))({
|
|
29
33
|
acceptedOffer: new acceptedOffer_1.MongoRepository(settings.connection),
|
|
30
34
|
action: new action_1.MongoRepository(settings.connection),
|
|
31
35
|
order: new order_1.MongoRepository(settings.connection),
|
|
@@ -15,7 +15,7 @@ const action_1 = require("../../repo/action");
|
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
16
|
const paymentService_1 = require("../../repo/paymentService");
|
|
17
17
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
|
-
|
|
18
|
+
// import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
19
19
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
20
20
|
const task_1 = require("../../repo/task");
|
|
21
21
|
const transaction_1 = require("../../repo/transaction");
|
|
@@ -32,7 +32,7 @@ function call(data) {
|
|
|
32
32
|
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
33
33
|
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
34
34
|
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection),
|
|
35
|
-
project: new
|
|
35
|
+
// project: new ProjectRepo(settings.connection),
|
|
36
36
|
task: new task_1.MongoRepository(settings.connection),
|
|
37
37
|
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
38
38
|
});
|
|
@@ -13,6 +13,7 @@ exports.call = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
|
+
const orderInTransaction_1 = require("../../repo/orderInTransaction");
|
|
16
17
|
const offer_1 = require("../../repo/rateLimit/offer");
|
|
17
18
|
const reservation_1 = require("../../repo/reservation");
|
|
18
19
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
@@ -27,19 +28,14 @@ function call(data) {
|
|
|
27
28
|
if (settings.redisClient === undefined) {
|
|
28
29
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
29
30
|
}
|
|
30
|
-
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
31
|
-
const assetTransactionRepo = new assetTransaction_1.MongoRepository(settings.connection);
|
|
32
|
-
const stockHolderRepo = new stockHolder_1.StockHolderRepository(settings.redisClient, settings.connection);
|
|
33
|
-
const offerRateLimitRepo = new offer_1.RedisRepository(settings.redisClient);
|
|
34
|
-
const reservationRepo = new reservation_1.MongoRepository(settings.connection);
|
|
35
|
-
const taskRepo = new task_1.MongoRepository(settings.connection);
|
|
36
31
|
yield EventOfferService.voidTransaction(data)({
|
|
37
|
-
action:
|
|
38
|
-
assetTransaction:
|
|
39
|
-
stockHolder:
|
|
40
|
-
offerRateLimit:
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
action: new action_1.MongoRepository(settings.connection),
|
|
33
|
+
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
34
|
+
stockHolder: new stockHolder_1.StockHolderRepository(settings.redisClient, settings.connection),
|
|
35
|
+
offerRateLimit: new offer_1.RedisRepository(settings.redisClient),
|
|
36
|
+
orderInTransaction: new orderInTransaction_1.MongoRepository(settings.connection),
|
|
37
|
+
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
38
|
+
task: new task_1.MongoRepository(settings.connection),
|
|
43
39
|
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
44
40
|
});
|
|
45
41
|
});
|
|
@@ -261,7 +261,7 @@ function deleteTransactionById(params) {
|
|
|
261
261
|
deletedReservationNumbers,
|
|
262
262
|
deleteActionResult
|
|
263
263
|
};
|
|
264
|
-
yield repos.action.
|
|
264
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
function deleteReservationsByPlaceOrder(params) {
|
|
@@ -235,7 +235,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
235
235
|
// requestBody: requestBody,
|
|
236
236
|
responseBody: responseBody
|
|
237
237
|
};
|
|
238
|
-
|
|
238
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
function createAuthorizeMoneyTransferOfferActionAttributes(params) {
|
|
@@ -472,10 +472,6 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
|
|
|
472
472
|
if (order === undefined) {
|
|
473
473
|
throw new factory.errors.NotFound('Order');
|
|
474
474
|
}
|
|
475
|
-
// OrderDeliveredのみ許可
|
|
476
|
-
// if (order.orderStatus !== chevre.factory.orderStatus.OrderDelivered) {
|
|
477
|
-
// throw new chevre.factory.errors.Argument('fromLocation', `Invalid order status '${order.orderStatus}''`);
|
|
478
|
-
// }
|
|
479
475
|
let awardAccounts = [];
|
|
480
476
|
const awardAccounsValue = (_b = (_a = order.identifier) === null || _a === void 0 ? void 0 : _a.find((i) => i.name === order_1.AWARD_ACCOUNTS_IDENTIFIER_NAME)) === null || _b === void 0 ? void 0 : _b.value;
|
|
481
477
|
if (typeof awardAccounsValue === 'string' && awardAccounsValue.length > 0) {
|
|
@@ -16,6 +16,7 @@ const registerService_1 = require("./potentialActions/registerService");
|
|
|
16
16
|
const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
17
17
|
const factory = require("../../../factory");
|
|
18
18
|
const order_1 = require("../../../factory/order");
|
|
19
|
+
const settings_1 = require("../../../settings");
|
|
19
20
|
/**
|
|
20
21
|
* 取引のポストアクションを作成する
|
|
21
22
|
*/
|
|
@@ -43,11 +44,14 @@ function createPotentialActions(params) {
|
|
|
43
44
|
priceCurrency: params.order.priceCurrency,
|
|
44
45
|
orderDate: params.order.orderDate
|
|
45
46
|
};
|
|
47
|
+
const sendOrderObject = Object.assign(Object.assign({}, simpleOrder), { acceptedOffers: {
|
|
48
|
+
limit: settings_1.DELIVER_ORDER_LIMIT,
|
|
49
|
+
page: 1 // page1から配送
|
|
50
|
+
} });
|
|
46
51
|
const sendOrderActionAttributes = {
|
|
47
52
|
project: params.transaction.project,
|
|
48
53
|
typeOf: factory.actionType.SendAction,
|
|
49
|
-
|
|
50
|
-
object: simpleOrder,
|
|
54
|
+
object: sendOrderObject,
|
|
51
55
|
agent: params.transaction.project,
|
|
52
56
|
recipient: {
|
|
53
57
|
typeOf: params.order.customer.typeOf,
|
|
@@ -22,7 +22,6 @@ const validation_1 = require("./placeOrderInProgress/validation");
|
|
|
22
22
|
const validateSeller_1 = require("./placeOrderInProgress/validation/validateSeller");
|
|
23
23
|
const validation_2 = require("./validation");
|
|
24
24
|
const errorHandler_1 = require("../../errorHandler");
|
|
25
|
-
const settings_1 = require("../../settings");
|
|
26
25
|
exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
27
26
|
/**
|
|
28
27
|
* 取引開始
|
|
@@ -220,7 +219,8 @@ function createResult(params) {
|
|
|
220
219
|
orderDate: params.result.order.orderDate,
|
|
221
220
|
// OrderPaymentDueオプションを追加(2023-08-25~)
|
|
222
221
|
// 注文作成時のステータスとなる
|
|
223
|
-
orderStatus: (
|
|
222
|
+
// orderStatus: (USE_ORDER_PAYMENT_DUE_ON_PLACED) ? factory.orderStatus.OrderPaymentDue : factory.orderStatus.OrderProcessing,
|
|
223
|
+
orderStatus: factory.orderStatus.OrderPaymentDue,
|
|
224
224
|
isGift: false,
|
|
225
225
|
authorizeActions: params.authorizeActions
|
|
226
226
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { MongoRepository as AcceptedOfferRepo } from '../../../repo/acceptedOffer';
|
|
3
|
+
import type { MongoRepository as EventRepo } from '../../../repo/event';
|
|
4
|
+
import type { MongoRepository as MerchantReturnPolicyRepo } from '../../../repo/merchantReturnPolicy';
|
|
5
|
+
import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
6
|
+
import type { MongoRepository as OfferItemConditionRepo } from '../../../repo/offerItemCondition';
|
|
7
|
+
import type { MongoRepository as OrderRepo } from '../../../repo/order';
|
|
8
|
+
import type { MongoRepository as ProjectRepo } from '../../../repo/project';
|
|
9
|
+
import type { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
10
|
+
import type { MongoRepository as SellerRepo } from '../../../repo/seller';
|
|
11
|
+
interface IPreStartOperationRepos {
|
|
12
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
13
|
+
event: EventRepo;
|
|
14
|
+
merchantReturnPolicy: MerchantReturnPolicyRepo;
|
|
15
|
+
offer: OfferRepo;
|
|
16
|
+
offerItemCondition: OfferItemConditionRepo;
|
|
17
|
+
order: OrderRepo;
|
|
18
|
+
project: ProjectRepo;
|
|
19
|
+
reservation: ReservationRepo;
|
|
20
|
+
seller: SellerRepo;
|
|
21
|
+
}
|
|
22
|
+
type IPreStartOperation<T> = (repos: IPreStartOperationRepos) => Promise<T>;
|
|
23
|
+
type IFixedSeller = Pick<factory.seller.ISeller, 'id' | 'name' | 'project' | 'hasMerchantReturnPolicy' | 'typeOf'>;
|
|
24
|
+
/**
|
|
25
|
+
* 返品取引開始前処理
|
|
26
|
+
*/
|
|
27
|
+
declare function preStart(params: factory.transaction.returnOrder.IStartParamsWithoutDetail): IPreStartOperation<{
|
|
28
|
+
transactionObject: factory.transaction.returnOrder.IObject;
|
|
29
|
+
seller: IFixedSeller;
|
|
30
|
+
expiresInSeconds: number;
|
|
31
|
+
}>;
|
|
32
|
+
export { preStart };
|