mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Annotate Immutable classes
This commit is contained in:
parent
afe64bea4d
commit
180b5ad0f0
29 changed files with 205 additions and 326 deletions
|
@ -68,13 +68,13 @@ public class Arbitrator implements Serializable {
|
|||
transient private Storage<Arbitrator> storage;
|
||||
|
||||
// Persisted fields
|
||||
private String id;
|
||||
private byte[] pubKey;
|
||||
private PublicKey p2pSigPubKey;
|
||||
private String name;
|
||||
private Reputation reputation;
|
||||
private final String id;
|
||||
private final byte[] pubKey;
|
||||
private final PublicKey p2pSigPubKey;
|
||||
private final String name;
|
||||
private final Reputation reputation;
|
||||
|
||||
// editable
|
||||
// Mutable
|
||||
private ID_TYPE idType;
|
||||
private List<String> languageCodes;
|
||||
private Coin fee;
|
||||
|
@ -137,6 +137,8 @@ public class Arbitrator implements Serializable {
|
|||
Arbitrator other = (Arbitrator) obj;
|
||||
return id != null && id.equals(other.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -21,79 +21,69 @@ import io.bitsquare.locale.Country;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
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 final FiatAccountType fiatAccountType;
|
||||
private final String accountPrimaryID; // like IBAN
|
||||
private final String accountSecondaryID; // like BIC
|
||||
private final String accountHolderName;
|
||||
private final Country country; // where bank is registered
|
||||
private final String nameOfBank;
|
||||
public enum Type {
|
||||
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");
|
||||
|
||||
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 user can create multiple bank accounts with same bank account but other currency if his bank account
|
||||
// support that.
|
||||
private final String currencyCode;
|
||||
public final String currencyCode;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 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) {
|
||||
this.fiatAccountType = fiatAccountType;
|
||||
this.type = type;
|
||||
this.currencyCode = currencyCode;
|
||||
this.country = country;
|
||||
this.nameOfBank = nameOfBank;
|
||||
this.accountHolderName = accountHolderName;
|
||||
this.accountPrimaryID = accountPrimaryID;
|
||||
this.accountSecondaryID = accountSecondaryID;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
id = nameOfBank;
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +93,7 @@ public class FiatAccount implements Serializable {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(nameOfBank);
|
||||
return Objects.hashCode(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,19 +102,20 @@ public class FiatAccount implements Serializable {
|
|||
if (obj == this) return true;
|
||||
|
||||
final FiatAccount other = (FiatAccount) obj;
|
||||
return nameOfBank.equals(other.getId());
|
||||
return id.equals(other.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BankAccount{" +
|
||||
"bankAccountType=" + fiatAccountType +
|
||||
return "FiatAccount{" +
|
||||
"id='" + id + '\'' +
|
||||
", nameOfBank='" + nameOfBank + '\'' +
|
||||
", type=" + type +
|
||||
", country=" + country +
|
||||
", accountPrimaryID='" + accountPrimaryID + '\'' +
|
||||
", accountSecondaryID='" + accountSecondaryID + '\'' +
|
||||
", accountHolderName='" + accountHolderName + '\'' +
|
||||
", country=" + country +
|
||||
", currency=" + currencyCode +
|
||||
", accountTitle='" + nameOfBank + '\'' +
|
||||
", currencyCode='" + currencyCode + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,6 @@ import io.bitsquare.btc.BitcoinNetwork;
|
|||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.common.viewfx.model.ViewModel;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.p2p.BaseP2PService;
|
||||
|
@ -193,7 +192,7 @@ class MainViewModel implements ViewModel {
|
|||
|
||||
// For alpha version
|
||||
if (!user.isRegistered()) {
|
||||
FiatAccount fiatAccount = new FiatAccount(FiatAccountType.IRC,
|
||||
FiatAccount fiatAccount = new FiatAccount(FiatAccount.Type.IRC,
|
||||
"EUR",
|
||||
CountryUtil.getDefaultCountry(),
|
||||
"Demo (Name of bank)",
|
||||
|
@ -286,7 +285,7 @@ class MainViewModel implements ViewModel {
|
|||
return new StringConverter<FiatAccount>() {
|
||||
@Override
|
||||
public String toString(FiatAccount fiatAccount) {
|
||||
return fiatAccount.getNameOfBank();
|
||||
return fiatAccount.nameOfBank;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.DataModel;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
|
@ -52,10 +51,10 @@ class FiatAccountDataModel implements Activatable, DataModel {
|
|||
final StringProperty secondaryIDPrompt = new SimpleStringProperty();
|
||||
final StringProperty currencyCode = new SimpleStringProperty();
|
||||
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 ObservableList<FiatAccountType> allTypes = FXCollections.observableArrayList(FiatAccountType
|
||||
final ObservableList<FiatAccount.Type> allTypes = FXCollections.observableArrayList(FiatAccount.Type
|
||||
.getAllBankAccountTypes());
|
||||
final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList();
|
||||
final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil
|
||||
|
@ -112,16 +111,16 @@ class FiatAccountDataModel implements Activatable, DataModel {
|
|||
user.setCurrentFiatAccountProperty(fiatAccount);
|
||||
|
||||
if (fiatAccount != null) {
|
||||
title.set(fiatAccount.getNameOfBank());
|
||||
holderName.set(fiatAccount.getAccountHolderName());
|
||||
primaryID.set(fiatAccount.getAccountPrimaryID());
|
||||
secondaryID.set(fiatAccount.getAccountSecondaryID());
|
||||
primaryIDPrompt.set(fiatAccount.getFiatAccountType().getPrimaryId());
|
||||
secondaryIDPrompt.set(fiatAccount.getFiatAccountType().getSecondaryId());
|
||||
title.set(fiatAccount.nameOfBank);
|
||||
holderName.set(fiatAccount.accountHolderName);
|
||||
primaryID.set(fiatAccount.accountPrimaryID);
|
||||
secondaryID.set(fiatAccount.accountSecondaryID);
|
||||
primaryIDPrompt.set(fiatAccount.type.primaryId);
|
||||
secondaryIDPrompt.set(fiatAccount.type.secondaryId);
|
||||
|
||||
type.set(fiatAccount.getFiatAccountType());
|
||||
country.set(fiatAccount.getCountry());
|
||||
currencyCode.set(fiatAccount.getCurrencyCode());
|
||||
type.set(fiatAccount.type);
|
||||
country.set(fiatAccount.country);
|
||||
currencyCode.set(fiatAccount.currencyCode);
|
||||
}
|
||||
else {
|
||||
reset();
|
||||
|
@ -134,12 +133,12 @@ class FiatAccountDataModel implements Activatable, DataModel {
|
|||
}
|
||||
|
||||
|
||||
void setType(FiatAccountType type) {
|
||||
void setType(FiatAccount.Type type) {
|
||||
this.type.set(type);
|
||||
|
||||
if (type != null) {
|
||||
primaryIDPrompt.set(type.getPrimaryId());
|
||||
secondaryIDPrompt.set(type.getSecondaryId());
|
||||
primaryIDPrompt.set(type.primaryId);
|
||||
secondaryIDPrompt.set(type.secondaryId);
|
||||
}
|
||||
else {
|
||||
primaryIDPrompt.set(null);
|
||||
|
|
|
@ -21,7 +21,6 @@ import io.bitsquare.common.viewfx.view.ActivatableViewAndModel;
|
|||
import io.bitsquare.common.viewfx.view.FxmlView;
|
||||
import io.bitsquare.common.viewfx.view.Wizard;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.gui.OverlayManager;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
|
@ -58,7 +57,7 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
|
|||
@FXML InputTextField nameOfBankTextField, holderNameTextField, primaryIDTextField, secondaryIDTextField;
|
||||
@FXML Button saveButton, completedButton, removeBankAccountButton;
|
||||
@FXML ComboBox<FiatAccount> selectionComboBox;
|
||||
@FXML ComboBox<FiatAccountType> typesComboBox;
|
||||
@FXML ComboBox<FiatAccount.Type> typesComboBox;
|
||||
@FXML ComboBox<String> currencyComboBox;
|
||||
|
||||
private Wizard wizard;
|
||||
|
@ -187,9 +186,9 @@ public class FiatAccountView extends ActivatableViewAndModel<GridPane, FiatAccou
|
|||
|
||||
model.country.addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
int regionIndex = regionComboBox.getItems().indexOf(newValue.getRegion());
|
||||
int regionIndex = regionComboBox.getItems().indexOf(newValue.region);
|
||||
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);
|
||||
if (countryIndex >= 0 && countryIndex < countryComboBox.getItems().size())
|
||||
|
|
|
@ -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.ViewModel;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
@ -54,7 +53,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
final StringProperty currencyCode = new SimpleStringProperty();
|
||||
final BooleanProperty selectionDisable = new SimpleBooleanProperty();
|
||||
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<>();
|
||||
|
||||
|
||||
|
@ -112,15 +111,15 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
}
|
||||
|
||||
|
||||
StringConverter<FiatAccountType> getTypesConverter() {
|
||||
return new StringConverter<FiatAccountType>() {
|
||||
StringConverter<FiatAccount.Type> getTypesConverter() {
|
||||
return new StringConverter<FiatAccount.Type>() {
|
||||
@Override
|
||||
public String toString(FiatAccountType TypeInfo) {
|
||||
public String toString(FiatAccount.Type TypeInfo) {
|
||||
return BSResources.get(TypeInfo.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FiatAccountType fromString(String s) {
|
||||
public FiatAccount.Type fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -130,7 +129,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
return new StringConverter<FiatAccount>() {
|
||||
@Override
|
||||
public String toString(FiatAccount fiatAccount) {
|
||||
return fiatAccount.getNameOfBank();
|
||||
return fiatAccount.nameOfBank;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +159,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
return new StringConverter<io.bitsquare.locale.Region>() {
|
||||
@Override
|
||||
public String toString(io.bitsquare.locale.Region region) {
|
||||
return region.getName();
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,7 +173,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
return new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.getName();
|
||||
return country.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -185,7 +184,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
}
|
||||
|
||||
|
||||
ObservableList<FiatAccountType> getAllTypes() {
|
||||
ObservableList<FiatAccount.Type> getAllTypes() {
|
||||
return dataModel.allTypes;
|
||||
}
|
||||
|
||||
|
@ -214,7 +213,7 @@ class FiatAccountViewModel extends ActivatableWithDataModel<FiatAccountDataModel
|
|||
}
|
||||
|
||||
|
||||
void setType(FiatAccountType type) {
|
||||
void setType(FiatAccount.Type type) {
|
||||
dataModel.setType(type);
|
||||
validateInput();
|
||||
}
|
||||
|
|
|
@ -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.DataModel;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.user.User;
|
||||
|
@ -40,10 +39,10 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
|||
|
||||
final StringProperty nickName = new SimpleStringProperty();
|
||||
final StringProperty currencyCode = new SimpleStringProperty();
|
||||
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
|
||||
|
||||
final ObservableList<FiatAccountType> allTypes =
|
||||
FXCollections.observableArrayList(FiatAccountType.getAllBankAccountTypes());
|
||||
final ObservableList<FiatAccount.Type> allTypes =
|
||||
FXCollections.observableArrayList(FiatAccount.Type.getAllBankAccountTypes());
|
||||
final ObservableList<String> allCurrencyCodes = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencyCodes());
|
||||
final ObservableList<FiatAccount> allFiatAccounts = FXCollections.observableArrayList();
|
||||
|
||||
|
@ -76,7 +75,7 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
|||
reset();
|
||||
}
|
||||
|
||||
void setType(FiatAccountType type) {
|
||||
void setType(FiatAccount.Type type) {
|
||||
this.type.set(type);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.FxmlView;
|
||||
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.Popups;
|
||||
import io.bitsquare.gui.main.help.Help;
|
||||
|
@ -45,7 +45,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
|||
@FXML HBox buttonsHBox;
|
||||
@FXML InputTextField ircNickNameTextField;
|
||||
@FXML Button saveButton;
|
||||
@FXML ComboBox<FiatAccountType> typesComboBox;
|
||||
@FXML ComboBox<FiatAccount.Type> typesComboBox;
|
||||
@FXML ComboBox<String> currencyComboBox;
|
||||
|
||||
private Wizard wizard;
|
||||
|
@ -62,13 +62,13 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
|||
typesComboBox.setItems(model.getAllTypes());
|
||||
typesComboBox.setConverter(model.getTypesConverter());
|
||||
// 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
|
||||
public ListCell<FiatAccountType> call(ListView<FiatAccountType> p) {
|
||||
return new ListCell<FiatAccountType>() {
|
||||
public ListCell<FiatAccount.Type> call(ListView<FiatAccount.Type> p) {
|
||||
return new ListCell<FiatAccount.Type>() {
|
||||
|
||||
@Override
|
||||
protected void updateItem(FiatAccountType item, boolean empty) {
|
||||
protected void updateItem(FiatAccount.Type item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
setText(model.getBankAccountType(item));
|
||||
|
@ -76,7 +76,7 @@ public class IrcAccountView extends ActivatableViewAndModel<GridPane, IrcAccount
|
|||
if (item == null || empty) {
|
||||
setGraphic(null);
|
||||
}
|
||||
else if (item != FiatAccountType.IRC) {
|
||||
else if (item != FiatAccount.Type.IRC) {
|
||||
setOpacity(0.3);
|
||||
setDisable(true);
|
||||
}
|
||||
|
|
|
@ -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.ViewModel;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
|
@ -43,7 +43,7 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
|
|||
final StringProperty ircNickName = new SimpleStringProperty();
|
||||
final StringProperty currencyCode = new SimpleStringProperty();
|
||||
final BooleanProperty saveButtonDisable = new SimpleBooleanProperty(true);
|
||||
final ObjectProperty<FiatAccountType> type = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<FiatAccount.Type> type = new SimpleObjectProperty<>();
|
||||
|
||||
@Inject
|
||||
public IrcAccountViewModel(IrcAccountDataModel dataModel, BankAccountNumberValidator nickNameValidator) {
|
||||
|
@ -67,21 +67,21 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
|
|||
return result;
|
||||
}
|
||||
|
||||
StringConverter<FiatAccountType> getTypesConverter() {
|
||||
return new StringConverter<FiatAccountType>() {
|
||||
StringConverter<FiatAccount.Type> getTypesConverter() {
|
||||
return new StringConverter<FiatAccount.Type>() {
|
||||
@Override
|
||||
public String toString(FiatAccountType TypeInfo) {
|
||||
public String toString(FiatAccount.Type TypeInfo) {
|
||||
return BSResources.get(TypeInfo.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FiatAccountType fromString(String s) {
|
||||
public FiatAccount.Type fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
String getBankAccountType(FiatAccountType fiatAccountType) {
|
||||
String getBankAccountType(FiatAccount.Type fiatAccountType) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class IrcAccountViewModel extends ActivatableWithDataModel<IrcAccountDataModel>
|
|||
}
|
||||
|
||||
|
||||
void setType(FiatAccountType type) {
|
||||
void setType(FiatAccount.Type type) {
|
||||
dataModel.setType(type);
|
||||
validateInput();
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
|||
Region region = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
countryComboBox.setItems(model.getAllCountriesFor(region));
|
||||
|
||||
addAllEuroCountriesButton.setVisible(region.getCode().equals("EU"));
|
||||
addAllEuroCountriesButton.setVisible(region.code.equals("EU"));
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
@ -223,7 +223,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
|||
regionComboBox.setConverter(new StringConverter<io.bitsquare.locale.Region>() {
|
||||
@Override
|
||||
public String toString(io.bitsquare.locale.Region region) {
|
||||
return region.getName();
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -248,11 +248,11 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateItem(final Country item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
label.setText(item.getName());
|
||||
removeButton.setOnAction(actionEvent -> removeCountry(item));
|
||||
public void updateItem(final Country country, boolean empty) {
|
||||
super.updateItem(country, empty);
|
||||
if (country != null && !empty) {
|
||||
label.setText(country.name);
|
||||
removeButton.setOnAction(actionEvent -> removeCountry(country));
|
||||
setGraphic(pane);
|
||||
}
|
||||
else {
|
||||
|
@ -266,7 +266,7 @@ public class RestrictionsView extends ActivatableViewAndModel<GridPane, Restrict
|
|||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.getName();
|
||||
return country.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -171,7 +171,7 @@ class PendingTradesViewModel extends ActivatableWithDataModel<PendingTradesDataM
|
|||
|
||||
// payment
|
||||
String getPaymentMethod() {
|
||||
return BSResources.get(dataModel.getTrade().getContract().getTakerFiatAccount().getFiatAccountType().toString());
|
||||
return BSResources.get(dataModel.getTrade().getContract().takerFiatAccount.type.toString());
|
||||
}
|
||||
|
||||
String getFiatAmount() {
|
||||
|
@ -179,15 +179,15 @@ class PendingTradesViewModel extends ActivatableWithDataModel<PendingTradesDataM
|
|||
}
|
||||
|
||||
String getHolderName() {
|
||||
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountHolderName();
|
||||
return dataModel.getTrade().getContract().takerFiatAccount.accountHolderName;
|
||||
}
|
||||
|
||||
String getPrimaryId() {
|
||||
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountPrimaryID();
|
||||
return dataModel.getTrade().getContract().takerFiatAccount.accountPrimaryID;
|
||||
}
|
||||
|
||||
String getSecondaryId() {
|
||||
return dataModel.getTrade().getContract().getTakerFiatAccount().getAccountSecondaryID();
|
||||
return dataModel.getTrade().getContract().takerFiatAccount.accountSecondaryID;
|
||||
}
|
||||
|
||||
// summary
|
||||
|
|
|
@ -261,11 +261,11 @@ class CreateOfferDataModel implements Activatable, DataModel {
|
|||
|
||||
private void applyBankAccount(FiatAccount fiatAccount) {
|
||||
if (fiatAccount != null) {
|
||||
bankAccountType.set(fiatAccount.getFiatAccountType().toString());
|
||||
bankAccountCurrency.set(fiatAccount.getCurrencyCode());
|
||||
bankAccountCounty.set(fiatAccount.getCountry().getName());
|
||||
bankAccountType.set(fiatAccount.type.toString());
|
||||
bankAccountCurrency.set(fiatAccount.currencyCode);
|
||||
bankAccountCounty.set(fiatAccount.country.name);
|
||||
|
||||
fiatCode.set(fiatAccount.getCurrencyCode());
|
||||
fiatCode.set(fiatAccount.currencyCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -152,14 +152,13 @@ class OfferBookDataModel implements Activatable, DataModel {
|
|||
if (currentFiatAccount == null)
|
||||
return true;
|
||||
|
||||
boolean countryResult = offer.getAcceptedCountries().contains(currentFiatAccount.getCountry());
|
||||
boolean countryResult = offer.getAcceptedCountries().contains(currentFiatAccount.country);
|
||||
// for IRC test version deactivate the check
|
||||
countryResult = true;
|
||||
if (!countryResult)
|
||||
restrictionsInfo.set("This offer requires that the payments account resides in one of those countries:\n" +
|
||||
formatter.countryLocalesToString(offer.getAcceptedCountries()) +
|
||||
"\n\nThe country of your payments account (" + user.currentFiatAccountPropertyProperty().get().getCountry()
|
||||
.getName() +
|
||||
"\n\nThe country of your payments account (" + user.currentFiatAccountPropertyProperty().get().country.name +
|
||||
") is not included in that list." +
|
||||
"\n\n Do you want to edit your preferences now?");
|
||||
|
||||
|
@ -245,9 +244,9 @@ class OfferBookDataModel implements Activatable, DataModel {
|
|||
|
||||
private void setBankAccount(FiatAccount fiatAccount) {
|
||||
if (fiatAccount != null) {
|
||||
fiatCode.set(fiatAccount.getCurrencyCode());
|
||||
bankAccountCountry.set(fiatAccount.getCountry());
|
||||
sortedItems.stream().forEach(e -> e.setBankAccountCountry(fiatAccount.getCountry()));
|
||||
fiatCode.set(fiatAccount.currencyCode);
|
||||
bankAccountCountry.set(fiatAccount.country);
|
||||
sortedItems.stream().forEach(e -> e.setBankAccountCountry(fiatAccount.country));
|
||||
}
|
||||
else {
|
||||
fiatCode.set(CurrencyUtil.getDefaultCurrencyAsCode());
|
||||
|
|
|
@ -586,7 +586,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
Country country = offerBookListItem.getOffer().getBankAccountCountry();
|
||||
hBox.getChildren().add(ImageUtil.getCountryIconImageView(offerBookListItem
|
||||
.getOffer().getBankAccountCountry()));
|
||||
Tooltip.install(this, new Tooltip(country.getName()));
|
||||
Tooltip.install(this, new Tooltip(country.name));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -144,7 +144,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
acceptedArbitratorIds = formatter.arbitratorIdsToNames(offer.getArbitratorIds());
|
||||
bankAccountType = BSResources.get(offer.getFiatAccountType().toString());
|
||||
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));
|
||||
applyOfferState(offer.stateProperty().get());
|
||||
|
|
|
@ -82,11 +82,11 @@ public class BSFormatter {
|
|||
if (user.currentFiatAccountPropertyProperty().get() == null)
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
|
||||
else if (user.currentFiatAccountPropertyProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode());
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
|
||||
|
||||
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue != null)
|
||||
setFiatCurrencyCode(newValue.getCurrencyCode());
|
||||
setFiatCurrencyCode(newValue.currencyCode);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ public class BSFormatter {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -50,10 +50,10 @@ public class ImageUtil {
|
|||
|
||||
public static ImageView getCountryIconImageView(Country country) {
|
||||
try {
|
||||
return ImageUtil.getImageViewByUrl("/images/countries/" + country.getCode().toLowerCase() + ".png");
|
||||
return ImageUtil.getImageViewByUrl("/images/countries/" + country.code.toLowerCase() + ".png");
|
||||
} catch (Exception e) {
|
||||
log.error("Country icon not found URL = /images/countries/" + country.getCode().toLowerCase() +
|
||||
".png / country name = " + country.getName());
|
||||
log.error("Country icon not found URL = /images/countries/" + country.code.toLowerCase() +
|
||||
".png / country name = " + country.name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,11 +42,11 @@ public final class FiatValidator extends NumberValidator {
|
|||
if (user.currentFiatAccountPropertyProperty().get() == null)
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
|
||||
else if (user.currentFiatAccountPropertyProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode());
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
|
||||
|
||||
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue != null)
|
||||
setFiatCurrencyCode(newValue.getCurrencyCode());
|
||||
setFiatCurrencyCode(newValue.currencyCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,11 +42,11 @@ public final class OptionalFiatValidator extends NumberValidator {
|
|||
if (user.currentFiatAccountPropertyProperty().get() == null)
|
||||
setFiatCurrencyCode(CurrencyUtil.getDefaultCurrencyAsCode());
|
||||
else if (user.currentFiatAccountPropertyProperty().get() != null)
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().getCurrencyCode());
|
||||
setFiatCurrencyCode(user.currentFiatAccountPropertyProperty().get().currencyCode);
|
||||
|
||||
user.currentFiatAccountPropertyProperty().addListener((ov, oldValue, newValue) -> {
|
||||
if (newValue != null)
|
||||
setFiatCurrencyCode(newValue.getCurrencyCode());
|
||||
setFiatCurrencyCode(newValue.currencyCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ package io.bitsquare.locale;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.concurrent.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.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
private final Region region;
|
||||
public final String code;
|
||||
public final String name;
|
||||
public final Region region;
|
||||
|
||||
public Country(String code, String name, Region region) {
|
||||
this.code = code;
|
||||
|
@ -38,40 +36,33 @@ public class Country implements Serializable {
|
|||
this.region = region;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
Country country = (Country) o;
|
||||
|
||||
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
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
int result = code != null ? code.hashCode() : 0;
|
||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||
result = 31 * result + (region != null ? region.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "code='" + code + '\'' +
|
||||
return "Country{" +
|
||||
"code='" + code + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", getRegion='" + region;
|
||||
", region=" + region +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class CountryUtil {
|
|||
|
||||
public static List<Country> getAllCountriesFor(Region selectedRegion) {
|
||||
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() {
|
||||
|
|
|
@ -19,8 +19,6 @@ package io.bitsquare.locale;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.concurrent.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.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
public final String code;
|
||||
public final String name;
|
||||
|
||||
public Region(String code, String name) {
|
||||
this.code = code;
|
||||
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() {
|
||||
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
|
||||
public String toString() {
|
||||
return "regionCode='" + code + '\'' +
|
||||
", continentName='" + name;
|
||||
return "Region{" +
|
||||
"code='" + code + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package io.bitsquare.offer;
|
||||
|
||||
import io.bitsquare.btc.Restrictions;
|
||||
import io.bitsquare.fiat.FiatAccountType;
|
||||
import io.bitsquare.fiat.FiatAccount;
|
||||
import io.bitsquare.locale.Country;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -70,7 +70,7 @@ public class Offer implements Serializable {
|
|||
private final Coin amount;
|
||||
private final Coin minAmount;
|
||||
private final PublicKey p2pSigPubKey;
|
||||
private final FiatAccountType fiatAccountType;
|
||||
private final FiatAccount.Type fiatAccountType;
|
||||
private final Country bankAccountCountry;
|
||||
|
||||
private final Coin securityDeposit;
|
||||
|
@ -98,7 +98,7 @@ public class Offer implements Serializable {
|
|||
long fiatPrice,
|
||||
Coin amount,
|
||||
Coin minAmount,
|
||||
FiatAccountType fiatAccountType,
|
||||
FiatAccount.Type fiatAccountType,
|
||||
String currencyCode,
|
||||
Country bankAccountCountry,
|
||||
String bankAccountUID,
|
||||
|
@ -217,7 +217,7 @@ public class Offer implements Serializable {
|
|||
return direction == Direction.BUY ? Direction.SELL : Direction.BUY;
|
||||
}
|
||||
|
||||
public FiatAccountType getFiatAccountType() {
|
||||
public FiatAccount.Type getFiatAccountType() {
|
||||
return fiatAccountType;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,8 +137,8 @@ public class OfferBook {
|
|||
private void setBankAccount(FiatAccount fiatAccount) {
|
||||
log.debug("setBankAccount " + fiatAccount);
|
||||
if (fiatAccount != null) {
|
||||
country = fiatAccount.getCountry();
|
||||
fiatCode = fiatAccount.getCurrencyCode();
|
||||
country = fiatAccount.country;
|
||||
fiatCode = fiatAccount.currencyCode;
|
||||
|
||||
// TODO check why that was used (probably just for update triggering, if so refactor that)
|
||||
//offerBookListItems.stream().forEach(e -> e.setBankAccountCountry(country));
|
||||
|
|
|
@ -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.
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Offer offer;
|
||||
private final String takeOfferFeeTxID;
|
||||
private final Coin tradeAmount;
|
||||
private final String offererAccountID;
|
||||
private final String takerAccountID;
|
||||
private final FiatAccount offererFiatAccount;
|
||||
private final FiatAccount takerFiatAccount;
|
||||
private final String offererP2PSigPubKeyAsString;
|
||||
private final String takerP2PSigPubKeyAsString;
|
||||
public final Offer offer;
|
||||
public final String takeOfferFeeTxID;
|
||||
public final Coin tradeAmount;
|
||||
public final String offererAccountID;
|
||||
public final String takerAccountID;
|
||||
public final FiatAccount offererFiatAccount;
|
||||
public final FiatAccount takerFiatAccount;
|
||||
public final String offererP2PSigPubKeyAsString;
|
||||
public final String takerP2PSigPubKeyAsString;
|
||||
|
||||
public Contract(Offer offer,
|
||||
Coin tradeAmount,
|
||||
|
@ -64,47 +64,6 @@ public class Contract implements Serializable {
|
|||
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
|
||||
public String toString() {
|
||||
return "Contract{" +
|
||||
|
@ -113,10 +72,10 @@ public class Contract implements Serializable {
|
|||
", tradeAmount=" + tradeAmount +
|
||||
", offererAccountID='" + offererAccountID + '\'' +
|
||||
", takerAccountID='" + takerAccountID + '\'' +
|
||||
", offererBankAccount=" + offererFiatAccount +
|
||||
", takerBankAccount=" + takerFiatAccount +
|
||||
", takerP2PSigPubKeyAsString=" + takerP2PSigPubKeyAsString +
|
||||
", offererP2PSigPubKeyAsString=" + offererP2PSigPubKeyAsString +
|
||||
", offererFiatAccount=" + offererFiatAccount +
|
||||
", takerFiatAccount=" + takerFiatAccount +
|
||||
", offererP2PSigPubKeyAsString='" + offererP2PSigPubKeyAsString + '\'' +
|
||||
", takerP2PSigPubKeyAsString='" + takerP2PSigPubKeyAsString + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,10 +172,10 @@ public class TradeManager {
|
|||
price.getValue(),
|
||||
amount,
|
||||
minAmount,
|
||||
currentFiatAccount.getFiatAccountType(),
|
||||
currentFiatAccount.getCurrencyCode(),
|
||||
currentFiatAccount.getCountry(),
|
||||
currentFiatAccount.getId(),
|
||||
currentFiatAccount.type,
|
||||
currentFiatAccount.currencyCode,
|
||||
currentFiatAccount.country,
|
||||
currentFiatAccount.id,
|
||||
accountSettings.getAcceptedArbitratorIds(),
|
||||
accountSettings.getSecurityDeposit(),
|
||||
accountSettings.getAcceptedCountries(),
|
||||
|
|
|
@ -181,7 +181,7 @@ public class User implements Serializable {
|
|||
|
||||
public FiatAccount getFiatAccount(String fiatAccountId) {
|
||||
for (FiatAccount fiatAccount : fiatAccountsObservableList) {
|
||||
if (fiatAccount.getId().equals(fiatAccountId)) {
|
||||
if (fiatAccount.id.equals(fiatAccountId)) {
|
||||
return fiatAccount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
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.validation.BtcValidator;
|
||||
import io.bitsquare.gui.util.validation.FiatValidator;
|
||||
|
@ -97,10 +97,10 @@ public class CreateOfferViewModelTest {
|
|||
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());
|
||||
|
||||
model.bankAccountType.set(FiatAccountType.WIRE.toString());
|
||||
model.bankAccountType.set(FiatAccount.Type.WIRE.toString());
|
||||
assertEquals("Wire", presenter.bankAccountType.get());
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue