paymentrefusal

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package paymentrefusal recognises the narrow response shape that proves a key authenticated but its account cannot fund a request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Matches

func Matches(status int, body []byte) bool

Matches reports whether status and body describe an account that cannot pay. A bare 429 is pacing and stays false; only payment-bearing words or a known payment code turn that otherwise transient status into a terminal answer.

func ResetAt

func ResetAt(body []byte) string

ResetAt returns the vendor's reset value when a window refusal names one. It returns only the value after "reset at" so a surface can compose its own sentence without copying an entire error envelope onto the status line.

Types

type Kind

type Kind int

Kind is the meaning of a payment-shaped vendor response. The numeric code decides before prose because a plan-window message may also say that the account has insufficient balance for EXTRA usage.

const (
	Unknown Kind = iota
	Payment
	WindowExhausted
	NoPlan
	Pacing
)

func Classify

func Classify(status int, body []byte) Kind

Classify separates an empty wallet, an exhausted subscription window, a door the key cannot use, and ordinary pacing. A vendor code is the stronger fact and a body carrying one never falls through to ambiguous prose.

Jump to

Keyboard shortcuts

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