repository

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePaymentParams

type CreatePaymentParams struct {
	ExternalID        sql.NullString `json:"external_id"`
	DestinationWallet string         `json:"destination_wallet"`
	DestinationMint   string         `json:"destination_mint"`
	Amount            int64          `json:"amount"`
	Status            PaymentStatus  `json:"status"`
	Message           sql.NullString `json:"message"`
	ExpiresAt         sql.NullTime   `json:"expires_at"`
}

type CreateTransactionParams

type CreateTransactionParams struct {
	PaymentID          uuid.UUID         `json:"payment_id"`
	Reference          string            `json:"reference"`
	SourceWallet       string            `json:"source_wallet"`
	SourceMint         string            `json:"source_mint"`
	DestinationWallet  string            `json:"destination_wallet"`
	DestinationMint    string            `json:"destination_mint"`
	Amount             int64             `json:"amount"`
	DiscountAmount     int64             `json:"discount_amount"`
	TotalAmount        int64             `json:"total_amount"`
	AccruedBonusAmount int64             `json:"accrued_bonus_amount"`
	Message            sql.NullString    `json:"message"`
	Memo               sql.NullString    `json:"memo"`
	ApplyBonus         sql.NullBool      `json:"apply_bonus"`
	Status             TransactionStatus `json:"status"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteTokenParams

type DeleteTokenParams struct {
	TokenType  string `json:"token_type"`
	Credential string `json:"credential"`
}

type GetTokenParams

type GetTokenParams struct {
	TokenType      string    `json:"token_type"`
	Credential     string    `json:"credential"`
	AccessTokenID  uuid.UUID `json:"access_token_id"`
	RefreshTokenID uuid.UUID `json:"refresh_token_id"`
}

type GetTransactionByPaymentIDSourceWalletAndMintParams

type GetTransactionByPaymentIDSourceWalletAndMintParams struct {
	PaymentID    uuid.UUID `json:"payment_id"`
	SourceWallet string    `json:"source_wallet"`
	SourceMint   string    `json:"source_mint"`
}

type NullPaymentStatus

type NullPaymentStatus struct {
	PaymentStatus PaymentStatus
	Valid         bool // Valid is true if PaymentStatus is not NULL
}

func (*NullPaymentStatus) Scan

func (ns *NullPaymentStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullPaymentStatus) Value

func (ns NullPaymentStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullTransactionStatus

type NullTransactionStatus struct {
	TransactionStatus TransactionStatus
	Valid             bool // Valid is true if TransactionStatus is not NULL
}

func (*NullTransactionStatus) Scan

func (ns *NullTransactionStatus) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTransactionStatus) Value

func (ns NullTransactionStatus) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Payment

type Payment struct {
	ID                uuid.UUID      `json:"id"`
	ExternalID        sql.NullString `json:"external_id"`
	DestinationWallet string         `json:"destination_wallet"`
	DestinationMint   string         `json:"destination_mint"`
	Amount            int64          `json:"amount"`
	Status            PaymentStatus  `json:"status"`
	Message           sql.NullString `json:"message"`
	ExpiresAt         sql.NullTime   `json:"expires_at"`
	CreatedAt         time.Time      `json:"created_at"`
	UpdatedAt         sql.NullTime   `json:"updated_at"`
}

type PaymentStatus

type PaymentStatus string
const (
	PaymentStatusNew       PaymentStatus = "new"
	PaymentStatusPending   PaymentStatus = "pending"
	PaymentStatusCompleted PaymentStatus = "completed"
	PaymentStatusFailed    PaymentStatus = "failed"
	PaymentStatusCanceled  PaymentStatus = "canceled"
	PaymentStatusExpired   PaymentStatus = "expired"
)

func (*PaymentStatus) Scan

func (e *PaymentStatus) Scan(src interface{}) error

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreatePayment

func (q *Queries) CreatePayment(ctx context.Context, arg CreatePaymentParams) (Payment, error)

func (*Queries) CreateTransaction

func (q *Queries) CreateTransaction(ctx context.Context, arg CreateTransactionParams) (Transaction, error)

func (*Queries) DeleteExpiredTokens

func (q *Queries) DeleteExpiredTokens(ctx context.Context) error

func (*Queries) DeleteToken

func (q *Queries) DeleteToken(ctx context.Context, arg DeleteTokenParams) error

func (*Queries) DeleteTokensByCredential

func (q *Queries) DeleteTokensByCredential(ctx context.Context, credential string) error

func (*Queries) GetPayment

func (q *Queries) GetPayment(ctx context.Context, id uuid.UUID) (Payment, error)

func (*Queries) GetPaymentByExternalID

func (q *Queries) GetPaymentByExternalID(ctx context.Context, externalID string) (Payment, error)

func (*Queries) GetPendingTransactions

func (q *Queries) GetPendingTransactions(ctx context.Context) ([]Transaction, error)

func (*Queries) GetToken

func (q *Queries) GetToken(ctx context.Context, arg GetTokenParams) (Token, error)

func (*Queries) GetTransaction

func (q *Queries) GetTransaction(ctx context.Context, id uuid.UUID) (Transaction, error)

func (*Queries) GetTransactionByPaymentIDSourceWalletAndMint

func (q *Queries) GetTransactionByPaymentIDSourceWalletAndMint(ctx context.Context, arg GetTransactionByPaymentIDSourceWalletAndMintParams) (Transaction, error)

func (*Queries) GetTransactionByReference

func (q *Queries) GetTransactionByReference(ctx context.Context, reference string) (Transaction, error)

func (*Queries) GetTransactionsByPaymentID

func (q *Queries) GetTransactionsByPaymentID(ctx context.Context, paymentID uuid.UUID) ([]Transaction, error)

func (*Queries) MarkPaymentsExpired

func (q *Queries) MarkPaymentsExpired(ctx context.Context) error

func (*Queries) MarkTransactionsAsExpired

func (q *Queries) MarkTransactionsAsExpired(ctx context.Context) error

func (*Queries) StoreToken

func (q *Queries) StoreToken(ctx context.Context, arg StoreTokenParams) (Token, error)

func (*Queries) UpdatePaymentStatus

func (q *Queries) UpdatePaymentStatus(ctx context.Context, arg UpdatePaymentStatusParams) (Payment, error)

func (*Queries) UpdateTransactionByReference

func (q *Queries) UpdateTransactionByReference(ctx context.Context, arg UpdateTransactionByReferenceParams) (Transaction, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type StoreTokenParams

type StoreTokenParams struct {
	TokenType        string    `json:"token_type"`
	Credential       string    `json:"credential"`
	AccessTokenID    uuid.UUID `json:"access_token_id"`
	RefreshTokenID   uuid.UUID `json:"refresh_token_id"`
	AccessExpiresAt  time.Time `json:"access_expires_at"`
	RefreshExpiresAt time.Time `json:"refresh_expires_at"`
}

type Token

type Token struct {
	TokenType        string       `json:"token_type"`
	Credential       string       `json:"credential"`
	AccessTokenID    uuid.UUID    `json:"access_token_id"`
	RefreshTokenID   uuid.UUID    `json:"refresh_token_id"`
	AccessExpiresAt  time.Time    `json:"access_expires_at"`
	RefreshExpiresAt time.Time    `json:"refresh_expires_at"`
	UpdatedAt        sql.NullTime `json:"updated_at"`
	CreatedAt        time.Time    `json:"created_at"`
}

type Transaction

type Transaction struct {
	ID                 uuid.UUID         `json:"id"`
	PaymentID          uuid.UUID         `json:"payment_id"`
	Reference          string            `json:"reference"`
	SourceWallet       string            `json:"source_wallet"`
	SourceMint         string            `json:"source_mint"`
	DestinationWallet  string            `json:"destination_wallet"`
	DestinationMint    string            `json:"destination_mint"`
	Amount             int64             `json:"amount"`
	DiscountAmount     int64             `json:"discount_amount"`
	TotalAmount        int64             `json:"total_amount"`
	AccruedBonusAmount int64             `json:"accrued_bonus_amount"`
	Message            sql.NullString    `json:"message"`
	Memo               sql.NullString    `json:"memo"`
	ApplyBonus         sql.NullBool      `json:"apply_bonus"`
	TxSignature        sql.NullString    `json:"tx_signature"`
	Status             TransactionStatus `json:"status"`
	CreatedAt          time.Time         `json:"created_at"`
	UpdatedAt          sql.NullTime      `json:"updated_at"`
}

type TransactionStatus

type TransactionStatus string
const (
	TransactionStatusPending   TransactionStatus = "pending"
	TransactionStatusCompleted TransactionStatus = "completed"
	TransactionStatusFailed    TransactionStatus = "failed"
	TransactionStatusExpired   TransactionStatus = "expired"
)

func (*TransactionStatus) Scan

func (e *TransactionStatus) Scan(src interface{}) error

type UpdatePaymentStatusParams

type UpdatePaymentStatusParams struct {
	Status PaymentStatus `json:"status"`
	ID     uuid.UUID     `json:"id"`
}

type UpdateTransactionByReferenceParams

type UpdateTransactionByReferenceParams struct {
	TxSignature sql.NullString    `json:"tx_signature"`
	Status      TransactionStatus `json:"status"`
	Reference   string            `json:"reference"`
}

Jump to

Keyboard shortcuts

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