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.
186 lines
9.5 KiB
186 lines
9.5 KiB
|
2 months ago
|
package foxpay
|
||
|
|
|
||
|
|
const (
|
||
|
|
baseURL = "https://api.foxpay.vip"
|
||
|
|
payURL = "/api/unifiedOrder"
|
||
|
|
queryPayURL = "/api/unifiedOrder/query"
|
||
|
|
withdrawURL = "/api/payOut"
|
||
|
|
queryWithdrawURL = "/api/payOut/query"
|
||
|
|
mid = "D6648CCA47AC43CCABA20631ADBE9C7B"
|
||
|
|
key = "I7BUg9z0jH6CC2q591InO0JOykffg4UxNJbMwrE97zqXYVkohrvLMQ3s6crSg10a"
|
||
|
|
payNo = "S201"
|
||
|
|
withdrawNo = "F201"
|
||
|
|
)
|
||
|
|
|
||
|
|
type PayReq struct {
|
||
|
|
Amount int64 `json:"amount"` // 交易金额,单位:元
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
UId string `json:"uId"` // 付款用户id
|
||
|
|
UbAccount string `json:"ubAccount"` // 用户付款账号
|
||
|
|
UName string `json:"uName"` // 付款用户名
|
||
|
|
UPhone string `json:"uPhone"` // 付款用户手机
|
||
|
|
UEmail string `json:"uEmail"` // 付款用户邮箱
|
||
|
|
Other string `json:"other"` // 其它参数
|
||
|
|
NotifyUrl string `json:"notifyUrl"` // 回调地址
|
||
|
|
ReqTime int64 `json:"reqTime"` // 下单时间(请求时间戳)
|
||
|
|
ReturnUrl string `json:"returnUrl"` // 同步跳转地址
|
||
|
|
MchNo string `json:"mchNo"` // 商户号
|
||
|
|
UIp string `json:"uIp"` // 用户真实ip地址
|
||
|
|
UdId string `json:"udId"` // 用户设备唯一ID
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
代收订单状态码
|
||
|
|
code 中文返回信息
|
||
|
|
PAID 已支付(有回调)
|
||
|
|
UN_PAYD 待支付
|
||
|
|
SUBMITTED_FAILED 提交失败
|
||
|
|
PAY_FAILED 支付失败
|
||
|
|
CANCEL_PAY 取消支付
|
||
|
|
*/
|
||
|
|
type PayResp struct {
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
MchNo string `json:"mchNo"` // 商户号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
ReceivableAmount string `json:"receivableAmount"` // 应收金额
|
||
|
|
RealAmount string `json:"realAmount"` // 实收金额(付款后为付款金额,未付款为0)
|
||
|
|
Amount string `json:"amount"` // 订单金额
|
||
|
|
ReqTime string `json:"reqTime"` // 订单时间
|
||
|
|
OrderNo string `json:"orderNo"` // 平台订单号
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
PaymentUrl string `json:"paymentUrl"` // 付款链接
|
||
|
|
AlternatePaymentUrl string `json:"alternatePaymentUrl"` // 备用付款链接
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
type PayCallbackReq struct {
|
||
|
|
Amount string `json:"amount"` // 交易金额
|
||
|
|
RealAmount string `json:"realAmount"` // 实收金额
|
||
|
|
MerServiceFee string `json:"merServiceFee"` // 商家手续费
|
||
|
|
MertSettlementAmount string `json:"mertSettlementAmount"` // 商户结算金额
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
UId string `json:"uId"` // 付款用户 ID
|
||
|
|
UbAccount string `json:"ubAccount"` // 用户付款账号
|
||
|
|
Other string `json:"other"` // 其它参数 (可选)
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
ReqTime string `json:"reqTime"` // 下单时间
|
||
|
|
ReturnUrl string `json:"returnUrl"` // 同步跳转地址,支付成功后跳转地址,不能携带参数
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
type QueryPayReq struct {
|
||
|
|
MchNo string `json:"mchNo"` // 商家号
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
OrderNo string `json:"orderNo"` // 平台订单号
|
||
|
|
}
|
||
|
|
|
||
|
|
type QueryPayResp struct {
|
||
|
|
Amount float64 `json:"amount"` // 交易金额
|
||
|
|
RealAmount float64 `json:"realAmount"` // 实收金额
|
||
|
|
MerServiceFee float64 `json:"merServiceFee"` // 商家手续费
|
||
|
|
MertSettlementAmount float64 `json:"mertSettlementAmount"` // 商户结算金额
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
UID string `json:"uId"` // 付款用户id
|
||
|
|
UbAccount string `json:"ubAccount"` // 用户付款账号
|
||
|
|
Other string `json:"other"` // 其它参数
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
ReqTime string `json:"reqTime"` // 下单时间
|
||
|
|
ReturnUrl string `json:"returnUrl"` // 同步跳转地址
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
代付订单状态码
|
||
|
|
code 中文返回信息
|
||
|
|
PROCESSED 已处理
|
||
|
|
PAID 已支付(有回调)
|
||
|
|
UN_PAYD 待支付
|
||
|
|
UN_SUBMITTED 未提交
|
||
|
|
SUBMITTED_FAILED 提交失败(有回调)
|
||
|
|
PAY_FAILED 支付失败(有回调)
|
||
|
|
CANCEL_PAY 取消支付(有回调)
|
||
|
|
PAYING 支付中
|
||
|
|
*/
|
||
|
|
type WithdrawReq struct {
|
||
|
|
Amount int64 `json:"amount"` // 交易金额
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchNo string `json:"mchNo"` // 商户号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
PayType string `json:"payType"` // 支付类型;:UPI/IMPS
|
||
|
|
UbAccount string `json:"ubAccount"` // 用户收款账号;UPI/imps
|
||
|
|
IfscCode string `json:"ifscCode"` // IMPS IFSC (当 payType=IMPS 时必填)
|
||
|
|
UName string `json:"uName"` // 收款用户名
|
||
|
|
UPhone string `json:"uPhone"` // 收款用户手机
|
||
|
|
UEmail string `json:"uEmail"` // 收款用户邮箱
|
||
|
|
FailMsg string `json:"failMsg"` // 失败原因
|
||
|
|
Other string `json:"other"` // 其它参数
|
||
|
|
NotifyUrl string `json:"notifyUrl"` // 回调地址
|
||
|
|
ReqTime int64 `json:"reqTime"` // 下单时间
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
type WithdrawResp struct {
|
||
|
|
MchNo string `json:"mchNo"` // 商户号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
SuperiorNo string `json:"superiorNo"` // 上游订单号
|
||
|
|
ReceivableAmount string `json:"receivableAmount"` // 应付金额
|
||
|
|
RealAmount string `json:"realAmount"` // 实付金额 (如失败金额为 0)
|
||
|
|
Amount string `json:"amount"` // 订单金额
|
||
|
|
ReqTime string `json:"reqTime"` // 订单时间
|
||
|
|
OrderNo string `json:"orderNo"` // 平台订单号
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
type WithdrawCallbackReq struct {
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
Amount string `json:"amount"` // 交易金额
|
||
|
|
MerServiceFee string `json:"merServiceFee"` // 商家手续费
|
||
|
|
SingleServiceFee string `json:"singleServiceFee"` // 单笔手续费
|
||
|
|
MertSettlementAmount string `json:"mertSettlementAmount"` // 商户结算金额
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
UId string `json:"uId"` // 收款用户 ID
|
||
|
|
UserBankAccount string `json:"userBankAccount"` // 用户收款账号
|
||
|
|
Other string `json:"other"` // 其它参数
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
ReqTime string `json:"reqTime"` // 下单时间
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|
||
|
|
|
||
|
|
type QueryWithdrawReq struct {
|
||
|
|
MchNo string `json:"mchNo"` // 商家号
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
OrderNo string `json:"orderNo"` // 平台订单号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号(可选)
|
||
|
|
}
|
||
|
|
|
||
|
|
type QueryWithdrawResp struct {
|
||
|
|
Amount float64 `json:"amount"` // 交易金额
|
||
|
|
MerServiceFee float64 `json:"merServiceFee"` // 商家手续费
|
||
|
|
SingleServiceFee float64 `json:"singleServiceFee"` // 单笔手续费
|
||
|
|
MertSettlementAmount float64 `json:"mertSettlementAmount"` // 商户结算金额
|
||
|
|
AisleCode string `json:"aisleCode"` // 通道号
|
||
|
|
MchOrderNo string `json:"mchOrderNo"` // 商家订单号
|
||
|
|
UId string `json:"uId"` // 收款用户id
|
||
|
|
UbAccount string `json:"ubAccount"` // 用户收款账号
|
||
|
|
Other string `json:"other"` // 其它参数
|
||
|
|
Status string `json:"status"` // 下单状态
|
||
|
|
ReqTime string `json:"reqTime"` // 下单时间
|
||
|
|
Code string `json:"code"` // 响应状态
|
||
|
|
Msg string `json:"msg"` // 响应失败原因
|
||
|
|
Sign string `json:"sign"` // 签名
|
||
|
|
}
|