diff --git a/server/api/accounts/router.go b/server/api/accounts/router.go index 4c41a8b..25f92e9 100644 --- a/server/api/accounts/router.go +++ b/server/api/accounts/router.go @@ -81,6 +81,7 @@ func Routes( simulations := r.Group("/:acctID/simulations") simulations.POST("/sale", response.Handler(as.postNewSale)) + simulations.POST("/refund", response.Handler(as.postNewRefund)) } // POST / @@ -765,6 +766,32 @@ func (s *accountSubrouter) postNewSale(c *gin.Context) (response.Response, error return response.StatusCreated(), nil } +// POST /:acctID/simulations/refund +func (s *accountSubrouter) postNewRefund(c *gin.Context) (response.Response, error) { + acctID := auth.GetIdentity(c).Account.AccountID + + var ( + shopID string + listingID string + count int + ) + + if err := param.Form("shop-id", param.Text(&shopID)). + Form("listing-id", param.Text(&listingID)). + Form("count", param.Int(&count)). + Unmarshal(c); err != nil { + return nil, err + } + + s.log.Debugf("refund posted:") + s.log.Debugf(" account: %d", acctID) + s.log.Debugf(" shop: %s", shopID) + s.log.Debugf(" listing: %s", listingID) + s.log.Debugf(" count: %d", count) + + return response.StatusCreated(), nil +} + func lowerSnakeCase(s accounts.Platform) string { return strings.ToLower(strings.Join(strings.Split(string(s), " "), "_")) } diff --git a/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl b/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl index 811bb13..99686b0 100644 --- a/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl +++ b/templates/pages/accounts/{acctID.int64}/simulations.html.tmpl @@ -3,6 +3,7 @@ +{{/* SALES */}} {{- define "sale-accordion-header" }}