payout

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(data *CreateParams) (*xendit.Payout, *xendit.Error)

Create creates new payout

Example
xendit.Opt.SecretKey = "examplesecretkey"

createData := payout.CreateParams{
	ExternalID: "payout-" + time.Now().String(),
	Amount:     200000,
}

resp, err := payout.Create(&createData)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("created payout: %+v\n", resp)
Output:

func CreateWithContext

func CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Payout, *xendit.Error)

CreateWithContext creates new payout with context

func Get

func Get(data *GetParams) (*xendit.Payout, *xendit.Error)

Get gets one payout

Example
xendit.Opt.SecretKey = "examplesecretkey"

resp, err := payout.Get(&payout.GetParams{
	ID: "123",
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("retrieved payout: %+v\n", resp)
Output:

func GetWithContext

func GetWithContext(ctx context.Context, data *GetParams) (*xendit.Payout, *xendit.Error)

GetWithContext gets one payout with context

func Void

func Void(data *VoidParams) (*xendit.Payout, *xendit.Error)

Void voids the created payout

Example
xendit.Opt.SecretKey = "examplesecretkey"

resp, err := payout.Void(&payout.VoidParams{
	ID: "123",
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("voided payout: %+v\n", resp)
Output:

func VoidWithContext

func VoidWithContext(ctx context.Context, data *VoidParams) (*xendit.Payout, *xendit.Error)

VoidWithContext voids the created payout with context

Types

type Client

type Client struct {
	Opt          *xendit.Option
	APIRequester xendit.APIRequester
}

Client is the client used to invoke invoice API.

func (*Client) Create

func (c *Client) Create(data *CreateParams) (*xendit.Payout, *xendit.Error)

Create creates new payout

func (*Client) CreateWithContext

func (c *Client) CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Payout, *xendit.Error)

CreateWithContext creates new payout with context

func (*Client) Get

func (c *Client) Get(data *GetParams) (*xendit.Payout, *xendit.Error)

Get gets one payout

func (*Client) GetWithContext

func (c *Client) GetWithContext(ctx context.Context, data *GetParams) (*xendit.Payout, *xendit.Error)

GetWithContext gets one payout with context

func (*Client) Void

func (c *Client) Void(data *VoidParams) (*xendit.Payout, *xendit.Error)

Void voids the created payout

func (*Client) VoidWithContext

func (c *Client) VoidWithContext(ctx context.Context, data *VoidParams) (*xendit.Payout, *xendit.Error)

VoidWithContext voids the created payout with context

type CreateParams

type CreateParams struct {
	IdempotencyKey string  `json:"-"`
	ExternalID     string  `json:"external_id" validate:"required"`
	Amount         float64 `json:"amount" validate:"required"`
	Email          string  `json:"email" validate:"required"`
}

CreateParams contains parameters for Create

type GetParams

type GetParams struct {
	ID string `json:"id" validate:"required"`
}

GetParams contains parameters for Get

type VoidParams

type VoidParams struct {
	ID string `json:"id" validate:"required"`
}

VoidParams contains parameters for Get

Jump to

Keyboard shortcuts

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