Prevent creation of invoices where sender is the same as the recipient
This commit is contained in:
parent
86fe717a77
commit
714b872a5d
2 changed files with 5 additions and 0 deletions
|
@ -769,6 +769,8 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Invoice'
|
||||
400:
|
||||
description: Invalid request.
|
||||
404:
|
||||
description: Sender or recipient not found.
|
||||
418:
|
||||
|
|
|
@ -177,6 +177,9 @@ async fn create_invoice_view(
|
|||
.ok_or(HttpError::NotSupported)?
|
||||
.monero_config()
|
||||
.ok_or(HttpError::NotSupported)?;
|
||||
if invoice_data.sender_id == invoice_data.recipient_id {
|
||||
return Err(ValidationError("sender must be different from recipient").into());
|
||||
};
|
||||
let db_client = &**get_database_client(&db_pool).await?;
|
||||
let sender = get_profile_by_id(db_client, &invoice_data.sender_id).await?;
|
||||
let recipient = get_user_by_id(db_client, &invoice_data.recipient_id).await?;
|
||||
|
|
Loading…
Reference in a new issue