Introduces RefundPublicView for public refund creation via email and invoice/order ID, returning refund info and a base64-encoded PDF slip. Adds RefundCreatePublicSerializer for validation and creation, implements PDF generation in Refund model, and provides a customer-facing HTML template for the return slip. Updates URLs to expose the new endpoint.
27 lines
900 B
Python
27 lines
900 B
Python
from django.urls import path, include
|
|
from rest_framework.routers import DefaultRouter
|
|
from .views import (
|
|
OrderViewSet,
|
|
ProductViewSet,
|
|
CategoryViewSet,
|
|
ProductImageViewSet,
|
|
DiscountCodeViewSet,
|
|
RefundViewSet,
|
|
RefundPublicView,
|
|
)
|
|
|
|
router = DefaultRouter()
|
|
router.register(r'orders', OrderViewSet)
|
|
router.register(r'products', ProductViewSet, basename='product')
|
|
router.register(r'categories', CategoryViewSet, basename='category')
|
|
router.register(r'product-images', ProductImageViewSet, basename='product-image')
|
|
router.register(r'discount-codes', DiscountCodeViewSet, basename='discount-code')
|
|
router.register(r'refunds', RefundViewSet, basename='refund')
|
|
|
|
urlpatterns = [
|
|
path('', include(router.urls)),
|
|
path('refunds/public/', RefundPublicView.as_view(), name='RefundPublicView'),
|
|
]
|
|
|
|
# NOTE: Other endpoints (categories/products/discounts) can be added later
|