intent

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPaymentMetadata      = errors.New("no payment metdata")
	ErrInvalidPaymentMetadata = errors.New("invalid payment metadata")
)
View Source
var (
	ErrAlreadyFulfilled = errors.New("intent id is already fulfilled")
)

Functions

func LoadPaymentMetadata

func LoadPaymentMetadata(ctx context.Context, codeData codedata.Provider, intentID *commonpb.IntentId, dst proto.Message) (*codeintent.Record, error)

Types

type CustomAntispamGuard

type CustomAntispamGuard interface {
	AllowOpenAccounts(ctx context.Context, owner *codecommon.Account) (bool, string, error)

	AllowSendPayment(ctx context.Context, owner *codecommon.Account, isPublic bool) (bool, string, error)
}

func NewFlipchatAntispamGuard

func NewFlipchatAntispamGuard(accounts account.Store) CustomAntispamGuard

type CustomHandler

type CustomHandler interface {
	Validate(ctx context.Context, intentRecord *codeintent.Record, customMetadata proto.Message) (*ValidationResult, error)
}

todo: some way to register a handler to a proto URL

type FlipchatAntispamGuard

type FlipchatAntispamGuard struct {
	// contains filtered or unexported fields
}

func (*FlipchatAntispamGuard) AllowOpenAccounts

func (g *FlipchatAntispamGuard) AllowOpenAccounts(ctx context.Context, owner *codecommon.Account) (bool, string, error)

func (*FlipchatAntispamGuard) AllowSendPayment

func (g *FlipchatAntispamGuard) AllowSendPayment(_ context.Context, _ *codecommon.Account, isPublic bool) (bool, string, error)

type StatusCode

type StatusCode uint8
const (
	SUCCESS StatusCode = iota
	INVALID
	DENIED
)

type Store

type Store interface {
	IsFulfilled(ctx context.Context, id *commonpb.IntentId) (bool, error)

	MarkFulfilled(ctx context.Context, id *commonpb.IntentId) error
}

type ValidationResult

type ValidationResult struct {
	StatusCode       StatusCode
	ErrorDescription string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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