From f25404eac35677352dc3b57873cd27fb2e5653f6 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Wed, 24 Sep 2025 16:28:30 -0400 Subject: [PATCH] Filter crypto payment history by shop - Add shop_id filtering to crypto_quotes_history view - Only show payments for the current shop context - Maintains user privacy by filtering cross-shop payments --- make_post_sell/views/crypto.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/make_post_sell/views/crypto.py b/make_post_sell/views/crypto.py index 81039b6..768b4f7 100644 --- a/make_post_sell/views/crypto.py +++ b/make_post_sell/views/crypto.py @@ -796,11 +796,14 @@ def crypto_cancel(request): def crypto_quotes_history(request): """Show user's crypto payment history (all attempts, successful and failed).""" - # Get all crypto payments for this user, ordered by newest first + # Get crypto payments for this user on this shop, ordered by newest first crypto_payments = ( request.dbsession.query(CryptoPayment) .join(CryptoPayment.invoice) - .filter(Invoice.user_id == request.user.id) + .filter( + Invoice.user_id == request.user.id, + Invoice.shop_id == request.shop.id if request.shop else None, + ) .order_by(CryptoPayment.created_timestamp.desc()) .all() )