57 lines
2.5 KiB
Go
57 lines
2.5 KiB
Go
package constants
|
|
|
|
// What a client delivers, and what that implies operationally.
|
|
//
|
|
// ─── One vocabulary, not two ───────────────────────────────────────────────
|
|
//
|
|
// These eight values already existed as `validCategories` in
|
|
// controllers/doormilePricingController.go and as the comment on
|
|
// models.DoormilePricing.Category. Tenants now carry one too, so the set is
|
|
// promoted here rather than copied: a second list would drift, and a tenant
|
|
// whose category is not a pricing category cannot be priced.
|
|
var DeliveryCategories = map[string]bool{
|
|
"General": true,
|
|
"Documents": true,
|
|
"Electronics": true,
|
|
"Clothing": true,
|
|
"Fragile": true,
|
|
"Medical": true,
|
|
"Automotive": true,
|
|
"Food": true,
|
|
}
|
|
|
|
// DeliveryCategoryList is the same set, ordered, for anything that renders a
|
|
// choice. General first because it is the safe default; Food last because it
|
|
// is the one that turns a capability off.
|
|
var DeliveryCategoryList = []string{
|
|
"General", "Documents", "Electronics", "Clothing",
|
|
"Fragile", "Medical", "Automotive", "Food",
|
|
}
|
|
|
|
// CategoryDefault is what a client with no category recorded is treated as.
|
|
// Every tenant onboarded before this field existed has an empty string, and
|
|
// they must keep behaving exactly as they did — which means reverse logistics
|
|
// stays available to them.
|
|
const CategoryDefault = "General"
|
|
|
|
// ReverseLogisticsAllowed reports whether a return journey makes sense for
|
|
// what this client ships.
|
|
//
|
|
// Food is the exception: a meal that comes back is waste, not inventory. There
|
|
// is nothing to restock, nothing to refund against a returned item, and a
|
|
// rider carrying it to a hub is carrying rubbish. Offering RTO there is not a
|
|
// harmless extra button — it invites an operator to start a return journey
|
|
// that can only end in disposal, and it puts a return charge on a client's
|
|
// invoice for a parcel nobody can resell.
|
|
//
|
|
// Everything else can come back: clothing is the canonical case (wrong size),
|
|
// and electronics, documents and automotive parts all have a real return path.
|
|
//
|
|
// An UNKNOWN or empty category allows returns. That is deliberate: this field
|
|
// is new, every existing tenant has no value for it, and a default of "off"
|
|
// would silently withdraw a working capability from every client already using
|
|
// it. New information must not change old behaviour.
|
|
func ReverseLogisticsAllowed(category string) bool {
|
|
return category != "Food"
|
|
}
|