From 014f59b059f4db9719ad6ee9886e16a10eb2c22c Mon Sep 17 00:00:00 2001 From: Jerry <85411418@qq.com> Date: Sat, 9 Nov 2024 22:41:23 +0800 Subject: [PATCH] alipay v3 add api --- alipay/v3/constant.go | 19 ++++ alipay/v3/fund_auth_api.go | 118 +++++++++++++++++++++++ alipay/v3/member_api.go | 180 +++++++++++++++++++++++++++++++++++ alipay/v3/model_fund_auth.go | 83 ++++++++++++++++ alipay/v3/model_member.go | 64 +++++++++++++ alipay/v3/payment_api.go | 18 ++-- doc/alipay_v3.md | 12 ++- 7 files changed, 484 insertions(+), 10 deletions(-) create mode 100644 alipay/v3/fund_auth_api.go create mode 100644 alipay/v3/member_api.go create mode 100644 alipay/v3/model_fund_auth.go create mode 100644 alipay/v3/model_member.go diff --git a/alipay/v3/constant.go b/alipay/v3/constant.go index 54bd3738..156f50ea 100644 --- a/alipay/v3/constant.go +++ b/alipay/v3/constant.go @@ -62,4 +62,23 @@ const ( v3FundAuthOrderUnfreeze = "/v3/alipay/fund/auth/order/unfreeze" // 资金授权解冻接口 v3FundAuthOrderVoucherCreate = "/v3/alipay/fund/auth/order/voucher/create" // 资金授权发码接口 + // 会员 + v3UserCertifyOpenQuery = "/v3/alipay/user/certify/open/query" // 身份认证记录查询 + v3UserCertifyOpenInitialize = "/v3/alipay/user/certify/open/initialize" // 身份认证初始化服务 + v3SystemOauthToken = "/v3/alipay/system/oauth/token" // 换取授权访问令牌 + v3UserInfoShare = "/v3/alipay/user/info/share" // 支付宝会员授权信息查询接口 + v3UserAuthRelationshipQuery = "/v3/alipay/open/auth/userauth/relationship/query" // 用户授权关系查询 + v3UserDelOauthDetailQuery = "/v3/alipay/user/deloauth/detail/query" // 查询解除授权明细 + v3FaceVerificationInitialize = "/v3/datadigital/fincloud/generalsaas/face/verification/initialize" // 人脸核身初始化 + v3FaceVerificationQuery = "/v3/datadigital/fincloud/generalsaas/face/verification/query" // 人脸核身结果查询 + v3FaceCertifyInitialize = "/v3/datadigital/fincloud/generalsaas/face/certify/initialize" // 跳转支付宝人脸核身初始化 + v3FaceCertifyVerify = "/v3/datadigital/fincloud/generalsaas/face/certify/verify" // 跳转支付宝人脸核身开始认证 + v3FaceCertifyQuery = "/v3/datadigital/fincloud/generalsaas/face/certify/query" // 跳转支付宝人脸核身查询记录 + v3FaceSourceCertify = "/v3/datadigital/fincloud/generalsaas/face/source/certify" // 纯服务端人脸核身 + v3FaceCheckInitialize = "/v3/datadigital/fincloud/generalsaas/face/check/initialize" // 活体检测初始化 + v3FaceCheckQuery = "/v3/datadigital/fincloud/generalsaas/face/check/query" // 活体检测结果查询 + v3IdCardTwoMetaCheck = "/v3/datadigital/fincloud/generalsaas/twometa/check" // 身份证二要素核验 + v3BankCardCheck = "/v3/datadigital/fincloud/generalsaas/bankcard/check" // 银行卡核验 + v3OcrServerDetect = "/v3/datadigital/fincloud/generalsaas/ocr/server/detect" // 服务端OCR + v3OcrMobileInitialize = "/v3/datadigital/fincloud/generalsaas/ocr/mobile/initialize" // App端OCR初始化 ) diff --git a/alipay/v3/fund_auth_api.go b/alipay/v3/fund_auth_api.go new file mode 100644 index 00000000..2ae3e4b1 --- /dev/null +++ b/alipay/v3/fund_auth_api.go @@ -0,0 +1,118 @@ +package alipay + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "github.com/go-pay/gopay" +) + +// 资金授权操作查询接口 +// StatusCode = 200 is success +func (a *ClientV3) FundAuthOperationDetailQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *FundAuthOperationDetailQueryRsp, err error) { + authorization, err := a.authorization(MethodPost, v3FundAuthOperationDetailQuery, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3FundAuthOperationDetailQuery, authorization) + if err != nil { + return nil, err + } + aliRsp = &FundAuthOperationDetailQueryRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 资金授权冻结接口 +// StatusCode = 200 is success +func (a *ClientV3) FundAuthOrderFreeze(ctx context.Context, bm gopay.BodyMap) (aliRsp *FundAuthOrderFreezeRsp, err error) { + err = bm.CheckEmptyError("auth_code", "auth_code_type", "out_order_no", "out_request_no", "order_title", "product_code", "amount") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3FundAuthOrderFreeze, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3FundAuthOrderFreeze, authorization) + if err != nil { + return nil, err + } + aliRsp = &FundAuthOrderFreezeRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 资金授权解冻接口 +// StatusCode = 200 is success +func (a *ClientV3) FundAuthOrderUnfreeze(ctx context.Context, bm gopay.BodyMap) (aliRsp *FundAuthOrderUnfreezeRsp, err error) { + err = bm.CheckEmptyError("auth_no", "out_request_no", "amount", "remark") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3FundAuthOrderUnfreeze, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3FundAuthOrderUnfreeze, authorization) + if err != nil { + return nil, err + } + aliRsp = &FundAuthOrderUnfreezeRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 资金授权发码接口 +// StatusCode = 200 is success +func (a *ClientV3) FundAuthOrderVoucherCreate(ctx context.Context, bm gopay.BodyMap) (aliRsp *FundAuthOrderVoucherCreateRsp, err error) { + err = bm.CheckEmptyError("out_order_no", "out_request_no", "order_title", "amount", "product_code") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3FundAuthOrderVoucherCreate, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3FundAuthOrderVoucherCreate, authorization) + if err != nil { + return nil, err + } + aliRsp = &FundAuthOrderVoucherCreateRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} diff --git a/alipay/v3/member_api.go b/alipay/v3/member_api.go new file mode 100644 index 00000000..067f561f --- /dev/null +++ b/alipay/v3/member_api.go @@ -0,0 +1,180 @@ +package alipay + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + + "github.com/go-pay/gopay" +) + +// 换取授权访问令牌 +// StatusCode = 200 is success +func (a *ClientV3) SystemOauthToken(ctx context.Context, bm gopay.BodyMap) (aliRsp *SystemOauthTokenRsp, err error) { + err = bm.CheckEmptyError("grant_type") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3SystemOauthToken, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3SystemOauthToken, authorization) + if err != nil { + return nil, err + } + aliRsp = &SystemOauthTokenRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 身份认证记录查询 +// StatusCode = 200 is success +func (a *ClientV3) UserCertifyOpenQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *UserCertifyOpenQueryRsp, err error) { + err = bm.CheckEmptyError("certify_id") + if err != nil { + return nil, err + } + uri := v3UserCertifyOpenQuery + "?" + bm.EncodeURLParams() + authorization, err := a.authorization(MethodGet, uri, nil) + if err != nil { + return nil, err + } + res, bs, err := a.doGet(ctx, uri, authorization) + if err != nil { + return nil, err + } + aliRsp = &UserCertifyOpenQueryRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 身份认证初始化服务 +// StatusCode = 200 is success +func (a *ClientV3) UserCertifyOpenInitialize(ctx context.Context, bm gopay.BodyMap) (aliRsp *UserCertifyOpenInitializeRsp, err error) { + err = bm.CheckEmptyError("outer_order_no", "biz_code", "identity_param") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3UserCertifyOpenInitialize, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3UserCertifyOpenInitialize, authorization) + if err != nil { + return nil, err + } + aliRsp = &UserCertifyOpenInitializeRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 支付宝会员授权信息查询接口 +// StatusCode = 200 is success +func (a *ClientV3) UserInfoShare(ctx context.Context, bm gopay.BodyMap) (aliRsp *UserInfoShareRsp, err error) { + err = bm.CheckEmptyError("avatar", "city", "nick_name", "province") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3UserInfoShare, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3UserInfoShare, authorization) + if err != nil { + return nil, err + } + aliRsp = &UserInfoShareRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 用户授权关系查询 +// StatusCode = 200 is success +func (a *ClientV3) UserAuthRelationshipQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *UserAuthRelationshipQueryRsp, err error) { + err = bm.CheckEmptyError("scopes") + if err != nil { + return nil, err + } + uri := v3UserAuthRelationshipQuery + "?" + bm.EncodeURLParams() + authorization, err := a.authorization(MethodGet, uri, nil) + if err != nil { + return nil, err + } + res, bs, err := a.doGet(ctx, uri, authorization) + if err != nil { + return nil, err + } + aliRsp = &UserAuthRelationshipQueryRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} + +// 查询解除授权明细 +// StatusCode = 200 is success +func (a *ClientV3) UserDelOauthDetailQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *UserDelOauthDetailQueryRsp, err error) { + err = bm.CheckEmptyError("date", "limit", "offset") + if err != nil { + return nil, err + } + authorization, err := a.authorization(MethodPost, v3UserDelOauthDetailQuery, bm) + if err != nil { + return nil, err + } + res, bs, err := a.doPost(ctx, bm, v3UserDelOauthDetailQuery, authorization) + if err != nil { + return nil, err + } + aliRsp = &UserDelOauthDetailQueryRsp{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)) + } + return aliRsp, a.autoVerifySignByCert(res, bs) +} diff --git a/alipay/v3/model_fund_auth.go b/alipay/v3/model_fund_auth.go new file mode 100644 index 00000000..76911aaa --- /dev/null +++ b/alipay/v3/model_fund_auth.go @@ -0,0 +1,83 @@ +package alipay + +type FundAuthOperationDetailQueryRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + AuthNo string `json:"auth_no"` + OutOrderNo string `json:"out_order_no"` + OrderStatus string `json:"order_status"` + TotalFreezeAmount string `json:"total_freeze_amount"` + RestAmount string `json:"rest_amount"` + TotalPayAmount string `json:"total_pay_amount"` + OrderTitle string `json:"order_title"` + PayerLogonId string `json:"payer_logon_id"` + PayerUserId string `json:"payer_user_id"` + PayerOpenId string `json:"payer_open_id"` + ExtraParam string `json:"extra_param"` + OperationId string `json:"operation_id"` + OutRequestNo string `json:"out_request_no"` + Amount string `json:"amount"` + OperationType string `json:"operation_type"` + Status string `json:"status"` + Remark string `json:"remark"` + GmtCreate string `json:"gmt_create"` + GmtTrans string `json:"gmt_trans"` + PreAuthType string `json:"pre_auth_type"` + TransCurrency string `json:"trans_currency"` + TotalFreezeCreditAmount string `json:"total_freeze_credit_amount"` + TotalFreezeFundAmount string `json:"total_freeze_fund_amount"` + TotalPayCreditAmount string `json:"total_pay_credit_amount"` + TotalPayFundAmount string `json:"total_pay_fund_amount"` + RestCreditAmount string `json:"rest_credit_amount"` + RestFundAmount string `json:"rest_fund_amount"` + CreditAmount string `json:"credit_amount"` + FundAmount string `json:"fund_amount"` + CreditMerchantExt string `json:"credit_merchant_ext"` +} + +type FundAuthOrderFreezeRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + AuthNo string `json:"auth_no"` + OutOrderNo string `json:"out_order_no"` + OperationId string `json:"operation_id"` + OutRequestNo string `json:"out_request_no"` + Amount string `json:"amount"` + PayerUserId string `json:"payer_user_id"` + PayerOpenId string `json:"payer_open_id"` + Status string `json:"status"` + PayerLogonId string `json:"payer_logon_id"` + GmtTrans string `json:"gmt_trans"` + PreAuthType string `json:"pre_auth_type"` + TransCurrency string `json:"trans_currency"` + CreditAmount string `json:"credit_amount"` + FundAmount string `json:"fund_amount"` +} + +type FundAuthOrderUnfreezeRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + AuthNo string `json:"auth_no"` + OutOrderNo string `json:"out_order_no"` + OperationId string `json:"operation_id"` + OutRequestNo string `json:"out_request_no"` + Amount float64 `json:"amount"` + Status string `json:"status"` + GmtTrans string `json:"gmt_trans"` + CreditAmount float64 `json:"credit_amount"` + FundAmount float64 `json:"fund_amount"` +} + +type FundAuthOrderVoucherCreateRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + OutOrderNo string `json:"out_order_no"` + OutRequestNo string `json:"out_request_no"` + CodeType string `json:"code_type"` + CodeValue string `json:"code_value"` + CodeUrl string `json:"code_url"` +} diff --git a/alipay/v3/model_member.go b/alipay/v3/model_member.go new file mode 100644 index 00000000..85d7ceba --- /dev/null +++ b/alipay/v3/model_member.go @@ -0,0 +1,64 @@ +package alipay + +type SystemOauthTokenRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + UserId string `json:"user_id"` + OpenId string `json:"open_id"` + AccessToken string `json:"access_token"` + ExpiresIn string `json:"expires_in"` + RefreshToken string `json:"refresh_token"` + ReExpiresIn string `json:"re_expires_in"` + AuthStart string `json:"auth_start"` +} + +type UserCertifyOpenQueryRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + Passed string `json:"passed"` + IdentityInfo string `json:"identity_info"` + MaterialInfo string `json:"material_info"` + FailReason string `json:"fail_reason"` +} + +type UserCertifyOpenInitializeRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + CertifyId string `json:"certify_id"` +} + +type UserInfoShareRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + UserId string `json:"user_id"` + OpenId string `json:"open_id"` + Avatar string `json:"avatar"` + City string `json:"city"` + NickName string `json:"nick_name"` + Province string `json:"province"` + Gender string `json:"gender"` +} + +type UserAuthRelationshipQueryRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + QueryDetail string `json:"query_detail"` +} + +type UserDelOauthDetailQueryRsp struct { + StatusCode int `json:"status_code"` + ErrResponse ErrResponse `json:"-"` + + Details []*UserDelOauthDetail `json:"details"` +} + +type UserDelOauthDetail struct { + DelAuthTime string `json:"del_auth_time"` + UserId string `json:"user_id"` + OpenId string `json:"open_id"` +} diff --git a/alipay/v3/payment_api.go b/alipay/v3/payment_api.go index e8f611e8..600f9c22 100644 --- a/alipay/v3/payment_api.go +++ b/alipay/v3/payment_api.go @@ -11,7 +11,7 @@ import ( ) // 统一收单交易支付接口 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradePay(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradePayRsp, err error) { err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject", "auth_code", "scene") if err != nil { @@ -39,7 +39,7 @@ func (a *ClientV3) TradePay(ctx context.Context, bm gopay.BodyMap) (aliRsp *Trad } // 统一收单交易查询 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeQueryRsp, err error) { if bm.GetString("out_trade_no") == gopay.NULL && bm.GetString("trade_no") == gopay.NULL { return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time") @@ -66,7 +66,7 @@ func (a *ClientV3) TradeQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *Tr } // 统一收单交易退款接口 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeRefund(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeRefundRsp, err error) { err = bm.CheckEmptyError("refund_amount") if err != nil { @@ -97,7 +97,7 @@ func (a *ClientV3) TradeRefund(ctx context.Context, bm gopay.BodyMap) (aliRsp *T } // 统一收单交易退款查询 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeFastPayRefundQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeFastPayRefundQueryRsp, err error) { err = bm.CheckEmptyError("out_request_no") if err != nil { @@ -128,7 +128,7 @@ func (a *ClientV3) TradeFastPayRefundQuery(ctx context.Context, bm gopay.BodyMap } // 统一收单交易撤销接口 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeCancel(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeCancelRsp, err error) { if bm.GetString("out_trade_no") == gopay.NULL && bm.GetString("trade_no") == gopay.NULL { return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time") @@ -155,7 +155,7 @@ func (a *ClientV3) TradeCancel(ctx context.Context, bm gopay.BodyMap) (aliRsp *T } // 统一收单交易关闭接口 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeClose(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeCloseRsp, err error) { if bm.GetString("out_trade_no") == gopay.NULL && bm.GetString("trade_no") == gopay.NULL { return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time") @@ -182,7 +182,7 @@ func (a *ClientV3) TradeClose(ctx context.Context, bm gopay.BodyMap) (aliRsp *Tr } // 查询对账单下载地址 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) DataBillDownloadUrlQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *DataBillDownloadUrlQueryRsp, err error) { err = bm.CheckEmptyError("bill_type", "bill_date") if err != nil { @@ -211,7 +211,7 @@ func (a *ClientV3) DataBillDownloadUrlQuery(ctx context.Context, bm gopay.BodyMa } // 统一收单线下交易预创建 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradePrecreate(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradePrecreateRsp, err error) { err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject") if err != nil { @@ -239,7 +239,7 @@ func (a *ClientV3) TradePrecreate(ctx context.Context, bm gopay.BodyMap) (aliRsp } // 统一收单交易创建接口 -// Code = 200 is success +// StatusCode = 200 is success func (a *ClientV3) TradeCreate(ctx context.Context, bm gopay.BodyMap) (aliRsp *TradeCreateRsp, err error) { err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject", "product_code", "op_app_id") if err != nil { diff --git a/doc/alipay_v3.md b/doc/alipay_v3.md index 5261f446..e0c54f22 100644 --- a/doc/alipay_v3.md +++ b/doc/alipay_v3.md @@ -195,5 +195,15 @@ return c.String(http.StatusOK, "success") * 查询对账单下载地址:`client.DataBillDownloadUrlQuery()` * 统一收单线下交易预创建:`client.TradePrecreate()` * 统一收单交易创建接口:`client.TradeCreate()` - + * 资金授权操作查询接口:`client.FundAuthOperationDetailQuery()` + * 资金授权冻结接口:`client.FundAuthOrderFreeze()` + * 资金授权解冻接口:`client.FundAuthOrderUnfreeze()` + * 资金授权发码接口:`client.FundAuthOrderVoucherCreate()` +* 会员 + * 换取授权访问令牌:`client.SystemOauthToken()` + * 身份认证记录查询:`client.UserCertifyOpenQuery()` + * 身份认证初始化服务:`client.UserCertifyOpenInitialize()` + * 支付宝会员授权信息查询接口:`client.UserInfoShare()` + * 用户授权关系查询:`client.UserAuthRelationshipQuery()` + * 查询解除授权明细:`client.UserDelOauthDetailQuery()` ### 支付宝公共 API