Services can now have variable pricing where: - Final price is determined after service completion - A deposit (fixed amount or percentage) is collected at booking - Customer's saved payment method is charged for remaining balance Changes: - Add variable_pricing, deposit_amount, deposit_percent fields to Service model - Add service FK and final_price fields to Event model - Add AWAITING_PAYMENT status to Event - Add SetFinalPriceView endpoint to charge customer's saved card - Add EventPricingInfoView endpoint for pricing details - Update Services page with variable pricing toggle and deposit config - Show "From $X" and deposit info in customer preview 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
95 lines
4.3 KiB
Python
95 lines
4.3 KiB
Python
"""
|
|
Payments App URLs
|
|
"""
|
|
from django.urls import path
|
|
from .views import (
|
|
# Config status
|
|
PaymentConfigStatusView,
|
|
# Subscription plans & add-ons
|
|
SubscriptionPlansView,
|
|
CreateCheckoutSessionView,
|
|
SubscriptionsView,
|
|
CancelSubscriptionView,
|
|
ReactivateSubscriptionView,
|
|
# API Keys (Free Tier)
|
|
ApiKeysView,
|
|
ApiKeysValidateView,
|
|
ApiKeysRevalidateView,
|
|
ApiKeysDeleteView,
|
|
# Connect (Paid Tiers)
|
|
ConnectStatusView,
|
|
ConnectOnboardView,
|
|
ConnectRefreshLinkView,
|
|
ConnectAccountSessionView,
|
|
ConnectRefreshStatusView,
|
|
# Transactions
|
|
TransactionListView,
|
|
TransactionSummaryView,
|
|
StripeChargesView,
|
|
StripePayoutsView,
|
|
StripeBalanceView,
|
|
TransactionExportView,
|
|
# Payment operations
|
|
CreatePaymentIntentView,
|
|
TerminalConnectionTokenView,
|
|
RefundPaymentView,
|
|
# Customer billing
|
|
CustomerBillingView,
|
|
CustomerPaymentMethodsView,
|
|
CustomerSetupIntentView,
|
|
CustomerPaymentMethodDeleteView,
|
|
CustomerPaymentMethodDefaultView,
|
|
# Variable pricing / final charge
|
|
SetFinalPriceView,
|
|
EventPricingInfoView,
|
|
)
|
|
|
|
urlpatterns = [
|
|
# Payment configuration status
|
|
path('config/status/', PaymentConfigStatusView.as_view(), name='payment-config-status'),
|
|
|
|
# Subscription plans & add-ons
|
|
path('plans/', SubscriptionPlansView.as_view(), name='subscription-plans'),
|
|
path('checkout/', CreateCheckoutSessionView.as_view(), name='create-checkout'),
|
|
path('subscriptions/', SubscriptionsView.as_view(), name='subscriptions'),
|
|
path('subscriptions/cancel/', CancelSubscriptionView.as_view(), name='cancel-subscription'),
|
|
path('subscriptions/reactivate/', ReactivateSubscriptionView.as_view(), name='reactivate-subscription'),
|
|
|
|
# API Keys endpoints (free tier)
|
|
path('api-keys/', ApiKeysView.as_view(), name='api-keys'),
|
|
path('api-keys/validate/', ApiKeysValidateView.as_view(), name='api-keys-validate'),
|
|
path('api-keys/revalidate/', ApiKeysRevalidateView.as_view(), name='api-keys-revalidate'),
|
|
path('api-keys/delete/', ApiKeysDeleteView.as_view(), name='api-keys-delete'),
|
|
|
|
# Connect endpoints (paid tiers)
|
|
path('connect/status/', ConnectStatusView.as_view(), name='connect-status'),
|
|
path('connect/onboard/', ConnectOnboardView.as_view(), name='connect-onboard'),
|
|
path('connect/refresh-link/', ConnectRefreshLinkView.as_view(), name='connect-refresh-link'),
|
|
path('connect/account-session/', ConnectAccountSessionView.as_view(), name='connect-account-session'),
|
|
path('connect/refresh-status/', ConnectRefreshStatusView.as_view(), name='connect-refresh-status'),
|
|
|
|
# Transaction endpoints
|
|
path('transactions/', TransactionListView.as_view(), name='transaction-list'),
|
|
path('transactions/summary/', TransactionSummaryView.as_view(), name='transaction-summary'),
|
|
path('transactions/charges/', StripeChargesView.as_view(), name='stripe-charges'),
|
|
path('transactions/payouts/', StripePayoutsView.as_view(), name='stripe-payouts'),
|
|
path('transactions/balance/', StripeBalanceView.as_view(), name='stripe-balance'),
|
|
path('transactions/export/', TransactionExportView.as_view(), name='transaction-export'),
|
|
|
|
# Payment operations (existing)
|
|
path('payment-intents/', CreatePaymentIntentView.as_view(), name='create-payment-intent'),
|
|
path('terminal/connection-token/', TerminalConnectionTokenView.as_view(), name='terminal-connection-token'),
|
|
path('refunds/', RefundPaymentView.as_view(), name='create-refund'),
|
|
|
|
# Customer billing endpoints
|
|
path('customer/billing/', CustomerBillingView.as_view(), name='customer-billing'),
|
|
path('customer/payment-methods/', CustomerPaymentMethodsView.as_view(), name='customer-payment-methods'),
|
|
path('customer/setup-intent/', CustomerSetupIntentView.as_view(), name='customer-setup-intent'),
|
|
path('customer/payment-methods/<str:payment_method_id>/', CustomerPaymentMethodDeleteView.as_view(), name='customer-payment-method-delete'),
|
|
path('customer/payment-methods/<str:payment_method_id>/default/', CustomerPaymentMethodDefaultView.as_view(), name='customer-payment-method-default'),
|
|
|
|
# Variable pricing / final charge endpoints
|
|
path('events/<int:event_id>/final-price/', SetFinalPriceView.as_view(), name='set-final-price'),
|
|
path('events/<int:event_id>/pricing/', EventPricingInfoView.as_view(), name='event-pricing-info'),
|
|
]
|