client

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultHTTPTimeout defaultHTTPTimeout is the default timeout on the http Client
	DefaultHTTPTimeout = 60 * time.Second

	// base URL for all Paystack API requests
	BaseURL = "https://api.paystack.co"
)

Variables

This section is empty.

Functions

func MustGetTestKey

func MustGetTestKey() string

func PaginateURL

func PaginateURL(path string, count, offset int) string

PaginateURL INTERNALS

Types

type Client

type Client struct {
	Client *http.Client // HTTP Client used to communicate with the API.
	// the API Key used to authenticate all Paystack API requests
	Key            string
	BaseURL        *url.URL
	LoggingEnabled bool
}

Client manages communication with the Paystack API

func (*Client) Call

func (c *Client) Call(ctx context.Context, method, path string, body, v interface{}) error

Call actually does the HTTP request to Paystack API

func (*Client) GetSessionTimeout

func (c *Client) GetSessionTimeout(ctx context.Context) (response.Response, error)

GetSessionTimeout fetches payment session timeout

func (*Client) ResolveCardBIN

func (c *Client) ResolveCardBIN(ctx context.Context, bin int) (response.Response, error)

ResolveCardBIN docs https://developers.paystack.co/v1.0/reference#resolve-card-bin

func (*Client) UpdateSessionTimeout

func (c *Client) UpdateSessionTimeout(ctx context.Context, timeout int) (response.Response, error)

UpdateSessionTimeout updates payment session timeout

type DefaultPaystackService

type DefaultPaystackService struct {
	Client *Client
}

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Logger interface for custom loggers

type Metadata

type Metadata map[string]interface{}

Metadata is an key-value pairs added to Paystack API requests

type Service

type Service interface {
	Call(ctx context.Context, method, path string, body, v interface{}) error
	ResolveCardBIN(ctx context.Context, bin int) (response.Response, error)
	CheckBalance(ctx context.Context) (response.Response, error)
	GetSessionTimeout(ctx context.Context) (response.Response, error)
	UpdateSessionTimeout(ctx context.Context, timeout int) (response.Response, error)
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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