get sale
This commit is contained in:
@ -536,3 +536,14 @@ func (app *application) AllSubscriptions(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
app.writeJSON(w, http.StatusOK, allSubscriptions)
|
||||
}
|
||||
|
||||
func (app *application) GetSale(w http.ResponseWriter, r *http.Request) {
|
||||
id := chi.URLParam(r, "id")
|
||||
orderID, _ := strconv.Atoi(id)
|
||||
|
||||
order, err := app.DB.GetOrderByID(orderID)
|
||||
if err != nil {
|
||||
app.badRequest(w, r, err)
|
||||
}
|
||||
app.writeJSON(w, http.StatusOK, order)
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ func (app *application) routes() http.Handler {
|
||||
mux.Post("/virtual-terminal-succeeded", app.VirtualTerminalPaymentSucceeded)
|
||||
mux.Post("/all-sales", app.AllSales)
|
||||
mux.Post("/all-subscriptions", app.AllSubscriptions)
|
||||
mux.Post("/get-sale/{id}", app.GetSale)
|
||||
})
|
||||
mux.Post("/api/forgot-password", app.SendPasswordResetEmail)
|
||||
mux.Post("/api/reset-password", app.ResetPassword)
|
||||
|
Reference in New Issue
Block a user