Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Return zero money as authorized amount once payment is captured
Unknown9b8ba84e1326
diff --git a/saleor/payment/models.py b/saleor/payment/models.pyindex c72d5c6eda..9fc126a3dc 100644--- a/saleor/payment/models.py+++ b/saleor/payment/models.py@@ -99,6 +99,12 @@ class Payment(models.Model):def get_authorized_amount(self):money = zero_money()+ # There is no authorized amount anymore when capture is succeeded+ # since capture can only be made once, even it is a partial capture+ if self.transactions.filter(+ kind=TransactionKind.CAPTURE, is_success=True).exists():+ return money+# Calculate authorized amount from all succeeded auth transactionsfor transaction in self.transactions.filter(kind=TransactionKind.AUTH, is_success=True).all():