pp

package
v1.618.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PaymentEnvWechatBrowser = "WechatBrowser"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlipayPaymentProvider

type AlipayPaymentProvider struct {
	Client *alipay.Client
}

func NewAlipayPaymentProvider

func NewAlipayPaymentProvider(appId string, appCertificate string, appPrivateKey string, authorityPublicKey string, authorityRootPublicKey string) (*AlipayPaymentProvider, error)

func (*AlipayPaymentProvider) GetInvoice added in v1.44.9

func (pp *AlipayPaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*AlipayPaymentProvider) GetResponseError added in v1.324.0

func (pp *AlipayPaymentProvider) GetResponseError(err error) string

func (*AlipayPaymentProvider) Notify added in v1.29.0

func (pp *AlipayPaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*AlipayPaymentProvider) Pay

func (pp *AlipayPaymentProvider) Pay(r *PayReq) (*PayResp, error)

type DummyPaymentProvider added in v1.327.0

type DummyPaymentProvider struct{}

func NewDummyPaymentProvider added in v1.327.0

func NewDummyPaymentProvider() (*DummyPaymentProvider, error)

func (*DummyPaymentProvider) GetInvoice added in v1.327.0

func (pp *DummyPaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*DummyPaymentProvider) GetResponseError added in v1.327.0

func (pp *DummyPaymentProvider) GetResponseError(err error) string

func (*DummyPaymentProvider) Notify added in v1.327.0

func (pp *DummyPaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*DummyPaymentProvider) Pay added in v1.327.0

func (pp *DummyPaymentProvider) Pay(r *PayReq) (*PayResp, error)

type GcInvoiceReqInfo added in v1.44.9

type GcInvoiceReqInfo struct {
	BusNo        string `json:"busno"`
	PayerName    string `json:"payername"`
	IdNum        string `json:"idnum"`
	PayerType    string `json:"payertype"`
	InvoiceTitle string `json:"invoicetitle"`
	Tin          string `json:"tin"`
	Phone        string `json:"phone"`
	Email        string `json:"email"`
}

type GcInvoiceRespInfo added in v1.44.9

type GcInvoiceRespInfo struct {
	BusNo     string `json:"busno"`
	State     string `json:"state"`
	EbillCode string `json:"ebillcode"`
	EbillNo   string `json:"ebillno"`
	CheckCode string `json:"checkcode"`
	Url       string `json:"url"`
	Content   string `json:"content"`
}

type GcNotifyRespInfo added in v1.29.0

type GcNotifyRespInfo struct {
	Xmpch      string  `json:"xmpch"`
	OrderDate  string  `json:"orderdate"`
	OrderNo    string  `json:"orderno"`
	Amount     float64 `json:"amount"`
	Jylsh      string  `json:"jylsh"`
	TradeNo    string  `json:"tradeno"`
	PayMethod  string  `json:"paymethod"`
	OrderState string  `json:"orderstate"`
	ReturnType string  `json:"return_type"`
	PayerId    string  `json:"payerid"`
	PayerName  string  `json:"payername"`
}

type GcPayReqInfo added in v1.29.0

type GcPayReqInfo struct {
	OrderDate string `json:"orderdate"`
	OrderNo   string `json:"orderno"`
	Amount    string `json:"amount"`
	Xmpch     string `json:"xmpch"`
	Body      string `json:"body"`
	ReturnUrl string `json:"return_url"`
	NotifyUrl string `json:"notify_url"`
	PayerId   string `json:"payerid"`
	PayerName string `json:"payername"`
	Remark1   string `json:"remark1"`
	Remark2   string `json:"remark2"`
}

type GcPayRespInfo added in v1.29.0

type GcPayRespInfo struct {
	Jylsh     string `json:"jylsh"`
	Amount    string `json:"amount"`
	PayerId   string `json:"payerid"`
	PayerName string `json:"payername"`
	PayUrl    string `json:"payurl"`
}

type GcPaymentProvider added in v1.29.0

type GcPaymentProvider struct {
	Xmpch     string
	SecretKey string
	Host      string
}

func NewGcPaymentProvider added in v1.29.0

func NewGcPaymentProvider(clientId string, clientSecret string, host string) *GcPaymentProvider

func (*GcPaymentProvider) GetInvoice added in v1.44.9

func (pp *GcPaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*GcPaymentProvider) GetResponseError added in v1.324.0

func (pp *GcPaymentProvider) GetResponseError(err error) string

func (*GcPaymentProvider) Notify added in v1.29.0

func (pp *GcPaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*GcPaymentProvider) Pay added in v1.29.0

func (pp *GcPaymentProvider) Pay(r *PayReq) (*PayResp, error)

type GcRequestBody added in v1.29.0

type GcRequestBody struct {
	Op          string `json:"op"`
	Xmpch       string `json:"xmpch"`
	Version     string `json:"version"`
	Data        string `json:"data"`
	RequestTime string `json:"requesttime"`
	Sign        string `json:"sign"`
}

type GcResponseBody added in v1.29.0

type GcResponseBody struct {
	Op         string `json:"op"`
	Xmpch      string `json:"xmpch"`
	Version    string `json:"version"`
	ReturnCode string `json:"return_code"`
	ReturnMsg  string `json:"return_msg"`
	Data       string `json:"data"`
	NotifyTime string `json:"notifytime"`
	Sign       string `json:"sign"`
}

type NotifyResult added in v1.377.2

type NotifyResult struct {
	PaymentName   string
	PaymentStatus PaymentState
	NotifyMessage string

	ProductName        string
	ProductDisplayName string
	ProviderName       string
	Price              float64
	Currency           string

	OrderId string
}

type PayReq added in v1.452.0

type PayReq struct {
	ProviderName       string
	ProductName        string
	PayerName          string
	PayerId            string
	PaymentName        string
	ProductDisplayName string
	Price              float64
	Currency           string

	ReturnUrl string
	NotifyUrl string

	PaymentEnv string
}

type PayResp added in v1.452.0

type PayResp struct {
	PayUrl     string
	OrderId    string
	AttachInfo map[string]interface{}
}

type PaymentProvider

type PaymentProvider interface {
	Pay(req *PayReq) (*PayResp, error)
	Notify(body []byte, orderId string) (*NotifyResult, error)
	GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)
	GetResponseError(err error) string
}

type PaymentState added in v1.377.2

type PaymentState string
const (
	PaymentStatePaid     PaymentState = "Paid"
	PaymentStateCreated  PaymentState = "Created"
	PaymentStateCanceled PaymentState = "Canceled"
	PaymentStateTimeout  PaymentState = "Timeout"
	PaymentStateError    PaymentState = "Error"
)

type PaypalPaymentProvider added in v1.326.1

type PaypalPaymentProvider struct {
	Client *paypal.Client
}

func NewPaypalPaymentProvider added in v1.326.1

func NewPaypalPaymentProvider(clientID string, secret string) (*PaypalPaymentProvider, error)

func (*PaypalPaymentProvider) GetInvoice added in v1.326.1

func (pp *PaypalPaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*PaypalPaymentProvider) GetResponseError added in v1.326.1

func (pp *PaypalPaymentProvider) GetResponseError(err error) string

func (*PaypalPaymentProvider) Notify added in v1.326.1

func (pp *PaypalPaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*PaypalPaymentProvider) Pay added in v1.326.1

func (pp *PaypalPaymentProvider) Pay(r *PayReq) (*PayResp, error)

type StripePaymentProvider added in v1.390.0

type StripePaymentProvider struct {
	PublishableKey string
	SecretKey      string
	// contains filtered or unexported fields
}

func NewStripePaymentProvider added in v1.390.0

func NewStripePaymentProvider(PublishableKey, SecretKey string) (*StripePaymentProvider, error)

func (*StripePaymentProvider) GetInvoice added in v1.390.0

func (pp *StripePaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*StripePaymentProvider) GetResponseError added in v1.390.0

func (pp *StripePaymentProvider) GetResponseError(err error) string

func (*StripePaymentProvider) Notify added in v1.390.0

func (pp *StripePaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*StripePaymentProvider) Pay added in v1.390.0

func (pp *StripePaymentProvider) Pay(r *PayReq) (*PayResp, error)

type WechatPayNotifyResponse added in v1.324.0

type WechatPayNotifyResponse struct {
	Code    string `json:"Code"`
	Message string `json:"Message"`
}

type WechatPaymentProvider added in v1.290.0

type WechatPaymentProvider struct {
	Client *wechat.ClientV3
	AppId  string
}

func NewWechatPaymentProvider added in v1.290.0

func NewWechatPaymentProvider(mchId string, apiV3Key string, appId string, serialNo string, privateKey string) (*WechatPaymentProvider, error)

func (*WechatPaymentProvider) GetInvoice added in v1.290.0

func (pp *WechatPaymentProvider) GetInvoice(paymentName string, personName string, personIdCard string, personEmail string, personPhone string, invoiceType string, invoiceTitle string, invoiceTaxId string) (string, error)

func (*WechatPaymentProvider) GetResponseError added in v1.324.0

func (pp *WechatPaymentProvider) GetResponseError(err error) string

func (*WechatPaymentProvider) Notify added in v1.290.0

func (pp *WechatPaymentProvider) Notify(body []byte, orderId string) (*NotifyResult, error)

func (*WechatPaymentProvider) Pay added in v1.290.0

func (pp *WechatPaymentProvider) Pay(r *PayReq) (*PayResp, error)

Jump to

Keyboard shortcuts

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