api

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package paypack implements the payment.Client for the (https://payments.paypack.rw/paypack)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(uri string, tr http.RoundTripper) (*Client, error)

New creates a new payment.Client instance backed by the paypack.DriverPaypack

func NewDefault

func NewDefault() *Client

NewDefault returns a new paypack-payments connection for client using the` default "https://payments.paypack.rw/api" address.

func (*Client) Cashin

Cashin responsible to push refund from your phone to dashboard

func (*Client) Cashout

Cashout responsible to pull refund from dashboard to your phone

func (*Client) Checkout

func (c *Client) Checkout(ctx context.Context, agent, secret string) (*paypack.Checkout, error)

Checkout that will query checkout information of a given agent id

func (*Client) FindTx

func (c *Client) FindTx(ctx context.Context, ref string) (*paypack.Transaction, error)

FindTx responsible to query transaction information that is corresponding to given ref or return error

func (*Client) ListEvents

func (c *Client) ListEvents(ctx context.Context, options ...paypack.Option) (*paypack.EventList, error)

ListEvents implements the paypack list events with the given query slice parameters

func (*Client) ListTx

func (c *Client) ListTx(ctx context.Context, options ...paypack.Option) (*paypack.Transactions, error)

List handles List http api request for https://payments.paypack.rw/api/transactions/list with paramas eg:["kind=cashin",phone="078xxxx"]

func (*Client) Login

func (c *Client) Login(ctx context.Context, clientId, clietnSecret string) (*paypack.Token, error)

func (*Client) Profile

func (c *Client) Profile(ctx context.Context) (*paypack.Merchant, error)

Profile response to call payment /merchants/me endpoint

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context, token *paypack.Token) (*paypack.Token, error)

type Err

type Err struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

Error represents a PayPack error.

type EventResponse

type EventResponse struct {
	ID        string          `json:"event_id"`
	Kind      string          `json:"event_kind"`
	Data      json.RawMessage `json:"data"`
	CreatedAt string          `json:"created_at"`
}

type Transaction

type Transaction struct {
	Ref       string    `json:"ref"`
	Status    string    `json:"status"`
	Amount    float64   `json:"amount"`
	Fee       float64   `json:"fee"`
	Kind      string    `json:"kind"`
	Provider  string    `json:"provider"`
	Client    string    `json:"client"`
	Merchant  string    `json:"merchant"`
	Timestamp time.Time `json:"timestamp"`
}

Transaction represent transaction data details information from payments-paypack

Jump to

Keyboard shortcuts

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