Add carrier field to Refund model and update Stripe views
Introduces a OneToOneField for carrier in the Refund model to support future integration and refactoring. Adds and updates TODO comments for email template usage, error handling in Stripe webhooks, and clarifies logic placement in Stripe models.
This commit is contained in:
2
backend/thirdparty/stripe/models.py
vendored
2
backend/thirdparty/stripe/models.py
vendored
@@ -3,8 +3,6 @@ from django.apps import apps
|
||||
|
||||
# Create your models here.
|
||||
|
||||
#TODO: logika a interakce bude na stripu (třeba aktualizovaní objednávky na zaplacenou apod.)
|
||||
|
||||
from .client import StripeClient
|
||||
|
||||
class StripeModel(models.Model):
|
||||
|
||||
3
backend/thirdparty/stripe/views.py
vendored
3
backend/thirdparty/stripe/views.py
vendored
@@ -26,12 +26,13 @@ class StripeWebhook(APIView):
|
||||
sig_header = request.META['HTTP_STRIPE_SIGNATURE']
|
||||
|
||||
try:
|
||||
#build stripe event
|
||||
#build stripe event (api call)
|
||||
event = stripe.Webhook.construct_event(
|
||||
payload, sig_header, os.getenv("STRIPE_WEBHOOK_SECRET")
|
||||
)
|
||||
|
||||
except ValueError as e:
|
||||
# TODO: doupravit error handling, dodělat v modelu možnost pro uložení chyby a status ERROR
|
||||
logger.error(f"Invalid payload: {e}")
|
||||
return HttpResponse(status=400)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user