asyncnotify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrNoSuccess success 错误码
	ErrNoSuccess = 0
	// ErrNoFailedToCheckTheSignature 验签失败
	ErrNoFailedToCheckTheSignature = 400
	// ErrNoRequestParameterError 请求参数错误
	ErrNoRequestParameterError = 401
	// ErrNoSystemError system error 错误码
	ErrNoSystemError = 10000

	// ErrTipsSuccess success 提示
	ErrTipsSuccess = "success"
	// ErrTipsSystemError system error 提示
	ErrTipsSystemError = "system error"

	// StateSuccess 结果状态,目前有两种状态"SUCCESS" (支付成功),"CANCEL"(支付取消))
	// indicates that the payment was successful
	StateSuccess = "SUCCESS"

	// StateCancel indicates that the payment was cancelled
	StateCancel = "CANCEL"
)
View Source
const (
	// AsyncPay 异步支付类型
	AsyncPay = "payment"

	// AsyncSettle 异步结算类型
	AsyncSettle = "settle"

	// AsyncRefund 异步退款类型
	AsyncRefund = "refund"

	// AsyncWithdraw 异步提现类型
	AsyncWithdraw = "withdraw"

	// AsyncTransfer 异步转账类型
	AsyncTransfer = "transfer"

	// AsyncSettleFinish 异步结算完成类型 自动分账
	AsyncSettleFinish = "settle_finish"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncNotify

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

AsyncNotify async notify

func NewAsyncNotify

func NewAsyncNotify(cfg *credential.ContextConfig) *AsyncNotify

NewAsyncNotify init

func (*AsyncNotify) AsyncNotify

func (a *AsyncNotify) AsyncNotify(ctx context.Context, req *AsyncRequest) (resp *AsyncResponse, err error)

AsyncNotify 异步通知

type AsyncRequest

type AsyncRequest struct {
	Content          string `json:"content" description:"回调内容,应答中的报文主体(response body)"`
	Version          string `json:"version" description:"固定值:3.0。回调版本,用于开发者识别回调参数的变更"`
	Msg              string `json:"msg" description:"订单相关信息的 JSON 字符串"`
	Type             string `json:"type" description:"回调类型(支付结果回调为 payment):payment(支付成功/支付取消)"`
	ByteIdentifyName string `json:"Byte-Identifyname" description:"回调标识,用于开发者识别回调来源" in:"header"`
	ByteLogID        string `json:"Byte-LogId" description:"回调日志 ID" in:"header"`
	ByteNonceStr     string `json:"Byte-Nonce-Str" description:"随机字符串" in:"header"`
	ByteSignature    string `json:"Byte-Signature" description:"签名" in:"header"`
	ByteTimestamp    string `json:"Byte-Timestamp" description:"时间戳" in:"header"`
}

AsyncRequest 异步通知

type AsyncResponse

type AsyncResponse struct {
	ErrNo       int          `json:"err_no"`
	ErrTips     string       `json:"err_tips"`
	Type        string       `json:"type" description:"回调类型(支付结果回调为 payment):payment(支付成功/支付取消)"`
	PaymentData *PaymentData `json:"paymentData"`
	SettleData  *SettleData  `json:"settleData"`
}

AsyncResponse 异步响应

type PaymentData

type PaymentData struct {
	AppID          string `json:"app_id" description:"小程序 app_id"`
	OutOrderNo     string `` /* 138-byte string literal not displayed */
	OrderID        string `json:"order_id" description:"抖音开平侧订单 id,长度 <= 64byte"`
	Status         string `json:"status" description:"支付结果状态,目前有两种状态:SUCCESS(支付成功),CANCEL(支付取消)"`
	TotalAmount    int    `json:"total_amount" description:"订单总金额,单位分,支付金额为 = total_amount - discount_amount"`
	DiscountAmount int    `json:"discount_amount" description:"订单优惠金额,单位分,接入营销时请关注这个字段"`
	PayChannel     int    `json:"pay_channel" description:"支付渠道枚举(支付成功时才有):1:微信,2:支付宝 10:抖音支付"`
	ChannelPayID   string `` /* 157-byte string literal not displayed */
	MerchantUID    string `` /* 158-byte string literal not displayed */
	Message        string `json:"message" description:"该笔交易取消原因,如:USER_CANCEL:用户取消,TIME_OUT:超时取消"`
	CpExtra        string `json:"cp_extra"`
	EventTime      int64  `json:"event_time" description:"用户支付成功/支付取消时间戳,单位为毫秒"`
}

PaymentData 异步通知

type SettleData

type SettleData struct {
	AppID        string `json:"app_id" description:"小程序 id "`
	Status       string `json:"status"`
	OrderID      string `json:"order_id"`
	CpExtra      string `json:"cp_extra"`
	Message      string `json:"message"`
	EventTime    int64  `json:"event_time"`
	SettleID     string `json:"settle_id"`
	OutSettleNo  string `json:"out_settle_no"`
	Rake         int    `json:"rake"`
	Commission   int    `json:"commission" desc:"交易参与 CPS 投放等任务产生的佣金,单位分 "`
	SettleDetail string `json:"settle_detail" desc:"分账细节 "`
	SettleAmount int    `json:"settle_amount"`
	ItemOrderID  string `json:"item_order_id"`
	IsAutoSettle bool   `json:"is_auto_settle" desc:"是否自动分账 "`
}

SettleData 结算异步信息

Jump to

Keyboard shortcuts

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