Annotate Immutable classes

This commit is contained in:
Manfred Karrer 2015-03-25 22:56:12 +01:00
parent afe64bea4d
commit 180b5ad0f0
29 changed files with 205 additions and 326 deletions

View file

@ -68,13 +68,13 @@ public class Arbitrator implements Serializable {
transient private Storage<Arbitrator> storage; transient private Storage<Arbitrator> storage;
// Persisted fields // Persisted fields
private String id; private final String id;
private byte[] pubKey; private final byte[] pubKey;
private PublicKey p2pSigPubKey; private final PublicKey p2pSigPubKey;
private String name; private final String name;
private Reputation reputation; private final Reputation reputation;
// editable // Mutable
private ID_TYPE idType; private ID_TYPE idType;
private List<String> languageCodes; private List<String> languageCodes;
private Coin fee; private Coin fee;
@ -139,6 +139,8 @@ public class Arbitrator implements Serializable {
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Setters // Setters
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -21,79 +21,69 @@ import io.bitsquare.locale.Country;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
@Immutable @Immutable
public class FiatAccount implements Serializable { public class FiatAccount implements Serializable {
// That object is saved to disc. We need to take care of changes to not break deserialization. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final FiatAccountType fiatAccountType; public enum Type {
private final String accountPrimaryID; // like IBAN IRC("", ""),
private final String accountSecondaryID; // like BIC SEPA("IBAN", "BIC"),
private final String accountHolderName; WIRE("primary ID", "secondary ID"),
private final Country country; // where bank is registered INTERNATIONAL("primary ID", "secondary ID"),
private final String nameOfBank; OK_PAY("primary ID", "secondary ID"),
NET_TELLER("primary ID", "secondary ID"),
PERFECT_MONEY("primary ID", "secondary ID");
public final String primaryId;
public final String secondaryId;
Type(String primaryId, String secondaryId) {
this.primaryId = primaryId;
this.secondaryId = secondaryId;
}
public static ArrayList<Type> getAllBankAccountTypes() {
return new ArrayList<>(Arrays.asList(Type.values()));
}
}
public final String id;
public final String nameOfBank;
public final Type type;
public final Country country; // where bank is registered
public final String accountPrimaryID; // like IBAN
public final String accountSecondaryID; // like BIC
public final String accountHolderName;
// The main currency if account support multiple currencies. // The main currency if account support multiple currencies.
// The user can create multiple bank accounts with same bank account but other currency if his bank account // The user can create multiple bank accounts with same bank account but other currency if his bank account
// support that. // support that.
private final String currencyCode; public final String currencyCode;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor // Constructor
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public FiatAccount(FiatAccountType fiatAccountType, String currencyCode, Country country, String nameOfBank, public FiatAccount(Type type, String currencyCode, Country country, String nameOfBank,
String accountHolderName, String accountPrimaryID, String accountSecondaryID) { String accountHolderName, String accountPrimaryID, String accountSecondaryID) {
this.fiatAccountType = fiatAccountType; this.type = type;
this.currencyCode = currencyCode; this.currencyCode = currencyCode;
this.country = country; this.country = country;
this.nameOfBank = nameOfBank; this.nameOfBank = nameOfBank;
this.accountHolderName = accountHolderName; this.accountHolderName = accountHolderName;
this.accountPrimaryID = accountPrimaryID; this.accountPrimaryID = accountPrimaryID;
this.accountSecondaryID = accountSecondaryID; this.accountSecondaryID = accountSecondaryID;
}
id = nameOfBank;
///////////////////////////////////////////////////////////////////////////////////////////
// Getters/Setters
///////////////////////////////////////////////////////////////////////////////////////////
public String getAccountPrimaryID() {
return accountPrimaryID;
}
public String getAccountSecondaryID() {
return accountSecondaryID;
}
public String getAccountHolderName() {
return accountHolderName;
}
public FiatAccountType getFiatAccountType() {
return fiatAccountType;
}
public String getCurrencyCode() {
return currencyCode;
}
public Country getCountry() {
return country;
}
// we use the accountTitle as unique id
public String getId() {
return nameOfBank;
}
public String getNameOfBank() {
return nameOfBank;
} }
@ -103,7 +93,7 @@ public class FiatAccount implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(nameOfBank); return Objects.hashCode(id);
} }
@Override @Override
@ -112,19 +102,20 @@ public class FiatAccount implements Serializable {
if (obj == this) return true; if (obj == this) return true;
final FiatAccount other = (FiatAccount) obj; final FiatAccount other = (FiatAccount) obj;
return nameOfBank.equals(other.getId()); return id.equals(other.id);
} }
@Override @Override
public String toString() { public String toString() {
return "BankAccount{" + return "FiatAccount{" +
"bankAccountType=" + fiatAccountType + "id='" + id + '\'' +
", nameOfBank='" + nameOfBank + '\'' +
", type=" + type +
", country=" + country +
", accountPrimaryID='" + accountPrimaryID + '\'' + ", accountPrimaryID='" + accountPrimaryID + '\'' +
", accountSecondaryID='" + accountSecondaryID + '\'' + ", accountSecondaryID='" + accountSecondaryID + '\'' +
", accountHolderName='" + accountHolderName + '\'' + ", accountHolderName='" + accountHolderName + '\'' +
", country=" + country + ", currencyCode='" + currencyCode + '\'' +
", currency=" + currencyCode +
", accountTitle='" + nameOfBank + '\'' +
'}'; '}';
} }
} }

View file

@ -1,51 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.fiat;
import java.util.ArrayList;
import java.util.Arrays;
public enum FiatAccountType {
IRC("", ""),
SEPA("IBAN", "BIC"),
WIRE("primary ID", "secondary ID"),
INTERNATIONAL("primary ID", "secondary ID"),
OK_PAY("primary ID", "secondary ID"),
NET_TELLER("primary ID", "secondary ID"),
PERFECT_MONEY("primary ID", "secondary ID");
private final String primaryId;
private final String secondaryId;
FiatAccountType(String primaryId, String secondaryId) {
this.primaryId = primaryId;
this.secondaryId = secondaryId;
}
public static ArrayList<FiatAccountType> getAllBankAccountTypes() {
return new ArrayList<>(Arrays.asList(FiatAccountType.values()));
}
public String getPrimaryId() {
return primaryId;
}
public String getSecondaryId() {
return secondaryId;
}
}

View file

@ -23,7 +23,6 @@ import io.bitsquare.btc.BitcoinNetwork;
import io.bitsquare.btc.WalletService; import io.bitsquare.btc.WalletService;
import io.bitsquare.common.viewfx.model.ViewModel; import io.bitsquare.common.viewfx.model.ViewModel;
import io.bitsquare.fiat.FiatAccount; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.fiat.FiatAccountType;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.locale.CountryUtil; import io.bitsquare.locale.CountryUtil;
import io.bitsquare.p2p.BaseP2PService; import io.bitsquare.p2p.BaseP2PService;
@ -193,7 +192,7 @@ class MainViewModel implements ViewModel {
// For alpha version // For alpha version
if (!user.isRegistered()) { if (!user.isRegistered()) {
FiatAccount fiatAccount = new FiatAccount(FiatAccountType.IRC, FiatAccount fiatAccount = new FiatAccount(FiatAccount.Type.IRC,
"EUR", "EUR",
CountryUtil.getDefaultCountry(), CountryUtil.getDefaultCountry(),
"Demo (Name of bank)", "Demo (Name of bank)",
@ -286,7 +285,7 @@ class MainViewModel implements ViewModel {
return new StringConverter<FiatAccount>() { return new StringConverter<FiatAccount>() {
@Override @Override
public String toString(FiatAccount fiatAccount) { public String toString(FiatAccount fiatAccount) {
return fiatAccount.getNameOfBank(); return fiatAccount.nameOfBank;
} }
@Override @Override

View file

@ -20,7 +20,6 @@ package io.bitsquare.gui.main.account.content.fiat;
import io.bitsquare.common.viewfx.model.Activatable; import io.bitsquare.common.viewfx.model.Activatable;
import io.bitsquare.common.viewfx.model.DataModel; import io.bitsquare.common.viewfx.model.DataModel;
import io.bitsquare.fiat.FiatAccount; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.fiat.FiatAccountType;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import io.bitsquare.locale.CountryUtil; import io.bitsquare.locale.CountryUtil;
import io.bitsquare.locale.CurrencyUtil; import io.bitsquare.locale.CurrencyUtil;
@ -52,10 +51,10 @@ class FiatAccountDataModel implements Activatable, DataModel {
final StringProperty secondaryIDPrompt = new SimpleStringProperty(); final StringProperty secondaryIDPrompt = new SimpleStringProperty();
final StringProperty currencyCode = new SimpleStringProperty(); final StringProperty currencyCode = new SimpleStringProperty();
final BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty(); final BooleanProperty countryNotInAcceptedCountriesList = new SimpleBooleanProperty();
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>(); final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
final ObjectProperty<Country> country = new SimpleObjectProperty<>(); final ObjectProperty<Country> country = new SimpleObjectProperty<>();
final ObservableList<FiatAccountType> allTypes = FXCollections.observableArrayList(FiatAccountType final ObservableList<FiatAccount.Type> allTypes = FXCollections.observableArrayList(FiatAccount.Type
.getAllBankAccountTypes()); .getAllBankAccountTypes());
final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList(); final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList();
final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil
@ -112,16 +111,16 @@ class FiatAccountDataModel implements Activatable, DataModel {
user.setCurrentFiatAccountProperty(fiatAccount); user.setCurrentFiatAccountProperty(fiatAccount);
if (fiatAccount != null) { if (fiatAccount != null) {
title.set(fiatAccount.getNameOfBank()); title.set(fiatAccount.nameOfBank);
holderName.set(fiatAccount.getAccountHolderName()); holderName.set(fiatAccount.accountHolderName);
primaryID.set(fiatAccount.getAccountPrimaryID()); primaryID.set(fiatAccount.accountPrimaryID);
secondaryID.set(fiatAccount.getAccountSecondaryID()); secondaryID.set(fiatAccount.accountSecondaryID);
primaryIDPrompt.set(fiatAccount.getFiatAccountType().getPrimaryId()); primaryIDPrompt.set(fiatAccount.type.primaryId);
secondaryIDPrompt.set(fiatAccount.getFiatAccountType().getSecondaryId()); secondaryIDPrompt.set(fiatAccount.type.secondaryId);
type.set(fiatAccount.getFiatAccountType()); type.set(fiatAccount.type);
country.set(fiatAccount.getCountry()); country.set(fiatAccount.country);
currencyCode.set(fiatAccount.getCurrencyCode()); currencyCode.set(fiatAccount.currencyCode);
} }
else { else {
reset(); reset();
@ -134,12 +133,12 @@ class FiatAccountDataModel implements Activatable, DataModel {
} }
void setType(FiatAccountType type) { void setType(FiatAccount.Type type) {
this.type.set(type); this.type.set(type);
if (type != null) { if (type != null) {
primaryIDPrompt.set(type.getPrimaryId()); primaryIDPrompt.set(type.primaryId);
secondaryIDPrompt.set(type.getSecondaryId()); secondaryIDPrompt.set(type.secondaryId);
} }
else { else {
primaryIDPrompt.set(null); primaryIDPrompt.set(null);

View file

@ -21,7 +21,6 @@ import io.bitsquare.common.viewfx.view.ActivatableViewAndModel;
import io.bitsquare.common.viewfx.view.FxmlView; import io.bitsquare.common.viewfx.view.FxmlView;
import io.bitsquare.common.viewfx.view.Wizard; import io.bitsquare.common.viewfx.view.Wizard;
import io.bitsquare.fiat.FiatAccount; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.fiat.FiatAccountType;
import io.bitsquare.gui.OverlayManager; import io.bitsquare.gui.OverlayManager;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;
@ -58,7 +57,7 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
@FXML InputTextField nameOfBankTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField; @FXML InputTextField nameOfBankTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField;
@FXML Button saveButton, completedButton, removeBankAccountButton; @FXML Button saveButton, completedButton, removeBankAccountButton;
@FXML ComboBox<FiatAccount> selectionComboBox; @FXML ComboBox<FiatAccount> selectionComboBox;
@FXML ComboBox<FiatAccountType> typesComboBox; @FXML ComboBox<FiatAccount.Type> typesComboBox;
@FXML ComboBox<String> currencyComboBox; @FXML ComboBox<String> currencyComboBox;
private Wizard wizard; private Wizard wizard;
@ -187,9 +186,9 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
model.country.addListener((ov, oldValue, newValue) -> { model.country.addListener((ov, oldValue, newValue) -> {
if (newValue != null) { if (newValue != null) {
int regionIndex = regionComboBox.getItems().indexOf(newValue.getRegion()); int regionIndex = regionComboBox.getItems().indexOf(newValue.region);
if (regionIndex >= 0 && regionIndex < regionComboBox.getItems().size()) if (regionIndex >= 0 && regionIndex < regionComboBox.getItems().size())
regionComboBox.getSelectionModel().select(regionComboBox.getItems().indexOf(newValue.getRegion())); regionComboBox.getSelectionModel().select(regionComboBox.getItems().indexOf(newValue.region));
int countryIndex = countryComboBox.getItems().indexOf(newValue); int countryIndex = countryComboBox.getItems().indexOf(newValue);
if (countryIndex >= 0 && countryIndex < countryComboBox.getItems().size()) if (countryIndex >= 0 && countryIndex < countryComboBox.getItems().size())

View file

@ -20,7 +20,6 @@ package io.bitsquare.gui.main.account.content.fiat;
import io.bitsquare.common.viewfx.model.ActivatableWithDataModel; import io.bitsquare.common.viewfx.model.ActivatableWithDataModel;
import io.bitsquare.common.viewfx.model.ViewModel; import io.bitsquare.common.viewfx.model.ViewModel;
import io.bitsquare.fiat.FiatAccount; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.fiat.FiatAccountType;
import io.bitsquare.gui.util.validation.BankAccountNumberValidator; import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources; import io.bitsquare.locale.BSResources;
@ -54,7 +53,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
final StringProperty currencyCode = new SimpleStringProperty(); final StringProperty currencyCode = new SimpleStringProperty();
final BooleanProperty selectionDisable = new SimpleBooleanProperty(); final BooleanProperty selectionDisable = new SimpleBooleanProperty();
final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true); final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>(); final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
final ObjectProperty<Country> country = new SimpleObjectProperty<>(); final ObjectProperty<Country> country = new SimpleObjectProperty<>();
@ -112,15 +111,15 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
} }
StringConverter<FiatAccountType> getTypesConverter() { StringConverter<FiatAccount.Type> getTypesConverter() {
return new StringConverter<FiatAccountType>() { return new StringConverter<FiatAccount.Type>() {
@Override @Override
public String toString(FiatAccountType TypeInfo) { public String toString(FiatAccount.Type TypeInfo) {
return BSResources.get(TypeInfo.toString()); return BSResources.get(TypeInfo.toString());
} }
@Override @Override
public FiatAccountType fromString(String s) { public FiatAccount.Type fromString(String s) {
return null; return null;
} }
}; };
@ -130,7 +129,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
return new StringConverter<FiatAccount>() { return new StringConverter<FiatAccount>() {
@Override @Override
public String toString(FiatAccount fiatAccount) { public String toString(FiatAccount fiatAccount) {
return fiatAccount.getNameOfBank(); return fiatAccount.nameOfBank;
} }
@Override @Override
@ -160,7 +159,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
return new StringConverter<io.bitsquare.locale.Region>() { return new StringConverter<io.bitsquare.locale.Region>() {
@Override @Override
public String toString(io.bitsquare.locale.Region region) { public String toString(io.bitsquare.locale.Region region) {
return region.getName(); return region.name;
} }
@Override @Override
@ -174,7 +173,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
return new StringConverter<Country>() { return new StringConverter<Country>() {
@Override @Override
public String toString(Country country) { public String toString(Country country) {
return country.getName(); return country.name;
} }
@Override @Override
@ -185,7 +184,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
} }
ObservableList<FiatAccountType> getAllTypes() { ObservableList<FiatAccount.Type> getAllTypes() {
return dataModel.allTypes; return dataModel.allTypes;
} }
@ -214,7 +213,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
} }
void setType(FiatAccountType type) { void setType(FiatAccount.Type type) {
dataModel.setType(type); dataModel.setType(type);
validateInput(); validateInput();
} }

View file

@ -20,7 +20,6 @@ package io.bitsquare.gui.main.account.content.irc;
import io.bitsquare.common.viewfx.model.Activatable; import io.bitsquare.common.viewfx.model.Activatable;
import io.bitsquare.common.viewfx.model.DataModel; import io.bitsquare.common.viewfx.model.DataModel;
import io.bitsquare.fiat.FiatAccount; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.fiat.FiatAccountType;
import io.bitsquare.locale.CountryUtil; import io.bitsquare.locale.CountryUtil;
import io.bitsquare.locale.CurrencyUtil; import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.user.User; import io.bitsquare.user.User;
@ -40,10 +39,10 @@ class IrcAccountDataModel implements Activatable, DataModel {
final StringProperty nickName = new SimpleStringProperty(); final StringProperty nickName = new SimpleStringProperty();
final StringProperty currencyCode = new SimpleStringProperty(); final StringProperty currencyCode = new SimpleStringProperty();
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>(); final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
final ObservableList<FiatAccountType> allTypes = final ObservableList<FiatAccount.Type> allTypes =
FXCollections.observableArrayList(FiatAccountType.getAllBankAccountTypes()); FXCollections.observableArrayList(FiatAccount.Type.getAllBankAccountTypes());
final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencyCodes()); final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencyCodes());
final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList(); final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList();
@ -76,7 +75,7 @@ class IrcAccountDataModel implements Activatable, DataModel {
reset(); reset();
} }
void setType(FiatAccountType type) { void setType(FiatAccount.Type type) {
this.type.set(type); this.type.set(type);
} }

View file

@ -20,7 +20,7 @@ package io.bitsquare.gui.main.account.content.irc;
import io.bitsquare.common.viewfx.view.ActivatableViewAndModel; import io.bitsquare.common.viewfx.view.ActivatableViewAndModel;
import io.bitsquare.common.viewfx.view.FxmlView; import io.bitsquare.common.viewfx.view.FxmlView;
import io.bitsquare.common.viewfx.view.Wizard; import io.bitsquare.common.viewfx.view.Wizard;
import io.bitsquare.fiat.FiatAccountType; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.components.Popups; import io.bitsquare.gui.components.Popups;
import io.bitsquare.gui.main.help.Help; import io.bitsquare.gui.main.help.Help;
@ -45,7 +45,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
@FXML HBox buttonsHBox; @FXML HBox buttonsHBox;
@FXML InputTextField ircNickNameTextField; @FXML InputTextField ircNickNameTextField;
@FXML Button saveButton; @FXML Button saveButton;
@FXML ComboBox<FiatAccountType> typesComboBox; @FXML ComboBox<FiatAccount.Type> typesComboBox;
@FXML ComboBox<String> currencyComboBox; @FXML ComboBox<String> currencyComboBox;
private Wizard wizard; private Wizard wizard;
@ -62,13 +62,13 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
typesComboBox.setItems(model.getAllTypes()); typesComboBox.setItems(model.getAllTypes());
typesComboBox.setConverter(model.getTypesConverter()); typesComboBox.setConverter(model.getTypesConverter());
// we use a custom cell for deactivating non IRC items, later we use the standard cell and the StringConverter // we use a custom cell for deactivating non IRC items, later we use the standard cell and the StringConverter
typesComboBox.setCellFactory(new Callback<ListView<FiatAccountType>, ListCell<FiatAccountType>>() { typesComboBox.setCellFactory(new Callback<ListView<FiatAccount.Type>, ListCell<FiatAccount.Type>>() {
@Override @Override
public ListCell<FiatAccountType> call(ListView<FiatAccountType> p) { public ListCell<FiatAccount.Type> call(ListView<FiatAccount.Type> p) {
return new ListCell<FiatAccountType>() { return new ListCell<FiatAccount.Type>() {
@Override @Override
protected void updateItem(FiatAccountType item, boolean empty) { protected void updateItem(FiatAccount.Type item, boolean empty) {
super.updateItem(item, empty); super.updateItem(item, empty);
setText(model.getBankAccountType(item)); setText(model.getBankAccountType(item));
@ -76,7 +76,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
if (item == null || empty) { if (item == null || empty) {
setGraphic(null); setGraphic(null);
} }
else if (item != FiatAccountType.IRC) { else if (item != FiatAccount.Type.IRC) {
setOpacity(0.3); setOpacity(0.3);
setDisable(true); setDisable(true);
} }

View file

@ -19,7 +19,7 @@ package io.bitsquare.gui.main.account.content.irc;
import io.bitsquare.common.viewfx.model.ActivatableWithDataModel; import io.bitsquare.common.viewfx.model.ActivatableWithDataModel;
import io.bitsquare.common.viewfx.model.ViewModel; import io.bitsquare.common.viewfx.model.ViewModel;
import io.bitsquare.fiat.FiatAccountType; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.gui.util.validation.BankAccountNumberValidator; import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
import io.bitsquare.gui.util.validation.InputValidator; import io.bitsquare.gui.util.validation.InputValidator;
import io.bitsquare.locale.BSResources; import io.bitsquare.locale.BSResources;
@ -43,7 +43,7 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
final StringProperty ircNickName = new SimpleStringProperty(); final StringProperty ircNickName = new SimpleStringProperty();
final StringProperty currencyCode = new SimpleStringProperty(); final StringProperty currencyCode = new SimpleStringProperty();
final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true); final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>(); final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
@Inject @Inject
public IrcAccountViewModel(IrcAccountDataModel dataModel, BankAccountNumberValidator nickNameValidator) { public IrcAccountViewModel(IrcAccountDataModel dataModel, BankAccountNumberValidator nickNameValidator) {
@ -67,21 +67,21 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
return result; return result;
} }
StringConverter<FiatAccountType> getTypesConverter() { StringConverter<FiatAccount.Type> getTypesConverter() {
return new StringConverter<FiatAccountType>() { return new StringConverter<FiatAccount.Type>() {
@Override @Override
public String toString(FiatAccountType TypeInfo) { public String toString(FiatAccount.Type TypeInfo) {
return BSResources.get(TypeInfo.toString()); return BSResources.get(TypeInfo.toString());
} }
@Override @Override
public FiatAccountType fromString(String s) { public FiatAccount.Type fromString(String s) {
return null; return null;
} }
}; };
} }
String getBankAccountType(FiatAccountType fiatAccountType) { String getBankAccountType(FiatAccount.Type fiatAccountType) {
return fiatAccountType != null ? BSResources.get(fiatAccountType.toString()) : ""; return fiatAccountType != null ? BSResources.get(fiatAccountType.toString()) : "";
} }
@ -100,7 +100,7 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
} }
ObservableList<FiatAccountType> getAllTypes() { ObservableList<FiatAccount.Type> getAllTypes() {
return dataModel.allTypes; return dataModel.allTypes;
} }
@ -113,7 +113,7 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
} }
void setType(FiatAccountType type) { void setType(FiatAccount.Type type) {
dataModel.setType(type); dataModel.setType(type);
validateInput(); validateInput();
} }

View file

@ -105,7 +105,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
Region region = regionComboBox.getSelectionModel().getSelectedItem(); Region region = regionComboBox.getSelectionModel().getSelectedItem();
countryComboBox.setItems(model.getAllCountriesFor(region)); countryComboBox.setItems(model.getAllCountriesFor(region));
addAllEuroCountriesButton.setVisible(region.getCode().equals("EU")); addAllEuroCountriesButton.setVisible(region.code.equals("EU"));
} }
@FXML @FXML
@ -223,7 +223,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
regionComboBox.setConverter(new StringConverter<io.bitsquare.locale.Region>() { regionComboBox.setConverter(new StringConverter<io.bitsquare.locale.Region>() {
@Override @Override
public String toString(io.bitsquare.locale.Region region) { public String toString(io.bitsquare.locale.Region region) {
return region.getName(); return region.name;
} }
@Override @Override
@ -248,11 +248,11 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
} }
@Override @Override
public void updateItem(final Country item, boolean empty) { public void updateItem(final Country country, boolean empty) {
super.updateItem(item, empty); super.updateItem(country, empty);
if (item != null && !empty) { if (country != null && !empty) {
label.setText(item.getName()); label.setText(country.name);
removeButton.setOnAction(actionEvent -> removeCountry(item)); removeButton.setOnAction(actionEvent -> removeCountry(country));
setGraphic(pane); setGraphic(pane);
} }
else { else {
@ -266,7 +266,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
countryComboBox.setConverter(new StringConverter<Country>() { countryComboBox.setConverter(new StringConverter<Country>() {
@Override @Override
public String toString(Country country) { public String toString(Country country) {
return country.getName(); return country.name;
} }
@Override @Override

View file

@ -171,7 +171,7 @@ class PendingTradesViewModel extends ActivatableWithDataModel<PendingTradesDataM
// payment // payment
String getPaymentMethod() { String getPaymentMethod() {
return BSResources.get(dataModel.getTrade().getContract().getTakerFiatAccount().getFiatAccountType().toString()); return BSResources.get(dataModel.getTrade().getContract().takerFiatAccount.type.toString());
} }
String getFiatAmount() { String getFiatAmount() {
@ -179,15 +179,15 @@ class PendingTradesViewModel extends ActivatableWithDataModel<PendingTradesDataM
} }
String getHolderName() { String getHolderName() {
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountHolderName(); return dataModel.getTrade().getContract().takerFiatAccount.accountHolderName;
} }
String getPrimaryId() { String getPrimaryId() {
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountPrimaryID(); return dataModel.getTrade().getContract().takerFiatAccount.accountPrimaryID;
} }
String getSecondaryId() { String getSecondaryId() {
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountSecondaryID(); return dataModel.getTrade().getContract().takerFiatAccount.accountSecondaryID;
} }
// summary // summary

View file

@ -261,11 +261,11 @@ class CreateOfferDataModel implements Activatable, DataModel {
private void applyBankAccount(FiatAccount fiatAccount) { private void applyBankAccount(FiatAccount fiatAccount) {
if (fiatAccount != null) { if (fiatAccount != null) {
bankAccountType.set(fiatAccount.getFiatAccountType().toString()); bankAccountType.set(fiatAccount.type.toString());
bankAccountCurrency.set(fiatAccount.getCurrencyCode()); bankAccountCurrency.set(fiatAccount.currencyCode);
bankAccountCounty.set(fiatAccount.getCountry().getName()); bankAccountCounty.set(fiatAccount.country.name);
fiatCode.set(fiatAccount.getCurrencyCode()); fiatCode.set(fiatAccount.currencyCode);
} }
} }

View file

@ -152,14 +152,13 @@ class OfferBookDataModel implements Activatable, DataModel {
if (currentFiatAccount == null) if (currentFiatAccount == null)
return true; return true;
boolean countryResult = offer.getAcceptedCountries().contains(currentFiatAccount.getCountry()); boolean countryResult = offer.getAcceptedCountries().contains(currentFiatAccount.country);
// for IRC test version deactivate the check // for IRC test version deactivate the check
countryResult = true; countryResult = true;
if (!countryResult) if (!countryResult)
restrictionsInfo.set("This offer requires that the payments account resides in one of those countries:\n" + restrictionsInfo.set("This offer requires that the payments account resides in one of those countries:\n" +
formatter.countryLocalesToString(offer.getAcceptedCountries()) + formatter.countryLocalesToString(offer.getAcceptedCountries()) +
"\n\nThe country of your payments account (" + user.currentFiatAccountPropertyProperty().get().getCountry() "\n\nThe country of your payments account (" + user.currentFiatAccountPropertyProperty().get().country.name +
.getName() +
") is not included in that list." + ") is not included in that list." +
"\n\n Do you want to edit your preferences now?"); "\n\n Do you want to edit your preferences now?");
@ -245,9 +244,9 @@ class OfferBookDataModel implements Activatable, DataModel {
private void setBankAccount(FiatAccount fiatAccount) { private void setBankAccount(FiatAccount fiatAccount) {
if (fiatAccount != null) { if (fiatAccount != null) {
fiatCode.set(fiatAccount.getCurrencyCode()); fiatCode.set(fiatAccount.currencyCode);
bankAccountCountry.set(fiatAccount.getCountry()); bankAccountCountry.set(fiatAccount.country);
sortedItems.stream().forEach(e -> e.setBankAccountCountry(fiatAccount.getCountry())); sortedItems.stream().forEach(e -> e.setBankAccountCountry(fiatAccount.country));
} }
else { else {
fiatCode.set(CurrencyUtil.getDefaultCurrencyAsCode()); fiatCode.set(CurrencyUtil.getDefaultCurrencyAsCode());

View file

@ -586,7 +586,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
Country country = offerBookListItem.getOffer().getBankAccountCountry(); Country country = offerBookListItem.getOffer().getBankAccountCountry();
hBox.getChildren().add(ImageUtil.getCountryIconImageView(offerBookListItem hBox.getChildren().add(ImageUtil.getCountryIconImageView(offerBookListItem
.getOffer().getBankAccountCountry())); .getOffer().getBankAccountCountry()));
Tooltip.install(this, new Tooltip(country.getName())); Tooltip.install(this, new Tooltip(country.name));
} }
} }
}; };

View file

@ -144,7 +144,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
acceptedArbitratorIds = formatter.arbitratorIdsToNames(offer.getArbitratorIds()); acceptedArbitratorIds = formatter.arbitratorIdsToNames(offer.getArbitratorIds());
bankAccountType = BSResources.get(offer.getFiatAccountType().toString()); bankAccountType = BSResources.get(offer.getFiatAccountType().toString());
bankAccountCurrency = BSResources.get(CurrencyUtil.getDisplayName(offer.getCurrencyCode())); bankAccountCurrency = BSResources.get(CurrencyUtil.getDisplayName(offer.getCurrencyCode()));
bankAccountCounty = BSResources.get(offer.getBankAccountCountry().getName()); bankAccountCounty = BSResources.get(offer.getBankAccountCountry().name);
offer.stateProperty().addListener((ov, oldValue, newValue) -> applyOfferState(newValue)); offer.stateProperty().addListener((ov, oldValue, newValue) -> applyOfferState(newValue));
applyOfferState(offer.stateProperty().get()); applyOfferState(offer.stateProperty().get());

View file

@ -82,11 +82,11 @@ public class BSFormatter {
if (user.currentFiatAccountPropertyProperty().get() == null) if (user.currentFiatAccountPropertyProperty().get() == null)
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode()); setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
else if (user.currentFiatAccountPropertyProperty().get() != null) else if (user.currentFiatAccountPropertyProperty().get() != null)
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode()); setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> { user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null) if (newValue != null)
setFiatCurrencyCode(newValue.getCurrencyCode()); setFiatCurrencyCode(newValue.currencyCode);
}); });
} }
@ -313,7 +313,7 @@ public class BSFormatter {
} }
public String countryLocalesToString(List<Country> countries) { public String countryLocalesToString(List<Country> countries) {
return countries.stream().map(Country::getName).collect(Collectors.joining(", ")); return countries.stream().map(e-> e.name).collect(Collectors.joining(", "));
} }
public String arbitratorsToNames(List<Arbitrator> arbitrators) { public String arbitratorsToNames(List<Arbitrator> arbitrators) {

View file

@ -50,10 +50,10 @@ public class ImageUtil {
public static ImageView getCountryIconImageView(Country country) { public static ImageView getCountryIconImageView(Country country) {
try { try {
return ImageUtil.getImageViewByUrl("/images/countries/" + country.getCode().toLowerCase() + ".png"); return ImageUtil.getImageViewByUrl("/images/countries/" + country.code.toLowerCase() + ".png");
} catch (Exception e) { } catch (Exception e) {
log.error("Country icon not found URL = /images/countries/" + country.getCode().toLowerCase() + log.error("Country icon not found URL = /images/countries/" + country.code.toLowerCase() +
".png / country name = " + country.getName()); ".png / country name = " + country.name);
return null; return null;
} }
} }

View file

@ -42,11 +42,11 @@ public final class FiatValidator extends NumberValidator {
if (user.currentFiatAccountPropertyProperty().get() == null) if (user.currentFiatAccountPropertyProperty().get() == null)
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode()); setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
else if (user.currentFiatAccountPropertyProperty().get() != null) else if (user.currentFiatAccountPropertyProperty().get() != null)
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode()); setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> { user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null) if (newValue != null)
setFiatCurrencyCode(newValue.getCurrencyCode()); setFiatCurrencyCode(newValue.currencyCode);
}); });
} }
} }

View file

@ -42,11 +42,11 @@ public final class OptionalFiatValidator extends NumberValidator {
if (user.currentFiatAccountPropertyProperty().get() == null) if (user.currentFiatAccountPropertyProperty().get() == null)
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode()); setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
else if (user.currentFiatAccountPropertyProperty().get() != null) else if (user.currentFiatAccountPropertyProperty().get() != null)
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode()); setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> { user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
if (newValue != null) if (newValue != null)
setFiatCurrencyCode(newValue.getCurrencyCode()); setFiatCurrencyCode(newValue.currencyCode);
}); });
} }
} }

View file

@ -19,8 +19,6 @@ package io.bitsquare.locale;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
@Immutable @Immutable
@ -28,9 +26,9 @@ public class Country implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String code; public final String code;
private final String name; public final String name;
private final Region region; public final Region region;
public Country(String code, String name, Region region) { public Country(String code, String name, Region region) {
this.code = code; this.code = code;
@ -38,40 +36,33 @@ public class Country implements Serializable {
this.region = region; this.region = region;
} }
public String getCode() { @Override
return code; public boolean equals(Object o) {
} if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
public String getName() { Country country = (Country) o;
return name;
} if (code != null ? !code.equals(country.code) : country.code != null) return false;
if (name != null ? !name.equals(country.name) : country.name != null) return false;
return !(region != null ? !region.equals(country.region) : country.region != null);
public Region getRegion() {
return region;
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(code); int result = code != null ? code.hashCode() : 0;
} result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (region != null ? region.hashCode() : 0);
@Override return result;
public boolean equals(Object obj) {
if (!(obj instanceof Country)) {
return false;
}
if (obj == this) {
return true;
}
final Country other = (Country) obj;
return code.equals(other.getCode());
} }
@Override @Override
public String toString() { public String toString() {
return "code='" + code + '\'' + return "Country{" +
"code='" + code + '\'' +
", name='" + name + '\'' + ", name='" + name + '\'' +
", getRegion='" + region; ", region=" + region +
'}';
} }
} }

View file

@ -76,7 +76,7 @@ public class CountryUtil {
public static List<Country> getAllCountriesFor(Region selectedRegion) { public static List<Country> getAllCountriesFor(Region selectedRegion) {
return Lists.newArrayList(Collections2.filter(getAllCountries(), country -> return Lists.newArrayList(Collections2.filter(getAllCountries(), country ->
selectedRegion != null && country != null && selectedRegion.equals(country.getRegion()))); selectedRegion != null && country != null && selectedRegion.equals(country.region)));
} }
public static Country getDefaultCountry() { public static Country getDefaultCountry() {

View file

@ -19,8 +19,6 @@ package io.bitsquare.locale;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects;
import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.Immutable;
@Immutable @Immutable
@ -28,43 +26,38 @@ public class Region implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final String code; public final String code;
private final String name; public final String name;
public Region(String code, String name) { public Region(String code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Region region = (Region) o;
if (code != null ? !code.equals(region.code) : region.code != null) return false;
return !(name != null ? !name.equals(region.name) : region.name != null);
}
@Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(code); int result = code != null ? code.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
} }
public boolean equals(Object obj) {
if (!(obj instanceof Region)) {
return false;
}
if (obj == this) {
return true;
}
Region other = (Region) obj;
return code.equals(other.getCode());
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
@Override @Override
public String toString() { public String toString() {
return "regionCode='" + code + '\'' + return "Region{" +
", continentName='" + name; "code='" + code + '\'' +
", name='" + name + '\'' +
'}';
} }
} }

View file

@ -18,7 +18,7 @@
package io.bitsquare.offer; package io.bitsquare.offer;
import io.bitsquare.btc.Restrictions; import io.bitsquare.btc.Restrictions;
import io.bitsquare.fiat.FiatAccountType; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.locale.Country; import io.bitsquare.locale.Country;
import org.bitcoinj.core.Coin; import org.bitcoinj.core.Coin;
@ -70,7 +70,7 @@ public class Offer implements Serializable {
private final Coin amount; private final Coin amount;
private final Coin minAmount; private final Coin minAmount;
private final PublicKey p2pSigPubKey; private final PublicKey p2pSigPubKey;
private final FiatAccountType fiatAccountType; private final FiatAccount.Type fiatAccountType;
private final Country bankAccountCountry; private final Country bankAccountCountry;
private final Coin securityDeposit; private final Coin securityDeposit;
@ -98,7 +98,7 @@ public class Offer implements Serializable {
long fiatPrice, long fiatPrice,
Coin amount, Coin amount,
Coin minAmount, Coin minAmount,
FiatAccountType fiatAccountType, FiatAccount.Type fiatAccountType,
String currencyCode, String currencyCode,
Country bankAccountCountry, Country bankAccountCountry,
String bankAccountUID, String bankAccountUID,
@ -217,7 +217,7 @@ public class Offer implements Serializable {
return direction == Direction.BUY ? Direction.SELL : Direction.BUY; return direction == Direction.BUY ? Direction.SELL : Direction.BUY;
} }
public FiatAccountType getFiatAccountType() { public FiatAccount.Type getFiatAccountType() {
return fiatAccountType; return fiatAccountType;
} }

View file

@ -137,8 +137,8 @@ public class OfferBook {
private void setBankAccount(FiatAccount fiatAccount) { private void setBankAccount(FiatAccount fiatAccount) {
log.debug("setBankAccount " + fiatAccount); log.debug("setBankAccount " + fiatAccount);
if (fiatAccount != null) { if (fiatAccount != null) {
country = fiatAccount.getCountry(); country = fiatAccount.country;
fiatCode = fiatAccount.getCurrencyCode(); fiatCode = fiatAccount.currencyCode;
// TODO check why that was used (probably just for update triggering, if so refactor that) // TODO check why that was used (probably just for update triggering, if so refactor that)
//offerBookListItems.stream().forEach(e -> e.setBankAccountCountry(country)); //offerBookListItems.stream().forEach(e -> e.setBankAccountCountry(country));

View file

@ -34,15 +34,15 @@ public class Contract implements Serializable {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final Offer offer; public final Offer offer;
private final String takeOfferFeeTxID; public final String takeOfferFeeTxID;
private final Coin tradeAmount; public final Coin tradeAmount;
private final String offererAccountID; public final String offererAccountID;
private final String takerAccountID; public final String takerAccountID;
private final FiatAccount offererFiatAccount; public final FiatAccount offererFiatAccount;
private final FiatAccount takerFiatAccount; public final FiatAccount takerFiatAccount;
private final String offererP2PSigPubKeyAsString; public final String offererP2PSigPubKeyAsString;
private final String takerP2PSigPubKeyAsString; public final String takerP2PSigPubKeyAsString;
public Contract(Offer offer, public Contract(Offer offer,
Coin tradeAmount, Coin tradeAmount,
@ -64,47 +64,6 @@ public class Contract implements Serializable {
this.takerP2PSigPubKeyAsString = Utilities.getHexFromPubKey(takerP2PSigPubKey); this.takerP2PSigPubKeyAsString = Utilities.getHexFromPubKey(takerP2PSigPubKey);
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Getters
///////////////////////////////////////////////////////////////////////////////////////////
public Offer getOffer() {
return offer;
}
public String getTakeOfferFeeTxID() {
return takeOfferFeeTxID;
}
public Coin getTradeAmount() {
return tradeAmount;
}
public String getOffererAccountID() {
return offererAccountID;
}
public String getTakerAccountID() {
return takerAccountID;
}
public FiatAccount getOffererFiatAccount() {
return offererFiatAccount;
}
public FiatAccount getTakerFiatAccount() {
return takerFiatAccount;
}
public String getTakerMessagePublicKey() {
return takerP2PSigPubKeyAsString;
}
public String getOffererMessagePublicKey() {
return offererP2PSigPubKeyAsString;
}
@Override @Override
public String toString() { public String toString() {
return "Contract{" + return "Contract{" +
@ -113,10 +72,10 @@ public class Contract implements Serializable {
", tradeAmount=" + tradeAmount + ", tradeAmount=" + tradeAmount +
", offererAccountID='" + offererAccountID + '\'' + ", offererAccountID='" + offererAccountID + '\'' +
", takerAccountID='" + takerAccountID + '\'' + ", takerAccountID='" + takerAccountID + '\'' +
", offererBankAccount=" + offererFiatAccount + ", offererFiatAccount=" + offererFiatAccount +
", takerBankAccount=" + takerFiatAccount + ", takerFiatAccount=" + takerFiatAccount +
", takerP2PSigPubKeyAsString=" + takerP2PSigPubKeyAsString + ", offererP2PSigPubKeyAsString='" + offererP2PSigPubKeyAsString + '\'' +
", offererP2PSigPubKeyAsString=" + offererP2PSigPubKeyAsString + ", takerP2PSigPubKeyAsString='" + takerP2PSigPubKeyAsString + '\'' +
'}'; '}';
} }
} }

View file

@ -172,10 +172,10 @@ public class TradeManager {
price.getValue(), price.getValue(),
amount, amount,
minAmount, minAmount,
currentFiatAccount.getFiatAccountType(), currentFiatAccount.type,
currentFiatAccount.getCurrencyCode(), currentFiatAccount.currencyCode,
currentFiatAccount.getCountry(), currentFiatAccount.country,
currentFiatAccount.getId(), currentFiatAccount.id,
accountSettings.getAcceptedArbitratorIds(), accountSettings.getAcceptedArbitratorIds(),
accountSettings.getSecurityDeposit(), accountSettings.getSecurityDeposit(),
accountSettings.getAcceptedCountries(), accountSettings.getAcceptedCountries(),

View file

@ -181,7 +181,7 @@ public class User implements Serializable {
public FiatAccount getFiatAccount(String fiatAccountId) { public FiatAccount getFiatAccount(String fiatAccountId) {
for (FiatAccount fiatAccount : fiatAccountsObservableList) { for (FiatAccount fiatAccount : fiatAccountsObservableList) {
if (fiatAccount.getId().equals(fiatAccountId)) { if (fiatAccount.id.equals(fiatAccountId)) {
return fiatAccount; return fiatAccount;
} }
} }

View file

@ -17,7 +17,7 @@
package io.bitsquare.gui.main.trade.createoffer; package io.bitsquare.gui.main.trade.createoffer;
import io.bitsquare.fiat.FiatAccountType; import io.bitsquare.fiat.FiatAccount;
import io.bitsquare.gui.util.BSFormatter; import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.validation.BtcValidator; import io.bitsquare.gui.util.validation.BtcValidator;
import io.bitsquare.gui.util.validation.FiatValidator; import io.bitsquare.gui.util.validation.FiatValidator;
@ -97,10 +97,10 @@ public class CreateOfferViewModelTest {
assertEquals(Fiat.valueOf("USD", 9999900), model.volumeAsFiat.get()); assertEquals(Fiat.valueOf("USD", 9999900), model.volumeAsFiat.get());
model.bankAccountType.set(FiatAccountType.SEPA.toString()); model.bankAccountType.set(FiatAccount.Type.SEPA.toString());
assertEquals("Sepa", presenter.bankAccountType.get()); assertEquals("Sepa", presenter.bankAccountType.get());
model.bankAccountType.set(FiatAccountType.WIRE.toString()); model.bankAccountType.set(FiatAccount.Type.WIRE.toString());
assertEquals("Wire", presenter.bankAccountType.get()); assertEquals("Wire", presenter.bankAccountType.get());