Add support 3 new types of bank accounts

This commit is contained in:
Manfred Karrer 2016-02-29 23:57:31 +01:00
parent b511267340
commit 31fb0fafa4
40 changed files with 1273 additions and 378 deletions

View 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:";
}
}
}

View file

@ -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;

View file

@ -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",

View file

@ -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;

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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) {

View 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 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());
}
}

View file

@ -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", ", ");
}
}

View file

@ -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) {

View file

@ -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;
}

View file

@ -31,7 +31,7 @@ public abstract class PaymentAccountContractData implements Payload {
private final int maxTradePeriod;
@Nullable
private String countryCode;
protected String countryCode;
///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -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);
}
}
}

View file

@ -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();
}

View file

@ -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();
}
}

View 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());
}
}

View file

@ -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", ", ");
}
}

View file

@ -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);
}
}

View 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 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());
}
}

View file

@ -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", ", ");
}
}

View file

@ -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) {

View file

@ -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 +
'}';
}
}

View file

@ -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 +
'}';
}
}

View file

@ -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 +
'}';
}
}

View file

@ -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() {