qrcode

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: 7 Imported by: 3

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateQRCode

func CreateQRCode(data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)

CreateQRCode creates new QR Code.

Example
xendit.Opt.SecretKey = "examplesecretkey"

createQRCodeData := qrcode.CreateQRCodeParams{
	ExternalID:  "external_id",
	CallbackURL: "http://webhook-site",
	Type:        xendit.DynamicQRCode,
	Amount:      10000,
}

qrCodeResponse, err := qrcode.CreateQRCode(&createQRCodeData)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("created QR code: %+v\n", qrCodeResponse)
Output:

func CreateQRCodeWithContext

func CreateQRCodeWithContext(ctx context.Context, data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)

CreateQRCodeWithContext creates new QR Code with context.

func GetQRCode

func GetQRCode(data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)

GetQRCode gets a single QR Code.

Example
xendit.Opt.SecretKey = "examplesecretkey"

qrCodeResponse, err := qrcode.GetQRCode(&qrcode.GetQRCodeParams{
	ExternalID: "external_id",
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("retrieved qr code: %v\n", qrCodeResponse)
Output:

func GetQRCodePayments

func GetQRCodePayments(data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)

GetQRCodePayments gets a list of QR Code payments.

Example
xendit.Opt.SecretKey = "examplesecretkey"

getQRCodePaymentsdata := qrcode.GetQRCodePaymentsParams{
	ExternalID: "external_id",
	Limit:      20,
}

getQRCodePaymentsRes, err := qrcode.GetQRCodePayments(&getQRCodePaymentsdata)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("retrieved QR Code payments: %v\n", getQRCodePaymentsRes)
Output:

func GetQRCodePaymentsWithContext

func GetQRCodePaymentsWithContext(ctx context.Context, data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)

GetQRCodePaymentsWithContext gets a list of QR Code payments with context.

func GetQRCodeWithContext

func GetQRCodeWithContext(ctx context.Context, data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)

GetQRCodeWithContext gets a single QR Code with context.

Types

type Client

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

Client is the client used to invoke QRCode API.

func (*Client) CreateQRCode

func (c *Client) CreateQRCode(data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)

CreateQRCode creates new QR Code

func (*Client) CreateQRCodeWithContext

func (c *Client) CreateQRCodeWithContext(ctx context.Context, data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)

CreateQRCodeWithContext creates new QR Code with context

func (*Client) GetQRCode

func (c *Client) GetQRCode(data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)

GetQRCode gets a single QRCode

func (*Client) GetQRCodePayments

func (c *Client) GetQRCodePayments(data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)

GetQRCodePayments gets a list of QR Code payments

func (*Client) GetQRCodePaymentsWithContext

func (c *Client) GetQRCodePaymentsWithContext(ctx context.Context, data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)

GetQRCodePaymentsWithContext gets a list of QR Code payments with context

func (*Client) GetQRCodeWithContext

func (c *Client) GetQRCodeWithContext(ctx context.Context, data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)

GetQRCodeWithContext gets a single QRCode with context

type CreateQRCodeParams

type CreateQRCodeParams struct {
	ForUserID   string            `json:"-"`
	ExternalID  string            `json:"external_id" validate:"required"`
	Type        xendit.QRCodeType `json:"type" validate:"required"`
	CallbackURL string            `json:"callback_url" validate:"required"`
	Amount      float64           `json:"amount,omitempty"`
}

CreateQRCodeParams contains parameters for CreateQRCode

type GetQRCodeParams

type GetQRCodeParams struct {
	ForUserID  string `json:"-"`
	ExternalID string `json:"external_id" validate:"required"`
}

GetQRCodeParams contains parameters for GetQRCode

type GetQRCodePaymentsParams

type GetQRCodePaymentsParams struct {
	ExternalID string `json:"external_id" validate:"required"`
	Limit      int    `json:"limit,omitempty"`
	From       string `json:"from,omitempty"`
	To         string `json:"to,omitempty"`
}

GetQRCodePaymentsParams contains parameters for GetQRCodePayments

func (*GetQRCodePaymentsParams) QueryString

func (p *GetQRCodePaymentsParams) QueryString() string

QueryString creates query string from GetQRCodePaymentsParams, ignores nil values

Jump to

Keyboard shortcuts

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