config

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TradeStatusWaitBuyerPay 交易创建,等待买家付款
	TradeStatusWaitBuyerPay = "WAIT_BUYER_PAY"
	// TradeStatusClosed 未付款交易超时关闭,或支付完成后全额退款
	TradeStatusClosed = "TRADE_CLOSED"
	// TradeStatusSuccess 交易支付成功
	TradeStatusSuccess = "TRADE_SUCCESS"
	// TradeStatusFinished 交易结束,不可退款
	TradeStatusFinished = "TRADE_FINISHED"
	// TradeStatusException 交易异常(用于退款)
	TradeStatusException = "TRADE_EXCEPTION"
	// TradeStatusProcessing 交易中(用于退款)
	TradeStatusProcessing = "TRADE_PROCESSING"
)

Variables

View Source
var (
	ErrUnknowDevice  = errors.New("Unknow device type")
	ErrSignature     = errors.New("Signature error")
	ErrPaymentFailed = errors.New("Payment failed")
	ErrRefundFailed  = errors.New("Refund failed")
	ErrUnsupported   = errors.New("Unsupported")
)
View Source
var EmptyTradeStatus = TradeStatus{}

Functions

func IsOK

func IsOK(err error) bool

Types

type Account

type Account struct {
	Debug      bool    `json:"debug"`
	AppID      string  `json:"appID"`      //即AppID
	AppSecret  string  `json:"appSecret"`  //即AppKey
	MerchantID string  `json:"merchantID"` //商家ID
	PublicKey  string  `json:"publicKey"`  //公钥
	PrivateKey string  `json:"privateKey"` //私钥
	CertPath   string  `json:"certPath"`   //证书路径
	WebhookID  string  `json:"webhookID"`  // paypal使用的webhook id
	Options    Options `json:"options"`    //其它选项
}

Account 付款平台账号参数

func NewAccount

func NewAccount() *Account

func (*Account) FromStore

func (c *Account) FromStore(v echo.Store) *Account

type Currency added in v0.0.5

type Currency string

Currency 币种

const (
	// USD 美元
	USD Currency = `USD`
	// CNY 人民币
	CNY Currency = `CNY`
	// RUB 俄罗斯卢布
	RUB Currency = `RUB`
	// EUR 欧元
	EUR Currency = `EUR`
	// GBP 英镑
	GBP Currency = `GBP`
	// HKD 港元
	HKD Currency = `HKD`
	// JPY 日元
	JPY Currency = `JPY`
	// KRW 韩元
	KRW Currency = `KRW`
	// AUD 澳元
	AUD Currency = `AUD`
	// CAD 加元
	CAD Currency = `CAD`
)

func (Currency) String added in v0.0.5

func (c Currency) String() string

type Device

type Device string

Device 设备类型

const (
	// App 在App支付
	App Device = `app`
	// Web 在电脑端网页上支付
	Web Device = `web`
	// Wap 在手机端网页上支付
	Wap Device = `wap`
)

func (Device) String added in v0.0.13

func (a Device) String() string

type GoodsType

type GoodsType int

GoodsType 商品类型

const (
	// VirtualGoods 虚拟商品
	VirtualGoods GoodsType = iota
	// PhysicalGoods 实物类商品
	PhysicalGoods
)

func (GoodsType) Name added in v0.0.13

func (a GoodsType) Name() string

func (GoodsType) String

func (a GoodsType) String() string

type OK

type OK struct {
	// contains filtered or unexported fields
}

func NewOK

func NewOK(msg error) *OK

func NewOKString

func NewOKString(msg string) *OK

func (*OK) OK

func (s *OK) OK()

type OKer

type OKer interface {
	OK()
}

type Options

type Options struct {
	IconClass string `json:"iconClass"`
	IconImage string `json:"iconImage"`
	Title     string `json:"title"`
	Name      string `json:"name"`
}

type Pay

type Pay struct {
	Platform       string    //付款平台(alipay/wechat/paypal)
	Device         Device    //付款时的设备
	NotifyURL      string    //接收付款结果通知的网址
	ReturnURL      string    //支付操作后返回的网址
	CancelURL      string    //取消付款后返回的网址
	Subject        string    //主题描述
	OutTradeNo     string    //业务方的交易号(我们的订单号)
	Amount         float64   //支付金额
	Currency       Currency  //币种
	GoodsType      GoodsType //商品类型
	PassbackParams string    //回传参数
	ExpiredAt      time.Time //支付过期时间
	Options        echo.H    //其它选项
}

Pay 付款参数

func (*Pay) GoodsTypeName

func (pay *Pay) GoodsTypeName() string

type Query added in v0.0.12

type Query struct {
	Platform    string //付款平台
	TradeNo     string //付款平台的交易号
	OutTradeNo  string //业务方的交易号(我们的订单号)
	RefundNo    string //付款平台的退款单号 (退款查询时有效)
	OutRefundNo string //业务方的退款单号 (退款查询时有效)
	Options     echo.H //其它选项
}

Query 查询参数

type Refund

type Refund struct {
	Platform     string   //付款平台
	TradeNo      string   //付款平台的交易号
	OutTradeNo   string   //业务方的交易号(我们的订单号)
	OutRefundNo  string   //业务方退单号
	TotalAmount  float64  //订单总金额(alipay可不传)
	RefundAmount float64  //退款金额
	RefundReason string   //退款原因(选填)
	Currency     Currency //币种
	NotifyURL    string   //接收退款结果通知的网址
	Options      echo.H   //其它选项
}

Refund 退款参数

type TradeStatus added in v0.0.12

type TradeStatus struct {
	Status string
	Extra  echo.H
}

TradeStatus 交易状态

func NewTradeStatus added in v0.0.12

func NewTradeStatus(status string, extras ...echo.H) TradeStatus

func (TradeStatus) IsClosed added in v0.0.12

func (t TradeStatus) IsClosed() bool

func (TradeStatus) IsFinished added in v0.0.12

func (t TradeStatus) IsFinished() bool

func (TradeStatus) IsProcessing added in v0.0.17

func (t TradeStatus) IsProcessing() bool

IsProcessing 是否退款中

func (TradeStatus) IsSuccess added in v0.0.12

func (t TradeStatus) IsSuccess() bool

func (TradeStatus) IsWaitPay added in v0.0.12

func (t TradeStatus) IsWaitPay() bool

Jump to

Keyboard shortcuts

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