serializer erreur if no stripe api key
This commit is contained in:
parent
88d471ac87
commit
8f93a549c1
|
|
@ -10,9 +10,11 @@ import stripe
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
from rest_framework import serializers
|
||||||
|
|
||||||
from AuthBillet.models import HumanUser
|
from AuthBillet.models import HumanUser
|
||||||
from BaseBillet.models import Configuration, LigneArticle, Paiement_stripe, Reservation
|
from BaseBillet.models import Configuration, LigneArticle, Paiement_stripe, Reservation
|
||||||
|
from django.utils.translation import gettext, gettext_lazy as _
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
@ -95,7 +97,10 @@ class creation_paiement_stripe():
|
||||||
else:
|
else:
|
||||||
stripe.api_key = self.configuration.stripe_api_key
|
stripe.api_key = self.configuration.stripe_api_key
|
||||||
|
|
||||||
|
if stripe.api_key :
|
||||||
return stripe.api_key
|
return stripe.api_key
|
||||||
|
else :
|
||||||
|
raise serializers.ValidationError(_(f"No Stripe Api Key in configuration"))
|
||||||
|
|
||||||
def _line_items(self):
|
def _line_items(self):
|
||||||
line_items = []
|
line_items = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue