This commit is contained in:
邹宗楠
2025-08-05 16:20:28 +08:00
parent eb59d502e0
commit 28af82d606
6 changed files with 60 additions and 15 deletions

View File

@@ -328,7 +328,7 @@ func TestDeleteStoreSku(t *testing.T) {
}
func TestDeleteSku(t *testing.T) {
shopId := "102433"
shopId := "669283"
param1 := &SkuListParams{
Page: 1,
PageSize: 100,
@@ -358,4 +358,14 @@ func TestDeleteSku(t *testing.T) {
fmt.Println(data)
fmt.Println(err)
}
categoryList, _ := api.ShopCategoryGet(shopId)
for _, v := range categoryList {
if v.Children != nil {
for _, v2 := range v.Children {
api.ShopCategoryDelete(shopId, v2.CategoryID)
}
}
api.ShopCategoryDelete(shopId, v.CategoryID)
}
}

View File

@@ -144,7 +144,7 @@ type ClosePayMiniOrder struct {
}
// ScannerPayMicroPay 扫码枪扫码支付
func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (string, string, string, string, error) {
func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (*PayMicroPayResp, error) {
reqParameter := map[string]interface{}{
"req_data": utils.Struct2Map(param, "", false),
"version": Version3,
@@ -152,23 +152,23 @@ func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (string, string, string,
}
result, err := a.AccessAPISign(PayProdUrl, PayMicropayActive, http.MethodPost, "", reqParameter)
if err != nil {
return "", "", "", "", err
return nil, err
}
switch result["code"].(string) {
case PaySuccess, "BBS10000", "BBS11105":
bodyResult, err := json.Marshal(result["resp_data"])
if err != nil {
return "", "", "", "", err
return nil, err
}
resp := &PayMicroPayResp{}
if err = json.Unmarshal(bodyResult, resp); err != nil {
return "", "", "", "", err
return nil, err
}
return result["code"].(string), result["msg"].(string), resp.TradeNo, resp.LogNo, nil
return resp, nil
default:
return "", "", "", "", fmt.Errorf(result["msg"].(string))
return nil, fmt.Errorf(result["msg"].(string))
}
}

View File

@@ -57,3 +57,17 @@ func TestPayActive(t *testing.T) {
CompleteNotifyUrl: "",
})
}
func TestAggregateRefund(t *testing.T) {
api.AggregateRefund(&AggregateRefundReq{
MerchantNo: "822651059990E2S",
TermNo: "M3595962",
OutTradeNo: "111223344",
RefundAmount: "1",
RefundReason: "测试",
OriginOutTradeNo: "88492081389546",
OriginTradeNo: "",
OriginLogNo: "",
LocationInfo: LocationInfoObj{RequestIp: "192.168.255.132"},
})
}

View File

@@ -281,7 +281,7 @@ func (a *API) SeparateUnBind(param *SeparateUnBindReq) (string, error) {
}
// Separate 分账
func (a *API) Separate(param *OrderSeparateReq) (string, string, error) {
func (a *API) Separate(param *OrderSeparateReq) (*OrderSeparateResp, error) {
reqParameter := map[string]interface{}{
"req_data": utils.Struct2Map(param, "", false),
"version": Version,
@@ -289,24 +289,23 @@ func (a *API) Separate(param *OrderSeparateReq) (string, string, error) {
}
result, err := a.AccessAPISign(SeparateProd, SeparateOrder, http.MethodPost, "", reqParameter)
if err != nil {
return "", "", err
return nil, err
}
bodyResult, err := json.Marshal(result)
if err != nil {
return "", "", err
return nil, err
}
resp := &OrderSeparateResp{}
if err = json.Unmarshal(bodyResult, resp); err != nil {
return "", "", err
return nil, err
}
if resp.Code != SeparateSuccess {
return "", "", fmt.Errorf(resp.Msg)
return nil, fmt.Errorf(resp.Msg)
}
return resp.RespData.Status, resp.RespData.SeparateNo, nil
return resp, nil
}
// SeparateCancel 订单分账撤销

View File

@@ -68,6 +68,12 @@ const (
OTHERS // 其他
)
const (
SeparateType_SEPATRATE = "SEPARATE" // 分账
SeparateType_CANCEL = "CANCEL" // 分账撤销
Separate_FALLBACK = "FALLBACK" // 分账回退
)
// CreateSeparateReq 商户创建分账
type CreateSeparateReq struct {
Version string `json:"version"` //必传 String 8 接口版本号 1.0

View File

@@ -83,5 +83,21 @@ func TestAccountStatusQuery(t *testing.T) {
}
func TestSeparateQueryAmt(t *testing.T) {
api.SeparateQueryAmt("822651059990E2S", "20250731111111", "20250731")
api.SeparateQueryAmt("822651059990E2S", "66222324796612", "20250805")
}
//func TestSeparate(t *testing.T) {
// api.Separate(&OrderSeparateReq{
// MerchantNo: "822651059990E2S",
// LogNo: "66222324796612",
// LogDate: "20250805",
// OutSeparateNo: "983931822651059990E2",
// TotalAmt: "1",
// LklOrgNo: "983931",
// CalType: "0",
// NotifyUrl: CallbackLaKaLaSeparateUrl,
// RecvDatas: []RecvDatasParam{
// {RecvMerchantNo: ,RecvNo: ,SeparateValue: ,},
// },
// })
//}