Skip to content

Commit

Permalink
Add holder name to venmo
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Feb 19, 2018
1 parent a129d06 commit 378134c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion common/src/main/proto/pb.proto
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ message UpholdAccountPayload {
}

message CashAppAccountPayload {
string account_id = 1;
string cash_tag = 1;
}

message MoneyBeamAccountPayload {
Expand All @@ -958,6 +958,7 @@ message MoneyBeamAccountPayload {

message VenmoAccountPayload {
string venmo_user_name = 1;
string holder_name = 2;
}

message PerfectMoneyAccountPayload {
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/io/bisq/core/payment/VenmoAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -50,6 +51,7 @@ public VenmoAccountPayload(String paymentMethod, String id) {
private VenmoAccountPayload(String paymentMethod,
String id,
String venmoUserName,
String holderName,
long maxTradePeriod,
Map<String, String> excludeFromJsonDataMap) {
super(paymentMethod,
Expand All @@ -58,20 +60,23 @@ 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();
}

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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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) -> {
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down

0 comments on commit 378134c

Please sign in to comment.