Documentation ¶
Index ¶
- Variables
- func MakeHTTPHandler(e Endpoints, log logger, authMdw middlewareFunc) http.Handler
- func NewError(err error) *httpencoder.ErrorResponse
- type Config
- type CreatePaymentRequest
- type CreatePaymentResponse
- type Endpoints
- type GeneratePaymentLinkRequest
- type GeneratePaymentLinkResponse
- type GeneratePaymentTransactionRequest
- type GeneratePaymentTransactionResponse
- type GetAppInfoResponse
- type GetExchangeRateRequest
- type GetExchangeRateResponse
- type GetPaymentResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRequest = errors.New("invalid_request") ErrInvalidParameter = errors.New("invalid_parameter") ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not_found") )
Predefined errors.
var ErrorCodes = map[error]int{ ErrInvalidRequest: http.StatusBadRequest, ErrInvalidParameter: http.StatusBadRequest, ErrForbidden: http.StatusForbidden, ErrNotFound: http.StatusNotFound, }
Error codes map
var ErrorMessages = map[error]string{ ErrInvalidRequest: "Invalid request payload", ErrInvalidParameter: "Some parameters are invalid", ErrForbidden: "Forbidden. You don't have permission to access this account", ErrNotFound: "Not found", }
Error messages
Functions ¶
func MakeHTTPHandler ¶
MakeHTTPHandler returns an http.Handler that can be used to serve the API.
Types ¶
type CreatePaymentRequest ¶
type CreatePaymentRequest struct { ExternalID string `json:"external_id,omitempty" validate:"min_len:1|max_len:50"` Amount uint64 `json:"amount,omitempty" validate:"required|gt:0"` Message string `json:"message,omitempty" validate:"min_len:2|max_len:100"` TTL int64 `json:"ttl,omitempty" validate:"min:0|max:86400"` }
CreatePaymentRequest is the request type for the CreatePayment method. For more information about the fields, see the struct definition in payment/payment.go.CreatePaymentParams
type CreatePaymentResponse ¶
CreatePaymentResponse is the response type for the CreatePayment method.
type Endpoints ¶
type Endpoints struct { GetAppInfo endpoint.Endpoint CreatePayment endpoint.Endpoint CancelPayment endpoint.Endpoint GetPayment endpoint.Endpoint GetPaymentByExternalID endpoint.Endpoint GeneratePaymentLink endpoint.Endpoint GeneratePaymentTransaction endpoint.Endpoint GetExchangeRate endpoint.Endpoint }
Endpoints is a collection of all the endpoints that comprise a server.
func MakeEndpoints ¶
MakeEndpoints returns an Endpoints struct where each field is an endpoint that comprises the server.
type GeneratePaymentLinkRequest ¶
type GeneratePaymentLinkRequest struct { PaymentID uuid.UUID `json:"-" validate:"-" label:"Payment ID"` Mint string `json:"mint,omitempty" validate:"-" label:"Selected Mint"` ApplyBonus bool `json:"apply_bonus,omitempty" validate:"bool" label:"Apply Bonus"` }
GeneratePaymentLinkRequest is the request type for the GeneratePaymentLink method.
type GeneratePaymentLinkResponse ¶
type GeneratePaymentLinkResponse struct {
Link string `json:"link"`
}
GeneratePaymentLinkResponse is the response type for the GeneratePaymentLink method.
type GeneratePaymentTransactionRequest ¶
type GeneratePaymentTransactionRequest struct { PaymentID string `json:"-" validate:"required|uuid" label:"Payment ID"` SourceWallet string `json:"account" validate:"required" label:"Account public key"` Mint string `json:"-" validate:"-"` ApplyBonus string `json:"-" validate:"bool"` }
GeneratePaymentTransactionRequest is the request type for the GeneratePaymentTransaction method.
type GeneratePaymentTransactionResponse ¶
type GeneratePaymentTransactionResponse struct { Transaction string `json:"transaction"` Message string `json:"message,omitempty"` }
GeneratePaymentTransactionResponse is the response type for the GeneratePaymentTransaction method.
type GetAppInfoResponse ¶
GetAppInfoResponse is the response type for the GetAppInfo method.
type GetExchangeRateRequest ¶
type GetExchangeRateRequest struct { InCurrency string `json:"in_currency" validate:"required" label:"In Currency"` OutCurrency string `json:"out_currency" validate:"required" label:"Out Currency"` Amount uint64 `json:"amount" validate:"required|gte:0" label:"Amount"` SwapMode string `json:"swap_mode" validate:"required|in:ExactIn,ExactOut" label:"Swap Mode"` }
GetExchangeRateRequest is the request type for the GetExchangeRate method.
type GetExchangeRateResponse ¶
GetExchangeRateResponse is the response type for the GetExchangeRate method.
type GetPaymentResponse ¶
type GetPaymentResponse struct { Payment *payments.Payment `json:"payment"` Transaction *payments.Transaction `json:"transaction,omitempty"` }
GetPaymentResponse is the response type for the GetPayment method.