Documentation ¶
Overview ¶
==================================
- Name:Jerry
- Tel:18017448610
- DateTime:2019/1/13 14:42
==================================
==================================
- Name:Jerry
- Tel:18017448610
- DateTime:2019/1/16 0:30
==================================
==================================
- Name:Jerry
- DateTime:2019/5/6 13:16
- Desc:
==================================
==================================
- Name:Jerry
- Tel:18017448610
- DateTime:2019/1/28 20:16
==================================
==================================
- Name:Jerry
- Tel:18017448610
- DateTime:2019/1/13 14:03
==================================
Index ¶
- Constants
- func Float32ToString(floatNum float32, prec ...int) (floatStr string)
- func Float64ToString(floatNum float64, prec ...int) (floatStr string)
- func FormatDate(dateStr string) (formatDate string)
- func FormatDateTime(timeStr string) (formatTime string)
- func GetMiniPaySign(appId, nonceStr, prepayId, signType, timeStamp, secretKey string) (paySign string)
- func GetRandomString(length int) string
- func Int2String(intNum int) (intStr string)
- func Int642String(intNum int64) (int64Str string)
- func NewAlipayClient(appId, mchId string, isProd bool, secretKey ...string) *aliPayClient
- func NewWeChatClient(appId, mchId, secretKey string, isProd bool) *weChatClient
- func ParseDateTime(timeStr string) (datetime time.Time)
- func String2Float(floatStr string) (floatNum float64)
- func String2Int(intStr string) (intNum int)
- func String2Int64(intStr string) (int64Num int64)
- type BodyMap
- type ReturnMessage
- type WeChatCloseOrderResponse
- type WeChatMicropayResponse
- type WeChatNotifyRequest
- type WeChatNotifyResponse
- type WeChatQueryOrderResponse
- type WeChatQueryRefundResponse
- type WeChatRefundResponse
- type WeChatReverseResponse
- type WeChatUnifiedOrderResponse
- type WeChatUserIdRsp
Constants ¶
View Source
const ( TimeLayout string = "2006-01-02 15:04:05" DateLayout string = "2006-01-02" //支付类型 TradeType_Mini = "JSAPI" TradeType_JsApi = "JSAPI" TradeType_App = "APP" TradeType_H5 = "MWEB" TradeType_Native = "NATIVE" //签名方式 SignType_MD5 = "MD5" SignType_HMAC_SHA256 = "HMAC-SHA256" )
View Source
const ( SUCCESS = "SUCCESS" FAIL = "FAIL" )
Variables ¶
This section is empty.
Functions ¶
func GetMiniPaySign ¶
func GetMiniPaySign(appId, nonceStr, prepayId, signType, timeStamp, secretKey string) (paySign string)
JSAPI支付,支付参数后,再次计算出小程序用的paySign
func NewAlipayClient ¶
初始化支付宝客户端
appId:应用ID mchID:商户ID isProd:是否是正式环境 secretKey:key,(当isProd为true时,此参数必传;false时,此参数为空)
Types ¶
type ReturnMessage ¶
type WeChatCloseOrderResponse ¶
type WeChatCloseOrderResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` DeviceInfo string `xml:"device_info"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` }
type WeChatMicropayResponse ¶
type WeChatMicropayResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` DeviceInfo string `xml:"device_info"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` Openid string `xml:"openid"` IsSubscribe string `xml:"is_subscribe"` TradeType string `xml:"trade_type"` BankType string `xml:"bank_type"` FeeType string `xml:"fee_type"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` CouponFee int `xml:"coupon_fee"` CashFeeType string `xml:"cash_fee_type"` CashFee int `xml:"cash_fee"` TransactionId string `xml:"transaction_id"` OutTradeNo string `xml:"out_trade_no"` Attach string `xml:"attach"` TimeEnd string `xml:"time_end"` PromotionDetail string `xml:"promotion_detail"` }
type WeChatNotifyRequest ¶
type WeChatNotifyRequest struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` DeviceInfo string `xml:"device_info"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` SignType string `xml:"sign_type"` Openid string `xml:"openid"` IsSubscribe string `xml:"is_subscribe"` TradeType string `xml:"trade_type"` BankType string `xml:"bank_type"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` FeeType string `xml:"fee_type"` CashFee int `xml:"cash_fee"` CashFeeType string `xml:"cash_fee_type"` CouponFee int `xml:"coupon_fee"` CouponCount int `xml:"coupon_count"` CouponType0 string `xml:"coupon_type_0"` CouponId0 string `xml:"coupon_id_0"` CouponFee0 int `xml:"coupon_fee_0"` TransactionId string `xml:"transaction_id"` OutTradeNo string `xml:"out_trade_no"` Attach string `xml:"attach"` TimeEnd string `xml:"time_end"` }
func ParseNotifyResult ¶
func ParseNotifyResult(req *http.Request) (notifyRsp *WeChatNotifyRequest, err error)
解析支付完成后的回调信息
type WeChatNotifyResponse ¶
type WeChatNotifyResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` }
func (*WeChatNotifyResponse) ToXmlString ¶
func (this *WeChatNotifyResponse) ToXmlString() (xmlStr string)
type WeChatQueryOrderResponse ¶
type WeChatQueryOrderResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` DeviceInfo string `xml:"device_info"` Openid string `xml:"openid"` IsSubscribe string `xml:"is_subscribe"` TradeType string `xml:"trade_type"` TradeState string `xml:"trade_state"` BankType string `xml:"bank_type"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` FeeType string `xml:"fee_type"` CashFee int `xml:"cash_fee"` CashFeeType string `xml:"cash_fee_type"` CouponFee int `xml:"coupon_fee"` CouponCount int `xml:"coupon_count"` CouponType0 string `xml:"coupon_type_0"` CouponId0 string `xml:"coupon_id_0"` CouponFee0 int `xml:"coupon_fee_0"` TransactionId string `xml:"transaction_id"` OutTradeNo string `xml:"out_trade_no"` Attach string `xml:"attach"` TimeEnd string `xml:"time_end"` TradeStateDesc string `xml:"trade_state_desc"` }
type WeChatQueryRefundResponse ¶
type WeChatQueryRefundResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` TotalRefundCount int `xml:"total_refund_count"` TransactionId string `xml:"transaction_id"` OutTradeNo string `xml:"out_trade_no"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` FeeType string `xml:"fee_type"` CashFee int `xml:"cash_fee"` RefundCount int `xml:"refund_count"` OutRefundNo0 string `xml:"out_refund_no_0"` RefundId0 string `xml:"refund_id_0"` RefundChannel0 string `xml:"refund_channel_0"` RefundFee0 int `xml:"refund_fee_0"` SettlementRefundFee0 int `xml:"settlement_refund_fee_0"` CouponType00 string `xml:"coupon_type_0_0"` CouponRefundFee0 int `xml:"coupon_refund_fee_0"` CouponRefundCount0 int `xml:"coupon_refund_count_0"` CouponRefundId00 string `xml:"coupon_refund_id_0_0"` CouponRefundFee00 int `xml:"coupon_refund_fee_0_0"` RefundStatus0 string `xml:"refund_status_0"` RefundAccount0 string `xml:"refund_account_0"` RefundRecvAccout0 string `xml:"refund_recv_accout_0"` RefundSuccessTime0 string `xml:"refund_success_time_0"` }
type WeChatRefundResponse ¶
type WeChatRefundResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` TransactionId string `xml:"transaction_id"` OutTradeNo string `xml:"out_trade_no"` OutRefundNo string `xml:"out_refund_no"` RefundId string `xml:"refund_id"` RefundFee int `xml:"refund_fee"` SettlementRefundFee int `xml:"settlement_refund_fee"` TotalFee int `xml:"total_fee"` SettlementTotalFee int `xml:"settlement_total_fee"` FeeType string `xml:"fee_type"` CashFee int `xml:"cash_fee"` CashFeeType string `xml:"cash_fee_type"` CashRefundFee int `xml:"cash_refund_fee"` CouponType0 string `xml:"coupon_type_0"` CouponRefundFee int `xml:"coupon_refund_fee"` CouponRefundFee0 int `xml:"coupon_refund_fee_0"` CouponRefundCount int `xml:"coupon_refund_count"` CouponRefundId0 string `xml:"coupon_refund_id_0"` }
type WeChatReverseResponse ¶
type WeChatReverseResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` Recall string `xml:"recall"` }
type WeChatUnifiedOrderResponse ¶
type WeChatUnifiedOrderResponse struct { ReturnCode string `xml:"return_code"` ReturnMsg string `xml:"return_msg"` Appid string `xml:"appid"` MchId string `xml:"mch_id"` DeviceInfo string `xml:"device_info"` NonceStr string `xml:"nonce_str"` Sign string `xml:"sign"` ResultCode string `xml:"result_code"` ErrCode string `xml:"err_code"` ErrCodeDes string `xml:"err_code_des"` TradeType string `xml:"trade_type"` PrepayId string `xml:"prepay_id"` CodeUrl string `xml:"code_url"` MwebUrl string `xml:"mweb_url"` }
type WeChatUserIdRsp ¶
type WeChatUserIdRsp struct { Openid string `json:"openid"` //用户唯一标识 SessionKey string `json:"session_key"` //会话密钥 Unionid string `json:"unionid"` //用户在开放平台的唯一标识符 ExpiresIn int `json:"expires_in"` // }
func GetWeChatUserId ¶
func GetWeChatUserId(appId, secretKey, wxCode string) (userRsp *WeChatUserIdRsp, err error)
获取微信用户的OpenId、SessionKey、UnionId
Click to show internal directories.
Click to hide internal directories.