Help us shape the future of Go! Take the 2026 Go Developer Survey

commercecheck

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package commercecheck checks public offer snapshots without contacting Stripe. Only the documented optional commerce convention has typed fields; extensions remain ordinary data and are never normalized or removed from the template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catalog

func Catalog() []diagnostic.RuleInfo

func ConfigSecrets

func ConfigSecrets(values map[string]any, sources jsonsrc.Sources) []diagnostic.Diagnostic

func Decimal

func Decimal(raw any) (*big.Rat, bool)

Decimal accepts finite JSON numbers or machine-readable decimal text, without binary floating-point arithmetic or unbounded scientific-notation expansion.

func Identity

func Identity(raw string) string

Identity deliberately excludes only query/fragment; it never equates distinct paths, removes trailing slashes or strips the test-mode prefix.

func Secret

func Secret(value string) bool

Secret recognizes only concrete Stripe secret-key shapes, never publishable keys, public object IDs, customer field names or generic words like token.

func SecretOffset

func SecretOffset(raw []byte) int

func StripeHost

func StripeHost(host string) bool

Types

type Facts

type Facts struct {
	Offers          []Offer
	Consumed        []string // operational fields checked here, rather than rendered
	CheckedCheckout map[string]bool
}

func Check

func Check(data map[string]any, urls map[string]string, sources jsonsrc.Sources) (Facts, []diagnostic.Diagnostic)

Check does not require commerce on knowledge/tools/free pages. Unknown fields within the convention remain available for arbitrary authoring and extensions.

type Money

type Money struct {
	AmountMinor int64
	Currency    string
	Scale       int64 // zero means precision is not known locally
}

func (Money) Matches

func (m Money) Matches(value any) (bool, bool)

type Offer

type Offer struct {
	Path, SKU, Name, CheckoutURLKey, CheckoutURL string
	Price                                        *Money
	Location                                     diagnostic.Location
}

type URLFinding

type URLFinding struct {
	Error         bool
	Message, Hint string
}

func Checkout

func Checkout(raw string) []URLFinding

Checkout never fetches a destination or assumes that a custom domain is not Stripe. Parameter checks apply to confirmed standard Payment Link hosts only.

Jump to

Keyboard shortcuts

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