Skip to content

Commit

Permalink
logistica reversa
Browse files Browse the repository at this point in the history
  • Loading branch information
HerbertNatal committed Aug 8, 2024
1 parent 6554e57 commit d74d1d8
Show file tree
Hide file tree
Showing 14 changed files with 522 additions and 256 deletions.
2 changes: 1 addition & 1 deletion airline.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ func (n Airline) Error() string {

func (c *Client) GetAirline() ([]Airline, error) {
var aAirlines []Airline
err := c.Get(airline, nil, nil, aAirlines, "JSON", "")
err := c.Get(airline, nil, nil, aAirlines)
return aAirlines, err
}
6 changes: 3 additions & 3 deletions balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ func (n BalanceInput) Error() string {

func (c *Client) GetBalance() (*BalanceResponse, error) {
newBalance := &BalanceResponse{}
err := c.Get(balanceTrackingNumbers, nil, nil, newBalance, "JSON", "")
err := c.Get(balanceTrackingNumbers, nil, nil, newBalance)
return newBalance, err
}

func (c *Client) GetUnitCodeBalance() (*BalanceResponse, error) {
newBalance := &BalanceResponse{}
err := c.Get(balanceUnitsCode, nil, nil, newBalance, "JSON", "")
err := c.Get(balanceUnitsCode, nil, nil, newBalance)
return newBalance, err
}

func (c *Client) GetBalanceInput() (*BalanceInput, error) {
newBalance := &BalanceInput{}
err := c.Get(balance, nil, nil, newBalance, "JSON", "")
err := c.Get(balance, nil, nil, newBalance)
return newBalance, err
}
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func NewClientToken(user, pass, contract, cartaopostagem, tpPost string, sandbox

switch tpPost {
case "AUTH":
err = c.Post(tokenAuth, nil, nil, model, "JSON", "")
err = c.Post(tokenAuth, nil, nil, model)
case "CONTRATO":
err = c.Post(tokenAuthContrato, tmpLoginToken, nil, model, "JSON", "")
err = c.Post(tokenAuthContrato, tmpLoginToken, nil, model)
case "CARTAOPOSTAGEM":
tmpLoginToken.Numero = cartaopostagem
err = c.Post(tokenAuthCartaoPostagem, tmpLoginToken, nil, model, "JSON", "")
err = c.Post(tokenAuthCartaoPostagem, tmpLoginToken, nil, model)
case "LOGISTICAREVERSA":
err = nil
}
Expand Down
20 changes: 10 additions & 10 deletions cn38.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (n Cn38DepartureList) Error() string {
func (c *Client) PostCn38Request(dispatches *Cn38RequestAsyncInput) (*Cn38RequestReturn, error) {

newcn38RequestReturn := &Cn38RequestReturn{}
err := c.Post(cn38async, dispatches, nil, newcn38RequestReturn, "JSON", "")
err := c.Post(cn38async, dispatches, nil, newcn38RequestReturn)
return newcn38RequestReturn, err
}

Expand All @@ -111,14 +111,14 @@ func (c *Client) GetCn38Async(requestId string) (*Cn38RequestReturn, error) {
sendRequest.RequestId = StringPtr(requestId)

newCn38RequestReturn := &Cn38RequestReturn{}
err = c.Get(cn38async, sendRequest, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38async, sendRequest, nil, newCn38RequestReturn)
return newCn38RequestReturn, err
}

func (c *Client) PostCn38UnitCode(unitcodes *Cn38UnitList) (*Cn38UnitCodesReturn, error) {

newcn38RequestReturn := &Cn38UnitCodesReturn{}
err := c.Post(cn38Units, unitcodes, nil, newcn38RequestReturn, "JSON", "")
err := c.Post(cn38Units, unitcodes, nil, newcn38RequestReturn)
return newcn38RequestReturn, err
}

Expand All @@ -130,9 +130,9 @@ func (c *Client) GetCn38ListPending(page int) (*Cn38DepartureList, error) {

if page > 0 {
sendRequest.Page = IntPtr(page)
err = c.Get(cn38ListsPending, sendRequest, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsPending, sendRequest, nil, newCn38RequestReturn)
} else {
err = c.Get(cn38ListsPending, nil, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsPending, nil, nil, newCn38RequestReturn)
}

return newCn38RequestReturn, err
Expand All @@ -146,9 +146,9 @@ func (c *Client) GetCn38ListConfirmed(page int) (*Cn38DepartureList, error) {

if page > 0 {
sendRequest.Page = IntPtr(page)
err = c.Get(cn38ListsConfirmed, sendRequest, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsConfirmed, sendRequest, nil, newCn38RequestReturn)
} else {
err = c.Get(cn38ListsConfirmed, nil, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsConfirmed, nil, nil, newCn38RequestReturn)
}

return newCn38RequestReturn, err
Expand All @@ -162,9 +162,9 @@ func (c *Client) GetCn38ListGenerated(page int) (*Cn38DepartureList, error) {

if page > 0 {
sendRequest.Page = IntPtr(page)
err = c.Get(cn38ListsGenerated, sendRequest, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsGenerated, sendRequest, nil, newCn38RequestReturn)
} else {
err = c.Get(cn38ListsGenerated, nil, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsGenerated, nil, nil, newCn38RequestReturn)
}

return newCn38RequestReturn, err
Expand All @@ -174,6 +174,6 @@ func (c *Client) GetCn38ListGeneratedByInvoice(cn38Number string) (*Cn38Itens, e

var err error
newCn38RequestReturn := &Cn38Itens{}
err = c.Get(cn38ListsGenerated+"/"+cn38Number, nil, nil, newCn38RequestReturn, "JSON", "")
err = c.Get(cn38ListsGenerated+"/"+cn38Number, nil, nil, newCn38RequestReturn)
return newCn38RequestReturn, err
}
2 changes: 1 addition & 1 deletion departure.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ func (n Departure) Error() string {
}

func (c *Client) PutDepartureConfirmation(dep *Departure) (*Departure, error) {
err := c.Put(departure, dep, nil, departure, "JSON", "")
err := c.Put(departure, dep, nil, departure)
return dep, err
}
8 changes: 4 additions & 4 deletions exporta_facil_rastro.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c *Client) GetExpFacilRemessa(req *RastreamentoRemessaGet) ([]Rastreamento
}

rastRemess := []RastreamentoRemessaResult{}
err = c.Get(exportaFacilRemessa, req, nil, &rastRemess, "JSON", "")
err = c.Get(exportaFacilRemessa, req, nil, &rastRemess)
return rastRemess, err
}

Expand All @@ -92,20 +92,20 @@ func (c *Client) GetExpFacilEvento() ([]RastreamentoEventoResult, error) {
var err error

rastEvento := []RastreamentoEventoResult{}
err = c.Get(exportaFacilEventos, nil, nil, &rastEvento, "JSON", "")
err = c.Get(exportaFacilEventos, nil, nil, &rastEvento)
return rastEvento, err
}

func (c *Client) CancelExpFacilRastro(unitcodes *RastreamentoRemessaInputCancel) (*RastreamentoRemessaResponseCancel, error) {

newExpFacilRastroReturn := &RastreamentoRemessaResponseCancel{}
err := c.Put(exportaFacilRastros, unitcodes, nil, newExpFacilRastroReturn, "JSON", "")
err := c.Put(exportaFacilRastros, unitcodes, nil, newExpFacilRastroReturn)
return newExpFacilRastroReturn, err
}

func (c *Client) AddExpFacilRastro(unitcodes *RastreamentoRemessaInput) (*RastreamentoRemessaResponse, error) {

newExpFacilRastroReturn := &RastreamentoRemessaResponse{}
err := c.Post(exportaFacilRastros, unitcodes, nil, newExpFacilRastroReturn, "JSON", "")
err := c.Post(exportaFacilRastros, unitcodes, nil, newExpFacilRastroReturn)
return newExpFacilRastroReturn, err
}
Loading

0 comments on commit d74d1d8

Please sign in to comment.