This commit is contained in:
邹宗楠
2026-06-24 09:34:16 +08:00
parent 3b37289dd5
commit 4844f494c6
3 changed files with 40 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ func TestInvoice(t *testing.T) {
} }
func TestQueryUnansweredInvoice(t *testing.T) { func TestQueryUnansweredInvoice(t *testing.T) {
api.QueryUnansweredInvoice("1306214718") api.QueryUnansweredInvoice("32267184083")
} }
func TestBathUpdateInvoiceSetting(t *testing.T) { func TestBathUpdateInvoiceSetting(t *testing.T) {

View File

@@ -200,7 +200,7 @@ type ResultList struct {
} }
// QueryUnansweredInvoice 查询门店未回复发票信息 // QueryUnansweredInvoice 查询门店未回复发票信息
func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoiceResult, error) { func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoiceResult2, error) {
data, err := a.AccessAPI("invoice.apply.list", map[string]interface{}{ data, err := a.AccessAPI("invoice.apply.list", map[string]interface{}{
"baidu_shop_id": baiDuStoreId, "baidu_shop_id": baiDuStoreId,
"status": "INIT", "status": "INIT",
@@ -213,7 +213,7 @@ func (a *API) QueryUnansweredInvoice(baiDuStoreId string) (*QueryUnansweredInvoi
if data.ErrNo != 0 { if data.ErrNo != 0 {
return nil, fmt.Errorf(data.Error) return nil, fmt.Errorf(data.Error)
} }
result := &QueryUnansweredInvoiceResult{} result := &QueryUnansweredInvoiceResult2{}
if err = utils.UnmarshalUseNumber(utils.MustMarshal(data.Data), result); err != nil { if err = utils.UnmarshalUseNumber(utils.MustMarshal(data.Data), result); err != nil {
return nil, err return nil, err
} }
@@ -230,6 +230,42 @@ type QueryUnansweredInvoiceResult struct {
// InvoiceApplyBody 用户申请发票body 消息推送接口 // InvoiceApplyBody 用户申请发票body 消息推送接口
type InvoiceApplyBody struct { type InvoiceApplyBody struct {
ApplicationNo string `json:"application_no"` // 申请单编号
BaiduShopId string `json:"baidu_shop_id"` // 平台门店ID与合作方门店ID至少有一个
ShopId string `json:"shop_id"` // 合作方门店ID与平台门店ID 至少有一个
InvoiceMaterial string `json:"invoice_material"` // 发票材质
InvoiceClass string `json:"invoice_class"` // 发票种类
Status string `json:"status"` // 申请状态,目前仅支持
BuyerTitle struct {
BankAccount string `json:"bank_account"` // 开户行账号
BankName string `json:"bank_name"` // 开户行名称
RegisterAddress string `json:"register_address"` // 注册地址
RegisterPhone string `json:"register_phone"` // 注册地址
TaxPayerNum string `json:"tax_payer_num"` // 纳税人识别号
TitleName string `json:"title_name"` // 抬头名称
TitleType string `json:"title_type"` // 抬头类型
} `json:"buyer_title"` // 购方信息
OrderList []struct {
CreateTime int64 `json:"create_time"`
InvoiceAmount float64 `json:"invoice_amount"`
OrderId string `json:"order_id"`
} `json:"order_list"`
BuyerContact struct {
Email string `json:"email"` // 邮箱
} `json:"buyer_contact"` // 购方用户联系信息
TotalInvoiceAmount float64 `json:"total_invoice_amount"` // 开票总金额,单位元
}
type QueryUnansweredInvoiceResult2 struct {
PageNo int `json:"page_no"` // 页码
PageSize int `json:"page_size"` // 每页条数
TotalCount int `json:"total_count"` // 总条数
TotalPage int `json:"total_page"` // 总页数
RecordList []*InvoiceApplyBody2 `json:"record_list"` // 申请单列表
}
// InvoiceApplyBody2 用户申请发票body 消息推送接口
type InvoiceApplyBody2 struct {
ApplicationNo string `json:"application_no"` // 申请单编号 ApplicationNo string `json:"application_no"` // 申请单编号
BaiduShopId string `json:"baidu_shop_id"` // 平台门店ID与合作方门店ID至少有一个 BaiduShopId string `json:"baidu_shop_id"` // 平台门店ID与合作方门店ID至少有一个
ShopId string `json:"shop_id"` // 合作方门店ID与平台门店ID 至少有一个 ShopId string `json:"shop_id"` // 合作方门店ID与平台门店ID 至少有一个

View File

@@ -193,6 +193,7 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http.
bodyMap = map[string]interface{}{ bodyMap = map[string]interface{}{
KeyData: bodyGeneral, KeyData: bodyGeneral,
} }
} }
errLevel, err = handleResponse(response, string(bodyData), bodyMap) errLevel, err = handleResponse(response, string(bodyData), bodyMap)
if err != nil && errLevel == ErrLevelRecoverableErr && parseJSONErr != nil { if err != nil && errLevel == ErrLevelRecoverableErr && parseJSONErr != nil {