Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Format with black
Jakub Draganeke862db738ceb
diff --git a/saleor/account/migrations/0028_user_private_meta.py b/saleor/account/migrations/0028_user_private_meta.pyindex f1629efbe8..8f447ed348 100644--- a/saleor/account/migrations/0028_user_private_meta.py+++ b/saleor/account/migrations/0028_user_private_meta.py@@ -7,14 +7,16 @@ import saleor.core.utils.json_serializerclass Migration(migrations.Migration):- dependencies = [- ('account', '0027_customerevent'),- ]+ dependencies = [("account", "0027_customerevent")]operations = [migrations.AddField(- model_name='user',- name='private_meta',- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, encoder=saleor.core.utils.json_serializer.CustomJsonEncoder),- ),+ model_name="user",+ name="private_meta",+ field=django.contrib.postgres.fields.jsonb.JSONField(+ blank=True,+ default=dict,+ encoder=saleor.core.utils.json_serializer.CustomJsonEncoder,+ ),+ )]diff --git a/saleor/graphql/payment/schema.py b/saleor/graphql/payment/schema.pyindex 4ab41d57b7..a342ffbe71 100644--- a/saleor/graphql/payment/schema.py+++ b/saleor/graphql/payment/schema.py@@ -12,7 +12,8 @@ class PaymentQueries(graphene.ObjectType):payment = graphene.Field(Payment, id=graphene.Argument(graphene.ID))payments = PrefetchingConnectionField(Payment, description="List of payments")payment_stored_sources = graphene.List(- PaymentSource, description="List of stored payment sources")+ PaymentSource, description="List of stored payment sources"+ )payment_client_token = graphene.Field(graphene.String, args={"gateway": PaymentGatewayEnum()})diff --git a/saleor/graphql/payment/types.py b/saleor/graphql/payment/types.pyindex ea68732903..7fb4d2bb36 100644--- a/saleor/graphql/payment/types.py+++ b/saleor/graphql/payment/types.py@@ -55,7 +55,8 @@ class CreditCard(graphene.ObjectType):class PaymentSource(graphene.ObjectType):gateway = graphene.String(description="Payment gateway name", required=True)credit_card = graphene.Field(- CreditCard, description="Stored credit card details if available")+ CreditCard, description="Stored credit card details if available"+ )class Payment(CountableDjangoObjectType):diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.pyindex e22cd96fa4..0fb46bc176 100644--- a/saleor/payment/gateways/braintree/__init__.py+++ b/saleor/payment/gateways/braintree/__init__.py@@ -32,7 +32,7 @@ ERROR_CODES_WHITELIST = {def get_customer_data(payment_information: PaymentData) -> Dict:- ''' Provides customer info, use only for new customer creation '''+ """ Provides customer info, use only for new customer creation """billing = payment_information.billingreturn {"order_id": payment_information.order_id,@@ -153,7 +153,9 @@ def authorize()-def transaction_for_new_customer(payment_information: PaymentData, config: GatewayConfig):+def transaction_for_new_customer(+ payment_information: PaymentData, config: GatewayConfig+):gateway = get_braintree_gateway(**config.connection_params)return gateway.transaction.sale({@@ -168,7 +170,9 @@ def transaction_for_new_customer(payment_information: PaymentData, config: Gatew)-def transaction_for_existing_customer(payment_information: PaymentData, config: GatewayConfig):+def transaction_for_existing_customer(+ payment_information: PaymentData, config: GatewayConfig+):gateway = get_braintree_gateway(**config.connection_params)return gateway.transaction.sale({diff --git a/saleor/payment/interface.py b/saleor/payment/interface.pyindex 9dd3278cbf..f13299d582 100644--- a/saleor/payment/interface.py+++ b/saleor/payment/interface.py@@ -39,6 +39,7 @@ class PaymentData:"""Dataclass for storing all payment information. Used for unifying therepresentation of data. It is required to communicate between Saleor andgiven payment gateway."""+amount: Decimalcurrency: strbilling: Optional[AddressData]@@ -54,6 +55,7 @@ class PaymentData:@dataclassclass TokenConfig:"""Dataclass for payment gateway token fetching customization"""+customer_id: Optional[str] = None