merchant

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyWebhookURL      = "webhook.url"
	PropertySignatureSecret = "webhook.secret"
	PropertyPaymentMethods  = "payment.methods"
)

Variables

View Source
var (
	ErrMerchantNotFound     = errors.New("merchant not found")
	ErrAddressNotFound      = errors.New("merchant address not found")
	ErrAddressAlreadyExists = errors.New("merchant address already exists")
	ErrAddressReserved      = errors.New("this address is reserved")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	ID             int64
	UUID           uuid.UUID
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Name           string
	MerchantID     int64
	Blockchain     wallet.Blockchain
	BlockchainName string
	Address        string
}

type BlockchainService

type BlockchainService interface {
	blockchain.Resolver
	blockchain.Convertor
}

type CreateMerchantAddressParams

type CreateMerchantAddressParams struct {
	Name       string
	Blockchain wallet.Blockchain
	Address    string
}

type Merchant

type Merchant struct {
	ID        int64
	UUID      uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
	Name      string
	Website   string
	CreatorID int64
	// contains filtered or unexported fields
}

func (*Merchant) Settings

func (m *Merchant) Settings() Settings

type Property

type Property string

type Service

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

func New

func New(
	repo *repository.Queries,
	blockchainService BlockchainService,
	logger *zerolog.Logger,
) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, creatorID int64, name, website string, settings Settings) (*Merchant, error)

func (*Service) CreateMerchantAddress

func (s *Service) CreateMerchantAddress(ctx context.Context, merchantID int64, params CreateMerchantAddressParams) (*Address, error)

func (*Service) DeleteByUUID

func (s *Service) DeleteByUUID(ctx context.Context, merchantUUID uuid.UUID) error

func (*Service) DeleteMerchantAddress

func (s *Service) DeleteMerchantAddress(ctx context.Context, merchantID int64, id uuid.UUID) error

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id int64, withTrashed bool) (*Merchant, error)

func (*Service) GetByUUIDAndCreatorID

func (s *Service) GetByUUIDAndCreatorID(
	ctx context.Context,
	merchantUUID uuid.UUID,
	creatorID int64,
	withTrashed bool,
) (*Merchant, error)

func (*Service) GetMerchantAddressByID

func (s *Service) GetMerchantAddressByID(ctx context.Context, merchantID, id int64) (*Address, error)

func (*Service) GetMerchantAddressByUUID

func (s *Service) GetMerchantAddressByUUID(ctx context.Context, merchantID int64, id uuid.UUID) (*Address, error)

GetMerchantAddressByUUID returns saved merchant address for withdrawals.

func (*Service) ListByCreatorID

func (s *Service) ListByCreatorID(ctx context.Context, creatorID int64) ([]*Merchant, error)

func (*Service) ListMerchantAddresses

func (s *Service) ListMerchantAddresses(ctx context.Context, merchantID int64) ([]*Address, error)

func (*Service) ListSupportedCurrencies

func (s *Service) ListSupportedCurrencies(_ context.Context, merchant *Merchant) ([]SupportedCurrency, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id int64, name, website string) (*Merchant, error)

func (*Service) UpdateMerchantAddress

func (s *Service) UpdateMerchantAddress(ctx context.Context, merchantID int64, id uuid.UUID, name string) (*Address, error)

func (*Service) UpdateSupportedMethods

func (s *Service) UpdateSupportedMethods(ctx context.Context, merchant *Merchant, tickers []string) error

func (*Service) UpsertSettings

func (s *Service) UpsertSettings(ctx context.Context, merchant *Merchant, settings Settings) error

type Settings

type Settings map[Property]string

func (Settings) PaymentMethods

func (s Settings) PaymentMethods() []string

func (Settings) WebhookSignatureSecret

func (s Settings) WebhookSignatureSecret() string

func (Settings) WebhookURL

func (s Settings) WebhookURL() string

type SupportedCurrency

type SupportedCurrency struct {
	Currency money.CryptoCurrency
	Enabled  bool
}

Jump to

Keyboard shortcuts

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