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.
106 lines
4.8 KiB
106 lines
4.8 KiB
package jjpay |
|
|
|
const ( |
|
baseUrl = "https://api.jjpay.org" |
|
payURL = "/api/india/payin" |
|
queryPayURL = "/api/query" |
|
withdrawURL = "/api/india/payout" |
|
queryWithdrawURL = "/api/query" |
|
mid = "17462512118" |
|
key = "f4eda3404ed5ce400936be7fb6cecb93" |
|
) |
|
|
|
type PayReq struct { |
|
MchId string `json:"mchId"` // 商户号 |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
ReturnUrl string `json:"returnUrl"` // 同步回调地址 |
|
NotifyUrl string `json:"notifyUrl"` // 异步回调地址 |
|
Name string `json:"name"` // 用户姓名 |
|
Mobile string `json:"mobile"` // 手机号 |
|
Email string `json:"email"` // 邮箱 |
|
Subject string `json:"subject"` // 商品标题 |
|
Amount int64 `json:"amount"` // 金额(单位:最小币种,如分) |
|
Time int64 `json:"time"` // 时间戳 |
|
Sign string `json:"sign"` // 签名 |
|
// Body string `json:"body"` // 商品描述(可为空) |
|
} |
|
|
|
type PayResp struct { |
|
Code int `json:"code"` // 响应状态(如 200 表示成功) |
|
Msg string `json:"msg"` // 响应消息 |
|
Data PayRespData `json:"data"` // 响应数据 |
|
} |
|
|
|
type PayRespData struct { |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
SystemOrderId string `json:"system_order_id"` // 平台订单号 |
|
Time int64 `json:"time"` // 下单时间戳 |
|
Amount float64 `json:"amount"` // 订单金额 |
|
Link string `json:"link"` // 收银台链接(可为空) |
|
Url string `json:"url"` // 支付跳转地址 |
|
Expire int64 `json:"expire"` // 订单过期时间戳 |
|
} |
|
|
|
type QueryReq struct { |
|
MchId string `json:"mchId"` // 商户号 |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
Time int64 `json:"time"` // 时间戳 |
|
Type string `json:"type"` // payin |
|
Sign string `json:"sign"` |
|
} |
|
|
|
type QueryResp struct { |
|
Code int `json:"code"` // 响应状态码,如 "200" |
|
Msg string `json:"msg"` // 响应描述 |
|
Data struct { |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
SystemOrderId string `json:"system_order_id"` // 平台订单号 |
|
Status int `json:"status"` // 订单状态(0:处理中,1:成功,2:失败) |
|
// Amount string `json:"amount"` // 订单金额(单位:元/卢比,字符串带两位小数) |
|
// Fee string `json:"fee"` // 手续费 |
|
Time int64 `json:"time"` // 时间戳 |
|
} `json:"data"` // 订单数据 |
|
} |
|
|
|
type CallbackReq struct { |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
Amount float64 `json:"amount"` // 订单金额 |
|
PayAmount float64 `json:"pay_amount"` // 实际支付金额 |
|
MchId string `json:"mchId"` // 商户号 |
|
Subject string `json:"subject"` // 商品名称 |
|
BankMsg string `json:"bankMsg"` // 失败说明(仅代付回调存在) |
|
SystemOrderId string `json:"system_order_id"` // 平台订单 |
|
Time int `json:"time"` // 当前时间戳 |
|
Sign string `json:"sign"` // 签名参数 |
|
Status int `json:"status"` // 订单状态(1 支付中,2 成功,3 失败) |
|
} |
|
|
|
type WithdrawReq struct { |
|
MchId string `json:"mchId"` // 商户号 |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
Amount int64 `json:"amount"` // 金额(单位:根据实际使用,可能为元、卢比、分等) |
|
NotifyUrl string `json:"notifyUrl"` // 异步通知地址 |
|
AccountType string `json:"account_type"` // 账户类型,如 "Bank" |
|
AccountCode string `json:"account_code"` // 银行编码 |
|
IFSC string `json:"ifsc"` // IFSC 码 |
|
Account string `json:"account"` // 收款人卡号/账号 |
|
Name string `json:"name"` // 收款人姓名 |
|
Mobile string `json:"mobile"` // 收款人手机号 |
|
Email string `json:"email"` // 收款人邮箱 |
|
Time string `json:"time"` // 请求时间戳(如为 int 类型可改为 int64) |
|
Sign string `json:"sign"` // 签名 |
|
} |
|
|
|
type WithdrawResp struct { |
|
Code int `json:"code"` // 响应状态(200为成功) |
|
Message string `json:"message"` // 响应消息 |
|
Data WithdrawRespData `json:"data"` // 响应数据 |
|
} |
|
|
|
type WithdrawRespData struct { |
|
OrderNo string `json:"orderNo"` // 商户订单号 |
|
SystemOrderId string `json:"system_order_id"` // 平台订单号 |
|
Time int64 `json:"time"` // 响应时间戳 |
|
Amount float64 `json:"amount"` // 金额 |
|
Status int `json:"status"` // 状态(1 成功,其他可定义为处理中、失败等) |
|
}
|
|
|