georate

package
v1.46.21 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoRate

type GeoRate struct {
	Country string `json:"country"`
	State   string `json:"state"`

	// Only take a city OR postal code, not both
	City string `json:"city"`
	// Comma separates postal codes
	PostalCodes string         `json:"postalCode"`
	Above       currency.Cents `json:"above"`
	Below       currency.Cents `json:"below"`

	// Support both percent and currency
	// Use store's currency in implementation
	Percent float64        `json:"percent"`
	Cost    currency.Cents `json:"cost"`
}

func Match

func Match(grs []GeoRate, ctr, st, ct, pc string, c currency.Cents) (*GeoRate, int, int)

Match across an array of georates, return result with highest match level, return first result if there is a tie

func New

func New(ctr, st, ct, pcs string, ab, bl currency.Cents, pt float64, cst currency.Cents) GeoRate

Create and validate that a GeoRate's requirements are valid and exist

func (GeoRate) Match

func (g GeoRate) Match(ctr, st, ct, pc string, c currency.Cents) (bool, int)

Match GeoRate with country, state, city/postal code. Report if there's a match and the level of match. If false, also return level of any partial match

Jump to

Keyboard shortcuts

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