contaazul

package module
v0.0.0-...-737b305 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

contaazul-go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InvalidParamsError = fmt.Errorf("invalid params to create client")
)
View Source
var (
	UnmarshalResponseError = errors.New("could not unmarshal response")
)

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
}

type Address

type Address struct {
	Street       string `json:"street"`
	Number       string `json:"number"`
	Complement   string `json:"complement"`
	ZipCode      string `json:"zip_code"`
	Neighborhood string `json:"neighborhood"`
	City         City   `json:"city"`
	State        State  `json:"state"`
}

type Base

type Base struct {
	Name string `json:"name"`
}

type City

type City Base

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts Options) (*Client, error)

func (*Client) ListCustomers

func (cli *Client) ListCustomers(listOpts ListCustomerOptions) ([]Customer, error)

ListCustomers list customers

func (*Client) ListSales

func (cli *Client) ListSales(listOpts ListSaleOptions) ([]Sale, error)

type Customer

type Customer struct {
	ID                      string           `json:"id"`
	Name                    string           `json:"name"`
	CompanyName             string           `json:"company_name"`
	Email                   string           `json:"email"`
	BusinessPhone           string           `json:"business_phone"`
	MobilePhone             string           `json:"mobile_phone"`
	PersonType              PersonType       `json:"person_type"`
	Document                string           `json:"document"`
	IdentityDocument        string           `json:"identity_document"`
	StateRegistrationNumber string           `json:"state_registration_number"`
	StateRegistrationType   RegistrationType `json:"state_registration_type"`
	CityRegistrationNumber  string           `json:"city_registration_number"`
	DateOfBirth             string           `json:"date_of_birth"`
	Notes                   string           `json:"notes"`
	CreatedAt               time.Time        `json:"created_at"`
	Address                 Address          `json:"address"`
}

type Discount

type Discount struct {
	MeasureUnit DiscountMeasureUnit `json:"measure_unit"`
	Rate        float64             `json:"rate"`
}

type DiscountMeasureUnit

type DiscountMeasureUnit string
const (
	Percent DiscountMeasureUnit = "PERCENT"
	Value   DiscountMeasureUnit = "VALUE"
)

type ListCustomerOptions

type ListCustomerOptions struct {
	Search      string `json:"search,omitempty"        structs:"search,omitempty"`
	Name        string `json:"name,omitempty"          structs:"name,omitempty"`
	CompanyName string `json:"company_name,omitempty"  structs:"company_name,omitempty"`
	Document    string `json:"document,omitempty"      structs:"document,omitempty"`
	Page        int    `json:"page,omitempty"          structs:"page,omitempty"`
	Size        int    `json:"size,omitempty"          structs:"size,omitempty"`
}

ListCustomerOptions list customer options

func (ListCustomerOptions) AddOptions

func (lco ListCustomerOptions) AddOptions(u string) string

type ListSaleOptions

type ListSaleOptions struct {
	EmissionStart time.Time  `json:"emission_start,omitempty"  structs:"emission_start,omitempty"`
	EmissionEnd   time.Time  `json:"emission_end,omitempty"    structs:"emission_end,omitempty"`
	Status        SaleStatus `json:"status,omitempty"          structs:"status,omitempty"`
	CustomerId    string     `json:"customer_id,omitempty"     structs:"customer_id,omitempty"`
	Page          int        `json:"page,omitempty"            structs:"page,omitempty"`
	Size          int        `json:"size,omitempty"            structs:"size,omitempty"`
}

ListSaleOptions list sale options

func (ListSaleOptions) AddOptions

func (lso ListSaleOptions) AddOptions(u string) string

type Options

type Options struct {
	BaseURL      string
	AccessToken  string
	RefreshToken string
	ClientID     string
	ClientSecret string
	Timeout      time.Duration
}

type Payment

type Payment struct {
	Type PaymentType `json:"type"`
}

type PaymentType

type PaymentType string
const (
	Cash  PaymentType = "CASH"
	Times PaymentType = "TIMES"
)

type PersonType

type PersonType string
const (
	Natural PersonType = "NATURAL"
	Legal   PersonType = "LEGAL"
)

type RegistrationType

type RegistrationType string
const (
	NoContributor     RegistrationType = "NO_CONTRIBUTOR"
	Contributor       RegistrationType = "CONTRIBUTOR"
	ImmuneContributor RegistrationType = "IMMUNE_CONTRIBUTOR"
)

type RequestParams

type RequestParams struct {
	// contains filtered or unexported fields
}

type Sale

type Sale struct {
	ID           string     `json:"id"`
	Number       int        `json:"number"`
	Emission     time.Time  `json:"emission"`
	Status       SaleStatus `json:"status"`
	Scheduled    bool       `json:"scheduled"`
	Customer     Customer   `json:"customer"` // TODO Criar um tipo simplificado de Customer?
	Discount     Discount   `json:"discount"`
	Payment      Payment    `json:"payment"`
	Notes        string     `json:"notes"`
	ShippingCost float64    `json:"shipping_cost"`
	Total        float64    `json:"total"`
	Seller       Seller     `json:"seller"`
}

Sale sale

type SaleStatus

type SaleStatus string

SaleStatus represent sales status

const (
	Pending   SaleStatus = "PENDING"
	Committed SaleStatus = "COMMITTED"
)

type Seller

type Seller struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Seller seller

type State

type State Base

Jump to

Keyboard shortcuts

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