@chevre/domain 24.0.0-alpha.2 → 24.0.0-alpha.21
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/acceptCOAOffer.d.ts +23 -0
- package/lib/chevre/repo/action/acceptCOAOffer.js +64 -0
- package/lib/chevre/repo/action/acceptPay.d.ts +8 -0
- package/lib/chevre/repo/action/acceptPay.js +13 -0
- package/lib/chevre/repo/action/actionProcess.d.ts +115 -0
- package/lib/chevre/repo/action/actionProcess.js +293 -0
- package/lib/chevre/repo/action/authorizeOffer.d.ts +21 -0
- package/lib/chevre/repo/action/authorizeOffer.js +85 -0
- package/lib/chevre/repo/action/checkMovieTicket.d.ts +111 -0
- package/lib/chevre/repo/action/checkMovieTicket.js +200 -0
- package/lib/chevre/repo/action/checkThing.d.ts +8 -0
- package/lib/chevre/repo/action/checkThing.js +13 -0
- package/lib/chevre/repo/action.d.ts +9 -249
- package/lib/chevre/repo/action.js +308 -708
- package/lib/chevre/repo/aggregateAction.d.ts +102 -0
- package/lib/chevre/repo/aggregateAction.js +379 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.js +31 -0
- package/lib/chevre/repo/orderInTransaction.d.ts +8 -0
- package/lib/chevre/repo/orderInTransaction.js +16 -2
- package/lib/chevre/repo/orderNumber.d.ts +3 -2
- package/lib/chevre/repo/orderNumber.js +23 -28
- package/lib/chevre/repo/transaction/moneyTransfer.d.ts +61 -0
- package/lib/chevre/repo/transaction/moneyTransfer.js +379 -0
- package/lib/chevre/repo/transaction/placeOrder.d.ts +140 -0
- package/lib/chevre/repo/transaction/placeOrder.js +528 -0
- package/lib/chevre/repo/transaction/returnOrder.d.ts +45 -0
- package/lib/chevre/repo/transaction/returnOrder.js +341 -0
- package/lib/chevre/repo/transaction.d.ts +1 -125
- package/lib/chevre/repo/transaction.js +726 -632
- package/lib/chevre/repository.d.ts +49 -0
- package/lib/chevre/repository.js +107 -2
- package/lib/chevre/service/aggregation/system.d.ts +10 -10
- package/lib/chevre/service/aggregation/system.js +9 -9
- package/lib/chevre/service/assetTransaction/pay/check.d.ts +5 -4
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +5 -2
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +3 -3
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +51 -3
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +58 -21
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.d.ts +10 -0
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +88 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +55 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.js +56 -0
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +1 -11
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay/start.js +8 -132
- package/lib/chevre/service/notification/triggerWebhook.d.ts +7 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize.js +3 -3
- package/lib/chevre/service/offer/event/issueEventOfferTicket.d.ts +2 -2
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.js +1 -0
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +3 -3
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +16 -5
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +6 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -10
- package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +21 -13
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +19 -10
- package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +6 -3
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.d.ts +2 -2
- package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +4 -1
- package/lib/chevre/service/offer/product.d.ts +3 -3
- package/lib/chevre/service/offer/product.js +4 -4
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +2 -2
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +16 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +97 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.d.ts +21 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +86 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.d.ts +22 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionConfirmed.js +112 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.d.ts +22 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onReserveTransactionConfirmed.js +74 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.d.ts +25 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/paymentDue2Processing.js +111 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.d.ts +16 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/processing2inTransit.js +74 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +8 -30
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +37 -348
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +6 -7
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +6 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +7 -6
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -1
- package/lib/chevre/service/order/placeOrder.d.ts +13 -12
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.d.ts +6 -6
- package/lib/chevre/service/order/sendOrder.js +10 -8
- package/lib/chevre/service/order.d.ts +3 -6
- package/lib/chevre/service/order.js +3 -9
- package/lib/chevre/service/payment/any/{fixOrderAsNeeded.d.ts → authorize/fixOrderAsNeeded.d.ts} +6 -6
- package/lib/chevre/service/payment/any/{fixOrderAsNeeded.js → authorize/fixOrderAsNeeded.js} +5 -8
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +3 -3
- package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
- package/lib/chevre/service/payment/any/authorize.d.ts +92 -0
- package/lib/chevre/service/payment/any/authorize.js +225 -0
- package/lib/chevre/service/payment/any/findAcceptAction.d.ts +43 -0
- package/lib/chevre/service/payment/any/findAcceptAction.js +94 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.d.ts +41 -0
- package/lib/chevre/service/payment/any/findAuthorizeAction.js +83 -0
- package/lib/chevre/service/payment/any/findCheckAction.d.ts +45 -0
- package/lib/chevre/service/payment/any/findCheckAction.js +89 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +28 -0
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +185 -0
- package/lib/chevre/service/payment/any/onPayActionCompleted.d.ts +7 -3
- package/lib/chevre/service/payment/any/onPayActionCompleted.js +3 -0
- package/lib/chevre/service/payment/any/processVoidPayTransaction.d.ts +29 -0
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +125 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +2 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +66 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +133 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +31 -0
- package/lib/chevre/service/payment/any/voidPayTransaction.js +38 -0
- package/lib/chevre/service/payment/any.d.ts +8 -305
- package/lib/chevre/service/payment/any.js +17 -857
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +11 -10
- package/lib/chevre/service/payment/movieTicket/validation.js +19 -15
- package/lib/chevre/service/report/telemetry.d.ts +4 -0
- package/lib/chevre/service/report/telemetry.js +7 -12
- package/lib/chevre/service/task/acceptCOAOffer.js +11 -6
- package/lib/chevre/service/task/authorizePayment.js +6 -2
- package/lib/chevre/service/task/checkMovieTicket.js +3 -3
- package/lib/chevre/service/task/checkResource.js +2 -2
- package/lib/chevre/service/task/confirmPayTransaction.js +2 -2
- package/lib/chevre/service/task/deleteTransaction.js +7 -1
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +4 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -2
- package/lib/chevre/service/task/payment/payByTask.d.ts +14 -12
- package/lib/chevre/service/task/placeOrder.js +6 -4
- package/lib/chevre/service/task/publishPaymentUrl.js +8 -4
- package/lib/chevre/service/task/returnOrder.js +4 -4
- package/lib/chevre/service/task/returnPayTransaction.js +4 -3
- package/lib/chevre/service/task/sendOrder.js +4 -4
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -3
- package/lib/chevre/service/task/voidPayTransaction.js +4 -2
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -3
- package/lib/chevre/service/task/voidReserveTransaction.js +4 -3
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +6 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +56 -14
- package/lib/chevre/service/transaction/moneyTransfer.d.ts +5 -5
- package/lib/chevre/service/transaction/moneyTransfer.js +5 -5
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +10 -9
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.d.ts +7 -6
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.d.ts → issueOrderNumberIfNotExist.d.ts} +4 -4
- package/lib/chevre/service/transaction/placeOrder/{publishOrderNumberIfNotExist.js → issueOrderNumberIfNotExist.js} +21 -13
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/publishConfirmationNumberIfNotExist.js +3 -3
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/start.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +23 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +126 -0
- package/lib/chevre/service/transaction/placeOrder.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrder.js +3 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +16 -14
- package/lib/chevre/service/transaction/returnOrder.js +4 -4
- package/lib/chevre/service/transaction.d.ts +9 -21
- package/lib/chevre/service/transaction.js +5 -111
- package/package.json +4 -8
|
@@ -36,7 +36,8 @@ const paymentService_1 = require("../../repo/paymentService");
|
|
|
36
36
|
const potentialAction_1 = require("../../repo/potentialAction");
|
|
37
37
|
const product_1 = require("../../repo/product");
|
|
38
38
|
const task_1 = require("../../repo/task");
|
|
39
|
-
|
|
39
|
+
// import { TransactionRepo } from '../../repo/transaction';
|
|
40
|
+
const returnOrder_1 = require("../../repo/transaction/returnOrder");
|
|
40
41
|
const transactionNumber_1 = require("../../repo/transactionNumber");
|
|
41
42
|
const RefundTransactionService = __importStar(require("../assetTransaction/refund"));
|
|
42
43
|
/**
|
|
@@ -58,7 +59,7 @@ function call(params) {
|
|
|
58
59
|
potentialAction: new potentialAction_1.PotentialActionRepo(connection),
|
|
59
60
|
product: new product_1.ProductRepo(connection),
|
|
60
61
|
task: new task_1.TaskRepo(connection),
|
|
61
|
-
|
|
62
|
+
returnOrder: new returnOrder_1.ReturnOrderRepo(connection),
|
|
62
63
|
transactionNumber: new transactionNumber_1.TransactionNumberRepo({ connection })
|
|
63
64
|
});
|
|
64
65
|
};
|
|
@@ -104,7 +105,7 @@ function fixOrderAndTransaction(params) {
|
|
|
104
105
|
}
|
|
105
106
|
// const orderNumber = params.purpose.orderNumber;
|
|
106
107
|
const orderNumber = orderByPaymentMethodId.orderNumber;
|
|
107
|
-
const returnOrderTransaction = (await repos.
|
|
108
|
+
const returnOrderTransaction = (await repos.returnOrder.findReturnOrderTransactions({
|
|
108
109
|
limit: 1,
|
|
109
110
|
page: 1,
|
|
110
111
|
typeOf: factory.transactionType.ReturnOrder,
|
|
@@ -31,13 +31,13 @@ const order_1 = require("../../repo/order");
|
|
|
31
31
|
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
32
32
|
const setting_1 = require("../../repo/setting");
|
|
33
33
|
const task_1 = require("../../repo/task");
|
|
34
|
-
const
|
|
34
|
+
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
35
35
|
const sendOrder_1 = require("../order/sendOrder");
|
|
36
36
|
/**
|
|
37
37
|
* タスク実行関数
|
|
38
38
|
*/
|
|
39
39
|
function call(data) {
|
|
40
|
-
return async ({ connection
|
|
40
|
+
return async ({ connection }) => {
|
|
41
41
|
await (0, sendOrder_1.sendOrder)({
|
|
42
42
|
...data,
|
|
43
43
|
object: {
|
|
@@ -57,7 +57,7 @@ function call(data) {
|
|
|
57
57
|
ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
|
|
58
58
|
setting: new setting_1.SettingRepo(connection),
|
|
59
59
|
task: new task_1.TaskRepo(connection),
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
61
|
+
});
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const action_1 = require("../../repo/action");
|
|
5
5
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
|
-
|
|
6
|
+
// import { TransactionRepo } from '../../repo/transaction';
|
|
7
|
+
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
7
8
|
const voidTransaction_1 = require("../offer/moneyTransfer/voidTransaction");
|
|
8
9
|
/**
|
|
9
10
|
* タスク実行関数
|
|
@@ -12,11 +13,13 @@ function call(data) {
|
|
|
12
13
|
return async ({ connection }) => {
|
|
13
14
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
14
15
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
15
|
-
const
|
|
16
|
+
const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
|
|
17
|
+
// const transactionRepo = new TransactionRepo(connection);
|
|
16
18
|
await (0, voidTransaction_1.voidTransaction)(data)({
|
|
17
19
|
action: actionRepo,
|
|
18
20
|
assetTransaction: assetTransactionRepo,
|
|
19
|
-
|
|
21
|
+
placeOrder: placeOrderRepo
|
|
22
|
+
// transaction: transactionRepo
|
|
20
23
|
});
|
|
21
24
|
};
|
|
22
25
|
}
|
|
@@ -8,7 +8,8 @@ const paymentService_1 = require("../../repo/paymentService");
|
|
|
8
8
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
9
9
|
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
10
10
|
const task_1 = require("../../repo/task");
|
|
11
|
-
const
|
|
11
|
+
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
12
|
+
// import { TransactionRepo } from '../../repo/transaction';
|
|
12
13
|
const any_1 = require("../payment/any");
|
|
13
14
|
/**
|
|
14
15
|
* タスク実行関数
|
|
@@ -27,7 +28,8 @@ function call(params) {
|
|
|
27
28
|
paymentService: new paymentService_1.PaymentServiceRepo(connection),
|
|
28
29
|
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
29
30
|
task: new task_1.TaskRepo(connection),
|
|
30
|
-
|
|
31
|
+
placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
|
|
32
|
+
// transaction: new TransactionRepo(connection)
|
|
31
33
|
}
|
|
32
34
|
// settings
|
|
33
35
|
);
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const action_1 = require("../../repo/action");
|
|
5
5
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
6
|
-
const
|
|
6
|
+
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
7
7
|
const product_1 = require("../offer/product");
|
|
8
8
|
/**
|
|
9
9
|
* タスク実行関数
|
|
@@ -12,11 +12,11 @@ function call(data) {
|
|
|
12
12
|
return async ({ connection }) => {
|
|
13
13
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
14
14
|
const assetTransactionRepo = new assetTransaction_1.AssetTransactionRepo(connection);
|
|
15
|
-
const
|
|
15
|
+
const placeOrderRepo = new placeOrder_1.PlaceOrderRepo(connection);
|
|
16
16
|
await (0, product_1.voidTransaction)(data)({
|
|
17
17
|
action: actionRepo,
|
|
18
18
|
assetTransaction: assetTransactionRepo,
|
|
19
|
-
|
|
19
|
+
placeOrder: placeOrderRepo
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
}
|
|
@@ -36,8 +36,8 @@ const reserveInterface_1 = require("../../repo/reserveInterface");
|
|
|
36
36
|
const setting_1 = require("../../repo/setting");
|
|
37
37
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
38
38
|
const task_1 = require("../../repo/task");
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// import { TransactionRepo } from '../../repo/transaction';
|
|
40
|
+
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
41
41
|
let coaAuthClientCreated = false;
|
|
42
42
|
let coaAuthClient = new COA.auth.RefreshToken({
|
|
43
43
|
endpoint: '', // 使用されないので空文字でok
|
|
@@ -87,7 +87,8 @@ function call(params) {
|
|
|
87
87
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
88
88
|
setting: new setting_1.SettingRepo(connection),
|
|
89
89
|
task: new task_1.TaskRepo(connection),
|
|
90
|
-
|
|
90
|
+
placeOrder: new placeOrder_1.PlaceOrderRepo(connection),
|
|
91
|
+
// transaction: new TransactionRepo(connection),
|
|
91
92
|
reserveService
|
|
92
93
|
}, settings);
|
|
93
94
|
}
|
|
@@ -12,6 +12,9 @@ import type { ReservationRepo } from '../../repo/reservation';
|
|
|
12
12
|
import type { SettingRepo } from '../../repo/setting';
|
|
13
13
|
import type { TaskRepo } from '../../repo/task';
|
|
14
14
|
import type { TransactionRepo } from '../../repo/transaction';
|
|
15
|
+
import type { PlaceOrderRepo } from '../../repo/transaction/placeOrder';
|
|
16
|
+
import type { ReturnOrderRepo } from '../../repo/transaction/returnOrder';
|
|
17
|
+
import type { MoneyTransferRepo } from '../../repo/transaction/moneyTransfer';
|
|
15
18
|
/**
|
|
16
19
|
* 取引に関わるリソースを削除する
|
|
17
20
|
* 冪等性を確保すること
|
|
@@ -30,4 +33,7 @@ export declare function deleteTransaction(params: factory.task.IData<factory.tas
|
|
|
30
33
|
setting: SettingRepo;
|
|
31
34
|
task: TaskRepo;
|
|
32
35
|
transaction: TransactionRepo;
|
|
36
|
+
placeOrder: PlaceOrderRepo;
|
|
37
|
+
returnOrder: ReturnOrderRepo;
|
|
38
|
+
moneyTransfer: MoneyTransferRepo;
|
|
33
39
|
}) => Promise<void>;
|
|
@@ -50,15 +50,40 @@ function createDeleteTransactionTasksByAgentId(params) {
|
|
|
50
50
|
// agentIdによる全取引についてDeleteTransactionタスクを作成する
|
|
51
51
|
if (typeof agentIdSpecified === 'string' && agentIdSpecified.length > 0) {
|
|
52
52
|
const transactionTypeOf = params.object.typeOf;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
let transactions;
|
|
54
|
+
if (transactionTypeOf === factory.transactionType.PlaceOrder) {
|
|
55
|
+
transactions = await repos.placeOrder.findPlaceOrderTransactions({
|
|
56
|
+
project: { id: { $eq: params.object.project.id } },
|
|
57
|
+
agent: {
|
|
58
|
+
ids: [agentIdSpecified],
|
|
59
|
+
typeOf: factory.personType.Person
|
|
60
|
+
},
|
|
61
|
+
typeOf: transactionTypeOf,
|
|
62
|
+
inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else if (transactionTypeOf === factory.transactionType.ReturnOrder) {
|
|
66
|
+
transactions = await repos.returnOrder.findReturnOrderTransactions({
|
|
67
|
+
project: { id: { $eq: params.object.project.id } },
|
|
68
|
+
agent: {
|
|
69
|
+
ids: [agentIdSpecified],
|
|
70
|
+
typeOf: factory.personType.Person
|
|
71
|
+
},
|
|
72
|
+
typeOf: transactionTypeOf,
|
|
73
|
+
inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
transactions = await repos.moneyTransfer.findMoneyTransferTransactions({
|
|
78
|
+
project: { id: { $eq: params.object.project.id } },
|
|
79
|
+
agent: {
|
|
80
|
+
ids: [agentIdSpecified],
|
|
81
|
+
typeOf: factory.personType.Person
|
|
82
|
+
},
|
|
83
|
+
typeOf: transactionTypeOf,
|
|
84
|
+
inclusion: ['typeOf', 'startDate', 'endDate', 'object', 'project']
|
|
85
|
+
});
|
|
86
|
+
}
|
|
62
87
|
const deleteAt = new Date();
|
|
63
88
|
let deleteTransactionTasks;
|
|
64
89
|
switch (transactionTypeOf) {
|
|
@@ -166,11 +191,28 @@ function deleteTransactionById(params) {
|
|
|
166
191
|
if (typeof deletingTransactionId !== 'string' || deletingTransactionId.length === 0) {
|
|
167
192
|
throw new factory.errors.ArgumentNull('object.id');
|
|
168
193
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
194
|
+
let transaction;
|
|
195
|
+
if (params.object.typeOf === factory.transactionType.PlaceOrder) {
|
|
196
|
+
transaction = (await repos.placeOrder.findPlaceOrderTransactions({
|
|
197
|
+
ids: [deletingTransactionId],
|
|
198
|
+
typeOf: params.object.typeOf,
|
|
199
|
+
inclusion: ['typeOf', 'project', 'status', 'result']
|
|
200
|
+
})).shift();
|
|
201
|
+
}
|
|
202
|
+
else if (params.object.typeOf === factory.transactionType.ReturnOrder) {
|
|
203
|
+
transaction = (await repos.returnOrder.findReturnOrderTransactions({
|
|
204
|
+
ids: [deletingTransactionId],
|
|
205
|
+
typeOf: params.object.typeOf,
|
|
206
|
+
inclusion: ['typeOf', 'project', 'status', 'result']
|
|
207
|
+
})).shift();
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
transaction = (await repos.moneyTransfer.findMoneyTransferTransactions({
|
|
211
|
+
ids: [deletingTransactionId],
|
|
212
|
+
typeOf: params.object.typeOf,
|
|
213
|
+
inclusion: ['typeOf', 'project', 'status', 'result']
|
|
214
|
+
})).shift();
|
|
215
|
+
}
|
|
174
216
|
if (transaction === undefined) {
|
|
175
217
|
// すでに削除済
|
|
176
218
|
return;
|
|
@@ -9,7 +9,7 @@ import type { SellerRepo } from '../../repo/seller';
|
|
|
9
9
|
import type { SettingRepo } from '../../repo/setting';
|
|
10
10
|
import type { TaskRepo } from '../../repo/task';
|
|
11
11
|
import type { TicketRepo } from '../../repo/ticket';
|
|
12
|
-
import type { IStartedTransaction,
|
|
12
|
+
import type { IStartedTransaction, MoneyTransferRepo } from '../../repo/transaction/moneyTransfer';
|
|
13
13
|
import type { TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
14
14
|
import { moneyTransfer as MoneyTransferFactory } from '../../factory/transaction';
|
|
15
15
|
export interface IStartOperationRepos {
|
|
@@ -21,7 +21,7 @@ export interface IStartOperationRepos {
|
|
|
21
21
|
project: ProjectRepo;
|
|
22
22
|
seller: SellerRepo;
|
|
23
23
|
ticket: TicketRepo;
|
|
24
|
-
|
|
24
|
+
moneyTransfer: MoneyTransferRepo;
|
|
25
25
|
transactionNumber: TransactionNumberRepo;
|
|
26
26
|
assetTransaction: AssetTransactionRepo;
|
|
27
27
|
}
|
|
@@ -29,11 +29,11 @@ export type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
|
29
29
|
export type ITaskAndTransactionOperation<T> = (repos: {
|
|
30
30
|
setting: SettingRepo;
|
|
31
31
|
task: TaskRepo;
|
|
32
|
-
|
|
32
|
+
moneyTransfer: MoneyTransferRepo;
|
|
33
33
|
}) => Promise<T>;
|
|
34
34
|
export type IConfirmOperation<T> = (repos: {
|
|
35
35
|
action: ActionRepo;
|
|
36
|
-
|
|
36
|
+
moneyTransfer: MoneyTransferRepo;
|
|
37
37
|
}) => Promise<T>;
|
|
38
38
|
export type IStartParams = MoneyTransferFactory.IStartParams;
|
|
39
39
|
/**
|
|
@@ -48,7 +48,7 @@ export type IAuthorizeOperation<T> = (repos: {
|
|
|
48
48
|
product: ProductRepo;
|
|
49
49
|
project: ProjectRepo;
|
|
50
50
|
ticket: TicketRepo;
|
|
51
|
-
|
|
51
|
+
moneyTransfer: MoneyTransferRepo;
|
|
52
52
|
assetTransaction: AssetTransactionRepo;
|
|
53
53
|
}) => Promise<T>;
|
|
54
54
|
/**
|
|
@@ -72,7 +72,7 @@ function start(params) {
|
|
|
72
72
|
const { transactionNumber } = await repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
|
|
73
73
|
// 取引開始
|
|
74
74
|
const startParams = (0, factory_2.createStartParams)(params, passport, seller, amount, fromLocation, toLocation, transactionNumber);
|
|
75
|
-
const transaction = await repos.
|
|
75
|
+
const transaction = await repos.moneyTransfer.startMoneyTransfer(startParams);
|
|
76
76
|
await authorizePaymentCard({
|
|
77
77
|
transaction: {
|
|
78
78
|
...transaction,
|
|
@@ -202,7 +202,7 @@ function processAuthorizePaymentCard(params) {
|
|
|
202
202
|
// jwt: JWTCredentials;
|
|
203
203
|
// }
|
|
204
204
|
) => {
|
|
205
|
-
const transaction = await repos.
|
|
205
|
+
const transaction = await repos.moneyTransfer.findMoneyTransferInProgressById({
|
|
206
206
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
207
207
|
id: params.purpose.id
|
|
208
208
|
}, ['agent', 'project', 'recipient', 'seller', 'typeOf', 'object']);
|
|
@@ -566,7 +566,7 @@ function validateToLocation(project, toLocationBeforeStart, issuedThrough) {
|
|
|
566
566
|
function confirm(params) {
|
|
567
567
|
return async (repos) => {
|
|
568
568
|
const now = new Date();
|
|
569
|
-
const transaction = await repos.
|
|
569
|
+
const transaction = await repos.moneyTransfer.findMoneyTransferById({
|
|
570
570
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
571
571
|
id: params.id
|
|
572
572
|
}, ['typeOf', 'status', 'project']);
|
|
@@ -591,7 +591,7 @@ function confirm(params) {
|
|
|
591
591
|
// ポストアクションを作成
|
|
592
592
|
const potentialActions = await (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
|
|
593
593
|
// 取引確定
|
|
594
|
-
await repos.
|
|
594
|
+
await repos.moneyTransfer.confirmMoneyTransfer({
|
|
595
595
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
596
596
|
id: transaction.id,
|
|
597
597
|
result: {},
|
|
@@ -625,7 +625,7 @@ function exportTasksById(params) {
|
|
|
625
625
|
return async (repos
|
|
626
626
|
// settings: Settings
|
|
627
627
|
) => {
|
|
628
|
-
const transaction = await repos.
|
|
628
|
+
const transaction = await repos.moneyTransfer.findMoneyTransferById({
|
|
629
629
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
630
630
|
id: params.id
|
|
631
631
|
}, ['endDate', 'status', 'project', 'startDate', 'typeOf', 'object', 'potentialActions']);
|
|
@@ -8,7 +8,7 @@ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
|
8
8
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
9
9
|
import type { ProjectRepo } from '../../../repo/project';
|
|
10
10
|
import type { SettingRepo } from '../../../repo/setting';
|
|
11
|
-
import type {
|
|
11
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
12
12
|
import * as factory from '../../../factory';
|
|
13
13
|
import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
|
|
14
14
|
interface IConfirmOperationRepos {
|
|
@@ -18,7 +18,7 @@ interface IConfirmOperationRepos {
|
|
|
18
18
|
emailMessage?: EmailMessageRepo;
|
|
19
19
|
message: MessageRepo;
|
|
20
20
|
project: ProjectRepo;
|
|
21
|
-
|
|
21
|
+
placeOrder: PlaceOrderRepo;
|
|
22
22
|
orderInTransaction: OrderInTransactionRepo;
|
|
23
23
|
orderNumber: OrderNumberRepo;
|
|
24
24
|
confirmationNumber: ConfirmationNumberRepo;
|
|
@@ -40,19 +40,20 @@ const potentialActions_1 = require("./confirm/potentialActions");
|
|
|
40
40
|
const publishCode_1 = require("./confirm/publishCode");
|
|
41
41
|
const validation_1 = require("./confirm/validation");
|
|
42
42
|
const publishConfirmationNumberIfNotExist_1 = require("./publishConfirmationNumberIfNotExist");
|
|
43
|
-
const
|
|
43
|
+
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
44
44
|
const debug = (0, debug_1.default)('chevre-domain:service:transaction');
|
|
45
|
+
/**
|
|
46
|
+
* 進行中でない取引を処理する
|
|
47
|
+
*/
|
|
45
48
|
function processTransactionNotInProgress(transaction) {
|
|
46
49
|
return async (repos) => {
|
|
47
50
|
if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
48
|
-
// retrieve customer from orderInTransaction(2024-06-24~)
|
|
49
|
-
// let resultCustomer: factory.order.ICustomer | undefined = createCustomer({ transaction });
|
|
50
51
|
const resultCustomer = await repos.orderInTransaction.findCustomerByOrderNumber({
|
|
51
52
|
orderNumber: { $eq: String(transaction.object.orderNumber) }
|
|
52
53
|
});
|
|
53
|
-
if (resultCustomer === undefined) {
|
|
54
|
-
|
|
55
|
-
}
|
|
54
|
+
// if (resultCustomer === undefined) {
|
|
55
|
+
// throw new factory.errors.Internal('resultCustomer undefined'); // impossible process
|
|
56
|
+
// }
|
|
56
57
|
// すでに確定済の場合
|
|
57
58
|
return {
|
|
58
59
|
...transaction.result,
|
|
@@ -80,7 +81,7 @@ function confirm(params, options) {
|
|
|
80
81
|
status: { $in: [factory.transactionStatusType.Confirmed, factory.transactionStatusType.InProgress] },
|
|
81
82
|
object: { orderDate: params.result.order.orderDate }
|
|
82
83
|
})(repos);
|
|
83
|
-
const transaction = await repos.
|
|
84
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: factory.transactionType.PlaceOrder, id: params.id }, ['typeOf', 'project', 'status', 'agent', 'seller', 'object', 'result']);
|
|
84
85
|
const confirmResult = await processTransactionNotInProgress(transaction)(repos);
|
|
85
86
|
if (confirmResult !== undefined) {
|
|
86
87
|
return confirmResult;
|
|
@@ -95,7 +96,7 @@ function confirm(params, options) {
|
|
|
95
96
|
acceptPayActions = await searchAcceptPayActions(params)(repos);
|
|
96
97
|
}
|
|
97
98
|
// 注文番号を発行
|
|
98
|
-
const orderNumber = await (0,
|
|
99
|
+
const orderNumber = await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
99
100
|
project: { id: transaction.project.id },
|
|
100
101
|
id: transaction.id,
|
|
101
102
|
object: { orderDate: params.result.order.orderDate }
|
|
@@ -179,7 +180,7 @@ function confirm(params, options) {
|
|
|
179
180
|
})(repos);
|
|
180
181
|
// ステータス変更
|
|
181
182
|
try {
|
|
182
|
-
await repos.
|
|
183
|
+
await repos.placeOrder.confirmPlaceOrder({
|
|
183
184
|
typeOf: transaction.typeOf,
|
|
184
185
|
id: transaction.id,
|
|
185
186
|
result: result,
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { SettingRepo } from '../../../repo/setting';
|
|
2
2
|
import type { TaskRepo } from '../../../repo/task';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
4
|
+
interface IExportTasksByIdRepos {
|
|
5
5
|
setting: SettingRepo;
|
|
6
6
|
task: TaskRepo;
|
|
7
|
-
|
|
8
|
-
}
|
|
7
|
+
placeOrder: PlaceOrderRepo;
|
|
8
|
+
}
|
|
9
|
+
type ITaskAndTransactionOperation<T> = (repos: IExportTasksByIdRepos) => Promise<T>;
|
|
9
10
|
/**
|
|
10
11
|
* 取引のタスクを出力します
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
declare function exportTasksById(params: {
|
|
13
14
|
id: string;
|
|
14
15
|
/**
|
|
15
16
|
* タスク実行日時バッファ
|
|
@@ -20,4 +21,4 @@ export declare function exportTasksById(params: {
|
|
|
20
21
|
*/
|
|
21
22
|
optimizeRedundantTasks: boolean;
|
|
22
23
|
}): ITaskAndTransactionOperation<void>;
|
|
23
|
-
export {};
|
|
24
|
+
export { IExportTasksByIdRepos, exportTasksById };
|
|
@@ -38,7 +38,7 @@ function exportTasksById(params) {
|
|
|
38
38
|
return async (repos
|
|
39
39
|
// settings: Settings
|
|
40
40
|
) => {
|
|
41
|
-
const transaction = await repos.
|
|
41
|
+
const transaction = await repos.placeOrder.findPlaceOrderById({
|
|
42
42
|
typeOf: factory.transactionType.PlaceOrder,
|
|
43
43
|
id: params.id
|
|
44
44
|
}, ['endDate', 'object', 'project', 'seller', 'startDate', 'status', 'typeOf']);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
2
2
|
import type { ProjectRepo } from '../../../repo/project';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
4
4
|
/**
|
|
5
5
|
* 未発行であれば、注文番号を発行して取引に保管する
|
|
6
6
|
*/
|
|
7
|
-
declare function
|
|
7
|
+
declare function issueOrderNumberIfNotExist(params: {
|
|
8
8
|
project: {
|
|
9
9
|
id: string;
|
|
10
10
|
};
|
|
@@ -17,7 +17,7 @@ declare function publishOrderNumberIfNotExist(params: {
|
|
|
17
17
|
};
|
|
18
18
|
}): (repos: {
|
|
19
19
|
project: ProjectRepo;
|
|
20
|
-
|
|
20
|
+
placeOrder: PlaceOrderRepo;
|
|
21
21
|
orderNumber: OrderNumberRepo;
|
|
22
22
|
}) => Promise<string>;
|
|
23
|
-
export {
|
|
23
|
+
export { issueOrderNumberIfNotExist };
|
|
@@ -23,36 +23,44 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.issueOrderNumberIfNotExist = issueOrderNumberIfNotExist;
|
|
27
27
|
const factory = __importStar(require("../../../factory"));
|
|
28
28
|
/**
|
|
29
29
|
* 未発行であれば、注文番号を発行して取引に保管する
|
|
30
30
|
*/
|
|
31
|
-
function
|
|
31
|
+
function issueOrderNumberIfNotExist(params) {
|
|
32
32
|
return async (repos) => {
|
|
33
|
-
//
|
|
34
|
-
let orderNumber = await repos.
|
|
33
|
+
// 1. 最初のチェック
|
|
34
|
+
let orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.id });
|
|
35
35
|
// すでに発行済であれば何もしない
|
|
36
36
|
if (typeof orderNumber === 'string') {
|
|
37
37
|
return orderNumber;
|
|
38
38
|
}
|
|
39
|
-
//
|
|
39
|
+
// 2. 発行準備
|
|
40
40
|
const { alternateName } = await repos.project.findAlternateNameById({ id: params.project.id });
|
|
41
41
|
if (typeof alternateName !== 'string') {
|
|
42
42
|
throw new factory.errors.NotFound('project.alternateName');
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
// 3. 番号発行
|
|
45
|
+
const issuedOrderNumber = await repos.orderNumber.issueOrderNumber({
|
|
45
46
|
project: { alternateName },
|
|
46
47
|
orderDate: params.object.orderDate
|
|
47
48
|
});
|
|
48
|
-
//
|
|
49
|
-
await repos.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
//
|
|
49
|
+
// 4. 保管を試みる
|
|
50
|
+
const { modifiedCount } = await repos.placeOrder.saveOrderNumberIfNotExist({
|
|
51
|
+
id: params.id,
|
|
52
|
+
orderNumber: issuedOrderNumber
|
|
53
|
+
});
|
|
54
|
+
// 5. 書き込めたなら、自分が発行した番号が「真実」
|
|
55
|
+
if (modifiedCount === 1) {
|
|
56
|
+
return issuedOrderNumber;
|
|
57
|
+
}
|
|
58
|
+
// 6. 競合が発生した場合(他者が先に書き込んだ場合)
|
|
59
|
+
// DBにある「正解」を再取得して返す
|
|
60
|
+
orderNumber = await repos.placeOrder.findInProgressOrderNumberById({ id: params.id });
|
|
54
61
|
if (typeof orderNumber !== 'string') {
|
|
55
|
-
|
|
62
|
+
// ここを通るのは、他者が保存した直後に取引がキャンセル/削除された等の極めて稀なケース
|
|
63
|
+
throw new factory.errors.Internal('OrderNumber conflict: failed to retrieve existing number');
|
|
56
64
|
}
|
|
57
65
|
return orderNumber;
|
|
58
66
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfirmationNumberRepo } from '../../../repo/confirmationNumber';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
3
3
|
import * as factory from '../../../factory';
|
|
4
4
|
/**
|
|
5
5
|
* 未発行であれば、注文の確認番号を発行して取引に保管する
|
|
@@ -16,7 +16,7 @@ declare function publishConfirmationNumberIfNotExist(params: {
|
|
|
16
16
|
orderDate: Date;
|
|
17
17
|
};
|
|
18
18
|
}): (repos: {
|
|
19
|
-
|
|
19
|
+
placeOrder: PlaceOrderRepo;
|
|
20
20
|
confirmationNumber: ConfirmationNumberRepo;
|
|
21
21
|
}) => Promise<string>;
|
|
22
22
|
export { publishConfirmationNumberIfNotExist };
|
|
@@ -30,7 +30,7 @@ const factory = __importStar(require("../../../factory"));
|
|
|
30
30
|
*/
|
|
31
31
|
function publishConfirmationNumberIfNotExist(params) {
|
|
32
32
|
return async (repos) => {
|
|
33
|
-
let confirmationNumber = await repos.
|
|
33
|
+
let confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
34
34
|
id: params.id,
|
|
35
35
|
status: { $in: params.status.$in }
|
|
36
36
|
});
|
|
@@ -41,13 +41,13 @@ function publishConfirmationNumberIfNotExist(params) {
|
|
|
41
41
|
// 確認番号を発行
|
|
42
42
|
confirmationNumber = await repos.confirmationNumber.publish({ orderDate: params.object.orderDate });
|
|
43
43
|
// 取引に存在しなければ保管
|
|
44
|
-
await repos.
|
|
44
|
+
await repos.placeOrder.saveConfirmationNumberIfNotExist({
|
|
45
45
|
id: params.id,
|
|
46
46
|
status: { $in: params.status.$in },
|
|
47
47
|
confirmationNumber
|
|
48
48
|
});
|
|
49
49
|
// 確認番号を取引から再取得
|
|
50
|
-
confirmationNumber = await repos.
|
|
50
|
+
confirmationNumber = await repos.placeOrder.findInProgressConfirmationNumberById({
|
|
51
51
|
id: params.id,
|
|
52
52
|
status: { $in: params.status.$in }
|
|
53
53
|
});
|
|
@@ -4,7 +4,7 @@ import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
|
4
4
|
import type { PassportRepo } from '../../../repo/passport';
|
|
5
5
|
import type { ProjectMakesOfferRepo } from '../../../repo/projectMakesOffer';
|
|
6
6
|
import type { SellerRepo } from '../../../repo/seller';
|
|
7
|
-
import type {
|
|
7
|
+
import type { IStartedPlaceOrder, PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
8
8
|
import { placeOrder as PlaceOrderFactory } from '../../../factory/transaction';
|
|
9
9
|
interface IStartOperationRepos {
|
|
10
10
|
issuer: IssuerRepo;
|
|
@@ -13,7 +13,7 @@ interface IStartOperationRepos {
|
|
|
13
13
|
passport: PassportRepo;
|
|
14
14
|
projectMakesOffer: ProjectMakesOfferRepo;
|
|
15
15
|
seller: SellerRepo;
|
|
16
|
-
|
|
16
|
+
placeOrder: PlaceOrderRepo;
|
|
17
17
|
}
|
|
18
18
|
type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
19
19
|
type IStartParams = PlaceOrderFactory.IStartParams;
|
|
@@ -23,5 +23,5 @@ interface IStartOptions {
|
|
|
23
23
|
/**
|
|
24
24
|
* 取引開始
|
|
25
25
|
*/
|
|
26
|
-
declare function start(params: IStartParams, options: IStartOptions): IStartOperation<
|
|
26
|
+
declare function start(params: IStartParams, options: IStartOptions): IStartOperation<IStartedPlaceOrder>;
|
|
27
27
|
export { start };
|
|
@@ -54,7 +54,7 @@ function start(params, options) {
|
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
56
|
// in case already locked
|
|
57
|
-
const alreadyStartedTransaction = (await repos.
|
|
57
|
+
const alreadyStartedTransaction = (await repos.placeOrder.findPlaceOrderTransactions({
|
|
58
58
|
limit: 1, page: 1,
|
|
59
59
|
typeOf: factory.transactionType.PlaceOrder,
|
|
60
60
|
project: { id: { $eq: startParams.project.id } },
|
|
@@ -72,7 +72,7 @@ function start(params, options) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
if (transaction === undefined) {
|
|
75
|
-
transaction = await repos.
|
|
75
|
+
transaction = await repos.placeOrder.startPlaceOrder(startParams);
|
|
76
76
|
}
|
|
77
77
|
return transaction;
|
|
78
78
|
};
|