1
This commit is contained in:
@@ -16,6 +16,7 @@ const (
|
||||
AliPayPublicCertPath = "./config/alipayCertPublicKey_RSA2.crt" // 支付宝公钥证书文件路径
|
||||
aliPayRootCertPath = "./config/alipayRootCert.crt" // 支付宝根证书文件路径
|
||||
appCertPath = "./config/appCertPublicKey_2019110769024042.crt" // 应用公钥证书路径
|
||||
MinWithdrawalMoney = 500 // 最小提现金额,不用审核
|
||||
)
|
||||
|
||||
// WithdrawalSystemParam 支付包创建提现操作,系统参数
|
||||
@@ -39,9 +40,6 @@ type WithdrawalParam struct {
|
||||
BizScene string `json:"biz_scene"` // 业务场景。单笔无密转账固定为 DIRECT_TRANSFER。
|
||||
OrderTitle string `json:"order_title"` // 转账业务的标题,用于在支付宝用户的账单里显示。
|
||||
PayeeInfo *PayeeInfoParam `json:"payee_info"` // 收款方信息
|
||||
//AppCertSN string `json:"app_cert_sn"` // 支付宝应用证书
|
||||
//AliPayPublicCertSN string `json:"ali_pay_public_cert_sn"` // 支付宝公钥证书
|
||||
//AliPayRootCertSN string `json:"ali_pay_root_cert_sn"` // 支付宝根证书
|
||||
// 可选参数
|
||||
Remark string `json:"remark"` // 业务备注。
|
||||
}
|
||||
@@ -53,8 +51,17 @@ type PayeeInfoParam struct {
|
||||
Name string `json:"name"` // 参与方真实姓名。如果非空,将校验收款支付宝账号姓名一致性。 当 identity_type=ALIPAY_LOGON_ID 时,本字段必填。若传入该属性,则在支付宝回单中将会显示这个属性。
|
||||
}
|
||||
|
||||
type Withdrawal4AliPayRes struct {
|
||||
Code string `json:"code"` // code值
|
||||
Msg string `json:"msg"` // 返回消息
|
||||
OrderId string `json:"order_id"` // 支付宝订单Id
|
||||
OutBizNo string `json:"out_biz_no"` // 本地Id
|
||||
Status string `json:"status"` // 支付状态
|
||||
TransDate string `json:"trans_date"` // 成功日期
|
||||
}
|
||||
|
||||
// Withdrawal4AliPay 单笔转账接口,公司转账给个人
|
||||
func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (map[string]interface{}, error) {
|
||||
func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (*Withdrawal4AliPayRes, error) {
|
||||
if param.PayeeInfo.Identity == "" || param.PayeeInfo.Name == "" {
|
||||
return nil, errors.New("支付宝关联电话和用户正式姓名不能为空")
|
||||
}
|
||||
@@ -77,7 +84,13 @@ func (a *API) Withdrawal4AliPay(param *WithdrawalParam) (map[string]interface{},
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
|
||||
data := &Withdrawal4AliPayRes{}
|
||||
if err := utils.Map2StructByJson(result, data, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// SetCertSnByPath 通过应用公钥证书路径设置 app_cert_sn、alipay_root_cert_sn、alipay_cert_sn
|
||||
|
||||
Reference in New Issue
Block a user