extmongo

package
v0.0.0-...-a4179b6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 生成平台订单
	PaymentStatusCreatePlatformOrder = iota
	// 生成平台订单失败
	PaymentStatusCreatePlatformOrderFailed
	// 请求JSAPI下单接口, 创建微信预支付订单
	PaymentStatusCreateWXPrepayOrder
	// 请求JSAPI下单接口失败
	PaymentStatusCreateWXPrepayOrderFailed
	// 返回预付单标识
	PaymentStatusGetPrepayId
	// 生成带签名支付信息
	PaymentStatusCreatePaymentSignature
	// 生成带签名支付信息失败
	PaymentStatusCreatePaymentSignatureFailed
	// 关闭平台订单
	PaymentStatusClosePlatformOrder
	// 关闭平台订单失败
	PaymentStatusClosePlatformOrderFailed
	// 异步通知平台支付结果
	PaymentStatusRecvAsyncNotification
	// 保存支付通知
	PaymentStatusStoreAsyncNotification
	// 保存支付通知失败
	PaymentStatusStoreAsyncNotificationFailed
	// 返回告知成功接收处理
	PaymentStatusAckAsyncNotification
)
View Source
const (
	PaymentNotificationCollection = "payment_notifications"
)
View Source
const (
	PlatformOrderCollection = "platform_orders"
)

Variables

This section is empty.

Functions

func CloseConnPool

func CloseConnPool()

func InitConnPool

func InitConnPool(cfg *config.Storage)

func NewConnPoolContext

func NewConnPoolContext(ctx context.Context) (context.Context, context.CancelFunc)

Types

type MongoClientConnPool

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

func GetConnPool

func GetConnPool() *MongoClientConnPool

func (*MongoClientConnPool) AddPaymentNotification

func (impl *MongoClientConnPool) AddPaymentNotification(ctx context.Context, notification *PaymentNotificationModel) (
	err error)

func (*MongoClientConnPool) AddPlatformOrder

func (impl *MongoClientConnPool) AddPlatformOrder(ctx context.Context, order *PlatformOrderModel) (
	err error)

func (*MongoClientConnPool) UpdatePlatformOrder

func (impl *MongoClientConnPool) UpdatePlatformOrder(ctx context.Context, tradeId string, status int) (
	err error)

type PaymentInfoStorage

type PaymentInfoStorage interface {
	AddPlatformOrder(ctx context.Context, order *PlatformOrderModel) (err error)
	UpdatePlatformOrder(ctx context.Context, orderId string, status int) (err error)
	AddPaymentNotification(ctx context.Context, notification *PaymentNotificationModel) (err error)
}

type PaymentNotificationModel

type PaymentNotificationModel struct {
	Id                          primitive.ObjectID `bson:"_id,omitempty"`
	NotifyId                    string             `bson:"notify_id"`
	CreateTime                  string             `bson:"create_time"`
	EventType                   string             `bson:"event_type"`
	ResourceAppId               string             `bson:"resource_appid"`
	ResourceMchId               string             `bson:"resource_mchid"`
	TradeId                     string             `bson:"trade_id"`
	ResourceTransactionId       string             `bson:"resource_transaction_id"`
	ResourceTradeType           string             `bson:"resource_trade_type"`
	ResourceTradeState          string             `bson:"resource_trade_state"`
	ResourceTradeStateDesc      string             `bson:"resource_trade_state_desc"`
	ResourceBankType            string             `bson:"resource_bank_type"`
	ResourceSuccessTime         string             `bson:"resource_success_time"`
	ResourcePayerOpenId         string             `bson:"resource_payer_openid"`
	ResourceAmountTotal         int                `bson:"resource_amount_total"`
	ResourceAmountPayerTotal    int                `bson:"resource_amount_payer_total"`
	ResourceAmountCurrency      string             `bson:"resource_amount_currency"`
	ResourceAmountPayerCurrency string             `bson:"resource_amount_payer_currency"`
	Summary                     string             `bson:"summary"`
}

type PlatformOrderModel

type PlatformOrderModel struct {
	Id              primitive.ObjectID `bson:"_id,omitempty"`
	AppId           string             `bson:"app_id"`
	MchId           string             `bson:"merchant_id"`
	TradeId         string             `bson:"trade_id"`
	PayerUid        string             `bson:"payer_uid"`
	ItemDescription string             `bson:"item_description"`
	ItemAmountTotal int64              `bson:"item_amount_total"`
	Status          int                `bson:"status"`
	ExpireTime      int64              `bson:"expire_time"`
	CreateTime      int64              `bson:"create_time"`
	UpdateTime      int64              `bson:"update_time"`
}

Jump to

Keyboard shortcuts

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