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

BATM-5625: fix Coinbase Wallet response (#861) #862

Merged
merged 2 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# buildscript - project id
projectGroup=com.generalbytes.batm.public
projectVersion=1.2.1
projectVersion=1.2.2

# buildscript - common dependency versions
bitrafaelVersion=1.0.44
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,31 @@ private String getAccountId(String accountName, String cryptoCurrency) {
if (accountName != null) {
for (CBAccount cbAccount : accounts) {
if (accountName.equalsIgnoreCase(cbAccount.getName())) {
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency())) {
preferredCryptoCurrency = cbAccount.getCurrency();
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency().getCode())) {
preferredCryptoCurrency = cbAccount.getCurrency().getCode();
return cbAccount.getId();
}
}
}
} else {
for (CBAccount cbAccount : accounts) {
if (cbAccount.isPrimary()) {
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency())) {
preferredCryptoCurrency = cbAccount.getCurrency();
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency().getCode())) {
preferredCryptoCurrency = cbAccount.getCurrency().getCode();
return cbAccount.getId();
}
}
}
}
for (CBAccount cbAccount : accounts) {
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency())) {
preferredCryptoCurrency = cbAccount.getCurrency();
if (cryptoCurrency.equalsIgnoreCase(cbAccount.getCurrency().getCode())) {
preferredCryptoCurrency = cbAccount.getCurrency().getCode();
return cbAccount.getId();
}
}

CBAccount cbAccount = accounts.get(0);
preferredCryptoCurrency = cbAccount.getCurrency();
preferredCryptoCurrency = cbAccount.getCurrency().getCode();
return cbAccount.getId();
}

Expand All @@ -165,8 +165,7 @@ public String getCryptoAddress(String cryptoCurrency) {
String network = getNetworkName(cryptoCurrency);
CBAddress address = null;
if (network != null) {
for (int i = 0; i < addresses.size(); i++) {
CBAddress a = addresses.get(i);
for (CBAddress a : addresses) {
if (a.getNetwork().equalsIgnoreCase(network)) {
address = a;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CBAccount implements CBPaginatedItem {
private boolean primary;
private boolean ready;
private String type;
private String currency;
private CBCurrency currency;
private CBBalance balance;
private CBBalance native_balance;

Expand Down Expand Up @@ -127,11 +127,11 @@ public void setType(String type) {
this.type = type;
}

public String getCurrency() {
public CBCurrency getCurrency() {
return currency;
}

public void setCurrency(String currency) {
public void setCurrency(CBCurrency currency) {
this.currency = currency;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*************************************************************************************
* Copyright (C) 2014-2023 GENERAL BYTES s.r.o. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
* Foundation and appearing in the file GPL2.TXT included in the packaging of
* this file. Please note that GPL2 Section 2[b] requires that all works based
* on this software must also be made publicly available under the terms of
* the GPL2 ("Copyleft").
*
* Contact information
* -------------------
*
* GENERAL BYTES s.r.o.
* Web : http://www.generalbytes.com
*
************************************************************************************/

package com.generalbytes.batm.server.extensions.extra.bitcoin.wallets.coinbase.v2.dto;

public class CBCurrency {
private String code;
private String name;
private String color;
private Integer exponent;
private String type;

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getColor() {
return color;
}

public void setColor(String color) {
this.color = color;
}

public Integer getExponent() {
return exponent;
}

public void setExponent(Integer exponent) {
this.exponent = exponent;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

@Override
public String toString() {
return "CBCurrency{" +
"code=" + getCode() +
", name='" + getName() + "'" +
", color='" + getColor() + "'" +
", exponent='" + getExponent() + "'" +
", type='" + getType() + "'" +
'}';
}
}
Loading