From 378134c413e49457e4daf25ff985a5e18d7bd158 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 18 Feb 2018 19:38:44 -0500 Subject: [PATCH] Add holder name to venmo --- common/src/main/proto/pb.proto | 3 ++- .../java/io/bisq/core/payment/VenmoAccount.java | 8 ++++++++ .../core/payment/payload/VenmoAccountPayload.java | 7 ++++++- .../gui/components/paymentmethods/VenmoForm.java | 13 +++++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/common/src/main/proto/pb.proto b/common/src/main/proto/pb.proto index 9044d51b46c..adbb99ffaff 100644 --- a/common/src/main/proto/pb.proto +++ b/common/src/main/proto/pb.proto @@ -949,7 +949,7 @@ message UpholdAccountPayload { } message CashAppAccountPayload { - string account_id = 1; + string cash_tag = 1; } message MoneyBeamAccountPayload { @@ -958,6 +958,7 @@ message MoneyBeamAccountPayload { message VenmoAccountPayload { string venmo_user_name = 1; + string holder_name = 2; } message PerfectMoneyAccountPayload { diff --git a/core/src/main/java/io/bisq/core/payment/VenmoAccount.java b/core/src/main/java/io/bisq/core/payment/VenmoAccount.java index 33578a01771..fd64e50d49c 100644 --- a/core/src/main/java/io/bisq/core/payment/VenmoAccount.java +++ b/core/src/main/java/io/bisq/core/payment/VenmoAccount.java @@ -43,4 +43,12 @@ public void setVenmoUserName(String venmoUserName) { public String getVenmoUserName() { return ((VenmoAccountPayload) paymentAccountPayload).getVenmoUserName(); } + + public void setHolderName(String holderName) { + ((VenmoAccountPayload) paymentAccountPayload).setHolderName(holderName); + } + + public String getHolderName() { + return ((VenmoAccountPayload) paymentAccountPayload).getHolderName(); + } } diff --git a/core/src/main/java/io/bisq/core/payment/payload/VenmoAccountPayload.java b/core/src/main/java/io/bisq/core/payment/payload/VenmoAccountPayload.java index cc9d2c04f6b..a240325d8cc 100644 --- a/core/src/main/java/io/bisq/core/payment/payload/VenmoAccountPayload.java +++ b/core/src/main/java/io/bisq/core/payment/payload/VenmoAccountPayload.java @@ -37,6 +37,7 @@ @Slf4j public final class VenmoAccountPayload extends PaymentAccountPayload { private String venmoUserName = ""; + private String holderName = ""; public VenmoAccountPayload(String paymentMethod, String id) { super(paymentMethod, id); @@ -50,6 +51,7 @@ public VenmoAccountPayload(String paymentMethod, String id) { private VenmoAccountPayload(String paymentMethod, String id, String venmoUserName, + String holderName, long maxTradePeriod, Map excludeFromJsonDataMap) { super(paymentMethod, @@ -58,13 +60,15 @@ private VenmoAccountPayload(String paymentMethod, excludeFromJsonDataMap); this.venmoUserName = venmoUserName; + this.holderName = holderName; } @Override public Message toProtoMessage() { return getPaymentAccountPayloadBuilder() .setVenmoAccountPayload(PB.VenmoAccountPayload.newBuilder() - .setVenmoUserName(venmoUserName)) + .setVenmoUserName(venmoUserName) + .setHolderName(holderName)) .build(); } @@ -72,6 +76,7 @@ public static VenmoAccountPayload fromProto(PB.PaymentAccountPayload proto) { return new VenmoAccountPayload(proto.getPaymentMethodId(), proto.getId(), proto.getVenmoAccountPayload().getVenmoUserName(), + proto.getVenmoAccountPayload().getHolderName(), proto.getMaxTradePeriod(), CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); } diff --git a/gui/src/main/java/io/bisq/gui/components/paymentmethods/VenmoForm.java b/gui/src/main/java/io/bisq/gui/components/paymentmethods/VenmoForm.java index c500cb40703..645ff8544c9 100644 --- a/gui/src/main/java/io/bisq/gui/components/paymentmethods/VenmoForm.java +++ b/gui/src/main/java/io/bisq/gui/components/paymentmethods/VenmoForm.java @@ -41,6 +41,8 @@ public class VenmoForm extends PaymentMethodForm { private InputTextField accountIdInputTextField; public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { + addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), + ((VenmoAccountPayload) paymentAccountPayload).getHolderName()); addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.venmo.venmoUserName"), ((VenmoAccountPayload) paymentAccountPayload).getVenmoUserName()); return gridRow; } @@ -55,6 +57,14 @@ public VenmoForm(PaymentAccount paymentAccount, AccountAgeWitnessService account public void addFormForAddAccount() { gridRowFrom = gridRow + 1; + InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, + Res.getWithCol("payment.account.owner")).second; + holderNameInputTextField.setValidator(inputValidator); + holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { + account.setHolderName(newValue); + updateFromInputs(); + }); + accountIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.venmo.venmoUserName")).second; accountIdInputTextField.setValidator(validator); accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { @@ -84,6 +94,8 @@ public void addFormForDisplayAccount() { gridRowFrom = gridRow; addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), account.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId())); + addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), + account.getHolderName()); TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.venmo.venmoUserName"), account.getVenmoUserName()).second; field.setMouseTransparent(false); final TradeCurrency singleTradeCurrency = account.getSingleTradeCurrency(); @@ -95,6 +107,7 @@ public void addFormForDisplayAccount() { @Override public void updateAllInputsValid() { allInputsValid.set(isAccountNameValid() + && inputValidator.validate(account.getHolderName()).isValid && validator.validate(account.getVenmoUserName()).isValid && account.getTradeCurrencies().size() > 0); }