Add new payment method "Faster Payments System (SBP)" for Russian Ruble

This is the standard P2P payment method in Russia to perform funds transfers and
payments between Russian bank accounts in Russian Rubles. There is no chargeback
risk. Recipient bank account is located using telephone number and bank name,
and sender receives recipients first name, middle name, and initial of last name
to confirm the phone number entered is correct before sending. Adding this new
payment method has been discussed at length on the GitHub 'growth' channel at:
   https://github.com/bisq-network/growth/issues/288
This commit is contained in:
Chris Parker 2024-09-22 18:05:19 -04:00
parent c8c9251f2b
commit a136f79bd1
No known key found for this signature in database
GPG Key ID: C924FE487A9DA755
14 changed files with 439 additions and 1 deletions

View File

@ -132,6 +132,8 @@ public class PaymentAccountFactory {
return new BsqSwapAccount(); return new BsqSwapAccount();
case PaymentMethod.MERCADO_PAGO_ID: case PaymentMethod.MERCADO_PAGO_ID:
return new MercadoPagoAccount(); return new MercadoPagoAccount();
case PaymentMethod.SBP_ID:
return new SbpAccount();
// Cannot be deleted as it would break old trade history entries // Cannot be deleted as it would break old trade history entries
case PaymentMethod.OK_PAY_ID: case PaymentMethod.OK_PAY_ID:

View File

@ -216,6 +216,8 @@ public class PaymentAccountUtil {
return VerseAccount.SUPPORTED_CURRENCIES; return VerseAccount.SUPPORTED_CURRENCIES;
case MERCADO_PAGO_ID: case MERCADO_PAGO_ID:
return MercadoPagoAccount.SUPPORTED_CURRENCIES(); return MercadoPagoAccount.SUPPORTED_CURRENCIES();
case SBP_ID:
return SbpAccount.SUPPORTED_CURRENCIES;
default: default:
return Collections.emptyList(); return Collections.emptyList();
} }

View File

@ -0,0 +1,78 @@
/*
* 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.locale.FiatCurrency;
import bisq.core.locale.TradeCurrency;
import bisq.core.payment.payload.SbpAccountPayload;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.payment.payload.PaymentMethod;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@EqualsAndHashCode(callSuper = true)
public final class SbpAccount extends PaymentAccount {
public static final List<TradeCurrency> SUPPORTED_CURRENCIES = List.of(new FiatCurrency("RUB"));
public SbpAccount() {
super(PaymentMethod.SBP);
setSingleTradeCurrency(SUPPORTED_CURRENCIES.get(0));
}
@Override
protected PaymentAccountPayload createPayload() {
return new SbpAccountPayload(paymentMethod.getId(), id);
}
@Override
public @NonNull List<TradeCurrency> getSupportedCurrencies() {
return SUPPORTED_CURRENCIES;
}
public String getMessageForAccountCreation() {
return "payment.sbp.info.account";
}
public void setMobileNumber(String mobileNumber) {
((SbpAccountPayload) paymentAccountPayload).setMobileNumber(mobileNumber);
}
public String getMobileNumber() {
return ((SbpAccountPayload) paymentAccountPayload).getMobileNumber();
}
public void setBankName(String bankName) {
((SbpAccountPayload) paymentAccountPayload).setBankName(bankName);
}
public String getBankName() {
return ((SbpAccountPayload) paymentAccountPayload).getBankName();
}
public void setHolderName(String holderName) {
((SbpAccountPayload) paymentAccountPayload).setHolderName(holderName);
}
public String getHolderName() {
return ((SbpAccountPayload) paymentAccountPayload).getHolderName();
}
}

View File

@ -124,6 +124,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
public static final String DOMESTIC_WIRE_TRANSFER_ID = "DOMESTIC_WIRE_TRANSFER"; public static final String DOMESTIC_WIRE_TRANSFER_ID = "DOMESTIC_WIRE_TRANSFER";
public static final String BSQ_SWAP_ID = "BSQ_SWAP"; public static final String BSQ_SWAP_ID = "BSQ_SWAP";
public static final String MERCADO_PAGO_ID = "MERCADO_PAGO"; public static final String MERCADO_PAGO_ID = "MERCADO_PAGO";
public static final String SBP_ID = "SBP";
// Cannot be deleted as it would break old trade history entries // Cannot be deleted as it would break old trade history entries
@Deprecated @Deprecated
@ -188,6 +189,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
public static PaymentMethod DOMESTIC_WIRE_TRANSFER; public static PaymentMethod DOMESTIC_WIRE_TRANSFER;
public static PaymentMethod BSQ_SWAP; public static PaymentMethod BSQ_SWAP;
public static PaymentMethod MERCADO_PAGO; public static PaymentMethod MERCADO_PAGO;
public static PaymentMethod SBP;
// Cannot be deleted as it would break old trade history entries // Cannot be deleted as it would break old trade history entries
@Deprecated @Deprecated
@ -276,6 +278,9 @@ public final class PaymentMethod implements PersistablePayload, Comparable<Payme
// Thailand // Thailand
PROMPT_PAY = new PaymentMethod(PROMPT_PAY_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK), PROMPT_PAY = new PaymentMethod(PROMPT_PAY_ID, DAY, DEFAULT_TRADE_LIMIT_LOW_RISK),
// Russia
SBP = new PaymentMethod(SBP_ID, DAY, DEFAULT_TRADE_LIMIT_HIGH_RISK),
// Altcoins // Altcoins
BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, DAY, DEFAULT_TRADE_LIMIT_VERY_LOW_RISK), BLOCK_CHAINS = new PaymentMethod(BLOCK_CHAINS_ID, DAY, DEFAULT_TRADE_LIMIT_VERY_LOW_RISK),
// Altcoins with 1 hour trade period // Altcoins with 1 hour trade period

View File

@ -0,0 +1,129 @@
/*
* 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 org.apache.commons.lang3.ArrayUtils;
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 SbpAccountPayload extends PaymentAccountPayload implements PayloadWithHolderName {
private String mobileNumber = "";
private String holderName = "";
private String bankName = "";
public SbpAccountPayload(String paymentMethod, String id) {
super(paymentMethod, id);
}
///////////////////////////////////////////////////////////////////////////////////////////
// PROTO BUFFER
///////////////////////////////////////////////////////////////////////////////////////////
private SbpAccountPayload(String paymentMethod,
String id,
String mobileNumber,
String holderName,
String bankName,
long maxTradePeriod,
Map<String, String> excludeFromJsonDataMap) {
super(paymentMethod,
id,
maxTradePeriod,
excludeFromJsonDataMap);
this.mobileNumber = mobileNumber;
this.holderName = holderName;
this.bankName = bankName;
}
@Override
public Message toProtoMessage() {
return getPaymentAccountPayloadBuilder()
.setSbpAccountPayload(protobuf.SbpAccountPayload.newBuilder()
.setMobileNumber(mobileNumber)
.setHolderName(holderName)
.setBankName(bankName))
.build();
}
public static SbpAccountPayload fromProto(protobuf.PaymentAccountPayload proto) {
return new SbpAccountPayload(proto.getPaymentMethodId(),
proto.getId(),
proto.getSbpAccountPayload().getMobileNumber(),
proto.getSbpAccountPayload().getHolderName(),
proto.getSbpAccountPayload().getBankName(),
proto.getMaxTradePeriod(),
new HashMap<>(proto.getExcludeFromJsonDataMap()));
}
///////////////////////////////////////////////////////////////////////////////////////////
// API
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public String getPaymentDetails() {
return Res.get(paymentMethodId) + " - " +
Res.getWithCol("payment.account.owner.sbp") + " " + holderName + ", " +
Res.getWithCol("payment.mobile") + " " + mobileNumber + ", " +
Res.getWithCol("payment.bank.name") + " " + bankName;
}
@Override
public String getPaymentDetailsForTradePopup() {
return Res.getWithCol("payment.account.owner.sbp") + " " + holderName + "\n" +
Res.getWithCol("payment.mobile") + " " + mobileNumber + "\n" +
Res.getWithCol("payment.bank.name") + " " + bankName;
}
@Override
public byte[] getAgeWitnessInputData() {
// We don't add holderName because we don't want to break age validation if the user recreates an account with
// slight changes in holder name (e.g. add or remove middle name)
return super.getAgeWitnessInputData(
ArrayUtils.addAll(
mobileNumber.getBytes(StandardCharsets.UTF_8),
bankName.getBytes(StandardCharsets.UTF_8)
)
);
}
@Override
public String getOwnerId() {
return holderName;
}
}

View File

@ -64,6 +64,7 @@ import bisq.core.payment.payload.RevolutAccountPayload;
import bisq.core.payment.payload.RtgsAccountPayload; import bisq.core.payment.payload.RtgsAccountPayload;
import bisq.core.payment.payload.SameBankAccountPayload; import bisq.core.payment.payload.SameBankAccountPayload;
import bisq.core.payment.payload.SatispayAccountPayload; import bisq.core.payment.payload.SatispayAccountPayload;
import bisq.core.payment.payload.SbpAccountPayload;
import bisq.core.payment.payload.SepaAccountPayload; import bisq.core.payment.payload.SepaAccountPayload;
import bisq.core.payment.payload.SepaInstantAccountPayload; import bisq.core.payment.payload.SepaInstantAccountPayload;
import bisq.core.payment.payload.SpecificBanksAccountPayload; import bisq.core.payment.payload.SpecificBanksAccountPayload;
@ -236,6 +237,8 @@ public class CoreProtoResolver implements ProtoResolver {
return SwiftAccountPayload.fromProto(proto); return SwiftAccountPayload.fromProto(proto);
case BSQ_SWAP_ACCOUNT_PAYLOAD: case BSQ_SWAP_ACCOUNT_PAYLOAD:
return BsqSwapAccountPayload.fromProto(proto); return BsqSwapAccountPayload.fromProto(proto);
case SBP_ACCOUNT_PAYLOAD:
return SbpAccountPayload.fromProto(proto);
// Cannot be deleted as it would break old trade history entries // Cannot be deleted as it would break old trade history entries
case O_K_PAY_ACCOUNT_PAYLOAD: case O_K_PAY_ACCOUNT_PAYLOAD:

View File

@ -197,7 +197,8 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
TIKKIE, TIKKIE,
TRANSFERWISE_USD, TRANSFERWISE_USD,
ACH_TRANSFER, ACH_TRANSFER,
DOMESTIC_WIRE_TRANSFER; DOMESTIC_WIRE_TRANSFER,
SBP;
private static final PaymentMethodMapper[] values = values(); // cache for perf gain private static final PaymentMethodMapper[] values = values(); // cache for perf gain
} }

View File

@ -820,6 +820,7 @@ portfolio.pending.step2_buyer.halCashInfo.msg=You need to send a text message wi
portfolio.pending.step2_buyer.fasterPaymentsHolderNameInfo=Some banks might verify the receiver's name. \ portfolio.pending.step2_buyer.fasterPaymentsHolderNameInfo=Some banks might verify the receiver's name. \
Faster Payments accounts created in old Bisq clients do not provide the receiver's name, \ Faster Payments accounts created in old Bisq clients do not provide the receiver's name, \
so please use trade chat to obtain it (if needed). so please use trade chat to obtain it (if needed).
portfolio.pending.step2_buyer.sbp=Please pay {0} via your bank''s SBP "Pay by Telephone Number" service using the seller''s information on the next screen.\n\n
portfolio.pending.step2_buyer.confirmStart.headline=Confirm that you have started the payment portfolio.pending.step2_buyer.confirmStart.headline=Confirm that you have started the payment
portfolio.pending.step2_buyer.confirmStart.msg=Did you initiate the {0} payment to your trading partner? portfolio.pending.step2_buyer.confirmStart.msg=Did you initiate the {0} payment to your trading partner?
portfolio.pending.step2_buyer.confirmStart.yes=Yes, I have started the payment portfolio.pending.step2_buyer.confirmStart.yes=Yes, I have started the payment
@ -3721,6 +3722,7 @@ payment.account.phoneNr=Phone number
payment.account.owner=Account owner full name payment.account.owner=Account owner full name
payment.account.owner.ask=[Ask trader to provide account name if needed] payment.account.owner.ask=[Ask trader to provide account name if needed]
payment.account.fullName=Full name (first, middle, last) payment.account.fullName=Full name (first, middle, last)
payment.account.owner.sbp=Account owner name (first, middle, and initial of last name)
payment.account.state=State/Province/Region payment.account.state=State/Province/Region
payment.account.city=City payment.account.city=City
payment.account.address=Address payment.account.address=Address
@ -4295,6 +4297,14 @@ payment.amazonGiftCard.info=To pay with Amazon eGift Card, you will need to send
- Amazon eGift Cards can only be redeemed on the Amazon website they were purchased on (e.g., a gift card purchased on amazon.it can only be redeemed on amazon.it) - Amazon eGift Cards can only be redeemed on the Amazon website they were purchased on (e.g., a gift card purchased on amazon.it can only be redeemed on amazon.it)
payment.mercadoPago.holderId=UserID linked to financial institution. Like phone number or email or CVU. payment.mercadoPago.holderId=UserID linked to financial institution. Like phone number or email or CVU.
payment.sbp.info.account=The Faster Payments System (SBP) is an inter-bank funds transfer service in RUSSIA that allows individuals \
to make personal payments using just a mobile phone number.\n\n\
1. The service is for payments and transfers between Russian bank accounts in Russian Rubles only.\n\n\
2. Only Russian carrier mobile numbers (+7 country code) can be registered for use with the service.\n\n\
3. You must create a separate Bisq account for each bank where you have an account and want to receive funds.\n\n\
4. SBP displays the receiver's first name, middle name, and initial letter of last name to verify that the phone number is correct. \
Therefore, you should enter the account owner's name on the Bisq account using the same style.
# We use constants from the code so we do not use our normal naming convention # We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ # dynamic values are not recognized by IntelliJ
@ -4423,6 +4433,9 @@ DOMESTIC_WIRE_TRANSFER=Domestic Wire Transfer
BSQ_SWAP=BSQ Swap BSQ_SWAP=BSQ Swap
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
MERCADO_PAGO=MercadoPago MERCADO_PAGO=MercadoPago
# suppress inspection "UnusedProperty"
SBP=Faster Payments System (SBP)
# Deprecated: Cannot be deleted as it would break old trade history entries # Deprecated: Cannot be deleted as it would break old trade history entries
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
@ -4521,6 +4534,8 @@ DOMESTIC_WIRE_TRANSFER_SHORT=Domestic Wire
BSQ_SWAP_SHORT=BSQ Swap BSQ_SWAP_SHORT=BSQ Swap
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
MERCADO_PAGO_SHORT=MercadoPago MERCADO_PAGO_SHORT=MercadoPago
# suppress inspection "UnusedProperty"
SBP_SHORT=SBP
# Deprecated: Cannot be deleted as it would break old trade history entries # Deprecated: Cannot be deleted as it would break old trade history entries
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"

View File

@ -719,6 +719,7 @@ portfolio.pending.step2_buyer.westernUnionMTCNInfo.msg=Вам необходим
portfolio.pending.step2_buyer.halCashInfo.headline=Отправить код HalCash portfolio.pending.step2_buyer.halCashInfo.headline=Отправить код HalCash
portfolio.pending.step2_buyer.halCashInfo.msg=Вам необходимо отправить сообщение с кодом HalCash и идентификатором сделки ({0}) продавцу BTC.\nНомер моб. тел. продавца: {1}\n\nВы отправили код продавцу? portfolio.pending.step2_buyer.halCashInfo.msg=Вам необходимо отправить сообщение с кодом HalCash и идентификатором сделки ({0}) продавцу BTC.\nНомер моб. тел. продавца: {1}\n\nВы отправили код продавцу?
portfolio.pending.step2_buyer.fasterPaymentsHolderNameInfo=Some banks might verify the receiver's name. Faster Payments accounts created in old Bisq clients do not provide the receiver's name, so please use trade chat to obtain it (if needed). portfolio.pending.step2_buyer.fasterPaymentsHolderNameInfo=Some banks might verify the receiver's name. Faster Payments accounts created in old Bisq clients do not provide the receiver's name, so please use trade chat to obtain it (if needed).
portfolio.pending.step2_buyer.sbp=Пожалуйста, оплатите {0} через услугу SBP «Оплата по номеру телефона» вашего банка, используя информацию продавца на следующем экране.\n\n
portfolio.pending.step2_buyer.confirmStart.headline=Подтвердите начало платежа portfolio.pending.step2_buyer.confirmStart.headline=Подтвердите начало платежа
portfolio.pending.step2_buyer.confirmStart.msg=Вы начали платеж {0} своему контрагенту? portfolio.pending.step2_buyer.confirmStart.msg=Вы начали платеж {0} своему контрагенту?
portfolio.pending.step2_buyer.confirmStart.yes=Да portfolio.pending.step2_buyer.confirmStart.yes=Да
@ -2945,6 +2946,7 @@ payment.account.phoneNr=Phone number
payment.account.owner=Полное имя владельца счёта payment.account.owner=Полное имя владельца счёта
payment.account.owner.ask=[Ask trader to provide account name if needed] payment.account.owner.ask=[Ask trader to provide account name if needed]
payment.account.fullName=Полное имя (имя, отчество, фамилия) payment.account.fullName=Полное имя (имя, отчество, фамилия)
payment.account.owner.sbp=Имя владельца счёта (Имя, отчество, первая буква фамилии)
payment.account.state=Штат/Провинция/Область payment.account.state=Штат/Провинция/Область
payment.account.city=Город payment.account.city=Город
payment.account.address=Адрес payment.account.address=Адрес
@ -3204,6 +3206,14 @@ payment.payid.info=A PayID like a phone number, email address or an Australian B
payment.amazonGiftCard.info=To pay with Amazon eGift Card, you will need to send an Amazon eGift Card to the BTC seller via your Amazon account. \n\nPlease see the wiki [HYPERLINK:https://bisq.wiki/Amazon_eGift_card] for further details and best practices. \n\nThree important notes:\n- try to send gift cards with amounts of 100 USD or smaller, as Amazon is known to flag larger gift cards as fraudulent\n- try to use creative, believable text for the gift card''s message (e.g., "Happy birthday Susan!") and use trader chat to tell your trading peer the reference text you picked so they can verify your payment\n- Amazon eGift Cards can only be redeemed on the Amazon website they were purchased on (e.g., a gift card purchased on amazon.it can only be redeemed on amazon.it) payment.amazonGiftCard.info=To pay with Amazon eGift Card, you will need to send an Amazon eGift Card to the BTC seller via your Amazon account. \n\nPlease see the wiki [HYPERLINK:https://bisq.wiki/Amazon_eGift_card] for further details and best practices. \n\nThree important notes:\n- try to send gift cards with amounts of 100 USD or smaller, as Amazon is known to flag larger gift cards as fraudulent\n- try to use creative, believable text for the gift card''s message (e.g., "Happy birthday Susan!") and use trader chat to tell your trading peer the reference text you picked so they can verify your payment\n- Amazon eGift Cards can only be redeemed on the Amazon website they were purchased on (e.g., a gift card purchased on amazon.it can only be redeemed on amazon.it)
payment.mercadoPago.holderId=UserID linked to financial institution. Like phone number or email or CVU. payment.mercadoPago.holderId=UserID linked to financial institution. Like phone number or email or CVU.
payment.sbp.info.account=Система быстрых платежей (СБП) — это межбанковский сервис денежных переводов в РОССИИ, позволяющий физическим лицам \
совершать личные платежи, используя только номер мобильного телефона.\n\n\
1. Сервис предназначен для платежей и переводов между российскими банковскими счетами только в российских рублях.\n\n\
2. Для использования сервиса можно зарегистрировать только номера мобильных операторов России (+7 код страны).\n\n\
3. Вам необходимо создать отдельную учетную запись Bisq для каждого банка, в котором у вас есть счет и вы хотите получать средства.\n\n\
4. СБП отображает имя, отчество и первую букву фамилии получателя для проверки правильности номера телефона. \
Поэтому вам следует ввести имя владельца учетной записи в учетной записи Bisq, используя тот же стиль.
# We use constants from the code so we do not use our normal naming convention # We use constants from the code so we do not use our normal naming convention
# dynamic values are not recognized by IntelliJ # dynamic values are not recognized by IntelliJ
@ -3332,6 +3342,8 @@ DOMESTIC_WIRE_TRANSFER=Domestic Wire Transfer
BSQ_SWAP=BSQ Swap BSQ_SWAP=BSQ Swap
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
MERCADO_PAGO=MercadoPago MERCADO_PAGO=MercadoPago
# suppress inspection "UnusedProperty"
SBP=Система быстрых платежей (СБП)
# Deprecated: Cannot be deleted as it would break old trade history entries # Deprecated: Cannot be deleted as it would break old trade history entries
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
@ -3430,6 +3442,8 @@ DOMESTIC_WIRE_TRANSFER_SHORT=Domestic Wire
BSQ_SWAP_SHORT=BSQ Swap BSQ_SWAP_SHORT=BSQ Swap
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"
MERCADO_PAGO_SHORT=MercadoPago MERCADO_PAGO_SHORT=MercadoPago
# suppress inspection "UnusedProperty"
SBP_SHORT=СБП
# Deprecated: Cannot be deleted as it would break old trade history entries # Deprecated: Cannot be deleted as it would break old trade history entries
# suppress inspection "UnusedProperty" # suppress inspection "UnusedProperty"

View File

@ -0,0 +1,130 @@
/*
* 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.validation.SbpValidator;
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.locale.Res;
import bisq.core.locale.TradeCurrency;
import bisq.core.payment.SbpAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.payload.SbpAccountPayload;
import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;
import javafx.scene.control.TextField;
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 SbpForm extends PaymentMethodForm {
private final SbpAccount SbpAccount;
private final SbpValidator SbpValidator;
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) {
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.owner.sbp"),
((SbpAccountPayload) paymentAccountPayload).getHolderName());
addCompactTopLabelTextFieldWithCopyIcon(gridPane, gridRow, 1, Res.get("payment.mobile"),
((SbpAccountPayload) paymentAccountPayload).getMobileNumber());
addCompactTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.bank.name"),
((SbpAccountPayload) paymentAccountPayload).getBankName());
return gridRow;
}
public SbpForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, SbpValidator sbpValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) {
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
this.SbpAccount = (SbpAccount) paymentAccount;
this.SbpValidator = sbpValidator;
}
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
InputTextField holderNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
Res.get("payment.account.owner.sbp"));
holderNameInputTextField.setValidator(inputValidator);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
SbpAccount.setHolderName(newValue.trim());
updateFromInputs();
});
InputTextField mobileNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
Res.get("payment.mobile"));
mobileNrInputTextField.setValidator(SbpValidator);
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
SbpAccount.setMobileNumber(newValue.trim());
updateFromInputs();
});
InputTextField bankNameInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
Res.get("payment.bank.name"));
bankNameInputTextField.setValidator(inputValidator);
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
SbpAccount.setBankName(newValue.trim());
updateFromInputs();
});
final TradeCurrency singleTradeCurrency = SbpAccount.getSingleTradeCurrency();
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
nameAndCode);
addLimitations(false);
addAccountNameTextFieldWithAutoFillToggleButton();
}
@Override
protected void autoFillNameTextField() {
setAccountNameWithString(SbpAccount.getMobileNumber());
}
@Override
public void addFormForEditAccount() {
gridRowFrom = gridRow;
addAccountNameTextFieldWithAutoFillToggleButton();
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
Res.get(SbpAccount.getPaymentMethod().getId()));
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner.sbp"),
SbpAccount.getHolderName());
TextField mobileNrField = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.mobile"),
SbpAccount.getMobileNumber()).second;
mobileNrField.setMouseTransparent(false);
TextField BankNameField = addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.name"),
SbpAccount.getBankName()).second;
final TradeCurrency singleTradeCurrency = SbpAccount.getSingleTradeCurrency();
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
nameAndCode);
addLimitations(true);
}
@Override
public void updateAllInputsValid() {
allInputsValid.set(isAccountNameValid()
&& SbpValidator.validate(SbpAccount.getMobileNumber()).isValid
&& inputValidator.validate(SbpAccount.getHolderName()).isValid
&& inputValidator.validate(SbpAccount.getBankName()).isValid
&& SbpAccount.getTradeCurrencies().size() > 0);
}
}

View File

@ -58,6 +58,7 @@ import bisq.desktop.components.paymentmethods.RevolutForm;
import bisq.desktop.components.paymentmethods.RtgsForm; import bisq.desktop.components.paymentmethods.RtgsForm;
import bisq.desktop.components.paymentmethods.SameBankForm; import bisq.desktop.components.paymentmethods.SameBankForm;
import bisq.desktop.components.paymentmethods.SatispayForm; import bisq.desktop.components.paymentmethods.SatispayForm;
import bisq.desktop.components.paymentmethods.SbpForm;
import bisq.desktop.components.paymentmethods.SepaForm; import bisq.desktop.components.paymentmethods.SepaForm;
import bisq.desktop.components.paymentmethods.SepaInstantForm; import bisq.desktop.components.paymentmethods.SepaInstantForm;
import bisq.desktop.components.paymentmethods.SpecificBankForm; import bisq.desktop.components.paymentmethods.SpecificBankForm;
@ -96,6 +97,7 @@ import bisq.desktop.util.validation.PerfectMoneyValidator;
import bisq.desktop.util.validation.PopmoneyValidator; import bisq.desktop.util.validation.PopmoneyValidator;
import bisq.desktop.util.validation.PromptPayValidator; import bisq.desktop.util.validation.PromptPayValidator;
import bisq.desktop.util.validation.RevolutValidator; import bisq.desktop.util.validation.RevolutValidator;
import bisq.desktop.util.validation.SbpValidator;
import bisq.desktop.util.validation.SwishValidator; import bisq.desktop.util.validation.SwishValidator;
import bisq.desktop.util.validation.TransferwiseValidator; import bisq.desktop.util.validation.TransferwiseValidator;
import bisq.desktop.util.validation.USPostalMoneyOrderValidator; import bisq.desktop.util.validation.USPostalMoneyOrderValidator;
@ -186,6 +188,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
private final PromptPayValidator promptPayValidator; private final PromptPayValidator promptPayValidator;
private final AdvancedCashValidator advancedCashValidator; private final AdvancedCashValidator advancedCashValidator;
private final TransferwiseValidator transferwiseValidator; private final TransferwiseValidator transferwiseValidator;
private final SbpValidator sbpValidator;
private final CoinFormatter formatter; private final CoinFormatter formatter;
private ComboBox<PaymentMethod> paymentMethodComboBox; private ComboBox<PaymentMethod> paymentMethodComboBox;
private PaymentMethodForm paymentMethodForm; private PaymentMethodForm paymentMethodForm;
@ -217,6 +220,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
PromptPayValidator promptPayValidator, PromptPayValidator promptPayValidator,
AdvancedCashValidator advancedCashValidator, AdvancedCashValidator advancedCashValidator,
TransferwiseValidator transferwiseValidator, TransferwiseValidator transferwiseValidator,
SbpValidator sbpValidator,
AccountAgeWitnessService accountAgeWitnessService, AccountAgeWitnessService accountAgeWitnessService,
KeyRing keyRing, KeyRing keyRing,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) {
@ -247,6 +251,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
this.promptPayValidator = promptPayValidator; this.promptPayValidator = promptPayValidator;
this.advancedCashValidator = advancedCashValidator; this.advancedCashValidator = advancedCashValidator;
this.transferwiseValidator = transferwiseValidator; this.transferwiseValidator = transferwiseValidator;
this.sbpValidator = sbpValidator;
this.formatter = formatter; this.formatter = formatter;
} }
@ -710,6 +715,8 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
return new DomesticWireTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter); return new DomesticWireTransferForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
case PaymentMethod.MERCADO_PAGO_ID: case PaymentMethod.MERCADO_PAGO_ID:
return new MercadoPagoForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter); return new MercadoPagoForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
case PaymentMethod.SBP_ID:
return new SbpForm(paymentAccount, accountAgeWitnessService, sbpValidator, inputValidator, root, gridRow, formatter);
default: default:
log.error("Not supported PaymentMethod: " + paymentMethod); log.error("Not supported PaymentMethod: " + paymentMethod);
return null; return null;

View File

@ -60,6 +60,7 @@ import bisq.desktop.components.paymentmethods.RevolutForm;
import bisq.desktop.components.paymentmethods.RtgsForm; import bisq.desktop.components.paymentmethods.RtgsForm;
import bisq.desktop.components.paymentmethods.SameBankForm; import bisq.desktop.components.paymentmethods.SameBankForm;
import bisq.desktop.components.paymentmethods.SatispayForm; import bisq.desktop.components.paymentmethods.SatispayForm;
import bisq.desktop.components.paymentmethods.SbpForm;
import bisq.desktop.components.paymentmethods.SepaForm; import bisq.desktop.components.paymentmethods.SepaForm;
import bisq.desktop.components.paymentmethods.SepaInstantForm; import bisq.desktop.components.paymentmethods.SepaInstantForm;
import bisq.desktop.components.paymentmethods.SpecificBankForm; import bisq.desktop.components.paymentmethods.SpecificBankForm;
@ -102,6 +103,7 @@ import bisq.core.payment.payload.HalCashAccountPayload;
import bisq.core.payment.payload.MoneyGramAccountPayload; import bisq.core.payment.payload.MoneyGramAccountPayload;
import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload;
import bisq.core.payment.payload.PaymentMethod; import bisq.core.payment.payload.PaymentMethod;
import bisq.core.payment.payload.SbpAccountPayload;
import bisq.core.payment.payload.SepaAccountPayload; import bisq.core.payment.payload.SepaAccountPayload;
import bisq.core.payment.payload.SepaInstantAccountPayload; import bisq.core.payment.payload.SepaInstantAccountPayload;
import bisq.core.payment.payload.SwiftAccountPayload; import bisq.core.payment.payload.SwiftAccountPayload;
@ -430,6 +432,9 @@ public class BuyerStep2View extends TradeStepView {
case PaymentMethod.MERCADO_PAGO_ID: case PaymentMethod.MERCADO_PAGO_ID:
gridRow = MercadoPagoForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload); gridRow = MercadoPagoForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break; break;
case PaymentMethod.SBP_ID:
gridRow = SbpForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
default: default:
log.error("Not supported PaymentMethod: " + paymentMethodId); log.error("Not supported PaymentMethod: " + paymentMethodId);
} }
@ -713,6 +718,8 @@ public class BuyerStep2View extends TradeStepView {
message += Res.get("portfolio.pending.step2_buyer.pay", amount) + message += Res.get("portfolio.pending.step2_buyer.pay", amount) +
refTextWarn + "\n\n" + refTextWarn + "\n\n" +
Res.get("portfolio.pending.step2_buyer.fees.swift"); Res.get("portfolio.pending.step2_buyer.fees.swift");
} else if (paymentAccountPayload instanceof SbpAccountPayload) {
message += Res.get("portfolio.pending.step2_buyer.sbp", amount);
} else { } else {
message += Res.get("portfolio.pending.step2_buyer.pay", amount) + message += Res.get("portfolio.pending.step2_buyer.pay", amount) +
refTextWarn + "\n\n" + refTextWarn + "\n\n" +

View File

@ -0,0 +1,38 @@
/*
* 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.util.validation;
public final class SbpValidator extends PhoneNumberValidator {
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
// Public no-arg constructor required by Guice injector.
// Superclass' isoCountryCode must be set before validation.
public SbpValidator() { super("RU"); }
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
@Override
public ValidationResult validate(String input) {
return super.validate(input);
}
}

View File

@ -1103,6 +1103,7 @@ message PaymentAccountPayload {
MoneseAccountPayload monese_account_payload = 38; MoneseAccountPayload monese_account_payload = 38;
VerseAccountPayload verse_account_payload = 39; VerseAccountPayload verse_account_payload = 39;
BsqSwapAccountPayload bsq_swap_account_payload = 40; BsqSwapAccountPayload bsq_swap_account_payload = 40;
SbpAccountPayload sbp_account_payload = 41;
} }
map<string, string> exclude_from_json_data = 15; map<string, string> exclude_from_json_data = 15;
} }
@ -1458,6 +1459,12 @@ message SwiftAccountPayload {
string intermediary_address = 16; string intermediary_address = 16;
} }
message SbpAccountPayload {
string holder_name = 1;
string mobile_number = 2;
string bank_name = 3;
}
message PersistableEnvelope { message PersistableEnvelope {
oneof message { oneof message {
SequenceNumberMap sequence_number_map = 1; SequenceNumberMap sequence_number_map = 1;