Initial commit - production deployment

This commit is contained in:
2026-01-21 17:17:16 +01:00
commit c23d00dd92
2289 changed files with 638440 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
"""
Exceptions package for the bakery platform
"""
# Import all exceptions for easy access
from .payment_exceptions import *
from .auth_exceptions import *
from .registration_exceptions import *

View File

@@ -0,0 +1,43 @@
"""
Authentication-related exceptions for the auth system
"""
class AuthServiceError(Exception):
"""Base exception for authentication service errors"""
pass
class UserCreationError(Exception):
"""Exception for user creation failures"""
pass
class RegistrationError(Exception):
"""Exception for registration failures"""
pass
class PaymentOrchestrationError(Exception):
"""Exception for payment orchestration failures"""
pass
class LoginError(Exception):
"""Exception for login failures"""
pass
class TokenError(Exception):
"""Exception for token-related errors"""
pass
class PermissionError(Exception):
"""Exception for permission-related errors"""
pass
class UserNotFoundError(Exception):
"""Exception for user not found errors"""
pass
class EmailVerificationError(Exception):
"""Exception for email verification failures"""
pass
class PasswordResetError(Exception):
"""Exception for password reset failures"""
pass

View File

@@ -0,0 +1,80 @@
"""
Payment-related exceptions for the atomic payment architecture
"""
class PaymentException(Exception):
"""Base class for payment-related exceptions"""
pass
class PaymentVerificationRequired(PaymentException):
"""Exception raised when payment verification is required before proceeding"""
def __init__(self, message: str = "Payment verification required", setup_intent_id: str = None, client_secret: str = None):
self.message = message
self.setup_intent_id = setup_intent_id
self.client_secret = client_secret
super().__init__(message)
class ThreeDSAuthenticationRequired(PaymentException):
"""Exception raised when 3DS authentication is required"""
def __init__(self, setup_intent_id: str, client_secret: str, action_type: str, **kwargs):
self.setup_intent_id = setup_intent_id
self.client_secret = client_secret
self.action_type = action_type
self.extra_data = kwargs
message = f"3DS authentication required (action: {action_type})"
super().__init__(message)
class PaymentMethodInvalid(PaymentException):
"""Exception raised when payment method is invalid"""
def __init__(self, message: str = "Payment method is invalid"):
super().__init__(message)
class PaymentFailed(PaymentException):
"""Exception raised when payment fails"""
def __init__(self, message: str = "Payment failed"):
super().__init__(message)
class SubscriptionCreationFailed(PaymentException):
"""Exception raised when subscription creation fails"""
def __init__(self, message: str = "Subscription creation failed"):
super().__init__(message)
class PaymentProviderError(PaymentException):
"""Exception raised when there's an error with the payment provider"""
def __init__(self, message: str = "Payment provider error"):
super().__init__(message)
class PaymentVerificationError(PaymentException):
"""Exception raised when payment verification fails"""
def __init__(self, message: str = "Payment verification failed"):
super().__init__(message)
class SetupIntentError(PaymentException):
"""Exception raised when SetupIntent operations fail"""
def __init__(self, message: str = "SetupIntent operation failed"):
super().__init__(message)
class SubscriptionUpdateFailed(PaymentException):
"""Exception raised when subscription update fails"""
def __init__(self, message: str = "Subscription update failed"):
super().__init__(message)
class PaymentServiceError(PaymentException):
"""General payment service error"""
def __init__(self, message: str = "Payment service error"):
super().__init__(message)
class PaymentMethodError(PaymentException):
"""Exception raised when payment method operations fail"""
def __init__(self, message: str = "Payment method operation failed"):
super().__init__(message)
class CustomerUpdateFailed(PaymentException):
"""Exception raised when customer update operations fail"""
def __init__(self, message: str = "Customer update failed"):
super().__init__(message)

View File

@@ -0,0 +1,55 @@
"""
Registration-related exceptions for the atomic registration architecture
"""
class RegistrationException(Exception):
"""Base class for registration-related exceptions"""
pass
class RegistrationPaymentFailed(RegistrationException):
"""Exception raised when registration payment fails"""
def __init__(self, message: str = "Registration payment failed"):
super().__init__(message)
class RegistrationValidationFailed(RegistrationException):
"""Exception raised when registration validation fails"""
def __init__(self, message: str = "Registration validation failed", errors: dict = None):
self.errors = errors or {}
super().__init__(message)
class UserCreationFailed(RegistrationException):
"""Exception raised when user creation fails"""
def __init__(self, message: str = "User creation failed"):
super().__init__(message)
class TenantCreationFailed(RegistrationException):
"""Exception raised when tenant creation fails"""
def __init__(self, message: str = "Tenant creation failed"):
super().__init__(message)
class RegistrationFlowInterrupted(RegistrationException):
"""Exception raised when registration flow is interrupted"""
def __init__(self, message: str = "Registration flow interrupted"):
super().__init__(message)
class EmailAlreadyRegistered(RegistrationException):
"""Exception raised when email is already registered"""
def __init__(self, message: str = "Email already registered"):
super().__init__(message)
class RegistrationStateInvalid(RegistrationException):
"""Exception raised when registration state is invalid"""
def __init__(self, message: str = "Registration state is invalid"):
super().__init__(message)
class RegistrationStateError(RegistrationException):
"""Exception raised when registration state operations fail"""
def __init__(self, message: str = "Registration state error"):
super().__init__(message)
class InvalidStateTransitionError(RegistrationException):
"""Exception raised when an invalid state transition is attempted"""
def __init__(self, message: str = "Invalid state transition"):
super().__init__(message)

View File

@@ -0,0 +1,22 @@
"""
Subscription-related exceptions
"""
class SubscriptionException(Exception):
"""Base class for subscription-related exceptions"""
pass
class SubscriptionNotFound(SubscriptionException):
"""Exception raised when subscription is not found"""
def __init__(self, message: str = "Subscription not found"):
super().__init__(message)
class SubscriptionAlreadyExists(SubscriptionException):
"""Exception raised when subscription already exists"""
def __init__(self, message: str = "Subscription already exists"):
super().__init__(message)
class SubscriptionUpdateFailed(SubscriptionException):
"""Exception raised when subscription update fails"""
def __init__(self, message: str = "Subscription update failed"):
super().__init__(message)