Skip to content

Commit

Permalink
v1.5.108
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Jan 8, 2025
1 parent 44486c2 commit 3866a7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
4 changes: 2 additions & 2 deletions alipay/v3/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ func TestClientV3_Transfer(t *testing.T) {
Set("remark", "转账测试").
Set("business_params", struct{}{})

res, err := client.Transfer(ctx, bm)
res, err := client.FundTransUniTransfer(ctx, bm)
if err != nil {
xlog.Errorf("client.Transfer(), err:%v", err)
xlog.Errorf("client.FundTransUniTransfer(), err:%v", err)
return
}

Expand Down
12 changes: 12 additions & 0 deletions alipay/v3/model_transfer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package alipay

type FundTransUniTransferRsp struct {
StatusCode int `json:"status_code"`
ErrResponse ErrResponse `json:"-"`

OutBizNo string `json:"out_biz_no"` // 商户订单号
OrderId string `json:"order_id"` // 支付宝转账订单号
PayFundOrderId string `json:"pay_fund_order_id"` // 支付宝支付资金流水号
TransDate string `json:"trans_date"` // 订单支付时间
Status string `json:"status"`
}
33 changes: 5 additions & 28 deletions alipay/v3/transfer_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,33 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/go-pay/gopay"
"net/http"
)

// PayeeInfo 收款方信息
type PayeeInfo struct {
Identity string `json:"identity,omitempty"` // 必选
IdentityType string `json:"identity_type,omitempty"` // 必选
CertNo string `json:"cert_no,omitempty"` // 可选
CertType string `json:"cert_type,omitempty"` // 可选
Name string `json:"name,omitempty"` // 可选
}

type TransferRsp struct {
StatusCode int `json:"status_code"`
ErrResponse ErrResponse `json:"-"`

OutBizNo string `json:"out_biz_no"` // 商户订单号
OrderId string `json:"order_id"` // 支付宝转账订单号
PayFundOrderId string `json:"pay_fund_order_id"` // 支付宝支付资金流水号
TransDate string `json:"trans_date"` // 订单支付时间
Status string `json:"status"`
}
"github.com/go-pay/gopay"
)

// Transfer 单笔转账接口
// 单笔转账接口 alipay.fund.trans.uni.transfer
// StatusCode = 200 is success
func (a *ClientV3) Transfer(ctx context.Context, bm gopay.BodyMap) (aliRsp *TransferRsp, err error) {
func (a *ClientV3) FundTransUniTransfer(ctx context.Context, bm gopay.BodyMap) (aliRsp *FundTransUniTransferRsp, err error) {
err = bm.CheckEmptyError("out_biz_no", "trans_amount", "product_code", "biz_scene", "payee_info", "order_title")
if err != nil {
return nil, err
}

authorization, err := a.authorization(MethodPost, v3TransUniTransfer, bm)
if err != nil {
return nil, err
}

res, bs, err := a.doPost(ctx, bm, v3TransUniTransfer, authorization)
if err != nil {
return nil, err
}

aliRsp = &TransferRsp{StatusCode: res.StatusCode}
aliRsp = &FundTransUniTransferRsp{StatusCode: res.StatusCode}
if res.StatusCode != http.StatusOK {
if err = json.Unmarshal(bs, &aliRsp.ErrResponse); err != nil {
return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs))
}
return aliRsp, nil
}

if err = json.Unmarshal(bs, aliRsp); err != nil {
return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs))
}
Expand Down
1 change: 1 addition & 0 deletions release_note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(1) gopay:golang.org/x/crypto 版本升级到 v0.32.0。
(2) 微信V3:支持设置代理 Host 地址,client.SetProxyHost(),wechat.SetProxyHost()。
(3) 支付宝V3:支持设置代理 Host 地址,client.SetProxyHost()。
(4) 补充部分支付宝V3接口。

版本号:v1.5.107
修改记录:
Expand Down

0 comments on commit 3866a7f

Please sign in to comment.