Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Fix codeclimate issue
Unknownffe797e610aa
diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.pyindex 83af086998..1ecd73a5d3 100644--- a/saleor/graphql/payment/types.py+++ b/saleor/graphql/payment/types.py@@ -1,7 +1,7 @@import graphene+import graphene_django_optimizer as gql_optimizerfrom django_countries.fields import Countryfrom graphene import relay-import graphene_django_optimizer as gql_optimizerfrom ...payment import GATEWAYS_ENUM, ChargeStatus, modelsfrom ..account.types import Addressdiff --git a/saleor/payment/models.py b/saleor/payment/models.pyindex 013dae1116..d8b81a36c3 100644--- a/saleor/payment/models.py+++ b/saleor/payment/models.py@@ -108,12 +108,13 @@ class Payment(models.Model):and txn.is_success for txn in transactions]):return money- # Calculate authorized amount from all succeeded auth transactions- for txn in transactions:- # Bypass non-authorized transactions- if not (txn.kind == TransactionKind.AUTH and txn.is_success):- continue+ # Filter the succeeded auth transactions+ authorized_txns = [+ txn for txn in transactions+ if txn.kind == TransactionKind.AUTH and txn.is_success]+ # Calculate authorized amount from all succeeded auth transactions+ for txn in authorized_txns:money += Money(txn.amount, self.currency or settings.DEFAULT_CURRENCY)