mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-24 06:44:19 -04:00
fix formatting for price
This commit is contained in:
parent
454dc94965
commit
4fd06ac161
11 changed files with 50 additions and 89 deletions
|
@ -155,10 +155,9 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
|
||||||
model.minAmountAsCoin.set(orderBookFilter.getAmount());
|
model.minAmountAsCoin.set(orderBookFilter.getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use Fiat in orderBookFilter
|
|
||||||
// apply only if valid
|
// apply only if valid
|
||||||
if (orderBookFilter.getPrice() != 0 && isBtcInputValid(String.valueOf(orderBookFilter.getPrice())).isValid)
|
if (orderBookFilter.getPrice() != null && isBtcInputValid(orderBookFilter.getPrice().toPlainString()).isValid)
|
||||||
model.priceAsFiat.set(parseToFiatWith2Decimals(String.valueOf(orderBookFilter.getPrice())));
|
model.priceAsFiat.set(parseToFiatWith2Decimals(orderBookFilter.getPrice().toPlainString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class OrderBookController extends CachedViewController {
|
||||||
});
|
});
|
||||||
|
|
||||||
price.textProperty().addListener((observable, oldValue, newValue) -> {
|
price.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
orderBookFilter.setPrice(textInputToNumber(oldValue, newValue));
|
orderBookFilter.setPrice(BSFormatter.parseToFiat(newValue));
|
||||||
updateVolume();
|
updateVolume();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class BSFormatter {
|
||||||
|
|
||||||
public static Coin parseToCoin(String input) {
|
public static Coin parseToCoin(String input) {
|
||||||
try {
|
try {
|
||||||
return coinFormat.parse(cleanedInput(input));
|
return coinFormat.parse(cleanInput(input));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.warn("Exception at parseToBtc: " + t.toString());
|
log.warn("Exception at parseToBtc: " + t.toString());
|
||||||
return Coin.ZERO;
|
return Coin.ZERO;
|
||||||
|
@ -145,7 +145,7 @@ public class BSFormatter {
|
||||||
*/
|
*/
|
||||||
public static Coin parseToCoinWith4Decimals(String input) {
|
public static Coin parseToCoinWith4Decimals(String input) {
|
||||||
try {
|
try {
|
||||||
return Coin.valueOf(new BigDecimal(parseToCoin(cleanedInput(input)).value).setScale(-scale - 1,
|
return Coin.valueOf(new BigDecimal(parseToCoin(cleanInput(input)).value).setScale(-scale - 1,
|
||||||
BigDecimal.ROUND_HALF_UP).setScale(scale + 1).toBigInteger().longValue());
|
BigDecimal.ROUND_HALF_UP).setScale(scale + 1).toBigInteger().longValue());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.warn("Exception at parseToCoinWith4Decimals: " + t.toString());
|
log.warn("Exception at parseToCoinWith4Decimals: " + t.toString());
|
||||||
|
@ -192,7 +192,7 @@ public class BSFormatter {
|
||||||
|
|
||||||
public static Fiat parseToFiat(String input) {
|
public static Fiat parseToFiat(String input) {
|
||||||
try {
|
try {
|
||||||
return Fiat.parseFiat(currencyCode, cleanedInput(input));
|
return Fiat.parseFiat(currencyCode, cleanInput(input));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Fiat.valueOf(currencyCode, 0);
|
return Fiat.valueOf(currencyCode, 0);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class BSFormatter {
|
||||||
*/
|
*/
|
||||||
public static Fiat parseToFiatWith2Decimals(String input) {
|
public static Fiat parseToFiatWith2Decimals(String input) {
|
||||||
try {
|
try {
|
||||||
return parseToFiat(new BigDecimal(cleanedInput(input)).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
return parseToFiat(new BigDecimal(cleanInput(input)).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.warn("Exception at parseCoinTo4Decimals: " + t.toString());
|
log.warn("Exception at parseCoinTo4Decimals: " + t.toString());
|
||||||
return Fiat.valueOf(currencyCode, 0);
|
return Fiat.valueOf(currencyCode, 0);
|
||||||
|
@ -219,6 +219,8 @@ public class BSFormatter {
|
||||||
public static boolean hasFiatValidDecimals(String input) {
|
public static boolean hasFiatValidDecimals(String input) {
|
||||||
return parseToFiat(input).equals(parseToFiatWith2Decimals(input));
|
return parseToFiat(input).equals(parseToFiatWith2Decimals(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Other
|
// Other
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -228,6 +230,7 @@ public class BSFormatter {
|
||||||
* " are supported. Thousands separator is not supported.
|
* " are supported. Thousands separator is not supported.
|
||||||
* @return Returns a double value. Any invalid value returns Double.NEGATIVE_INFINITY.
|
* @return Returns a double value. Any invalid value returns Double.NEGATIVE_INFINITY.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated //TODO use Fiat or Btc if possible
|
||||||
public static double parseToDouble(String input) {
|
public static double parseToDouble(String input) {
|
||||||
try {
|
try {
|
||||||
checkNotNull(input);
|
checkNotNull(input);
|
||||||
|
@ -247,22 +250,6 @@ public class BSFormatter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatDouble(Fiat value) {
|
|
||||||
return formatDouble(value, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String formatDouble(Fiat value, int fractionDigits) {
|
|
||||||
DecimalFormat decimalFormat = getDecimalFormat(fractionDigits);
|
|
||||||
return decimalFormat.format(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DecimalFormat getDecimalFormat(int fractionDigits) {
|
|
||||||
DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(locale);
|
|
||||||
decimalFormat.setMinimumFractionDigits(fractionDigits);
|
|
||||||
decimalFormat.setMaximumFractionDigits(fractionDigits);
|
|
||||||
decimalFormat.setGroupingUsed(false);
|
|
||||||
return decimalFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String countryLocalesToString(List<Country> countries) {
|
public static String countryLocalesToString(List<Country> countries) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
@ -290,7 +277,6 @@ public class BSFormatter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String arbitrationMethodsToString(List<Arbitrator.METHOD> items) {
|
public static String arbitrationMethodsToString(List<Arbitrator.METHOD> items) {
|
||||||
String result = "";
|
String result = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -325,25 +311,18 @@ public class BSFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatCollateralPercent(long collateral) {
|
public static String formatCollateralPercent(long collateral) {
|
||||||
return getDecimalFormat(1).format(collateral / 10) + " %";
|
DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(locale);
|
||||||
|
decimalFormat.setMinimumFractionDigits(1);
|
||||||
|
decimalFormat.setMaximumFractionDigits(1);
|
||||||
|
decimalFormat.setGroupingUsed(false);
|
||||||
|
return decimalFormat.format(collateral / 10) + " %";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatVolumeWithMinVolume(Fiat volume, Fiat minVolume) {
|
public static String formatVolumeWithMinVolume(Fiat volume, Fiat minVolume) {
|
||||||
return formatFiat(volume) + " (" + formatFiat(minVolume) + ")";
|
return formatFiat(volume) + " (" + formatFiat(minVolume) + ")";
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
@Deprecated
|
|
||||||
public static String formatCoin(Coin coin) {
|
|
||||||
return coin != null ? coin.toPlainString() : "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private static String cleanInput(String input) {
|
||||||
@Deprecated
|
|
||||||
public static String formatCoinWithCode(Coin coin) {
|
|
||||||
return coin != null ? coin.toFriendlyString() : "";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private static String cleanedInput(String input) {
|
|
||||||
input = input.replace(",", ".");
|
input = input.replace(",", ".");
|
||||||
// don't use String.valueOf(Double.parseDouble(input)) as return value as it gives scientific
|
// don't use String.valueOf(Double.parseDouble(input)) as return value as it gives scientific
|
||||||
// notation (1.0E-6) which screw up coinFormat.parse
|
// notation (1.0E-6) which screw up coinFormat.parse
|
||||||
|
|
|
@ -20,8 +20,6 @@ package io.bitsquare.settings;
|
||||||
import io.bitsquare.arbitrator.Arbitrator;
|
import io.bitsquare.arbitrator.Arbitrator;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -99,25 +97,14 @@ public class Settings implements Serializable {
|
||||||
return acceptedArbitrators;
|
return acceptedArbitrators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Locale> getAcceptedLanguageLocales() {
|
public List<Locale> getAcceptedLanguageLocales() {
|
||||||
return acceptedLanguageLocales;
|
return acceptedLanguageLocales;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Country> getAcceptedCountries() {
|
public List<Country> getAcceptedCountries() {
|
||||||
return acceptedCountryLocales;
|
return acceptedCountryLocales;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
public Arbitrator getRandomArbitrator(Coin amount) {
|
|
||||||
List<Arbitrator> candidates = new ArrayList<>();
|
|
||||||
for (Arbitrator arbitrator : acceptedArbitrators) {
|
|
||||||
candidates.add(arbitrator);
|
|
||||||
}
|
|
||||||
return !candidates.isEmpty() ? candidates.get((int) (Math.random() * candidates.size())) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCollateral(long collateral) {
|
public void setCollateral(long collateral) {
|
||||||
this.collateral = collateral;
|
this.collateral = collateral;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,11 @@ import io.bitsquare.bank.BankAccountType;
|
||||||
import io.bitsquare.locale.Country;
|
import io.bitsquare.locale.Country;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
import com.google.bitcoin.utils.ExchangeRate;
|
||||||
import com.google.bitcoin.utils.Fiat;
|
import com.google.bitcoin.utils.Fiat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
|
|
||||||
import java.util.Currency;
|
import java.util.Currency;
|
||||||
|
@ -60,7 +59,7 @@ public class Offer implements Serializable {
|
||||||
private final List<Country> acceptedCountries;
|
private final List<Country> acceptedCountries;
|
||||||
private final List<Locale> acceptedLanguageLocales;
|
private final List<Locale> acceptedLanguageLocales;
|
||||||
private final String bankAccountUID;
|
private final String bankAccountUID;
|
||||||
private final Arbitrator arbitrator;
|
private final List<Arbitrator> arbitrators;
|
||||||
private String offerFeePaymentTxID;
|
private String offerFeePaymentTxID;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ public class Offer implements Serializable {
|
||||||
Currency currency,
|
Currency currency,
|
||||||
Country bankAccountCountry,
|
Country bankAccountCountry,
|
||||||
String bankAccountUID,
|
String bankAccountUID,
|
||||||
Arbitrator arbitrator,
|
List<Arbitrator> arbitrators,
|
||||||
long collateral,
|
long collateral,
|
||||||
List<Country> acceptedCountries,
|
List<Country> acceptedCountries,
|
||||||
List<Locale> acceptedLanguageLocales) {
|
List<Locale> acceptedLanguageLocales) {
|
||||||
|
@ -92,7 +91,7 @@ public class Offer implements Serializable {
|
||||||
this.currency = currency;
|
this.currency = currency;
|
||||||
this.bankAccountCountry = bankAccountCountry;
|
this.bankAccountCountry = bankAccountCountry;
|
||||||
this.bankAccountUID = bankAccountUID;
|
this.bankAccountUID = bankAccountUID;
|
||||||
this.arbitrator = arbitrator;
|
this.arbitrators = arbitrators;
|
||||||
this.collateral = collateral;
|
this.collateral = collateral;
|
||||||
this.acceptedCountries = acceptedCountries;
|
this.acceptedCountries = acceptedCountries;
|
||||||
|
|
||||||
|
@ -156,10 +155,11 @@ public class Offer implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Fiat getVolumeForCoin(Coin coin) {
|
public Fiat getVolumeForCoin(Coin coin) {
|
||||||
BigDecimal amountBD = BigDecimal.valueOf(coin.longValue());
|
if (price != null && coin != null && !coin.isZero() && !price.isZero()) {
|
||||||
BigDecimal volumeBD = amountBD.multiply(BigDecimal.valueOf(price.longValue() / 10000));
|
return new ExchangeRate(price).coinToFiat(coin);
|
||||||
long fiatAsDouble = volumeBD.divide(BigDecimal.valueOf(Coin.COIN.value)).longValue();
|
}
|
||||||
return Fiat.valueOf("EUR", fiatAsDouble);
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Fiat getOfferVolume() {
|
public Fiat getOfferVolume() {
|
||||||
|
@ -178,8 +178,8 @@ public class Offer implements Serializable {
|
||||||
this.offerFeePaymentTxID = offerFeePaymentTxID;
|
this.offerFeePaymentTxID = offerFeePaymentTxID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Arbitrator getArbitrator() {
|
public List<Arbitrator> getArbitrators() {
|
||||||
return arbitrator;
|
return arbitrators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getCollateral() {
|
public long getCollateral() {
|
||||||
|
@ -208,7 +208,7 @@ public class Offer implements Serializable {
|
||||||
", acceptedLanguageLocales=" + acceptedLanguageLocales +
|
", acceptedLanguageLocales=" + acceptedLanguageLocales +
|
||||||
", offerFeePaymentTxID='" + offerFeePaymentTxID + '\'' +
|
", offerFeePaymentTxID='" + offerFeePaymentTxID + '\'' +
|
||||||
", bankAccountUID='" + bankAccountUID + '\'' +
|
", bankAccountUID='" + bankAccountUID + '\'' +
|
||||||
", arbitrator=" + arbitrator +
|
", arbitrator=" + arbitrators +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class TradeManager {
|
||||||
user.getCurrentBankAccount().getCurrency(),
|
user.getCurrentBankAccount().getCurrency(),
|
||||||
user.getCurrentBankAccount().getCountry(),
|
user.getCurrentBankAccount().getCountry(),
|
||||||
user.getCurrentBankAccount().getUid(),
|
user.getCurrentBankAccount().getUid(),
|
||||||
settings.getRandomArbitrator(amount),
|
settings.getAcceptedArbitrators(),
|
||||||
settings.getCollateral(),
|
settings.getCollateral(),
|
||||||
settings.getAcceptedCountries(),
|
settings.getAcceptedCountries(),
|
||||||
settings.getAcceptedLanguageLocales());
|
settings.getAcceptedLanguageLocales());
|
||||||
|
|
|
@ -25,6 +25,7 @@ import io.bitsquare.locale.CurrencyUtil;
|
||||||
import io.bitsquare.msg.MessageFacade;
|
import io.bitsquare.msg.MessageFacade;
|
||||||
import io.bitsquare.msg.listeners.OrderBookListener;
|
import io.bitsquare.msg.listeners.OrderBookListener;
|
||||||
import io.bitsquare.settings.Settings;
|
import io.bitsquare.settings.Settings;
|
||||||
|
import io.bitsquare.trade.Direction;
|
||||||
import io.bitsquare.trade.Offer;
|
import io.bitsquare.trade.Offer;
|
||||||
import io.bitsquare.trade.TradeManager;
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
|
@ -135,20 +136,16 @@ public class OrderBook implements OrderBookListener {
|
||||||
|
|
||||||
// Apply applyFilter only if there is a valid value set
|
// Apply applyFilter only if there is a valid value set
|
||||||
boolean priceResult = true;
|
boolean priceResult = true;
|
||||||
if (orderBookFilter.getPrice() > 0) {
|
if (orderBookFilter.getPrice() != null) {
|
||||||
//TODO
|
if (offer.getDirection() == Direction.SELL)
|
||||||
/* if (offer.getDirection() == Direction.SELL) {
|
priceResult = orderBookFilter.getPrice().compareTo(offer.getPrice()) >= 0;
|
||||||
priceResult = orderBookFilter.getPrice() //>= offer.getPrice();
|
else
|
||||||
}
|
priceResult = orderBookFilter.getPrice().compareTo(offer.getPrice()) <= 0;
|
||||||
else {
|
|
||||||
priceResult = orderBookFilter.getPrice() <= offer.getPrice();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The arbitrator defined in the offer must match one of the accepted arbitrators defined in the settings
|
// The arbitrator defined in the offer must match one of the accepted arbitrators defined in the settings
|
||||||
// (1 to n)
|
// (1 to n)
|
||||||
boolean arbitratorResult = arbitratorInList(offer.getArbitrator(), settings.getAcceptedArbitrators());
|
boolean arbitratorResult = arbitratorsInList(offer.getArbitrators(), settings.getAcceptedArbitrators());
|
||||||
|
|
||||||
boolean result = currencyResult && countryResult && languageResult && amountResult && directionResult &&
|
boolean result = currencyResult && countryResult && languageResult && amountResult && directionResult &&
|
||||||
priceResult && arbitratorResult;
|
priceResult && arbitratorResult;
|
||||||
|
@ -250,15 +247,11 @@ public class OrderBook implements OrderBookListener {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean arbitratorInList(Arbitrator arbitratorToMatch, List<Arbitrator> list) {
|
private boolean arbitratorsInList(List<Arbitrator> list1, List<Arbitrator> list2) {
|
||||||
if (arbitratorToMatch != null) {
|
for (Arbitrator arbitrator1 : list2) {
|
||||||
for (Arbitrator arbitrator : list) {
|
for (Arbitrator arbitrator2 : list1) {
|
||||||
try {
|
if (arbitrator1.getId().equals(arbitrator2.getId())) {
|
||||||
if (arbitrator.getId().equals(arbitratorToMatch.getId())) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.trade.orderbook;
|
||||||
import io.bitsquare.trade.Direction;
|
import io.bitsquare.trade.Direction;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
import com.google.bitcoin.core.Coin;
|
||||||
|
import com.google.bitcoin.utils.Fiat;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ public class OrderBookFilter {
|
||||||
// TODO use ObjectProperty<Direction> instead
|
// TODO use ObjectProperty<Direction> instead
|
||||||
private final SimpleBooleanProperty directionChangedProperty = new SimpleBooleanProperty();
|
private final SimpleBooleanProperty directionChangedProperty = new SimpleBooleanProperty();
|
||||||
|
|
||||||
private double price;
|
private Fiat price;
|
||||||
private Coin amount;
|
private Coin amount;
|
||||||
private Direction direction;
|
private Direction direction;
|
||||||
|
|
||||||
|
@ -58,11 +59,11 @@ public class OrderBookFilter {
|
||||||
directionChangedProperty.set(!directionChangedProperty.get());
|
directionChangedProperty.set(!directionChangedProperty.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPrice() {
|
public Fiat getPrice() {
|
||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrice(double price) {
|
public void setPrice(Fiat price) {
|
||||||
this.price = price;
|
this.price = price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class VerifyOffer {
|
||||||
checkNotNull(offer.getAcceptedCountries(), "AcceptedCountries is null");
|
checkNotNull(offer.getAcceptedCountries(), "AcceptedCountries is null");
|
||||||
checkNotNull(offer.getAcceptedLanguageLocales(), "AcceptedLanguageLocales is null");
|
checkNotNull(offer.getAcceptedLanguageLocales(), "AcceptedLanguageLocales is null");
|
||||||
checkNotNull(offer.getAmount(), "Amount is null");
|
checkNotNull(offer.getAmount(), "Amount is null");
|
||||||
checkNotNull(offer.getArbitrator(), "Arbitrator is null");
|
checkNotNull(offer.getArbitrators(), "Arbitrator is null");
|
||||||
checkNotNull(offer.getBankAccountCountry(), "BankAccountCountry is null");
|
checkNotNull(offer.getBankAccountCountry(), "BankAccountCountry is null");
|
||||||
checkNotNull(offer.getBankAccountId(), "BankAccountId is null");
|
checkNotNull(offer.getBankAccountId(), "BankAccountId is null");
|
||||||
checkNotNull(offer.getCollateral(), "Collateral is null");
|
checkNotNull(offer.getCollateral(), "Collateral is null");
|
||||||
|
|
|
@ -156,7 +156,8 @@ public class BuyerAcceptsOfferProtocol {
|
||||||
tradeId = trade.getId();
|
tradeId = trade.getId();
|
||||||
offer = trade.getOffer();
|
offer = trade.getOffer();
|
||||||
|
|
||||||
arbitratorPubKey = offer.getArbitrator().getPubKeyAsHex();
|
//TODO use first for now
|
||||||
|
arbitratorPubKey = offer.getArbitrators().get(0).getPubKeyAsHex();
|
||||||
|
|
||||||
bankAccount = user.getBankAccount(trade.getOffer().getBankAccountId());
|
bankAccount = user.getBankAccount(trade.getOffer().getBankAccountId());
|
||||||
accountId = user.getAccountId();
|
accountId = user.getAccountId();
|
||||||
|
|
|
@ -150,7 +150,8 @@ public class SellerTakesOfferProtocol {
|
||||||
tradeId = trade.getId();
|
tradeId = trade.getId();
|
||||||
tradeAmount = trade.getTradeAmount();
|
tradeAmount = trade.getTradeAmount();
|
||||||
collateral = trade.getCollateralAmount();
|
collateral = trade.getCollateralAmount();
|
||||||
arbitratorPubKey = trade.getOffer().getArbitrator().getPubKeyAsHex();
|
//TODO use 1. for now
|
||||||
|
arbitratorPubKey = trade.getOffer().getArbitrators().get(0).getPubKeyAsHex();
|
||||||
|
|
||||||
peersMessagePublicKey = offer.getMessagePublicKey();
|
peersMessagePublicKey = offer.getMessagePublicKey();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue