mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Rename getPaymentMethodById to getPaymentMethod
This commit is contained in:
parent
091f82477b
commit
cb474c57da
@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.core.locale.CountryUtil.findCountryByCode;
|
||||
import static bisq.core.payment.payload.PaymentMethod.CLEAR_X_CHANGE_ID;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
||||
import static java.lang.String.format;
|
||||
import static java.lang.System.getProperty;
|
||||
import static java.nio.file.Files.readAllBytes;
|
||||
@ -74,7 +74,7 @@ public abstract class AbstractBotTest extends MethodTest {
|
||||
} else {
|
||||
throw new UnsupportedOperationException(
|
||||
format("This test harness bot does not work with %s payment accounts yet.",
|
||||
getPaymentMethodById(paymentMethodId).getDisplayString()));
|
||||
getPaymentMethod(paymentMethodId).getDisplayString()));
|
||||
}
|
||||
} else {
|
||||
String countryCode = botScript.getCountryCode();
|
||||
|
@ -8,7 +8,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.core.locale.CountryUtil.findCountryByCode;
|
||||
import static bisq.core.payment.payload.PaymentMethod.CLEAR_X_CHANGE_ID;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
||||
import static java.lang.String.format;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
|
||||
@ -62,7 +62,7 @@ class Bot {
|
||||
} else {
|
||||
throw new UnsupportedOperationException(
|
||||
format("This bot test does not work with %s payment accounts yet.",
|
||||
getPaymentMethodById(paymentMethodId).getDisplayString()));
|
||||
getPaymentMethod(paymentMethodId).getDisplayString()));
|
||||
}
|
||||
} else {
|
||||
Country country = findCountry(botScript.getCountryCode());
|
||||
|
@ -773,7 +773,7 @@ public class AccountAgeWitnessService {
|
||||
filterManager.isNodeAddressBanned(dispute.getContract().getSellerNodeAddress()) ||
|
||||
filterManager.isCurrencyBanned(dispute.getContract().getOfferPayload().getCurrencyCode()) ||
|
||||
filterManager.isPaymentMethodBanned(
|
||||
PaymentMethod.getPaymentMethodById(dispute.getContract().getPaymentMethodId())) ||
|
||||
PaymentMethod.getPaymentMethod(dispute.getContract().getPaymentMethodId())) ||
|
||||
filterManager.arePeersPaymentAccountDataBanned(dispute.getContract().getBuyerPaymentAccountPayload()) ||
|
||||
filterManager.arePeersPaymentAccountDataBanned(
|
||||
dispute.getContract().getSellerPaymentAccountPayload()) ||
|
||||
|
@ -47,7 +47,7 @@ import java.lang.reflect.Type;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static java.lang.String.format;
|
||||
import static java.lang.System.getProperty;
|
||||
@ -148,7 +148,7 @@ public class PaymentAccountForm {
|
||||
* @return A uniquely named tmp file used to define new payment account details.
|
||||
*/
|
||||
public File getPaymentAccountForm(String paymentMethodId) {
|
||||
PaymentMethod paymentMethod = getPaymentMethodById(paymentMethodId);
|
||||
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
||||
File file = getTmpJsonFile(paymentMethodId);
|
||||
try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(new FileOutputStream(checkNotNull(file), false), UTF_8)) {
|
||||
PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(paymentMethod);
|
||||
@ -244,7 +244,7 @@ public class PaymentAccountForm {
|
||||
}
|
||||
|
||||
private Class<? extends PaymentAccount> getPaymentAccountClass(String paymentMethodId) {
|
||||
PaymentMethod paymentMethod = getPaymentMethodById(paymentMethodId);
|
||||
PaymentMethod paymentMethod = getPaymentMethod(paymentMethodId);
|
||||
return PaymentAccountFactory.getPaymentAccount(paymentMethod).getClass();
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
||||
}
|
||||
|
||||
public PaymentMethod getPaymentMethod() {
|
||||
return PaymentMethod.getPaymentMethodById(offerPayloadBase.getPaymentMethodId());
|
||||
return PaymentMethod.getPaymentMethod(offerPayloadBase.getPaymentMethodId());
|
||||
}
|
||||
|
||||
// utils
|
||||
|
@ -42,7 +42,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.core.payment.payload.PaymentMethod.TRANSFERWISE_ID;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@EqualsAndHashCode
|
||||
@ -113,7 +112,7 @@ public abstract class PaymentAccount implements PersistablePayload {
|
||||
ngnTwOptional.ifPresent(tradeCurrencies::remove);
|
||||
|
||||
try {
|
||||
PaymentAccount account = PaymentAccountFactory.getPaymentAccount(getPaymentMethodById(paymentMethodId));
|
||||
PaymentAccount account = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethod(paymentMethodId));
|
||||
account.getTradeCurrencies().clear();
|
||||
account.setId(proto.getId());
|
||||
account.setCreationDate(proto.getCreationDate());
|
||||
|
@ -364,7 +364,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static PaymentMethod getPaymentMethodById(String id) {
|
||||
public static PaymentMethod getPaymentMethod(String id) {
|
||||
return getActivePaymentMethod(id)
|
||||
.orElseGet(() -> new PaymentMethod(Res.get("shared.na")));
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethodById;
|
||||
import static bisq.core.payment.payload.PaymentMethod.getPaymentMethod;
|
||||
import static bisq.core.support.dispute.DisputeResult.PayoutSuggestion.UNKNOWN;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -232,7 +232,7 @@ public class AccountAgeWitnessServiceTest {
|
||||
when(contract.getBuyerPaymentAccountPayload()).thenReturn(buyerPaymentAccountPayload);
|
||||
when(contract.getSellerPaymentAccountPayload()).thenReturn(sellerPaymentAccountPayload);
|
||||
when(contract.getOfferPayload()).thenReturn(mock(OfferPayload.class));
|
||||
List<TraderDataItem> items = service.getTraderPaymentAccounts(now, getPaymentMethodById(PaymentMethod.SEPA_ID), disputes);
|
||||
List<TraderDataItem> items = service.getTraderPaymentAccounts(now, getPaymentMethod(PaymentMethod.SEPA_ID), disputes);
|
||||
assertEquals(2, items.size());
|
||||
|
||||
// Setup a mocked arbitrator key
|
||||
|
Loading…
Reference in New Issue
Block a user