-
Notifications
You must be signed in to change notification settings - Fork 1
/
status.go
64 lines (52 loc) · 1.62 KB
/
status.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
57
58
59
60
61
62
63
package popbill
import (
"fmt"
"net/http"
)
type Status struct {
Code int `json:"code"`
Message string `json:"message"`
InterOPYN bool `json:"interOPYN"`
InvoiceeCorpNum string `json:"invoiceeCorpNum"`
ItemKey string `json:"itemKey"`
SupplyCostTotal int `json:"supplyCostTotal,string"`
TaxTotal int `json:"taxTotal,string"`
RegDT string `json:"regDT"`
WriteDate string `json:"writeDate"`
IssueType string `json:"issueType"`
StateDT string `json:"stateDT"`
OpenYN bool `json:"openYN"`
TaxType string `json:"taxType"`
InvoicerCorpNum string `json:"invoicerCorpNum"`
InvoicerMgtKey string `json:"invoicerMgtKey"`
InvoicerCorpName string `json:"invoicerCorpName"`
InvoicerPrintYN bool `json:"invoicerPrintYN"`
InvoiceeCorpName string `json:"invoiceeCorpName"`
InvoiceePrintYN bool `json:"invoiceePrintYN"`
TrusteePrintYN bool `json:"trusteePrintYN"`
PurposeType string `json:"purposeType"`
LateIssueYN bool `json:"lateIssueYN"`
StateCode int `json:"stateCode"`
}
func (res *Status) GetCode() int {
return res.Code
}
func (res *Status) GetMessage() string {
return res.Message
}
func (res *Status) Error() string {
return res.Message
}
func (c *Client) CheckMgtKeyInUse(mgtKeyType, mgtKey string) (invoiceStatus *Status, err error) {
res, err := c.Request(
http.MethodGet,
TaxinvoiceService,
fmt.Sprintf("%s/%s", mgtKeyType, mgtKey),
"")
if err != nil {
return nil, err
}
invoiceStatus = &Status{}
err = res.ToJSON(invoiceStatus)
return invoiceStatus, err
}