-
Notifications
You must be signed in to change notification settings - Fork 2
/
statetax.go
56 lines (48 loc) · 1.91 KB
/
statetax.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package nfeio
import (
"encoding/json"
"fmt"
"time"
)
func (c *Client) GetStateTaxes(companyId string) (response StateTaxesResponse, err error) {
err = c.Get(fmt.Sprintf("companies/%s/statetaxes", companyId), nil, nil, &response)
return
}
func (c *Client) AddStateTax(companyId string, stateTax *StateTax) (response StateTaxResponse, err error) {
err = c.Post(fmt.Sprintf("companies/%s/statetaxes", companyId), Params{"stateTax": stateTax}, nil, &response)
return
}
func (c *Client) DeleteStateTax(companyId, stateTaxId string) (err error) {
err = c.Delete(fmt.Sprintf("companies/%s/statetaxes/%s", companyId, stateTaxId), nil, nil, nil)
return
}
type StateTaxResponse struct {
Data StateTax `json:"stateTax"`
}
type StateTaxesResponse struct {
Data []StateTax `json:"stateTaxes"`
}
type StateTax struct {
//request
Code string `json:"code,omitempty"`
EnvironmentType string `json:"environmentType,omitempty"`
TaxNumber string `json:"taxNumber,omitempty"`
SpecialTaxRegime string `json:"specialTaxRegime,omitempty"`
Serie json.Number `json:"serie,omitempty"`
Number json.Number `json:"number,omitempty"`
Type string `json:"type,omitempty"`
SecurityCredential *SecurityCredential `json:"securityCredential,omitempty"`
// response
Id string `json:"id,omitempty"`
CompanyId string `json:"companyId,omitempty"`
AccountId string `json:"accountId,omitempty"`
BatchId json.Number `json:"batchId,omitempty"`
Status string `json:"status,omitempty"`
Series []json.Number `json:"series,omitempty"`
CreatedOn *time.Time `json:"createdOn,omitempty"`
ModifiedOn *time.Time `json:"modifiedOn,omitempty"`
}
type SecurityCredential struct {
Id json.Number `json:"id,omitempty"`
Code string `json:"code,omitempty"`
}