添加文件: xy_sh/types.go
This commit is contained in:
parent
9f9316348d
commit
2f35a0130f
|
|
@ -0,0 +1,113 @@
|
||||||
|
package xy_sh
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 通用请求/响应结构体
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
// BaseRequest 基础请求头参数
|
||||||
|
type BaseRequest struct {
|
||||||
|
Timestamp string `json:"-"` // 毫秒级时间戳,由SDK自动填充
|
||||||
|
Sign string `json:"-"` // 签名,由SDK自动生成
|
||||||
|
}
|
||||||
|
|
||||||
|
// EncryptedRequest 加密后的请求体
|
||||||
|
type EncryptedRequest struct {
|
||||||
|
EncryptedData string `json:"encryptedData"` // SM4加密后的业务数据
|
||||||
|
}
|
||||||
|
|
||||||
|
// EncryptedResponse 加密后的响应体
|
||||||
|
type EncryptedResponse struct {
|
||||||
|
Code int `json:"code"` // 返回状态编码,0成功 -1失败
|
||||||
|
Msg string `json:"msg"` // 返回错误信息
|
||||||
|
Data *string `json:"data"` // JSON格式业务数据进行SM4加密后的字符串,可能为null
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 接口1:卡券/直充权益下单接口
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
// PlaceOrderRequest 下单请求业务参数
|
||||||
|
type PlaceOrderRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
GoodsCode string `json:"goodsCode"` // 供应商商品编号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号,唯一
|
||||||
|
Account string `json:"account,omitempty"` // 充值账号
|
||||||
|
CallbackUrl string `json:"callbackUrl,omitempty"` // 回调地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// PlaceOrderResponseData 下单响应解密后的业务数据
|
||||||
|
type PlaceOrderResponseData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 权益订单号
|
||||||
|
CouponNo string `json:"couponNo,omitempty"` // 卡号
|
||||||
|
CouponCode string `json:"couponCode,omitempty"` // 卡密
|
||||||
|
Status int `json:"status"` // 状态:-1发放中 0成功 1失败 2已核销 3已过期
|
||||||
|
ExpireTime string `json:"expireTime,omitempty"` // 有效期
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 接口2:卡券/直充/微信立减金订单查询接口
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
// QueryOrderRequest 查询订单请求业务参数
|
||||||
|
type QueryOrderRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
}
|
||||||
|
|
||||||
|
// CardInfo 卡券信息
|
||||||
|
type CardInfo struct {
|
||||||
|
CouponNo string `json:"couponNo"` // 卡号/短链
|
||||||
|
CouponCode string `json:"couponCode"` // 卡密
|
||||||
|
ExpireTime string `json:"expireTime"` // 过期时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryOrderResponseData 查询订单响应解密后的业务数据
|
||||||
|
type QueryOrderResponseData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 权益订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
Account string `json:"account,omitempty"` // 充值账号
|
||||||
|
CardInfo *CardInfo `json:"cardInfo,omitempty"` // 卡券信息
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 接口3:微信立减金订单充值接口
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
// WechatRechargeRequest 微信立减金充值请求业务参数
|
||||||
|
type WechatRechargeRequest struct {
|
||||||
|
ActCode string `json:"actCode"` // 活动code
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
GoodsCode string `json:"goodsCode"` // 供应商商品编号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号
|
||||||
|
AppId string `json:"appId"` // 公众账号ID
|
||||||
|
OpenId string `json:"openId"` // 微信用户标识
|
||||||
|
CallbackUrl string `json:"callbackUrl,omitempty"` // 回调地址
|
||||||
|
}
|
||||||
|
|
||||||
|
// WechatRechargeResponseData 微信立减金充值响应解密后的业务数据
|
||||||
|
type WechatRechargeResponseData struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 权益订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 微信优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 接口4:卡券/直充/微信立减金充值结果通知接口
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
// NotifyRequest 充值结果通知请求业务参数
|
||||||
|
type NotifyRequest struct {
|
||||||
|
OrderNo string `json:"orderNo"` // 供应商订单号
|
||||||
|
ActOrderNum string `json:"actOrderNum"` // 活动方订单号
|
||||||
|
Status int `json:"status"` // 订单状态
|
||||||
|
Account string `json:"account,omitempty"` // 直充账号
|
||||||
|
CardInfo *CardInfo `json:"cardInfo,omitempty"` // 卡券信息
|
||||||
|
CouponId string `json:"couponId,omitempty"` // 微信优惠id
|
||||||
|
}
|
||||||
|
|
||||||
|
// NotifyResponse 回调通知响应
|
||||||
|
type NotifyResponse struct {
|
||||||
|
StatusCode int // HTTP状态码
|
||||||
|
Body string // 响应体内容
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue