Documentation ¶
Index ¶
- func CreateCustomer(data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
- func CreateCustomerWithContext(ctx context.Context, data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
- func GetCustomerByReferenceID(data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
- func GetCustomerByReferenceIDWithContext(ctx context.Context, data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
- type Client
- func (c *Client) CreateCustomer(data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
- func (c *Client) CreateCustomerWithContext(ctx context.Context, data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
- func (c *Client) GetCustomerByReferenceID(data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
- func (c *Client) GetCustomerByReferenceIDWithContext(ctx context.Context, data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
- type CreateCustomerParams
- type GetCustomerByReferenceIDParams
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCustomer ¶
func CreateCustomer(data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
CreateCustomer creates new customer
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" customerAddress := xendit.CustomerAddress{ Country: "ID", StreetLine1: "Jl. 123", StreetLine2: "Jl. 456", City: "Jakarta Selatan", Province: "DKI Jakarta", State: "-", PostalCode: "12345", } metadata := map[string]interface{}{ "meta": "data", } data := customer.CreateCustomerParams{ ReferenceID: "test-reference-id-002", Email: "tes@tes.com", GivenNames: "Given Names", Nationality: "ID", DateOfBirth: "1992-12-30", Addresses: []xendit.CustomerAddress{customerAddress}, Metadata: metadata, } resp, err := customer.CreateCustomer(&data) if err != nil { log.Fatal(err) } fmt.Printf("created customer: %+v\n", resp)
Output:
func CreateCustomerWithContext ¶
func CreateCustomerWithContext(ctx context.Context, data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
CreateCustomerWithContext creates new payment
func GetCustomerByReferenceID ¶
func GetCustomerByReferenceID(data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
GetCustomerByReferenceID gets customer by reference ID
Example ¶
xendit.Opt.SecretKey = "examplesecretkey" data := customer.GetCustomerByReferenceIDParams{ ReferenceID: "test-reference-id-002", } resp, err := customer.GetCustomerByReferenceID(&data) if err != nil { log.Fatal(err) } fmt.Printf("retrieved customer: %+v\n", resp)
Output:
func GetCustomerByReferenceIDWithContext ¶
func GetCustomerByReferenceIDWithContext(ctx context.Context, data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
GetCustomerByReferenceIDWithContext gets customer by reference ID
Types ¶
type Client ¶
type Client struct { Opt *xendit.Option APIRequester xendit.APIRequester }
Client is the client used to invoke customer API.
func (*Client) CreateCustomer ¶
func (c *Client) CreateCustomer(data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
CreateCustomer creates new customer
func (*Client) CreateCustomerWithContext ¶
func (c *Client) CreateCustomerWithContext(ctx context.Context, data *CreateCustomerParams) (*xendit.Customer, *xendit.Error)
CreateCustomerWithContext creates new customer
func (*Client) GetCustomerByReferenceID ¶
func (c *Client) GetCustomerByReferenceID(data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
GetCustomerByReferenceID gets customer by reference ID
func (*Client) GetCustomerByReferenceIDWithContext ¶
func (c *Client) GetCustomerByReferenceIDWithContext(ctx context.Context, data *GetCustomerByReferenceIDParams) ([]xendit.Customer, *xendit.Error)
GetCustomerByReferenceIDWithContext gets customer by reference ID
type CreateCustomerParams ¶
type CreateCustomerParams struct { ForUserID string `json:"-"` APIVersion string `json:"-"` ReferenceID string `json:"reference_id" validate:"required"` MobileNumber string `json:"mobile_number,omitempty"` Email string `json:"email,omitempty"` GivenNames string `json:"given_names" validate:"required"` MiddleName string `json:"middle_name,omitempty"` Surname string `json:"surname,omitempty"` Description string `json:"description,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` Nationality string `json:"nationality,omitempty"` Addresses []xendit.CustomerAddress `json:"addresses,omitempty"` DateOfBirth string `json:"date_of_birth,omitempty"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
CreateCustomerParams contains parameters for CreateCustomer
type GetCustomerByReferenceIDParams ¶
type GetCustomerByReferenceIDParams struct {
ReferenceID string `json:"reference_id" validate:"required"`
}
GetCustomerByReferenceIDParams contains parameters for GetCustomerByReferenceID
func (*GetCustomerByReferenceIDParams) QueryString ¶
func (p *GetCustomerByReferenceIDParams) QueryString() string
QueryString creates query string from GetCustomerByReferenceIDParams, ignores nil values