From f58d39e7201757e6a1af1b7ee0e3e563742a3a15 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:06:29 -0300 Subject: [PATCH 1/5] Rename AustraliaPayidPayload -> AustraliaPayidAccountPayload Fit to nameing convention for acct payload classes; API's reflection based acct creation logic depends on it. --- .../payload/AustraliaPayidAccountPayload.java | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 core/src/main/java/bisq/core/payment/payload/AustraliaPayidAccountPayload.java diff --git a/core/src/main/java/bisq/core/payment/payload/AustraliaPayidAccountPayload.java b/core/src/main/java/bisq/core/payment/payload/AustraliaPayidAccountPayload.java new file mode 100644 index 00000000000..f8600ab36af --- /dev/null +++ b/core/src/main/java/bisq/core/payment/payload/AustraliaPayidAccountPayload.java @@ -0,0 +1,113 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.core.payment.payload; + +import bisq.core.locale.Res; + +import bisq.common.util.CollectionUtils; + +import com.google.protobuf.Message; + +import java.nio.charset.StandardCharsets; + +import java.util.HashMap; +import java.util.Map; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.extern.slf4j.Slf4j; + +@EqualsAndHashCode(callSuper = true) +@ToString +@Setter +@Getter +@Slf4j +public final class AustraliaPayidAccountPayload extends PaymentAccountPayload { + private String payid = ""; + private String bankAccountName = ""; + + public AustraliaPayidAccountPayload(String paymentMethod, String id) { + super(paymentMethod, id); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // PROTO BUFFER + /////////////////////////////////////////////////////////////////////////////////////////// + + private AustraliaPayidAccountPayload(String paymentMethod, + String id, + String payid, + String bankAccountName, + long maxTradePeriod, + Map excludeFromJsonDataMap) { + super(paymentMethod, + id, + maxTradePeriod, + excludeFromJsonDataMap); + + this.payid = payid; + this.bankAccountName = bankAccountName; + } + + @Override + public Message toProtoMessage() { + return getPaymentAccountPayloadBuilder() + .setAustraliaPayidPayload( + protobuf.AustraliaPayidPayload.newBuilder() + .setPayid(payid) + .setBankAccountName(bankAccountName) + ).build(); + } + + public static AustraliaPayidAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { + protobuf.AustraliaPayidPayload AustraliaPayidPayload = proto.getAustraliaPayidPayload(); + return new AustraliaPayidAccountPayload(proto.getPaymentMethodId(), + proto.getId(), + AustraliaPayidPayload.getPayid(), + AustraliaPayidPayload.getBankAccountName(), + proto.getMaxTradePeriod(), + CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // API + /////////////////////////////////////////////////////////////////////////////////////////// + + @Override + public String getPaymentDetails() { + return Res.get(paymentMethodId) + " - " + getPaymentDetailsForTradePopup().replace("\n", ", "); + } + + @Override + public String getPaymentDetailsForTradePopup() { + return + Res.get("payment.australia.payid") + ": " + payid + "\n" + + Res.get("payment.account.owner") + ": " + bankAccountName; + } + + + @Override + public byte[] getAgeWitnessInputData() { + String all = this.payid + this.bankAccountName; + return super.getAgeWitnessInputData(all.getBytes(StandardCharsets.UTF_8)); + } +} From 77a206e0db3a8f710dcdc24bcc4baff715ee41e9 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:09:12 -0300 Subject: [PATCH 2/5] Remove deleted (renamed) class --- .../payload/AustraliaPayidPayload.java | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 core/src/main/java/bisq/core/payment/payload/AustraliaPayidPayload.java diff --git a/core/src/main/java/bisq/core/payment/payload/AustraliaPayidPayload.java b/core/src/main/java/bisq/core/payment/payload/AustraliaPayidPayload.java deleted file mode 100644 index 50539cd4c0a..00000000000 --- a/core/src/main/java/bisq/core/payment/payload/AustraliaPayidPayload.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.core.payment.payload; - -import bisq.core.locale.Res; - -import bisq.common.util.CollectionUtils; - -import com.google.protobuf.Message; - -import java.nio.charset.StandardCharsets; - -import java.util.HashMap; -import java.util.Map; - -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.extern.slf4j.Slf4j; - -@EqualsAndHashCode(callSuper = true) -@ToString -@Setter -@Getter -@Slf4j -public final class AustraliaPayidPayload extends PaymentAccountPayload { - private String payid = ""; - private String bankAccountName = ""; - - public AustraliaPayidPayload(String paymentMethod, String id) { - super(paymentMethod, id); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // PROTO BUFFER - /////////////////////////////////////////////////////////////////////////////////////////// - - private AustraliaPayidPayload(String paymentMethod, - String id, - String payid, - String bankAccountName, - long maxTradePeriod, - Map excludeFromJsonDataMap) { - super(paymentMethod, - id, - maxTradePeriod, - excludeFromJsonDataMap); - - this.payid = payid; - this.bankAccountName = bankAccountName; - } - - @Override - public Message toProtoMessage() { - return getPaymentAccountPayloadBuilder() - .setAustraliaPayidPayload( - protobuf.AustraliaPayidPayload.newBuilder() - .setPayid(payid) - .setBankAccountName(bankAccountName) - ).build(); - } - - public static AustraliaPayidPayload fromProto(protobuf.PaymentAccountPayload proto) { - protobuf.AustraliaPayidPayload AustraliaPayidPayload = proto.getAustraliaPayidPayload(); - return new AustraliaPayidPayload(proto.getPaymentMethodId(), - proto.getId(), - AustraliaPayidPayload.getPayid(), - AustraliaPayidPayload.getBankAccountName(), - proto.getMaxTradePeriod(), - CollectionUtils.isEmpty(proto.getExcludeFromJsonDataMap()) ? null : new HashMap<>(proto.getExcludeFromJsonDataMap())); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // API - /////////////////////////////////////////////////////////////////////////////////////////// - - @Override - public String getPaymentDetails() { - return Res.get(paymentMethodId) + " - " + getPaymentDetailsForTradePopup().replace("\n", ", "); - } - - @Override - public String getPaymentDetailsForTradePopup() { - return - Res.get("payment.australia.payid") + ": " + payid + "\n" + - Res.get("payment.account.owner") + ": " + bankAccountName; - } - - - @Override - public byte[] getAgeWitnessInputData() { - String all = this.payid + this.bankAccountName; - return super.getAgeWitnessInputData(all.getBytes(StandardCharsets.UTF_8)); - } -} From 4df152b83383c372dcc86b706d497fc07b441214 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:10:13 -0300 Subject: [PATCH 3/5] Adjust to renamed class: AustraliaPayidAccountPayload --- .../bisq/core/payment/AustraliaPayidAccount.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/bisq/core/payment/AustraliaPayidAccount.java b/core/src/main/java/bisq/core/payment/AustraliaPayidAccount.java index a09a62209c8..d5a79e2caef 100644 --- a/core/src/main/java/bisq/core/payment/AustraliaPayidAccount.java +++ b/core/src/main/java/bisq/core/payment/AustraliaPayidAccount.java @@ -19,7 +19,7 @@ import bisq.core.locale.FiatCurrency; import bisq.core.locale.TradeCurrency; -import bisq.core.payment.payload.AustraliaPayidPayload; +import bisq.core.payment.payload.AustraliaPayidAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PaymentMethod; @@ -38,7 +38,7 @@ public AustraliaPayidAccount() { @Override protected PaymentAccountPayload createPayload() { - return new AustraliaPayidPayload(paymentMethod.getId(), id); + return new AustraliaPayidAccountPayload(paymentMethod.getId(), id); } @Override @@ -47,20 +47,20 @@ protected PaymentAccountPayload createPayload() { } public String getPayid() { - return ((AustraliaPayidPayload) paymentAccountPayload).getPayid(); + return ((AustraliaPayidAccountPayload) paymentAccountPayload).getPayid(); } public void setPayid(String payid) { if (payid == null) payid = ""; - ((AustraliaPayidPayload) paymentAccountPayload).setPayid(payid); + ((AustraliaPayidAccountPayload) paymentAccountPayload).setPayid(payid); } public String getBankAccountName() { - return ((AustraliaPayidPayload) paymentAccountPayload).getBankAccountName(); + return ((AustraliaPayidAccountPayload) paymentAccountPayload).getBankAccountName(); } public void setBankAccountName(String bankAccountName) { if (bankAccountName == null) bankAccountName = ""; - ((AustraliaPayidPayload) paymentAccountPayload).setBankAccountName(bankAccountName); + ((AustraliaPayidAccountPayload) paymentAccountPayload).setBankAccountName(bankAccountName); } } From c03dac5a268b91c2116b4a669c845f4d4777e6c6 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:11:01 -0300 Subject: [PATCH 4/5] Adjust to renamed class: AustraliaPayidAccountPayload --- core/src/main/java/bisq/core/proto/CoreProtoResolver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/bisq/core/proto/CoreProtoResolver.java b/core/src/main/java/bisq/core/proto/CoreProtoResolver.java index 1a0e2bd10e6..0ab652e55d0 100644 --- a/core/src/main/java/bisq/core/proto/CoreProtoResolver.java +++ b/core/src/main/java/bisq/core/proto/CoreProtoResolver.java @@ -25,7 +25,7 @@ import bisq.core.payment.payload.AdvancedCashAccountPayload; import bisq.core.payment.payload.AliPayAccountPayload; import bisq.core.payment.payload.AmazonGiftCardAccountPayload; -import bisq.core.payment.payload.AustraliaPayidPayload; +import bisq.core.payment.payload.AustraliaPayidAccountPayload; import bisq.core.payment.payload.BizumAccountPayload; import bisq.core.payment.payload.BsqSwapAccountPayload; import bisq.core.payment.payload.CapitualAccountPayload; @@ -186,7 +186,7 @@ public PaymentAccountPayload fromProto(protobuf.PaymentAccountPayload proto) { case JAPAN_BANK_ACCOUNT_PAYLOAD: return JapanBankAccountPayload.fromProto(proto); case AUSTRALIA_PAYID_PAYLOAD: - return AustraliaPayidPayload.fromProto(proto); + return AustraliaPayidAccountPayload.fromProto(proto); case UPHOLD_ACCOUNT_PAYLOAD: return UpholdAccountPayload.fromProto(proto); case MONEY_BEAM_ACCOUNT_PAYLOAD: From 0bd38c9fce8dc037f46cd7c6ca5da446061f755f Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Sat, 30 Apr 2022 11:11:37 -0300 Subject: [PATCH 5/5] Adjust to renamed class: AustraliaPayidAccountPayload --- .../components/paymentmethods/AustraliaPayidForm.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AustraliaPayidForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AustraliaPayidForm.java index 62d6e8c3983..03defcc1333 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AustraliaPayidForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AustraliaPayidForm.java @@ -26,7 +26,7 @@ import bisq.core.locale.TradeCurrency; import bisq.core.payment.AustraliaPayidAccount; import bisq.core.payment.PaymentAccount; -import bisq.core.payment.payload.AustraliaPayidPayload; +import bisq.core.payment.payload.AustraliaPayidAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; @@ -43,9 +43,9 @@ public class AustraliaPayidForm extends PaymentMethodForm { public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), - ((AustraliaPayidPayload) paymentAccountPayload).getBankAccountName()); + ((AustraliaPayidAccountPayload) paymentAccountPayload).getBankAccountName()); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.payid"), - ((AustraliaPayidPayload) paymentAccountPayload).getPayid()); + ((AustraliaPayidAccountPayload) paymentAccountPayload).getPayid()); return gridRow; }