Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Account owner full name field to Uphold payment method #5500

Merged
merged 5 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions core/src/main/java/bisq/core/payment/UpholdAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ public void setAccountId(String accountId) {
public String getAccountId() {
return ((UpholdAccountPayload) paymentAccountPayload).getAccountId();
}

public String getAccountOwner() {
BtcContributor marked this conversation as resolved.
Show resolved Hide resolved
return ((UpholdAccountPayload) paymentAccountPayload).getAccountOwner();
}

public void setAccountOwner(String accountOwner) {
if (accountOwner == null) accountOwner = "";
BtcContributor marked this conversation as resolved.
Show resolved Hide resolved
((UpholdAccountPayload) paymentAccountPayload).setAccountOwner(accountOwner);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@Slf4j
public final class UpholdAccountPayload extends PaymentAccountPayload {
private String accountId = "";
private String accountOwner = "";

public UpholdAccountPayload(String paymentMethod, String id) {
super(paymentMethod, id);
Expand All @@ -52,6 +53,7 @@ public UpholdAccountPayload(String paymentMethod, String id) {
private UpholdAccountPayload(String paymentMethod,
String id,
String accountId,
String accountOwner,
long maxTradePeriod,
Map<String, String> excludeFromJsonDataMap) {
super(paymentMethod,
Expand All @@ -60,12 +62,14 @@ private UpholdAccountPayload(String paymentMethod,
excludeFromJsonDataMap);

this.accountId = accountId;
this.accountOwner = accountOwner;
}

@Override
public Message toProtoMessage() {
return getPaymentAccountPayloadBuilder()
.setUpholdAccountPayload(protobuf.UpholdAccountPayload.newBuilder()
.setAccountOwner(accountOwner)
.setAccountId(accountId))
.build();
}
Expand All @@ -74,6 +78,7 @@ public static UpholdAccountPayload fromProto(protobuf.PaymentAccountPayload prot
return new UpholdAccountPayload(proto.getPaymentMethodId(),
proto.getId(),
proto.getUpholdAccountPayload().getAccountId(),
proto.getUpholdAccountPayload().getAccountOwner(),
proto.getMaxTradePeriod(),
new HashMap<>(proto.getExcludeFromJsonDataMap()));
}
Expand All @@ -85,12 +90,14 @@ public static UpholdAccountPayload fromProto(protobuf.PaymentAccountPayload prot

@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();
return
Res.get("payment.account") + ": " + accountId + "\n" +
Res.get("payment.account.owner") + ": " + accountOwner;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class UpholdForm extends PaymentMethodForm {

public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) {
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner"),
((UpholdAccountPayload) paymentAccountPayload).getAccountOwner());
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.uphold.accountId"),
((UpholdAccountPayload) paymentAccountPayload).getAccountId());
return gridRow;
Expand All @@ -64,6 +66,14 @@ public UpholdForm(PaymentAccount paymentAccount, AccountAgeWitnessService accoun
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) -> {
Expand Down
3 changes: 2 additions & 1 deletion proto/src/main/proto/pb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,8 @@ message OKPayAccountPayload {
}

message UpholdAccountPayload {
string account_id = 1;
string account_owner = 1;
string account_id = 2;
BtcContributor marked this conversation as resolved.
Show resolved Hide resolved
}

// Deprecated, not used anymore
Expand Down