Skip to content

Commit

Permalink
Do not change case of input params in client
Browse files Browse the repository at this point in the history
This commit is for a change requested in PR 4308:
bisq-network#4308 (review)

  ".toUpperCase() seems misplaced here. It would soon get repetive.
  Whether the underlying logic differentiates between capitalizations
  is a low-level implementation detail and would do better at the
  lowest practical level."
  • Loading branch information
ghubstan authored and eigentsmis committed Jun 26, 2020
1 parent eef9811 commit 2392225
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cli/src/main/java/bisq/cli/CliMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ public static void run(String[] args) {
if (nonOptionArgs.size() < 2)
throw new IllegalArgumentException("no buy/sell direction specified");

var direction = nonOptionArgs.get(1).toUpperCase();
if (!direction.equals("BUY") && !direction.equals("SELL"))
var direction = nonOptionArgs.get(1);
if (!direction.equalsIgnoreCase("BUY") && !direction.equalsIgnoreCase("SELL"))
throw new IllegalArgumentException("no buy/sell direction specified");

if (nonOptionArgs.size() < 3)
throw new IllegalArgumentException("no fiat currency specified");

var fiatCurrency = nonOptionArgs.get(2).toUpperCase();
var fiatCurrency = nonOptionArgs.get(2);

var request = GetOffersRequest.newBuilder()
.setDirection(direction)
Expand All @@ -215,7 +215,7 @@ public static void run(String[] args) {
if (nonOptionArgs.size() < 4)
throw new IllegalArgumentException("no fiat currency specified");

var fiatCurrencyCode = nonOptionArgs.get(3).toUpperCase();
var fiatCurrencyCode = nonOptionArgs.get(3);

var request = CreatePaymentAccountRequest.newBuilder()
.setAccountName(accountName)
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/bisq/core/grpc/CoreOffersService.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public CoreOffersService(CreateOfferService createOfferService,

public List<Offer> getOffers(String direction, String fiatCurrencyCode) {
List<Offer> offers = offerBookService.getOffers().stream()
.filter(o -> !o.getDirection().name().equals(direction)
&& o.getOfferPayload().getCounterCurrencyCode().equals(fiatCurrencyCode))
.filter(o -> !o.getDirection().name().equalsIgnoreCase(direction)
&& o.getOfferPayload().getCounterCurrencyCode().equalsIgnoreCase(fiatCurrencyCode))
.collect(Collectors.toList());

if (direction.equals(BUY.name()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void createPaymentAccount(String accountName, String accountNumber, Strin
paymentAccount.init();
paymentAccount.setAccountName(accountName);
((PerfectMoneyAccount) paymentAccount).setAccountNr(accountNumber);
paymentAccount.setSingleTradeCurrency(new FiatCurrency(fiatCurrencyCode));
paymentAccount.setSingleTradeCurrency(new FiatCurrency(fiatCurrencyCode.toUpperCase()));
user.addPaymentAccount(paymentAccount);

// Don't do this on mainnet until thoroughly tested.
Expand Down

0 comments on commit 2392225

Please sign in to comment.