From 53bbf85fe13bbfddf170257ca0e095f96950d5a8 Mon Sep 17 00:00:00 2001 From: Angel Beltran Date: Fri, 27 Feb 2026 17:24:27 -0700 Subject: [PATCH] stubbed simulations page content: refund --- server/api/accounts/router.go | 27 ++++++ .../{acctID.int64}/simulations.html.tmpl | 94 ++++++++++++++++++- 2 files changed, 119 insertions(+), 2 deletions(-) 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" }}

Simulate Sale @@ -72,7 +73,7 @@
{{ component "button" - "Text" "Simulate Sale" + "Text" "Submit" "Background" true "Class" "m-0" }} @@ -81,7 +82,7 @@ {{ end }} {{ component "accordion" - "Name" "sale" + "Name" "simulate" "Open" true "Class" ` mx-[1em] @@ -90,3 +91,92 @@ "#accordion-header" "sale-accordion-header" "#accordion-body" "sale-accordion-body" }} + + +{{/* REFUNDS */}} +{{- define "refund-accordion-header" }} +

+ Simulate Refund +

+{{ end }} + +{{- define "refund-accordion-body" }} + {{ $acctID := .Identity.Account.AccountID }} +
+ + + + + + +
+ {{ component "button" + "Text" "Submit" + "Background" true + "Class" "m-0" + }} +
+
+{{ end }} + +{{ component "accordion" + "Name" "simulate" + "Class" ` + mx-[1em] + mb-[1em] + ` + "#accordion-header" "refund-accordion-header" + "#accordion-body" "refund-accordion-body" +}}