diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 374c894..2f1b3bb 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -769,6 +769,8 @@ paths: application/json: schema: $ref: '#/components/schemas/Invoice' + 400: + description: Invalid request. 404: description: Sender or recipient not found. 418: diff --git a/src/mastodon_api/subscriptions/views.rs b/src/mastodon_api/subscriptions/views.rs index bbb9654..2090942 100644 --- a/src/mastodon_api/subscriptions/views.rs +++ b/src/mastodon_api/subscriptions/views.rs @@ -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?;