Documentation
¶
Index ¶
- func CreateQRCode(data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func CreateQRCodeWithContext(ctx context.Context, data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func GetQRCode(data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func GetQRCodePayments(data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)
- func GetQRCodePaymentsWithContext(ctx context.Context, data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)
- func GetQRCodeWithContext(ctx context.Context, data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)
- type Client
- func (c *Client) CreateQRCode(data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func (c *Client) CreateQRCodeWithContext(ctx context.Context, data *CreateQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func (c *Client) GetQRCode(data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)
- func (c *Client) GetQRCodePayments(data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)
- func (c *Client) GetQRCodePaymentsWithContext(ctx context.Context, data *GetQRCodePaymentsParams) ([]xendit.QRCodePayments, *xendit.Error)
- func (c *Client) GetQRCodeWithContext(ctx context.Context, data *GetQRCodeParams) (*xendit.QRCode, *xendit.Error)
- type CreateQRCodeParams
- type GetQRCodeParams
- type GetQRCodePaymentsParams
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)
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)
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)
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 ¶
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) 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