Documentation
¶
Index ¶
- Constants
- Variables
- func SignHMACSHA256(params Parameter, key []byte) string
- func SignMD5(params Parameter) string
- type CDATA
- type Client
- func (c *Client) Config() Config
- func (c *Client) PromotionTransfers(req *PromotionTransfersRequest) (resp *PromotionTransfersResponse, err error)
- func (c *Client) SendGroupRedPack(req *SendGroupRedPackRequest) (resp *SendGroupRedPackResponse, err error)
- func (c *Client) SendRedPack(req *SendRedPackRequest) (resp *SendRedPackResponse, err error)
- func (c *Client) UnifiedOrder(req *UnifiedOrderRequest) (resp *UnifiedOrderResponse, err error)
- type Clienter
- type Config
- type Parameter
- type PromotionTransfersRequest
- type PromotionTransfersResponse
- type ResponseReturn
- type ResponseStatus
- type SceneInfo
- type SendGroupRedPackRequest
- type SendGroupRedPackResponse
- type SendRedPackRequest
- type SendRedPackResponse
- type UnifiedOrderRequest
- type UnifiedOrderResponse
Constants ¶
const ( Fail = "FAIL" Success = "SUCCESS" Ok = "OK" HMACSHA256 = "HMAC-SHA256" MD5 = "MD5" TradeTypeJSApi = "JSAPI" TradeTypeNative = "NATIVE" TradeTypeApp = "APP" )
const ( // BaseURL ... BaseURL = "https://api.mch.weixin.qq.com" // Base2URL 备用域名 Base2URL = "https://api2.mch.weixin.qq.com" )
Variables ¶
var ( // ErrTypeIsNil ... ErrTypeIsNil = errors.New("类型为Nil") // ErrTypeUnknown ... ErrTypeUnknown = errors.New("未处理到的数据类型") )
var (
CallbackSuccessful = &ResponseReturn{Code: Success, Msg: Ok}
)
var ( // ErrNotEqualStruct ... ErrNotEqualStruct = errors.New("参数不是Struct类型") )
Functions ¶
func SignHMACSHA256 ¶
SignHMACSHA256 生成Sign HMACS-HA256
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 客户端
func (*Client) PromotionTransfers ¶
func (c *Client) PromotionTransfers(req *PromotionTransfersRequest) (resp *PromotionTransfersResponse, err error)
PromotionTransfers 企业向微信用户个人付款
func (*Client) SendGroupRedPack ¶
func (c *Client) SendGroupRedPack(req *SendGroupRedPackRequest) (resp *SendGroupRedPackResponse, err error)
SendGroupRedPack 发裂变红包
func (*Client) SendRedPack ¶
func (c *Client) SendRedPack(req *SendRedPackRequest) (resp *SendRedPackResponse, err error)
SendRedPack 发现金红包
func (*Client) UnifiedOrder ¶
func (c *Client) UnifiedOrder(req *UnifiedOrderRequest) (resp *UnifiedOrderResponse, err error)
UnifiedOrder 统一下单
type Clienter ¶
type Clienter interface {
Config() Config
UnifiedOrder(req *UnifiedOrderRequest) (resp *UnifiedOrderResponse, err error)
}
Clienter ...
type Config ¶
type Config struct {
BaseURL string `json:"base_url"`
AppID string `json:"app_id"`
MchID string `json:"mch_id"`
APIKey string `json:"api_key"`
SignType string `json:"sign_type"`
SignKey string `json:"sign_key"`
NotifyURL string `json:"notify_url"`
CaCertFile string `json:"ca_cert_file"`
CaKeyFile string `json:"ca_key_file"`
HttpProxy string `json:"http_proxy"`
}
Config ...
type Parameter ¶
type Parameter map[string]interface{}
Parameter 参数
func SignStructToParameter ¶
SignStructToParameter ...
type PromotionTransfersRequest ¶
type PromotionTransfersRequest struct {
XMLName xml.Name `xml:"xml"`
MchAppID string `xml:"mch_appid"`
MchID string `xml:"mchid"`
DeviceInfo string `xml:"device_info"`
NonceStr string `xml:"nonce_str"`
Sign string `xml:"sign"`
PartnerTradeNo string `xml:"partner_trade_no"`
OpenID string `xml:"openid"`
CheckName string `xml:"check_name"`
ReUserName string `xml:"re_user_name"`
Amount int `xml:"amount"`
Desc string `xml:"desc"`
SpbillCreateIP string `xml:"spbill_create_ip"`
}
PromotionTransfersRequest 企业向微信用户个人付款请求
func NewPromotionTransfersRequest ¶
func NewPromotionTransfersRequest() *PromotionTransfersRequest
NewPromotionTransfersRequest 创建企业向微信用户个人付款请求
func (*PromotionTransfersRequest) SignMD5 ¶
func (req *PromotionTransfersRequest) SignMD5(apiKey string) error
SignMD5 md5
type PromotionTransfersResponse ¶
type PromotionTransfersResponse struct {
ResponseStatus
MchAppID string `xml:"mch_appid"`
MchID string `xml:"mchid"`
DeviceInfo string `xml:"device_info"`
NonceStr string `xml:"nonce_str"`
PartnerTradeNo string `xml:"partner_trade_no"`
PaymentNo string `xml:"payment_no"`
PaymentTime string `xml:"payment_time"`
}
PromotionTransfersResponse 企业向微信用户个人付款响应
type ResponseReturn ¶
type ResponseReturn struct {
XMLName xml.Name `xml:"xml"`
Code CDATA `xml:"return_code"`
Msg CDATA `xml:"return_msg"`
}
ResponseReturn 成功
type ResponseStatus ¶
type ResponseStatus 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"`
}
ResponseStatus 响应状态
type SceneInfo ¶
type SceneInfo struct {
ID string `json:"id"`
Name string `json:"name"`
AreaCode string `json:"area_code"`
Address string `json:"address"`
}
SceneInfo 场景信息
type SendGroupRedPackRequest ¶
type SendGroupRedPackRequest struct {
XMLName xml.Name `xml:"xml"`
NonceStr string `xml:"nonce_str"`
Sign string `xml:"sign"`
MchBillno string `xml:"mch_billno"`
MchID string `xml:"mch_id"`
WxAppID string `xml:"wxappid"`
SendName string `xml:"send_name"`
ReOpenID string `xml:"re_openid"`
TotalAmount uint `xml:"total_amount"`
TotalNum uint `xml:"total_num"`
AmtType string `xml:"amt_type"`
Wishing string `xml:"wishing"`
ActName string `xml:"act_name"`
Remark string `xml:"remark"`
SceneID string `xml:"scene_id"`
RiskInfo string `xml:"risk_info"`
}
SendGroupRedPackRequest 发裂变红包
func NewSendGroupRedPackRequest ¶
func NewSendGroupRedPackRequest() *SendGroupRedPackRequest
NewSendGroupRedPackRequest 创建裂变红包
func (*SendGroupRedPackRequest) SignMD5 ¶
func (req *SendGroupRedPackRequest) SignMD5(apiKey string) error
SignMD5 md5
type SendGroupRedPackResponse ¶
type SendGroupRedPackResponse struct {
ResponseStatus
MchBillno string `xml:"mch_billno"`
MchID string `xml:"mch_id"`
WxAppID string `xml:"wxappid"`
ReOpenID string `xml:"re_openid"`
TotalAmount uint `xml:"total_amount"`
SendListID string `xml:"send_listid"`
}
SendGroupRedPackResponse ...
type SendRedPackRequest ¶
type SendRedPackRequest struct {
XMLName xml.Name `xml:"xml"`
NonceStr string `xml:"nonce_str"`
Sign string `xml:"sign"`
MchBillno string `xml:"mch_billno"`
MchID string `xml:"mch_id"`
WxAppID string `xml:"wxappid"`
SendName string `xml:"send_name"`
ReOpenID string `xml:"re_openid"`
TotalAmount uint `xml:"total_amount"`
TotalNum uint `xml:"total_num"`
Wishing string `xml:"wishing"`
ClientIP string `xml:"client_ip"`
ActName string `xml:"act_name"`
Remark string `xml:"remark"`
SceneID string `xml:"scene_id"`
RiskInfo string `xml:"risk_info"`
}
SendRedPackRequest 发红包
func NewSendRedPackRequest ¶
func NewSendRedPackRequest() *SendRedPackRequest
NewSendRedPackRequest 创建现金红包
func (*SendRedPackRequest) SignMD5 ¶
func (req *SendRedPackRequest) SignMD5(apiKey string) error
SignMD5 md5
type SendRedPackResponse ¶
type SendRedPackResponse struct {
ResponseStatus
MchBillno string `xml:"mch_billno"`
MchID string `xml:"mch_id"`
WxAppID string `xml:"wxappid"`
ReOpenID string `xml:"re_openid"`
TotalAmount uint `xml:"total_amount"`
SendListID string `xml:"send_listid"`
}
SendRedPackResponse ...
type UnifiedOrderRequest ¶
type UnifiedOrderRequest struct {
XMLName xml.Name `xml:"xml"`
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"`
Body string `xml:"body"`
Detail CDATA `xml:"detail"`
Attach string `xml:"attach"`
OutTradeNo string `xml:"out_trade_no"`
FeeType string `xml:"fee_type"`
TotalFee uint64 `xml:"total_fee"`
SpbillCreateIP string `xml:"spbill_create_ip"`
TimeStart string `xml:"time_start"`
TimeExpire string `xml:"time_expire"`
GoodsTag string `xml:"goods_tag"`
NotifyURL string `xml:"notify_url"`
TradeType string `xml:"trade_type"`
ProductID string `xml:"product_id"`
LimitPay string `xml:"limit_pay"`
OpenID string `xml:"openid"`
Receipt string `xml:"receipt"`
SceneInfo string `xml:"scene_info"`
}
UnifiedOrderRequest 统一支付
func NewUnifiedOrderRequest ¶
func NewUnifiedOrderRequest() *UnifiedOrderRequest
NewUnifiedOrderRequest 创建统一支付
func (*UnifiedOrderRequest) SignHMACSHA256 ¶
func (req *UnifiedOrderRequest) SignHMACSHA256(key []byte, apiKey string) error
SignHMACSHA256 HMACS-HA256
func (*UnifiedOrderRequest) SignMD5 ¶
func (req *UnifiedOrderRequest) SignMD5(apiKey string) error
SignMD5 md5
type UnifiedOrderResponse ¶
type UnifiedOrderResponse struct {
ResponseStatus
TradeType string `xml:"trade_type"`
PrepayID string `xml:"prepay_id"`
CodeURL string `xml:"code_url"`
}
UnifiedOrderResponse ...