mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-22 06:38:55 -04:00
Add support 3 new types of bank accounts
This commit is contained in:
parent
b511267340
commit
31fb0fafa4
40 changed files with 1273 additions and 378 deletions
|
@ -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);
|
||||
}
|
||||
|
|
57
common/src/main/java/io/bitsquare/common/util/Tuple4.java
Normal file
57
common/src/main/java/io/bitsquare/common/util/Tuple4.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.common.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Tuple4<A, B, C, D> 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;
|
||||
}
|
||||
}
|
47
core/src/main/java/io/bitsquare/locale/BankUtil.java
Normal file
47
core/src/main/java/io/bitsquare/locale/BankUtil.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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:";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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<Region> getAllRegions() {
|
||||
final List<Region> 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<Country> getAllCountriesForRegion(Region selectedRegion) {
|
||||
return Lists.newArrayList(Collections2.filter(getAllCountries(), country ->
|
||||
selectedRegion != null && country != null && selectedRegion.equals(country.region)));
|
||||
}
|
||||
|
||||
private static List<Country> getAllCountries() {
|
||||
final List<Country> 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<Locale> getAllCountryLocales() {
|
||||
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
|
||||
Set<Locale> 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<String> getNamesByCodes(List<String> 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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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", ", ");
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public abstract class PaymentAccountContractData implements Payload {
|
|||
private final int maxTradePeriod;
|
||||
|
||||
@Nullable
|
||||
private String countryCode;
|
||||
protected String countryCode;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
34
core/src/main/java/io/bitsquare/payment/SameBankAccount.java
Normal file
34
core/src/main/java/io/bitsquare/payment/SameBankAccount.java
Normal file
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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", ", ");
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<String> 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<String> getAcceptedBanks() {
|
||||
return acceptedBanks;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return "Transfers with specific banks - " + getPaymentDetailsForTradePopup().replace("\n", ", ");
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -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() {
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:");
|
||||
currencyTextField = addLabelTextField(gridPane, ++gridRow, "Currency:").second;
|
||||
currencyTextField.setMouseTransparent(true);
|
||||
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText("Select region");
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText("Select country");
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
paymentAccount.setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyTextField.setText(currency.getNameAndCode());
|
||||
|
||||
if (holderIdInputTextField != null) {
|
||||
boolean requiresHolderId = BankUtil.requiresHolderId(countryCode);
|
||||
if (requiresHolderId) {
|
||||
holderNameInputTextField.minWidthProperty().unbind();
|
||||
holderNameInputTextField.setMinWidth(300);
|
||||
} else {
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
|
||||
}
|
||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||
holderIdLabel.setVisible(requiresHolderId);
|
||||
holderIdLabel.setManaged(requiresHolderId);
|
||||
holderIdInputTextField.resetValidation();
|
||||
holderIdInputTextField.setVisible(requiresHolderId);
|
||||
holderIdInputTextField.setManaged(requiresHolderId);
|
||||
if (!requiresHolderId)
|
||||
holderIdInputTextField.setText("");
|
||||
}
|
||||
|
||||
updateFromInputs();
|
||||
|
||||
onCountryChanged();
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
});
|
||||
|
||||
addAcceptedBanksForAddAccount();
|
||||
|
||||
addHolderNameAndId();
|
||||
|
||||
bankNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Bank name:").second;
|
||||
bankNameInputTextField.setValidator(inputValidator);
|
||||
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setBankName(newValue);
|
||||
updateFromInputs();
|
||||
|
||||
});
|
||||
|
||||
bankIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Bank number:").second;
|
||||
bankIdInputTextField.setValidator(inputValidator);
|
||||
bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setBankId(newValue);
|
||||
updateFromInputs();
|
||||
|
||||
});
|
||||
|
||||
branchIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Branch number:").second;
|
||||
branchIdInputTextField.setValidator(inputValidator);
|
||||
branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setBranchId(newValue);
|
||||
updateFromInputs();
|
||||
|
||||
});
|
||||
|
||||
accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, "Account number:").second;
|
||||
accountNrInputTextField.setValidator(inputValidator);
|
||||
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setAccountNr(newValue);
|
||||
updateFromInputs();
|
||||
|
||||
});
|
||||
|
||||
addAllowedPeriod();
|
||||
addAccountNameTextFieldWithAutoFillCheckBox();
|
||||
|
||||
updateFromInputs();
|
||||
}
|
||||
|
||||
protected void onCountryChanged() {
|
||||
}
|
||||
|
||||
protected void addHolderNameAndId() {
|
||||
Tuple4<Label, InputTextField, Label, InputTextField> tuple = addLabelInputTextFieldLabelInputTextField(gridPane, ++gridRow, "Account holder name:", BankUtil.getHolderIdLabel(""));
|
||||
holderNameInputTextField = tuple.second;
|
||||
holderNameInputTextField.setMinWidth(300);
|
||||
holderNameInputTextField.setValidator(inputValidator);
|
||||
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyTextField.widthProperty());
|
||||
|
||||
holderIdLabel = tuple.third;
|
||||
holderIdLabel.setVisible(false);
|
||||
holderIdLabel.setManaged(false);
|
||||
|
||||
holderIdInputTextField = tuple.forth;
|
||||
holderIdInputTextField.setVisible(false);
|
||||
holderIdInputTextField.setManaged(false);
|
||||
holderIdInputTextField.setValidator(inputValidator);
|
||||
holderIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setHolderId(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
}
|
||||
|
||||
protected void addAcceptedBanksForAddAccount() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||
String bankName = bankNameInputTextField.getText();
|
||||
if (bankName.length() > 6)
|
||||
bankName = StringUtils.abbreviate(bankName, 9);
|
||||
String accountNr = accountNrInputTextField.getText();
|
||||
if (accountNr.length() > 6)
|
||||
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||
|
||||
String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
|
||||
accountNameTextField.setText(method.concat(", ").concat(bankName).concat(", ").concat(accountNr));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
boolean holderIdValid = true;
|
||||
if (paymentAccount.getCountry() != null) {
|
||||
if (BankUtil.requiresHolderId(paymentAccount.getCountry().code))
|
||||
holderIdValid = inputValidator.validate(bankAccountContractData.getHolderId()).isValid;
|
||||
}
|
||||
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& inputValidator.validate(bankAccountContractData.getHolderName()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBankName()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBankId()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBranchId()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getAccountNr()).isValid
|
||||
&& holderIdValid
|
||||
&& paymentAccount.getSingleTradeCurrency() != null
|
||||
&& paymentAccount.getCountry() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
|
||||
addLabelTextField(gridPane, gridRow, "Account name:", paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(paymentAccount.getPaymentMethod().getId()));
|
||||
addLabelTextField(gridPane, ++gridRow, "Country:", paymentAccount.getCountry() != null ? paymentAccount.getCountry().name : "");
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", paymentAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
addAcceptedBanksForDisplayAccount();
|
||||
addHolderNameAndIdForDisplayAccount();
|
||||
addLabelTextField(gridPane, ++gridRow, "Bank name:", bankAccountContractData.getBankName()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Bank number:", bankAccountContractData.getBankId()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Branch number:", bankAccountContractData.getBranchId()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Account number:", bankAccountContractData.getAccountNr()).second.setMouseTransparent(false);
|
||||
|
||||
addAllowedPeriod();
|
||||
}
|
||||
|
||||
protected void addHolderNameAndIdForDisplayAccount() {
|
||||
if (BankUtil.requiresHolderId(bankAccountContractData.getCountryCode())) {
|
||||
Tuple4<Label, TextField, Label, TextField> tuple = addLabelTextFieldLabelTextField(gridPane, ++gridRow,
|
||||
"Account holder name:", BankUtil.getHolderIdLabel(bankAccountContractData.getCountryCode()));
|
||||
TextField holderNameTextField = tuple.second;
|
||||
holderNameTextField.setText(bankAccountContractData.getHolderName());
|
||||
holderNameTextField.setMinWidth(300);
|
||||
tuple.forth.setText(bankAccountContractData.getHolderId());
|
||||
} else {
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", bankAccountContractData.getHolderName());
|
||||
}
|
||||
}
|
||||
|
||||
public void addAcceptedBanksForDisplayAccount() {
|
||||
}
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.gui.components.paymentmethods;
|
||||
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NationalBankForm extends BankForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(NationalBankForm.class);
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
BankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public NationalBankForm(PaymentAccount paymentAccount, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow);
|
||||
}
|
||||
}
|
|
@ -82,9 +82,10 @@ public abstract class PaymentMethodForm {
|
|||
protected void addAccountNameTextFieldWithAutoFillCheckBox() {
|
||||
Tuple3<Label, InputTextField, CheckBox> tuple = addLabelInputTextFieldCheckBox(gridPane, ++gridRow, "Account name:", "Use custom account name");
|
||||
accountNameTextField = tuple.second;
|
||||
accountNameTextField.setPrefWidth(250);
|
||||
accountNameTextField.setPrefWidth(300);
|
||||
accountNameTextField.setEditable(false);
|
||||
accountNameTextField.setValidator(inputValidator);
|
||||
accountNameTextField.setFocusTraversable(false);
|
||||
accountNameTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
paymentAccount.setAccountName(newValue);
|
||||
updateAllInputsValid();
|
||||
|
@ -92,7 +93,9 @@ public abstract class PaymentMethodForm {
|
|||
useCustomAccountNameCheckBox = tuple.third;
|
||||
useCustomAccountNameCheckBox.setSelected(false);
|
||||
useCustomAccountNameCheckBox.setOnAction(e -> {
|
||||
accountNameTextField.setEditable(useCustomAccountNameCheckBox.isSelected());
|
||||
boolean selected = useCustomAccountNameCheckBox.isSelected();
|
||||
accountNameTextField.setEditable(selected);
|
||||
accountNameTextField.setFocusTraversable(selected);
|
||||
autoFillNameTextField();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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.gui.components.paymentmethods;
|
||||
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static io.bitsquare.gui.util.FormBuilder.addLabelInputTextField;
|
||||
import static io.bitsquare.gui.util.FormBuilder.addLabelTextField;
|
||||
|
||||
public class SameBankForm extends BankForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(SameBankForm.class);
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
BankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public SameBankForm(PaymentAccount paymentAccount, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addHolderNameAndId() {
|
||||
Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++gridRow, "Account holder name:");
|
||||
InputTextField holderNameInputTextField = tuple.second;
|
||||
holderNameInputTextField.setValidator(inputValidator);
|
||||
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& inputValidator.validate(bankAccountContractData.getHolderName()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBankName()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBankId()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getBranchId()).isValid
|
||||
&& inputValidator.validate(bankAccountContractData.getAccountNr()).isValid
|
||||
&& paymentAccount.getSingleTradeCurrency() != null
|
||||
&& paymentAccount.getCountry() != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addHolderNameAndIdForDisplayAccount() {
|
||||
Tuple2<Label, TextField> tuple = addLabelTextField(gridPane, ++gridRow, "Account holder name:");
|
||||
TextField holderNameTextField = tuple.second;
|
||||
holderNameTextField.setMinWidth(300);
|
||||
holderNameTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
bankAccountContractData.setHolderName(newValue);
|
||||
updateFromInputs();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -251,10 +251,8 @@ public class SepaForm extends PaymentMethodForm {
|
|||
addLabelTextField(gridPane, gridRow, "Account name:", sepaAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(sepaAccount.getPaymentMethod().getId()));
|
||||
addLabelTextField(gridPane, ++gridRow, "Account holder name:", sepaAccount.getHolderName());
|
||||
TextField ibanField = addLabelTextField(gridPane, ++gridRow, "IBAN:", sepaAccount.getIban()).second;
|
||||
ibanField.setMouseTransparent(false);
|
||||
TextField bicField = addLabelTextField(gridPane, ++gridRow, "BIC/SWIFT:", sepaAccount.getBic()).second;
|
||||
bicField.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "IBAN:", sepaAccount.getIban()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "BIC/SWIFT:", sepaAccount.getBic()).second.setMouseTransparent(false);
|
||||
addLabelTextField(gridPane, ++gridRow, "Location of Bank:",
|
||||
sepaAccount.getCountry() != null ? sepaAccount.getCountry().name : "");
|
||||
addLabelTextField(gridPane, ++gridRow, "Currency:", sepaAccount.getSingleTradeCurrency().getNameAndCode());
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* 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.gui.components.paymentmethods;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import io.bitsquare.common.util.Tuple3;
|
||||
import io.bitsquare.gui.components.InputTextField;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountContractData;
|
||||
import io.bitsquare.payment.SpecificBanksAccountContractData;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static io.bitsquare.gui.util.FormBuilder.*;
|
||||
|
||||
public class SpecificBankForm extends BankForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(SpecificBankForm.class);
|
||||
|
||||
private final SpecificBanksAccountContractData specificBanksAccountContractData;
|
||||
private TextField acceptedBanksTextField;
|
||||
private Tooltip acceptedBanksTooltip;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
|
||||
BankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public SpecificBankForm(PaymentAccount paymentAccount, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow) {
|
||||
super(paymentAccount, inputValidator, gridPane, gridRow);
|
||||
this.specificBanksAccountContractData = (SpecificBanksAccountContractData) paymentAccount.contractData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAcceptedBanksForAddAccount() {
|
||||
Tuple3<Label, InputTextField, Button> addBankTuple = addLabelInputTextFieldButton(gridPane, ++gridRow, "Add name of accepted bank:", "Add accepted bank");
|
||||
InputTextField addBankInputTextField = addBankTuple.second;
|
||||
addBankInputTextField.setMinWidth(300);
|
||||
Button addButton = addBankTuple.third;
|
||||
addButton.disableProperty().bind(Bindings.createBooleanBinding(() -> addBankInputTextField.getText().isEmpty(), addBankInputTextField.textProperty()));
|
||||
|
||||
Tuple3<Label, TextField, Button> acceptedBanksTuple = addLabelTextFieldButton(gridPane, ++gridRow, "Accepted banks:", "Clear accepted banks");
|
||||
acceptedBanksTextField = acceptedBanksTuple.second;
|
||||
acceptedBanksTextField.setMinWidth(addBankInputTextField.getMinWidth());
|
||||
acceptedBanksTextField.setMouseTransparent(false);
|
||||
acceptedBanksTooltip = new Tooltip();
|
||||
acceptedBanksTextField.setTooltip(acceptedBanksTooltip);
|
||||
Button clearButton = acceptedBanksTuple.third;
|
||||
clearButton.disableProperty().bind(Bindings.createBooleanBinding(() -> acceptedBanksTextField.getText().isEmpty(), acceptedBanksTextField.textProperty()));
|
||||
addButton.setOnAction(e -> {
|
||||
specificBanksAccountContractData.addAcceptedBank(addBankInputTextField.getText());
|
||||
addBankInputTextField.setText("");
|
||||
String value = Joiner.on(", ").join(specificBanksAccountContractData.getAcceptedBanks());
|
||||
acceptedBanksTextField.setText(value);
|
||||
acceptedBanksTooltip.setText(value);
|
||||
updateAllInputsValid();
|
||||
});
|
||||
|
||||
clearButton.setOnAction(e -> resetAcceptedBanks());
|
||||
}
|
||||
|
||||
private void resetAcceptedBanks() {
|
||||
specificBanksAccountContractData.clearAcceptedBanks();
|
||||
acceptedBanksTextField.setText("");
|
||||
acceptedBanksTooltip.setText("");
|
||||
updateAllInputsValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCountryChanged() {
|
||||
resetAcceptedBanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAcceptedBanksForDisplayAccount() {
|
||||
addLabelTextField(gridPane, ++gridRow, "Accepted banks:",
|
||||
Joiner.on(", ").join(specificBanksAccountContractData.getAcceptedBanks())).second.setMouseTransparent(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
super.updateAllInputsValid();
|
||||
allInputsValid.set(allInputsValid.get() && inputValidator.validate(acceptedBanksTextField.getText()).isValid);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,9 @@ import io.bitsquare.gui.util.ImageUtil;
|
|||
import io.bitsquare.gui.util.Layout;
|
||||
import io.bitsquare.gui.util.validation.*;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.payment.*;
|
||||
import io.bitsquare.payment.PaymentAccount;
|
||||
import io.bitsquare.payment.PaymentAccountFactory;
|
||||
import io.bitsquare.payment.PaymentMethod;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.geometry.VPos;
|
||||
|
@ -238,8 +240,11 @@ public class PaymentAccountView extends ActivatableViewAndModel<GridPane, Paymen
|
|||
if (paymentMethodForm != null) {
|
||||
paymentMethodForm.addFormForDisplayAccount();
|
||||
gridRow = paymentMethodForm.getGridRow();
|
||||
Button deleteAccountButton = addButtonAfterGroup(root, ++gridRow, "Delete account");
|
||||
Tuple2<Button, Button> tuple = add2ButtonsAfterGroup(root, ++gridRow, "Delete account", "Cancel");
|
||||
Button deleteAccountButton = tuple.first;
|
||||
deleteAccountButton.setOnAction(event -> onDeleteAccount(paymentMethodForm.getPaymentAccount()));
|
||||
Button cancelButton = tuple.second;
|
||||
cancelButton.setOnAction(event -> removeSelectAccountForm());
|
||||
GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan());
|
||||
model.onSelectAccount(paymentAccount);
|
||||
}
|
||||
|
@ -255,32 +260,7 @@ public class PaymentAccountView extends ActivatableViewAndModel<GridPane, Paymen
|
|||
}
|
||||
|
||||
private PaymentMethodForm getPaymentMethodForm(PaymentMethod paymentMethod) {
|
||||
PaymentAccount paymentAccount;
|
||||
switch (paymentMethod.getId()) {
|
||||
case PaymentMethod.OK_PAY_ID:
|
||||
paymentAccount = new OKPayAccount();
|
||||
break;
|
||||
case PaymentMethod.PERFECT_MONEY_ID:
|
||||
paymentAccount = new PerfectMoneyAccount();
|
||||
break;
|
||||
case PaymentMethod.SEPA_ID:
|
||||
paymentAccount = new SepaAccount();
|
||||
break;
|
||||
case PaymentMethod.ALI_PAY_ID:
|
||||
paymentAccount = new AliPayAccount();
|
||||
break;
|
||||
case PaymentMethod.SWISH_ID:
|
||||
paymentAccount = new SwishAccount();
|
||||
break;
|
||||
case PaymentMethod.BLOCK_CHAINS_ID:
|
||||
paymentAccount = new BlockChainAccount();
|
||||
break;
|
||||
default:
|
||||
log.error("Not supported PaymentMethod: " + paymentMethod);
|
||||
paymentAccount = null;
|
||||
break;
|
||||
}
|
||||
return getPaymentMethodForm(paymentMethod, paymentAccount);
|
||||
return getPaymentMethodForm(paymentMethod, PaymentAccountFactory.getPaymentAccount(paymentMethod));
|
||||
}
|
||||
|
||||
private PaymentMethodForm getPaymentMethodForm(PaymentMethod paymentMethod, PaymentAccount paymentAccount) {
|
||||
|
@ -291,6 +271,12 @@ public class PaymentAccountView extends ActivatableViewAndModel<GridPane, Paymen
|
|||
return new PerfectMoneyForm(paymentAccount, perfectMoneyValidator, inputValidator, root, gridRow);
|
||||
case PaymentMethod.SEPA_ID:
|
||||
return new SepaForm(paymentAccount, ibanValidator, bicValidator, inputValidator, root, gridRow);
|
||||
case PaymentMethod.NATIONAL_BANK_ID:
|
||||
return new NationalBankForm(paymentAccount, inputValidator, root, gridRow);
|
||||
case PaymentMethod.SAME_BANK_ID:
|
||||
return new SameBankForm(paymentAccount, inputValidator, root, gridRow);
|
||||
case PaymentMethod.SPECIFIC_BANKS_ID:
|
||||
return new SpecificBankForm(paymentAccount, inputValidator, root, gridRow);
|
||||
case PaymentMethod.ALI_PAY_ID:
|
||||
return new AliPayForm(paymentAccount, aliPayValidator, inputValidator, root, gridRow);
|
||||
case PaymentMethod.SWISH_ID:
|
||||
|
@ -313,6 +299,7 @@ public class PaymentAccountView extends ActivatableViewAndModel<GridPane, Paymen
|
|||
FormBuilder.removeRowsFromGridPane(root, 2, gridRow);
|
||||
gridRow = 1;
|
||||
addAccountButton.setDisable(false);
|
||||
paymentAccountsListView.getSelectionModel().clearSelection();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,6 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
|||
|
||||
List<TransactionsListItem> listItems = walletService.getWallet().getRecentTransactions(1000, true).stream()
|
||||
.map(transaction -> {
|
||||
log.error("tx ID " + transaction.getHashAsString());
|
||||
Optional<Tradable> tradableOptional = all.stream()
|
||||
.filter(tradable -> {
|
||||
String txId = transaction.getHashAsString();
|
||||
|
@ -193,19 +192,12 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
|||
tradable.getId().equals(dispute.getTradeId()))
|
||||
.findAny()
|
||||
.isPresent();
|
||||
log.error("isTakeOfferFeeTx " + isTakeOfferFeeTx);
|
||||
log.error("isOfferFeeTx " + isOfferFeeTx);
|
||||
log.error("isDepositTx " + isDepositTx);
|
||||
log.error("isPayoutTx " + isPayoutTx);
|
||||
log.error("isDisputedPayoutTx " + isDisputedPayoutTx);
|
||||
|
||||
return isTakeOfferFeeTx || isOfferFeeTx || isDepositTx || isPayoutTx || isDisputedPayoutTx;
|
||||
} else
|
||||
return false;
|
||||
})
|
||||
.findAny();
|
||||
if (tradableOptional.isPresent())
|
||||
log.error("tradableOptional " + tradableOptional.get().getId());
|
||||
return new TransactionsListItem(transaction, walletService, tradableOptional, formatter);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -103,6 +103,8 @@ public class Popup {
|
|||
|
||||
public void hide() {
|
||||
animateHide(() -> {
|
||||
if (owner == null)
|
||||
owner = MainView.getRootContainer();
|
||||
Scene rootScene = owner.getScene();
|
||||
if (rootScene != null) {
|
||||
Window window = rootScene.getWindow();
|
||||
|
@ -308,6 +310,8 @@ public class Popup {
|
|||
}
|
||||
|
||||
protected void layout() {
|
||||
if (owner == null)
|
||||
owner = MainView.getRootContainer();
|
||||
Scene rootScene = owner.getScene();
|
||||
if (rootScene != null) {
|
||||
Window window = rootScene.getWindow();
|
||||
|
|
|
@ -138,6 +138,15 @@ public class BuyerStep2View extends TradeStepView {
|
|||
case PaymentMethod.SEPA_ID:
|
||||
gridRow = SepaForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.NATIONAL_BANK_ID:
|
||||
gridRow = NationalBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.SAME_BANK_ID:
|
||||
gridRow = SameBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.SPECIFIC_BANKS_ID:
|
||||
gridRow = SpecificBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
case PaymentMethod.SWISH_ID:
|
||||
gridRow = SwishForm.addFormForBuyer(gridPane, gridRow, paymentAccountContractData);
|
||||
break;
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.gui.util;
|
|||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bitsquare.common.util.Tuple2;
|
||||
import io.bitsquare.common.util.Tuple3;
|
||||
import io.bitsquare.common.util.Tuple4;
|
||||
import io.bitsquare.gui.components.*;
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
|
@ -308,6 +309,104 @@ public class FormBuilder {
|
|||
return new Tuple3<>(label, inputTextField, checkBox);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + InputTextField + Button
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, InputTextField, Button> addLabelInputTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, 0);
|
||||
|
||||
InputTextField inputTextField = new InputTextField();
|
||||
Button button = new Button(buttonTitle);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(inputTextField, button);
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
gridPane.getChildren().add(hBox);
|
||||
|
||||
return new Tuple3<>(label, inputTextField, button);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + TextField + Button
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, TextField, Button> addLabelTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, 0);
|
||||
|
||||
TextField textField = new TextField();
|
||||
textField.setEditable(false);
|
||||
textField.setMouseTransparent(true);
|
||||
textField.setFocusTraversable(false);
|
||||
Button button = new Button(buttonTitle);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(textField, button);
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
gridPane.getChildren().add(hBox);
|
||||
|
||||
return new Tuple3<>(label, textField, button);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + InputTextField + Label + InputTextField
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple4<Label, InputTextField, Label, InputTextField> addLabelInputTextFieldLabelInputTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
|
||||
Label label1 = addLabel(gridPane, rowIndex, title1, 0);
|
||||
|
||||
InputTextField inputTextField1 = new InputTextField();
|
||||
Label label2 = new Label(title2);
|
||||
HBox.setMargin(label2, new Insets(5, 0, 0, 0));
|
||||
InputTextField inputTextField2 = new InputTextField();
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(inputTextField1, label2, inputTextField2);
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
gridPane.getChildren().add(hBox);
|
||||
|
||||
return new Tuple4<>(label1, inputTextField1, label2, inputTextField2);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + TextField + Label + TextField
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple4<Label, TextField, Label, TextField> addLabelTextFieldLabelTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
|
||||
Label label1 = addLabel(gridPane, rowIndex, title1, 0);
|
||||
|
||||
TextField textField1 = new TextField();
|
||||
textField1.setEditable(false);
|
||||
textField1.setMouseTransparent(true);
|
||||
textField1.setFocusTraversable(false);
|
||||
Label label2 = new Label(title2);
|
||||
HBox.setMargin(label2, new Insets(5, 0, 0, 0));
|
||||
TextField textField2 = new TextField();
|
||||
textField2.setEditable(false);
|
||||
textField2.setMouseTransparent(true);
|
||||
textField2.setFocusTraversable(false);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(textField1, label2, textField2);
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
gridPane.getChildren().add(hBox);
|
||||
|
||||
return new Tuple4<>(label1, textField1, label2, textField2);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Button + CheckBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -145,9 +145,11 @@ OK_PAY=OKPay
|
|||
PERFECT_MONEY=Perfect Money
|
||||
ALI_PAY=AliPay
|
||||
SEPA=SEPA
|
||||
NATIONAL_BANK=National Bank transfer
|
||||
SAME_BANK=Transfer with same Bank
|
||||
SPECIFIC_BANKS=Transfers with specific banks
|
||||
FED_WIRE=Fed Wire
|
||||
SWISH= Swish
|
||||
TRANSFER_WISE=TransferWise
|
||||
US_POSTAL_MONEY_ORDER=US Postal money order
|
||||
BLOCK_CHAINS=Crypto currencies
|
||||
|
||||
|
|
|
@ -111,16 +111,17 @@ public class BroadcastHandler implements PeerManager.Listener {
|
|||
// the data owner sends to all and immediately
|
||||
connectedPeers.stream().forEach(connection -> sendToPeer(connection, message));
|
||||
numOfPeers = connectedPeers.size();
|
||||
log.info("Broadcast message to {} peers.", numOfPeers);
|
||||
log.info("Broadcast message to all {} connected peers.", numOfPeers);
|
||||
} else {
|
||||
// for relay nodes we limit to 2 recipients and use a delay
|
||||
List<Connection> list = new ArrayList<>(connectedPeers);
|
||||
Collections.shuffle(list);
|
||||
int size = list.size();
|
||||
if (size > 1)
|
||||
// We want min. 2 nodes
|
||||
if (size > 3)
|
||||
list = list.subList(0, size / 2);
|
||||
numOfPeers = list.size();
|
||||
log.info("Broadcast message to {} peers.", numOfPeers);
|
||||
log.info("Broadcast message to {} peers out of {} total connected peers.", numOfPeers, connectedPeers.size());
|
||||
list.stream().forEach(connection -> UserThread.runAfterRandomDelay(() ->
|
||||
sendToPeer(connection, message), DELAY_MS, DELAY_MS * 2, TimeUnit.MILLISECONDS));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue