Merge branch 'master' of github.com:romanornr/batm_public
This commit is contained in:
commit
a303cd7065
|
@ -26,14 +26,14 @@ import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
public class ViacoinExtentsion implements IExtension{
|
||||
public class ViacoinExtension implements IExtension{
|
||||
@Override
|
||||
public String getName(){
|
||||
return "BATM Viacoin extension";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IExchange createExchange(string exchangeLogin){
|
||||
public IExchange createExchange(String exchangeLogin){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class ViacoinExtentsion implements IExtension{
|
|||
if("viacoind".equalsIgnoreCase(walletType)){
|
||||
//"viacoind::protocol:user:password:ip:port:accountname"
|
||||
|
||||
String protcol = st.nextToken();
|
||||
String protocol = st.nextToken();
|
||||
String username = st.nextToken();
|
||||
String password = st.nextToken();
|
||||
String hostname = st.nextToken();
|
||||
|
@ -57,9 +57,9 @@ public class ViacoinExtentsion implements IExtension{
|
|||
}
|
||||
|
||||
|
||||
if (protocol != null && username != null && password != null && hostname !=null && port != null && accountName != null) {
|
||||
if (protocol != null && username != null && password != null && hostname !=null && port != null && accountname != null) {
|
||||
String rpcURL = protocol +"://" + username +":" + password + "@" + hostname +":" + port;
|
||||
return new ViacoindRPCWallet(rpcURL,accountName);
|
||||
return new ViacoindRPCWallet(rpcURL,accountname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class ViacoinExtentsion implements IExtension{
|
|||
}
|
||||
|
||||
@Override
|
||||
public IPaymentProcessors createPaymentProcessor(String paymentProcessorLogin){
|
||||
public IPaymentProcessor createPaymentProcessor(String paymentProcessorLogin){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ public class FixPriceRateSource implements IRateSource {
|
|||
private String preferedFiatCurrency = ICurrencies.USD;
|
||||
|
||||
public FixPriceRateSource(BigDecimal rate, String preferedFiatCurrency)
|
||||
{
|
||||
this.rate = rate;
|
||||
if(ICurrencies.EUR.equalsIgnoreCase(preferedFiatCurrency)){
|
||||
this.preferedFiatCurrency = ICurrencies.EUR;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
package com.generalbytes.batm.server.extensions.extra.via.sources.poloniex;
|
||||
package com.generalbytes.batm.server.extensions.extra.viacoin.sources.poloniex;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.generalbytes.batm.server.extensions.extra.via.sources.poloniex;
|
||||
package com.generalbytes.batm.server.extensions.extra.viacoin.sources.poloniex;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* Web : http://www.generalbytes.com
|
||||
*
|
||||
************************************************************************************/
|
||||
package com.generalbytes.batm.server.extensions.extra.via.sources.poloniex;
|
||||
package com.generalbytes.batm.server.extensions.extra.viacoin.sources.poloniex;
|
||||
|
||||
import com.generalbytes.batm.server.extensions.ICurrencies;
|
||||
import com.generalbytes.batm.server.extensions.IRateSource;
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Set;
|
|||
|
||||
public class ViacoindRPCWallet implements IWallet{
|
||||
private static final Logger log = LoggerFactory.getLogger(ViacoindRPCWallet.class);
|
||||
private static final CRYPTO_CURRENCY = ICurrencies.VIA;
|
||||
private static final String CRYPTO_CURRENCY = ICurrencies.VIA;
|
||||
|
||||
public ViacoindRPCWallet(String rpcURL, String accountName){
|
||||
this.rpcURL = rpcURL;
|
||||
|
@ -43,7 +43,7 @@ public class ViacoindRPCWallet implements IWallet{
|
|||
private String accountName;
|
||||
|
||||
@Override
|
||||
public set<String> getCryptoCurrencies(){
|
||||
public Set<String> getCryptoCurrencies(){
|
||||
Set<String> result = new HashSet<String>();
|
||||
result.add(CRYPTO_CURRENCY);
|
||||
return result;
|
||||
|
@ -94,14 +94,15 @@ public class ViacoindRPCWallet implements IWallet{
|
|||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getCryptoBalance(string cryptocurrency){
|
||||
if(!CRYPTO_CURRENCY.equalsIgnoreCase(cryptocurrency)){
|
||||
public BigDecimal getCryptoBalance(String cryptoCurrency){
|
||||
|
||||
if(!CRYPTO_CURRENCY.equalsIgnoreCase(cryptoCurrency)){
|
||||
log.error("Viacoind wallet error: unknown cryptocurrency" + cryptoCurrency);
|
||||
return null;
|
||||
}
|
||||
try{
|
||||
double balance = getClient(rpcUrl).getBalance(accountName);
|
||||
return BigDecimal.ValueOf(balance);
|
||||
double balance = getClient(rpcURL).getBalance(accountName);
|
||||
return BigDecimal.valueOf(balance);
|
||||
}catch(BitcoinException e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue