giftcard

package
v1.799.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2026 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Overview

Package giftcard is the HTTP surface for gift cards: base CRUD via rest plus money actions (redeem / balance / void). Every handler is tenant-scoped via middleware.GetOrganization(c) + org.Namespaced(c) — the same isolation the rest of the /v1 surface uses — so a caller only ever touches its own org's gift cards.

Money actions are idempotent (see models/giftcard.Redeem): a redeem carries a caller idempotency key (X-Idempotency-Key header or body.idempotencyKey) and re-submitting it debits once, never twice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Balance

func Balance(c *gin.Context)

Balance returns the projected spendable balance (initial − Σ redemptions).

func ListRedemptions

func ListRedemptions(c *gin.Context)

ListRedemptions returns the append-only debit ledger for a card.

func Redeem

func Redeem(c *gin.Context)

Redeem draws amountCents from the card. Idempotent on the idempotency key. Admin-only: redeeming moves money off a card, so it is gated INSIDE the handler (the route middleware no-ops on the IAM path — Red HIGH-4).

func Route

func Route(router router.Router, args ...gin.HandlerFunc)

func Void

func Void(c *gin.Context)

Void reverses a prior redemption (append-only compensating line). Idempotent. Admin-only (money move) — gated inside the handler like Redeem.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL