customer

package
v1.0.58 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	APIVersion = "2020-10-31"
)

Variables

This section is empty.

Functions

func CreateCustomer

func CreateCustomer(data *map[string]interface{}) (*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",
	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 *map[string]interface{}) (*xendit.Customer, *xendit.Error)

CreateCustomerWithContext creates new payment

func GenerateIdempotencyKey added in v1.0.48

func GenerateIdempotencyKey() string

func GetCustomerByCustomerID added in v1.0.9

func GetCustomerByCustomerID(data *GetCustomerByCustomerIDParams) (*[]xendit.Customer, *xendit.Error)

GetCustomerByCustomerID gets customer by customer ID

func GetCustomerByCustomerIDWithContext added in v1.0.9

func GetCustomerByCustomerIDWithContext(ctx context.Context, data *GetCustomerByCustomerIDParams) (*[]xendit.Customer, *xendit.Error)

GetCustomerByCustomerIDWithContext gets customer by customer ID

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

func UpdateCustomer added in v1.0.9

func UpdateCustomer(data *map[string]interface{}) (*xendit.Customer, *xendit.Error)

UpdateCustomer updates the details on a customer

func UpdateCustomerWithContext added in v1.0.9

func UpdateCustomerWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.Customer, *xendit.Error)

UpdateCustomerWithContext updates the details on a customer

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 *map[string]interface{}) (*xendit.Customer, *xendit.Error)

CreateCustomer creates new customer

func (*Client) CreateCustomerWithContext

func (c *Client) CreateCustomerWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.Customer, *xendit.Error)

CreateCustomerWithContext creates new customer

func (*Client) GetCustomerByCustomerID added in v1.0.9

func (c *Client) GetCustomerByCustomerID(data *GetCustomerByCustomerIDParams) (*[]xendit.Customer, *xendit.Error)

GetCustomerByReferenceID gets customer by reference ID

func (*Client) GetCustomerByCustomerIDWithContext added in v1.0.9

func (c *Client) GetCustomerByCustomerIDWithContext(ctx context.Context, data *GetCustomerByCustomerIDParams) (*[]xendit.Customer, *xendit.Error)

GetCustomerByReferenceIDWithContext gets customer by reference ID

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

func (*Client) UpdateCustomer added in v1.0.9

func (c *Client) UpdateCustomer(data *map[string]interface{}) (*xendit.Customer, *xendit.Error)

UpdateCustomer updates the details on a customer

func (*Client) UpdateCustomerWithContext added in v1.0.9

func (c *Client) UpdateCustomerWithContext(ctx context.Context, data *map[string]interface{}) (*xendit.Customer, *xendit.Error)

UpdateCustomerWithContext updates the details on a customer

type CreateCustomerBusinessParams added in v1.0.22

type CreateCustomerBusinessParams struct {
	IdempotencyKey         string                   `json:"-"`
	ForUserID              string                   `json:"-"`
	APIVersion             string                   `json:"-"`
	ReferenceID            string                   `json:"reference_id" validate:"required"`
	Type                   string                   `json:"type"`
	BusinessDetail         xendit.BusinessDetail    `json:"business_detail,omitempty"`
	MobileNumber           string                   `json:"mobile_number,omitempty"`
	PhoneNumber            string                   `json:"phone_number,omitempty"`
	HashedPhoneNumber      string                   `json:"hashed_phone_number"`
	Email                  string                   `json:"email,omitempty"`
	Addresses              []xendit.CustomerAddress `json:"addresses,omitempty"`
	Description            string                   `json:"description,omitempty"`
	DateOfRegistration     string                   `json:"date_of_registration"`
	DomicileOfRegistration string                   `json:"domicile_of_registration"`
	Metadata               map[string]interface{}   `json:"metadata,omitempty"`
}

type CreateCustomerIndividualParams added in v1.0.22

type CreateCustomerIndividualParams struct {
	IdempotencyKey         string                   `json:"-"`
	ForUserID              string                   `json:"-"`
	APIVersion             string                   `json:"-"`
	ReferenceID            string                   `json:"reference_id" validate:"required"`
	Type                   string                   `json:"type"`
	IndividualDetail       xendit.IndividualDetail  `json:"individual_detail,omitempty"`
	MobileNumber           string                   `json:"mobile_number,omitempty"`
	PhoneNumber            string                   `json:"phone_number,omitempty"`
	HashedPhoneNumber      string                   `json:"hashed_phone_number"`
	Email                  string                   `json:"email,omitempty"`
	Addresses              []xendit.CustomerAddress `json:"addresses,omitempty"`
	Description            string                   `json:"description,omitempty"`
	DateOfRegistration     string                   `json:"date_of_registration"`
	DomicileOfRegistration string                   `json:"domicile_of_registration"`
	Metadata               map[string]interface{}   `json:"metadata,omitempty"`
}

type CreateCustomerParams

type CreateCustomerParams struct {
	IdempotencyKey         string                   `json:"-"`
	ForUserID              string                   `json:"-"`
	APIVersion             string                   `json:"-"`
	ReferenceID            string                   `json:"reference_id" validate:"required"`
	Type                   string                   `json:"type"`
	IndividualDetail       xendit.IndividualDetail  `json:"individual_detail,omitempty"`
	BusinessDetail         xendit.BusinessDetail    `json:"business_detail,omitempty"`
	MobileNumber           string                   `json:"mobile_number,omitempty"`
	PhoneNumber            string                   `json:"phone_number,omitempty"`
	HashedPhoneNumber      string                   `json:"hashed_phone_number"`
	Email                  string                   `json:"email,omitempty"`
	Addresses              []xendit.CustomerAddress `json:"addresses,omitempty"`
	Description            string                   `json:"description,omitempty"`
	DateOfRegistration     string                   `json:"date_of_registration"`
	DomicileOfRegistration string                   `json:"domicile_of_registration"`
	Metadata               map[string]interface{}   `json:"metadata,omitempty"`
}

CreateCustomerParams contains parameters for CreateCustomer

type GetCustomerByCustomerIDParams added in v1.0.9

type GetCustomerByCustomerIDParams struct {
	ForUserID  string `json:"-"`
	APIVersion string `json:"-"`
	CustomerID string `json:"-"`
}

GetCustomerByReferenceIDParams contains parameters for GetCustomerByReferenceID

func (*GetCustomerByCustomerIDParams) QueryString added in v1.0.9

func (p *GetCustomerByCustomerIDParams) QueryString() string

QueryString creates query string from GetCustomerByReferenceIDParams, ignores nil values

type GetCustomerByReferenceIDParams

type GetCustomerByReferenceIDParams struct {
	ForUserID   string `json:"-"`
	APIVersion  string `json:"-"`
	ReferenceID string `json:"-"`
}

GetCustomerByReferenceIDParams contains parameters for GetCustomerByReferenceID

func (*GetCustomerByReferenceIDParams) QueryString

func (p *GetCustomerByReferenceIDParams) QueryString() string

QueryString creates query string from GetCustomerByReferenceIDParams, ignores nil values

type UpdateCustomerParams added in v1.0.9

type UpdateCustomerParams struct {
	ForUserID        string                   `json:"-"`
	APIVersion       string                   `json:"-"`
	CustomerID       string                   `json:"-"`
	IndividualDetail xendit.IndividualDetail  `json:"individual_detail,omitempty"`
	BusinessDetail   xendit.BusinessDetail    `json:"business_detail,omitempty"`
	MobileNumber     string                   `json:"mobile_number"`
	Email            string                   `json:"email,omitempty"`
	Addresses        []xendit.CustomerAddress `json:"addresses,omitempty"`
	Metadata         map[string]interface{}   `json:"metadata,omitempty"`
}

UpdateCustomerParams contains parameters for UpdateCustomer

Jump to

Keyboard shortcuts

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