mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-24 14:50:28 -04:00
fix custom amounts for dispute result
This commit is contained in:
parent
85ee6787cd
commit
dd65cdca13
1 changed files with 22 additions and 1 deletions
|
@ -25,6 +25,7 @@ import haveno.common.handlers.ResultHandler;
|
|||
import haveno.common.util.Tuple2;
|
||||
import haveno.common.util.Tuple3;
|
||||
import haveno.core.api.CoreDisputesService;
|
||||
import haveno.core.api.CoreDisputesService.PayoutSuggestion;
|
||||
import haveno.core.locale.Res;
|
||||
import haveno.core.support.SupportType;
|
||||
import haveno.core.support.dispute.Dispute;
|
||||
|
@ -138,6 +139,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||
public void show(Dispute dispute) {
|
||||
this.dispute = dispute;
|
||||
this.trade = tradeManager.getTrade(dispute.getTradeId());
|
||||
this.payoutSuggestion = null;
|
||||
|
||||
rowIndex = -1;
|
||||
width = 1150;
|
||||
|
@ -243,7 +245,6 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||
reasonWasPeerWasLateRadioButton.setDisable(true);
|
||||
reasonWasTradeAlreadySettledRadioButton.setDisable(true);
|
||||
|
||||
applyPayoutAmounts(tradeAmountToggleGroup.selectedToggleProperty().get());
|
||||
applyTradeAmountRadioButtonStates();
|
||||
}
|
||||
|
||||
|
@ -724,6 +725,10 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||
|
||||
private void applyTradeAmountRadioButtonStates() {
|
||||
|
||||
if (payoutSuggestion == null) {
|
||||
payoutSuggestion = getPayoutSuggestionFromDisputeResult();
|
||||
}
|
||||
|
||||
BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmountBeforeCost();
|
||||
BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmountBeforeCost();
|
||||
|
||||
|
@ -748,4 +753,20 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Persist the payout suggestion to DisputeResult like Bisq upstream?
|
||||
// That would be a better design, but it's not currently needed.
|
||||
private PayoutSuggestion getPayoutSuggestionFromDisputeResult() {
|
||||
if (disputeResult.getBuyerPayoutAmountBeforeCost().equals(BigInteger.ZERO)) {
|
||||
return PayoutSuggestion.SELLER_GETS_ALL;
|
||||
} else if (disputeResult.getSellerPayoutAmountBeforeCost().equals(BigInteger.ZERO)) {
|
||||
return PayoutSuggestion.BUYER_GETS_ALL;
|
||||
} else if (disputeResult.getBuyerPayoutAmountBeforeCost().equals(trade.getAmount().add(trade.getBuyer().getSecurityDeposit()))) {
|
||||
return PayoutSuggestion.BUYER_GETS_TRADE_AMOUNT;
|
||||
} else if (disputeResult.getSellerPayoutAmountBeforeCost().equals(trade.getAmount().add(trade.getSeller().getSecurityDeposit()))) {
|
||||
return PayoutSuggestion.SELLER_GETS_TRADE_AMOUNT;
|
||||
} else {
|
||||
return PayoutSuggestion.CUSTOM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue