refactor(shipping): check ALREADY_LABELED before INVALID_STATE in PurchaseLabel
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
This commit is contained in:
@@ -185,15 +185,16 @@ func (h *OrderHandler) PurchaseLabel(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if order.Status != models.OrderStatusPaid {
|
||||
utils.RespondError(w, http.StatusConflict, "INVALID_STATE", "only paid orders can be labeled", nil)
|
||||
return
|
||||
}
|
||||
if order.TrackingNumber != "" {
|
||||
utils.RespondError(w, http.StatusConflict, "ALREADY_LABELED", "order already has a tracking number", nil)
|
||||
return
|
||||
}
|
||||
|
||||
if order.Status != models.OrderStatusPaid {
|
||||
utils.RespondError(w, http.StatusConflict, "INVALID_STATE", "only paid orders can be labeled", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Coffee.Ounces in ounces; shippo client expects kg
|
||||
const ozToKg = 0.0283495
|
||||
const defaultOunces = 12.0
|
||||
|
||||
Reference in New Issue
Block a user