cnpay

package module
v0.0.0-...-d26e6c3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	App deviceType
	Web
)

Variables

This section is empty.

Functions

func AlipayCallback

func AlipayCallback(form url.Values) (*alipay.TradeNotification, error)

func AlipayPay

func AlipayPay(tradePay *TradePay) (map[string]string, error)

func InitAlipay

func InitAlipay(appID, aliPublicKey, privateKey string, debug bool)

func InitWxpay

func InitWxpay(appID, mchID, apiKey, certPath string, debug bool)

func Notification

func Notification(platform Platform, isSuccess bool) string

func Pay

func Pay(tradePay *TradePay) (map[string]string, error)

func Refund

func Refund(refund *TradeRefund) (interface{}, error)

func WxpayCallback

func WxpayCallback(body *[]byte) (map[string]string, error)

func WxpayPay

func WxpayPay(tradePay *TradePay) (map[string]string, error)

Types

type Platform

type Platform int
const (
	Wxpay Platform
	Alipay
)

type TradePay

type TradePay struct {
	Platform   Platform
	DeviceType deviceType
	NotifyURL  string
	Subject    string
	TradeNo    string
	Amount     float64
}

func (*TradePay) ToAlipay

func (pay *TradePay) ToAlipay() *alipay.TradePay

func (*TradePay) ToWxpay

func (pay *TradePay) ToWxpay() wxpay.Params

type TradeRefund

type TradeRefund struct {
	Platform     Platform
	TradeNo      string  //商户订单号
	RefundNo     string  //商户退单号(aliapy可不传)
	TotalAmount  float64 //订单总金额(alipay可不传)
	RefundAmount float64 //退款金额
	RefundReason string  //退款原因(选填)
}

func (*TradeRefund) ToAlipay

func (refund *TradeRefund) ToAlipay() *alipay.AliPayTradeRefund

func (*TradeRefund) ToWxpay

func (refund *TradeRefund) ToWxpay() wxpay.Params

Jump to

Keyboard shortcuts

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