Skip to content

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

Refactor payment_error

Aleksander Spyra3e746efe4423
diff --git a/saleor/payment/gateways/braintree/forms.py b/saleor/payment/gateways/braintree/forms.py
index 55bc036f10..6e3e07674b 100644
--- a/saleor/payment/gateways/braintree/forms.py
+++ b/saleor/payment/gateways/braintree/forms.py
@@ -2,6 +2,7 @@ from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import pgettext_lazy
+from ....graphql.core.utils.error_codes import PaymentErrorCode
from ...interface import PaymentData
@@ -32,7 +33,7 @@ class BraintreePaymentForm(forms.Form):
"payment error",
"Unable to process transaction. Please try again in a moment",
)
- raise ValidationError(msg, code="payment_error")
+ raise ValidationError(msg, code=PaymentErrorCode.PAYMENT_ERROR)
return cleaned_data
def get_payment_token(self):