mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Merge pull request #5500 from BtcContributor/fix_uphold
Add Account owner full name field to Uphold payment method
This commit is contained in:
commit
7883df2977
4 changed files with 50 additions and 2 deletions
|
@ -44,4 +44,15 @@ public final class UpholdAccount extends PaymentAccount {
|
|||
public String getAccountId() {
|
||||
return ((UpholdAccountPayload) paymentAccountPayload).getAccountId();
|
||||
}
|
||||
|
||||
public String getAccountOwner() {
|
||||
return ((UpholdAccountPayload) paymentAccountPayload).getAccountOwner();
|
||||
}
|
||||
|
||||
public void setAccountOwner(String accountOwner) {
|
||||
if (accountOwner == null) {
|
||||
accountOwner = "";
|
||||
}
|
||||
((UpholdAccountPayload) paymentAccountPayload).setAccountOwner(accountOwner);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -40,6 +42,10 @@ import lombok.extern.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) {
|
||||
super(paymentMethod, id);
|
||||
}
|
||||
|
@ -52,6 +58,7 @@ public final class UpholdAccountPayload extends PaymentAccountPayload {
|
|||
private UpholdAccountPayload(String paymentMethod,
|
||||
String id,
|
||||
String accountId,
|
||||
String accountOwner,
|
||||
long maxTradePeriod,
|
||||
Map<String, String> excludeFromJsonDataMap) {
|
||||
super(paymentMethod,
|
||||
|
@ -60,12 +67,14 @@ public final class UpholdAccountPayload extends PaymentAccountPayload {
|
|||
excludeFromJsonDataMap);
|
||||
|
||||
this.accountId = accountId;
|
||||
this.accountOwner = accountOwner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message toProtoMessage() {
|
||||
return getPaymentAccountPayloadBuilder()
|
||||
.setUpholdAccountPayload(protobuf.UpholdAccountPayload.newBuilder()
|
||||
.setAccountOwner(accountOwner)
|
||||
.setAccountId(accountId))
|
||||
.build();
|
||||
}
|
||||
|
@ -74,6 +83,7 @@ public final class UpholdAccountPayload extends PaymentAccountPayload {
|
|||
return new UpholdAccountPayload(proto.getPaymentMethodId(),
|
||||
proto.getId(),
|
||||
proto.getUpholdAccountPayload().getAccountId(),
|
||||
proto.getUpholdAccountPayload().getAccountOwner(),
|
||||
proto.getMaxTradePeriod(),
|
||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||
}
|
||||
|
@ -85,12 +95,20 @@ public final class UpholdAccountPayload extends PaymentAccountPayload {
|
|||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.account") + " " + accountId;
|
||||
return Res.get(paymentMethodId) + " - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return getPaymentDetails();
|
||||
if (accountOwner.isEmpty()) {
|
||||
return
|
||||
Res.get("payment.account") + ": " + accountId + "\n" +
|
||||
Res.get("payment.account.owner") + ": N/A";
|
||||
} else {
|
||||
return
|
||||
Res.get("payment.account") + ": " + accountId + "\n" +
|
||||
Res.get("payment.account.owner") + ": " + accountOwner;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,8 +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"),
|
||||
accountOwner);
|
||||
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.uphold.accountId"),
|
||||
((UpholdAccountPayload) paymentAccountPayload).getAccountId());
|
||||
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
|
@ -64,6 +72,14 @@ public class UpholdForm extends PaymentMethodForm {
|
|||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
|
||||
Res.get("payment.account.owner"));
|
||||
holderNameInputTextField.setValidator(inputValidator);
|
||||
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
upholdAccount.setAccountOwner(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
accountIdInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.uphold.accountId"));
|
||||
accountIdInputTextField.setValidator(upholdValidator);
|
||||
accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
|
@ -102,6 +118,8 @@ public class UpholdForm extends PaymentMethodForm {
|
|||
upholdAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(upholdAccount.getPaymentMethod().getId()));
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"),
|
||||
Res.get(upholdAccount.getAccountOwner()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.uphold.accountId"),
|
||||
upholdAccount.getAccountId()).second;
|
||||
field.setMouseTransparent(false);
|
||||
|
|
|
@ -1133,6 +1133,7 @@ message OKPayAccountPayload {
|
|||
|
||||
message UpholdAccountPayload {
|
||||
string account_id = 1;
|
||||
string account_owner = 2;
|
||||
}
|
||||
|
||||
// Deprecated, not used anymore
|
||||
|
|
Loading…
Add table
Reference in a new issue