diff --git a/platformapi/tiktok/refund.go b/platformapi/tiktok/refund.go index cfeb1993..49d293d3 100644 --- a/platformapi/tiktok/refund.go +++ b/platformapi/tiktok/refund.go @@ -27,7 +27,7 @@ type RefundOrderRes struct { // 抖音退款 func (a *API) RefundOrderTT(param *RefundOrderReq) (string, error) { param.Sign = a.Sign(utils.Struct2FlatMap(param)) - data, err := a.AccessAPI2(PayUrl, utils.Struct2FlatMap(param)) + data, err := a.AccessAPI2(RefundUrl, utils.Struct2FlatMap(param)) if err != nil { return "", err } @@ -41,3 +41,15 @@ func (a *API) RefundOrderTT(param *RefundOrderReq) (string, error) { } return result.RefundNo, nil } + +// 查询退款结果 +func (a *API) QueryRefundMsg() (map[string]interface{}, error) { + param := map[string]interface{}{"app_id": a.GetAppID(), "out_refund_no": "7105943473253206285"} + param["sign"] = a.Sign(param) + data, err := a.AccessAPI2("https://developer.toutiao.com/api/apps/ecpay/v1/query_refund", param) + if err != nil { + return nil, err + } + + return data, err +} diff --git a/platformapi/tiktok/tiktok_pay_model.go b/platformapi/tiktok/tiktok_pay_model.go index 75caff23..fa155fd1 100644 --- a/platformapi/tiktok/tiktok_pay_model.go +++ b/platformapi/tiktok/tiktok_pay_model.go @@ -1,7 +1,8 @@ package tiktok const ( - PayUrl = "https://developer.toutiao.com/api/apps/ecpay/v1/create_order" + PayUrl = "https://developer.toutiao.com/api/apps/ecpay/v1/create_order" + RefundUrl = "https://developer.toutiao.com/api/apps/ecpay/v1/create_refund" ) // OauthAccessTokenResData access_token diff --git a/platformapi/tiktok/tiktok_test.go b/platformapi/tiktok/tiktok_test.go index 3617e608..a5774a29 100644 --- a/platformapi/tiktok/tiktok_test.go +++ b/platformapi/tiktok/tiktok_test.go @@ -56,6 +56,7 @@ func TestFMT(t *testing.T) { fmt.Println(3&4 != 0) fmt.Println(3&2 != 0) fmt.Println(3&1 != 0) + fmt.Println(0&512 != 0) } func TestJieXi(t *testing.T) { @@ -70,3 +71,26 @@ func TestJieXi(t *testing.T) { fmt.Println("err==========", err2) fmt.Println("payInfo===", callback.PaymentOrderNo) } + +func TestRefund(t *testing.T) { + a := New("5c08a0465cf0f996af254a03b6c2548defef87ad ", "tta6a1d01c399f264201") + data, err := a.QueryRefundMsg() + fmt.Println(err) + fmt.Println(data) +} + +func TestSQRefund(t *testing.T) { + a := New("5c08a0465cf0f996af254a03b6c2548defef87ad ", "tta6a1d01c399f264201") + cc := &RefundOrderReq{ + AppID: a.GetAppID(), + OutOrderNo: "88392206436412", + OutRefundNo: "ceshi11100100044", + Reason: "协商一致", + RefundAmount: 99, + //CpExtra: "msg", + //NotifyURL: "jxc3.com", + } + aa, err := a.RefundOrderTT(cc) + fmt.Println(aa) + fmt.Println(err) +}