Compare commits
No commits in common. "main" and "v1.0.6" have entirely different histories.
41
README.md
41
README.md
|
|
@ -6,45 +6,14 @@
|
|||
|
||||
```
|
||||
lklsdk/
|
||||
├── account.go # 账户相关功能
|
||||
├── common/ # 通用工具和客户端
|
||||
│ ├── client.go # 核心客户端
|
||||
│ ├── json_cleaner.go # JSON清理工具
|
||||
│ └── structs.go # 通用结构体定义
|
||||
├── merchant.go # 商户相关功能
|
||||
├── merchant/ # 商户相关模块
|
||||
│ └── in_net/ # 网络接口
|
||||
│ └── ec/ # 电子合同功能
|
||||
│ ├── apply/ # 电子合同申请
|
||||
│ │ ├── api.go # API实现
|
||||
│ │ ├── request.go # 请求结构体
|
||||
│ │ └── response.go # 响应结构体
|
||||
│ ├── applymanual/ # 电子合同人工复核申请
|
||||
│ │ ├── api.go # API实现
|
||||
│ │ ├── request.go # 请求结构体
|
||||
│ │ └── response.go # 响应结构体
|
||||
│ ├── download/ # 电子合同下载
|
||||
│ │ ├── api.go # API实现
|
||||
│ │ ├── request.go # 请求结构体
|
||||
│ │ └── response.go # 响应结构体
|
||||
│ ├── qmastatus/ # 电子合同人工复核结果查询
|
||||
│ │ ├── api.go # API实现
|
||||
│ │ ├── request.go # 请求结构体
|
||||
│ │ └── response.go # 响应结构体
|
||||
│ └── querystatus/ # 电子合同签署状态查询
|
||||
│ ├── api.go # API实现
|
||||
│ ├── request.go # 请求结构体
|
||||
│ └── response.go # 响应结构体
|
||||
├── mergePre.go # 主扫合单交易功能
|
||||
├── sdk.go # SDK主入口
|
||||
├── client.go # 核心客户端
|
||||
├── split_ledger.go # 分账基本功能
|
||||
├── split_ledger_more.go # 分账扩展功能
|
||||
├── trade.go # 交易相关功能
|
||||
├── unifiedreturn/ # 统一退款功能
|
||||
│ ├── mergerefund/ # 合并退款
|
||||
│ ├── refund/ # 退款
|
||||
│ ├── refundfee/ # 退款手续费
|
||||
│ └── refundquery/ # 退款查询
|
||||
├── account.go # 账户相关功能
|
||||
├── merge_pre.go # 主扫合单交易功能
|
||||
├── sdk.go # SDK主入口
|
||||
├── merchant.go # 商户相关功能
|
||||
└── uploadFile.go # 文件上传相关功能
|
||||
```
|
||||
|
||||
|
|
|
|||
42
consts/ec.go
42
consts/ec.go
|
|
@ -1,42 +0,0 @@
|
|||
package consts
|
||||
|
||||
type ECType string
|
||||
|
||||
const (
|
||||
ECType001 ECType = "EC001" // EC001 : 特约商户支付服务合作协议V3.1(商户入网)
|
||||
ECType002 ECType = "EC002" // EC002 : 特约商户支付服务合作协议V3.2(商户入网+分账)
|
||||
ECType003 ECType = "EC003" // EC003 : 分账结算授权委托书
|
||||
ECType004 ECType = "EC004" // EC004 : 特约商户支付服务合作协议V3.3(商户入网)
|
||||
ECType005 ECType = "EC005" // EC005 : 特约商户支付服务合作协议V3.3(商户入网+分账)
|
||||
ECType007 ECType = "EC007" // EC007 : 特约商户支付服务合作协议V4.1 + 结算授权委托书 (商户入网 + 分账 )
|
||||
ECType008 ECType = "EC008" // EC008 : 特约商户支付服务合作协议V4.1 (商户入网)
|
||||
ECType009 ECType = "EC009" // EC009 : 结算授权委托书
|
||||
)
|
||||
|
||||
func (e ECType) Ptr() string {
|
||||
return string(e)
|
||||
}
|
||||
|
||||
type CertType string
|
||||
|
||||
const (
|
||||
CertType_RESIDENT_ID CertType = "RESIDENT_ID" // RESIDENT_ID(身份证)
|
||||
CertType_PASSPORT CertType = "PASSPORT" // PASSPORT(护照)
|
||||
CertType_HK_MACAO_PASS CertType = "HK_MACAO_PASS" // HK_MACAO_PASS(港澳居民往来内地通行证)
|
||||
CertType_TAIWAN_PASS CertType = "TAIWAN_PASS" // TAIWAN_PASS(台湾居民来往大陆通行证)
|
||||
)
|
||||
|
||||
func (c CertType) Ptr() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
type AgentTag int
|
||||
|
||||
const (
|
||||
AgentTag0 AgentTag = iota // 0:不启用 缺省
|
||||
AgentTag1 // 1: 启用
|
||||
)
|
||||
|
||||
func (a AgentTag) Ptr() int {
|
||||
return int(a)
|
||||
}
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
package consts
|
||||
|
||||
const (
|
||||
BASE_URL = "https://s2.lakala.com/api"
|
||||
BASE_TEST_URL = "https://test.wsmsd.cn/sit/api"
|
||||
BASE_URL = "https://s2.lakala.com/api"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -23,8 +22,7 @@ const (
|
|||
// LKL_ACCOUNT_BALANCE_QUERY_URL 拉卡拉账户余额查询
|
||||
LKL_ACCOUNT_BALANCE_QUERY_URL = "/v2/laep/industry/ewalletBalanceQuery"
|
||||
// LKL_ACCOUNT_WITHDRAW_URL 拉卡拉账户提现
|
||||
LKL_ACCOUNT_WITHDRAW_URL = "/v2/laep/industry/ewalletWithdrawD1"
|
||||
LKL_SPLIT_LEDGER_FALLBACK_URL = "/v3/sacs/fallback"
|
||||
LKL_ACCOUNT_WITHDRAW_URL = "/v2/laep/industry/ewalletWithdrawD1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -47,18 +45,6 @@ const (
|
|||
LKL_MER_VALIDATE = "/v2/mms/openApi/verifyContractInfo"
|
||||
// LKL_RECONF_SUBMIT 拉卡拉商户进件复议提交
|
||||
LKL_RECONF_SUBMIT = "/v2/mms/openApi/reconsiderSubmit"
|
||||
// LKL_EC_APPLY 拉卡拉商户电子合同
|
||||
LKL_EC_APPLY = "/v3/mms/open_api/ec/apply"
|
||||
// LKL_EC_QUERY_STATUS 拉卡拉商户电子合同查询状态
|
||||
LKL_EC_QUERY_STATUS = "/v3/mms/open_api/ec/q_status"
|
||||
// LKL_EC_DOWNLOAD 拉卡拉商户电子合同下载
|
||||
LKL_EC_DOWNLOAD = "/v3/mms/open_api/ec/download"
|
||||
// LKL_EC_APPLY_MANUAL 拉卡拉商户电子合同人工复核申请
|
||||
LKL_EC_APPLY_MANUAL = "/v3/mms/open_api/ec/apply_manual"
|
||||
// LKL_EC_QMA_STATUS 拉卡拉商户电子合同人工复核结果查询
|
||||
LKL_EC_QMA_STATUS = "/v3/mms/open_api/ec/qma_status"
|
||||
LKL_QUERY_SUB_MER_INFO_URL = "/v2/mms/openApi/querySubMerInfo"
|
||||
LKL_MRCH_AUTH_STATE_QUERY_URL = "/v2/mms/sme/mrchAuthStateQuery"
|
||||
)
|
||||
|
||||
// unifiedReturn 统一退货API地址
|
||||
|
|
|
|||
|
|
@ -2,18 +2,17 @@ package lklsdk
|
|||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// AccountService 账户服务
|
||||
type AccountService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewAccountService 创建账户服务实例
|
||||
func NewAccountService[T any](client *common.Client[T]) *AccountService[T] {
|
||||
func NewAccountService[T any](client *Client[T]) *AccountService[T] {
|
||||
return &AccountService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -31,26 +30,7 @@ func (a *AccountService[T]) BalanceQuery(req *model.BalanceQueryReqData) (*T, er
|
|||
ReqData: req,
|
||||
}
|
||||
// 发送请求
|
||||
respBody, err := a.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (a *AccountService[T]) BalanceQueryTest(req *model.BalanceQueryReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_ACCOUNT_BALANCE_QUERY_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.BalanceQueryRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
// 发送请求
|
||||
respBody, err := a.client.DoRequest(url, baseReq)
|
||||
respBody, err := a.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -71,26 +51,7 @@ func (a *AccountService[T]) Withdraw(req *model.WithdrawReqData) (*T, error) {
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := a.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (a *AccountService[T]) WithdrawTest(req *model.WithdrawReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_ACCOUNT_WITHDRAW_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.WithdrawRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := a.client.DoRequest(url, baseReq)
|
||||
respBody, err := a.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
package lklsdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
ran "math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/black1552/base-common/utils"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
// Config 拉卡拉SDK配置
|
||||
type Config struct {
|
||||
PublicKey string `json:"public_key" dc:"公钥字符串"`
|
||||
PrivateKey string `json:"private_key" dc:"私钥字符串"`
|
||||
AppId string `json:"app_id" dc:"lakala应用ID"`
|
||||
SerialNo string `json:"serial_no" dc:"序列号"`
|
||||
SubAppId string `json:"sub_app_id" dc:"子应用ID 微信AppId"`
|
||||
Version string `json:"version" dc:"lakala版本号"`
|
||||
AccountType string `json:"account_type" dc:"账户类型"`
|
||||
TransType string `json:"trans_type" dc:"交易类型"`
|
||||
NotifyUrl string `json:"notify_url" dc:"回调地址"`
|
||||
}
|
||||
|
||||
// Client 拉卡拉SDK客户端
|
||||
type Client[T any] struct {
|
||||
config *Config
|
||||
response T
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewClient 创建拉卡拉SDK客户端
|
||||
func NewClient[T any](ctx context.Context, cfgJson string) *Client[T] {
|
||||
var config *Config
|
||||
err := gconv.Struct(cfgJson, &config)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &Client[T]{
|
||||
config: config,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
func (c *Client[T]) generateNonceStr() string {
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
nonce := make([]byte, 12)
|
||||
for i := range nonce {
|
||||
nonce[i] = letterBytes[ran.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(nonce)
|
||||
}
|
||||
|
||||
// generateSign 生成签名
|
||||
func (c *Client[T]) generateSign(request []byte) (string, error) {
|
||||
// 生成随机字符串
|
||||
nonceStr := c.generateNonceStr()
|
||||
// 获取当前时间戳(秒)
|
||||
timestamp := fmt.Sprintf("%d", time.Now().Unix())
|
||||
|
||||
// 构建待签名报文
|
||||
signData := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n", c.config.AppId, c.config.SerialNo, timestamp, nonceStr, string(request))
|
||||
|
||||
// 计算签名
|
||||
hashed := sha256.Sum256([]byte(signData))
|
||||
|
||||
privateKey, err := c.loadPrivateKey()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
signature, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed[:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
signatureBase64 := base64.StdEncoding.EncodeToString(signature)
|
||||
|
||||
// 构建Authorization头
|
||||
authorization := fmt.Sprintf("LKLAPI-SHA256withRSA appid=\"%s\",serial_no=\"%s\",timestamp=\"%s\",nonce_str=\"%s\",signature=\"%s\"",
|
||||
c.config.AppId, c.config.SerialNo, timestamp, nonceStr, signatureBase64)
|
||||
return authorization, nil
|
||||
}
|
||||
|
||||
func (c *Client[T]) loadPrivateKey() (*rsa.PrivateKey, error) {
|
||||
block, _ := pem.Decode(gfile.GetBytes(c.config.PrivateKey))
|
||||
if block == nil {
|
||||
return nil, fmt.Errorf("无法解码私钥PEM数据")
|
||||
}
|
||||
// 解析PKCS#8格式私钥
|
||||
privateKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return privateKey.(*rsa.PrivateKey), nil
|
||||
}
|
||||
|
||||
// doRequest 发送HTTP请求
|
||||
func (c *Client[T]) doRequest(url string, reqData interface{}) (*T, error) {
|
||||
// 序列化为JSON
|
||||
jsonData, err := json.Marshal(reqData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("序列化请求数据失败: %v", err)
|
||||
}
|
||||
|
||||
auth, err := c.generateSign(jsonData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("生成签名失败: %v", err)
|
||||
}
|
||||
header := map[string]string{
|
||||
"Authorization": auth,
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
// 设置其他必要的请求头
|
||||
|
||||
return utils.NewClient[T](jsonData, url, header).Post(c.ctx)
|
||||
}
|
||||
|
|
@ -8,21 +8,20 @@ import (
|
|||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
ran "math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/black1552/base-common/utils"
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
// Client 拉卡拉SDK客户端
|
||||
type Client[T any] struct {
|
||||
Config *Config
|
||||
config *Config
|
||||
response T
|
||||
ctx context.Context
|
||||
}
|
||||
|
|
@ -35,7 +34,7 @@ func NewClient[T any](ctx context.Context, cfgJson string) *Client[T] {
|
|||
return nil
|
||||
}
|
||||
return &Client[T]{
|
||||
Config: config,
|
||||
config: config,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
|
|
@ -56,7 +55,7 @@ func (c *Client[T]) generateSign(request []byte) (string, error) {
|
|||
timestamp := fmt.Sprintf("%d", time.Now().Unix())
|
||||
|
||||
// 构建待签名报文
|
||||
signData := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n", c.Config.AppId, c.Config.SerialNo, timestamp, nonceStr, string(request))
|
||||
signData := fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n", c.config.AppId, c.config.SerialNo, timestamp, nonceStr, string(request))
|
||||
|
||||
// 计算签名
|
||||
hashed := sha256.Sum256([]byte(signData))
|
||||
|
|
@ -73,12 +72,12 @@ func (c *Client[T]) generateSign(request []byte) (string, error) {
|
|||
|
||||
// 构建Authorization头
|
||||
authorization := fmt.Sprintf("LKLAPI-SHA256withRSA appid=\"%s\",serial_no=\"%s\",timestamp=\"%s\",nonce_str=\"%s\",signature=\"%s\"",
|
||||
c.Config.AppId, c.Config.SerialNo, timestamp, nonceStr, signatureBase64)
|
||||
c.config.AppId, c.config.SerialNo, timestamp, nonceStr, signatureBase64)
|
||||
return authorization, nil
|
||||
}
|
||||
|
||||
func (c *Client[T]) loadPrivateKey() (*rsa.PrivateKey, error) {
|
||||
block, _ := pem.Decode(gfile.GetBytes(c.Config.PrivateKey))
|
||||
block, _ := pem.Decode(gfile.GetBytes(c.config.PrivateKey))
|
||||
if block == nil {
|
||||
return nil, fmt.Errorf("无法解码私钥PEM数据")
|
||||
}
|
||||
|
|
@ -92,17 +91,13 @@ func (c *Client[T]) loadPrivateKey() (*rsa.PrivateKey, error) {
|
|||
|
||||
// DoRequest 发送HTTP请求
|
||||
func (c *Client[T]) DoRequest(url string, reqData interface{}) (*T, error) {
|
||||
jsonStr, err := gjson.EncodeString(reqData)
|
||||
// 序列化为JSON
|
||||
jsonData, err := json.Marshal(reqData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("请求参数转JSON字符串失败: %v", err)
|
||||
return nil, fmt.Errorf("序列化请求数据失败: %v", err)
|
||||
}
|
||||
reqJson, err := CleanJSON(jsonStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("清理JSON空值失败: %v", err)
|
||||
}
|
||||
g.Log().Infof(c.ctx, "清理后的json: %v", string(reqJson))
|
||||
|
||||
auth, err := c.generateSign(reqJson)
|
||||
auth, err := c.generateSign(jsonData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("生成签名失败: %v", err)
|
||||
}
|
||||
|
|
@ -113,5 +108,5 @@ func (c *Client[T]) DoRequest(url string, reqData interface{}) (*T, error) {
|
|||
}
|
||||
// 设置其他必要的请求头
|
||||
|
||||
return utils.NewClient[T](reqJson, url, header).Post(c.ctx)
|
||||
return utils.NewClient[T](jsonData, url, header).Post(c.ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,115 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/gogf/gf/v2/encoding/gjson"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
"github.com/gogf/gf/v2/os/glog"
|
||||
)
|
||||
|
||||
// CleanJSON 清理JSON字符串中的空值和0值字段
|
||||
func CleanJSON(jsonStr string) ([]byte, error) {
|
||||
// 解析为JSON
|
||||
json := gjson.NewWithOptions(jsonStr, gjson.Options{StrNumber: true})
|
||||
glog.Infof(gctx.New(), "Cleaning JSON: %+v", json)
|
||||
// 递归清理数据
|
||||
cleaned := cleanData(json.Interface())
|
||||
jsons, err := gjson.DecodeToJson(cleaned, gjson.Options{StrNumber: true})
|
||||
if err != nil {
|
||||
glog.Errorf(gctx.New(), "Error decoding JSON: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return jsons.ToJson()
|
||||
}
|
||||
|
||||
// cleanData 递归清理map或slice中的空值和0值
|
||||
func cleanData(data interface{}) interface{} {
|
||||
if data == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(data)
|
||||
|
||||
switch v.Kind() {
|
||||
case reflect.Map:
|
||||
cleanedMap := make(map[string]interface{})
|
||||
for _, key := range v.MapKeys() {
|
||||
val := v.MapIndex(key)
|
||||
if val.Interface() != nil && !isEmptyValue(val) {
|
||||
cleanedVal := cleanData(val.Interface())
|
||||
// 只有清理后的值不为空才添加
|
||||
if !isCleanedValueEmpty(cleanedVal) {
|
||||
cleanedMap[key.String()] = cleanedVal
|
||||
}
|
||||
}
|
||||
}
|
||||
return cleanedMap
|
||||
|
||||
case reflect.Slice:
|
||||
cleanedSlice := make([]interface{}, 0)
|
||||
for i := 0; i < v.Len(); i++ {
|
||||
item := v.Index(i)
|
||||
if item.Interface() != nil && !isEmptyValue(item) {
|
||||
cleanedItem := cleanData(item.Interface())
|
||||
if !isCleanedValueEmpty(cleanedItem) {
|
||||
cleanedSlice = append(cleanedSlice, cleanedItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果slice为空,则返回nil而不是空slice
|
||||
if len(cleanedSlice) == 0 {
|
||||
return nil
|
||||
}
|
||||
return cleanedSlice
|
||||
|
||||
default:
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
// isEmptyValue 检查值是否为空值或0值
|
||||
func isEmptyValue(v reflect.Value) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Interface, reflect.Ptr:
|
||||
return v.IsNil()
|
||||
case reflect.Slice, reflect.Map:
|
||||
return v.Len() == 0
|
||||
case reflect.String:
|
||||
return v.String() == "" || v.String() == "0"
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return v.Int() == 0
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
return v.Uint() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return v.Float() == 0
|
||||
case reflect.Bool:
|
||||
return !v.Bool()
|
||||
}
|
||||
|
||||
// 特殊处理nil值
|
||||
if !v.IsValid() {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// isCleanedValueEmpty 检查清理后的值是否为空
|
||||
func isCleanedValueEmpty(val interface{}) bool {
|
||||
if val == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
v := reflect.ValueOf(val)
|
||||
switch v.Kind() {
|
||||
case reflect.Map:
|
||||
return v.Len() == 0
|
||||
case reflect.Slice:
|
||||
return v.Len() == 0
|
||||
case reflect.String:
|
||||
return val == ""
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/gogf/gf/v2/crypto/gmd5"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
|
@ -13,11 +12,11 @@ import (
|
|||
|
||||
// MerService 商户服务
|
||||
type MerService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewMerService 创建交易服务实例
|
||||
func NewMerService[T any](client *common.Client[T]) *MerService[T] {
|
||||
func NewMerService[T any](client *Client[T]) *MerService[T] {
|
||||
return &MerService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -40,31 +39,7 @@ func (t *MerService[T]) AddMer(req *model.MerchantApplyReqData) (*T, error) {
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
// AddMerTest 商户进件(测试)
|
||||
func (t *MerService[T]) AddMerTest(req *model.MerchantApplyReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_ADD_MER
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.MerchantApplyRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -87,29 +62,7 @@ func (t *MerService[T]) QueryMer(req *model.QueryMerRequestData) (*T, error) {
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
func (t *MerService[T]) QueryMerTest(req *model.QueryMerRequestData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_QUERY_MER
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.QueryMerRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -131,29 +84,7 @@ func (t *MerService[T]) MerValidate(req *model.MerValidateRequestData) (*T, erro
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
func (t *MerService[T]) MerValidateTest(req *model.MerValidateRequestData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_MER_VALIDATE
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.MerValidateRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -176,75 +107,7 @@ func (t *MerService[T]) ReconsiderSubmit(req *model.ReConfSubmitRequestData) (*T
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (t *MerService[T]) ReconsiderSubmitTest(req *model.ReConfSubmitRequestData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_RECONF_SUBMIT
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.ReConfSubmitRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (t *MerService[T]) QuerySubMerInfo(req *model.QuerySubMerInfoReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_QUERY_SUB_MER_INFO_URL
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.QuerySubMerInfoRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
func (t *MerService[T]) MrchAuthStateQuery(req *model.MrchAuthStateQueryReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_MRCH_AUTH_STATE_QUERY_URL
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.MrchAuthStateQueryRequest{
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
Timestamp: time.Now().Unix(),
|
||||
Ver: "1.0",
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
package apply
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type Apply struct {
|
||||
Client *common.Client[ECApplyResponse]
|
||||
}
|
||||
|
||||
func NewEcApply(client *common.Client[ECApplyResponse]) *Apply {
|
||||
return &Apply{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// ECApply 电子合同申请
|
||||
// 提供与拉卡拉进行电子签约的第四方进行电子合同申请
|
||||
// 电子合同签约成功后不需要将其下载出来作为附件上传,只需将电子合同编号(ecNo)
|
||||
// 在“新增商户入网”接口中在(contractNo)字段中传入即可
|
||||
// https://o.lakala.com/#/home/document/detail?id=289
|
||||
func (a *Apply) ECApply(req *ECApplyRequestData) (*ECApplyResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECApplyRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_EC_APPLY, baseReq)
|
||||
}
|
||||
|
||||
// ECApplyTest 电子合同申请(测试环境)
|
||||
// 提供与拉卡拉进行电子签约的第四方进行电子合同申请
|
||||
// 电子合同签约成功后不需要将其下载出来作为附件上传,只需将电子合同编号(ecNo)
|
||||
// 在“新增商户入网”接口中在(contractNo)字段中传入即可
|
||||
// https://o.lakala.com/#/home/document/detail?id=289
|
||||
func (a *Apply) ECApplyTest(req *ECApplyRequestData) (*ECApplyResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECApplyRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
return a.Client.DoRequest(consts.BASE_TEST_URL+consts.LKL_EC_APPLY, baseReq)
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
package apply
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
)
|
||||
|
||||
// ECApplyRequestData 电子合同申请请求数据
|
||||
// 提供与拉卡拉进行电子签约的第四方进行电子合同申请
|
||||
// 电子合同签约成功后不需要将其下载出来作为附件上传,只需将电子合同编号(ecNo)
|
||||
// 在“新增商户入网”接口中在(contractNo)字段中传入即可
|
||||
// 合同类别适用业务场景说明:
|
||||
// EC001: 特约商户支付服务合作协议V3.1(商户入网) - 历史存量,推荐使用EC008
|
||||
// EC002: 特约商户支付服务合作协议V3.2+分账结算授权委托书 - 历史存量,推荐使用EC007
|
||||
// EC003: 分账结算授权委托书 - 历史存量,推荐使用EC009
|
||||
// EC004: 特约商户支付服务合作协议V3.3(商户入网) - 历史存量,推荐使用EC008
|
||||
// EC005: 特约商户支付服务合作协议V3.3+分账结算授权委托书 - 历史存量,推荐使用EC007
|
||||
// EC007: 特约商户支付服务合作协议V4.1+分账结算授权委托书(商户入网+分账业务) - 当前最新版本
|
||||
// EC008: 特约商户支付服务合作协议V4.1(商户入网) - 当前最新版本
|
||||
// EC009: 清分结算授权委托书(分账业务) - 当前最新版本
|
||||
type ECApplyRequestData struct {
|
||||
OrderNo string `json:"order_no" dc:"四方机构自定义订单编号 必选,建议:平台编号+14位年月日时分秒+8位的随机数"` // 必选,建议:平台编号+14位年月日时分秒+8位的随机数
|
||||
OrgID int `json:"org_id" dc:"机构号 必选,签约方所属拉卡拉机构"` // 必选,签约方所属拉卡拉机构
|
||||
EcTypeCode consts.ECType `json:"ec_type_code" dc:"合同类别 必选,合同类别编码"` // 必选,合同类别编码
|
||||
CertType consts.CertType `json:"cert_type" dc:"法人/经营者证件类型 必选,RESIDENT_ID(身份证);PASSPORT(护照);HK_MACAO_PASS(港澳居民往来内地通行证);TAIWAN_PASS(台湾居民来往大陆通行证)"` // 必选,RESIDENT_ID(身份证);PASSPORT(护照);HK_MACAO_PASS(港澳居民往来内地通行证);TAIWAN_PASS(台湾居民来往大陆通行证)
|
||||
CertName string `json:"cert_name" dc:"法人/经营者姓名 必选"` // 必选
|
||||
CertNo string `json:"cert_no" dc:"法人/经营者证件号码 必选"` // 必选
|
||||
Mobile string `json:"mobile" dc:"签约手机号 必选,小微个人商户必须填写经营者本人手机号;个体工商户或企业商户必须填写法人手机号或者经办人手机号"` // 必选,小微个人商户必须填写经营者本人手机号;个体工商户或企业商户必须填写法人手机号或者经办人手机号
|
||||
BusinessLicenseNo string `json:"business_license_no" dc:"营业执照号 可选,个体工商户或企业商户必传"` // 可选,个体工商户或企业商户必传
|
||||
BusinessLicenseName string `json:"business_license_name" dc:"营业执照名称 可选,个体工商户或企业商户必传"` // 可选,个体工商户或企业商户必传
|
||||
OpenningBankCode string `json:"openning_bank_code" dc:"企业/经营者结算开户行号 必选"` // 必选
|
||||
OpenningBankName string `json:"openning_bank_name" dc:"企业/经营者结算开户行名称 必选"` // 必选
|
||||
AcctTypeCode consts.AcctTypeCode `json:"acct_type_code" dc:"企业/经营者结算卡性质 必选,57 对公、 58 对私"` // 必选,57 对公、 58 对私
|
||||
AcctNo string `json:"acct_no" dc:"企业/经营者结算卡号 必选"` // 必选
|
||||
AcctName string `json:"acct_name" dc:"企业/经营者结算卡名称 必选"` // 必选
|
||||
EcContentParameters string `json:"ec_content_parameters" dc:"电子合同内容参数集合 必选,JSON字符串"` // 必选,JSON字符串
|
||||
AgentTag consts.AgentTag `json:"agent_tag" dc:"是否经办签约 可选,0 不启用 1启用,缺省 0"` // 可选,0 不启用 1启用,缺省 0
|
||||
AgentName string `json:"agent_name" dc:"经办人名称 可选,agentTag为1时必传"` // 可选,agentTag为1时必传
|
||||
AgentCertType consts.CertType `json:"agent_cert_type" dc:"经办人证件类型 可选,agentTag为1时必传"` // 可选,agentTag为1时必传
|
||||
AgentCertNo string `json:"agent_cert_no" dc:"经办人证件号 可选,agentTag为1时必传"` // 可选,agentTag为1时必传
|
||||
AgentFileName string `json:"agent_file_name" dc:"经办签约授权委托书文件名 可选,agentTag为1时必传"` // 可选,agentTag为1时必传
|
||||
AgentFilePath string `json:"agent_file_path" dc:"经办授权委托书文件路径 可选,agentTag为1时必传"` // 可选,agentTag为1时必传
|
||||
Remark string `json:"remark" dc:"备注说明 可选"` // 可选
|
||||
RetUrl string `json:"ret_url" dc:"电子合同签约结果回调通知 可选,成功签约才通知"` // 可选,成功签约才通知
|
||||
}
|
||||
|
||||
// ECApplyRequest 电子合同申请请求
|
||||
// 请求URL:
|
||||
// 测试环境:https://test.wsmsd.cn/sit/api/v3/mms/open_api/ec/apply
|
||||
// 生产环境:https://s2.lakala.com/api/v3/mms/open_api/ec/apply
|
||||
type ECApplyRequest struct {
|
||||
ReqTime string `json:"req_time" dc:"请求时间"` // 必选,格式:yyyyMMddHHmmss
|
||||
ReqData *ECApplyRequestData `json:"req_data" dc:"请求数据"` // 请求数据
|
||||
Version string `json:"version" dc:"版本号"` // 必选,固定值:1.0
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package apply
|
||||
|
||||
// ECApplyResponseData 电子合同申请响应数据
|
||||
type ECApplyResponseData struct {
|
||||
OrderNo string `json:"order_no" dc:"请求上送的订单号"` // 请求上送的订单号
|
||||
EcApplyID int64 `json:"ec_apply_id" dc:"电子签约申请受理编号"` // 电子签约申请受理编号
|
||||
ResultUrl string `json:"result_url" dc:"电子签约申请结果H5链接地址"` // 申请成功时:待签约合同H5链接;申请失败时:错误信息结果H5链接
|
||||
}
|
||||
|
||||
// ECApplyResponse 电子合同申请响应
|
||||
type ECApplyResponse struct {
|
||||
Code string `json:"code" dc:"返回码"` // 成功 000000 其它失败
|
||||
Msg string `json:"msg" dc:"返回码描述"` // 返回码描述
|
||||
RespData *ECApplyResponseData `json:"resp_data" dc:"结果信息集合"` // 结果信息集合
|
||||
RespTime string `json:"resp_time" dc:"响应时间"` // 格式:yyyyMMddHHmmss
|
||||
}
|
||||
|
||||
func (r *ECApplyResponse) SuccessOfFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package applymanual
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// ApplyManual 电子合同人工复核申请服务
|
||||
type ApplyManual struct {
|
||||
Client *common.Client[ECApplyManualResponse]
|
||||
}
|
||||
|
||||
// NewApplyManual 创建新的电子合同人工复核申请服务
|
||||
func NewApplyManual(client *common.Client[ECApplyManualResponse]) *ApplyManual {
|
||||
return &ApplyManual{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// ECApplyManual 电子合同人工复核申请(生产环境)
|
||||
// https://o.lakala.com/#/home/document/detail?id=981
|
||||
func (a *ApplyManual) ECApplyManual(req *ECApplyManualRequestData) (*ECApplyManualResponse, error) {
|
||||
// 创建请求对象
|
||||
request := ECApplyManualRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_EC_APPLY_MANUAL, request)
|
||||
}
|
||||
|
||||
// ECApplyManualTest 电子合同人工复核申请(测试环境)
|
||||
// https://o.lakala.com/#/home/document/detail?id=981
|
||||
func (a *ApplyManual) ECApplyManualTest(req *ECApplyManualRequestData) (*ECApplyManualResponse, error) {
|
||||
// 创建请求对象
|
||||
request := ECApplyManualRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
return a.Client.DoRequest(consts.BASE_TEST_URL+consts.LKL_EC_APPLY_MANUAL, request)
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package applymanual
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
)
|
||||
|
||||
// ECApplyManualRequestData 电子合同人工复核申请请求数据结构体
|
||||
type ECApplyManualRequestData struct {
|
||||
Version string `json:"version"` // 版本号,默认1.0
|
||||
OrderNo string `json:"order_no"` // 四方机构自定义订单编号,必填,建议平台编号+14位年月日时分秒+8位随机数
|
||||
OrgID int `json:"org_id"` // 机构号,必填,签约方所属拉卡拉机构
|
||||
EcApplyID string `json:"ec_apply_id"` // 电子合同申请受理号,必填,申请接口反馈编号
|
||||
ApplyDesc string `json:"apply_desc"` // 申请说明,必填,复议提交的原因说明
|
||||
FileData []*ECFileData `json:"file_data"` // 附件信息集合,必填,提供给审核人员核对信息
|
||||
RetURL string `json:"ret_url,omitempty"` // 回调地址,可选
|
||||
}
|
||||
|
||||
// ECFileData 附件信息结构体
|
||||
type ECFileData struct {
|
||||
AttachType consts.AttType `json:"attach_type"` // 附件类型,必填,枚举值见文档
|
||||
AttachName string `json:"attach_name"` // 附件名称,必填,最大32字符
|
||||
AttachExtName string `json:"attach_ext_name"` // 附件格式,必填,jpg、pdf等
|
||||
AttachStorePath string `json:"attach_store_path"` // 附件坐标URL,必填,如G1/M00/00/61/CrFdEl3IyceAVVd8AAA0ADuZsA0911.jpg
|
||||
}
|
||||
|
||||
// ECApplyManualRequest 电子合同人工复核申请请求结构体
|
||||
type ECApplyManualRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
ReqData *ECApplyManualRequestData `json:"req_data"` // 请求数据
|
||||
Version string `json:"version"` // 接口版本号
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package applymanual
|
||||
|
||||
// ECApplyManualResponseData 电子合同人工复核申请响应数据结构体
|
||||
type ECApplyManualResponseData struct {
|
||||
// 响应数据为空对象,根据API文档,成功时返回空的resp_data
|
||||
}
|
||||
|
||||
// ECApplyManualResponse 电子合同人工复核申请响应结构体
|
||||
type ECApplyManualResponse struct {
|
||||
Code string `json:"code"` // 返回码,成功为000000,其他为失败
|
||||
Msg string `json:"msg"` // 返回码描述
|
||||
RespData ECApplyManualResponseData `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOfFail 检查响应是否成功
|
||||
// 返回true表示成功,false表示失败
|
||||
func (r *ECApplyManualResponse) SuccessOfFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package download
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type Download struct {
|
||||
Client *common.Client[ECDownloadResponse]
|
||||
}
|
||||
|
||||
// NewDownload 创建电子合同下载服务实例
|
||||
func NewDownload(client *common.Client[ECDownloadResponse]) *Download {
|
||||
return &Download{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// ECDownload 电子合同下载
|
||||
// 提供已完成的签约电子合同下载
|
||||
// https://o.lakala.com/#/home/document/detail?id=294
|
||||
func (d *Download) ECDownload(req *ECDownloadRequestData) (*ECDownloadResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECDownloadRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
// 使用生产环境URL
|
||||
return d.Client.DoRequest(consts.BASE_URL+consts.LKL_EC_DOWNLOAD, baseReq)
|
||||
}
|
||||
|
||||
// ECDownloadTest 电子合同下载(测试环境)
|
||||
// 提供已完成的签约电子合同下载
|
||||
// https://o.lakala.com/#/home/document/detail?id=294
|
||||
func (d *Download) ECDownloadTest(req *ECDownloadRequestData) (*ECDownloadResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECDownloadRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
// 使用测试环境URL
|
||||
return d.Client.DoRequest(consts.BASE_TEST_URL+consts.LKL_EC_DOWNLOAD, baseReq)
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package download
|
||||
|
||||
// ECDownloadRequestData 电子合同下载请求数据
|
||||
type ECDownloadRequestData struct {
|
||||
OrderNo string `json:"order_no" dc:"四方机构自定义订单编号"` // 四方机构自定义订单编号
|
||||
OrgCode int `json:"org_code" dc:"机构号"` // 机构号
|
||||
EcApplyID int64 `json:"ec_apply_id" dc:"电子合同申请受理号"` // 电子合同申请受理号
|
||||
}
|
||||
|
||||
// ECDownloadRequest 电子合同下载请求结构
|
||||
type ECDownloadRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
ReqData *ECDownloadRequestData `json:"req_data"` // 请求数据
|
||||
Version string `json:"version"` // 接口版本号
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package download
|
||||
|
||||
// ECDownloadResponseData 电子合同下载响应数据
|
||||
type ECDownloadResponseData struct {
|
||||
OrderNo string `json:"order_no"` // 请求上送的订单号
|
||||
EcApplyID int64 `json:"ec_apply_id"` // 电子签约申请受理编号
|
||||
EcStatus string `json:"ec_status"` // 电子合同状态: UNDONE 未完成, COMPLETED 已完成
|
||||
EcNo string `json:"ec_no"` // 电子合同号(合同状态为COMPLETED时返回)
|
||||
EcFile string `json:"ec_file"` // 电子合同pdf文件(base64格式字符,合同状态为COMPLETED时返回)
|
||||
}
|
||||
|
||||
// ECDownloadResponse 电子合同下载响应结构
|
||||
type ECDownloadResponse struct {
|
||||
Code string `json:"code"` // 返回码
|
||||
Msg string `json:"msg"` // 返回码描述
|
||||
RespData *ECDownloadResponseData `json:"resp_data"` // 结果信息集合
|
||||
}
|
||||
|
||||
// SuccessOfFail 检查响应是否成功
|
||||
func (r *ECDownloadResponse) SuccessOfFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package qmastatus
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// QmaStatus 电子合同人工复核结果查询服务
|
||||
type QmaStatus struct {
|
||||
Client *common.Client[ECQmaStatusResponse]
|
||||
}
|
||||
|
||||
// NewQmaStatus 创建新的电子合同人工复核结果查询服务
|
||||
func NewQmaStatus(client *common.Client[ECQmaStatusResponse]) *QmaStatus {
|
||||
return &QmaStatus{Client: client}
|
||||
}
|
||||
|
||||
// ECQmaStatus
|
||||
// https://o.lakala.com/#/home/document/detail?id=982
|
||||
func (q *QmaStatus) ECQmaStatus(req *ECQmaStatusRequestData) (*ECQmaStatusResponse, error) {
|
||||
// 创建请求对象
|
||||
request := ECQmaStatusRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
return q.Client.DoRequest(consts.BASE_URL+consts.LKL_EC_QMA_STATUS, request)
|
||||
}
|
||||
|
||||
// ECQmaStatusTest 电子合同人工复核结果查询(测试环境)
|
||||
// https://o.lakala.com/#/home/document/detail?id=982
|
||||
func (q *QmaStatus) ECQmaStatusTest(req *ECQmaStatusRequestData) (*ECQmaStatusResponse, error) {
|
||||
// 创建请求对象
|
||||
request := ECQmaStatusRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
return q.Client.DoRequest(consts.BASE_TEST_URL+consts.LKL_EC_QMA_STATUS, request)
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package qmastatus
|
||||
|
||||
// ECQmaStatusRequestData 电子合同人工复核结果查询请求数据结构体
|
||||
type ECQmaStatusRequestData struct {
|
||||
Version string `json:"version"` // 版本号,默认1.0
|
||||
OrderNo string `json:"order_no"` // 四方机构自定义订单编号,必填,建议平台编号+14位年月日时分秒+8位随机数
|
||||
OrgID int `json:"org_id"` // 机构号,必填,签约方所属拉卡拉机构
|
||||
EcApplyID string `json:"ec_apply_id"` // 电子合同申请受理号,必填,申请接口反馈编号
|
||||
}
|
||||
|
||||
// ECQmaStatusRequest 电子合同人工复核结果查询请求结构体
|
||||
type ECQmaStatusRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
ReqData *ECQmaStatusRequestData `json:"req_data"` // 请求数据
|
||||
Version string `json:"version"` // 接口版本号
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package qmastatus
|
||||
|
||||
// ECQmaStatusResponseData 电子合同人工复核结果查询响应数据结构体
|
||||
type ECQmaStatusResponseData struct {
|
||||
Version string `json:"version"` // 版本号
|
||||
OrderNo string `json:"order_no"` // 四方机构自定义订单编号
|
||||
OrgID int `json:"org_id"` // 机构号
|
||||
EcApplyID string `json:"ec_apply_id"` // 电子合同申请受理号
|
||||
AuditStatus string `json:"audit_status"` // 人工审核状态:WAIT_AUDIT待审核、PASS审核通过、REFUSE审核拒绝、CLOSE审核关闭
|
||||
AuditDesc string `json:"audit_desc"` // 人工审核结果说明
|
||||
SignH5URL string `json:"sign_h5_url"` // 签约H5地址,审核通过时返回
|
||||
SignH5URLExpTm string `json:"sign_h5_url_exp_tm"` // 签约H5地址过期时间,审核通过时返回
|
||||
}
|
||||
|
||||
// ECQmaStatusResponse 电子合同人工复核结果查询响应结构体
|
||||
type ECQmaStatusResponse struct {
|
||||
Code string `json:"code"` // 返回码,成功000000,其它失败
|
||||
Msg string `json:"msg"` // 返回码描述
|
||||
RespData *ECQmaStatusResponseData `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOfFail 判断响应是否成功
|
||||
func (r *ECQmaStatusResponse) SuccessOfFail() bool {
|
||||
return r != nil && r.Code == "000000"
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package querystatus
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type QStatus struct {
|
||||
Client *common.Client[ECQueryStatusResponse]
|
||||
}
|
||||
|
||||
// NewQStatus 创建电子合同查询状态服务实例
|
||||
func NewQStatus(client *common.Client[ECQueryStatusResponse]) *QStatus {
|
||||
return &QStatus{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// QueryStatus 电子合同查询状态
|
||||
// 提供申请过与拉卡拉电子签约用户查询电子合同签署状态
|
||||
// https://o.lakala.com/#/home/document/detail?id=293
|
||||
func (q *QStatus) QueryStatus(req *ECQueryStatusRequestData) (*ECQueryStatusResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECQueryStatusRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
// 使用生产环境URL
|
||||
return q.Client.DoRequest(consts.BASE_URL+consts.LKL_EC_QUERY_STATUS, baseReq)
|
||||
}
|
||||
|
||||
// QueryStatusTest 电子合同查询状态(测试环境)
|
||||
// 提供申请过与拉卡拉电子签约用户查询电子合同签署状态
|
||||
// https://o.lakala.com/#/home/document/detail?id=293
|
||||
func (q *QStatus) QueryStatusTest(req *ECQueryStatusRequestData) (*ECQueryStatusResponse, error) {
|
||||
// 构建请求
|
||||
baseReq := ECQueryStatusRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqData: req,
|
||||
Version: "1.0",
|
||||
}
|
||||
|
||||
// 使用测试环境URL
|
||||
return q.Client.DoRequest(consts.BASE_TEST_URL+consts.LKL_EC_QUERY_STATUS, baseReq)
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
package querystatus
|
||||
|
||||
// ECQueryStatusRequestData 电子合同查询状态请求数据
|
||||
// 提供申请过与拉卡拉电子签约用户查询电子合同签署状态
|
||||
// 请求URL:
|
||||
// 测试环境:https://test.wsmsd.cn/sit/api/v3/mms/open_api/ec/q_status
|
||||
// 生产环境:https://s2.lakala.com/api/v3/mms/open_api/ec/q_status
|
||||
type ECQueryStatusRequestData struct {
|
||||
OrderNo string `json:"order_no" dc:"四方机构自定义订单编号 必选,建议:平台编号+14位年月日时(24小时制)分秒+8位的随机数(同一接入机构不重复)"` // 必选,建议:平台编号+14位年月日时(24小时制)分秒+8位的随机数(同一接入机构不重复)
|
||||
OrgCode int `json:"org_code" dc:"机构号 必选,签约方所属拉卡拉机构"` // 必选,签约方所属拉卡拉机构
|
||||
EcApplyID int64 `json:"ec_apply_id" dc:"电子合同申请受理号 必选,申请接口反馈编号"` // 必选,申请接口反馈编号
|
||||
}
|
||||
|
||||
// ECQueryStatusRequest 电子合同查询状态请求
|
||||
type ECQueryStatusRequest struct {
|
||||
ReqTime string `json:"req_time" dc:"请求时间"` // 必选,格式:yyyyMMddHHmmss
|
||||
ReqData *ECQueryStatusRequestData `json:"req_data" dc:"请求数据"` // 请求数据
|
||||
Version string `json:"version" dc:"版本号"` // 必选,固定值:1.0
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package querystatus
|
||||
|
||||
// ECQueryStatusResponseData 电子合同查询状态响应数据
|
||||
type ECQueryStatusResponseData struct {
|
||||
OrderNo string `json:"order_no" dc:"请求上送的订单号"` // 请求上送的订单号
|
||||
EcApplyID int64 `json:"ec_apply_id" dc:"电子签约申请受理编号"` // 电子签约申请受理编号
|
||||
EcStatus string `json:"ec_status" dc:"电子合同签署状态"` // 电子合同签署状态,UNDONE 未完成,COMPLETED 已完成
|
||||
EcNo string `json:"ec_no" dc:"电子合同号"` // 签署完成反馈
|
||||
}
|
||||
|
||||
// ECQueryStatusResponse 电子合同查询状态响应
|
||||
type ECQueryStatusResponse struct {
|
||||
Code string `json:"code" dc:"返回码"` // 成功 000000 其它失败
|
||||
Msg string `json:"msg" dc:"返回码描述"` // 返回码描述
|
||||
RespData *ECQueryStatusResponseData `json:"resp_data" dc:"结果信息集合"` // 结果信息集合
|
||||
RespTime string `json:"resp_time" dc:"响应时间"` // 格式:yyyyMMddHHmmss
|
||||
}
|
||||
|
||||
// SuccessOfFail 检查响应是否成功
|
||||
func (r *ECQueryStatusResponse) SuccessOfFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
|
@ -2,17 +2,16 @@ package lklsdk
|
|||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type MergePreService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewMergePreService 创建拉卡拉主扫合单交易
|
||||
func NewMergePreService[T any](client *common.Client[T]) *MergePreService[T] {
|
||||
func NewMergePreService[T any](client *Client[T]) *MergePreService[T] {
|
||||
return &MergePreService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -30,7 +29,7 @@ func (s *MergePreService[T]) PreOrder(req *model.MergePreorderReqData) (*T, erro
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
164
lklsdk/sdk.go
164
lklsdk/sdk.go
|
|
@ -3,47 +3,31 @@ package lklsdk
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
ecApply "github.com/black1552/lkl_sdk/lklsdk/merchant/in_net/ec/apply"
|
||||
ecApplyManual "github.com/black1552/lkl_sdk/lklsdk/merchant/in_net/ec/applymanual"
|
||||
ecDownload "github.com/black1552/lkl_sdk/lklsdk/merchant/in_net/ec/download"
|
||||
ecQmaStatus "github.com/black1552/lkl_sdk/lklsdk/merchant/in_net/ec/qmastatus"
|
||||
ecQuery "github.com/black1552/lkl_sdk/lklsdk/merchant/in_net/ec/querystatus"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
)
|
||||
|
||||
// SDK 拉卡拉SDK主入口
|
||||
type SDK[T any] struct {
|
||||
Client *common.Client[T]
|
||||
SplitLedger *SplitLedgerService[T]
|
||||
Trade *TradeService[T]
|
||||
Account *AccountService[T]
|
||||
UploadFile *UploadFileService[T]
|
||||
MergePre *MergePreService[T]
|
||||
Merchant *MerService[T]
|
||||
EC *ecApply.Apply
|
||||
ECQuery *ecQuery.QStatus
|
||||
ECFileDownload *ecDownload.Download
|
||||
ECPeApplyManual *ecApplyManual.ApplyManual
|
||||
ECPeQmaStatus *ecQmaStatus.QmaStatus
|
||||
Client *Client[T]
|
||||
SplitLedger *SplitLedgerService[T]
|
||||
Trade *TradeService[T]
|
||||
Account *AccountService[T]
|
||||
UploadFile *UploadFileService[T]
|
||||
MergePre *MergePreService[T]
|
||||
Merchant *MerService[T]
|
||||
}
|
||||
|
||||
// NewSDK 创建拉卡拉SDK实例
|
||||
func NewSDK[T any](ctx context.Context, cfgJson string) *SDK[T] {
|
||||
client := common.NewClient[T](ctx, cfgJson)
|
||||
client := NewClient[T](ctx, cfgJson)
|
||||
return &SDK[T]{
|
||||
Client: client,
|
||||
SplitLedger: NewSplitLedgerService(client),
|
||||
Trade: NewTradeService(client),
|
||||
Account: NewAccountService(client),
|
||||
UploadFile: NewUploadFileService(client),
|
||||
MergePre: NewMergePreService(client),
|
||||
Merchant: NewMerService(client),
|
||||
EC: ecApply.NewEcApply(common.NewClient[ecApply.ECApplyResponse](ctx, cfgJson)),
|
||||
ECQuery: ecQuery.NewQStatus(common.NewClient[ecQuery.ECQueryStatusResponse](ctx, cfgJson)),
|
||||
ECFileDownload: ecDownload.NewDownload(common.NewClient[ecDownload.ECDownloadResponse](ctx, cfgJson)),
|
||||
ECPeApplyManual: ecApplyManual.NewApplyManual(common.NewClient[ecApplyManual.ECApplyManualResponse](ctx, cfgJson)),
|
||||
ECPeQmaStatus: ecQmaStatus.NewQmaStatus(common.NewClient[ecQmaStatus.ECQmaStatusResponse](ctx, cfgJson)),
|
||||
Client: client,
|
||||
SplitLedger: NewSplitLedgerService(client),
|
||||
Trade: NewTradeService(client),
|
||||
Account: NewAccountService(client),
|
||||
UploadFile: NewUploadFileService(client),
|
||||
MergePre: NewMergePreService(client),
|
||||
Merchant: NewMerService(client),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,41 +38,21 @@ func (s *SDK[T]) ReconsiderSubmit(req *model.ReConfSubmitRequestData) (*T, error
|
|||
return s.Merchant.ReconsiderSubmit(req)
|
||||
}
|
||||
|
||||
// ReconsiderSubmitTest 商户进件复议提交
|
||||
func (s *SDK[T]) ReconsiderSubmitTest(req *model.ReConfSubmitRequestData) (*T, error) {
|
||||
return s.Merchant.ReconsiderSubmitTest(req)
|
||||
}
|
||||
|
||||
// QueryMerchant 商户进件信息查询
|
||||
func (s *SDK[T]) QueryMerchant(req *model.QueryMerRequestData) (*T, error) {
|
||||
return s.Merchant.QueryMer(req)
|
||||
}
|
||||
|
||||
// QueryMerchantTest 商户进件信息查询
|
||||
func (s *SDK[T]) QueryMerchantTest(req *model.QueryMerRequestData) (*T, error) {
|
||||
return s.Merchant.QueryMerTest(req)
|
||||
}
|
||||
|
||||
// MerValidate 商户进件信息校验
|
||||
func (s *SDK[T]) MerValidate(req *model.MerValidateRequestData) (*T, error) {
|
||||
return s.Merchant.MerValidate(req)
|
||||
}
|
||||
|
||||
// MerValidateTest 商户进件信息校验
|
||||
func (s *SDK[T]) MerValidateTest(req *model.MerValidateRequestData) (*T, error) {
|
||||
return s.Merchant.MerValidateTest(req)
|
||||
}
|
||||
|
||||
// AddMer 商户进件
|
||||
func (s *SDK[T]) AddMer(req *model.MerchantApplyReqData) (*T, error) {
|
||||
return s.Merchant.AddMer(req)
|
||||
}
|
||||
|
||||
// AddMerTest 商户进件
|
||||
func (s *SDK[T]) AddMerTest(req *model.MerchantApplyReqData) (*T, error) {
|
||||
return s.Merchant.AddMerTest(req)
|
||||
}
|
||||
|
||||
// MergePreOrder 主扫合单交易
|
||||
func (s *SDK[T]) MergePreOrder(req *model.MergePreorderReqData) (*T, error) {
|
||||
return s.MergePre.PreOrder(req)
|
||||
|
|
@ -104,60 +68,31 @@ func (s *SDK[T]) ApplyLedgerMer(req *model.ApplyLedgerMerReqData) (*T, error) {
|
|||
return s.SplitLedger.ApplyLedgerMer(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) ApplyLedgerMerTest(req *model.ApplyLedgerMerReqData) (*T, error) {
|
||||
return s.SplitLedger.ApplyLedgerMerTest(req)
|
||||
}
|
||||
|
||||
// QueryLedgerMer 商户分账信息查询
|
||||
func (s *SDK[T]) QueryLedgerMer(req *model.QueryLedgerMerReqData) (*T, error) {
|
||||
return s.SplitLedger.QueryLedgerMer(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) QueryLedgerMerTest(req *model.QueryLedgerMerReqData) (*T, error) {
|
||||
return s.SplitLedger.QueryLedgerMerTest(req)
|
||||
}
|
||||
|
||||
// ApplyLedgerReceiver 分账接收方创建申请
|
||||
func (s *SDK[T]) ApplyLedgerReceiver(req *model.ApplyLedgerReceiverReqData) (*T, error) {
|
||||
return s.SplitLedger.ApplyLedgerReceiver(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) ApplyLedgerReceiverTest(req *model.ApplyLedgerReceiverReqData) (*T, error) {
|
||||
return s.SplitLedger.ApplyLedgerReceiverTest(req)
|
||||
}
|
||||
|
||||
// ApplyBind 分账关系绑定申请
|
||||
func (s *SDK[T]) ApplyBind(req *model.ApplyBindReqData) (*T, error) {
|
||||
return s.SplitLedger.ApplyBind(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) ApplyBindTest(req *model.ApplyBindReqData) (*T, error) {
|
||||
return s.SplitLedger.ApplyBindTest(req)
|
||||
}
|
||||
|
||||
// QuerySplitBalance 可分账金额查询
|
||||
func (s *SDK[T]) QuerySplitBalance(req *model.SplitBalanceReqData) (*T, error) {
|
||||
return s.SplitLedger.QuerySplitBalance(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) QuerySplitBalanceTest(req *model.SplitBalanceReqData) (*T, error) {
|
||||
return s.SplitLedger.QuerySplitBalanceTest(req)
|
||||
}
|
||||
|
||||
// OrderSplitLedger 订单分账
|
||||
func (s *SDK[T]) OrderSplitLedger(req *model.OrderSplitLedgerReqData) (*T, error) {
|
||||
return s.SplitLedger.OrderSplitLedger(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) OrderSplitLedgerTest(req *model.OrderSplitLedgerReqData) (*T, error) {
|
||||
return s.SplitLedger.OrderSplitLedgerTest(req)
|
||||
}
|
||||
|
||||
// OrderSplitLedgerFallback 订单分账回退
|
||||
func (s *SDK[T]) OrderSplitLedgerFallback(req *model.OrderSplitLedgerFallbackReqData) (*T, error) {
|
||||
return s.SplitLedger.OrderSplitLedgerFallback(req)
|
||||
}
|
||||
|
||||
// TradeQuery 交易查询
|
||||
func (s *SDK[T]) TradeQuery(req *model.TradeQueryReqData) (*T, error) {
|
||||
return s.Trade.TradeQuery(req)
|
||||
|
|
@ -173,80 +108,11 @@ func (s *SDK[T]) BalanceQuery(req *model.BalanceQueryReqData) (*T, error) {
|
|||
return s.Account.BalanceQuery(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) BalanceQueryTest(req *model.BalanceQueryReqData) (*T, error) {
|
||||
return s.Account.BalanceQueryTest(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) UploadFileQuery(req *model.UploadFileReqData) (*T, error) {
|
||||
return s.UploadFile.UploadFileQuery(req)
|
||||
}
|
||||
func (s *SDK[T]) UploadFileQueryTest(req *model.UploadFileReqData) (*T, error) {
|
||||
return s.UploadFile.UploadFileQueryTest(req)
|
||||
}
|
||||
|
||||
// Withdraw 账户提现
|
||||
func (s *SDK[T]) Withdraw(req *model.WithdrawReqData) (*T, error) {
|
||||
return s.Account.Withdraw(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) WithdrawTest(req *model.WithdrawReqData) (*T, error) {
|
||||
return s.Account.WithdrawTest(req)
|
||||
}
|
||||
|
||||
// ECApply 电子合同申请
|
||||
func (s *SDK[T]) ECApply(req *ecApply.ECApplyRequestData) (*ecApply.ECApplyResponse, error) {
|
||||
return s.EC.ECApply(req)
|
||||
}
|
||||
|
||||
// ECApplyTest 电子合同申请(测试环境)
|
||||
func (s *SDK[T]) ECApplyTest(req *ecApply.ECApplyRequestData) (*ecApply.ECApplyResponse, error) {
|
||||
return s.EC.ECApplyTest(req)
|
||||
}
|
||||
|
||||
// ECQueryStatus 电子合同查询状态
|
||||
func (s *SDK[T]) ECQueryStatus(req *ecQuery.ECQueryStatusRequestData) (*ecQuery.ECQueryStatusResponse, error) {
|
||||
return s.ECQuery.QueryStatus(req)
|
||||
}
|
||||
|
||||
// ECQueryStatusTest 电子合同查询状态(测试环境)
|
||||
func (s *SDK[T]) ECQueryStatusTest(req *ecQuery.ECQueryStatusRequestData) (*ecQuery.ECQueryStatusResponse, error) {
|
||||
return s.ECQuery.QueryStatusTest(req)
|
||||
}
|
||||
|
||||
// ECDownload 电子合同下载
|
||||
func (s *SDK[T]) ECDownload(req *ecDownload.ECDownloadRequestData) (*ecDownload.ECDownloadResponse, error) {
|
||||
return s.ECFileDownload.ECDownload(req)
|
||||
}
|
||||
|
||||
// ECDownloadTest 电子合同下载(测试环境)
|
||||
func (s *SDK[T]) ECDownloadTest(req *ecDownload.ECDownloadRequestData) (*ecDownload.ECDownloadResponse, error) {
|
||||
return s.ECFileDownload.ECDownloadTest(req)
|
||||
}
|
||||
|
||||
// ECApplyManual 电子合同人工复核申请
|
||||
func (s *SDK[T]) ECApplyManual(req *ecApplyManual.ECApplyManualRequestData) (*ecApplyManual.ECApplyManualResponse, error) {
|
||||
return s.ECPeApplyManual.ECApplyManual(req)
|
||||
}
|
||||
|
||||
// ECApplyManualTest 电子合同人工复核申请(测试环境)
|
||||
func (s *SDK[T]) ECApplyManualTest(req *ecApplyManual.ECApplyManualRequestData) (*ecApplyManual.ECApplyManualResponse, error) {
|
||||
return s.ECPeApplyManual.ECApplyManualTest(req)
|
||||
}
|
||||
|
||||
// ECQmaStatus 电子合同人工复核结果查询
|
||||
func (s *SDK[T]) ECQmaStatus(req *ecQmaStatus.ECQmaStatusRequestData) (*ecQmaStatus.ECQmaStatusResponse, error) {
|
||||
return s.ECPeQmaStatus.ECQmaStatus(req)
|
||||
}
|
||||
|
||||
// ECQmaStatusTest 电子合同人工复核结果查询(测试环境)
|
||||
func (s *SDK[T]) ECQmaStatusTest(req *ecQmaStatus.ECQmaStatusRequestData) (*ecQmaStatus.ECQmaStatusResponse, error) {
|
||||
return s.ECPeQmaStatus.ECQmaStatusTest(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) QuerySubMerInfo(req *model.QuerySubMerInfoReqData) (*T, error) {
|
||||
return s.Merchant.QuerySubMerInfo(req)
|
||||
}
|
||||
|
||||
func (s *SDK[T]) MrchAuthStateQuery(req *model.MrchAuthStateQueryReqData) (*T, error) {
|
||||
return s.Merchant.MrchAuthStateQuery(req)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/gogf/gf/v2/crypto/gmd5"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
|
|
@ -14,11 +13,11 @@ import (
|
|||
|
||||
// SplitLedgerService 分账服务
|
||||
type SplitLedgerService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewSplitLedgerService 创建分账服务实例
|
||||
func NewSplitLedgerService[T any](client *common.Client[T]) *SplitLedgerService[T] {
|
||||
func NewSplitLedgerService[T any](client *Client[T]) *SplitLedgerService[T] {
|
||||
return &SplitLedgerService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -42,32 +41,7 @@ func (s *SplitLedgerService[T]) ApplyLedgerMer(req *model.ApplyLedgerMerReqData)
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) ApplyLedgerMerTest(req *model.ApplyLedgerMerReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_SPLIT_LEDGER_URL
|
||||
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.ApplyLedgerMerRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "2.0",
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -93,32 +67,7 @@ func (s *SplitLedgerService[T]) ApplyLedgerReceiver(req *model.ApplyLedgerReceiv
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) ApplyLedgerReceiverTest(req *model.ApplyLedgerReceiverReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_SPLIT_LEDGER_RECEIVE_URL
|
||||
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.ApplyLedgerReceiverRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "2.0",
|
||||
ReqId: md5,
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -139,27 +88,7 @@ func (s *SplitLedgerService[T]) QueryLedgerMer(req *model.QueryLedgerMerReqData)
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) QueryLedgerMerTest(req *model.QueryLedgerMerReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_SPLIT_LEDGER_QUERY_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.QueryLedgerMerRequest{
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,31 +29,7 @@ func (s *SplitLedgerService[T]) ApplyBind(req *model.ApplyBindReqData) (*T, erro
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) ApplyBindTest(req *model.ApplyBindReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_SPLIT_LEDGER_RECEIVE_BIND_URL
|
||||
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.ApplyBindRequest{
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "2.0",
|
||||
ReqData: req,
|
||||
ReqId: md5,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -73,26 +49,7 @@ func (s *SplitLedgerService[T]) QuerySplitBalance(req *model.SplitBalanceReqData
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) QuerySplitBalanceTest(req *model.SplitBalanceReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_SPLIT_LEDGER_BALANCE_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.SplitBalanceRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -112,45 +69,7 @@ func (s *SplitLedgerService[T]) OrderSplitLedger(req *model.OrderSplitLedgerReqD
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) OrderSplitLedgerTest(req *model.OrderSplitLedgerReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_ORDER_SPLIT_LEDGER_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.OrderSplitLedgerRequest{
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (s *SplitLedgerService[T]) OrderSplitLedgerFallback(req *model.OrderSplitLedgerFallbackReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_SPLIT_LEDGER_FALLBACK_URL
|
||||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.OrderSplitLedgerFallbackRequest{
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := s.client.DoRequest(url, baseReq)
|
||||
respBody, err := s.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,16 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
)
|
||||
|
||||
// TradeService 交易服务
|
||||
type TradeService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewTradeService 创建交易服务实例
|
||||
func NewTradeService[T any](client *common.Client[T]) *TradeService[T] {
|
||||
func NewTradeService[T any](client *Client[T]) *TradeService[T] {
|
||||
return &TradeService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -29,12 +28,12 @@ func (t *TradeService[T]) TradeQuery(req *model.TradeQueryReqData) (*T, error) {
|
|||
baseReq := model.TradeQuery{
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
OutOrgCode: t.client.Config.AppId,
|
||||
OutOrgCode: t.client.config.AppId,
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -50,7 +49,7 @@ func (t *TradeService[T]) PreOrder(req *model.PreorderReqData) (*T, error) {
|
|||
baseReq := model.NewPreorder(req)
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -66,7 +65,7 @@ func (t *TradeService[T]) Refound(req *model.RefundReqData) (*T, error) {
|
|||
// 构建BaseModel请求
|
||||
baseReq := model.NewRefund(req)
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/gogf/gf/v2/crypto/gmd5"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
|
|
@ -13,11 +12,11 @@ import (
|
|||
|
||||
// UploadFileService 交易服务
|
||||
type UploadFileService[T any] struct {
|
||||
client *common.Client[T]
|
||||
client *Client[T]
|
||||
}
|
||||
|
||||
// NewUploadFileService 创建交易服务实例
|
||||
func NewUploadFileService[T any](client *common.Client[T]) *UploadFileService[T] {
|
||||
func NewUploadFileService[T any](client *Client[T]) *UploadFileService[T] {
|
||||
return &UploadFileService[T]{
|
||||
client: client,
|
||||
}
|
||||
|
|
@ -40,30 +39,7 @@ func (t *UploadFileService[T]) UploadFileQuery(req *model.UploadFileReqData) (*T
|
|||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
||||
func (t *UploadFileService[T]) UploadFileQueryTest(req *model.UploadFileReqData) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_TEST_URL + consts.LKL_UPLOAD_FILE_URL
|
||||
md5, err := gmd5.Encrypt(gconv.String(time.Now().Unix()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("创建ReqId失败")
|
||||
}
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.UploadFileRequest{
|
||||
Timestamp: gconv.String(time.Now().Unix()),
|
||||
Ver: "1.0",
|
||||
ReqId: md5,
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
respBody, err := t.client.doRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ type ApplyLedgerMerReqData struct {
|
|||
SplitEntrustFilePath string `json:"splitEntrustFilePath"` // 分账授权委托书文件路径,必传,长度64,调用附件上传接口获取
|
||||
SplitRange consts.SplitRange `json:"splitRange"` // 分账范围,必传,长度32,取值说明:ALL-全部交易分账(所有交易默认都分账),MARK-标记交易分账(只有带标记交易才分账,其余交易正常结算)
|
||||
SepFundSource consts.SepFundSource `json:"sepFundSource"` // 分账依据,非必传,长度32,取值说明:TRA-交易分账,BAR-金额分账
|
||||
EleContractNo string `json:"eleContractNo"` // 电子合同编号,非必传,长度32,收单已签约交易电子合同编号,供审核人员复核使用
|
||||
ElecContractId string `json:"elecContractId"` // 电子合同编号,非必传,长度32,收单已签约交易电子合同编号,供审核人员复核使用
|
||||
SplitLaunchMode consts.SplitLaunchMode `json:"splitLaunchMode"` // 分账发起方式,非必传,长度32,取值说明:AUTO-自动触发分账,POINTTRUE-指定规则分账,MANUAL-手动分账
|
||||
SettleType consts.SplitSettleType `json:"settleType"` // 结算类型,非必传,长度32,取值说明:01-主扫现结,02-复扫现结,03-交易自动结算
|
||||
SplitRuleSource consts.SplitRuleSource `json:"splitRuleSource"` // 分账规则来源,条件必传,长度32,取值说明:MER-商户自定规则,PLATFORM-平台分润规则(分润规则必传)
|
||||
|
|
|
|||
|
|
@ -35,30 +35,30 @@ type BalanceQueryReqData struct {
|
|||
// 包含响应状态码、消息和业务数据
|
||||
type BalanceQueryResponse struct {
|
||||
// 响应状态码,000000
|
||||
Code string `json:"retCode"`
|
||||
Code string `json:"code"`
|
||||
// 响应消息
|
||||
Msg string `json:"retMsg"`
|
||||
Msg string `json:"msg"`
|
||||
// 响应业务数据,当code为SACS0000时返回
|
||||
RespData *BalanceQueryRespData `json:"respData"`
|
||||
RespData *BalanceQueryRespData `json:"resp_data"`
|
||||
}
|
||||
|
||||
// BalanceQueryRespData 余额查询响应业务数据结构体
|
||||
// 包含余额查询返回的具体账户信息
|
||||
type BalanceQueryRespData struct {
|
||||
// 账号,必传
|
||||
PayNo string `json:"payNo"`
|
||||
PayNo string `json:"pay_no"`
|
||||
// 账户类型,必传
|
||||
PayType string `json:"payType"`
|
||||
PayType string `json:"pay_type"`
|
||||
// 账户状态,必传,取值说明:CLOSE销户,NORMAL正常,FREEZE冻结,STOPAY止付
|
||||
AcctSt string `json:"acctSt"`
|
||||
AcctSt string `json:"acct_st"`
|
||||
// 预付余额(单位元),必传
|
||||
ForceBalance string `json:"forceBalance"`
|
||||
ForceBalance string `json:"force_balance"`
|
||||
// 上日余额(单位元)-该字段已废弃使用,必传
|
||||
HisBalance string `json:"hisBalance"`
|
||||
HisBalance string `json:"his_balance"`
|
||||
// 实时余额(单位元),必传
|
||||
ReBalance string `json:"reBalance"`
|
||||
ReBalance string `json:"re_balance"`
|
||||
// 当前可用余额(单位元),必传
|
||||
CuBalance string `json:"cuBalance"`
|
||||
CuBalance string `json:"cu_balance"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断余额查询请求是否成功
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ type FeeData struct {
|
|||
// FileData 附件集合结构体
|
||||
|
||||
type FileData struct {
|
||||
AttFileId string `json:"attFileId"` // 文件编号/附件上传后返回的编号,必填
|
||||
AttType consts.AcctTypeCode `json:"attType"` // 附件类型,必填
|
||||
AttField string `json:"attField"` // 文件编号/附件上传后返回的编号,必填
|
||||
AttType string `json:"attType"` // 附件类型,必填
|
||||
}
|
||||
|
||||
// MerchantApplyResponse 商户进件响应结构体
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
package model
|
||||
|
||||
type MrchAuthStateQueryRequest struct {
|
||||
ReqData *MrchAuthStateQueryReqData `json:"reqData"`
|
||||
Ver string `json:"ver"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
ReqId string `json:"reqId"`
|
||||
}
|
||||
|
||||
type MrchAuthStateQueryReqData struct {
|
||||
TradeMode string `json:"tradeMode" dc:"交易模式"`
|
||||
SubMerchantId string `json:"subMerchantId" dc:"子商户号"`
|
||||
MerchantNo string `json:"merchantNo" dc:"商户号"`
|
||||
}
|
||||
|
||||
type MrchAuthStateQueryResponse struct {
|
||||
RetCode string `json:"retCode"`
|
||||
RetMsg string `json:"retMsg"`
|
||||
RespData *MrchAuthStateQueryRespData `json:"respData"`
|
||||
}
|
||||
|
||||
type MrchAuthStateQueryRespData struct {
|
||||
SubMerchantId string `json:"subMerchantId"`
|
||||
CheckResult string `json:"checkResult"`
|
||||
}
|
||||
|
||||
func (t *MrchAuthStateQueryResponse) SuccessOrFail() bool {
|
||||
return t.RetCode == "000000"
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package model
|
||||
|
||||
type OrderSplitLedgerFallbackRequest struct {
|
||||
ReqData *OrderSplitLedgerFallbackReqData `json:"req_data"` // 请求业务数据
|
||||
Version string `json:"version"` // 接口版本号
|
||||
ReqTime string `json:"req_time"` // 请求时间,格式为yyyyMMddHHmmss
|
||||
}
|
||||
|
||||
type OrderSplitLedgerFallbackReqData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传,长度32
|
||||
OriginSeparateNo string `json:"origin_separate_no"` // 原分账单号,必传,长度32
|
||||
OutSeparateNo string `json:"out_separate_no"` // 外部分账单号,必传,长度32
|
||||
OriginOutSeparateNo string `json:"origin_out_separate_no"` // 原外部分账单号,必传,长度32
|
||||
FallbackReason string `json:"fallback_reason"` // 回退原因,必传,长度255
|
||||
TotalAmt string `json:"total_amt"` // 总金额,必传,长度15
|
||||
OriginRecvDatas []*OrderSplitLedgerOriginRecvDatas `json:"origin_recv_datas"` // 原分账接收数据,必传,数组长度1-100
|
||||
}
|
||||
|
||||
type OrderSplitLedgerOriginRecvDatas struct {
|
||||
RecvNo string `json:"recv_no"` // 原分账接收号,必传,长度32
|
||||
Amt string `json:"amt"` // 原分账接收金额,必传,长度15
|
||||
}
|
||||
|
||||
type OrderSplitLedgerFallbackResponse struct {
|
||||
Msg string `json:"msg"` // 消息
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
Code string `json:"code"` // 响应码 SACS0000表示成功
|
||||
RespData struct {
|
||||
OutSeparateNo string `json:"out_separate_no"` // 外部分账单号,必传,长度32
|
||||
TotalAmt string `json:"total_amt"` // 总金额,必传,长度15
|
||||
OriginOutSeparateNo string `json:"origin_out_separate_no"` // 原外部分账单号,必传,长度32
|
||||
OriginSeparateNo string `json:"origin_separate_no"` // 原分账单号,必传,长度32
|
||||
Status string `json:"status"` // 状态,必传,长度1
|
||||
SeparateNo string `json:"separate_no"` // 分账单号,必传,长度32
|
||||
}
|
||||
}
|
||||
|
||||
func (s *OrderSplitLedgerFallbackResponse) SuccessOrFail() bool {
|
||||
return s.Code == "SACS0000"
|
||||
}
|
||||
|
|
@ -26,8 +26,7 @@ type PreorderReqData struct {
|
|||
RequestIp string `json:"request_ip"` // 请求方IP地址,存在必填,格式如36.45.36.95,String(64)
|
||||
Location string `json:"location"` // 纬度,经度,商户终端的地理位置,银联二维码交易必填,整体格式:纬度,经度,+表示北纬、东经,-表示南纬、西经。经度格式:1位正负号+3位整数+1位小数点+5位小数;纬度格式:1位正负号+2位整数+1位小数点+6位小数;举例:+31.221345,+121.12345,String(32)
|
||||
} `json:"location_info"` // 地址位置信息,Object
|
||||
Subject string `json:"subject"` // 订单标题,用于简单描述订单或商品主题,传输给账户端(账户端控制,实际最多42个字节),微信支付必送,String(42)
|
||||
AccBusiFields *AccBusiFields `json:"acc_busi_fields"` // 账户业务字段,Object
|
||||
Subject string `json:"subject"` // 订单标题,用于简单描述订单或商品主题,传输给账户端(账户端控制,实际最多42个字节),微信支付必送,String(42)
|
||||
}
|
||||
|
||||
func NewPreorder(param *PreorderReqData) *Preorder {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ package model
|
|||
// 包含请求头信息和业务数据
|
||||
type QueryLedgerMerRequest struct {
|
||||
// 请求业务数据
|
||||
ReqData *QueryLedgerMerReqData `json:"reqData"`
|
||||
ReqData *QueryLedgerMerReqData `json:"req_data"`
|
||||
// 接口版本号
|
||||
Version string `json:"version"`
|
||||
// 请求时间,格式为yyyyMMddHHmmss
|
||||
ReqTime string `json:"reqTime"`
|
||||
ReqTime string `json:"req_time"`
|
||||
}
|
||||
|
||||
// QueryLedgerMerReqData 分账商户查询请求业务数据结构体
|
||||
|
|
@ -19,13 +19,13 @@ type QueryLedgerMerReqData struct {
|
|||
// 接口版本号,必传,长度8,取值说明:1.0
|
||||
Version string `json:"version"`
|
||||
// 订单编号(便于后续跟踪排查问题及核对报文),必传,长度32,取值说明:14位年月日(24小时制)分秒+8位的随机数(不重复)
|
||||
OrderNo string `json:"orderNo"`
|
||||
OrderNo string `json:"order_no"`
|
||||
// 机构代码,必传,长度32
|
||||
OrgCode string `json:"orgCode"`
|
||||
OrgCode string `json:"org_code"`
|
||||
// 拉卡拉内部商户号,可选,长度32,取值说明:拉卡拉内部商户号和银联商户号必须传一个,都送以内部商户号为准
|
||||
MerInnerNo string `json:"merInnerNo"`
|
||||
MerInnerNo string `json:"mer_inner_no"`
|
||||
// 银联商户号,可选,长度32,取值说明:拉卡拉内部商户号和银联商户号必须传一个,都送以内部商户号为准
|
||||
MerCupNo string `json:"merCupNo"`
|
||||
MerCupNo string `json:"mer_cup_no"`
|
||||
}
|
||||
|
||||
// QueryLedgerMerResponse 分账商户查询响应结构体
|
||||
|
|
@ -33,58 +33,58 @@ type QueryLedgerMerReqData struct {
|
|||
// 包含响应状态码、消息和业务数据
|
||||
type QueryLedgerMerResponse struct {
|
||||
// 响应状态码,000000表示成功
|
||||
RetCode string `json:"retCode"`
|
||||
Code string `json:"code"`
|
||||
// 响应消息
|
||||
RetMsg string `json:"retMsg"`
|
||||
Msg string `json:"msg"`
|
||||
// 响应业务数据,当code为000000时返回
|
||||
RespData *QueryLedgerMerRespData `json:"respData"`
|
||||
RespData *QueryLedgerMerRespData `json:"resp_data"`
|
||||
}
|
||||
|
||||
// QueryLedgerMerRespData 分账商户查询响应业务数据结构体
|
||||
// 包含分账商户查询返回的具体业务信息
|
||||
type QueryLedgerMerRespData struct {
|
||||
// 分账商户机构号
|
||||
OrgId string `json:"orgId"`
|
||||
OrgId string `json:"org_id"`
|
||||
// 分账商户机构名称
|
||||
OrgName string `json:"orgName"`
|
||||
OrgName string `json:"org_name"`
|
||||
// 拉卡拉内部商户号
|
||||
MerInnerNo string `json:"merInnerNo"`
|
||||
MerInnerNo string `json:"mer_inner_no"`
|
||||
// 银联商户号
|
||||
MerCupNo string `json:"merCupNo"`
|
||||
MerCupNo string `json:"mer_cup_no"`
|
||||
// 最低分账比例(百分比,支持2位精度),取值说明:70或70.50
|
||||
SplitLowestRatio float64 `json:"splitLowestRatio"`
|
||||
SplitLowestRatio string `json:"split_lowest_ratio"`
|
||||
// 商户分账状态,取值说明:VALID启用,INVALID禁用
|
||||
SplitStatus string `json:"splitStatus"`
|
||||
SplitStatus string `json:"split_status"`
|
||||
// 分账范围,取值说明:ALL:全部交易分账(商户所有交易默认待分账),MARK:标记交易分账(只有带分账标识交易待分账,其余交易正常结算),默认:MARK
|
||||
SplitRange string `json:"splitRange"`
|
||||
SplitRange string `json:"split_range"`
|
||||
// 分账依据,取值说明:TR或空:交易分账,BA:余额分账,默认:TR交易分账
|
||||
SepFundSource string `json:"sepFundSource"`
|
||||
SepFundSource string `json:"sep_fund_source"`
|
||||
// 平台ID,取值说明:如果商户和绑定平台分账,返回平台ID
|
||||
PlatformId string `json:"platformId"`
|
||||
PlatformId string `json:"platform_id"`
|
||||
// 分账发起方式,取值说明:AUTO:自动规则分账,POINTRULE:指定规则分账,MANUAL:手动规则分账
|
||||
SplitLaunchMode string `json:"splitLaunchMode"`
|
||||
SplitLaunchMode string `json:"split_launch_mode"`
|
||||
// 分账规则来源,取值说明:MER:商户分账规则,PLATFORM:平台分账规则
|
||||
SplitRuleSource string `json:"splitRuleSource"`
|
||||
SplitRuleSource string `json:"split_rule_source"`
|
||||
// 已绑定接收方列表
|
||||
BindRelations []*BindRelation `json:"bindRelations"`
|
||||
BindRelations []*BindRelation `json:"bind_relations"`
|
||||
}
|
||||
|
||||
// BindRelation 已绑定接收方信息结构体
|
||||
// 用于表示分账商户已绑定的接收方信息
|
||||
type BindRelation struct {
|
||||
// 拉卡拉内部商户号
|
||||
MerInnerNo string `json:"merInnerNo"`
|
||||
MerInnerNo string `json:"mer_inner_no"`
|
||||
// 银联商户号
|
||||
MerCupNo string `json:"merCupNo"`
|
||||
MerCupNo string `json:"mer_cup_no"`
|
||||
// 接收方编号
|
||||
ReceiverNo string `json:"receiverNo"`
|
||||
ReceiverNo string `json:"receiver_no"`
|
||||
// 接收方编号名称
|
||||
ReceiverName string `json:"receiverName"`
|
||||
ReceiverName string `json:"receiver_name"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断分账商户查询请求是否成功
|
||||
// 成功条件:响应码为000000
|
||||
// 返回值:true表示成功,false表示失败
|
||||
func (resp *QueryLedgerMerResponse) SuccessOrFail() bool {
|
||||
return resp.RetCode == "000000"
|
||||
return resp.Code == "000000"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
package model
|
||||
|
||||
type QuerySubMerInfoRequest struct {
|
||||
ReqData *QuerySubMerInfoReqData `json:"reqData"`
|
||||
Ver string `json:"ver"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
ReqId string `json:"reqId"`
|
||||
}
|
||||
|
||||
type QuerySubMerInfoReqData struct {
|
||||
Version string `json:"version" dc:"接口版本号"`
|
||||
OrderNo string `json:"orderNo" dc:"订单编号,保证唯一"`
|
||||
OrgCode string `json:"orgCode" dc:"机构代码"`
|
||||
MerInnerNo string `json:"merInnerNo" dc:"拉卡拉内部商户号和银联商户号必须传一个,都送以内部商户号为准。"`
|
||||
MerCupNo string `json:"merCupNo" dc:"拉卡拉内部商户号和银联商户号必须传一个,都送以内部商户号为准。"`
|
||||
RegisterChannel string `json:"registerChannel" dc:"报备渠道"`
|
||||
RegisterType string `json:"registerType" dc:"报备类型"`
|
||||
RegisterStatus string `json:"registerStatus" dc:"报备状态 SUCCESS:成功;FAIL:失败"`
|
||||
SubMchId string `json:"subMchId" dc:"子商户号"`
|
||||
}
|
||||
|
||||
type QuerySubMerInfoResponse struct {
|
||||
RetCode string `json:"retCode"`
|
||||
RetMsg string `json:"retMsg"`
|
||||
RespData *QuerySubMerInfoRespData `json:"respData"`
|
||||
}
|
||||
|
||||
type QuerySubMerInfoRespData struct {
|
||||
OrgCode string `json:"orgCode"`
|
||||
OrderNo string `json:"orderNo"`
|
||||
List []*RegisterList `json:"list"`
|
||||
}
|
||||
type RegisterList struct {
|
||||
MerInnerNo string `json:"merInnerNo" dc:"内部商户号"`
|
||||
SubMchId string `json:"subMchId" dc:"子商户号"`
|
||||
SubMchIdBank string `json:"subMchIdBank" dc:"交易子商户号"`
|
||||
DcWalletId string `json:"dcWalletId" dc:"数币钱包ID"`
|
||||
ChannelId string `json:"channelId" dc:"渠道号"`
|
||||
ReceOrgNo string `json:"receOrgNo" dc:"从业机构号"`
|
||||
RegisterChannel string `json:"registerChannel" dc:"报备渠道"`
|
||||
RegisterType string `json:"registerType" dc:"报备类型"`
|
||||
RegisterTm string `json:"registerTm" dc:"报备时间"`
|
||||
RegisterStatus string `json:"registerStatus" dc:"报备状态"`
|
||||
ResultCode string `json:"resultCode" dc:"结果返回码"`
|
||||
ResultMessage string `json:"resultMessage" dc:"结果描述"`
|
||||
}
|
||||
|
||||
func (t *QuerySubMerInfoResponse) SuccessOrFail() bool {
|
||||
return t.RetCode == "000000"
|
||||
}
|
||||
|
|
@ -2,41 +2,41 @@ package model
|
|||
|
||||
// TradeQuery 交易查询请求结构体
|
||||
type TradeQuery struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
Version string `json:"version"` // API版本号
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
Version string `json:"version"` // API版本号
|
||||
OutOrgCode string `json:"out_org_code"` // 外部机构码
|
||||
ReqData *TradeQueryReqData `json:"req_data"` // 请求数据
|
||||
ReqData *TradeQueryReqData `json:"req_data"` // 请求数据
|
||||
}
|
||||
|
||||
// TradeQueryReqData 交易查询请求数据结构体
|
||||
type TradeQueryReqData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
TermNo string `json:"term_no"` // 终端号,必传
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
TermNo string `json:"term_no"` // 终端号,必传
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,条件必传,与trade_no必传其一
|
||||
}
|
||||
|
||||
// TradeQueryResponse 交易查询响应结构体
|
||||
type TradeQueryResponse struct {
|
||||
Msg string `json:"msg"` // 响应消息
|
||||
Msg string `json:"msg"` // 响应消息
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
Code string `json:"code"` // 响应码,000000表示成功
|
||||
Code string `json:"code"` // 响应码,000000表示成功
|
||||
RespData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户请求流水号,必传
|
||||
TradeNo string `json:"trade_no"` // 拉卡拉商户订单号,必传
|
||||
LogNo string `json:"log_no"` // 拉卡拉对账流水号,必传
|
||||
TradeMainType string `json:"trade_main_type"` // 交易大类,条件必传(PREORDER-主扫,MICROPAY-被扫,REFUND-退款,CANCEL-撤销)
|
||||
SplitAttr string `json:"split_attr"` // 拆单属性,条件必传(M-主单,S-子单)
|
||||
SplitInfo []struct {
|
||||
SubTradeNo string `json:"sub_trade_no"` // 子单交易流水号,必传
|
||||
SubLogNo string `json:"sub_log_no"` // 子单对账单单流水号,必传
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户请求流水号,必传
|
||||
TradeNo string `json:"trade_no"` // 拉卡拉商户订单号,必传
|
||||
LogNo string `json:"log_no"` // 拉卡拉对账流水号,必传
|
||||
TradeMainType string `json:"trade_main_type"` // 交易大类,条件必传(PREORDER-主扫,MICROPAY-被扫,REFUND-退款,CANCEL-撤销)
|
||||
SplitAttr string `json:"split_attr"` // 拆单属性,条件必传(M-主单,S-子单)
|
||||
SplitInfo []struct {
|
||||
SubTradeNo string `json:"sub_trade_no"` // 子单交易流水号,必传
|
||||
SubLogNo string `json:"sub_log_no"` // 子单对账单单流水号,必传
|
||||
OutSubTradeNo string `json:"out_sub_trade_no"` // 外部子交易流水号,必传
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
MerchantName string `json:"merchant_name"` // 商户名称,必传
|
||||
TermNo string `json:"term_no"` // 终端号,必传
|
||||
Amount string `json:"amount"` // 金额,必传(单位分)
|
||||
} `json:"split_info"` // 拆单信息,条件必传(如果查询订单是主单,则返回)
|
||||
RefundSplitInfo []struct {
|
||||
} `json:"split_info"` // 拆单信息,条件必传(如果查询订单是主单,则返回)
|
||||
RefundSplitInfo []struct {
|
||||
OutSubTradeNo string `json:"out_sub_trade_no"` // 外部子退款交易流水号,必传
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必传
|
||||
TermNo string `json:"term_no"` // 终端号,必传
|
||||
|
|
@ -46,28 +46,28 @@ type TradeQueryResponse struct {
|
|||
TradeState string `json:"trade_state"` // 子交易状态,条件必传(SUCCESS-交易成功 FAIL-交易失败)
|
||||
ResultCode string `json:"result_code"` // 处理结果码,条件必传
|
||||
ResultMsg string `json:"result_msg"` // 处理描述,条件必传
|
||||
} `json:"refund_split_info"` // 合单退款拆单信息,条件必传(如果查询订单是退款主单,则返回)
|
||||
AccTradeNo string `json:"acc_trade_no"` // 账户端交易订单号,必传
|
||||
AccountType string `json:"account_type"` // 钱包类型,必传(微信: WECHAT 支付宝: ALIPAY 银联: UQRCODEPAY 翼支付: BESTPAY 苏宁支付: SUNING)
|
||||
TradeState string `json:"trade_state"` // 交易状态,必传(INIT-初始化 CREATE-下单成功 SUCCESS-交易成功 FAIL-交易失败 DEAL-交易处理中 UNKNOWN-未知状态 CLOSE-订单关闭 PART_REFUND-部分退款 REFUND-全部退款)
|
||||
TradeStateDesc string `json:"trade_state_desc"` // 交易状态描述,条件必传
|
||||
TotalAmount string `json:"total_amount"` // 订单金额,必传(单位分)
|
||||
PayerAmount string `json:"payer_amount"` // 付款人实付金额,条件必传(单位分)
|
||||
AccSettleAmount string `json:"acc_settle_amount"` // 账户端结算金额,条件必传(单位分)
|
||||
AccMdiscountAmount string `json:"acc_mdiscount_amount"` // 商户侧优惠金额,条件必传(单位分)
|
||||
AccDiscountAmount string `json:"acc_discount_amount"` // 账户端优惠金额,条件必传(单位分)
|
||||
AccOtherDiscountAmount string `json:"acc_other_discount_amount"` // 账户端其它优惠金额,条件必传(单位分)
|
||||
TradeTime string `json:"trade_time"` // 交易完成时间,条件必传(yyyyMMddHHmmss)
|
||||
UserId1 string `json:"user_id1"` // 用户标识1,条件必传(微信sub_open_id 支付宝buyer_login_id 买家支付账号)
|
||||
UserId2 string `json:"user_id2"` // 用户标识2,条件必传(微信open_id 支付宝buyer_user_id 银user_id)
|
||||
BankType string `json:"bank_type"` // 付款银行,条件必传
|
||||
CardType string `json:"card_type"` // 银行卡类型,条件必传(00: 借记卡 01: 贷记卡 02: 微信零钱 03: 支付宝花呗 04: 支付宝其他 05: 数字货币 06: 拉卡拉支付账户 99: 未知)
|
||||
AccActivityId string `json:"acc_activity_id"` // 活动ID,条件必传(在账户端商户后台配置的批次ID)
|
||||
TradeReqDate string `json:"trade_req_date"` // 交易请求日期,必传(yyyyMMdd)
|
||||
AccRespFields map[string]interface{} `json:"acc_resp_fields"` // 账户端返回信息域,条件必传
|
||||
} `json:"refund_split_info"` // 合单退款拆单信息,条件必传(如果查询订单是退款主单,则返回)
|
||||
AccTradeNo string `json:"acc_trade_no"` // 账户端交易订单号,必传
|
||||
AccountType string `json:"account_type"` // 钱包类型,必传(微信: WECHAT 支付宝: ALIPAY 银联: UQRCODEPAY 翼支付: BESTPAY 苏宁支付: SUNING)
|
||||
TradeState string `json:"trade_state"` // 交易状态,必传(INIT-初始化 CREATE-下单成功 SUCCESS-交易成功 FAIL-交易失败 DEAL-交易处理中 UNKNOWN-未知状态 CLOSE-订单关闭 PART_REFUND-部分退款 REFUND-全部退款)
|
||||
TradeStateDesc string `json:"trade_state_desc"` // 交易状态描述,条件必传
|
||||
TotalAmount string `json:"total_amount"` // 订单金额,必传(单位分)
|
||||
PayerAmount string `json:"payer_amount"` // 付款人实付金额,条件必传(单位分)
|
||||
AccSettleAmount string `json:"acc_settle_amount"` // 账户端结算金额,条件必传(单位分)
|
||||
AccMdiscountAmount string `json:"acc_mdiscount_amount"` // 商户侧优惠金额,条件必传(单位分)
|
||||
AccDiscountAmount string `json:"acc_discount_amount"` // 账户端优惠金额,条件必传(单位分)
|
||||
AccOtherDiscountAmount string `json:"acc_other_discount_amount"` // 账户端其它优惠金额,条件必传(单位分)
|
||||
TradeTime string `json:"trade_time"` // 交易完成时间,条件必传(yyyyMMddHHmmss)
|
||||
UserId1 string `json:"user_id1"` // 用户标识1,条件必传(微信sub_open_id 支付宝buyer_login_id 买家支付账号)
|
||||
UserId2 string `json:"user_id2"` // 用户标识2,条件必传(微信open_id 支付宝buyer_user_id 银user_id)
|
||||
BankType string `json:"bank_type"` // 付款银行,条件必传
|
||||
CardType string `json:"card_type"` // 银行卡类型,条件必传(00: 借记卡 01: 贷记卡 02: 微信零钱 03: 支付宝花呗 04: 支付宝其他 05: 数字货币 06: 拉卡拉支付账户 99: 未知)
|
||||
AccActivityId string `json:"acc_activity_id"` // 活动ID,条件必传(在账户端商户后台配置的批次ID)
|
||||
TradeReqDate string `json:"trade_req_date"` // 交易请求日期,必传(yyyyMMdd)
|
||||
AccRespFields map[string]interface{} `json:"acc_resp_fields"` // 账户端返回信息域,条件必传
|
||||
} `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
func (t *TradeQueryResponse) SuccessOrFail() bool {
|
||||
return t.Code == "BBS00000"
|
||||
return t.Code == "000000"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue