Documentation ¶
Index ¶
- func Create(data *CreateParams) (*xendit.Invoice, *xendit.Error)
- func CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Invoice, *xendit.Error)
- func Expire(data *ExpireParams) (*xendit.Invoice, *xendit.Error)
- func ExpireWithContext(ctx context.Context, data *ExpireParams) (*xendit.Invoice, *xendit.Error)
- func Get(data *GetParams) (*xendit.Invoice, *xendit.Error)
- func GetAll(data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
- func GetAllWithContext(ctx context.Context, data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
- func GetWithContext(ctx context.Context, data *GetParams) (*xendit.Invoice, *xendit.Error)
- type Client
- func (c *Client) Create(data *CreateParams) (*xendit.Invoice, *xendit.Error)
- func (c *Client) CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Invoice, *xendit.Error)
- func (c *Client) Expire(data *ExpireParams) (*xendit.Invoice, *xendit.Error)
- func (c *Client) ExpireWithContext(ctx context.Context, data *ExpireParams) (*xendit.Invoice, *xendit.Error)
- func (c *Client) Get(data *GetParams) (*xendit.Invoice, *xendit.Error)
- func (c *Client) GetAll(data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
- func (c *Client) GetAllWithContext(ctx context.Context, data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
- func (c *Client) GetWithContext(ctx context.Context, data *GetParams) (*xendit.Invoice, *xendit.Error)
- type CreateParams
- type ExpireParams
- type GetAllParams
- type GetParams
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(data *CreateParams) (*xendit.Invoice, *xendit.Error)
Create creates new invoice
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := invoice.CreateParams{ ExternalID: "invoice-example", Amount: 200000, PayerEmail: "customer@customer.com", Description: "invoice #1", } resp, err := invoice.Create(&data) if err != nil { log.Fatal(err) } fmt.Printf("created invoice: %+v\n", resp)
Output:
func CreateWithContext ¶
func CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Invoice, *xendit.Error)
CreateWithContext creates new invoice with context
func Expire ¶
func Expire(data *ExpireParams) (*xendit.Invoice, *xendit.Error)
Expire expires the created invoice
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := invoice.ExpireParams{ ID: "invoice-id", } resp, err := invoice.Expire(&data) if err != nil { log.Fatal(err) } fmt.Printf("expired invoice: %+v\n", resp)
Output:
func ExpireWithContext ¶
func ExpireWithContext(ctx context.Context, data *ExpireParams) (*xendit.Invoice, *xendit.Error)
ExpireWithContext expires the created invoice with context
func Get ¶
func Get(data *GetParams) (*xendit.Invoice, *xendit.Error)
Get gets one invoice
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := invoice.GetParams{ ID: "invoice-id", } resp, err := invoice.Get(&data) if err != nil { log.Fatal(err) } fmt.Printf("retrieved invoice: %+v\n", resp)
Output:
func GetAll ¶
func GetAll(data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
GetAll gets all invoices with conditions
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" createdAfter, _ := time.Parse(time.RFC3339, "2016-02-24T23:48:36.697Z") data := invoice.GetAllParams{ Statuses: []string{"EXPIRED", "SETTLED"}, Limit: 5, CreatedAfter: createdAfter, } resps, err := invoice.GetAll(&data) if err != nil { log.Fatal(err) } fmt.Printf("invoices: %+v\n", resps)
Output:
func GetAllWithContext ¶
func GetAllWithContext(ctx context.Context, data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
GetAllWithContext gets all invoices with conditions
func GetWithContext ¶
GetWithContext gets one invoice 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.Invoice, *xendit.Error)
Create creates new invoice
func (*Client) CreateWithContext ¶
func (c *Client) CreateWithContext(ctx context.Context, data *CreateParams) (*xendit.Invoice, *xendit.Error)
CreateWithContext creates new invoice with context
func (*Client) Expire ¶
func (c *Client) Expire(data *ExpireParams) (*xendit.Invoice, *xendit.Error)
Expire expires the created invoice
func (*Client) ExpireWithContext ¶
func (c *Client) ExpireWithContext(ctx context.Context, data *ExpireParams) (*xendit.Invoice, *xendit.Error)
ExpireWithContext expires the created invoice with context
func (*Client) GetAll ¶
func (c *Client) GetAll(data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
GetAll gets all invoices with conditions
func (*Client) GetAllWithContext ¶
func (c *Client) GetAllWithContext(ctx context.Context, data *GetAllParams) ([]xendit.Invoice, *xendit.Error)
GetAllWithContext gets all invoices with conditions
type CreateParams ¶
type CreateParams struct { ForUserID string `json:"-"` ExternalID string `json:"external_id" validate:"required"` Amount float64 `json:"amount" validate:"required"` Description string `json:"description,omitempty"` PayerEmail string `json:"payer_email,omitempty"` ShouldSendEmail *bool `json:"should_send_email,omitempty"` Customer xendit.InvoiceCustomer `json:"customer,omitempty"` CustomerNotificationPreference xendit.InvoiceCustomerNotificationPreference `json:"customer_notification_preference,omitempty"` InvoiceDuration int `json:"invoice_duration,omitempty"` SuccessRedirectURL string `json:"success_redirect_url,omitempty"` FailureRedirectURL string `json:"failure_redirect_url,omitempty"` PaymentMethods []string `json:"payment_methods,omitempty"` Currency string `json:"currency,omitempty"` FixedVA *bool `json:"fixed_va,omitempty"` CallbackVirtualAccountID string `json:"callback_virtual_account_id,omitempty"` MidLabel string `json:"mid_label,omitempty"` ReminderTimeUnit string `json:"reminder_time_unit,omitempty"` ReminderTime int `json:"reminder_time,omitempty"` Locale string `json:"locale,omitempty"` Items []xendit.InvoiceItem `json:"items,omitempty"` Fees []xendit.InvoiceFee `json:"fees,omitempty"` ShouldAuthenticateCreditCard bool `json:"should_authenticate_credit_card,omitempty"` }
CreateParams contains parameters for Create
type ExpireParams ¶
ExpireParams contains parameters for Expire
type GetAllParams ¶
type GetAllParams struct { ForUserID string `json:"-"` Statuses []string `json:"statuses,omitempty"` Limit int `json:"limit,omitempty"` CreatedAfter time.Time `json:"created_after,omitempty"` CreatedBefore time.Time `json:"created_before,omitempty"` PaidAfter time.Time `json:"paid_after,omitempty"` PaidBefore time.Time `json:"paid_before,omitempty"` ExpiredAfter time.Time `json:"expired_after,omitempty"` ExpiredBefore time.Time `json:"expired_before,omitempty"` LastInvoiceID string `json:"last_invoice_id,omitempty"` ClientTypes []string `json:"client_types,omitempty"` PaymentChannels []string `json:"payment_channels,omitempty"` OnDemandLink string `json:"on_demand_link,omitempty"` RecurringPaymentID string `json:"recurring_payment_id,omitempty"` }
GetAllParams contains parameters for GetAll
func (*GetAllParams) QueryString ¶
func (p *GetAllParams) QueryString() string
QueryString creates query string from GetAllParams, ignores nil values