Documentation
¶
Index ¶
- Constants
- type AsyncNotifyResult
- type Client
- func (c *Client) AsyncNotify(req *http.Request) (*AsyncNotifyResult, error)
- func (c *Client) CreateTrade(p CreateTradeParam) (*CreateTradeRsp, error)
- func (c *Client) QueryRefund(p PayParam) (*QueryRefundRsp, error)
- func (c *Client) QueryTrade(p PayParam) (*QueryTradeRsp, error)
- func (c *Client) RefundTrade(p PayParam) (*RefundTradeRsp, error)
- type Config
- type CreateTradeParam
- type CreateTradeRsp
- type ExtendParam
- type GoodsDetail
- type PayParam
- type QueryRefundParam
- type QueryRefundRsp
- type QueryTradeParam
- type QueryTradeRsp
- type RefundTradeParam
- type RefundTradeRsp
- type RoyaltyDetailInfo
- type RoyaltyInfo
- type SubMerchant
Constants ¶
const ( RSA = "RSA" RSA2 = "RSA2" Success = "10000" )
misc constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncNotifyResult ¶
type AsyncNotifyResult struct {
AppID string `json:"app_id"`
AuthAPPID string `json:"auth_app_id"`
BuyerID string `json:"buyer_id"`
BuyerLogonID string `json:"buyer_logon_id"`
BuyerPayAmount string `json:"buyer_pay_amount"`
Charset string `json:"charset"`
FundBillList string `json:"fund_bill_list"`
GmtCreate string `json:"gmt_create"`
GmtPayment string `json:"gmt_payment"`
InvoiceAmount string `json:"invoice_amount"`
NotifyID string `json:"notify_id"`
NotifyTime string `json:"notify_time"`
NotifyType string `json:"notify_type"`
OutTradeNo string `json:"out_trade_no"`
PointAmount string `json:"point_amount"`
ReceiptAmount string `json:"receipt_amount"`
SellerEmail string `json:"seller_email"`
SellerID string `json:"seller_id"`
Sign string `json:"sign"`
SignType string `json:"sign_type"`
Subject string `json:"subject"`
TotalAmount string `json:"total_amount"`
TradeNo string `json:"trade_no"`
TradeStatus string `json:"trade_status"`
Version string `json:"version"`
}
AsyncNotifyResult is the result return from Alipay.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles all transactions.
func (*Client) AsyncNotify ¶
func (c *Client) AsyncNotify(req *http.Request) (*AsyncNotifyResult, error)
AsyncNotify retrieves the asynchronous notification from Weixin.
func (*Client) CreateTrade ¶
func (c *Client) CreateTrade(p CreateTradeParam) (*CreateTradeRsp, error)
CreateTrade creates order from Alipay.
func (*Client) QueryRefund ¶
func (c *Client) QueryRefund(p PayParam) (*QueryRefundRsp, error)
QueryRefund queries the result of refund.
func (*Client) QueryTrade ¶
func (c *Client) QueryTrade(p PayParam) (*QueryTradeRsp, error)
QueryTrade queries order from Alipay.
func (*Client) RefundTrade ¶
func (c *Client) RefundTrade(p PayParam) (*RefundTradeRsp, error)
RefundTrade refunds trade .
type Config ¶
type Config struct {
APIGateway string
AppID string
NotifyURL string
SandBox bool
SignType string
AliPublicKey []byte
AppPublicKey []byte
AppPrivateKey []byte
}
Config contains all configuration info.
type CreateTradeParam ¶
type CreateTradeParam struct {
AppAuthToken string `json:"-"`
NotifyURL string `json:"-"`
OutTradeNo string `json:"out_trade_no,omitempty"`
SellerID string `json:"seller_id,omitempty"`
TotalAmount string `json:"total_amount"`
DiscountableAmount string `json:"discountable_amount"`
UndiscountableAmount string `json:"undiscountable_amount"`
BuyerLogonID string `json:"buyer_logon_id"`
Subject string `json:"subject"`
Body string `json:"body"`
BuyerID string `json:"buyer_id"`
GoodsDetails []*GoodsDetail `json:"goods_detail,omitempty"`
OperatorID string `json:"operator_id"`
StoreID string `json:"store_id"`
TerminalID string `json:"terminal_id"`
ExtendParams *ExtendParam `json:"extend_params,omitempty"`
TimeoutExpress string `json:"timeout_express"`
RoyaltyInfo *RoyaltyInfo `json:"royalty_info,omitempty"`
AliPayStoreID string `json:"alipay_store_id"`
SubMerchants []SubMerchant `json:"sub_merchant"`
MerchantOrderNo string `json:"merchant_order_no"`
}
CreateTradeParam requests alipay.trade.create.
func (CreateTradeParam) BizContent ¶
func (p CreateTradeParam) BizContent() string
BizContent returns biz_content in JSON format.
func (CreateTradeParam) ExtraParams ¶
func (p CreateTradeParam) ExtraParams() map[string]string
ExtraParams returns extra parameters.
type CreateTradeRsp ¶
type CreateTradeRsp struct {
TradeCreateResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"`
OutTradeNo string `json:"out_trade_no"`
} `json:"alipay_trade_create_response"`
Sign string `json:"sign"`
}
CreateTradeRsp responses alipay.trade.create.
type ExtendParam ¶
type ExtendParam struct {
SysServiceProviderID string `json:"sys_service_provider_id"`
HbFqNum string `json:"hb_fq_num"`
HbFqSellerPercent string `json:"hb_fq_seller_percent"`
TimeoutExpress string `json:"timeout_express"`
}
ExtendParam 业务扩展参数.
type GoodsDetail ¶
type GoodsDetail struct {
GoodsID string `json:"goods_id"`
AliPayGoodsID string `json:"alipay_goods_id"`
GoodsName string `json:"goods_name"`
Quantity string `json:"quantity"`
Price string `json:"price"`
GoodsCategory string `json:"goods_category"`
Body string `json:"body"`
ShowURL string `json:"show_url"`
}
GoodsDetail 订单包含的商品列表信息.
type QueryRefundParam ¶
type QueryRefundParam struct {
AppAuthToken string `json:"-"`
OutTradeNo string `json:"out_trade_no,omitempty"`
TradeNo string `json:"trade_no,omitempty"`
OutRequestNo string `json:"out_request_no"`
}
QueryRefundParam .
func (QueryRefundParam) BizContent ¶
func (p QueryRefundParam) BizContent() string
BizContent returns the JSON string of parameters.
func (QueryRefundParam) ExtraParams ¶
func (p QueryRefundParam) ExtraParams() map[string]string
ExtraParams returns extra parameters.
type QueryRefundRsp ¶
type QueryRefundRsp struct {
RefundQueryResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"` // 支付宝交易号
OutTradeNo string `json:"out_trade_no"` // 创建交易传入的商户订单号
OutRequestNo string `json:"out_request_no"` // 本笔退款对应的退款请求号
RefundReason string `json:"refund_reason"` // 发起退款时,传入的退款原因
TotalAmount string `json:"total_amount"` // 发该笔退款所对应的交易的订单金额
RefundAmount string `json:"refund_amount"` // 本次退款请求,对应的退款金额
} `json:"alipay_trade_fastpay_refund_query_response"`
Sign string `json:"sign"`
}
QueryRefundRsp .
type QueryTradeParam ¶
type QueryTradeParam struct {
AppAuthToken string `json:"-"`
OutTradeNo string `json:"out_trade_no,omitempty"`
TradeNo string `json:"trade_no,omitempty"`
}
QueryTradeParam requests alipay.trade.query.
func (QueryTradeParam) BizContent ¶
func (p QueryTradeParam) BizContent() string
BizContent returns biz_content in JSON format.
func (QueryTradeParam) ExtraParams ¶
func (p QueryTradeParam) ExtraParams() map[string]string
ExtraParams returns extra parameters.
type QueryTradeRsp ¶
type QueryTradeRsp struct {
TradeQueryResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
BuyerLogonID string `json:"buyer_logon_id"` // 买家支付宝账号
BuyerPayAmount string `json:"buyer_pay_amount"` // 买家实付金额,单位为元,两位小数。
BuyerUserID string `json:"buyer_user_id"` // 买家在支付宝的用户id
InvoiceAmount string `json:"invoice_amount"` // 交易中用户支付的可开具发票的金额,单位为元,两位小数。
OpenID string `json:"open_id"` // 买家支付宝用户号,该字段将废弃,不要使用
OutTradeNo string `json:"out_trade_no"` // 商家订单号
PointAmount string `json:"point_amount"` // 积分支付的金额,单位为元,两位小数。
ReceiptAmount string `json:"receipt_amount"`
SendPayDate string `json:"send_pay_date"` // 本次交易打款给卖家的时间
TotalAmount string `json:"total_amount"` // 交易的订单金额
TradeNo string `json:"trade_no"` // 支付宝交易号
TradeStatus string `json:"trade_status"` // 交易状态
} `json:"alipay_trade_query_response"`
Sign string `json:"sign"`
}
QueryTradeRsp responses alipay.trade.query.
type RefundTradeParam ¶
type RefundTradeParam struct {
AppAuthToken string `json:"-"` // 可选
OutTradeNo string `json:"out_trade_no"` // 商户订单号 与TradeNo二选一
TradeNo string `json:"trade_no"` // 支付宝交易号 与OutTradeNo二选一
RefundAmount string `json:"refund_amount"` // 必须 退款的金额
RefundReason string `json:"refund_reason"` // 可选 退款的原因说明
OutRequestNo string `json:"out_request_no"` // 可选 标识一次退款请求,同一笔交易多次退款需要保证唯一,如需部分退款,则此参数必传
OperatorID string `json:"operator_id"` // 可选 商户的操作员编号
StoreID string `json:"store_id"` // 可选 商户的门店编号
TerminalID string `json:"terminal_id"` // 可选 商户的终端编号
}
RefundTradeParam .
func (RefundTradeParam) BizContent ¶
func (p RefundTradeParam) BizContent() string
BizContent returns the JSON string of parameters.
func (RefundTradeParam) ExtraParams ¶
func (p RefundTradeParam) ExtraParams() map[string]string
ExtraParams returns extra parameters.
type RefundTradeRsp ¶
type RefundTradeRsp struct {
TradeRefundResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"`
OutTradeNo string `json:"out_trade_no"`
BuyerLogonID string `json:"buyer_logon_id"`
BuyerUserID string `json:"buyer_user_id"`
FundChange string `json:"fund_change"`
RefundFee string `json:"refund_fee"`
GmtRefundPay string `json:"gmt_refund_pay"`
StoreName string `json:"store_name"`
RefundDetailItemList []struct {
FundChannel string `json:"fund_channel"`
Amount string `json:"amount"`
RealAmount string `json:"real_amount"`
} `json:"refund_detail_item_list"`
} `json:"alipay_trade_refund_response"`
Sign string `json:"sign"`
}
RefundTradeRsp .
func (*RefundTradeRsp) Success ¶
func (r *RefundTradeRsp) Success() bool
Success returns true if response is success
type RoyaltyDetailInfo ¶
type RoyaltyDetailInfo struct {
SerialNo string `json:"serial_no"`
TransInType string `json:"trans_in_type"`
BatchNo string `json:"batch_no"`
OutRelationID string `json:"out_relation_id"`
TransOutType string `json:"trans_out_type"`
TransOut string `json:"trans_out"`
TransIn string `json:"trans_in"`
Amount string `json:"amount"`
Desc string `json:"desc"`
AmountPercentage string `json:"amount_percentage"`
AliPayStoreID string `json:"alipay_store_id"`
}
RoyaltyDetailInfo 分账明细的信息.
type RoyaltyInfo ¶
type RoyaltyInfo struct {
RoyaltyType string `json:"royalty_type"`
RoyaltyDetailInfos []*RoyaltyDetailInfo `json:"royalty_detail_infos,omitempty"`
}
RoyaltyInfo 描述分账信息.
type SubMerchant ¶
type SubMerchant struct {
MerchantID string `json:"merchant_id"`
}
SubMerchant 二级商户信息.