Don't unfail if deposit or delayedpayout txs are missing

This commit is contained in:
sqrrm 2020-04-10 16:40:17 +02:00
parent 817819dc51
commit 486f254773
No known key found for this signature in database
GPG key ID: 45235F9EF87089EC
2 changed files with 17 additions and 2 deletions

View file

@ -864,6 +864,8 @@ portfolio.failed.unfail=Before proceeding, make sure you have a backup of your d
This is a way to unlock funds stuck in a failed trade.
portfolio.failed.cantUnfail=This trade cannot be moved back to open trades at the moment. \n\
Try again after completion of trade(s) {0}
portfolio.failed.depositTxNull=The trade cannot be completed. Deposit transaction is null
portfolio.failed.delayedPayoutTxNull=The trade cannot be completed. Delayed payout transaction is null
####################################################################

View file

@ -108,10 +108,13 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
keyEventEventHandler = keyEvent -> {
if (Utilities.isAltOrCtrlPressed(KeyCode.Y, keyEvent)) {
var checkTxs = checkTxs();
var checkUnfailString = checkUnfail();
if (!checkUnfailString.isEmpty()) {
if (!checkTxs.isEmpty()) {
new Popup().warning(checkTxs)
.show();
} else if (!checkUnfailString.isEmpty()) {
new Popup().warning(Res.get("portfolio.failed.cantUnfail", checkUnfailString))
.onAction(this::onUnfail)
.show();
} else {
new Popup().warning(Res.get("portfolio.failed.unfail"))
@ -131,7 +134,17 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
private String checkUnfail() {
Trade trade = sortedList.get(tableView.getSelectionModel().getFocusedIndex()).getTrade();
return model.dataModel.checkUnfail(trade);
}
private String checkTxs() {
Trade trade = sortedList.get(tableView.getSelectionModel().getFocusedIndex()).getTrade();
if (trade.getDepositTx() == null) {
return Res.get("portfolio.failed.depositTxNull");
}
if (trade.getDelayedPayoutTx() == null) {
return Res.get("portfolio.failed.delayedPayoutTxNull");
}
return "";
}
@Override