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
This commit is contained in:
Russell Ballestrini 2025-09-24 16:28:30 -04:00
parent 3de1abdd7b
commit f25404eac3

View file

@ -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()
)