Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix bug where authorized amount should only exclude captured amount instead of charged amount

Unknowncafee3b25576
diff --git a/saleor/payment/models.py b/saleor/payment/models.py
index cb36b16c47..13c06b852e 100644
--- a/saleor/payment/models.py
+++ b/saleor/payment/models.py
@@ -112,7 +112,11 @@ class Payment(models.Model):
transaction.amount, self.currency or settings.DEFAULT_CURRENCY)
# The authorized amount should exclude the already captured amount
- money -= self.get_captured_amount()
+ for transaction in self.transactions.filter(
+ kind=TransactionKind.CAPTURE, is_success=True).all():
+ money -= Money(
+ transaction.amount, self.currency or settings.DEFAULT_CURRENCY)
+
return money
def get_captured_amount(self):