diff --git a/common/src/main/java/io/bitsquare/app/Log.java b/common/src/main/java/io/bitsquare/app/Log.java
index 15b8694eb2..54370c784e 100644
--- a/common/src/main/java/io/bitsquare/app/Log.java
+++ b/common/src/main/java/io/bitsquare/app/Log.java
@@ -48,7 +48,7 @@ public class Log {
rollingPolicy.start();
triggeringPolicy = new SizeBasedTriggeringPolicy();
- triggeringPolicy.setMaxFileSize("10MB");
+ triggeringPolicy.setMaxFileSize("1MB");
triggeringPolicy.start();
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
@@ -63,7 +63,7 @@ public class Log {
logbackLogger = loggerContext.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
//TODO for now use always trace
- logbackLogger.setLevel(useDetailedLogging ? Level.INFO : Level.INFO);
+ logbackLogger.setLevel(useDetailedLogging ? Level.TRACE : Level.INFO);
// logbackLogger.setLevel(useDetailedLogging ? Level.TRACE : Level.DEBUG);
logbackLogger.addAppender(appender);
}
diff --git a/common/src/main/java/io/bitsquare/common/util/Tuple4.java b/common/src/main/java/io/bitsquare/common/util/Tuple4.java
new file mode 100644
index 0000000000..2e90f8e57f
--- /dev/null
+++ b/common/src/main/java/io/bitsquare/common/util/Tuple4.java
@@ -0,0 +1,57 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.common.util;
+
+import java.io.Serializable;
+
+public class Tuple4 implements Serializable {
+ final public A first;
+ final public B second;
+ final public C third;
+ final public D forth;
+
+ public Tuple4(A first, B second, C third, D forth) {
+ this.first = first;
+ this.second = second;
+ this.third = third;
+ this.forth = forth;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Tuple4)) return false;
+
+ Tuple4, ?, ?, ?> tuple4 = (Tuple4, ?, ?, ?>) o;
+
+ if (first != null ? !first.equals(tuple4.first) : tuple4.first != null) return false;
+ if (second != null ? !second.equals(tuple4.second) : tuple4.second != null) return false;
+ if (third != null ? !third.equals(tuple4.third) : tuple4.third != null) return false;
+ return !(forth != null ? !forth.equals(tuple4.forth) : tuple4.forth != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = first != null ? first.hashCode() : 0;
+ result = 31 * result + (second != null ? second.hashCode() : 0);
+ result = 31 * result + (third != null ? third.hashCode() : 0);
+ result = 31 * result + (forth != null ? forth.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/locale/BankUtil.java b/core/src/main/java/io/bitsquare/locale/BankUtil.java
new file mode 100644
index 0000000000..1eefbd1ae7
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/locale/BankUtil.java
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.locale;
+
+public class BankUtil {
+
+ public static boolean requiresHolderId(String countryCode) {
+ if (countryCode != null) {
+ switch (countryCode) {
+ case "BR":
+ return true;
+ default:
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public static String getHolderIdLabel(String countryCode) {
+ if (countryCode != null) {
+ switch (countryCode) {
+ case "BR":
+ return "CPF Number:";
+ default:
+ return "Holder ID:";
+ }
+ } else {
+ return "Holder ID:";
+ }
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/locale/Country.java b/core/src/main/java/io/bitsquare/locale/Country.java
index c8b410267b..71ab2a56ac 100644
--- a/core/src/main/java/io/bitsquare/locale/Country.java
+++ b/core/src/main/java/io/bitsquare/locale/Country.java
@@ -29,7 +29,7 @@ public final class Country implements Persistable {
public final String code;
public final String name;
- private final Region region;
+ public final Region region;
public Country(String code, String name, Region region) {
this.code = code;
diff --git a/core/src/main/java/io/bitsquare/locale/CountryUtil.java b/core/src/main/java/io/bitsquare/locale/CountryUtil.java
index 1c432b767a..c4779039a4 100644
--- a/core/src/main/java/io/bitsquare/locale/CountryUtil.java
+++ b/core/src/main/java/io/bitsquare/locale/CountryUtil.java
@@ -17,12 +17,11 @@
package io.bitsquare.locale;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
import io.bitsquare.user.Preferences;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
+import java.util.*;
import java.util.stream.Collectors;
public class CountryUtil {
@@ -92,10 +91,71 @@ public class CountryUtil {
return getNamesByCodes(countryCodes).stream().collect(Collectors.joining(",\n"));
}
+ public static List getAllRegions() {
+ final List allRegions = new ArrayList<>();
+
+ String regionCode = "NA";
+ Region region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ regionCode = "SA";
+ region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ regionCode = "AF";
+ region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ regionCode = "EU";
+ region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ regionCode = "AS";
+ region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ regionCode = "OC";
+ region = new Region(regionCode, getRegionName(regionCode));
+ allRegions.add(region);
+
+ return allRegions;
+ }
+
+ public static List getAllCountriesForRegion(Region selectedRegion) {
+ return Lists.newArrayList(Collections2.filter(getAllCountries(), country ->
+ selectedRegion != null && country != null && selectedRegion.equals(country.region)));
+ }
+
+ private static List getAllCountries() {
+ final List allCountries = new ArrayList<>();
+ for (final Locale locale : getAllCountryLocales()) {
+ String regionCode = getRegionCode(locale.getCountry());
+ final Region region = new Region(regionCode, getRegionName(regionCode));
+ final Country country = new Country(locale.getCountry(), locale.getDisplayCountry(), region);
+ allCountries.add(country);
+ }
+ return allCountries;
+ }
+
+ // We use getAvailableLocales as we depend on display names (would be a bit painful with translations if handled
+ // from a static list -or we find something ready made?).
+ private static List getAllCountryLocales() {
+ List allLocales = Arrays.asList(Locale.getAvailableLocales());
+ Set allLocalesAsSet = allLocales.stream().filter(locale -> !"".equals(locale.getCountry()))
+ .map(locale -> new Locale("", locale.getCountry(), ""))
+ .collect(Collectors.toSet());
+
+ allLocales = new ArrayList<>();
+ allLocales.addAll(allLocalesAsSet);
+ allLocales.sort((locale1, locale2) -> locale1.getDisplayCountry().compareTo(locale2.getDisplayCountry()));
+ return allLocales;
+ }
+
private static List getNamesByCodes(List countryCodes) {
return countryCodes.stream().map(CountryUtil::getNameByCode).collect(Collectors.toList());
}
+ // other source of countries: https://developers.braintreepayments.com/reference/general/countries/java
private static final String[] countryCodes = new String[]{"AE", "AL", "AR", "AT", "AU", "BA", "BE", "BG", "BH",
"BO", "BR", "BY", "CA", "CH", "CL", "CN", "CO", "CR", "CS", "CU", "CY", "CZ", "DE", "DK", "DO", "DZ",
"EC", "EE", "EG", "ES", "FI", "FR", "GB", "GR", "GT", "HK", "HN", "HR", "HU", "ID", "IE", "IL", "IN",
diff --git a/core/src/main/java/io/bitsquare/locale/Region.java b/core/src/main/java/io/bitsquare/locale/Region.java
index 00e74aff59..1688ec6545 100644
--- a/core/src/main/java/io/bitsquare/locale/Region.java
+++ b/core/src/main/java/io/bitsquare/locale/Region.java
@@ -27,8 +27,8 @@ public final class Region implements Persistable {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
- 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;
diff --git a/core/src/main/java/io/bitsquare/payment/AliPayAccount.java b/core/src/main/java/io/bitsquare/payment/AliPayAccount.java
index c2bdcc2106..8be780b20d 100644
--- a/core/src/main/java/io/bitsquare/payment/AliPayAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/AliPayAccount.java
@@ -27,8 +27,11 @@ public final class AliPayAccount extends PaymentAccount {
public AliPayAccount() {
super(PaymentMethod.ALI_PAY);
setSingleTradeCurrency(new FiatCurrency("CNY"));
+ }
- contractData = new AliPayAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new AliPayAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setAccountNr(String accountNr) {
diff --git a/core/src/main/java/io/bitsquare/payment/BankAccountContractData.java b/core/src/main/java/io/bitsquare/payment/BankAccountContractData.java
new file mode 100644
index 0000000000..ad540b667f
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/BankAccountContractData.java
@@ -0,0 +1,112 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+import io.bitsquare.locale.BankUtil;
+import io.bitsquare.locale.CountryUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class BankAccountContractData extends PaymentAccountContractData {
+ // That object is sent over the wire, so we need to take care of version compatibility.
+ private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
+
+ private static final Logger log = LoggerFactory.getLogger(BankAccountContractData.class);
+
+ private String holderName;
+ private String bankName;
+ private String bankId;
+ private String branchId;
+ private String accountNr;
+ private String holderId;
+
+ public BankAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
+ super(paymentMethod, id, maxTradePeriod);
+ }
+
+ @Override
+ public String getPaymentDetails() {
+ return "National Bank transfer - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
+ }
+
+ @Override
+ public String getPaymentDetailsForTradePopup() {
+ String holderIdString = BankUtil.requiresHolderId(countryCode) ? (getHolderIdLabel() + ": " + holderId + "\n") : "";
+ return "Holder name: " + holderName + "\n" +
+ "Bank name: " + bankName + "\n" +
+ "Bank Nr.: " + bankId + "\n" +
+ "Branch Nr.: " + branchId + "\n" +
+ "Account Nr.: " + accountNr + "\n" +
+ holderIdString +
+ "Country of bank: " + CountryUtil.getNameAndCode(getCountryCode());
+ }
+
+
+ public void setHolderName(String holderName) {
+ this.holderName = holderName;
+ }
+
+ public String getHolderName() {
+ return holderName;
+ }
+
+ public void setBankName(String bankName) {
+ this.bankName = bankName;
+ }
+
+ public String getBankName() {
+ return bankName;
+ }
+
+ public void setBankId(String bankId) {
+ this.bankId = bankId;
+ }
+
+ public String getBankId() {
+ return bankId;
+ }
+
+ public String getBranchId() {
+ return branchId;
+ }
+
+ public void setBranchId(String branchId) {
+ this.branchId = branchId;
+ }
+
+ public String getAccountNr() {
+ return accountNr;
+ }
+
+ public void setAccountNr(String accountNr) {
+ this.accountNr = accountNr;
+ }
+
+ public String getHolderId() {
+ return holderId;
+ }
+
+ public void setHolderId(String holderId) {
+ this.holderId = holderId;
+ }
+
+ public String getHolderIdLabel() {
+ return BankUtil.getHolderIdLabel(countryCode);
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/BlockChainAccount.java b/core/src/main/java/io/bitsquare/payment/BlockChainAccount.java
index 3c7049f764..fe1d109181 100644
--- a/core/src/main/java/io/bitsquare/payment/BlockChainAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/BlockChainAccount.java
@@ -27,7 +27,11 @@ public final class BlockChainAccount extends PaymentAccount {
public BlockChainAccount() {
super(PaymentMethod.BLOCK_CHAINS);
- contractData = new BlockChainAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ }
+
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new BlockChainAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setAddress(String address) {
diff --git a/core/src/main/java/io/bitsquare/payment/NationalBankAccount.java b/core/src/main/java/io/bitsquare/payment/NationalBankAccount.java
new file mode 100644
index 0000000000..57b43f5679
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/NationalBankAccount.java
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+
+public final class NationalBankAccount extends PaymentAccount {
+ // That object is saved to disc. We need to take care of changes to not break deserialization.
+ private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
+
+ public NationalBankAccount() {
+ super(PaymentMethod.NATIONAL_BANK);
+ }
+
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new NationalBankAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/NationalBankAccountContractData.java b/core/src/main/java/io/bitsquare/payment/NationalBankAccountContractData.java
new file mode 100644
index 0000000000..15323ce495
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/NationalBankAccountContractData.java
@@ -0,0 +1,38 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class NationalBankAccountContractData extends BankAccountContractData {
+ // That object is sent over the wire, so we need to take care of version compatibility.
+ private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
+
+ private static final Logger log = LoggerFactory.getLogger(NationalBankAccountContractData.class);
+
+ public NationalBankAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
+ super(paymentMethod, id, maxTradePeriod);
+ }
+
+ @Override
+ public String getPaymentDetails() {
+ return "National Bank transfer - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/OKPayAccount.java b/core/src/main/java/io/bitsquare/payment/OKPayAccount.java
index b6cfa56371..4842e9dca1 100644
--- a/core/src/main/java/io/bitsquare/payment/OKPayAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/OKPayAccount.java
@@ -31,7 +31,11 @@ public final class OKPayAccount extends PaymentAccount {
public OKPayAccount() {
super(PaymentMethod.OK_PAY);
tradeCurrencies.addAll(CurrencyUtil.getAllOKPayCurrencies());
- contractData = new OKPayAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ }
+
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new OKPayAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setAccountNr(String accountNr) {
diff --git a/core/src/main/java/io/bitsquare/payment/PaymentAccount.java b/core/src/main/java/io/bitsquare/payment/PaymentAccount.java
index 7a0fc3a09a..3a0f544fe2 100644
--- a/core/src/main/java/io/bitsquare/payment/PaymentAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/PaymentAccount.java
@@ -44,7 +44,7 @@ public abstract class PaymentAccount implements Persistable {
protected TradeCurrency selectedTradeCurrency;
@Nullable
protected Country country = null;
- PaymentAccountContractData contractData;
+ public final PaymentAccountContractData contractData;
///////////////////////////////////////////////////////////////////////////////////////////
@@ -56,6 +56,7 @@ public abstract class PaymentAccount implements Persistable {
this.paymentMethod = paymentMethod;
id = UUID.randomUUID().toString();
creationDate = new Date();
+ contractData = setContractData();
}
@@ -95,6 +96,8 @@ public abstract class PaymentAccount implements Persistable {
// Getter, Setter
///////////////////////////////////////////////////////////////////////////////////////////
+ protected abstract PaymentAccountContractData setContractData();
+
public String getAccountName() {
return accountName;
}
diff --git a/core/src/main/java/io/bitsquare/payment/PaymentAccountContractData.java b/core/src/main/java/io/bitsquare/payment/PaymentAccountContractData.java
index ca5d4ab4e9..3ce0154df9 100644
--- a/core/src/main/java/io/bitsquare/payment/PaymentAccountContractData.java
+++ b/core/src/main/java/io/bitsquare/payment/PaymentAccountContractData.java
@@ -31,7 +31,7 @@ public abstract class PaymentAccountContractData implements Payload {
private final int maxTradePeriod;
@Nullable
- private String countryCode;
+ protected String countryCode;
///////////////////////////////////////////////////////////////////////////////////////////
diff --git a/core/src/main/java/io/bitsquare/payment/PaymentAccountFactory.java b/core/src/main/java/io/bitsquare/payment/PaymentAccountFactory.java
new file mode 100644
index 0000000000..1e3b362ea8
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/PaymentAccountFactory.java
@@ -0,0 +1,51 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.common.persistance.Persistable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class PaymentAccountFactory implements Persistable {
+ private static final Logger log = LoggerFactory.getLogger(PaymentAccountFactory.class);
+
+ public static PaymentAccount getPaymentAccount(PaymentMethod paymentMethod) {
+ switch (paymentMethod.getId()) {
+ case PaymentMethod.OK_PAY_ID:
+ return new OKPayAccount();
+ case PaymentMethod.PERFECT_MONEY_ID:
+ return new PerfectMoneyAccount();
+ case PaymentMethod.SEPA_ID:
+ return new SepaAccount();
+ case PaymentMethod.NATIONAL_BANK_ID:
+ return new NationalBankAccount();
+ case PaymentMethod.SAME_BANK_ID:
+ return new SameBankAccount();
+ case PaymentMethod.SPECIFIC_BANKS_ID:
+ return new SpecificBankAccount();
+ case PaymentMethod.ALI_PAY_ID:
+ return new AliPayAccount();
+ case PaymentMethod.SWISH_ID:
+ return new SwishAccount();
+ case PaymentMethod.BLOCK_CHAINS_ID:
+ return new BlockChainAccount();
+ default:
+ throw new RuntimeException("Not supported PaymentMethod: " + paymentMethod);
+ }
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/PaymentMethod.java b/core/src/main/java/io/bitsquare/payment/PaymentMethod.java
index feef66690e..56a563ee4e 100644
--- a/core/src/main/java/io/bitsquare/payment/PaymentMethod.java
+++ b/core/src/main/java/io/bitsquare/payment/PaymentMethod.java
@@ -41,6 +41,9 @@ public final class PaymentMethod implements Persistable, Comparable {
public static final String OK_PAY_ID = "OK_PAY";
public static final String PERFECT_MONEY_ID = "PERFECT_MONEY";
public static final String SEPA_ID = "SEPA";
+ public static final String NATIONAL_BANK_ID = "NATIONAL_BANK";
+ public static final String SAME_BANK_ID = "SAME_BANK";
+ public static final String SPECIFIC_BANKS_ID = "SPECIFIC_BANKS";
public static final String SWISH_ID = "SWISH";
public static final String ALI_PAY_ID = "ALI_PAY";
/* public static final String FED_WIRE="FED_WIRE";*/
@@ -51,6 +54,9 @@ public final class PaymentMethod implements Persistable, Comparable {
public static PaymentMethod OK_PAY;
public static PaymentMethod PERFECT_MONEY;
public static PaymentMethod SEPA;
+ public static PaymentMethod NATIONAL_BANK;
+ public static PaymentMethod SAME_BANK;
+ public static PaymentMethod SPECIFIC_BANKS;
public static PaymentMethod SWISH;
public static PaymentMethod ALI_PAY;
/* public static PaymentMethod FED_WIRE;*/
@@ -62,6 +68,9 @@ public final class PaymentMethod implements Persistable, Comparable {
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY), // tx instant so min. wait time
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, 0, DAY),
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY), // sepa takes 1-3 business days. We use 8 days to include safety for holidays
+ NATIONAL_BANK = new PaymentMethod(NATIONAL_BANK_ID, 0, 4 * DAY),
+ SAME_BANK = new PaymentMethod(SAME_BANK_ID, 0, 2 * DAY),
+ SPECIFIC_BANKS = new PaymentMethod(SPECIFIC_BANKS_ID, 0, 4 * DAY),
SWISH = new PaymentMethod(SWISH_ID, 0, DAY),
ALI_PAY = new PaymentMethod(ALI_PAY_ID, 0, DAY),
/* FED_WIRE = new PaymentMethod(FED_WIRE_ID, 0, DAY),*/
@@ -91,7 +100,7 @@ public final class PaymentMethod implements Persistable, Comparable {
this.maxTradePeriod = maxTradePeriod;
}
- public static PaymentMethod getPaymentMethodByName(String name) {
+ public static PaymentMethod getPaymentMethodById(String name) {
return ALL_VALUES.stream().filter(e -> e.getId().equals(name)).findFirst().get();
}
diff --git a/core/src/main/java/io/bitsquare/payment/PerfectMoneyAccount.java b/core/src/main/java/io/bitsquare/payment/PerfectMoneyAccount.java
index 2a3698bbe6..ffbbf6335b 100644
--- a/core/src/main/java/io/bitsquare/payment/PerfectMoneyAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/PerfectMoneyAccount.java
@@ -27,8 +27,11 @@ public final class PerfectMoneyAccount extends PaymentAccount {
public PerfectMoneyAccount() {
super(PaymentMethod.PERFECT_MONEY);
setSingleTradeCurrency(new FiatCurrency("USD"));
+ }
- contractData = new PerfectMoneyAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new PerfectMoneyAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setAccountNr(String accountNr) {
@@ -38,4 +41,6 @@ public final class PerfectMoneyAccount extends PaymentAccount {
public String getAccountNr() {
return ((PerfectMoneyAccountContractData) contractData).getAccountNr();
}
+
+
}
diff --git a/core/src/main/java/io/bitsquare/payment/SameBankAccount.java b/core/src/main/java/io/bitsquare/payment/SameBankAccount.java
new file mode 100644
index 0000000000..3f687051d1
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/SameBankAccount.java
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+
+public final class SameBankAccount extends PaymentAccount {
+ // That object is saved to disc. We need to take care of changes to not break deserialization.
+ private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
+
+ public SameBankAccount() {
+ super(PaymentMethod.SAME_BANK);
+ }
+
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new SameBankAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/SameBankAccountContractData.java b/core/src/main/java/io/bitsquare/payment/SameBankAccountContractData.java
new file mode 100644
index 0000000000..6811ef0219
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/SameBankAccountContractData.java
@@ -0,0 +1,39 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class SameBankAccountContractData extends BankAccountContractData {
+ // That object is sent over the wire, so we need to take care of version compatibility.
+ private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
+
+ private static final Logger log = LoggerFactory.getLogger(SameBankAccountContractData.class);
+
+
+ public SameBankAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
+ super(paymentMethod, id, maxTradePeriod);
+ }
+
+ @Override
+ public String getPaymentDetails() {
+ return "Transfer with same Bank - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/SepaAccount.java b/core/src/main/java/io/bitsquare/payment/SepaAccount.java
index 1e6571453e..3e04f77771 100644
--- a/core/src/main/java/io/bitsquare/payment/SepaAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/SepaAccount.java
@@ -27,8 +27,11 @@ public final class SepaAccount extends PaymentAccount {
public SepaAccount() {
super(PaymentMethod.SEPA);
+ }
- contractData = new SepaAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new SepaAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setHolderName(String holderName) {
@@ -67,4 +70,5 @@ public final class SepaAccount extends PaymentAccount {
((SepaAccountContractData) contractData).removeAcceptedCountry(countryCode);
}
+
}
diff --git a/core/src/main/java/io/bitsquare/payment/SpecificBankAccount.java b/core/src/main/java/io/bitsquare/payment/SpecificBankAccount.java
new file mode 100644
index 0000000000..6ffc1b911e
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/SpecificBankAccount.java
@@ -0,0 +1,34 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+
+public final class SpecificBankAccount extends PaymentAccount {
+ // That object is saved to disc. We need to take care of changes to not break deserialization.
+ private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
+
+ public SpecificBankAccount() {
+ super(PaymentMethod.SPECIFIC_BANKS);
+ }
+
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new SpecificBanksAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/SpecificBanksAccountContractData.java b/core/src/main/java/io/bitsquare/payment/SpecificBanksAccountContractData.java
new file mode 100644
index 0000000000..70fd789999
--- /dev/null
+++ b/core/src/main/java/io/bitsquare/payment/SpecificBanksAccountContractData.java
@@ -0,0 +1,59 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.payment;
+
+import io.bitsquare.app.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+
+public final class SpecificBanksAccountContractData extends BankAccountContractData {
+ // That object is sent over the wire, so we need to take care of version compatibility.
+ private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
+
+ private static final Logger log = LoggerFactory.getLogger(SpecificBanksAccountContractData.class);
+
+
+ // Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match
+ private ArrayList acceptedBanks;
+
+ public SpecificBanksAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
+ super(paymentMethod, id, maxTradePeriod);
+ acceptedBanks = new ArrayList<>();
+ }
+
+ public void clearAcceptedBanks() {
+ acceptedBanks = new ArrayList<>();
+ }
+
+ public void addAcceptedBank(String bankName) {
+ if (!acceptedBanks.contains(bankName))
+ acceptedBanks.add(bankName);
+ }
+
+ public ArrayList getAcceptedBanks() {
+ return acceptedBanks;
+ }
+
+
+ @Override
+ public String getPaymentDetails() {
+ return "Transfers with specific banks - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
+ }
+}
diff --git a/core/src/main/java/io/bitsquare/payment/SwishAccount.java b/core/src/main/java/io/bitsquare/payment/SwishAccount.java
index d5cb1804c1..7b24dcb5e8 100644
--- a/core/src/main/java/io/bitsquare/payment/SwishAccount.java
+++ b/core/src/main/java/io/bitsquare/payment/SwishAccount.java
@@ -27,8 +27,11 @@ public final class SwishAccount extends PaymentAccount {
public SwishAccount() {
super(PaymentMethod.SWISH);
setSingleTradeCurrency(new FiatCurrency("SEK"));
+ }
- contractData = new SwishAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
+ @Override
+ protected PaymentAccountContractData setContractData() {
+ return new SwishAccountContractData(paymentMethod.getId(), id, paymentMethod.getMaxTradePeriod());
}
public void setMobileNr(String mobileNr) {
diff --git a/core/src/main/java/io/bitsquare/payment/unused/FedWireAccount.java b/core/src/main/java/io/bitsquare/payment/unused/FedWireAccount.java
deleted file mode 100644
index ee118869e0..0000000000
--- a/core/src/main/java/io/bitsquare/payment/unused/FedWireAccount.java
+++ /dev/null
@@ -1,95 +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 .
- */
-
-package io.bitsquare.payment.unused;
-
-import io.bitsquare.app.Version;
-import io.bitsquare.payment.PaymentAccount;
-import io.bitsquare.payment.PaymentMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// US only
-public final class FedWireAccount extends PaymentAccount {
- // That object is saved to disc. We need to take care of changes to not break deserialization.
- private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
-
- private static final Logger log = LoggerFactory.getLogger(FedWireAccount.class);
-
- private String holderName;
- private String holderState;
- private String holderZIP;
- private String holderStreet;
- private String holderCity;
- private String holderSSN; // Optional? social security Nr only Arizona and Oklahoma?
- private String accountNr;
- private String bankCode;// SWIFT Code/BIC/RoutingNr/ABA (ABA for UD domestic)
- private String bankName;
- private String bankState;
- private String bankZIP;
- private String bankStreet;
- private String bankCity;
-
- private FedWireAccount() {
- super(PaymentMethod.SEPA);
- }
-
- public String getHolderName() {
- return holderName;
- }
-
- public void setHolderName(String holderName) {
- this.holderName = holderName;
- }
-
- public String getAccountNr() {
- return accountNr;
- }
-
- public void setAccountNr(String accountNr) {
- this.accountNr = accountNr;
- }
-
- public String getBankCode() {
- return bankCode;
- }
-
- public void setBankCode(String bankCode) {
- this.bankCode = bankCode;
- }
-
- @Override
- public String getPaymentDetails() {
- return "{accountName='" + accountName + '\'' +
- '}';
- }
-
- @Override
- public String toString() {
- return "SepaAccount{" +
- "accountName='" + accountName + '\'' +
- ", id='" + id + '\'' +
- ", paymentMethod=" + paymentMethod +
- ", holderName='" + holderName + '\'' +
- ", accountNr='" + accountNr + '\'' +
- ", bankCode='" + bankCode + '\'' +
- ", country=" + country +
- ", tradeCurrencies='" + getTradeCurrencies() + '\'' +
- ", selectedTradeCurrency=" + selectedTradeCurrency +
- '}';
- }
-}
diff --git a/core/src/main/java/io/bitsquare/payment/unused/TransferWiseAccount.java b/core/src/main/java/io/bitsquare/payment/unused/TransferWiseAccount.java
deleted file mode 100644
index 96ed595a2c..0000000000
--- a/core/src/main/java/io/bitsquare/payment/unused/TransferWiseAccount.java
+++ /dev/null
@@ -1,85 +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 .
- */
-
-package io.bitsquare.payment.unused;
-
-import io.bitsquare.app.Version;
-import io.bitsquare.payment.PaymentAccount;
-import io.bitsquare.payment.PaymentMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class TransferWiseAccount extends PaymentAccount {
- // That object is saved to disc. We need to take care of changes to not break deserialization.
- private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
-
- private static final Logger log = LoggerFactory.getLogger(TransferWiseAccount.class);
-
- private String holderName;
- private String iban;
- private String bic;
-
-
- private TransferWiseAccount() {
- super(PaymentMethod.SEPA);
- }
-
- public String getHolderName() {
- return holderName;
- }
-
- public void setHolderName(String holderName) {
- this.holderName = holderName;
- }
-
- public String getIban() {
- return iban;
- }
-
- public void setIban(String iban) {
- this.iban = iban;
- }
-
- public String getBic() {
- return bic;
- }
-
- public void setBic(String bic) {
- this.bic = bic;
- }
-
- @Override
- public String getPaymentDetails() {
- return "TransferWise{accountName='" + accountName + '\'' +
- '}';
- }
-
- @Override
- public String toString() {
- return "TransferWiseAccount{" +
- "accountName='" + accountName + '\'' +
- ", id='" + id + '\'' +
- ", paymentMethod=" + paymentMethod +
- ", holderName='" + holderName + '\'' +
- ", iban='" + iban + '\'' +
- ", bic='" + bic + '\'' +
- ", country=" + country +
- ", tradeCurrencies='" + getTradeCurrencies() + '\'' +
- ", selectedTradeCurrency=" + selectedTradeCurrency +
- '}';
- }
-}
diff --git a/core/src/main/java/io/bitsquare/payment/unused/USPostalMoneyOrderAccount.java b/core/src/main/java/io/bitsquare/payment/unused/USPostalMoneyOrderAccount.java
deleted file mode 100644
index c8c950b1b0..0000000000
--- a/core/src/main/java/io/bitsquare/payment/unused/USPostalMoneyOrderAccount.java
+++ /dev/null
@@ -1,133 +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 .
- */
-
-package io.bitsquare.payment.unused;
-
-import io.bitsquare.app.Version;
-import io.bitsquare.payment.PaymentAccount;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class USPostalMoneyOrderAccount extends PaymentAccount {
- // That object is saved to disc. We need to take care of changes to not break deserialization.
- private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
-
- private static final Logger log = LoggerFactory.getLogger(USPostalMoneyOrderAccount.class);
-
- private String holderName;
- private String iban;
- private String bic;
-
- /*
- - Message (interface):
- - GetDataRequest (Interface)
- - PreliminaryGetDataRequest (final class) impl. AnonymousMessage
- - GetUpdatedDataRequest (final class) impl. SendersNodeAddressMessage
- - SendersNodeAddressMessage (Interface)
- - PrefixedSealedAndSignedMessage (final class) impl. MailboxMessage
- - GetUpdatedDataRequest (final class) impl. GetDataRequest
- - GetPeersRequest (final class) extends PeerExchangeMessage
- - AnonymousMessage (Interface)
- - PreliminaryGetDataRequest (final class) impl. GetDataRequest
- - DirectMessage (Interface)
- - OfferMessage (abstract class)
- - OfferAvailabilityRequest (final class)
- - OfferAvailabilityResponse (final class)
- - TradeMessage (abstract class)
- - DepositTxPublishedMessage (final class) implements MailboxMessage
- - FiatTransferStartedMessage (final class) implements MailboxMessage
- - FinalizePayoutTxRequest (final class) implements MailboxMessage
- - PayDepositRequest (final class) implements MailboxMessage
- - PayoutTxFinalizedMessage (final class) implements MailboxMessage
- - PublishDepositTxRequest (final class)
- - DecryptedMsgWithPubKey (final class)
- - MailboxMessage (Interface)
- - PrefixedSealedAndSignedMessage (final class) implements SendersNodeAddressMessage
- - DisputeMessage (abstract class)
- - DisputeCommunicationMessage (final class)
- - DisputeResultMessage (final class)
- - OpenNewDisputeMessage (final class)
- - PeerOpenedDisputeMessage (final class)
- - PeerPublishedPayoutTxMessage (final class)
- - DepositTxPublishedMessage (final class) extends TradeMessage
- - FiatTransferStartedMessage (final class) extends TradeMessage
- - FinalizePayoutTxRequest (final class) extends TradeMessage
- - PayDepositRequest (final class) extends TradeMessage
- - PayoutTxFinalizedMessage (final class) extends TradeMessage
- - DataBroadcastMessage (abstract class)
- - AddDataMessage (final class)
- - RefreshTTLMessage (final class)
- - RemoveDataMessage (final class)
- - RemoveMailboxDataMessage (final class)
- - PeerExchangeMessage (abstract class)
- - GetPeersRequest (final class) implements SendersNodeAddressMessage
- - GetPeersResponse (final class)
- - KeepAliveMessage (abstract class)
- - Ping (final class)
- - Pong (final class)
- - GetDataResponse (final class)
- - CloseConnectionMessage (final class)
- */
- private USPostalMoneyOrderAccount() {
- super(null /*PaymentMethod.US_POSTAL_MONEY_ORDER*/);
- }
-
- public String getHolderName() {
- return holderName;
- }
-
- public void setHolderName(String holderName) {
- this.holderName = holderName;
- }
-
- public String getIban() {
- return iban;
- }
-
- public void setIban(String iban) {
- this.iban = iban;
- }
-
- public String getBic() {
- return bic;
- }
-
- public void setBic(String bic) {
- this.bic = bic;
- }
-
- @Override
- public String getPaymentDetails() {
- return "{accountName='" + accountName + '\'' +
- '}';
- }
-
- @Override
- public String toString() {
- return "USPostalMoneyOrderAccount{" +
- "accountName='" + accountName + '\'' +
- ", id='" + id + '\'' +
- ", paymentMethod=" + paymentMethod +
- ", holderName='" + holderName + '\'' +
- ", iban='" + iban + '\'' +
- ", bic='" + bic + '\'' +
- ", country=" + country +
- ", tradeCurrencies='" + getTradeCurrencies() + '\'' +
- ", selectedTradeCurrency=" + selectedTradeCurrency +
- '}';
- }
-}
diff --git a/core/src/main/java/io/bitsquare/trade/offer/Offer.java b/core/src/main/java/io/bitsquare/trade/offer/Offer.java
index d4e6b8fd5f..9aa5e1c74d 100644
--- a/core/src/main/java/io/bitsquare/trade/offer/Offer.java
+++ b/core/src/main/java/io/bitsquare/trade/offer/Offer.java
@@ -319,7 +319,7 @@ public final class Offer implements StoragePayload, RequiresOwnerIsOnlinePayload
}
public PaymentMethod getPaymentMethod() {
- return PaymentMethod.getPaymentMethodByName(paymentMethodName);
+ return PaymentMethod.getPaymentMethodById(paymentMethodName);
}
public String getCurrencyCode() {
diff --git a/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/BankForm.java b/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/BankForm.java
new file mode 100644
index 0000000000..745281cfd7
--- /dev/null
+++ b/gui/src/main/java/io/bitsquare/gui/components/paymentmethods/BankForm.java
@@ -0,0 +1,285 @@
+/*
+ * 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 .
+ */
+
+package io.bitsquare.gui.components.paymentmethods;
+
+import io.bitsquare.common.util.Tuple3;
+import io.bitsquare.common.util.Tuple4;
+import io.bitsquare.gui.components.InputTextField;
+import io.bitsquare.gui.util.Layout;
+import io.bitsquare.gui.util.validation.InputValidator;
+import io.bitsquare.locale.*;
+import io.bitsquare.payment.BankAccountContractData;
+import io.bitsquare.payment.PaymentAccount;
+import io.bitsquare.payment.PaymentAccountContractData;
+import javafx.collections.FXCollections;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.GridPane;
+import javafx.util.StringConverter;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static io.bitsquare.gui.util.FormBuilder.*;
+
+abstract class BankForm extends PaymentMethodForm {
+ private static final Logger log = LoggerFactory.getLogger(BankForm.class);
+
+ protected final BankAccountContractData bankAccountContractData;
+ private InputTextField bankNameInputTextField, bankIdInputTextField, branchIdInputTextField, accountNrInputTextField, holderIdInputTextField;
+ private TextField currencyTextField;
+ private Label holderIdLabel;
+ private InputTextField holderNameInputTextField;
+
+ static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
+ BankAccountContractData bankAccountContractData = (BankAccountContractData) paymentAccountContractData;
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", bankAccountContractData.getHolderName());
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(bankAccountContractData.getCountryCode()));
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Bank name:", bankAccountContractData.getBankName());
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Bank number:", bankAccountContractData.getBankId());
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Branch number:", bankAccountContractData.getBranchId());
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account number:", bankAccountContractData.getAccountNr());
+ if (bankAccountContractData.getHolderId() != null)
+ addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankAccountContractData.getHolderIdLabel(), bankAccountContractData.getHolderId());
+ return gridRow;
+ }
+
+ BankForm(PaymentAccount paymentAccount, InputValidator inputValidator,
+ GridPane gridPane, int gridRow) {
+ super(paymentAccount, inputValidator, gridPane, gridRow);
+ this.bankAccountContractData = (BankAccountContractData) paymentAccount.contractData;
+ }
+
+ @Override
+ public void addFormForAddAccount() {
+ gridRowFrom = gridRow + 1;
+
+ Tuple3