This commit is contained in:
邹宗楠
2025-07-29 10:52:30 +08:00
parent 3285b9a816
commit c34cc86bba
5 changed files with 29 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"strings"
"time"
@@ -166,6 +167,7 @@ func (a *API) AccessAPISign(baseUrl, action, method string, pathParam string, bi
if err != nil {
return nil, err
}
globals.SugarLogger.Debugf("------Authorization:= %s", Authorization)
err = platformapi.AccessPlatformAPIWithRetry(a.client,
func() *http.Request {
var request *http.Request

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"net/http"
"time"
)
@@ -15,10 +16,13 @@ func (a *API) AggregatePay(param *AggregatePayReq) (*AggregatePayResp, error) {
"version": Version3,
"req_time": utils.Time2TimeStrByFormat(time.Now(), TimeFormat),
}
globals.SugarLogger.Debugf("-------AggregatePay := %s", utils.Format4Output(param, false))
result, err := a.AccessAPISign(PayProdUrl, PayActive, http.MethodPost, "", reqParameter)
if err != nil {
return nil, err
}
globals.SugarLogger.Debugf("-------result := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("-------err := %v", err)
if result["code"].(string) != PaySuccess {
return nil, fmt.Errorf(result["msg"].(string))

View File

@@ -20,3 +20,24 @@ func TestCardBin(t *testing.T) {
globals.SugarLogger.Debugf("result := %s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("result := %v", err)
}
func TestPayActive(t *testing.T) {
api.AggregatePay(&AggregatePayReq{
MerchantNo: "",
TermNo: "",
OutTradeNo: "",
AccountType: "",
TransType: "",
TotalAmount: "",
LocationInfo: LocationInfoObj{},
BusiMode: "",
Subject: "",
PayOrderNo: "",
NotifyUrl: "",
SettleType: "",
Remark: "",
PnrInsIdCd: "",
AccBusiFields: nil,
CompleteNotifyUrl: "",
})
}

View File

@@ -9,7 +9,7 @@ import (
)
// 京西速食(蔬菜)
var token1 = `{"access_token":"qj8llidmti1j7t4nq1hehos0000yhugi-11","expires_in":1753681285,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"h6sn7ppvrl1j7t4nq1hehos0000yhugi-12","authority_id":""}`
var token1 = `{"access_token":"stma20r0pv1j7t4nq1hehos0000yhugi-11","expires_in":1754283109,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"b6xg6c61a71j7t4nq1hehos0000yhugi-12","authority_id":""}`
// 美好菜市
//var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`

View File

@@ -55,7 +55,7 @@ func TestGetSkuDetail(t *testing.T) {
// 查询商品详情本地商品id
func TestGetSkuDetailLocalId(t *testing.T) {
data, err := a.GetSkuDetail("3592503538749683119", "")
data, err := a.GetSkuDetail("3765728861137010842", "")
fmt.Println(err)
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
}