mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Add Payment Methods: Paysera and Paxum
This commit is contained in:
parent
15093720b9
commit
984a269776
15 changed files with 641 additions and 1 deletions
|
@ -330,6 +330,74 @@ public class CurrencyUtil {
|
|||
return currencies;
|
||||
}
|
||||
|
||||
// https://github.com/bisq-network/growth/issues/233
|
||||
public static List<TradeCurrency> getAllPayseraCurrencies() {
|
||||
ArrayList<TradeCurrency> currencies = new ArrayList<>(Arrays.asList(
|
||||
new FiatCurrency("AUD"),
|
||||
new FiatCurrency("BGN"),
|
||||
new FiatCurrency("BYN"),
|
||||
new FiatCurrency("CAD"),
|
||||
new FiatCurrency("CHF"),
|
||||
new FiatCurrency("CNY"),
|
||||
new FiatCurrency("CZK"),
|
||||
new FiatCurrency("DKK"),
|
||||
new FiatCurrency("EUR"),
|
||||
new FiatCurrency("GBP"),
|
||||
new FiatCurrency("GEL"),
|
||||
new FiatCurrency("HKD"),
|
||||
new FiatCurrency("HRK"),
|
||||
new FiatCurrency("HUF"),
|
||||
new FiatCurrency("ILS"),
|
||||
new FiatCurrency("INR"),
|
||||
new FiatCurrency("JPY"),
|
||||
new FiatCurrency("KZT"),
|
||||
new FiatCurrency("MXN"),
|
||||
new FiatCurrency("NOK"),
|
||||
new FiatCurrency("NZD"),
|
||||
new FiatCurrency("PHP"),
|
||||
new FiatCurrency("PLN"),
|
||||
new FiatCurrency("RON"),
|
||||
new FiatCurrency("RSD"),
|
||||
new FiatCurrency("RUB"),
|
||||
new FiatCurrency("SEK"),
|
||||
new FiatCurrency("SGD"),
|
||||
new FiatCurrency("THB"),
|
||||
new FiatCurrency("TRY"),
|
||||
new FiatCurrency("USD"),
|
||||
new FiatCurrency("ZAR")
|
||||
));
|
||||
|
||||
currencies.sort(Comparator.comparing(TradeCurrency::getCode));
|
||||
return currencies;
|
||||
}
|
||||
|
||||
// https://github.com/bisq-network/growth/issues/235
|
||||
public static List<TradeCurrency> getAllPaxumCurrencies() {
|
||||
ArrayList<TradeCurrency> currencies = new ArrayList<>(Arrays.asList(
|
||||
new FiatCurrency("USD"),
|
||||
new FiatCurrency("CAD"),
|
||||
new FiatCurrency("EUR"),
|
||||
new FiatCurrency("DKK"),
|
||||
new FiatCurrency("CZK"),
|
||||
new FiatCurrency("AUD"),
|
||||
new FiatCurrency("ZAR"),
|
||||
new FiatCurrency("THB"),
|
||||
new FiatCurrency("CHF"),
|
||||
new FiatCurrency("SEK"),
|
||||
new FiatCurrency("RON"),
|
||||
new FiatCurrency("PLN"),
|
||||
new FiatCurrency("NZD"),
|
||||
new FiatCurrency("NOK"),
|
||||
new FiatCurrency("INR"),
|
||||
new FiatCurrency("IDR"),
|
||||
new FiatCurrency("HUF"),
|
||||
new FiatCurrency("GBP")
|
||||
));
|
||||
|
||||
currencies.sort(Comparator.comparing(TradeCurrency::getCode));
|
||||
return currencies;
|
||||
}
|
||||
|
||||
public static List<TradeCurrency> getAllAmazonGiftCardCurrencies() {
|
||||
List<TradeCurrency> currencies = new ArrayList<>(Arrays.asList(
|
||||
new FiatCurrency("AUD"),
|
||||
|
|
44
core/src/main/java/bisq/core/payment/PaxumAccount.java
Normal file
44
core/src/main/java/bisq/core/payment/PaxumAccount.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.payment;
|
||||
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.payload.PaxumAccountPayload;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class PaxumAccount extends PaymentAccount {
|
||||
public PaxumAccount() {
|
||||
super(PaymentMethod.PAXUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountPayload createPayload() {
|
||||
return new PaxumAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
public void setEmail(String accountId) {
|
||||
((PaxumAccountPayload) paymentAccountPayload).setEmail(accountId);
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return ((PaxumAccountPayload) paymentAccountPayload).getEmail();
|
||||
}
|
||||
}
|
|
@ -82,6 +82,10 @@ public class PaymentAccountFactory {
|
|||
return new AdvancedCashAccount();
|
||||
case PaymentMethod.TRANSFERWISE_ID:
|
||||
return new TransferwiseAccount();
|
||||
case PaymentMethod.PAYSERA_ID:
|
||||
return new PayseraAccount();
|
||||
case PaymentMethod.PAXUM_ID:
|
||||
return new PaxumAccount();
|
||||
case PaymentMethod.AMAZON_GIFT_CARD_ID:
|
||||
return new AmazonGiftCardAccount();
|
||||
case PaymentMethod.BLOCK_CHAINS_INSTANT_ID:
|
||||
|
|
44
core/src/main/java/bisq/core/payment/PayseraAccount.java
Normal file
44
core/src/main/java/bisq/core/payment/PayseraAccount.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.payment;
|
||||
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.payment.payload.PayseraAccountPayload;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public final class PayseraAccount extends PaymentAccount {
|
||||
public PayseraAccount() {
|
||||
super(PaymentMethod.PAYSERA);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccountPayload createPayload() {
|
||||
return new PayseraAccountPayload(paymentMethod.getId(), id);
|
||||
}
|
||||
|
||||
public void setEmail(String accountId) {
|
||||
((PayseraAccountPayload) paymentAccountPayload).setEmail(accountId);
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return ((PayseraAccountPayload) paymentAccountPayload).getEmail();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.payment.payload;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
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 PaxumAccountPayload extends PaymentAccountPayload {
|
||||
private String email = "";
|
||||
|
||||
public PaxumAccountPayload(String paymentMethod, String id) {
|
||||
super(paymentMethod, id);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private PaxumAccountPayload(String paymentMethod,
|
||||
String id,
|
||||
String email,
|
||||
long maxTradePeriod,
|
||||
Map<String, String> excludeFromJsonDataMap) {
|
||||
super(paymentMethod,
|
||||
id,
|
||||
maxTradePeriod,
|
||||
excludeFromJsonDataMap);
|
||||
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message toProtoMessage() {
|
||||
return getPaymentAccountPayloadBuilder()
|
||||
.setPaxumAccountPayload(protobuf.PaxumAccountPayload.newBuilder().setEmail(email))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static PaxumAccountPayload fromProto(protobuf.PaymentAccountPayload proto) {
|
||||
return new PaxumAccountPayload(proto.getPaymentMethodId(),
|
||||
proto.getId(),
|
||||
proto.getPaxumAccountPayload().getEmail(),
|
||||
proto.getMaxTradePeriod(),
|
||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.email") + " " + email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return getPaymentDetails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getAgeWitnessInputData() {
|
||||
return super.getAgeWitnessInputData(email.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
|
@ -96,6 +96,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
public static final String PROMPT_PAY_ID = "PROMPT_PAY";
|
||||
public static final String ADVANCED_CASH_ID = "ADVANCED_CASH";
|
||||
public static final String TRANSFERWISE_ID = "TRANSFERWISE";
|
||||
public static final String PAYSERA_ID = "PAYSERA";
|
||||
public static final String PAXUM_ID = "PAXUM";
|
||||
public static final String AMAZON_GIFT_CARD_ID = "AMAZON_GIFT_CARD";
|
||||
public static final String BLOCK_CHAINS_INSTANT_ID = "BLOCK_CHAINS_INSTANT";
|
||||
public static final String CASH_BY_MAIL_ID = "CASH_BY_MAIL";
|
||||
|
@ -138,6 +140,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
public static PaymentMethod PROMPT_PAY;
|
||||
public static PaymentMethod ADVANCED_CASH;
|
||||
public static PaymentMethod TRANSFERWISE;
|
||||
public static PaymentMethod PAYSERA;
|
||||
public static PaymentMethod PAXUM;
|
||||
public static PaymentMethod AMAZON_GIFT_CARD;
|
||||
public static PaymentMethod BLOCK_CHAINS_INSTANT;
|
||||
public static PaymentMethod CASH_BY_MAIL;
|
||||
|
@ -193,6 +197,8 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
|
|||
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK),
|
||||
ADVANCED_CASH = new PaymentMethod(ADVANCED_CASH_ID, DAY, DEFAULT_TRADE_LIMIT_VERY_LOW_RISK),
|
||||
TRANSFERWISE = new PaymentMethod(TRANSFERWISE_ID, 4 * DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK),
|
||||
PAYSERA = new PaymentMethod(PAYSERA_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK),
|
||||
PAXUM = new PaymentMethod(PAXUM_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK),
|
||||
CAPITUAL = new PaymentMethod(CAPITUAL_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK),
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.payment.payload;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
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 PayseraAccountPayload extends PaymentAccountPayload {
|
||||
private String email = "";
|
||||
|
||||
public PayseraAccountPayload(String paymentMethod, String id) {
|
||||
super(paymentMethod, id);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private PayseraAccountPayload(String paymentMethod,
|
||||
String id,
|
||||
String email,
|
||||
long maxTradePeriod,
|
||||
Map<String, String> excludeFromJsonDataMap) {
|
||||
super(paymentMethod,
|
||||
id,
|
||||
maxTradePeriod,
|
||||
excludeFromJsonDataMap);
|
||||
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message toProtoMessage() {
|
||||
return getPaymentAccountPayloadBuilder()
|
||||
.setPayseraAccountPayload(protobuf.PayseraAccountPayload.newBuilder().setEmail(email))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static PayseraAccountPayload fromProto(protobuf.PaymentAccountPayload proto) {
|
||||
return new PayseraAccountPayload(proto.getPaymentMethodId(),
|
||||
proto.getId(),
|
||||
proto.getPayseraAccountPayload().getEmail(),
|
||||
proto.getMaxTradePeriod(),
|
||||
new HashMap<>(proto.getExcludeFromJsonDataMap()));
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getPaymentDetails() {
|
||||
return Res.get(paymentMethodId) + " - " + Res.getWithCol("payment.email") + " " + email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentDetailsForTradePopup() {
|
||||
return getPaymentDetails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getAgeWitnessInputData() {
|
||||
return super.getAgeWitnessInputData(email.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
|
@ -42,7 +42,9 @@ import bisq.core.payment.payload.MoneyBeamAccountPayload;
|
|||
import bisq.core.payment.payload.MoneyGramAccountPayload;
|
||||
import bisq.core.payment.payload.NationalBankAccountPayload;
|
||||
import bisq.core.payment.payload.OKPayAccountPayload;
|
||||
import bisq.core.payment.payload.PaxumAccountPayload;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PayseraAccountPayload;
|
||||
import bisq.core.payment.payload.PerfectMoneyAccountPayload;
|
||||
import bisq.core.payment.payload.PopmoneyAccountPayload;
|
||||
import bisq.core.payment.payload.PromptPayAccountPayload;
|
||||
|
@ -156,6 +158,10 @@ public class CoreProtoResolver implements ProtoResolver {
|
|||
return AdvancedCashAccountPayload.fromProto(proto);
|
||||
case TRANSFERWISE_ACCOUNT_PAYLOAD:
|
||||
return TransferwiseAccountPayload.fromProto(proto);
|
||||
case PAYSERA_ACCOUNT_PAYLOAD:
|
||||
return PayseraAccountPayload.fromProto(proto);
|
||||
case PAXUM_ACCOUNT_PAYLOAD:
|
||||
return PaxumAccountPayload.fromProto(proto);
|
||||
case AMAZON_GIFT_CARD_ACCOUNT_PAYLOAD:
|
||||
return AmazonGiftCardAccountPayload.fromProto(proto);
|
||||
case INSTANT_CRYPTO_CURRENCY_ACCOUNT_PAYLOAD:
|
||||
|
|
|
@ -153,7 +153,9 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
|||
TRANSFERWISE,
|
||||
AMAZON_GIFT_CARD,
|
||||
CASH_BY_MAIL,
|
||||
CAPITUAL
|
||||
CAPITUAL,
|
||||
PAYSERA,
|
||||
PAXUM
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
|
|
@ -3572,6 +3572,10 @@ ADVANCED_CASH=Advanced Cash
|
|||
# suppress inspection "UnusedProperty"
|
||||
TRANSFERWISE=TransferWise
|
||||
# suppress inspection "UnusedProperty"
|
||||
PAYSERA=Paysera
|
||||
# suppress inspection "UnusedProperty"
|
||||
PAXUM=Paxum
|
||||
# suppress inspection "UnusedProperty"
|
||||
AMAZON_GIFT_CARD=Amazon eGift Card
|
||||
# suppress inspection "UnusedProperty"
|
||||
BLOCK_CHAINS_INSTANT=Altcoins Instant
|
||||
|
@ -3626,6 +3630,10 @@ ADVANCED_CASH_SHORT=Advanced Cash
|
|||
# suppress inspection "UnusedProperty"
|
||||
TRANSFERWISE_SHORT=TransferWise
|
||||
# suppress inspection "UnusedProperty"
|
||||
PAYSERA_SHORT=Paysera
|
||||
# suppress inspection "UnusedProperty"
|
||||
PAXUM_SHORT=Paxum
|
||||
# suppress inspection "UnusedProperty"
|
||||
AMAZON_GIFT_CARD_SHORT=Amazon eGift Card
|
||||
# suppress inspection "UnusedProperty"
|
||||
BLOCK_CHAINS_INSTANT_SHORT=Altcoins Instant
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.PaxumAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PaxumAccountPayload;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
|
||||
public class PaxumForm extends PaymentMethodForm {
|
||||
private final PaxumAccount account;
|
||||
private InputTextField emailInputTextField;
|
||||
private EmailValidator validator = new EmailValidator();
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.email"),
|
||||
((PaxumAccountPayload) paymentAccountPayload).getEmail());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public PaxumForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
InputValidator inputValidator, GridPane gridPane,
|
||||
int gridRow, CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.account = (PaxumAccount) paymentAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
emailInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.email"));
|
||||
emailInputTextField.setValidator(validator);
|
||||
emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
account.setEmail(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
addCurrenciesGrid(true);
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
}
|
||||
|
||||
private void addCurrenciesGrid(boolean isEditable) {
|
||||
FlowPane flowPane = FormBuilder.addTopLabelFlowPane(gridPane, ++gridRow,
|
||||
Res.get("payment.supportedCurrenciesForReceiver"), 20, 20).second;
|
||||
|
||||
if (isEditable) {
|
||||
flowPane.setId("flow-pane-checkboxes-bg");
|
||||
} else {
|
||||
flowPane.setId("flow-pane-checkboxes-non-editable-bg");
|
||||
}
|
||||
|
||||
CurrencyUtil.getAllPaxumCurrencies().forEach(currency ->
|
||||
fillUpFlowPaneWithCurrencies(isEditable, flowPane, currency, account));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(emailInputTextField.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
|
||||
account.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(account.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
|
||||
account.getEmail()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLimitations(true);
|
||||
addCurrenciesGrid(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& account.getEmail() != null
|
||||
&& validator.validate(account.getEmail()).isValid
|
||||
&& account.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.PayseraAccount;
|
||||
import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.payment.payload.PayseraAccountPayload;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addCompactTopLabelTextFieldWithCopyIcon;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
|
||||
public class PayseraForm extends PaymentMethodForm {
|
||||
private final PayseraAccount account;
|
||||
private InputTextField emailInputTextField;
|
||||
private EmailValidator validator = new EmailValidator();
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload) {
|
||||
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.email"),
|
||||
((PayseraAccountPayload) paymentAccountPayload).getEmail());
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
public PayseraForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
InputValidator inputValidator, GridPane gridPane,
|
||||
int gridRow, CoinFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.account = (PayseraAccount) paymentAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
emailInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.email"));
|
||||
emailInputTextField.setValidator(validator);
|
||||
emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
|
||||
account.setEmail(newValue.trim());
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
addCurrenciesGrid(true);
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
}
|
||||
|
||||
private void addCurrenciesGrid(boolean isEditable) {
|
||||
FlowPane flowPane = FormBuilder.addTopLabelFlowPane(gridPane, ++gridRow,
|
||||
Res.get("payment.supportedCurrenciesForReceiver"), 20, 20).second;
|
||||
|
||||
if (isEditable) {
|
||||
flowPane.setId("flow-pane-checkboxes-bg");
|
||||
} else {
|
||||
flowPane.setId("flow-pane-checkboxes-non-editable-bg");
|
||||
}
|
||||
|
||||
CurrencyUtil.getAllPayseraCurrencies().forEach(currency ->
|
||||
fillUpFlowPaneWithCurrencies(isEditable, flowPane, currency, account));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
setAccountNameWithString(emailInputTextField.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"),
|
||||
account.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
|
||||
Res.get(account.getPaymentMethod().getId()));
|
||||
TextField field = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
|
||||
account.getEmail()).second;
|
||||
field.setMouseTransparent(false);
|
||||
addLimitations(true);
|
||||
addCurrenciesGrid(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAllInputsValid() {
|
||||
allInputsValid.set(isAccountNameValid()
|
||||
&& account.getEmail() != null
|
||||
&& validator.validate(account.getEmail()).isValid
|
||||
&& account.getTradeCurrencies().size() > 0);
|
||||
}
|
||||
}
|
|
@ -47,6 +47,8 @@ import bisq.desktop.components.paymentmethods.SepaInstantForm;
|
|||
import bisq.desktop.components.paymentmethods.SpecificBankForm;
|
||||
import bisq.desktop.components.paymentmethods.SwishForm;
|
||||
import bisq.desktop.components.paymentmethods.TransferwiseForm;
|
||||
import bisq.desktop.components.paymentmethods.PayseraForm;
|
||||
import bisq.desktop.components.paymentmethods.PaxumForm;
|
||||
import bisq.desktop.components.paymentmethods.USPostalMoneyOrderForm;
|
||||
import bisq.desktop.components.paymentmethods.UpholdForm;
|
||||
import bisq.desktop.components.paymentmethods.WeChatPayForm;
|
||||
|
@ -533,6 +535,10 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
|
|||
return new AdvancedCashForm(paymentAccount, accountAgeWitnessService, advancedCashValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.TRANSFERWISE_ID:
|
||||
return new TransferwiseForm(paymentAccount, accountAgeWitnessService, transferwiseValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.PAYSERA_ID:
|
||||
return new PayseraForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.PAXUM_ID:
|
||||
return new PaxumForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.AMAZON_GIFT_CARD_ID:
|
||||
return new AmazonGiftCardForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.CAPITUAL_ID:
|
||||
|
|
|
@ -38,6 +38,8 @@ import bisq.desktop.components.paymentmethods.JapanBankTransferForm;
|
|||
import bisq.desktop.components.paymentmethods.MoneyBeamForm;
|
||||
import bisq.desktop.components.paymentmethods.MoneyGramForm;
|
||||
import bisq.desktop.components.paymentmethods.NationalBankForm;
|
||||
import bisq.desktop.components.paymentmethods.PaxumForm;
|
||||
import bisq.desktop.components.paymentmethods.PayseraForm;
|
||||
import bisq.desktop.components.paymentmethods.PerfectMoneyForm;
|
||||
import bisq.desktop.components.paymentmethods.PopmoneyForm;
|
||||
import bisq.desktop.components.paymentmethods.PromptPayForm;
|
||||
|
@ -321,6 +323,12 @@ public class BuyerStep2View extends TradeStepView {
|
|||
case PaymentMethod.TRANSFERWISE_ID:
|
||||
gridRow = TransferwiseForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
case PaymentMethod.PAYSERA_ID:
|
||||
gridRow = PayseraForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
case PaymentMethod.PAXUM_ID:
|
||||
gridRow = PaxumForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
case PaymentMethod.AMAZON_GIFT_CARD_ID:
|
||||
gridRow = AmazonGiftCardForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
|
||||
break;
|
||||
|
|
|
@ -997,6 +997,8 @@ message PaymentAccountPayload {
|
|||
AmazonGiftCardAccountPayload amazon_gift_card_account_payload = 31;
|
||||
CashByMailAccountPayload cash_by_mail_account_payload = 32;
|
||||
CapitualAccountPayload capitual_account_payload = 33;
|
||||
PayseraAccountPayload Paysera_account_payload = 34;
|
||||
PaxumAccountPayload Paxum_account_payload = 35;
|
||||
}
|
||||
map<string, string> exclude_from_json_data = 15;
|
||||
}
|
||||
|
@ -1218,6 +1220,14 @@ message TransferwiseAccountPayload {
|
|||
string email = 1;
|
||||
}
|
||||
|
||||
message PayseraAccountPayload {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
message PaxumAccountPayload {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
message CapitualAccountPayload {
|
||||
string account_nr = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue