You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
3.1 KiB
72 lines
3.1 KiB
package payplus |
|
|
|
// 常量定义 |
|
const ( |
|
key = "your_secret_key" |
|
StatusSuccess = "SUCCESS" |
|
StatusFail = "FAIL" |
|
payApi = "http://api.letspayfast.com/apipay" |
|
withdrawApi = "http://api.letspayfast.com/apitrans" |
|
) |
|
|
|
// PayReq 支付请求结构体 |
|
type PayReq struct { |
|
MchId string `json:"mchId" binding:"required"` // 商户号 |
|
OrderNo string `json:"orderNo" binding:"required"` // 订单号 |
|
Amount int64 `json:"amount" binding:"required"` // 支付金额 |
|
NotifyUrl string `json:"notifyUrl" binding:"required"` // 支付结果通知的回调URL |
|
Sign string `json:"sign,omitempty"` // 签名,生成后填充 |
|
} |
|
|
|
// PaymentResponse 支付响应结构体 |
|
type PaymentResponse struct { |
|
RetCode string `json:"retCode"` |
|
PayUrl string `json:"payUrl"` |
|
OrderNo string `json:"orderNo"` |
|
PlatOrder string `json:"platOrder"` |
|
Code string `json:"code"` |
|
RetMsg string `json:"retMsg"` |
|
} |
|
|
|
// PayCallbackReq 支付通知结构体 |
|
type PayCallbackReq struct { |
|
MchId string `json:"mchId" binding:"required"` // 商户号 |
|
OrderNo string `json:"orderNo" binding:"required"` // 订单号 |
|
Amount string `json:"amount" binding:"required"` // 支付金额 |
|
TradeNo string `json:"tradeNo" binding:"required"` // 支付平台生成的交易号 |
|
Status string `json:"status" binding:"required"` // 支付状态(如成功、失败) |
|
Sign string `json:"sign" binding:"required"` // 签名,用于验证通知的真实性 |
|
} |
|
|
|
// WithdrawReq 代付请求结构体 |
|
type WithdrawReq struct { |
|
MchId string `json:"mchId" binding:"required"` // 商户号 |
|
OrderNo string `json:"orderNo" binding:"required"` // 订单号 |
|
Amount int64 `json:"amount" binding:"required"` // 代付金额 |
|
BankCode string `json:"bankCode" binding:"required"` // 收款银行代码 |
|
AccountName string `json:"accountName" binding:"required"` // 收款人姓名 |
|
AccountNo string `json:"accountNo" binding:"required"` // 收款账号 |
|
NotifyUrl string `json:"notifyUrl" binding:"required"` // 代付结果通知的回调URL |
|
Sign string `json:"sign,omitempty"` // 签名,生成后填充 |
|
} |
|
|
|
// PayoutResponse 代付响应结构体 |
|
type PayoutResponse struct { |
|
RetCode string `json:"retCode"` |
|
RetMsg string `json:"retMsg"` |
|
MchTransNo string `json:"mchTransNo"` |
|
PlatOrder string `json:"platOrder"` |
|
Status string `json:"status"` |
|
} |
|
|
|
// WithdrawCallbackReq 代付通知结构体 |
|
type WithdrawCallbackReq struct { |
|
MchId string `json:"mchId" binding:"required"` // 商户号 |
|
OrderNo string `json:"orderNo" binding:"required"` // 订单号 |
|
Amount string `json:"amount" binding:"required"` // 代付金额 |
|
TradeNo string `json:"tradeNo" binding:"required"` // 代付平台生成的交易号 |
|
Status string `json:"status" binding:"required"` // 代付状态(如成功、失败) |
|
AccountName string `json:"accountName" binding:"required"` // 收款人姓名 |
|
AccountNo string `json:"accountNo" binding:"required"` // 收款账号 |
|
Sign string `json:"sign" binding:"required"` // 签名,用于验证通知的真实性 |
|
}
|
|
|