wechatpayapiv3

package
v1.0.46-0...-d927801 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	AppId           string      // 小程序或者公众号唯一凭证
	AppSecret       string      // 小程序或者公众号唯一凭证密钥
	MchId           string      // 微信支付的商户id
	AesKey          string      // 私钥
	ApiV3           string      // API v3密钥
	PrivateSerialNo string      // 私钥证书号
	MchPrivateKey   string      // 商户私有证书内容 apiclient_key.pem
	Mongo           gomongo.App // 日志数据库
}

App 微信支付服务

func (*App) GetJsApi

func (app *App) GetJsApi(param GetJsApi) (result GetJsApiResult, err error)

GetJsApi JSAPI调起支付API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml

func (*App) NewParamsWith

func (app *App) NewParamsWith(params ...Params) Params

func (*App) PayTransactionsId

func (app *App) PayTransactionsId(transactionId string) *PayTransactionsIdResult

PayTransactionsId 微信支付订单号查询 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml

func (*App) PayTransactionsJsapi

func (app *App) PayTransactionsJsapi(notMustParams ...Params) *PayTransactionsJsapiResult

PayTransactionsJsapi 小程序 JSAPI下单 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_5_1.shtml

func (*App) PayTransactionsOutTradeNo

func (app *App) PayTransactionsOutTradeNo(outTradeNo string) *PayTransactionsOutTradeNoResult

PayTransactionsOutTradeNo 商户订单号查询 https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml

func (*App) PayTransactionsOutTradeNoClose

func (app *App) PayTransactionsOutTradeNoClose(OutTradeNo string) *PayTransactionsOutTradeNoCloseResult

PayTransactionsOutTradeNoClose 关闭订单API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_3.shtml

func (*App) RefundDomesticRefunds

func (app *App) RefundDomesticRefunds(notMustParams ...Params) *RefundDomesticRefundsResult

RefundDomesticRefunds 申请退款API https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter6_1_26.shtml

func (*App) RefundDomesticRefundsOutRefundNo

func (app *App) RefundDomesticRefundsOutRefundNo(outRefundNo string) *RefundDomesticRefundsOutRefundNoResult

RefundDomesticRefundsOutRefundNo 查询单笔退款API https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter4_5_10.shtml

type GetJsApi

type GetJsApi struct {
	Package string `json:"package"`
}

GetJsApi 入参

type GetJsApiResult

type GetJsApiResult struct {
	AppId     string // 应用ID
	TimeStamp string // 时间戳
	NonceStr  string // 随机字符串
	Package   string // 订单详情扩展字符串
	SignType  string // 签名方式
	PaySign   string // 签名
}

GetJsApiResult 返回参数

type Params

type Params map[string]interface{}

Params 请求参数

func NewParams

func NewParams() Params

func (Params) Set

func (p Params) Set(key string, value any)

func (Params) SetParams

func (p Params) SetParams(params Params)

type PayTransactionsIdResponse

type PayTransactionsIdResponse struct {
	Appid          string `json:"appid"`
	Mchid          string `json:"mchid"`
	OutTradeNo     string `json:"out_trade_no"`
	TransactionId  string `json:"transaction_id,omitempty"`
	TradeType      string `json:"trade_type,omitempty"`
	TradeState     string `json:"trade_state"`
	TradeStateDesc string `json:"trade_state_desc"`
	BankType       string `json:"bank_type,omitempty"`
	Attach         string `json:"attach,omitempty"`
	SuccessTime    string `json:"success_time,omitempty"`
	Payer          struct {
		Openid string `json:"openid"`
	} `json:"payer"`
	Amount struct {
		Total         int    `json:"total,omitempty"`
		PayerTotal    int    `json:"payer_total,omitempty"`
		Currency      string `json:"currency,omitempty"`
		PayerCurrency string `json:"payer_currency,omitempty"`
	} `json:"amount,omitempty"`
	SceneInfo struct {
		DeviceId string `json:"device_id,omitempty"`
	}
	PromotionDetail []struct {
		CouponId            string `json:"coupon_id"`
		Name                string `json:"name,omitempty"`
		Scope               string `json:"scope,omitempty"`
		Type                string `json:"type,omitempty"`
		Amount              int    `json:"amount"`
		StockId             string `json:"stock_id,omitempty"`
		WechatpayContribute int    `json:"wechatpay_contribute,omitempty"`
		MerchantContribute  int    `json:"merchant_contribute,omitempty"`
		OtherContribute     int    `json:"other_contribute,omitempty"`
		Currency            string `json:"currency,omitempty"`
		GoodsDetail         []struct {
			GoodsId        string `json:"goods_id"`
			Quantity       int    `json:"quantity"`
			UnitPrice      int    `json:"unit_price"`
			DiscountAmount int    `json:"discount_amount"`
			GoodsRemark    string `json:"goods_remark,omitempty"`
		} `json:"goods_detail"`
	}
}

type PayTransactionsIdResult

type PayTransactionsIdResult struct {
	Result PayTransactionsIdResponse // 结果
	Body   []byte                    // 内容
	Http   gohttp.Response           // 请求
	Err    error                     // 错误
}

func NewPayTransactionsIdResult

func NewPayTransactionsIdResult(result PayTransactionsIdResponse, body []byte, http gohttp.Response, err error) *PayTransactionsIdResult

type PayTransactionsJsapiResponse

type PayTransactionsJsapiResponse struct {
	PrepayId string `json:"prepay_id"`
}

type PayTransactionsJsapiResult

type PayTransactionsJsapiResult struct {
	Result PayTransactionsJsapiResponse // 结果
	Body   []byte                       // 内容
	Http   gohttp.Response              // 请求
	Err    error                        // 错误
}

func NewPayTransactionsJsapiResult

func NewPayTransactionsJsapiResult(result PayTransactionsJsapiResponse, body []byte, http gohttp.Response, err error) *PayTransactionsJsapiResult

type PayTransactionsOutTradeNoCloseResult

type PayTransactionsOutTradeNoCloseResult struct {
	Body []byte          // 内容
	Http gohttp.Response // 请求
	Err  error           // 错误
}

func NewPayTransactionsOutTradeNoCloseResult

func NewPayTransactionsOutTradeNoCloseResult(body []byte, http gohttp.Response, err error) *PayTransactionsOutTradeNoCloseResult

type PayTransactionsOutTradeNoResponse

type PayTransactionsOutTradeNoResponse struct {
	Appid          string `json:"appid"`
	Mchid          string `json:"mchid"`
	OutTradeNo     string `json:"out_trade_no"`
	TransactionId  string `json:"transaction_id,omitempty"`
	TradeType      string `json:"trade_type,omitempty"`
	TradeState     string `json:"trade_state"`
	TradeStateDesc string `json:"trade_state_desc"`
	BankType       string `json:"bank_type,omitempty"`
	Attach         string `json:"attach,omitempty"`
	SuccessTime    string `json:"success_time,omitempty"`
	Payer          struct {
		Openid string `json:"openid"`
	} `json:"payer"`
	Amount struct {
		Total         int    `json:"total,omitempty"`
		PayerTotal    int    `json:"payer_total,omitempty"`
		Currency      string `json:"currency,omitempty"`
		PayerCurrency string `json:"payer_currency,omitempty"`
	} `json:"amount,omitempty"`
	SceneInfo struct {
		DeviceId string `json:"device_id,omitempty"`
	}
	PromotionDetail []struct {
		CouponId            string `json:"coupon_id"`
		Name                string `json:"name,omitempty"`
		Scope               string `json:"scope,omitempty"`
		Type                string `json:"type,omitempty"`
		Amount              int    `json:"amount"`
		StockId             string `json:"stock_id,omitempty"`
		WechatpayContribute int    `json:"wechatpay_contribute,omitempty"`
		MerchantContribute  int    `json:"merchant_contribute,omitempty"`
		OtherContribute     int    `json:"other_contribute,omitempty"`
		Currency            string `json:"currency,omitempty"`
		GoodsDetail         []struct {
			GoodsId        string `json:"goods_id"`
			Quantity       int    `json:"quantity"`
			UnitPrice      int    `json:"unit_price"`
			DiscountAmount int    `json:"discount_amount"`
			GoodsRemark    string `json:"goods_remark,omitempty"`
		} `json:"goods_detail"`
	}
}

type PayTransactionsOutTradeNoResult

type PayTransactionsOutTradeNoResult struct {
	Result PayTransactionsOutTradeNoResponse // 结果
	Body   []byte                            // 内容
	Http   gohttp.Response                   // 请求
	Err    error                             // 错误
}

func NewPayTransactionsOutTradeNoResult

func NewPayTransactionsOutTradeNoResult(result PayTransactionsOutTradeNoResponse, body []byte, http gohttp.Response, err error) *PayTransactionsOutTradeNoResult

type RefundDomesticRefundsOutRefundNoResponse

type RefundDomesticRefundsOutRefundNoResponse struct {
	RefundId            string `json:"refund_id"`               // 微信支付退款单号
	OutRefundNo         string `json:"out_refund_no"`           // 商户退款单号
	TransactionId       string `json:"transaction_id"`          // 微信支付订单号
	OutTradeNo          string `json:"out_trade_no"`            // 商户订单号
	Channel             string `json:"channel"`                 // 退款渠道
	UserReceivedAccount string `json:"user_received_account"`   // 退款入账账户
	SuccessTime         string `json:"success_time,omitempty"`  // 退款成功时间
	CreateTime          string `json:"create_time"`             // 退款创建时间
	Status              string `json:"status"`                  // 退款状态
	FundsAccount        string `json:"funds_account,omitempty"` // 资金账户
	Amount              struct {
		Total  int `json:"total"`  // 订单金额
		Refund int `json:"refund"` // 退款金额
		From   []struct {
			Account string `json:"account"` // 出资账户类型
			Amount  int    `json:"amount"`  // 出资金额
		} `json:"from,omitempty"`
		PayerTotal       int    `json:"payer_Total"`       // 用户支付金额
		PayerRefund      int    `json:"payer_Refund"`      // 用户退款金额
		SettlementRefund int    `json:"settlement_Refund"` // 应结退款金额
		SettlementTotal  int    `json:"settlement_total"`  // 应结订单金额
		DiscountRefund   int    `json:"discount_refund"`   // 优惠退款金额
		Currency         string `json:"currency"`          // 退款币种
	} `json:"amount"` // 金额信息
	PromotionDetail []struct {
		PromotionId  string `json:"promotion_id"`  // 券ID
		Scope        string `json:"scope"`         // 优惠范围
		Type         string `json:"type"`          // 优惠类型
		Amount       int    `json:"amount"`        // 优惠券面额
		RefundAmount int    `json:"refund_amount"` // 优惠退款金额
		GoodsDetail  []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"`              // 商品退货数量
		} `json:"goods_detail"`
	} `json:"promotion_detail,omitempty"` // 优惠退款信息
}

type RefundDomesticRefundsOutRefundNoResult

type RefundDomesticRefundsOutRefundNoResult struct {
	Result RefundDomesticRefundsOutRefundNoResponse // 结果
	Body   []byte                                   // 内容
	Http   gohttp.Response                          // 请求
	Err    error                                    // 错误
}

type RefundDomesticRefundsResponse

type RefundDomesticRefundsResponse struct {
	RefundId            string `json:"refund_id"`               // 微信支付退款单号
	OutRefundNo         string `json:"out_refund_no"`           // 商户退款单号
	TransactionId       string `json:"transaction_id"`          // 微信支付订单号
	OutTradeNo          string `json:"out_trade_no"`            // 商户订单号
	Channel             string `json:"channel"`                 // 退款渠道
	UserReceivedAccount string `json:"user_received_account"`   // 退款入账账户
	SuccessTime         string `json:"success_time,omitempty"`  // 退款成功时间
	CreateTime          string `json:"create_time"`             // 退款创建时间
	Status              string `json:"status"`                  // 退款状态
	FundsAccount        string `json:"funds_account,omitempty"` // 资金账户
	Amount              struct {
		Total  int `json:"total"`  // 订单金额
		Refund int `json:"refund"` // 退款金额
		From   []struct {
			Account string `json:"account"` // 出资账户类型
			Amount  int    `json:"amount"`  // 出资金额
		} `json:"from,omitempty"`
		PayerTotal       int    `json:"payer_Total"`       // 用户支付金额
		PayerRefund      int    `json:"payer_Refund"`      // 用户退款金额
		SettlementRefund int    `json:"settlement_Refund"` // 应结退款金额
		SettlementTotal  int    `json:"settlement_total"`  // 应结订单金额
		DiscountRefund   int    `json:"discount_refund"`   // 优惠退款金额
		Currency         string `json:"currency"`          // 退款币种
	} `json:"amount"` // 金额信息
	PromotionDetail []struct {
		PromotionId  string `json:"promotion_id"`  // 券ID
		Scope        string `json:"scope"`         // 优惠范围
		Type         string `json:"type"`          // 优惠类型
		Amount       int    `json:"amount"`        // 优惠券面额
		RefundAmount int    `json:"refund_amount"` // 优惠退款金额
		GoodsDetail  []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"`              // 商品退货数量
		} `json:"goods_detail"`
	} `json:"promotion_detail,omitempty"` // 优惠退款信息
}

type RefundDomesticRefundsResult

type RefundDomesticRefundsResult struct {
	Result RefundDomesticRefundsResponse // 结果
	Body   []byte                        // 内容
	Http   gohttp.Response               // 请求
	Err    error                         // 错误
}

func NewRefundDomesticRefundsResult

func NewRefundDomesticRefundsResult(result RefundDomesticRefundsResponse, body []byte, http gohttp.Response, err error) *RefundDomesticRefundsResult

Jump to

Keyboard shortcuts

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