wxpay

package
v1.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MchId = "1606577609"
View Source
const MchSecret = "G2ADlVDdTYeGs9MqLQrgKtfFwL5WhF8g"
View Source
const NotifyUrl = "https://api.pubcloud.vip/mall/pay/v1/wxPayCallback"

Variables

This section is empty.

Functions

func WxPayCalcSign

func WxPayCalcSign(mReq map[string]interface{}, key string) (sign string)

func WxSecondSign

func WxSecondSign(appId string, timeStamp string, nonceStr string, prepayId string) (string, error)

Types

type AmountData

type AmountData struct {
	Total    int    `json:"total"`              // 订单总金额,单位为分。
	Currency string `json:"currency,omitempty"` // CNY:人民币,境内商户号仅支持人民币。
}

type CloseOrderReq

type CloseOrderReq struct {
	AppId      string `xml:"appid"`
	MchId      string `xml:"mch_id"`
	NonceStr   string `xml:"nonce_str"`
	OutTradeNo string `xml:"out_trade_no"`
	Sign       string `xml:"sign"`
}

type DownloadBillReq

type DownloadBillReq struct {
	AppId    string `xml:"appid"`
	MchId    string `xml:"mch_id"`
	NonceStr string `xml:"nonce_str"`
	Sign     string `xml:"sign"`
	BillDate string `xml:"bill_date"`
}

type DownloadFundFlowReq

type DownloadFundFlowReq struct {
	AppId       string `xml:"appid"`
	MchId       string `xml:"mch_id"`
	NonceStr    string `xml:"nonce_str"`
	Sign        string `xml:"sign"`
	BillDate    string `xml:"bill_date"`
	AccountType string `xml:"account_type"`
}

type NativeData

type NativeData struct {
	Appid       string     `json:"appid"`                 // 由微信生成的应用ID,全局唯一。
	Mchid       string     `json:"mchid"`                 // 直连商户的商户号,由微信支付生成并下发。
	Description string     `json:"description"`           // 商品描述
	OutTradeNo  string     `json:"out_trade_no"`          // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
	TimeExpire  string     `json:"time_expire,omitempty"` // 订单失效时间 yyyy-MM-DDTHH:mm:ss+TIMEZONE
	Attach      string     `json:"attach,omitempty"`      // 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用,实际情况下只有支付完成状态才会返回该字段
	NotifyUrl   string     `json:"notify_url"`            // 知URL必须为直接可访问的URL
	GoodsTag    string     `json:"goods_tag,omitempty"`   // 订单优惠标记
	Amount      AmountData `json:"amount"`                // 订单金额信息
}

type NativeReponse

type NativeReponse struct {
	CodeUrl string `json:"code_url"`
}

type OrderQueryReq

type OrderQueryReq struct {
	AppId      string `xml:"appid"`
	MchId      string `xml:"mch_id"`
	NonceStr   string `xml:"nonce_str"`
	OutTradeNo string `xml:"out_trade_no"`
	Sign       string `xml:"sign"`
}

type RefundQueryReq

type RefundQueryReq struct {
	AppId      string `xml:"appid"`
	MchId      string `xml:"mch_id"`
	NonceStr   string `xml:"nonce_str"`
	OutTradeNo string `xml:"out_trade_no"`
	Sign       string `xml:"sign"`
}

type RefundReq

type RefundReq struct {
	AppId       string `xml:"appid"`
	MchId       string `xml:"mch_id"`
	NonceStr    string `xml:"nonce_str"`
	OutTradeNo  string `xml:"out_trade_no"`
	Sign        string `xml:"sign"`
	OutRefundNo string `xml:"out_refund_no"`
	TotalFee    int    `xml:"total_fee"`
	RefundFee   int    `xml:"refund_fee"`
}

type UnifyOrderReq

type UnifyOrderReq struct {
	AppId          string `xml:"appid"`
	Body           string `xml:"body"`
	MchId          string `xml:"mch_id"`
	NonceStr       string `xml:"nonce_str"`
	NotifyUrl      string `xml:"notify_url"`
	TradeType      string `xml:"trade_type"`
	SpBillCreateIp string `xml:"spbill_create_ip"`
	TotalFee       int    `xml:"total_fee"`
	OutTradeNo     string `xml:"out_trade_no"`
	Sign           string `xml:"sign"`
	OpenId         string `xml:"openid"`
}

type WxPayResponse

type WxPayResponse struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
	NonceStr   string `xml:"nonce_str"`
	PrepayId   string `xml:"prepay_id"`
	ResultCode string `xml:"result_code"`
	ErrCodeDes string `xml:"err_code_des"`

	//SUCCESS--支付成功
	//REFUND--转入退款
	//NOTPAY--未支付
	//CLOSED--已关闭
	//REVOKED--已撤销(刷卡支付)
	//USERPAYING--用户支付中
	//PAYERROR--支付失败(其他原因,如银行返回失败)
	//ACCEPT--已接收,等待扣款
	TradeState         string `xml:"trade_state"`
	OpenId             string `xml:"openid"`
	BankType           string `xml:"bank_type"`
	TotalFee           int    `xml:"total_fee"`
	TransactionId      string `xml:"transaction_id"`
	TimeEnd            string `xml:"time_end"`
	TradeStateDesc     string `xml:"trade_state_desc"`
	OutTradeNo         string `xml:"out_trade_no"`
	RefundCount        int    `xml:"refund_count"`
	OutRefundNo0       string `xml:"out_refund_no_0"`
	RefundFee0         int    `xml:"refund_fee_0"`
	RefundStatus0      string `xml:"refund_status_0"`
	RefundSuccessTime0 string `xml:"refund_success_time_0"`
}

func WxCloseOrder

func WxCloseOrder(appId string, orderCode string) (WxPayResponse, error)

func WxDownloadBill

func WxDownloadBill(appId string, billDate string) (WxPayResponse, error)

func WxDownloadFundFlow

func WxDownloadFundFlow(appId string, billDate string, accountType string) (WxPayResponse, error)

func WxOrderQuery

func WxOrderQuery(appId string, orderCode string) (WxPayResponse, error)

func WxRefund

func WxRefund(appId string, orderCode string, refundFee int, totalFee int) (WxPayResponse, error)

func WxRefundQuery

func WxRefundQuery(appId string, orderCode string) (WxPayResponse, error)

func WxUnifiedOrder

func WxUnifiedOrder(appId string, payTitle string, totalFee int, orderCode string, openId string) (WxPayResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL