Documentation ¶
Index ¶
- Constants
- func GetIPByHost(host string, defaultIP string) string
- type BasePaymentProvider
- func (s *BasePaymentProvider) Close(payment *Payment) error
- func (s *BasePaymentProvider) CreatePayment(payment *Payment) (*CreatePaymentResp, error)
- func (s *BasePaymentProvider) GetNotifyController() *PaymentNotifyController
- func (s *BasePaymentProvider) GetPayment(query *PaymentQuery) (*PaymentNotify, error)
- func (s *BasePaymentProvider) GetReqIP() string
- func (s *BasePaymentProvider) Init(paymentUrl string, endpoint *PaymentEndpoint) error
- func (s *BasePaymentProvider) PostNotify(notify *PaymentNotify)
- func (s *BasePaymentProvider) QueryRefund(query *QueryRefund) (*QueryRefundResp, error)
- func (s *BasePaymentProvider) QueryTransfer(query *QueryTransfer) (*QueryTransferResp, error)
- func (s *BasePaymentProvider) Refund(payment *Payment) error
- func (s *BasePaymentProvider) Release()
- func (s *BasePaymentProvider) SetupNotify(handler PaymentNotifyHandler)
- func (s *BasePaymentProvider) Transfer(transfer *PaymentTransfer) error
- type CreatePaymentResp
- type IPaymentProvider
- type ISerivceMuggle
- type IServicePayment
- type MuggleReqOrder
- type MuggleRespBase
- type MuggleRespOrder
- type MuggleRespOrderCreate
- type Payment
- type PaymentEndpoint
- type PaymentNotify
- type PaymentNotifyController
- type PaymentNotifyHandler
- type PaymentQuery
- type PaymentTransfer
- type QueryRefund
- type QueryRefundResp
- type QueryTransfer
- type QueryTransferResp
Constants ¶
View Source
const ( ServiceMugglePay = "mugglepay" DispatcherMuggleCallback = "DispatcherMuggleCallback" )
View Source
const ( MuggleHeaderToken = "token" MugglePayStatusNEW = "NEW" MugglePayStatusPENDING = "PENDING" MugglePayStatusFinalCANCELED = "CANCELED" MugglePayStatusFinalEXPIRED = "EXPIRED" MugglePayStatusFinalUNRESOLVED = "UNRESOLVED" MugglePayStatusFinalRESOLVED = "RESOLVED" MugglePayStatusFinalPAID = "PAID" MugglePayStatusFinalREFUNDED = "REFUNDED" MugglePayCurrencyWechat = "WECHAT" MugglePayCurrencyAlipay = "ALIPAY" MugglePayCurrencyAlipayGlobal = "ALIGLOBAL" MugglePayCurrencyUSDT = "USDT" )
View Source
const ( PaymentMiniProgram = "miniprogram" PaymentWechat = "wechat" PaymentAlipay = "alipay" )
View Source
const ( PaymentTypeWechatMiniProgram = PaymentMiniProgram PaymentTypeAlipayScan = "alipay_scan" PaymentTypeAlipayPage = "alipay_page" PaymentTypeAlipayWap = "alipay_wap" )
View Source
const ( // 支付成功 PaymentStatusSuccess = "success" // 转入退款 PaymentStatusRefund = "refund" // 未支付 PaymentStatusNotPay = "notpay" // 已关闭 PaymentStatusClosed = "closed" // 已撤销 PaymentStatusRevoked = "revoked" // 支付中 PaymentStatusPaying = "paying" // 其他错误 PaymentStatusUnKnown = "unknown" // 交易结束 PaymentStatusFinished = "finished" )
View Source
const ( // 转账成功 TransferStatusSuccess = "success" // 转账失败 TransferStatusFailed = "failed" // 转账处理中 TransferStatusProcessing = "processing" )
View Source
const ( // 退款成功 RefundStatusSuccess = "success" // 退款处理中 RefundStatusProcessing = "processing" // 退款关闭 RefundStatusClosed = "closed" // 退款异常 RefundStatusException = "exception" )
View Source
const (
ErrorUnknown = "ErrorUnknown"
)
View Source
const (
PaymentNotifyLen = 4096
)
View Source
const (
ServicePayment = "payment"
)
Variables ¶
This section is empty.
Functions ¶
func GetIPByHost ¶
Types ¶
type BasePaymentProvider ¶
type BasePaymentProvider struct { IPaymentProvider Endpoint *PaymentEndpoint PaymentUrl string // contains filtered or unexported fields }
func (*BasePaymentProvider) Close ¶
func (s *BasePaymentProvider) Close(payment *Payment) error
func (*BasePaymentProvider) CreatePayment ¶
func (s *BasePaymentProvider) CreatePayment(payment *Payment) (*CreatePaymentResp, error)
func (*BasePaymentProvider) GetNotifyController ¶
func (s *BasePaymentProvider) GetNotifyController() *PaymentNotifyController
func (*BasePaymentProvider) GetPayment ¶
func (s *BasePaymentProvider) GetPayment(query *PaymentQuery) (*PaymentNotify, error)
func (*BasePaymentProvider) GetReqIP ¶
func (s *BasePaymentProvider) GetReqIP() string
func (*BasePaymentProvider) Init ¶
func (s *BasePaymentProvider) Init(paymentUrl string, endpoint *PaymentEndpoint) error
func (*BasePaymentProvider) PostNotify ¶
func (s *BasePaymentProvider) PostNotify(notify *PaymentNotify)
func (*BasePaymentProvider) QueryRefund ¶
func (s *BasePaymentProvider) QueryRefund(query *QueryRefund) (*QueryRefundResp, error)
func (*BasePaymentProvider) QueryTransfer ¶
func (s *BasePaymentProvider) QueryTransfer(query *QueryTransfer) (*QueryTransferResp, error)
func (*BasePaymentProvider) Refund ¶
func (s *BasePaymentProvider) Refund(payment *Payment) error
func (*BasePaymentProvider) Release ¶
func (s *BasePaymentProvider) Release()
func (*BasePaymentProvider) SetupNotify ¶
func (s *BasePaymentProvider) SetupNotify(handler PaymentNotifyHandler)
func (*BasePaymentProvider) Transfer ¶
func (s *BasePaymentProvider) Transfer(transfer *PaymentTransfer) error
type CreatePaymentResp ¶
type IPaymentProvider ¶
type IPaymentProvider interface { Init(paymentUrl string, endpoint *PaymentEndpoint) error Release() // 创建支付(下单) CreatePayment(payment *Payment) (*CreatePaymentResp, error) // 订单查询 GetPayment(query *PaymentQuery) (*PaymentNotify, error) // 转账给个人 Transfer(transfer *PaymentTransfer) error // 转账查询 QueryTransfer(query *QueryTransfer) (*QueryTransferResp, error) // 退款 Refund(payment *Payment) error // 退款查询 QueryRefund(query *QueryRefund) (*QueryRefundResp, error) // 关闭订单 Close(payment *Payment) error // 通知回调 SetupNotify(handler PaymentNotifyHandler) GetNotifyController() *PaymentNotifyController }
type ISerivceMuggle ¶
type ISerivceMuggle interface { CreateOrder(req *MuggleReqOrder) (*MuggleRespOrderCreate, error) GetOrder(orderID string) (*MuggleRespOrderCreate, error) }
type IServicePayment ¶
type IServicePayment interface { CreatePayment(endpoint string, payment *Payment) (*CreatePaymentResp, error) GetPayment(endpoint string, query *PaymentQuery) (*PaymentNotify, error) Transfer(endpoint string, transfer *PaymentTransfer) error QueryTransfer(endpoint string, query *QueryTransfer) (*QueryTransferResp, error) Refund(endpoint string, payment *Payment) error QueryRefund(endpoint string, query *QueryRefund) (*QueryRefundResp, error) ClosePayment(endpoint string, payment *Payment) error }
type MuggleReqOrder ¶
type MuggleReqOrder struct { // 用户订单id MerchantOrderID string `json:"merchant_order_id"` // 必填 PriceAmount float64 `json:"price_amount"` // 必填 PriceCurrency string `json:"price_currency"` // 支付渠道 PayCurrency string `json:"pay_currency"` // 支付结果回调 CallbackUrl string `json:"callback_url"` // 取消支付跳转链接 CancelUrl string `json:"cancel_url"` // 支付成功跳转链接 SuccessUrl string `json:"success_url"` // 用户支付结果回调时的验证token Token string `json:"token"` // 支付标题 Title string `json:"title"` // 支付描述 Description string `json:"description"` // Based on PC or Mobile Wap, we provide different links, for Alipay / Alipay Global / Wechat only. Mobile bool `json:"mobile"` // Return the payment url directly, for Alipay / Alipay Global / Wechat only. Fast bool `json:"fast"` }
type MuggleRespBase ¶
type MuggleRespOrder ¶
type MuggleRespOrder struct { MuggleReqOrder OrderID string `json:"order_id"` Status string `json:"status"` }
type MuggleRespOrderCreate ¶
type MuggleRespOrderCreate struct { MuggleRespBase PaymentUrl string `json:"payment_url"` Order *MuggleRespOrder `json:"order"` }
type PaymentEndpoint ¶
type PaymentNotify ¶
type PaymentNotifyController ¶
type PaymentNotifyHandler ¶
type PaymentNotifyHandler func(notify *PaymentNotify)
type PaymentQuery ¶
type PaymentTransfer ¶
type QueryRefund ¶
type QueryRefundResp ¶
type QueryTransfer ¶
type QueryTransferResp ¶
Click to show internal directories.
Click to hide internal directories.