test

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const RandomAddress = "random"

Variables

This section is empty.

Functions

func WithBalanceFromCurrency

func WithBalanceFromCurrency(currency money.CryptoCurrency, valueRaw string, isTest bool) func(params *repository.CreateBalanceParams)

Types

type Clear

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

func (*Clear) Table

func (c *Clear) Table(t *testing.T, table string)

func (*Clear) Wallets

func (c *Clear) Wallets(t *testing.T)

type Client

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

func (*Client) DELETE

func (c *Client) DELETE() *Request

func (*Client) GET

func (c *Client) GET() *Request

func (*Client) POST

func (c *Client) POST() *Request

func (*Client) PUT

func (c *Client) PUT() *Request

type Database

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

func NewDB

func NewDB(ctx context.Context) *Database

func (*Database) Conn

func (db *Database) Conn() *pg.Connection

func (*Database) Context

func (db *Database) Context() context.Context

func (*Database) Name

func (db *Database) Name() string

func (*Database) TearDown

func (db *Database) TearDown()

type IntegrationTest

type IntegrationTest struct {
	*Client

	Context context.Context

	Database   *Database
	Repository *repository.Queries
	Storage    *repository.Store

	Services *Services
	KMS      *KMS

	Providers *Providers

	Logger *zerolog.Logger

	Fakes *fakes.Fakes
	Clear *Clear
	Must  *Must
	// contains filtered or unexported fields
}

func NewIntegrationTest

func NewIntegrationTest(t *testing.T) *IntegrationTest

func (*IntegrationTest) AssertTableRows

func (i *IntegrationTest) AssertTableRows(t *testing.T, table string, expected int64)

func (*IntegrationTest) AssertTableRowsByMerchant

func (i *IntegrationTest) AssertTableRowsByMerchant(t *testing.T, merchantID int64, table string, expected int64)

func (*IntegrationTest) CreatePayment

func (i *IntegrationTest) CreatePayment(
	t *testing.T,
	merchantID int64,
	fiat money.FiatCurrency,
	amount float64,
	opts ...payment.CreateOpt,
) *payment.Payment

func (*IntegrationTest) CreateRawPayment

func (i *IntegrationTest) CreateRawPayment(
	t *testing.T,
	merchantID int64,
	opts ...func(*repository.CreatePaymentParams),
) repository.Payment

func (*IntegrationTest) CreateSamplePayment

func (i *IntegrationTest) CreateSamplePayment(t *testing.T, merchantID int64, opts ...payment.CreateOpt) *payment.Payment

func (*IntegrationTest) SetupCreateBSCTransaction added in v0.3.0

func (i *IntegrationTest) SetupCreateBSCTransaction(
	walletID uuid.UUID,
	input kmsmodel.CreateBSCTransactionRequest,
	rawTx string,
)

func (*IntegrationTest) SetupCreateBSCTransactionWildcard added in v0.3.0

func (i *IntegrationTest) SetupCreateBSCTransactionWildcard(rawTx string)

func (*IntegrationTest) SetupCreateEthereumTransaction

func (i *IntegrationTest) SetupCreateEthereumTransaction(
	walletID uuid.UUID,
	input kmsmodel.CreateEthereumTransactionRequest,
	rawTx string,
)

func (*IntegrationTest) SetupCreateEthereumTransactionWildcard

func (i *IntegrationTest) SetupCreateEthereumTransactionWildcard(rawTx string)

func (*IntegrationTest) SetupCreateMaticTransaction

func (i *IntegrationTest) SetupCreateMaticTransaction(
	walletID uuid.UUID,
	input kmsmodel.CreateMaticTransactionRequest,
	rawTx string,
)

func (*IntegrationTest) SetupCreateMaticTransactionWildcard

func (i *IntegrationTest) SetupCreateMaticTransactionWildcard(rawTx string)

func (*IntegrationTest) SetupCreateTronTransaction

func (i *IntegrationTest) SetupCreateTronTransaction(
	walletID uuid.UUID,
	input kmsmodel.CreateTronTransactionRequest,
	rawTx string,
)

func (*IntegrationTest) SetupCreateTronTransactionWildcard

func (i *IntegrationTest) SetupCreateTronTransactionWildcard(rawTx string)

func (*IntegrationTest) SetupCreateWallet

func (i *IntegrationTest) SetupCreateWallet(blockchain, address, pubKey string)

func (*IntegrationTest) SetupCreateWalletWithSubscription

func (i *IntegrationTest) SetupCreateWalletWithSubscription(blockchain, address, pubKey string)

func (*IntegrationTest) TearDown

func (i *IntegrationTest) TearDown()

type KMS

type KMS struct {
	Bolt       *bbolt.DB
	Repository *wallet.Repository
	Service    *wallet.Service
}

type Marshable

type Marshable interface {
	MarshalBinary() ([]byte, error)
}

type Must

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

func (*Must) CreateBalance

func (m *Must) CreateBalance(
	t *testing.T,
	entityType wallet.EntityType,
	entityID int64,
	opts ...func(params *repository.CreateBalanceParams),
) *wallet.Balance

func (*Must) CreateCustomer

func (m *Must) CreateCustomer(t *testing.T, merchantID int64, email string) *payment.Customer

func (*Must) CreateMerchant

func (m *Must) CreateMerchant(t *testing.T, userID int64) (*merchant.Merchant, string)

CreateMerchant creates merchant with api token.

func (*Must) CreateMerchantToken

func (m *Must) CreateMerchantToken(t *testing.T, mt *merchant.Merchant) string

func (*Must) CreateSampleUser

func (m *Must) CreateSampleUser(t *testing.T) (*user.User, string)

func (*Must) CreateTransaction

func (m *Must) CreateTransaction(t *testing.T, merchantID int64, customize ...func(params *transaction.CreateTransaction)) *transaction.Transaction

func (*Must) CreateUser

func (m *Must) CreateUser(t *testing.T, params auth.GoogleUser) (*user.User, string)

CreateUser creates user with api token.

func (*Must) CreateUserToken

func (m *Must) CreateUserToken(t *testing.T, u *user.User) string

func (*Must) CreateUserViaEmail

func (m *Must) CreateUserViaEmail(t *testing.T, email, pass string) (*user.User, string)

CreateUserViaEmail creates user with email auth and api token.

func (*Must) CreateWallet

func (m *Must) CreateWallet(t *testing.T, blockchain, address, pubKey string, walletType wallet.Type) *wallet.Wallet

func (*Must) CreateWalletWithBalance

func (m *Must) CreateWalletWithBalance(
	t *testing.T,
	blockchain string,
	walletType wallet.Type,
	balanceOpts ...func(params *repository.CreateBalanceParams),
) (*wallet.Wallet, *wallet.Balance)

func (*Must) GetBlockchainCoin added in v0.3.0

func (m *Must) GetBlockchainCoin(t *testing.T, chain money.Blockchain) money.CryptoCurrency

func (*Must) GetCurrency

func (m *Must) GetCurrency(t *testing.T, ticker string) money.CryptoCurrency

type Providers

type Providers struct {
	KMS          *kmsmock.ClientService
	Tatum        *tatumprovider.Provider
	TatumMock    *TatumMock
	Trongrid     *trongrid.Provider
	TrongridMock *fakes.Trongrid
}

type Request

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

func (*Request) Body

func (r *Request) Body(body []byte) *Request

func (*Request) Do

func (r *Request) Do() *Response

func (*Request) JSON

func (r *Request) JSON(m Marshable) *Request

func (*Request) Param

func (r *Request) Param(key, value string) *Request

func (*Request) Path

func (r *Request) Path(path string) *Request

func (*Request) Query

func (r *Request) Query(key, value string) *Request

func (*Request) WithCSRF

func (r *Request) WithCSRF() *Request

func (*Request) WithToken

func (r *Request) WithToken(token string) *Request

type Response

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

func (*Response) Bytes

func (r *Response) Bytes() []byte

func (*Response) Headers

func (r *Response) Headers() http.Header

func (*Response) JSON

func (r *Response) JSON(output any) error

func (*Response) StatusCode

func (r *Response) StatusCode() int

func (*Response) String

func (r *Response) String() string

type Services

type Services struct {
	AuthTokenManager *auth.TokenAuthManager
	Merchants        *merchant.Service
	Users            *user.Service
	Wallet           *wallet.Service
	Payment          *payment.Service
	Transaction      *transaction.Service
	Blockchain       *blockchain.Service
	Processing       *processing.Service
	Registry         *registry.Service
	Locker           *lock.Locker
	JobLogger        *log.JobLogger
}

type TatumMock

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

func NewTatum

func NewTatum(registrySvc *registry.Service, logger *zerolog.Logger) (*tatumprovider.Provider, *TatumMock)

func (*TatumMock) Clear

func (m *TatumMock) Clear()

func (*TatumMock) SetupRates

func (m *TatumMock) SetupRates(from string, to money.FiatCurrency, rate float64)

func (*TatumMock) SetupSubscription

func (m *TatumMock) SetupSubscription(chain, address string, isTest bool, resultID string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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