PaymentCenter/app/http/entities/front/pay.go

93 lines
3.1 KiB
Go

package front
import (
"PaymentCenter/app/models/ordersmodel"
)
type ApiCommonBody struct {
AppId int64 `json:"app_id" validate:"required"`
Timestamp int64 `json:"timestamp" validate:"required"`
}
type RequestBody struct {
AppId int64 `json:"app_id" validate:"required"`
Timestamp int64 `json:"timestamp" validate:"required"`
Data string `json:"data" validate:"required"`
Key string `json:"key" validate:"max=32"`
}
type PayCommonReqBody struct {
ApiCommonBody
PayChannelId int64 `json:"pay_channel_id" validate:"required" label:"支付渠道"`
Amount int `json:"amount" validate:"required" label:"支付金额,单位分"`
ExtJson string `json:"ext_json" label:"扩展参数"`
Desc string `json:"desc" validate:"max=100" label:"商品描述"`
ReturnUrl string `json:"return_url" validate:"max=1024" label:"支付成功后跳转的地址"`
OpenId string `json:"open_id" label:"用户openid"`
}
type PayReqs struct {
PayCommonReqBody
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
}
type RefundReqs struct {
PayCommonReqBody
RefundOutTradeNo string `json:"refund_out_trade_no" label:"需要退款的外侧商户订单号"`
RefundOrderId string `json:"refundOrder_id" label:"需要退款的平台订单号"`
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
}
type PayUrlResp struct {
Order string `json:"order"`
Url string `json:"url"`
}
type QueryReqs struct {
ApiCommonBody
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
}
// 关闭订单
type CloseReqs struct {
ApiCommonBody
PayChannelId int64 `json:"pay_channel_id" validate:"required" label:"支付渠道"`
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
}
// api 接口返回数据, 统一返回结构, order数据会进行加密
type ApiResponse struct {
Order interface{} `json:"order,omitempty"`
Url string `json:"url,omitempty"`
}
type PayChannelListRequest struct {
OrderId string `json:"id" form:"id" validate:"required"`
UserAgent string
}
type PayChannelListResponse struct {
PayName string `json:"pay_name"`
ChannelType int `json:"channel_type"`
}
type PayReqsV2 struct {
AppId int64 `json:"app_id" validate:"required"`
Timestamp int64 `json:"timestamp" validate:"required"`
Amount int `json:"amount" validate:"required" label:"支付金额,单位分"`
OutTradeNo string `json:"out_trade_no" validate:"required" label:"外侧商户订单号"`
ReturnUrl string `json:"return_url" validate:"max=1024" label:"支付成功后跳转的地址"`
Desc string `json:"desc" validate:"max=100" label:"商品描述"`
ExtJson string `json:"ext_json" label:"扩展参数"`
OpenId string `json:"open_id" label:"用户openid"` // 微信公众号支付时需要,如果没有传,可走支付中心的授权获取openid
}
type PayReqsV2Response struct {
RelationOrder *ordersmodel.Orders
Order *ordersmodel.Orders
PayCode int
Url string
ThirdMsg string
}