From 2583ddf044ddcc65e05555c81a6844c38cec0e5c Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Sun, 12 Nov 2017 12:45:48 -0500 Subject: [PATCH] Fix text. Improve logging. Add check for BankAccount --- .../main/resources/i18n/displayStrings.properties | 2 +- .../io/bisq/core/payment/PaymentAccountUtil.java | 6 +++--- .../io/bisq/core/proto/CoreProtoResolver.java | 15 +++++++++------ .../offer/createoffer/CreateOfferViewModel.java | 4 ++-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/common/src/main/resources/i18n/displayStrings.properties b/common/src/main/resources/i18n/displayStrings.properties index 61d2c33335..79c8626721 100644 --- a/common/src/main/resources/i18n/displayStrings.properties +++ b/common/src/main/resources/i18n/displayStrings.properties @@ -1632,7 +1632,7 @@ to get in contact with the {1} buyer by using the provided email address or mobi is really the owner of the Zelle (ClearXchange) account. payment.westernUnion.info=When using Western Union the BTC buyer has to send the MTCN (tracking number) and a photo of the receipt by email to the BTC seller. \ - The receipt must clearly show the seller's full name, city, country and the amount. The buyer will get displayed the seller's email in the trade process. + The receipt must clearly show the seller''s full name, city, country and the amount. The buyer will get displayed the seller''s email in the trade process. # We use constants from the code so we do not use our normal naming convention # dynamic values are not recognized by IntelliJ diff --git a/core/src/main/java/io/bisq/core/payment/PaymentAccountUtil.java b/core/src/main/java/io/bisq/core/payment/PaymentAccountUtil.java index 36cafee75a..4edee53756 100644 --- a/core/src/main/java/io/bisq/core/payment/PaymentAccountUtil.java +++ b/core/src/main/java/io/bisq/core/payment/PaymentAccountUtil.java @@ -66,8 +66,8 @@ public class PaymentAccountUtil { if (paymentAccount instanceof SepaAccount || offer.getPaymentMethod().equals(PaymentMethod.SEPA)) { return arePaymentMethodsEqual; - } else if (offer.getPaymentMethod().equals(PaymentMethod.SAME_BANK) || - offer.getPaymentMethod().equals(PaymentMethod.SPECIFIC_BANKS)) { + } else if (paymentAccount instanceof BankAccount && (offer.getPaymentMethod().equals(PaymentMethod.SAME_BANK) || + offer.getPaymentMethod().equals(PaymentMethod.SPECIFIC_BANKS))) { final List acceptedBankIds = offer.getAcceptedBankIds(); checkNotNull(acceptedBankIds, "offer.getAcceptedBankIds() must not be null"); @@ -82,6 +82,7 @@ public class PaymentAccountUtil { return bankId != null && acceptedBankIds.contains(bankId); } } else { + //TODO check if that case can be reached if (paymentAccount instanceof SpecificBanksAccount) { // check if we have a matching bank final ArrayList acceptedBanks = ((SpecificBanksAccount) paymentAccount).getAcceptedBanks(); @@ -95,7 +96,6 @@ public class PaymentAccountUtil { return true; } } - } else { return arePaymentMethodsEqual; } diff --git a/core/src/main/java/io/bisq/core/proto/CoreProtoResolver.java b/core/src/main/java/io/bisq/core/proto/CoreProtoResolver.java index 673edd1f5e..a1a8eee352 100644 --- a/core/src/main/java/io/bisq/core/proto/CoreProtoResolver.java +++ b/core/src/main/java/io/bisq/core/proto/CoreProtoResolver.java @@ -13,7 +13,8 @@ public class CoreProtoResolver implements ProtoResolver { @Override public PaymentAccountPayload fromProto(PB.PaymentAccountPayload proto) { if (proto != null) { - switch (proto.getMessageCase()) { + final PB.PaymentAccountPayload.MessageCase messageCase = proto.getMessageCase(); + switch (messageCase) { case ALI_PAY_ACCOUNT_PAYLOAD: return AliPayAccountPayload.fromProto(proto); case CHASE_QUICK_PAY_ACCOUNT_PAYLOAD: @@ -21,9 +22,11 @@ public class CoreProtoResolver implements ProtoResolver { case CLEAR_XCHANGE_ACCOUNT_PAYLOAD: return ClearXchangeAccountPayload.fromProto(proto); case COUNTRY_BASED_PAYMENT_ACCOUNT_PAYLOAD: - switch (proto.getCountryBasedPaymentAccountPayload().getMessageCase()) { + final PB.CountryBasedPaymentAccountPayload.MessageCase messageCaseCountry = proto.getCountryBasedPaymentAccountPayload().getMessageCase(); + switch (messageCaseCountry) { case BANK_ACCOUNT_PAYLOAD: - switch (proto.getCountryBasedPaymentAccountPayload().getBankAccountPayload().getMessageCase()) { + final PB.BankAccountPayload.MessageCase messageCaseBank = proto.getCountryBasedPaymentAccountPayload().getBankAccountPayload().getMessageCase(); + switch (messageCaseBank) { case NATIONAL_BANK_ACCOUNT_PAYLOAD: return NationalBankAccountPayload.fromProto(proto); case SAME_BANK_ACCONT_PAYLOAD: @@ -33,7 +36,7 @@ public class CoreProtoResolver implements ProtoResolver { default: throw new ProtobufferException("Unknown proto message case" + "(PB.PaymentAccountPayload.CountryBasedPaymentAccountPayload.BankAccountPayload). " + - "messageCase=" + proto.getMessageCase()); + "messageCase=" + messageCaseBank); } case WESTERN_UNION_ACCOUNT_PAYLOAD: return WesternUnionAccountPayload.fromProto(proto); @@ -44,7 +47,7 @@ public class CoreProtoResolver implements ProtoResolver { default: throw new ProtobufferException("Unknown proto message case" + "(PB.PaymentAccountPayload.CountryBasedPaymentAccountPayload)." + - " messageCase=" + proto.getMessageCase()); + " messageCase=" + messageCaseCountry); } case CRYPTO_CURRENCY_ACCOUNT_PAYLOAD: return CryptoCurrencyAccountPayload.fromProto(proto); @@ -61,7 +64,7 @@ public class CoreProtoResolver implements ProtoResolver { case U_S_POSTAL_MONEY_ORDER_ACCOUNT_PAYLOAD: return USPostalMoneyOrderAccountPayload.fromProto(proto); default: - throw new ProtobufferException("Unknown proto message case(PB.PaymentAccountPayload). messageCase=" + proto.getMessageCase()); + throw new ProtobufferException("Unknown proto message case(PB.PaymentAccountPayload). messageCase=" + messageCase); } } else { log.error("PersistableEnvelope.fromProto: PB.PaymentAccountPayload is null"); diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferViewModel.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferViewModel.java index adc95a4e40..b345ecb0cd 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferViewModel.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferViewModel.java @@ -196,8 +196,8 @@ class CreateOfferViewModel extends ActivatableWithDataModel { switch (BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode()) { case "BTC": - amount.set("0.125"); - price.set("7400"); + amount.set("0.0001"); + price.set("6000"); break; case "LTC": amount.set("50");