finish refund

This commit is contained in:
2024-08-22 14:33:36 +02:00
parent 7635a9826f
commit 059638f3a7
6 changed files with 89 additions and 35 deletions

View File

@ -570,6 +570,17 @@ func (app *application) RefundCharge(w http.ResponseWriter, r *http.Request) {
return
}
// update status in DB
err = app.DB.UpdateOrderStatus(chargeToRefund.ID, 2)
if err != nil {
app.badRequest(
w,
r,
errors.New("the charge was refunded, but the database could not be updated"),
)
return
}
var resp jsonResponse
resp.OK = true
resp.Message = "Charge refunded"