helper

package
v0.0.0-...-e191437 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBURI = "dburi"
	// TODO the database needs a new name
	Database           = "xy"
	AppColl            = "app"
	PayMethodColl      = "paymethod"
	PaymentDetailsColl = "paymentdetails"
	OrderDetailsColl   = "orderdetails"
)

DB

View Source
const (
	Wechat = "wechat"
	Alipay = "alipay"
	Stripe = "stripe"
)

Paymethod

View Source
const (
	Cert = "/path/to/certificates/tls.crt"
	Key  = "/path/to/certificates/tls.key"
)

TLS

View Source
const (
	DefaultPort   string = "443"
	DefaultDomain string = "cloud.sealos.io"
)

stripe

View Source
const (
	StripeSuccessPostfix = "STRIPE_SUCCESS_POSTFIX"
	StripeCancelPostfix  = "STRIPE_CANCEL_POSTFIX"
	StripeCurrency       = "STRIPE_CURRENCY"
)
View Source
const (
	LOCALHOST       = "http://localhost:2303"
	DNS             = "https://coqveoktbleo.dev.sealos.top"
	GROUP           = "/v1alpha1/pay"
	CreatePayMethod = "/method"
	CreatePayApp    = "/app"
	GetAppDetails   = "/details"
	GetSession      = "/session"
	GetPayStatus    = "/status"
	GetBill         = "/bill"
	TestAppID       = 66683568733697785
	TestSign        = "597d7f10a27219"
	TestUser        = "xy"
	TestOrderID     = "8QC6mu7vSNJckVhpKv"
	TestSessionID   = "cs_test_a1vbMHEx4iVfIWPoiJVVbBd7eecKDw8CDdJoLc7KRpahkMXYJ51EIlA1x5"
	TestTradeNO     = "049dfbf0b96ae9e2fa54a4b8eed6ea34"
)

Test

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(r *Request, client *mongo.Client) error

func InitDBAndColl

func InitDBAndColl(client *mongo.Client, datebase string, collection string) *mongo.Collection

func InitMongoClient

func InitMongoClient(URI string) *mongo.Client

func RequestLogger

func RequestLogger() gin.HandlerFunc

func ResponseLogger

func ResponseLogger() gin.HandlerFunc

Types

type App

type App struct {
	AppID      int64    `bson:"appID"`
	Sign       string   `bson:"sign"`
	PayAppName string   `bson:"payAppName"`
	Methods    []string `bson:"methods"`
}

type BillDetail

type BillDetail struct {
	OrderID   string `bson:"orderID"`
	Amount    string `bson:"amount"`
	Currency  string `bson:"currency"`
	PayTime   string `bson:"payTime"`
	PayMethod string `bson:"payMethod"`
	Status    string `bson:"status"`
}

type OrderDetails

type OrderDetails struct {
	OrderID     string                 `bson:"orderID"`
	User        string                 `bson:"user"`
	Amount      string                 `bson:"amount"`
	PayTime     string                 `bson:"paytime"`
	PayMethod   string                 `bson:"payMethod"`
	AppID       int64                  `bson:"appID"`
	DetailsData map[string]interface{} `bson:"detailsdata"`
}

type PayMethodDetail

type PayMethodDetail struct {
	PayMethod     string   `bson:"payMethod"`
	Currency      string   `bson:"currency"`
	AmountOptions []string `bson:"amountOptions"`
	ExchangeRate  float64  `bson:"exchangeRate"`
	TaxRate       float64  `bson:"taxRate"`
}

type PaymentDetails

type PaymentDetails struct {
	OrderID   string `bson:"orderID"`
	User      string `bson:"user"`
	Amount    string `bson:"amount"`
	Currency  string `bson:"currency"`
	PayTime   string `bson:"payTime"`
	PayMethod string `bson:"payMethod"`
	AppID     int64  `bson:"appID"`
	Status    string `bson:"status"`
}

type Request

type Request struct {
	AppID         int64    `json:"appID"`
	Sign          string   `json:"sign"`
	PayMethod     string   `json:"payMethod"`
	Amount        string   `json:"amount"`
	User          string   `json:"user"`
	PayAppName    string   `json:"payAppName,omitempty"`
	Currency      string   `json:"currency,omitempty"`
	AmountOptions []string `json:"amountOptions,omitempty"`
	ExchangeRate  float64  `json:"exchangeRate,omitempty"`
	TaxRate       float64  `json:"taxRate,omitempty"`
	TradeNO       string   `json:"tradeNO,omitempty"`
	SessionID     string   `json:"sessionID,omitempty"`
	OrderID       string   `json:"orderID,omitempty"`
}

func Init

func Init(c *gin.Context, client *mongo.Client) (*Request, error)

Jump to

Keyboard shortcuts

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