Documentation
¶
Index ¶
- Constants
- type Bill
- type BillRequest
- type BillResponse
- type Client
- type ClientResponse
- type Config
- type Jssdk
- type Marketing
- type Notify
- type NotifyMessage
- type NotifyRes
- type Order
- type OrderConfig
- type Payment
- func (p *Payment) Certificates()
- func (p *Payment) GCMDecryte(associateData, cipherText, nonce string) ([]byte, error)
- func (p *Payment) Jssdk(prepayId string) *Jssdk
- func (p *Payment) Marketing() *Marketing
- func (p *Payment) Notify(r *http.Request, w http.ResponseWriter) *Notify
- func (p *Payment) Order() *Order
- func (p *Payment) V2MD5(m map[string]interface{}) string
- func (p *Payment) V2Signature(str string) string
- func (p *Payment) V2SortKey(text map[string]interface{}) string
- func (p *Payment) VerifySignature(ctx context.Context, header http.Header, body []byte) error
- type QueryOrder
- type Redpack
- type Refund
- type RefundAmount
- type RefundGoodsDetail
- type RefundRequest
- type RefundResponse
- type Response
- type ResponseResult
Constants ¶
View Source
const ( KEY_LENGTH_BYTE = 32 AUTH_TAG_LENGTH_BYTE = 16 )
View Source
const ( MessageEventType = "TRANSACTION.SUCCESS" //支付通知状态 MessageResCode = "SUCCESS" //成功返回到code值 PaySuccess = "SUCCESS" //支付成功 PayRefund = "REFUND" //转入退款 PayNotPay = "NOTPAY" //未支付 PayClosed = "CLOSED" //已关闭 Paying = "USERPAYING" //正在支付中(付款码) PayRevoked = "REVOKED" //已撤销(付款码) PayError = "PAYERROR" //支付失败 )
View Source
const (
AUTH_TYPE = "WECHATPAY2-SHA256-RSA2048"
)
View Source
const (
BASE_API_URI = "https://api.mch.weixin.qq.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bill ¶
type Bill struct {
// contains filtered or unexported fields
}
Bill 账单管理
func (*Bill) DownloadBill ¶
func (b *Bill) DownloadBill(ctx context.Context, downloadURL string) *BillResponse
DownloadBill 下载账单文件
func (*Bill) GetFundBill ¶
func (b *Bill) GetFundBill(ctx context.Context, req BillRequest) *BillResponse
GetFundBill 获取资金账单
func (*Bill) GetTradeBill ¶
func (b *Bill) GetTradeBill(ctx context.Context, req BillRequest) *BillResponse
GetTradeBill 获取交易账单
type BillRequest ¶
type BillRequest struct {
BillDate string `json:"bill_date"` // 账单日期
BillType string `json:"bill_type,omitempty"` // 账单类型
SubMchID string `json:"sub_mchid,omitempty"` // 子商户号
TarType string `json:"tar_type,omitempty"` // 压缩账单类型
}
BillRequest 账单请求参数
type BillResponse ¶
BillResponse 账单响应
type Client ¶
type Client struct {
*gclient.Client
UrlValues url.Values
// Logger *log.Logger
BaseUri string
// contains filtered or unexported fields
}
type ClientResponse ¶
type Config ¶
type Config struct {
AppID string `json:"app_id"` //公众号
MchID string `json:"mch_id"` //商户号
//v2接口
Key string `json:"key"` //API 秘钥
CertPath string `json:"cert_path"` //API 证书路径 绝对路径!!!
KeyPath string `json:"key_path"` //绝对路径!!!
Sandbox bool `json:"sandbox"` //沙盒模式
//v3接口
SerialNo string `json:"serial_no"` //商户证书编号
PriCertPath string `json:"private_cert_path"` //私钥证书路径 绝对路径!!!
PubCertPath string `json:"public_cert_Path"` //公钥证书路径 绝对路径!!!
PublicCer *x509.Certificate //商户证书公钥
PrivateCer interface{} //商户证书私钥
PFSerialNo string //平台证书编号
PFPublicCer *x509.Certificate //平台证书公钥
PFCertSavePath string //平台证书保存路径 绝对路径!!!
PFCertPrefix string //平台证书保存前缀
ApiV3Key string //apiv3 秘钥
//公用
NotifyUrl string `json:"notify_url"` //默认回调地址
//服务商参数
SubMchID string `json:"sub_mch_id"`
SubAppID string `json:"sub_appid"`
//others
Logger *log.Logger
LogPath string
}
Config
type Notify ¶
type Notify struct {
Request *ehttp.Request
Response *ehttp.Response
Message *NotifyMessage // 消息数据包含原始数据
// contains filtered or unexported fields
}
支付通知
func (*Notify) HandlePaid ¶
支付通知处理
type NotifyMessage ¶
type Order ¶
type Order struct {
// contains filtered or unexported fields
}
type OrderConfig ¶
订单
type Payment ¶
type Payment struct {
Logger *log.Logger
Cache *gcache.Cache
// contains filtered or unexported fields
}
func (*Payment) Certificates ¶
func (p *Payment) Certificates()
func (*Payment) GCMDecryte ¶
aes-256-gcm
type QueryOrder ¶
QueryOrder @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml 返回参数
type Redpack ¶
type Redpack struct {
// contains filtered or unexported fields
}
营销红包 v2 @see https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3
type Refund ¶
type Refund struct {
// contains filtered or unexported fields
}
Refund 退款管理
func (*Refund) QueryRefund ¶
func (r *Refund) QueryRefund(ctx context.Context, outRefundNo string) *RefundResponse
QueryRefund 查询退款
func (*Refund) Refund ¶
func (r *Refund) Refund(ctx context.Context, req RefundRequest) *RefundResponse
Refund 申请退款
type RefundAmount ¶
type RefundAmount struct {
Total int `json:"total"` // 订单金额
Refund int `json:"refund"` // 退款金额
From []string `json:"from,omitempty"` // 退款出资账户
TotalFee int `json:"total_fee,omitempty"` // 应结订单金额
RefundFee int `json:"refund_fee,omitempty"` // 退款金额
RefundTotal int `json:"refund_total,omitempty"` // 退款总出资
}
RefundAmount 退款金额信息
type RefundGoodsDetail ¶
type RefundGoodsDetail struct {
MerchantGoodsID string `json:"merchant_goods_id"` // 商户商品编码
WechatpayGoodsID string `json:"wechatpay_goods_id,omitempty"` // 微信商品编码
GoodsName string `json:"goods_name,omitempty"` // 商品名称
UnitPrice int `json:"unit_price"` // 商品单价
RefundAmount int `json:"refund_amount"` // 商品退款金额
RefundQuantity int `json:"refund_quantity"` // 商品退款数量
}
RefundGoodsDetail 退款商品详情
type RefundRequest ¶
type RefundRequest struct {
TransactionID string `json:"transaction_id,omitempty"` // 微信支付订单号
OutTradeNo string `json:"out_trade_no,omitempty"` // 商户订单号
OutRefundNo string `json:"out_refund_no"` // 商户退款单号
Reason string `json:"reason,omitempty"` // 退款原因
NotifyURL string `json:"notify_url,omitempty"` // 退款结果通知 url
FundsAccount string `json:"funds_account,omitempty"` // 退款资金来源
Amount RefundAmount `json:"amount"` // 金额信息
GoodsDetail []RefundGoodsDetail `json:"goods_detail,omitempty"` // 订单商品列表
}
RefundRequest 退款请求参数
type RefundResponse ¶
RefundResponse 退款响应
type ResponseResult ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.