mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
28 lines
617 B
Go
28 lines
617 B
Go
package transaction
|
|
|
|
import (
|
|
"github.com/zap-proto/zip"
|
|
|
|
"github.com/hanzoai/commerce/log"
|
|
"github.com/hanzoai/commerce/middleware"
|
|
"github.com/hanzoai/commerce/models/transaction/util"
|
|
"github.com/hanzoai/commerce/util/json/http"
|
|
)
|
|
|
|
func List(c *zip.Ctx) error {
|
|
id := c.Param("id")
|
|
kind := c.Param("kind")
|
|
|
|
org := middleware.GetOrganization(c)
|
|
ctx := org.Namespaced(c.Context())
|
|
|
|
res, err := util.GetTransactions(ctx, id, kind, !org.Live)
|
|
|
|
if err != nil {
|
|
log.Error("transaction/%v/%v error: '%v'", id, kind, err, c)
|
|
return http.Fail(c, 400, err.Error(), err)
|
|
}
|
|
|
|
return http.Render(c, 200, res)
|
|
}
|