1
This commit is contained in:
@@ -1 +0,0 @@
|
||||
package tlpay
|
||||
@@ -1,70 +0,0 @@
|
||||
package tlpay
|
||||
|
||||
const ( //交易方式
|
||||
PayWxScan = "W01" //微信扫码支付
|
||||
PayWxJS = "W02" //微信JS支付
|
||||
PayWxMini = "W06" //微信小程序支付
|
||||
PayAlScan = "A01" //支付宝扫码支付
|
||||
PayAlJS = "A02" //支付宝JS支付
|
||||
PayAlApp = "A03" //支付宝APP支付
|
||||
PayQqScan = "Q01" //手机QQ扫码支付
|
||||
PayQqJS = "Q02" //手机QQ JS支付
|
||||
PayCsbScan = "U01" //银联扫码支付(CSB)
|
||||
PayCsbJS = "U02" //银联JS支付
|
||||
PayDigitalH5 = "S03" //数字货币H5
|
||||
)
|
||||
|
||||
const ( //交易类型
|
||||
PayTypeWx = "VSP501" //微信支付
|
||||
PayTypeWxCancel = "VSP502" //微信支付撤销
|
||||
PayTypeWxRefund = "VSP503" //微信支付退款
|
||||
PayTypeQq = "VSP505" //手机QQ支付
|
||||
PayTypeQqCancel = "VSP506" //手机QQ支付撤销
|
||||
PayTypeQqRefund = "VSP507" //手机QQ支付退款
|
||||
PayTypeAl = "VSP511" //支付宝支付
|
||||
PayTypeAlCancel = "VSP512" //支付宝支付撤销
|
||||
PayTypeAlRefund = "VSP513" //支付宝支付退款
|
||||
PayTypeCsb = "VSP551" //银联扫码支付
|
||||
PayTypeCsbCancel = "VSP552" //银联扫码撤销
|
||||
PayTypeCsbRefund = "VSP553" //银联扫码退货
|
||||
PayTypeDigitalH5 = "VSP611" //数字货币支付
|
||||
PayTypeDigitalH5Cancel = "VSP612" //数字货币撤销
|
||||
PayTypeDigitalH5Refund = "VSP613" //数字货币退货
|
||||
)
|
||||
|
||||
const ( //交易返回码trxStatus说明
|
||||
trxStatusSuccess = 0000 //交易成功
|
||||
trxStatusAbsent = 1001 //交易不存在
|
||||
trxStatusProcessing1 = 2008
|
||||
trxStatusProcessing2 = 2000 //交易处理中,请查询交易
|
||||
//以下都代表交易失败(3开头)
|
||||
trxStatusDuplicateReqSN = 3888 //流水号重复
|
||||
trxStatusControlFail = 3889 //交易控制失败,具体原因看errMsg
|
||||
trxStatusMerchantFail = 3099 //渠道商户错误
|
||||
trxStatusAmountLessThanCharge = 3014 //交易金额小于应收手续费
|
||||
trxStatusRealCheckingFail = 3031 //校验实名信息失败
|
||||
trxStatusNotPay = 3088 //交易未支付
|
||||
trxStatusCancelAbnormal = 3089 //撤销异常
|
||||
trxStatusOtherError1 = 3045
|
||||
trxStatusOtherError2 = 3999 //其他错误,具体原因看errMsg
|
||||
trxStatusAlreadyCanceled = 3050 //交易已被撤销
|
||||
)
|
||||
|
||||
var (
|
||||
trxStatus = map[int]string{
|
||||
trxStatusSuccess: "交易成功",
|
||||
trxStatusAbsent: "交易不存在",
|
||||
trxStatusProcessing1: "交易处理中1",
|
||||
trxStatusProcessing2: "交易处理中2",
|
||||
trxStatusDuplicateReqSN: "流水号重复",
|
||||
trxStatusControlFail: "交易控制失败",
|
||||
trxStatusMerchantFail: "渠道商户错误",
|
||||
trxStatusAmountLessThanCharge: "交易金额小于应收手续费",
|
||||
trxStatusRealCheckingFail: "校验实名信息失败",
|
||||
trxStatusNotPay: "交易未支付",
|
||||
trxStatusCancelAbnormal: "撤销异常",
|
||||
trxStatusOtherError1: "其他错误1",
|
||||
trxStatusOtherError2: "其他错误2",
|
||||
trxStatusAlreadyCanceled: "交易已被撤销",
|
||||
}
|
||||
)
|
||||
@@ -1,128 +0,0 @@
|
||||
package tlpay
|
||||
|
||||
const (
|
||||
sigKey = "sign"
|
||||
sigTypeMd5 = "MD5"
|
||||
sigTypeSha256 = "HMAC-SHA256"
|
||||
)
|
||||
|
||||
//var (
|
||||
// payMap = map[string]*wxpayapi.API{
|
||||
// "weixinapp": api.WxpayAPI,
|
||||
// "weixinmini": api.WxpayAPI2,
|
||||
// }
|
||||
//)
|
||||
|
||||
//func (p *PayHandler) CreatePay(txDB orm.TxOrmer, subAppID string) (err error) {
|
||||
// switch p.PayType {
|
||||
// case PayTypeWx:
|
||||
// param := &tonglianpayapi.CreateFakeOrderRes{
|
||||
// Trxamt: p.Order.PayPrice,
|
||||
// NotifyUrl: globals.TLPayNotifyURL,
|
||||
// Reqsn: p.Order.OrderID,
|
||||
// PayType: p.VendorPayType,
|
||||
// }
|
||||
// //暂时做兼容处理
|
||||
// if p.VendorPayType == "JSAPI" {
|
||||
// param.PayType = tonglianpayapi.PayTypeWxXcx
|
||||
// }
|
||||
// if p.VendorPayType == tonglianpayapi.PayTypeWxXcx {
|
||||
// param.SubAppID = subAppID
|
||||
// authInfo, err := p.Ctx.GetV2AuthInfo()
|
||||
// // 微信小程序支付
|
||||
// if err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
|
||||
// param.Acct = authInfo.GetAuthID()
|
||||
// }
|
||||
// }
|
||||
// if p.VendorPayType == tonglianpayapi.PayTypeZfbJS || p.VendorPayType == tonglianpayapi.PayTypeZfbApp {
|
||||
// if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil {
|
||||
// param.Acct = authInfo.GetAuthID()
|
||||
// }
|
||||
// if param.Acct == "" {
|
||||
// return fmt.Errorf("未找到用户的认证ID!")
|
||||
// }
|
||||
// }
|
||||
// if p.VendorPayType == tonglianpayapi.PayTypeH5 {
|
||||
// param2 := &tonglianpayapi.CreateH5UnitorderOrderParam{
|
||||
// Trxamt: p.Order.PayPrice,
|
||||
// NotifyUrl: globals.TLPayNotifyURL,
|
||||
// Body: "冲天猴",
|
||||
// Charset: "UTF-8",
|
||||
// }
|
||||
// err = api.TLpayAPI.CreateH5UnitorderOrder(param2)
|
||||
// } else {
|
||||
// result, err := api.TLpayAPI.CreateUnitorderOrder(param)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// var result2 tonglianpayapi.PayInfo
|
||||
// json.Unmarshal([]byte(result.PayInfo), &result2)
|
||||
// p.Order.PrepayID = result2.Package[strings.LastIndex(result2.Package, "=")+1 : len(result2.Package)]
|
||||
// p.Order.TransactionID = result.TrxID
|
||||
//
|
||||
// if _, err = dao.UpdateEntityTx(txDB, p.Order, "PrepayID", "TransactionID"); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// wxPay := &WxPayParam{
|
||||
// Prepayid: p.Order.PrepayID,
|
||||
// Noncestr: result2.NonceStr,
|
||||
// Timestamp: utils.Int64ToStr(utils.MustInterface2Int64(result2.TimeStamp)),
|
||||
// Package: result2.Package,
|
||||
// Partnerid: "", // 商户Id
|
||||
// Appid: result2.AppID,
|
||||
// Sign: result2.PaySign,
|
||||
// }
|
||||
// p.WxPayParam = wxPay
|
||||
// }
|
||||
// // 暂时不支持微信直接支付
|
||||
// case model.PayTypeWX:
|
||||
// param := &wxpayapi.CreateOrderParam{
|
||||
// OutTradeNo: p.Order.OrderID,
|
||||
// Body: "冲天猴儿App账户充值",
|
||||
// NotifyURL: globals.WxpayNotifyURL,
|
||||
// SpbillCreateIP: p.Ctx.GetRealRemoteIP(),
|
||||
// TradeType: p.VendorPayType,
|
||||
// TotalFee: p.Order.PayPrice,
|
||||
// TimeStart: wxpayapi.Time2PayTime(time.Now()),
|
||||
// // ProfitSharing: wxpayapi.OptYes,
|
||||
// }
|
||||
// authBinds, err := dao.GetUserBindAuthInfo(dao.GetDB(), p.Ctx.GetUserID(), model.AuthBindTypeAuth, []string{p.Order.Way}, "", "", "")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// if len(authBinds) == 0 {
|
||||
// return fmt.Errorf("未绑定微信认证方式!")
|
||||
// }
|
||||
// param.OpenID = authBinds[0].AuthID
|
||||
// result, err2 := payMap[p.Order.Way].CreateUnifiedOrder(param)
|
||||
// if err2 == nil {
|
||||
// param2 := make(map[string]interface{})
|
||||
// param2["prepayid"] = result.PrepayID
|
||||
// param2["noncestr"] = utils.GetUUID()
|
||||
// param2["timestamp"] = time.Now().Unix()
|
||||
// param2["package"] = "Sign=WXPay"
|
||||
// param2["partnerid"] = result.MchID
|
||||
// param2["appid"] = result.AppID
|
||||
// sign := signParam(sigTypeMd5, param2)
|
||||
// wxPay := &WxPayParam{
|
||||
// Prepayid: param2["prepayid"].(string),
|
||||
// Noncestr: param2["noncestr"].(string),
|
||||
// Timestamp: utils.Int64ToStr(utils.MustInterface2Int64(param2["timestamp"])),
|
||||
// Package: param2["package"].(string),
|
||||
// Partnerid: param2["partnerid"].(string),
|
||||
// Appid: param2["appid"].(string),
|
||||
// Sign: sign,
|
||||
// }
|
||||
// p.WxPayParam = wxPay
|
||||
// p.Order.PrepayID = result.PrepayID
|
||||
// p.Order.Comment = result.CodeURL
|
||||
// _, err = dao.UpdateEntityTx(txDB, p.Order, "PrepayID", "Comment")
|
||||
// } else {
|
||||
// return err2
|
||||
// }
|
||||
// default:
|
||||
// err = fmt.Errorf("支付方式:%d当前不支持", p.PayType)
|
||||
// }
|
||||
// return err
|
||||
//}
|
||||
@@ -1,26 +0,0 @@
|
||||
package tlpay
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
type tlPayParam struct {
|
||||
CusID string `json:"cusID"` //商户号
|
||||
AppID string `json:"appID "` //应用ID
|
||||
TrxAmt int `json:"trxAmt"` //交易金额
|
||||
ReqSN string `json:"reqSN"` //商户交易单号
|
||||
PayType string `json:"payType"` //交易方式
|
||||
RandomStr string `json:"randomStr"` //随机字符串
|
||||
SignType string `json:"signType"` //签名方式
|
||||
Sign string `json:"sign"` //签名
|
||||
}
|
||||
type PayHandler struct {
|
||||
Ctx *jxcontext.Context
|
||||
PayType string `json:"payType"`
|
||||
Order *model.OrderPay
|
||||
TLPayParam *tlPayParam `json:"tlPayParam"`
|
||||
}
|
||||
type PayHandlerInterface struct {
|
||||
//CreatePay() (err error)
|
||||
}
|
||||
Reference in New Issue
Block a user