PaymentAccount.java uses Res.get() instead of hardcoded labels

This commit is contained in:
woodser 2023-10-04 08:23:39 -04:00
parent 73f688e157
commit 9aea5e0c58
3 changed files with 36 additions and 35 deletions

View file

@ -553,26 +553,26 @@ public abstract class PaymentAccount implements PersistablePayload {
switch (fieldId) { switch (fieldId) {
case ACCEPTED_COUNTRY_CODES: case ACCEPTED_COUNTRY_CODES:
field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE); field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE);
field.setLabel("Accepted country codes"); field.setLabel(Res.get("payment.accepted.countries"));
field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries()); field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries());
break; break;
case ACCOUNT_ID: case ACCOUNT_ID:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Username or email or phone no."); field.setLabel(Res.get("payment.uphold.accountId"));
break; break;
case ACCOUNT_NAME: case ACCOUNT_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account name"); // TODO: pull all labels from language file field.setLabel(Res.get("payment.account.name"));
field.setMinLength(3); field.setMinLength(3);
field.setMaxLength(100); field.setMaxLength(100);
break; break;
case ACCOUNT_NR: case ACCOUNT_NR:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account number"); field.setLabel("payment.accountNr");
break; break;
case ACCOUNT_OWNER: case ACCOUNT_OWNER:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account owner full name"); field.setLabel(Res.get("payment.account.owner"));
break; break;
case ACCOUNT_TYPE: case ACCOUNT_TYPE:
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
@ -586,15 +586,15 @@ public abstract class PaymentAccount implements PersistablePayload {
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case BANK_ADDRESS: case BANK_ADDRESS:
field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
field.setLabel("Receiving Bank address"); field.setLabel(Res.get("payment.swift.address.bank"));
break; break;
case BANK_BRANCH: case BANK_BRANCH:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Receiving Bank branch"); field.setLabel(Res.get("payment.swift.branch.bank"));
break; break;
case BANK_BRANCH_CODE: case BANK_BRANCH_CODE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Receiving Bank SWIFT code"); // TODO: only used for swift? field.setLabel(Res.get("payment.swift.swiftCode.bank"));
break; break;
case BANK_BRANCH_NAME: case BANK_BRANCH_NAME:
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
@ -602,37 +602,37 @@ public abstract class PaymentAccount implements PersistablePayload {
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case BANK_COUNTRY_CODE: case BANK_COUNTRY_CODE:
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE); field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
field.setLabel("Country of bank"); field.setLabel(Res.get("payment.bank.country"));
break; break;
case BANK_ID: case BANK_ID:
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case BANK_NAME: case BANK_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Receiving Bank name"); field.setLabel(Res.get("payment.swift.name.bank"));
break; break;
case BANK_SWIFT_CODE: case BANK_SWIFT_CODE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Receiving Bank SWIFT Code"); field.setLabel(Res.get("payment.swift.swiftCode.bank"));
break; break;
case BENEFICIARY_ACCOUNT_NR: case BENEFICIARY_ACCOUNT_NR:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account No. (or IBAN)"); field.setLabel(Res.get("payment.swift.account"));
break; break;
case BENEFICIARY_ADDRESS: case BENEFICIARY_ADDRESS:
field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
field.setLabel("Beneficiary address"); field.setLabel(Res.get("payment.swift.address.beneficiary"));
break; break;
case BENEFICIARY_CITY: case BENEFICIARY_CITY:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Beneficiary city"); field.setLabel(Res.get("payment.account.city"));
break; break;
case BENEFICIARY_NAME: case BENEFICIARY_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account owner full name"); field.setLabel(Res.get("payment.account.owner"));
break; break;
case BENEFICIARY_PHONE: case BENEFICIARY_PHONE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Beneficiary phone number"); field.setLabel(Res.get("payment.swift.phone.beneficiary"));
break; break;
case BIC: case BIC:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
@ -642,27 +642,27 @@ public abstract class PaymentAccount implements PersistablePayload {
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case CITY: case CITY:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("City"); field.setLabel(Res.get("payment.account.city"));
case CONTACT: case CONTACT:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Contact info"); field.setLabel(Res.get("payment.payByMail.contact"));
case COUNTRY: case COUNTRY:
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE); field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
field.setLabel("Country"); field.setLabel(Res.get("shared.country"));
if (this instanceof CountryBasedPaymentAccount) field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries()); if (this instanceof CountryBasedPaymentAccount) field.setSupportedCountries(((CountryBasedPaymentAccount) this).getSupportedCountries());
break; break;
case EMAIL: case EMAIL:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setType("email"); field.setType("email");
field.setLabel("Email"); field.setLabel(Res.get("payment.email"));
break; break;
case EMAIL_OR_MOBILE_NR: case EMAIL_OR_MOBILE_NR:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Email or mobile number"); field.setLabel(Res.get("payment.email.mobile"));
break; break;
case EXTRA_INFO: case EXTRA_INFO:
field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
field.setLabel("Optional additional information"); field.setLabel(Res.get("payment.shared.optionalExtra"));
break; break;
case HOLDER_ADDRESS: case HOLDER_ADDRESS:
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
@ -670,7 +670,7 @@ public abstract class PaymentAccount implements PersistablePayload {
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case HOLDER_NAME: case HOLDER_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Account owner full name"); field.setLabel(Res.get("payment.account.owner"));
field.setMinLength(2); field.setMinLength(2);
field.setMaxLength(100); field.setMaxLength(100);
break; break;
@ -684,23 +684,23 @@ public abstract class PaymentAccount implements PersistablePayload {
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
case INTERMEDIARY_ADDRESS: case INTERMEDIARY_ADDRESS:
field.setComponent(PaymentAccountFormField.Component.TEXTAREA); field.setComponent(PaymentAccountFormField.Component.TEXTAREA);
field.setLabel("Intermediary Bank address"); field.setLabel(Res.get("payment.swift.address.intermediary"));
break; break;
case INTERMEDIARY_BRANCH: case INTERMEDIARY_BRANCH:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Intermediary Bank branch"); field.setLabel(Res.get("payment.swift.branch.intermediary"));
break; break;
case INTERMEDIARY_COUNTRY_CODE: case INTERMEDIARY_COUNTRY_CODE:
field.setComponent(PaymentAccountFormField.Component.SELECT_ONE); field.setComponent(PaymentAccountFormField.Component.SELECT_ONE);
field.setLabel("Intermediary Bank country"); field.setLabel(Res.get("payment.swift.country.intermediary"));
break; break;
case INTERMEDIARY_NAME: case INTERMEDIARY_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Intermediary Bank name"); field.setLabel(Res.get("payment.swift.name.intermediary"));
break; break;
case INTERMEDIARY_SWIFT_CODE: case INTERMEDIARY_SWIFT_CODE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Intermediary Bank SWIFT Code"); // TODO: swift only? field.setLabel(Res.get("payment.swift.swiftCode.intermediary"));
break; break;
case MOBILE_NR: case MOBILE_NR:
throw new IllegalArgumentException("Not implemented"); throw new IllegalArgumentException("Not implemented");
@ -726,32 +726,32 @@ public abstract class PaymentAccount implements PersistablePayload {
break; break;
case SORT_CODE: case SORT_CODE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("UK sort code"); field.setLabel(Res.get("payment.fasterPayments.ukSortCode"));
break; break;
case SPECIAL_INSTRUCTIONS: case SPECIAL_INSTRUCTIONS:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Special instructions"); field.setLabel(Res.get("payment.shared.extraInfo"));
break; break;
case STATE: case STATE:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("State/Province/Region"); field.setLabel(Res.get("payment.account.state"));
field.setRequiredForCountries(CountryUtil.getCountryCodes(BankUtil.getAllStateRequiredCountries())); field.setRequiredForCountries(CountryUtil.getCountryCodes(BankUtil.getAllStateRequiredCountries()));
break; break;
case TRADE_CURRENCIES: case TRADE_CURRENCIES:
field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE); field.setComponent(PaymentAccountFormField.Component.SELECT_MULTIPLE);
field.setLabel("Supported currencies"); field.setLabel(Res.get("payment.supportedCurrencies"));
field.setSupportedCurrencies(getSupportedCurrencies()); field.setSupportedCurrencies(getSupportedCurrencies());
field.setValue(String.join(",", getSupportedCurrencies().stream().map(TradeCurrency::getCode).collect(Collectors.toList()))); field.setValue(String.join(",", getSupportedCurrencies().stream().map(TradeCurrency::getCode).collect(Collectors.toList())));
break; break;
case USER_NAME: case USER_NAME:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("User name"); field.setLabel(Res.get("payment.account.userName"));
field.setMinLength(3); field.setMinLength(3);
field.setMaxLength(100); field.setMaxLength(100);
break; break;
case ADDRESS: case ADDRESS:
field.setComponent(PaymentAccountFormField.Component.TEXT); field.setComponent(PaymentAccountFormField.Component.TEXT);
field.setLabel("Address"); field.setLabel(Res.get("payment.account.address"));
field.setMinLength(10); field.setMinLength(10);
field.setMaxLength(150); field.setMaxLength(150);
break; break;

View file

@ -2591,6 +2591,7 @@ payment.fasterPayments.newRequirements.info=Some banks have started verifying th
When you recreate the account, make sure to copy the precise sort code, account number and account age verification \ When you recreate the account, make sure to copy the precise sort code, account number and account age verification \
salt values from your old account to your new account. This will ensure your existing account''s age and signing \ salt values from your old account to your new account. This will ensure your existing account''s age and signing \
status are preserved. status are preserved.
payment.fasterPayments.ukSortCode="UK sort code"
payment.moneyGram.info=When using MoneyGram the XMR buyer has to send the Authorisation number and a photo of the receipt by email to the XMR seller. \ payment.moneyGram.info=When using MoneyGram the XMR buyer has to send the Authorisation number and a photo of the receipt by email to the XMR seller. \
The receipt must clearly show the seller's full name, country, state and the amount. The seller's email will be displayed to the buyer during the trade process. The receipt must clearly show the seller's full name, country, state and the amount. The seller's email will be displayed to the buyer during the trade process.
payment.westernUnion.info=When using Western Union the XMR buyer has to send the MTCN (tracking number) and a photo of the receipt by email to the XMR seller. \ payment.westernUnion.info=When using Western Union the XMR buyer has to send the MTCN (tracking number) and a photo of the receipt by email to the XMR seller. \

View file

@ -37,7 +37,7 @@ import static haveno.desktop.util.FormBuilder.addCompactTopLabelTextField;
import static haveno.desktop.util.FormBuilder.addTopLabelTextField; import static haveno.desktop.util.FormBuilder.addTopLabelTextField;
public class FasterPaymentsForm extends PaymentMethodForm { public class FasterPaymentsForm extends PaymentMethodForm {
private static final String UK_SORT_CODE = "UK sort code"; private static final String UK_SORT_CODE = Res.get("payment.fasterPayments.ukSortCode");
public static int addFormForBuyer(GridPane gridPane, int gridRow, public static int addFormForBuyer(GridPane gridPane, int gridRow,
PaymentAccountPayload paymentAccountPayload) { PaymentAccountPayload paymentAccountPayload) {