Files
monica_site/site/messaging/urls.py
T
westfarn 045e956011
Deploy Beta / unit-tests (push) Successful in 24s
Deploy Beta / docker (push) Successful in 30s
Deploy Beta / deploy-beta (push) Successful in 7m22s
Add PCM carrier-route postcard pick-and-send (#16)
## Summary
Closes #15.
Mirrors westfarn/web_django_template#11.

- Compose can target the postcard mailing list **or** find and select one or two USPS carrier routes by ZIP (optional radius).
- Estimated cost is shown per route and for the selection (PCM design pricing, else `PCM_POSTCARD_PRICE_*` fallback).
- Selected routes order through PCM `POST /order/postcard/with-list-count` — occupant addresses are not imported into Contacts.
- Not official EDDM postage; PCM FirstClass/Standard purchased occupant lists on carrier routes.

## Test plan
- [ ] Campaign compose: mailing-list audience still quotes list size × per-piece cost.
- [ ] Switch to USPS carrier routes, search ZIP 60540 (mocked or live PCM), pick 1–2 routes, confirm household count + estimated cost.
- [ ] Saving without a selection is rejected; saving with a quote creates one contact-less Message and shows the route panel on the report.
- [ ] Send places `/order/postcard/with-list-count` (not per-recipient `/order/postcard`).
- [ ] `uv run python manage.py test messaging.tests.CarrierRoutePostcardTests messaging.tests.PostcardDesignPickTests`

Reviewed-on: #16
2026-09-21 13:29:20 -07:00

67 lines
1.9 KiB
Python

from django.urls import path
from messaging import views
app_name = "messaging"
urlpatterns = [
path("campaigns/", views.campaign_list, name="campaign_list"),
path(
"campaigns/postcard-quote/",
views.postcard_quote,
name="postcard_quote",
),
path(
"campaigns/short-link/",
views.campaign_short_link,
name="campaign_short_link",
),
path("campaigns/<uuid:pk>/", views.campaign_detail, name="campaign_detail"),
path(
"campaigns/<uuid:pk>/status.json",
views.campaign_status_json,
name="campaign_status_json",
),
path("campaigns/<uuid:pk>/send/", views.campaign_send, name="campaign_send"),
path(
"campaigns/<uuid:pk>/test-send/",
views.campaign_test_send,
name="campaign_test_send",
),
path(
"campaigns/<uuid:pk>/messages/<uuid:message_id>/remove/",
views.campaign_message_remove,
name="campaign_message_remove",
),
path(
"campaigns/upload-image/",
views.campaign_image_upload,
name="campaign_image_upload",
),
path(
"files/<uuid:pk>/",
views.stored_file,
name="stored_file",
),
path("postcard/", views.postcard_designer, name="postcard_designer"),
path(
"postcard/create/",
views.postcard_design_create,
name="postcard_design_create",
),
path(
"postcard/save/",
views.postcard_design_save,
name="postcard_design_save",
),
path("webhooks/smtp2go/", views.smtp2go_webhook, name="smtp2go_webhook"),
# Legacy aliases — same unified SMTP2GO handler.
path("webhooks/sms/", views.sms_webhook, name="sms_webhook"),
path("webhooks/email/", views.email_webhook, name="email_webhook"),
path(
"webhooks/postcard/",
views.postcard_webhook,
name="postcard_webhook",
),
]