payment

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

*

  • Copyright 2015 @ 56x.net.
  • name : new
  • author : jarryliu
  • date : 2015-07-27 20:22
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : new
  • author : jarryliu
  • date : 2015-07-27 20:22
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : payment
  • author : jarryliu
  • date : 2015-07-27 21:51
  • description :
  • history :

*

  • Copyright 2015 @ 56x.net.
  • name : result.go
  • author : jarryliu
  • date : 2015-07-27 21:52
  • description :
  • history :

Index

Constants

View Source
const StatusTradeFail = 2

交易失败

View Source
const StatusTradeSuccess = 1

交易成功

Variables

This section is empty.

Functions

func Debug

func Debug(format string, data ...interface{})

Types

type AliPay

type AliPay struct {
	Partner string //合作者ID
	Key     string //合作者私钥
	Seller  string //网站卖家邮箱地址
}

func (*AliPay) CreateGateway

func (this *AliPay) CreateGateway(orderNo string, fee float32, subject,
	body, notifyUrl, returnUrl string) string

func (*AliPay) Notify

func (this *AliPay) Notify(r *http.Request) Result

被动接收支付宝异步通知

func (*AliPay) Return

func (this *AliPay) Return(r *http.Request) Result

被动接收支付宝同步跳转的页面

func (*AliPay) Sign

func (this *AliPay) Sign(param interface{}) string

按照支付宝规则生成sign

type AliPayParameters

type AliPayParameters struct {
	InputCharset string  `json:"_input_charset"` //网站编码
	Body         string  `json:"body"`           //订单描述
	NotifyUrl    string  `json:"notify_url"`     //异步通知页面
	OutTradeNo   string  `json:"out_trade_no"`   //订单唯一id
	Partner      string  `json:"partner"`        //合作者身份ID
	PaymentType  uint8   `json:"payment_type"`   //支付类型 1:商品购买
	ReturnUrl    string  `json:"return_url"`     //回调url
	SellerEmail  string  `json:"seller_email"`   //卖家支付宝邮箱
	Service      string  `json:"service"`        //接口名称
	Subject      string  `json:"subject"`        //商品名称
	TotalFee     float32 `json:"total_fee"`      //总价
	Sign         string  `json:"sign"`           //签名,生成签名时忽略
	SignType     string  `json:"sign_type"`      //签名类型,生成签名时忽略
}

type AliPayWap

type AliPayWap struct {
	Merchant    string //合作者ID
	Key         string //合作者私钥
	Seller      string //网站卖家邮箱地址
	PrivateKey  string
	MerchantUrl string
}

func (*AliPayWap) CreateGateway

func (this *AliPayWap) CreateGateway(orderNo string, fee float32, subject,
	body, notifyUrl, returnUrl string) string

func (*AliPayWap) Notify

func (this *AliPayWap) Notify(r *http.Request) Result

被动接收支付宝异步通知

func (*AliPayWap) Return

func (this *AliPayWap) Return(r *http.Request) Result

被动接收支付宝同步跳转的页面

type IPayment

type IPayment interface {
	// 创建网关
	CreateGateway(orderNo string, fee float32, subject, body, notifyUrl, returnUrl string) string
	// 返回
	Return(r *http.Request) Result
	// 通知
	Notify(r *http.Request) Result
}

type Result

type Result struct {
	// 状态
	Status int
	// 错误消息
	ErrMsg string
	// 外部交易号(系统订单号)
	OutTradeNo string
	// 交易号
	TradeNo string
	// 金额
	Fee float32
}

Directories

Path Synopsis
*
*

Jump to

Keyboard shortcuts

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