mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
support deleting payment accounts #1136
Some checks are pending
Some checks are pending
This commit is contained in:
parent
0a469db8f6
commit
9c359b5e29
4 changed files with 38 additions and 0 deletions
|
@ -496,6 +496,10 @@ public class CoreApi {
|
||||||
tradeInstant);
|
tradeInstant);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deletePaymentAccount(String paymentAccountId) {
|
||||||
|
paymentAccountsService.deletePaymentAccount(paymentAccountId);
|
||||||
|
}
|
||||||
|
|
||||||
public List<PaymentMethod> getCryptoCurrencyPaymentMethods() {
|
public List<PaymentMethod> getCryptoCurrencyPaymentMethods() {
|
||||||
return paymentAccountsService.getCryptoCurrencyPaymentMethods();
|
return paymentAccountsService.getCryptoCurrencyPaymentMethods();
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,16 @@ class CorePaymentAccountsService {
|
||||||
return cryptoCurrencyAccount;
|
return cryptoCurrencyAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized void deletePaymentAccount(String paymentAccountId) {
|
||||||
|
accountService.checkAccountOpen();
|
||||||
|
PaymentAccount paymentAccount = getPaymentAccount(paymentAccountId);
|
||||||
|
if (paymentAccount == null) throw new IllegalArgumentException(format("Payment account with id %s not found", paymentAccountId));
|
||||||
|
user.removePaymentAccount(paymentAccount);
|
||||||
|
log.info("Deleted payment account with id {} and payment method {}.",
|
||||||
|
paymentAccount.getId(),
|
||||||
|
paymentAccount.getPaymentAccountPayload().getPaymentMethodId());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO Support all alt coin payment methods supported by UI.
|
// TODO Support all alt coin payment methods supported by UI.
|
||||||
// The getCryptoCurrencyPaymentMethods method below will be
|
// The getCryptoCurrencyPaymentMethods method below will be
|
||||||
// callable from the CLI when more are supported.
|
// callable from the CLI when more are supported.
|
||||||
|
|
|
@ -34,6 +34,8 @@ import haveno.proto.grpc.CreateCryptoCurrencyPaymentAccountReply;
|
||||||
import haveno.proto.grpc.CreateCryptoCurrencyPaymentAccountRequest;
|
import haveno.proto.grpc.CreateCryptoCurrencyPaymentAccountRequest;
|
||||||
import haveno.proto.grpc.CreatePaymentAccountReply;
|
import haveno.proto.grpc.CreatePaymentAccountReply;
|
||||||
import haveno.proto.grpc.CreatePaymentAccountRequest;
|
import haveno.proto.grpc.CreatePaymentAccountRequest;
|
||||||
|
import haveno.proto.grpc.DeletePaymentAccountReply;
|
||||||
|
import haveno.proto.grpc.DeletePaymentAccountRequest;
|
||||||
import haveno.proto.grpc.GetCryptoCurrencyPaymentMethodsReply;
|
import haveno.proto.grpc.GetCryptoCurrencyPaymentMethodsReply;
|
||||||
import haveno.proto.grpc.GetCryptoCurrencyPaymentMethodsRequest;
|
import haveno.proto.grpc.GetCryptoCurrencyPaymentMethodsRequest;
|
||||||
import haveno.proto.grpc.GetPaymentAccountFormReply;
|
import haveno.proto.grpc.GetPaymentAccountFormReply;
|
||||||
|
@ -160,6 +162,19 @@ class GrpcPaymentAccountsService extends PaymentAccountsImplBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deletePaymentAccount(DeletePaymentAccountRequest req,
|
||||||
|
StreamObserver<DeletePaymentAccountReply> responseObserver) {
|
||||||
|
try {
|
||||||
|
coreApi.deletePaymentAccount(req.getPaymentAccountId());
|
||||||
|
var reply = DeletePaymentAccountReply.newBuilder().build();
|
||||||
|
responseObserver.onNext(reply);
|
||||||
|
responseObserver.onCompleted();
|
||||||
|
} catch (Throwable cause) {
|
||||||
|
exceptionHandler.handleException(log, cause, responseObserver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getCryptoCurrencyPaymentMethods(GetCryptoCurrencyPaymentMethodsRequest req,
|
public void getCryptoCurrencyPaymentMethods(GetCryptoCurrencyPaymentMethodsRequest req,
|
||||||
StreamObserver<GetCryptoCurrencyPaymentMethodsReply> responseObserver) {
|
StreamObserver<GetCryptoCurrencyPaymentMethodsReply> responseObserver) {
|
||||||
|
|
|
@ -586,6 +586,8 @@ service PaymentAccounts {
|
||||||
}
|
}
|
||||||
rpc CreateCryptoCurrencyPaymentAccount (CreateCryptoCurrencyPaymentAccountRequest) returns (CreateCryptoCurrencyPaymentAccountReply) {
|
rpc CreateCryptoCurrencyPaymentAccount (CreateCryptoCurrencyPaymentAccountRequest) returns (CreateCryptoCurrencyPaymentAccountReply) {
|
||||||
}
|
}
|
||||||
|
rpc DeletePaymentAccount (DeletePaymentAccountRequest) returns (DeletePaymentAccountReply) {
|
||||||
|
}
|
||||||
rpc GetCryptoCurrencyPaymentMethods (GetCryptoCurrencyPaymentMethodsRequest) returns (GetCryptoCurrencyPaymentMethodsReply) {
|
rpc GetCryptoCurrencyPaymentMethods (GetCryptoCurrencyPaymentMethodsRequest) returns (GetCryptoCurrencyPaymentMethodsReply) {
|
||||||
}
|
}
|
||||||
rpc ValidateFormField (ValidateFormFieldRequest) returns (ValidateFormFieldReply) {
|
rpc ValidateFormField (ValidateFormFieldRequest) returns (ValidateFormFieldReply) {
|
||||||
|
@ -639,6 +641,13 @@ message CreateCryptoCurrencyPaymentAccountRequest {
|
||||||
bool trade_instant = 4;
|
bool trade_instant = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message DeletePaymentAccountRequest {
|
||||||
|
string payment_account_id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DeletePaymentAccountReply {
|
||||||
|
}
|
||||||
|
|
||||||
message CreateCryptoCurrencyPaymentAccountReply {
|
message CreateCryptoCurrencyPaymentAccountReply {
|
||||||
PaymentAccount payment_account = 1;
|
PaymentAccount payment_account = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue