Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various bugs related to Japan Bank Transfer payment method #3258

Merged
merged 3 commits into from
Sep 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

// Cannot be deleted as it would break old trade history entries
// Removed due too high chargeback risk
@Deprecated
@EqualsAndHashCode(callSuper = true)
@ToString
@Setter
Expand Down Expand Up @@ -132,10 +129,10 @@ public String getPaymentDetails()
@Override
public String getPaymentDetailsForTradePopup()
{
return bankName + "(" + bankCode + ")\n" +
bankBranchName + "(" + bankBranchCode + ")\n" +
bankAccountType + ": " + bankAccountNumber + "\n" +
bankAccountName + "\n";
return
Res.get("payment.japan.bank") + ": " + bankName + "(" + bankCode + ")\n" +
Res.get("payment.japan.branch") + ": " + bankBranchName + "(" + bankBranchCode + ")\n" +
Res.get("payment.japan.account") + ": " + bankAccountType + " " + bankAccountNumber + "\n" + Res.get("payment.japan.recipient") + ": " + bankAccountName;
}


Expand Down
5 changes: 5 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,11 @@ payment.f2f.info.openURL=Open web page
payment.f2f.offerbook.tooltip.countryAndCity=Country and city: {0} / {1}
payment.f2f.offerbook.tooltip.extra=Additional information: {0}

payment.japan.bank=Bank
payment.japan.branch=Branch
payment.japan.account=Account
payment.japan.recipient=Name

# We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ

Expand Down
4 changes: 4 additions & 0 deletions core/src/main/resources/i18n/displayStrings_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,10 @@ payment.f2f.info.openURL=Webページを開く
payment.f2f.offerbook.tooltip.countryAndCity=国と市区町村: {0} / {1}
payment.f2f.offerbook.tooltip.extra=追加情報: {0}

payment.japan.bank=銀行
payment.japan.branch=支店
payment.japan.account=口座
payment.japan.recipient=名義

# We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@

package bisq.desktop.components.paymentmethods;

import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;

import bisq.desktop.components.InputTextField;
import bisq.desktop.components.AutocompleteComboBox;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.components.InputTextField;
import bisq.desktop.components.paymentmethods.data.JapanBankData;
import bisq.desktop.util.Layout;
import bisq.desktop.util.validation.LengthValidator;
import bisq.desktop.util.validation.RegexValidator;
import bisq.desktop.util.validation.JapanBankTransferValidator;
import bisq.desktop.util.validation.JapanBankAccountNameValidator;
import bisq.desktop.util.validation.JapanBankAccountNumberValidator;
import bisq.desktop.util.validation.JapanBankBranchCodeValidator;
import bisq.desktop.util.validation.JapanBankBranchNameValidator;
import bisq.desktop.util.validation.JapanBankAccountNumberValidator;
import bisq.desktop.util.validation.JapanBankAccountNameValidator;
import bisq.desktop.components.paymentmethods.data.JapanBankData;
import bisq.desktop.util.validation.JapanBankTransferValidator;
import bisq.desktop.util.validation.LengthValidator;
import bisq.desktop.util.validation.RegexValidator;

import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.locale.Res;
import bisq.core.locale.TradeCurrency;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.JapanBankAccount;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.payload.JapanBankAccountPayload;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.util.BSFormatter;
import bisq.core.util.validation.InputValidator;

import bisq.common.util.Tuple2;
import bisq.common.util.Tuple3;
import bisq.common.util.Tuple4;

import org.apache.commons.lang3.StringUtils;

import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.control.Label;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;

import javafx.util.StringConverter;

import static bisq.desktop.util.FormBuilder.*;
Expand All @@ -78,31 +78,23 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, // {{{
JapanBankAccountPayload japanBankAccount = ((JapanBankAccountPayload) paymentAccountPayload);

addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow,
JapanBankData.getString("payment.account.owner"),
Res.get("payment.account.owner"),
((JapanBankAccountPayload) paymentAccountPayload).getBankName());

TextField bankCodeTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("bank.code"), japanBankAccount.getBankCode()).second;
bankCodeTextField.setPrefWidth(30);
bankCodeTextField.setEditable(false);

TextField bankNameTextField = addCompactTopLabelTextField(gridPane, gridRow, 1, JapanBankData.getString("bank.name"), japanBankAccount.getBankName()).second;
bankNameTextField.setPrefWidth(70);
bankNameTextField.setEditable(false);

TextField branchCodeTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("branch.code"), japanBankAccount.getBankBranchCode()).second;
branchCodeTextField.setPrefWidth(30);
branchCodeTextField.setEditable(false);
String bankText = japanBankAccount.getBankCode() + " " + japanBankAccount.getBankName();
TextField bankTextField = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.japan.bank"), bankText).second;
bankTextField.setEditable(false);

TextField branchNameTextField = addCompactTopLabelTextField(gridPane, ++gridRow, 1, JapanBankData.getString("branch.name"), japanBankAccount.getBankBranchName()).second;
branchNameTextField.setPrefWidth(70);
branchNameTextField.setEditable(false);
String branchText = japanBankAccount.getBankBranchCode() + " " + japanBankAccount.getBankBranchName();
TextField branchTextField = addCompactTopLabelTextField(gridPane, gridRow, 1, Res.get("payment.japan.branch"), branchText).second;
branchTextField.setEditable(false);

TextField accountNumberTextField = addCompactTopLabelTextField(gridPane, ++gridRow, JapanBankData.getString("account.number"), japanBankAccount.getBankAccountNumber()).second;
accountNumberTextField.setPrefWidth(30);
accountNumberTextField.setEditable(false);
String accountText = japanBankAccount.getBankAccountType() + " " + japanBankAccount.getBankAccountNumber();
TextField accountTextField = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.japan.account"), accountText).second;
accountTextField.setEditable(false);

TextField accountNameTextField = addCompactTopLabelTextField(gridPane, gridRow, 1, JapanBankData.getString("account.name"), japanBankAccount.getBankAccountName()).second;
accountNameTextField.setPrefWidth(70);
String accountNameText = japanBankAccount.getBankAccountName();
TextField accountNameTextField = addCompactTopLabelTextField(gridPane, gridRow, 1, Res.get("payment.japan.recipient"), accountNameText).second;
accountNameTextField.setEditable(false);

return gridRow;
Expand Down Expand Up @@ -193,8 +185,8 @@ private void addBankInput() // {{{

// Bank Code (readonly)
TextField bankCodeField = tuple4.second;
bankCodeField.setPrefWidth(175);
bankCodeField.setMaxWidth(175);
bankCodeField.setPrefWidth(200);
bankCodeField.setMaxWidth(200);
bankCodeField.setEditable(false);

// Bank Selector
Expand All @@ -215,8 +207,8 @@ public String fromString(String s) {
});
((AutocompleteComboBox) bankComboBox).setAutocompleteItems(JapanBankData.prettyPrintBankList());

bankComboBox.setPrefWidth(425);
bankComboBox.setVisibleRowCount(425);
bankComboBox.setPrefWidth(430);
bankComboBox.setVisibleRowCount(430);

((AutocompleteComboBox) bankComboBox).setOnChangeConfirmed(e -> {
// get selected value
Expand Down Expand Up @@ -259,8 +251,8 @@ private void addBankBranchInput() // {{{
// branch code
InputTextField bankBranchCodeInputTextField = tuple2.first;
bankBranchCodeInputTextField.setValidator(japanBankBranchCodeValidator);
bankBranchCodeInputTextField.setPrefWidth(175);
bankBranchCodeInputTextField.setMaxWidth(175);
bankBranchCodeInputTextField.setPrefWidth(200);
bankBranchCodeInputTextField.setMaxWidth(200);
bankBranchCodeInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
japanBankAccount.setBankBranchCode(newValue);
updateFromInputs();
Expand All @@ -269,8 +261,8 @@ private void addBankBranchInput() // {{{
// branch name
InputTextField bankBranchNameInputTextField = tuple2.second;
bankBranchNameInputTextField.setValidator(japanBankBranchNameValidator);
bankBranchNameInputTextField.setPrefWidth(425);
bankBranchNameInputTextField.setMaxWidth(425);
bankBranchNameInputTextField.setPrefWidth(430);
bankBranchNameInputTextField.setMaxWidth(430);
bankBranchNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
japanBankAccount.setBankBranchName(newValue);
updateFromInputs();
Expand All @@ -284,8 +276,8 @@ private void addBankAccountInput() // {{{
// account number
bankAccountNumberInputTextField = tuple2.first;
bankAccountNumberInputTextField.setValidator(japanBankAccountNumberValidator);
bankAccountNumberInputTextField.setPrefWidth(175);
bankAccountNumberInputTextField.setMaxWidth(175);
bankAccountNumberInputTextField.setPrefWidth(200);
bankAccountNumberInputTextField.setMaxWidth(200);
bankAccountNumberInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
japanBankAccount.setBankAccountNumber(newValue);
updateFromInputs();
Expand All @@ -294,8 +286,8 @@ private void addBankAccountInput() // {{{
// account name
InputTextField bankAccountNameInputTextField = tuple2.second;
bankAccountNameInputTextField.setValidator(japanBankAccountNameValidator);
bankAccountNameInputTextField.setPrefWidth(425);
bankAccountNameInputTextField.setMaxWidth(425);
bankAccountNameInputTextField.setPrefWidth(430);
bankAccountNameInputTextField.setMaxWidth(430);
bankAccountNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
japanBankAccount.setBankAccountName(newValue);
updateFromInputs();
Expand All @@ -308,7 +300,7 @@ private void addBankAccountTypeInput() // {{{

TradeCurrency singleTradeCurrency = japanBankAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
addCompactTopLabelTextField(gridPane, gridRow, Res.get("shared.currency"), nameAndCode);
addCompactTopLabelTextField(gridPane, gridRow, Res.get("shared.currency"), nameAndCode, 20);

// account type
gridRow++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public static final String getString(String id)
{
case "bank":
if (ja) return "銀行名 ・金融機関名";
return "Japan Bank or Financial Institution";
return "Bank or Financial Institution";
case "bank.select":
if (ja) return "金融機関 ・銀行検索 (名称入力検索)";
return "Search for Bank or Financial Institution";
Expand All @@ -812,7 +812,7 @@ public static final String getString(String id)
return "Bank Branch";
case "branch.code":
if (ja) return "支店コード";
return "Zengin Bank Branch Code";
return "Zengin Branch Code";
case "branch.code.validation.error":
if (ja) return "入力は3桁の支店コードでなければなりません";
return "Input must be a 3 digit branch code";
Expand All @@ -822,7 +822,7 @@ public static final String getString(String id)

case "account":
if (ja) return "銀行口座";
return "Japan Bank Account";
return "Bank Account";

case "account.type":
if (ja) return "口座科目";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import bisq.desktop.components.paymentmethods.FasterPaymentsForm;
import bisq.desktop.components.paymentmethods.HalCashForm;
import bisq.desktop.components.paymentmethods.InteracETransferForm;
import bisq.desktop.components.paymentmethods.JapanBankTransferForm;
import bisq.desktop.components.paymentmethods.MoneyBeamForm;
import bisq.desktop.components.paymentmethods.MoneyGramForm;
import bisq.desktop.components.paymentmethods.NationalBankForm;
Expand Down Expand Up @@ -267,6 +268,9 @@ protected void addContent() {
case PaymentMethod.INTERAC_E_TRANSFER_ID:
gridRow = InteracETransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.JAPAN_BANK_ID:
gridRow = JapanBankTransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
Expand Down