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: "",
})
}