1
This commit is contained in:
@@ -328,7 +328,7 @@ func TestDeleteStoreSku(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteSku(t *testing.T) {
|
func TestDeleteSku(t *testing.T) {
|
||||||
shopId := "102433"
|
shopId := "669283"
|
||||||
param1 := &SkuListParams{
|
param1 := &SkuListParams{
|
||||||
Page: 1,
|
Page: 1,
|
||||||
PageSize: 100,
|
PageSize: 100,
|
||||||
@@ -358,4 +358,14 @@ func TestDeleteSku(t *testing.T) {
|
|||||||
fmt.Println(data)
|
fmt.Println(data)
|
||||||
fmt.Println(err)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ type ClosePayMiniOrder struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ScannerPayMicroPay 扫码枪扫码支付
|
// ScannerPayMicroPay 扫码枪扫码支付
|
||||||
func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (string, string, string, string, error) {
|
func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (*PayMicroPayResp, error) {
|
||||||
reqParameter := map[string]interface{}{
|
reqParameter := map[string]interface{}{
|
||||||
"req_data": utils.Struct2Map(param, "", false),
|
"req_data": utils.Struct2Map(param, "", false),
|
||||||
"version": Version3,
|
"version": Version3,
|
||||||
@@ -152,23 +152,23 @@ func (a *API) ScannerPayMicroPay(param *PayMicroPayReq) (string, string, string,
|
|||||||
}
|
}
|
||||||
result, err := a.AccessAPISign(PayProdUrl, PayMicropayActive, http.MethodPost, "", reqParameter)
|
result, err := a.AccessAPISign(PayProdUrl, PayMicropayActive, http.MethodPost, "", reqParameter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch result["code"].(string) {
|
switch result["code"].(string) {
|
||||||
case PaySuccess, "BBS10000", "BBS11105":
|
case PaySuccess, "BBS10000", "BBS11105":
|
||||||
bodyResult, err := json.Marshal(result["resp_data"])
|
bodyResult, err := json.Marshal(result["resp_data"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &PayMicroPayResp{}
|
resp := &PayMicroPayResp{}
|
||||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
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:
|
default:
|
||||||
return "", "", "", "", fmt.Errorf(result["msg"].(string))
|
return nil, fmt.Errorf(result["msg"].(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,3 +57,17 @@ func TestPayActive(t *testing.T) {
|
|||||||
CompleteNotifyUrl: "",
|
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"},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ func (a *API) SeparateUnBind(param *SeparateUnBindReq) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Separate 分账
|
// Separate 分账
|
||||||
func (a *API) Separate(param *OrderSeparateReq) (string, string, error) {
|
func (a *API) Separate(param *OrderSeparateReq) (*OrderSeparateResp, error) {
|
||||||
reqParameter := map[string]interface{}{
|
reqParameter := map[string]interface{}{
|
||||||
"req_data": utils.Struct2Map(param, "", false),
|
"req_data": utils.Struct2Map(param, "", false),
|
||||||
"version": Version,
|
"version": Version,
|
||||||
@@ -289,24 +289,23 @@ func (a *API) Separate(param *OrderSeparateReq) (string, string, error) {
|
|||||||
}
|
}
|
||||||
result, err := a.AccessAPISign(SeparateProd, SeparateOrder, http.MethodPost, "", reqParameter)
|
result, err := a.AccessAPISign(SeparateProd, SeparateOrder, http.MethodPost, "", reqParameter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyResult, err := json.Marshal(result)
|
bodyResult, err := json.Marshal(result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &OrderSeparateResp{}
|
resp := &OrderSeparateResp{}
|
||||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||||
return "", "", err
|
return nil, err
|
||||||
}
|
}
|
||||||
if resp.Code != SeparateSuccess {
|
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 订单分账撤销
|
// SeparateCancel 订单分账撤销
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ const (
|
|||||||
OTHERS // 其他
|
OTHERS // 其他
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SeparateType_SEPATRATE = "SEPARATE" // 分账
|
||||||
|
SeparateType_CANCEL = "CANCEL" // 分账撤销
|
||||||
|
Separate_FALLBACK = "FALLBACK" // 分账回退
|
||||||
|
)
|
||||||
|
|
||||||
// CreateSeparateReq 商户创建分账
|
// CreateSeparateReq 商户创建分账
|
||||||
type CreateSeparateReq struct {
|
type CreateSeparateReq struct {
|
||||||
Version string `json:"version"` //必传 String 8 接口版本号 1.0
|
Version string `json:"version"` //必传 String 8 接口版本号 1.0
|
||||||
|
|||||||
@@ -83,5 +83,21 @@ func TestAccountStatusQuery(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSeparateQueryAmt(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: ,},
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user