1
This commit is contained in:
@@ -139,13 +139,19 @@ func TestRefundOrderQuery(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test1111(t *testing.T) {
|
func TestRefundOrder(t *testing.T) {
|
||||||
aa := []int{2, 4, 6, 8, 10, 12, 14}
|
param := &RefundOrderReq{
|
||||||
sum := 0
|
MerchantNo: "141804158",
|
||||||
for _, v := range aa {
|
TermNo: "M3595962",
|
||||||
if v%2 == 0 {
|
OutTradeNo: "88491738418134",
|
||||||
sum += v
|
RefundAmount: "10",
|
||||||
}
|
OriginBizType: "3",
|
||||||
|
OriginTradeDate: "20250801",
|
||||||
|
OriginLogNo: "",
|
||||||
|
OriginTradeNo: "",
|
||||||
|
OriginCardNo: "",
|
||||||
|
LocationInfo: nil,
|
||||||
|
RefundType: "",
|
||||||
}
|
}
|
||||||
fmt.Println(sum)
|
api.RefundOrder(param)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (a *API) AggregatePay(param *AggregatePayReq) (*AggregatePayResp, error) {
|
|||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AggregateRefund 主扫退款 (已经对接了一个了)
|
// AggregateRefund 聚合退款
|
||||||
func (a *API) AggregateRefund(param *AggregateRefundReq) (*AggregateRefundResp, error) {
|
func (a *API) AggregateRefund(param *AggregateRefundReq) (*AggregateRefundResp, error) {
|
||||||
reqParameter := map[string]interface{}{
|
reqParameter := map[string]interface{}{
|
||||||
"req_data": utils.Struct2Map(param, "", false),
|
"req_data": utils.Struct2Map(param, "", false),
|
||||||
|
|||||||
@@ -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) (string, string, string, 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,23 +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 "", "", "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyResult, err := json.Marshal(result)
|
bodyResult, err := json.Marshal(result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &OrderSeparateResp{}
|
resp := &OrderSeparateResp{}
|
||||||
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
if err = json.Unmarshal(bodyResult, resp); err != nil {
|
||||||
return "", "", err
|
return "", "", "", err
|
||||||
}
|
}
|
||||||
if resp.Code != SeparateSuccess {
|
if resp.Code != SeparateSuccess {
|
||||||
return "", "", fmt.Errorf(resp.Msg)
|
return "", "", "", fmt.Errorf(resp.Msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp.RespData.Status, resp.RespData.SeparateNo, nil
|
return resp.RespData.Status, resp.RespData.SeparateNo, resp.RespData.LogNo, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,3 +81,7 @@ func TestSaveAuthentication(t *testing.T) {
|
|||||||
func TestAccountStatusQuery(t *testing.T) {
|
func TestAccountStatusQuery(t *testing.T) {
|
||||||
api.AccountStatusQuery("ALIPAY", "2088770536505954", "822651059990E2S")
|
api.AccountStatusQuery("ALIPAY", "2088770536505954", "822651059990E2S")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSeparateQueryAmt(t *testing.T) {
|
||||||
|
api.SeparateQueryAmt("822651059990E2S", "20250731111111", "20250731")
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ func getTimeFromTimestamp(timeStamp int64) time.Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderGetOrderDetail(t *testing.T) {
|
func TestOrderGetOrderDetail(t *testing.T) {
|
||||||
result, err := api.OrderGetOrderDetail(2001664651373743860, false)
|
result, err := api.OrderGetOrderDetail(4001715692418465050, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user