mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-20 07:46:05 -04:00
Add reason entry to dispute result
This commit is contained in:
parent
6b16f2fbe7
commit
5535ee3167
@ -47,6 +47,13 @@ public final class DisputeResult implements Payload {
|
||||
STALE_MATE
|
||||
}
|
||||
|
||||
public enum Reason {
|
||||
BUG,
|
||||
USABILITY,
|
||||
SCAM,
|
||||
OTHER
|
||||
}
|
||||
|
||||
public final String tradeId;
|
||||
public final int traderId;
|
||||
private DisputeFeePolicy disputeFeePolicy;
|
||||
@ -64,6 +71,7 @@ public final class DisputeResult implements Payload {
|
||||
private byte[] arbitratorPubKey;
|
||||
private long closeDate;
|
||||
private Winner winner;
|
||||
private Reason reason;
|
||||
|
||||
transient private BooleanProperty tamperProofEvidenceProperty = new SimpleBooleanProperty();
|
||||
transient private BooleanProperty idVerificationProperty = new SimpleBooleanProperty();
|
||||
@ -137,7 +145,18 @@ public final class DisputeResult implements Payload {
|
||||
return disputeFeePolicy;
|
||||
}
|
||||
|
||||
public void setReason(Reason reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setSummaryNotes(String summaryNotes) {
|
||||
this.summaryNotesProperty.set(summaryNotes);
|
||||
}
|
||||
|
||||
public StringProperty summaryNotesProperty() {
|
||||
return summaryNotesProperty;
|
||||
}
|
||||
@ -231,6 +250,7 @@ public final class DisputeResult implements Payload {
|
||||
if (closeDate != that.closeDate) return false;
|
||||
if (tradeId != null ? !tradeId.equals(that.tradeId) : that.tradeId != null) return false;
|
||||
if (disputeFeePolicy != that.disputeFeePolicy) return false;
|
||||
if (reason != that.reason) return false;
|
||||
if (summaryNotes != null ? !summaryNotes.equals(that.summaryNotes) : that.summaryNotes != null) return false;
|
||||
if (disputeCommunicationMessage != null ? !disputeCommunicationMessage.equals(that.disputeCommunicationMessage) : that.disputeCommunicationMessage != null)
|
||||
return false;
|
||||
@ -247,6 +267,7 @@ public final class DisputeResult implements Payload {
|
||||
int result = tradeId != null ? tradeId.hashCode() : 0;
|
||||
result = 31 * result + traderId;
|
||||
result = 31 * result + (disputeFeePolicy != null ? disputeFeePolicy.hashCode() : 0);
|
||||
result = 31 * result + (reason != null ? reason.hashCode() : 0);
|
||||
result = 31 * result + (tamperProofEvidence ? 1 : 0);
|
||||
result = 31 * result + (idVerification ? 1 : 0);
|
||||
result = 31 * result + (screenCast ? 1 : 0);
|
||||
|
@ -201,8 +201,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
|
||||
stringBuilder.append("Summary of all disputes (Nr. of disputes: " + disputeGroups.size() + ")\n\n");
|
||||
disputeGroups.stream().forEach(disputeGroup -> {
|
||||
Dispute dispute0 = disputeGroup.get(0);
|
||||
stringBuilder
|
||||
.append("##########################################################################################/\n")
|
||||
stringBuilder.append("##########################################################################################/\n")
|
||||
.append("## Trade ID: ")
|
||||
.append(dispute0.getTradeId())
|
||||
.append("\n")
|
||||
@ -211,7 +210,13 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
|
||||
.append("\n")
|
||||
.append("## Is support ticket: ")
|
||||
.append(dispute0.isSupportTicket())
|
||||
.append("\n##########################################################################################/\n")
|
||||
.append("\n");
|
||||
if (dispute0.disputeResultProperty().get() != null && dispute0.disputeResultProperty().get().getReason() != null) {
|
||||
stringBuilder.append("## Reason: ")
|
||||
.append(dispute0.disputeResultProperty().get().getReason())
|
||||
.append("\n");
|
||||
}
|
||||
stringBuilder.append("##########################################################################################/\n")
|
||||
.append("\n");
|
||||
disputeGroup.stream().forEach(dispute -> {
|
||||
stringBuilder
|
||||
|
@ -70,16 +70,16 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
private ToggleGroup tradeAmountToggleGroup;
|
||||
private DisputeResult disputeResult;
|
||||
private RadioButton buyerIsWinnerRadioButton, sellerIsWinnerRadioButton, shareRadioButton, loserPaysFeeRadioButton, splitFeeRadioButton,
|
||||
waiveFeeRadioButton;
|
||||
waiveFeeRadioButton, reasonWasBugRadioButton, reasonWasUsabilityIssueRadioButton, reasonWasScamRadioButton, reasonWasOtherRadioButton;
|
||||
private Optional<Dispute> peersDisputeOptional;
|
||||
private Coin arbitratorPayoutAmount, winnerPayoutAmount, loserPayoutAmount, stalematePayoutAmount;
|
||||
private ToggleGroup feeToggleGroup;
|
||||
private ToggleGroup feeToggleGroup, reasonToggleGroup;
|
||||
private String role;
|
||||
private TextArea summaryNotesTextArea;
|
||||
private ObjectBinding<Tuple2<DisputeResult.DisputeFeePolicy, Toggle>> feePaymentPolicyChanged;
|
||||
private ChangeListener<Tuple2<DisputeResult.DisputeFeePolicy, Toggle>> feePaymentPolicyListener;
|
||||
private ChangeListener<Boolean> shareRadioButtonSelectedListener;
|
||||
private ChangeListener<Toggle> feeToggleSelectionListener;
|
||||
private ChangeListener<Toggle> feeToggleSelectionListener, reasonToggleSelectionListener;
|
||||
// keep a reference to not get GCed
|
||||
|
||||
|
||||
@ -127,6 +127,9 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
|
||||
if (feeToggleGroup != null)
|
||||
feeToggleGroup.selectedToggleProperty().removeListener(feeToggleSelectionListener);
|
||||
|
||||
if (reasonToggleGroup != null)
|
||||
reasonToggleGroup.selectedToggleProperty().removeListener(reasonToggleSelectionListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -169,6 +172,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
|
||||
addTradeAmountPayoutControls();
|
||||
addFeeControls();
|
||||
addReasonControls();
|
||||
|
||||
boolean applyPeersDisputeResult = peersDisputeOptional.isPresent() && peersDisputeOptional.get().isClosed();
|
||||
if (applyPeersDisputeResult) {
|
||||
@ -179,6 +183,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
disputeResult.setArbitratorPayoutAmount(peersDisputeResult.getArbitratorPayoutAmount());
|
||||
disputeResult.setDisputeFeePolicy(peersDisputeResult.getDisputeFeePolicy());
|
||||
disputeResult.setWinner(peersDisputeResult.getWinner());
|
||||
disputeResult.setReason(peersDisputeResult.getReason());
|
||||
disputeResult.setSummaryNotes(peersDisputeResult.summaryNotesProperty().get());
|
||||
|
||||
if (disputeResult.getBuyerPayoutAmount() != null) {
|
||||
log.debug("buyerPayoutAmount " + disputeResult.getBuyerPayoutAmount().toFriendlyString());
|
||||
@ -186,8 +192,6 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
log.debug("arbitratorPayoutAmount " + disputeResult.getArbitratorPayoutAmount().toFriendlyString());
|
||||
}
|
||||
|
||||
//setFeeRadioButtonState();
|
||||
|
||||
buyerIsWinnerRadioButton.setDisable(true);
|
||||
sellerIsWinnerRadioButton.setDisable(true);
|
||||
shareRadioButton.setDisable(true);
|
||||
@ -195,6 +199,11 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
splitFeeRadioButton.setDisable(true);
|
||||
waiveFeeRadioButton.setDisable(true);
|
||||
|
||||
reasonWasBugRadioButton.setDisable(true);
|
||||
reasonWasUsabilityIssueRadioButton.setDisable(true);
|
||||
reasonWasScamRadioButton.setDisable(true);
|
||||
reasonWasOtherRadioButton.setDisable(true);
|
||||
|
||||
calculatePayoutAmounts(disputeResult.getDisputeFeePolicy());
|
||||
applyTradeAmountRadioButtonStates();
|
||||
} else {
|
||||
@ -210,6 +219,7 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
}
|
||||
|
||||
setFeeRadioButtonState();
|
||||
setReasonRadioButtonState();
|
||||
|
||||
addSummaryNotes();
|
||||
addButtons(contract);
|
||||
@ -342,6 +352,62 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
|
||||
}
|
||||
}
|
||||
|
||||
private void addReasonControls() {
|
||||
Label label = addLabel(gridPane, ++rowIndex, "Reason of dispute:", 10);
|
||||
GridPane.setValignment(label, VPos.TOP);
|
||||
|
||||
reasonWasBugRadioButton = new RadioButton("Bug");
|
||||
reasonWasUsabilityIssueRadioButton = new RadioButton("Usability");
|
||||
reasonWasScamRadioButton = new RadioButton("Scam");
|
||||
reasonWasOtherRadioButton = new RadioButton("Other");
|
||||
|
||||
HBox feeRadioButtonPane = new HBox();
|
||||
feeRadioButtonPane.setSpacing(20);
|
||||
feeRadioButtonPane.getChildren().addAll(reasonWasBugRadioButton, reasonWasUsabilityIssueRadioButton,
|
||||
reasonWasScamRadioButton, reasonWasOtherRadioButton);
|
||||
GridPane.setRowIndex(feeRadioButtonPane, rowIndex);
|
||||
GridPane.setColumnIndex(feeRadioButtonPane, 1);
|
||||
GridPane.setMargin(feeRadioButtonPane, new Insets(10, 0, 10, 0));
|
||||
gridPane.getChildren().add(feeRadioButtonPane);
|
||||
|
||||
reasonToggleGroup = new ToggleGroup();
|
||||
reasonWasBugRadioButton.setToggleGroup(reasonToggleGroup);
|
||||
reasonWasUsabilityIssueRadioButton.setToggleGroup(reasonToggleGroup);
|
||||
reasonWasScamRadioButton.setToggleGroup(reasonToggleGroup);
|
||||
reasonWasOtherRadioButton.setToggleGroup(reasonToggleGroup);
|
||||
|
||||
reasonToggleSelectionListener = (observable, oldValue, newValue) -> {
|
||||
if (newValue == reasonWasBugRadioButton)
|
||||
disputeResult.setReason(DisputeResult.Reason.BUG);
|
||||
else if (newValue == reasonWasUsabilityIssueRadioButton)
|
||||
disputeResult.setReason(DisputeResult.Reason.USABILITY);
|
||||
else if (newValue == reasonWasScamRadioButton)
|
||||
disputeResult.setReason(DisputeResult.Reason.SCAM);
|
||||
else if (newValue == reasonWasOtherRadioButton)
|
||||
disputeResult.setReason(DisputeResult.Reason.OTHER);
|
||||
};
|
||||
reasonToggleGroup.selectedToggleProperty().addListener(reasonToggleSelectionListener);
|
||||
}
|
||||
|
||||
private void setReasonRadioButtonState() {
|
||||
if (disputeResult.getReason() != null) {
|
||||
switch (disputeResult.getReason()) {
|
||||
case BUG:
|
||||
reasonToggleGroup.selectToggle(reasonWasBugRadioButton);
|
||||
break;
|
||||
case USABILITY:
|
||||
reasonToggleGroup.selectToggle(reasonWasUsabilityIssueRadioButton);
|
||||
break;
|
||||
case SCAM:
|
||||
reasonToggleGroup.selectToggle(reasonWasScamRadioButton);
|
||||
break;
|
||||
case OTHER:
|
||||
reasonToggleGroup.selectToggle(reasonWasOtherRadioButton);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addSummaryNotes() {
|
||||
Label label = addLabel(gridPane, ++rowIndex, "Summary notes:", 0);
|
||||
GridPane.setValignment(label, VPos.TOP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user