finish refund
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user