1
This commit is contained in:
@@ -22,8 +22,10 @@ const (
|
||||
CmdShopUnbindMsg = "shop.unbind.msg"
|
||||
|
||||
//IM消息回调通知
|
||||
CmdImMessageSendEvent = "im.message.send.event" //用户/骑手消息通知
|
||||
CmdImMessageReadEvent = "im.message.read.event" //用户/骑手已读通知
|
||||
CmdImMessageSendEvent = "im.message.send.event" // 用户/骑手消息通知
|
||||
CmdImMessageReadEvent = "im.message.read.event" // 用户/骑手已读通知
|
||||
CmdImInvoicApply = "invoice.apply.push" // 用户发送发票申请
|
||||
CmdImInvoicEmail = "invoice.email.push" // 发票用户重发邮件
|
||||
|
||||
)
|
||||
|
||||
|
||||
114
platformapi/ebaiapi/invoice.go
Normal file
114
platformapi/ebaiapi/invoice.go
Normal file
@@ -0,0 +1,114 @@
|
||||
package ebaiapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
// UploadInvoice 上传发票回复
|
||||
func (a *API) UploadInvoice(baiduShopId, applicationNo, fileUrl string) (*UploadInvoiceResult, error) {
|
||||
param := &UpdateInvoice{
|
||||
BaiduShopId: baiduShopId,
|
||||
ShopId: "",
|
||||
RequestList: nil,
|
||||
}
|
||||
requestList := make([]ApplicationList, 0, 0)
|
||||
requestList = append(requestList, ApplicationList{
|
||||
ApplicationNo: applicationNo,
|
||||
Status: "",
|
||||
InvoiceList: nil,
|
||||
FileUrl: fileUrl,
|
||||
InvoiceClass: "",
|
||||
InvoiceCode: "",
|
||||
InvoiceDate: "",
|
||||
InvoiceMaterial: "",
|
||||
InvoiceNo: "",
|
||||
Memo: "",
|
||||
LineList: nil,
|
||||
MachineCode: "",
|
||||
SellerInfo: SellerInfo{},
|
||||
TaxAmount: "",
|
||||
ValidationCode: "",
|
||||
})
|
||||
param.RequestList = requestList
|
||||
|
||||
data, err := a.AccessAPI("invoice.apply.batchUpdate", utils.Struct2Map(param, "", false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if data.ErrNo != 0 {
|
||||
return nil, fmt.Errorf(data.Error)
|
||||
}
|
||||
result := &UploadInvoiceResult{}
|
||||
if err = utils.UnmarshalUseNumber(utils.MustMarshal(data.Data), result); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
type UploadInvoiceResult struct {
|
||||
SuccessfulApplicationNoList []string `json:"successful_application_no_list"`
|
||||
FailedApplicationNoList []string `json:"failed_application_no_list"`
|
||||
}
|
||||
|
||||
// UpdateInvoice 申请
|
||||
type UpdateInvoice struct {
|
||||
BaiduShopId string `json:"baidu_shop_id"`
|
||||
ShopId string `json:"shop_id"`
|
||||
RequestList []ApplicationList `json:"request_list"`
|
||||
}
|
||||
|
||||
type ApplicationList struct {
|
||||
ApplicationNo string `json:"application_no"`
|
||||
Status string `json:"status"`
|
||||
InvoiceList []InvoiceList `json:"buyer_title"`
|
||||
FileUrl string `json:"file_url"`
|
||||
InvoiceClass string `json:"invoice_class"`
|
||||
InvoiceCode string `json:"invoice_code"`
|
||||
InvoiceDate string `json:"invoice_date"`
|
||||
InvoiceMaterial string `json:"invoice_material"`
|
||||
InvoiceNo string `json:"invoice_no"`
|
||||
Memo string `json:"memo"`
|
||||
LineList []LineList `json:"line_list"`
|
||||
MachineCode string `json:"machine_code"`
|
||||
SellerInfo SellerInfo `json:"seller_info"`
|
||||
TaxAmount string `json:"tax_amount"`
|
||||
ValidationCode string `json:"validation_code"`
|
||||
}
|
||||
|
||||
type InvoiceList struct {
|
||||
AmountWithTax float64 `json:"amount_with_tax"`
|
||||
AmountWithoutTax float64 `json:"amount_without_tax"`
|
||||
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"`
|
||||
}
|
||||
}
|
||||
|
||||
type LineList struct {
|
||||
AmountWithoutTax float64 `json:"amount_without_tax"`
|
||||
CargoName string `json:"cargo_name"`
|
||||
CargoNo string `json:"cargo_no"`
|
||||
Quantity int `json:"quantity"`
|
||||
Specification string `json:"specification"`
|
||||
TaxAmount int `json:"tax_amount"`
|
||||
TaxRate float64 `json:"tax_rate"`
|
||||
Unit string `json:"unit"`
|
||||
UnitPrice float64 `json:"unit_price"`
|
||||
}
|
||||
type SellerInfo struct {
|
||||
BankAccount string `json:"bank_account"`
|
||||
BankName string `json:"bank_name"`
|
||||
Checker string `json:"checker"`
|
||||
Clerk string `json:"clerk"`
|
||||
Name string `json:"name"`
|
||||
Payee string `json:"payee"`
|
||||
RegisterAddress string `json:"register_address"`
|
||||
RegisterPhone string `json:"register_phone"`
|
||||
TaxPayerNum string `json:"tax_payer_num"`
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package ebaiapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -327,6 +328,7 @@ func (a *API) SkuCreate(trackInfo, shopID string, customSkuID int64, params map[
|
||||
KeyShopID: shopID,
|
||||
KeyCustomSkuID: customSkuID,
|
||||
}
|
||||
globals.SugarLogger.Debugf("----SkuCreate,params1 -- : %s", utils.Format4Output(params, false))
|
||||
if params["upc"] == nil {
|
||||
defParams["upc"] = "upc-" + utils.Int2Str(int(customSkuID))
|
||||
}
|
||||
@@ -337,6 +339,7 @@ func (a *API) SkuCreate(trackInfo, shopID string, customSkuID int64, params map[
|
||||
defParams["brand_name"] = "无" // 很狗血的是,你还必须填个无才行。。。
|
||||
}*/
|
||||
params = utils.MergeMaps(params, defParams)
|
||||
globals.SugarLogger.Debugf("----SkuCreate,params2 -- : %s", utils.Format4Output(params, false))
|
||||
result, err := a.AccessAPI2("sku.create", params, trackInfo)
|
||||
if err == nil && result.Data != nil {
|
||||
return utils.Interface2Int64WithDefault(result.Data.(map[string]interface{})[KeySkuID], 0), nil
|
||||
|
||||
@@ -328,7 +328,7 @@ func TestDeleteStoreSku(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteSku(t *testing.T) {
|
||||
shopId := "669283"
|
||||
shopId := "667410"
|
||||
param1 := &SkuListParams{
|
||||
Page: 1,
|
||||
PageSize: 100,
|
||||
|
||||
Reference in New Issue
Block a user