Fix text. Improve logging. Add check for BankAccount

This commit is contained in:
Manfred Karrer 2017-11-12 12:45:48 -05:00
parent 1a3bdf0f71
commit 2583ddf044
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
4 changed files with 15 additions and 12 deletions

View file

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

View file

@ -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<String> 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<String> acceptedBanks = ((SpecificBanksAccount) paymentAccount).getAcceptedBanks();
@ -95,7 +96,6 @@ public class PaymentAccountUtil {
return true;
}
}
} else {
return arePaymentMethodsEqual;
}

View file

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

View file

@ -196,8 +196,8 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
UserThread.runAfter(() -> {
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");