Restore proto order and add backward compatibility

This commit is contained in:
BtcContributor 2021-05-18 18:10:20 +02:00
parent 2809e8d768
commit 8dfe2601df
No known key found for this signature in database
GPG Key ID: DA582457496C7F6D
3 changed files with 23 additions and 6 deletions

View File

@ -19,6 +19,8 @@ package bisq.core.payment.payload;
import bisq.core.locale.Res;
import bisq.common.util.JsonExclude;
import com.google.protobuf.Message;
import java.nio.charset.StandardCharsets;
@ -39,6 +41,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public final class UpholdAccountPayload extends PaymentAccountPayload {
private String accountId = "";
// For backward compatibility we need to exclude the new field from the contract json.
@JsonExclude
private String accountOwner = "";
public UpholdAccountPayload(String paymentMethod, String id) {
@ -95,9 +100,15 @@ public final class UpholdAccountPayload extends PaymentAccountPayload {
@Override
public String getPaymentDetailsForTradePopup() {
return
Res.get("payment.account") + ": " + accountId + "\n" +
Res.get("payment.account.owner") + ": " + accountOwner;
if (accountOwner != "") {
return
Res.get("payment.account") + ": " + accountId + "\n" +
Res.get("payment.account.owner") + ": " + accountOwner;
} else {
return
Res.get("payment.account") + ": " + accountId + "\n" +
Res.get("payment.account.owner") + ": N/A";
}
}
@Override

View File

@ -47,10 +47,16 @@ public class UpholdForm extends PaymentMethodForm {
public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) {
String accountOwner = ((UpholdAccountPayload) paymentAccountPayload).getAccountOwner();
if (accountOwner.isEmpty()) {
accountOwner = Res.get("payment.ask");
}
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner"),
((UpholdAccountPayload) paymentAccountPayload).getAccountOwner());
accountOwner);
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.uphold.accountId"),
((UpholdAccountPayload) paymentAccountPayload).getAccountId());
return gridRow;
}

View File

@ -1132,8 +1132,8 @@ message OKPayAccountPayload {
}
message UpholdAccountPayload {
string account_owner = 1;
string account_id = 2;
string account_id = 1;
string account_owner = 2;
}
// Deprecated, not used anymore