disbursementph

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

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

Create creates new disbursement

Example
xendit.Opt.SecretKey = "examplesecretkey"

createData := disbursementph.CreateParams{
	IdempotencyKey: "disbursement" + time.Now().String(),
	ReferenceID:    "disbursement-reference",
	ChannelCode:    "PH_BDO",
	AccountName:    "Michael Jackson",
	AccountNumber:  "1234567890",
	Description:    "Disbursement from Go",
	Amount:         200000,
	Beneficiary: xendit.Beneficiary{
		Type:         "INDIVIDUAL",
		GivenNames:   "John",
		MiddleName:   "Michel",
		Surname:      "Doe",
		BusinessName: "Example Business",
		StreetLine1:  "Sultan Street",
		StreetLine2:  "BCG",
		City:         "Manila",
		Province:     "Manila",
		State:        "Manila",
		Country:      "Philippines",
		ZipCode:      "12345",
		MobileNumber: "9876543210",
		PhoneNumber:  "987654321",
		Email:        "example@test.com",
	},
	ReceiptNotification: xendit.ReceiptNotification{
		EmailTo:  []string{"example@test.com"},
		EmailCC:  []string{"example@test.com"},
		EmailBCC: []string{"example@test.com"},
	},
	Metadata: map[string]interface{}{
		"meta": "data",
	},
}

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

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

func CreateWithContext

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

CreateWithContext creates new disbursement with context

func GetByID

func GetByID(data *GetByIDParams) (*xendit.DisbursementPh, *xendit.Error)

GetByID gets a disbursement

Example
xendit.Opt.SecretKey = "examplesecretkey"

getByIDData := disbursementph.GetByIDParams{
	DisbursementID: "123",
}

resp, err := disbursementph.GetByID(&getByIDData)
if err != nil {
	log.Fatal(err.ErrorCode, err.Message, err.GetStatus())
}

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

func GetByIDWithContext

func GetByIDWithContext(ctx context.Context, data *GetByIDParams) (*xendit.DisbursementPh, *xendit.Error)

GetByIDWithContext gets a disbursement with context

func GetByReferenceID

func GetByReferenceID(data *GetByReferenceIDParams) ([]xendit.DisbursementPh, *xendit.Error)

GetByReferenceID gets a disbursement

Example
xendit.Opt.SecretKey = "examplesecretkey"

getByReferenceIDData := disbursementph.GetByReferenceIDParams{
	ReferenceID: "disbursement-reference-id",
}

resps, err := disbursementph.GetByReferenceID(&getByReferenceIDData)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("retrieved disbursements: %+v\n", resps)
Output:

func GetByReferenceIDWithContext

func GetByReferenceIDWithContext(ctx context.Context, data *GetByReferenceIDParams) ([]xendit.DisbursementPh, *xendit.Error)

GetByExternalIDWithContext gets a disbursement with context

func GetDisbursementChannels

func GetDisbursementChannels() ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannels gets available disbursement banks

Example
xendit.Opt.SecretKey = "examplesecretkey"

disbursementChannels, err := disbursementph.GetDisbursementChannels()
if err != nil {
	log.Fatal(err)
}

fmt.Printf("disbursement channels: %+v\n", disbursementChannels)
Output:

func GetDisbursementChannelsByChannelCategory

func GetDisbursementChannelsByChannelCategory(data *GetByChannelCategoryParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCategory gets available disbursement banks

Example
xendit.Opt.SecretKey = "examplesecretkey"

getByChannelCategoryData := disbursementph.GetByChannelCategoryParams{
	ChannelCategory: "BANK",
}

disbursementChannels, err := disbursementph.GetDisbursementChannelsByChannelCategory(&getByChannelCategoryData)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("disbursement channels: %+v\n", disbursementChannels)
Output:

func GetDisbursementChannelsByChannelCategoryWithContext

func GetDisbursementChannelsByChannelCategoryWithContext(ctx context.Context, data *GetByChannelCategoryParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCategoryWithContext gets available disbursement banks with context

func GetDisbursementChannelsByChannelCode

func GetDisbursementChannelsByChannelCode(data *GetByChannelCodeParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCode gets available disbursement banks

Example
xendit.Opt.SecretKey = "examplesecretkey"

getByChannelCodeData := disbursementph.GetByChannelCodeParams{
	ChannelCode: "BANK",
}

disbursementChannels, err := disbursementph.GetDisbursementChannelsByChannelCode(&getByChannelCodeData)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("disbursement channels: %+v\n", disbursementChannels)
Output:

func GetDisbursementChannelsByChannelCodeWithContext

func GetDisbursementChannelsByChannelCodeWithContext(ctx context.Context, data *GetByChannelCodeParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCodeWithContext gets available disbursement banks with context

func GetDisbursementChannelsWithContext

func GetDisbursementChannelsWithContext(ctx context.Context) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsWithContext gets available disbursement banks 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.DisbursementPh, *xendit.Error)

Create creates new PHP disbursement

func (*Client) CreateWithContext

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

CreateWithContext creates new disbursement with context

func (*Client) GetByID

func (c *Client) GetByID(data *GetByIDParams) (*xendit.DisbursementPh, *xendit.Error)

GetByID gets a disbursement by id

func (*Client) GetByIDWithContext

func (c *Client) GetByIDWithContext(ctx context.Context, data *GetByIDParams) (*xendit.DisbursementPh, *xendit.Error)

GetByIDWithContext gets a disbursement by id with context

func (*Client) GetByReferenceID

func (c *Client) GetByReferenceID(data *GetByReferenceIDParams) ([]xendit.DisbursementPh, *xendit.Error)

GetByReferenceID gets a disbursement by id

func (*Client) GetByReferenceIDWithContext

func (c *Client) GetByReferenceIDWithContext(ctx context.Context, data *GetByReferenceIDParams) ([]xendit.DisbursementPh, *xendit.Error)

GetByReferenceIDWithContext gets a disbursement by id with context

func (*Client) GetDisbursementChannels

func (c *Client) GetDisbursementChannels() ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannels gets available disbursement channels

func (*Client) GetDisbursementChannelsByChannelCategory

func (c *Client) GetDisbursementChannelsByChannelCategory(data *GetByChannelCategoryParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCategory gets available disbursement channels by ChannelCategory

func (*Client) GetDisbursementChannelsByChannelCategoryWithContext

func (c *Client) GetDisbursementChannelsByChannelCategoryWithContext(ctx context.Context, data *GetByChannelCategoryParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCategoryWithContext gets available disbursement channels by ChannelCategory with context

func (*Client) GetDisbursementChannelsByChannelCode

func (c *Client) GetDisbursementChannelsByChannelCode(data *GetByChannelCodeParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCode gets available disbursement channels by ChannelCode

func (*Client) GetDisbursementChannelsByChannelCodeWithContext

func (c *Client) GetDisbursementChannelsByChannelCodeWithContext(ctx context.Context, data *GetByChannelCodeParams) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsByChannelCodeWithContext gets available disbursement channels by ChannelCode with context

func (*Client) GetDisbursementChannelsWithContext

func (c *Client) GetDisbursementChannelsWithContext(ctx context.Context) ([]xendit.DisbursementChannel, *xendit.Error)

GetDisbursementChannelsWithContext gets available disbursement channels with context

type CreateParams

type CreateParams struct {
	IdempotencyKey      string                     `json:"xendit_idempotency_key" validate:"required"`
	ReferenceID         string                     `json:"reference_id" validate:"required"`
	Currency            string                     `json:"currency" validate:"required"`
	ChannelCode         string                     `json:"channel_code" validate:"required"`
	AccountName         string                     `json:"account_name" validate:"required"`
	AccountNumber       string                     `json:"account_number" validate:"required"`
	Description         string                     `json:"description" validate:"required"`
	Amount              float64                    `json:"amount" validate:"required"`
	Beneficiary         xendit.Beneficiary         `json:"beneficiary,omitempty"`
	ReceiptNotification xendit.ReceiptNotification `json:"receipt_notification,omitempty"`
	Metadata            map[string]interface{}     `json:"metadata,omitempty"`
}

CreateParams contains parameters for Create

type GetByChannelCategoryParams

type GetByChannelCategoryParams struct {
	ChannelCategory string `json:"channel_category" validate:"required"`
}

GetByChannelCategoryParams contains parameters for GetDisbursementChannelByChannelCategory

func (*GetByChannelCategoryParams) QueryString

func (p *GetByChannelCategoryParams) QueryString() string

QueryString creates query string from GetByChannelCategoryParams, ignores nil values

type GetByChannelCodeParams

type GetByChannelCodeParams struct {
	ChannelCode string `json:"channel_code" validate:"required"`
}

GetByChannelCodeParams contains parameters for GetDisbursementChannelByChannelCode

func (*GetByChannelCodeParams) QueryString

func (p *GetByChannelCodeParams) QueryString() string

QueryString creates query string from GetByChannelCodeParams, ignores nil values

type GetByIDParams

type GetByIDParams struct {
	DisbursementID string `json:"disbursement_id" validate:"required"`
}

GetByIDParams contains parameters for GetByID

type GetByReferenceIDParams

type GetByReferenceIDParams struct {
	ReferenceID string `json:"reference_id" validate:"required"`
}

GetByReferenceIDParams contains parameters for GetByReferenceID

func (*GetByReferenceIDParams) QueryString

func (p *GetByReferenceIDParams) QueryString() string

QueryString creates query string from GetByReferenceIDParams, ignores nil values

Jump to

Keyboard shortcuts

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