Skip to content

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

Fix bug where captured amount less than 0 should also be taken as fully refunded

Unknown5b2900754bfb
diff --git a/saleor/payment/utils.py b/saleor/payment/utils.py
index b4387775be..ee75a01e05 100644
--- a/saleor/payment/utils.py
+++ b/saleor/payment/utils.py
@@ -292,7 +292,7 @@ def _gateway_postprocess(transaction, payment):
elif transaction_kind == TransactionKind.REFUND:
changed_fields = ['captured_amount']
payment.captured_amount -= transaction.amount
- if not payment.captured_amount:
+ if payment.captured_amount <= 0:
payment.charge_status = ChargeStatus.FULLY_REFUNDED
payment.is_active = False
changed_fields += ['charge_status', 'is_active']