Compare commits
No commits in common. "main" and "v1.0.5" have entirely different histories.
341
README.md
341
README.md
|
|
@ -6,46 +6,13 @@
|
|||
|
||||
```
|
||||
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/ # 退款查询
|
||||
└── uploadFile.go # 文件上传相关功能
|
||||
├── trade.go # 交易相关功能
|
||||
├── account.go # 账户相关功能
|
||||
├── merge_pre.go # 主扫合单交易功能
|
||||
└── sdk.go # SDK主入口
|
||||
```
|
||||
|
||||
## 安装
|
||||
|
|
@ -63,7 +30,6 @@ go get -u github.com/black1552/lkl_sdk
|
|||
import (
|
||||
"github.com/black1552/lkl_sdk/lklsdk"
|
||||
"github.com/black1552/lkl_sdk/model"
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
|
|
@ -156,7 +122,7 @@ applyLedgerReq := &model.ApplyLedgerMerReqData{
|
|||
SplitLowestRatio: 3.51, // 最低分账比例
|
||||
SplitEntrustFileName: "授权委托书.pdf", // 授权委托书文件名
|
||||
SplitEntrustFilePath: "path", // 授权委托书文件路径
|
||||
SplitRange: consts.SPLIT_RANGE_ALL, // 分账范围(ALL全部交易分账,MARK标记交易分账)
|
||||
SplitRange: "ALL", // 分账范围(ALL全部交易分账,MARK标记交易分账)
|
||||
RetUrl: "notifyUrl.com", // 回调URL
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +181,7 @@ splitLedgerReq := &model.OrderSplitLedgerReqData{
|
|||
OutSeparateNo: "", // 商户分账指令流水号
|
||||
TotalAmt: "", // 分账总金额,单位为分
|
||||
LklOrgNo: "", // 拉卡拉机构编号
|
||||
CalType: consts.CAL_TYPE_AMOUNT, // 分账计算类型(0-按金额,1-按比例)
|
||||
CalType: "", // 分账计算类型(0-按金额,1-按比例)
|
||||
NotifyUrl: "", // 回调地址
|
||||
RecvDatas: recvDatas, // 分账接收方数据
|
||||
}
|
||||
|
|
@ -276,8 +242,8 @@ balanceQueryReq := &model.BalanceQueryReqData{
|
|||
MerchantNo: config.MerchantNo,
|
||||
OrgNo: "", // 机构号
|
||||
PayNo: "", // 支付单号
|
||||
PayType: consts.PAY_TYPE_CARD, // 支付类型(CARD-卡支付,COUPON-优惠券支付,DISCOUNT-折扣支付,POINT-积分支付,MIX-混合支付)
|
||||
MgtFlag: consts.MGT_FLAG_NO, // 管理标志(NO-普通交易,YES-管理交易)
|
||||
PayType: "", // 支付类型
|
||||
MgtFlag: "", // 管理标志
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
|
|
@ -316,295 +282,6 @@ if !resp.SuccessOrFail() {
|
|||
// 使用resp获取返回的数据
|
||||
```
|
||||
|
||||
### 7. 账户提现
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.WithdrawResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
withdrawReq := &model.WithdrawReqData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
TermNo: "your_term_no", // 终端号
|
||||
OutTradeNo: "your_withdraw_out_trade_no", // 提现商户流水号
|
||||
Amount: "10000", // 提现金额,单位为分
|
||||
Currency: "CNY", // 货币类型
|
||||
AccountType: "WECHAT", // 账户类型
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
withdrawResp, err := sdk.Withdraw(withdrawReq)
|
||||
if err != nil {
|
||||
log.Printf("账户提现失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !withdrawResp.SuccessOrFail() {
|
||||
log.Printf("账户提现失败: %s\n", withdrawResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 8. 商户进件
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.MerchantApplyResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
merchantApplyReq := &model.MerchantApplyReqData{
|
||||
// 填写商户进件所需的各项参数
|
||||
MerchantName: "商户名称",
|
||||
ContactName: "联系人姓名",
|
||||
ContactPhone: "联系电话",
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
merchantApplyResp, err := sdk.AddMer(merchantApplyReq)
|
||||
if err != nil {
|
||||
log.Printf("商户进件失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !merchantApplyResp.SuccessOrFail() {
|
||||
log.Printf("商户进件失败: %s\n", merchantApplyResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 9. 商户进件信息查询
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.QueryMerResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
queryMerReq := &model.QueryMerRequestData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
queryMerResp, err := sdk.QueryMerchant(queryMerReq)
|
||||
if err != nil {
|
||||
log.Printf("商户进件信息查询失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !queryMerResp.SuccessOrFail() {
|
||||
log.Printf("商户进件信息查询失败: %s\n", queryMerResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 10. 商户进件信息校验
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.MerValidateResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
merValidateReq := &model.MerValidateRequestData{
|
||||
// 填写商户进件校验所需的各项参数
|
||||
MerchantName: "商户名称",
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
merValidateResp, err := sdk.MerValidate(merValidateReq)
|
||||
if err != nil {
|
||||
log.Printf("商户进件信息校验失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !merValidateResp.SuccessOrFail() {
|
||||
log.Printf("商户进件信息校验失败: %s\n", merValidateResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 11. 商户进件复议提交
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.ReConfSubmitResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
reConfSubmitReq := &model.ReConfSubmitRequestData{
|
||||
// 填写商户进件复议所需的各项参数
|
||||
MerchantNo: "your_merchant_no",
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
reConfSubmitResp, err := sdk.ReconsiderSubmit(reConfSubmitReq)
|
||||
if err != nil {
|
||||
log.Printf("商户进件复议提交失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !reConfSubmitResp.SuccessOrFail() {
|
||||
log.Printf("商户进件复议提交失败: %s\n", reConfSubmitResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 12. 聚合预下单
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.PreorderResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
preOrderReq := &model.PreorderReqData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
TermNo: "your_term_no", // 终端号
|
||||
OutTradeNo: "your_out_trade_no", // 商户交易流水号
|
||||
AccountType: "WECHAT", // 账户类型
|
||||
TransType: "71", // 交易类型
|
||||
Amount: "100", // 金额,单位为分
|
||||
Subject: "测试订单", // 订单标题
|
||||
NotifyUrl: "https://your-notify-url.com", // 回调地址
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
preOrderResp, err := sdk.PreOrder(preOrderReq)
|
||||
if err != nil {
|
||||
log.Printf("聚合预下单失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !preOrderResp.SuccessOrFail() {
|
||||
log.Printf("聚合预下单失败: %s\n", preOrderResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 13. 文件上传查询
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.UploadFileResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
uploadFileReq := &model.UploadFileReqData{
|
||||
// 填写文件上传查询所需的各项参数
|
||||
// ...
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
uploadFileResp, err := sdk.UploadFileQuery(uploadFileReq)
|
||||
if err != nil {
|
||||
log.Printf("文件上传查询失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !uploadFileResp.SuccessOrFail() {
|
||||
log.Printf("文件上传查询失败: %s\n", uploadFileResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 14. 分账接收方创建申请
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.ApplyLedgerReceiverResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
applyLedgerReceiverReq := &model.ApplyLedgerReceiverReqData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
TermNo: "your_term_no", // 终端号
|
||||
ReceiverType: "PERSON", // 接收方类型
|
||||
ReceiverName: "接收方名称", // 接收方名称
|
||||
ReceiverNo: "接收方编号", // 接收方编号
|
||||
ReceiverAccNo: "接收方账号", // 接收方账号
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
applyLedgerReceiverResp, err := sdk.ApplyLedgerReceiver(applyLedgerReceiverReq)
|
||||
if err != nil {
|
||||
log.Printf("分账接收方创建申请失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !applyLedgerReceiverResp.SuccessOrFail() {
|
||||
log.Printf("分账接收方创建申请失败: %s\n", applyLedgerReceiverResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 15. 分账关系绑定申请
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.ApplyBindResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
applyBindReq := &model.ApplyBindReqData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
TermNo: "your_term_no", // 终端号
|
||||
ReceiverType: "PERSON", // 接收方类型
|
||||
ReceiverNo: "接收方编号", // 接收方编号
|
||||
BindType: "1", // 绑定类型
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
applyBindResp, err := sdk.ApplyBind(applyBindReq)
|
||||
if err != nil {
|
||||
log.Printf("分账关系绑定申请失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !applyBindResp.SuccessOrFail() {
|
||||
log.Printf("分账关系绑定申请失败: %s\n", applyBindResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
### 16. 可分账金额查询
|
||||
|
||||
```go
|
||||
// 初始化特定响应类型的SDK
|
||||
sdk := lklsdk.NewSDK[model.SplitBalanceResponse](gctx.New(), cfgJson)
|
||||
|
||||
// 构建请求参数
|
||||
splitBalanceReq := &model.SplitBalanceReqData{
|
||||
MerchantNo: "your_merchant_no", // 商户号
|
||||
TermNo: "your_term_no", // 终端号
|
||||
// ... 其他必要参数
|
||||
}
|
||||
|
||||
// 调用接口
|
||||
splitBalanceResp, err := sdk.QuerySplitBalance(splitBalanceReq)
|
||||
if err != nil {
|
||||
log.Printf("可分账金额查询失败: %v\n", err)
|
||||
}
|
||||
|
||||
// 使用SuccessOrFail方法判断请求是否成功
|
||||
if !splitBalanceResp.SuccessOrFail() {
|
||||
log.Printf("可分账金额查询失败: %s\n", splitBalanceResp.Msg)
|
||||
}
|
||||
```
|
||||
|
||||
## 错误处理
|
||||
|
||||
SDK使用两层错误处理机制,请确保同时检查网络错误和业务响应状态:
|
||||
|
||||
```go
|
||||
// 1. 首先检查网络或SDK层面的错误
|
||||
resp, err := sdk.SomeFunction(req)
|
||||
if err != nil {
|
||||
log.Printf("调用接口失败: %v\n", err)
|
||||
// 处理网络错误或SDK内部错误
|
||||
return err
|
||||
}
|
||||
|
||||
// 2. 然后使用SuccessOrFail()方法判断业务响应是否成功
|
||||
if !resp.SuccessOrFail() {
|
||||
log.Printf("业务处理失败: %s\n", resp.Msg) // 或resp.RetMsg
|
||||
// 处理业务失败情况
|
||||
return errors.New("业务处理失败")
|
||||
}
|
||||
|
||||
// 处理成功响应
|
||||
// 使用resp获取返回的数据
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. 请妥善保管您的AppID、商户号、密钥等敏感信息
|
||||
|
|
|
|||
|
|
@ -27,13 +27,6 @@ func (at AttType) Ptr() string {
|
|||
return string(at)
|
||||
}
|
||||
|
||||
type MgtFlag string
|
||||
|
||||
const (
|
||||
MGT_FLAG_AVERAGE MgtFlag = "01" // 一般账户
|
||||
MGT_FLAG_HOUSEHOLD MgtFlag = "03" // 虚户
|
||||
)
|
||||
|
||||
type SplitRange string
|
||||
|
||||
const (
|
||||
|
|
|
|||
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,28 +45,4 @@ 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地址
|
||||
const (
|
||||
// LKL_UNIFIED_RETURN_MERGE_REFUND_URL 拉卡拉合单退货
|
||||
LKL_UNIFIED_RETURN_MERGE_REFUND_URL = "/v3/rfd/refund_front/merge_refund"
|
||||
// LKL_UNIFIED_RETURN_REFUND_URL 拉卡拉退货
|
||||
LKL_UNIFIED_RETURN_REFUND_URL = "/v3/rfd/refund_front/refund"
|
||||
// LKL_UNIFIED_RETURN_REFUND_QUERY_URL 拉卡拉退货查询
|
||||
LKL_UNIFIED_RETURN_REFUND_QUERY_URL = "/v3/rfd/refund_front/refund_query"
|
||||
// LKL_UNIFIED_RETURN_REFUND_FEE_URL 拉卡拉退货手续费查询
|
||||
LKL_UNIFIED_RETURN_REFUND_FEE_URL = "/v3/rfd/refund_front/refund_fee"
|
||||
)
|
||||
|
|
|
|||
1
go.mod
1
go.mod
|
|
@ -20,7 +20,6 @@ require (
|
|||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-sql-driver/mysql v1.9.2 // indirect
|
||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.9.3 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
|
||||
github.com/magiconair/properties v1.8.10 // indirect
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
package lklsdk
|
||||
|
||||
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/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,
|
||||
}
|
||||
|
|
@ -26,31 +26,12 @@ func (a *AccountService[T]) BalanceQuery(req *model.BalanceQueryReqData) (*T, er
|
|||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.BalanceQueryRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
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
|
||||
}
|
||||
|
|
@ -65,32 +46,13 @@ func (a *AccountService[T]) Withdraw(req *model.WithdrawReqData) (*T, error) {
|
|||
|
||||
// 构建BaseModel请求
|
||||
baseReq := model.WithdrawRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
ReqTime: time.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package common
|
||||
package lklsdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -8,21 +8,33 @@ 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"
|
||||
)
|
||||
|
||||
// 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
|
||||
config *Config
|
||||
response T
|
||||
ctx context.Context
|
||||
}
|
||||
|
|
@ -35,7 +47,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 +68,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 +85,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数据")
|
||||
}
|
||||
|
|
@ -90,19 +102,15 @@ func (c *Client[T]) loadPrivateKey() (*rsa.PrivateKey, error) {
|
|||
return privateKey.(*rsa.PrivateKey), nil
|
||||
}
|
||||
|
||||
// DoRequest 发送HTTP请求
|
||||
func (c *Client[T]) DoRequest(url string, reqData interface{}) (*T, error) {
|
||||
jsonStr, err := gjson.EncodeString(reqData)
|
||||
// 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("请求参数转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 +121,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
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package common
|
||||
|
||||
// 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:"回调地址"`
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
package mergerefund
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type MergeRefund[T any] struct {
|
||||
client *common.Client[T]
|
||||
}
|
||||
|
||||
func NewMergeRefund[T any](client *common.Client[T]) *MergeRefund[T] {
|
||||
return &MergeRefund[T]{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
func (t *MergeRefund[T]) MergeRefund(req *RequestDataMergeRefund) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_UNIFIED_RETURN_MERGE_REFUND_URL
|
||||
// 构建BaseModel请求
|
||||
baseReq := RequestMergeRefund{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := t.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package mergerefund
|
||||
|
||||
// RequestMergeRefund 统一退货基础请求结构体
|
||||
type RequestMergeRefund struct {
|
||||
ReqTime string `json:"req_time" dc:"ReqTime 请求时间 必填,格式yyyyMMddHHmmss"`
|
||||
Version string `json:"version" dc:"Version 版本号 必填,固定为\"3\""`
|
||||
ReqData *RequestDataMergeRefund `json:"req_data" dc:"ReqData 请求参数 必填,具体字段见对应的数据结构体"`
|
||||
}
|
||||
|
||||
// RequestDataMergeRefund 合单退货请求参数结构体
|
||||
type RequestDataMergeRefund struct {
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
TermNo string `json:"term_no" dc:"TermNo 终端号 必填,拉卡拉分配的终端号"`
|
||||
OutTradeNo string `json:"out_trade_no" dc:"OutTradeNo 商户请求流水号 必填,商户系统唯一"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 退款金额 必填,单位分,整数数字型字符"`
|
||||
RefundReason string `json:"refund_reason,omitempty" dc:"RefundReason 退货原因 可选"`
|
||||
OriginLogNo string `json:"origin_log_no,omitempty" dc:"OriginLogNo 拉卡拉对账单流水号 可选,正交易返回的拉卡拉对账单流水号"`
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty" dc:"OriginOutTradeNo 原商户交易流水号 可选"`
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty" dc:"OriginTradeNo 原交易拉卡拉交易订单号 可选"`
|
||||
LocationInfo *LocationInfo `json:"location_info" dc:"LocationInfo 地址位置信息 必填"`
|
||||
NotifyURL string `json:"notify_url,omitempty" dc:"NotifyURL 后台通知地址 可选,交易结果通知地址"`
|
||||
RefundAccMode string `json:"refund_acc_mode,omitempty" dc:"RefundAccMode 退货账户模式 可选,00退货账户余额 05商户余额 06终端余额"`
|
||||
RefundSplitInfo []*RelateOutSplitInfo `json:"refund_split_info,omitempty" dc:"RefundSplitInfo 请参合单域 可选"`
|
||||
}
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip" dc:"RequestIP 请求方IP地址 必填,格式如36.45.36.95"`
|
||||
Location string `json:"location,omitempty" dc:"Location 维度,经度 可选,商户终端的地理位置,格式:纬度,经度,+表示北纬、东经,-表示南纬、西经,精度最长支持小数点后9位"`
|
||||
BaseStation string `json:"base_station,omitempty" dc:"BaseStation 基站信息 可选,客户端设备的基站信息"`
|
||||
}
|
||||
|
||||
// RelateOutSplitInfo 请求合单域结构体
|
||||
type RelateOutSplitInfo struct {
|
||||
OutSubTradeNo string `json:"out_sub_trade_no" dc:"OutSubTradeNo 外部子退款交易流水号 必填,商户子交易退款流水号,商户号下唯一"`
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
TermNo string `json:"term_no" dc:"TermNo 终端号 必填,拉卡拉分配的业务终端号"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 申请退款金额 必填,单位分,整数型字符"`
|
||||
OriginOutSubTradeNo string `json:"origin_out_sub_trade_no,omitempty" dc:"OriginOutSubTradeNo 原商户交易流水号 可选,下单时的商户子单请求流水号"`
|
||||
OriginSubTradeNo string `json:"origin_sub_trade_no,omitempty" dc:"OriginSubTradeNo 原拉卡拉子交易流水号 可选,下单成功时,返回的拉卡拉交易子流水"`
|
||||
OriginSubLogNo string `json:"origin_sub_log_no,omitempty" dc:"OriginSubLogNo 原对账单子流水号 可选,原交易的tradeNo的后14位,必须是66开头的"`
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package mergerefund
|
||||
|
||||
// ResponseMergeRefund 统一退货响应结构体
|
||||
type ResponseMergeRefund struct {
|
||||
Code string `json:"code" dc:"Code 响应码"`
|
||||
Msg string `json:"msg" dc:"Msg 响应描述"`
|
||||
RespTime string `json:"resp_time" dc:"RespTime 响应时间"`
|
||||
RespData *ResponseDataMergeRefund `json:"resp_data" dc:"RespData 响应数据"`
|
||||
}
|
||||
|
||||
func (r *ResponseMergeRefund) SuccessOrFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
||||
// ResponseDataMergeRefund 合单退货响应数据结构体
|
||||
type ResponseDataMergeRefund struct {
|
||||
TradeState string `json:"trade_state" dc:"TradeState 交易状态 必填,INIT-初始化;SUCCESS-交易成功;FAIL-交易失败;DEAL-交易处理中/未知;PROCESSING-交易已受理;TIMEOUT-超时未知;EXCEPTION-异常"`
|
||||
RefundType string `json:"refund_type" dc:"RefundType 退货模式 必填"`
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
OutTradeNo string `json:"out_trade_no" dc:"OutTradeNo 商户请求流水号 必填,请求中的商户请求流水号"`
|
||||
TradeNo string `json:"trade_no" dc:"TradeNo 拉卡拉交易流水号 必填"`
|
||||
LogNo string `json:"log_no" dc:"LogNo 拉卡拉对账单流水号 必填,tradeNo的后14位"`
|
||||
AccTradeNo string `json:"acc_trade_no,omitempty" dc:"AccTradeNo 账户端交易订单号 可选"`
|
||||
AccountType string `json:"account_type,omitempty" dc:"AccountType 钱包类型 可选,微信:WECHAT;支付宝:ALIPAY;银联:UQRCODEPAY;翼支付:BESTPAY;苏宁易付宝:SUNING"`
|
||||
TotalAmount string `json:"total_amount" dc:"TotalAmount 交易金额 必填,单位分,整数数字型字符串"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 申请退款金额 必填,单位分,整数数字型字符串"`
|
||||
PayerAmount string `json:"payer_amount" dc:"PayerAmount 实际退款金额 必填,单位分,整数数字型字符串"`
|
||||
TradeTime string `json:"trade_time,omitempty" dc:"TradeTime 退款时间 可选,实际退款时间。yyyyMMddHHmmss"`
|
||||
OriginLogNo string `json:"origin_log_no,omitempty" dc:"OriginLogNo 原拉卡拉对账单流水号 可选,如果请求中携带,则返回"`
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty" dc:"OriginTradeNo 原拉卡拉交易流水号 可选,如果请求中携带,则返回"`
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty" dc:"OriginOutTradeNo 原商户请求流水号 可选,如果请求中携带,则返回"`
|
||||
UpIssAddnData string `json:"up_iss_addn_data,omitempty" dc:"UpIssAddnData 单品营销附加数据 可选,扫码交易,参与单品营销优惠时返回"`
|
||||
UpCouponInfo string `json:"up_coupon_info,omitempty" dc:"UpCouponInfo 银联优惠信息 可选,扫码交易,参与单品营销优惠时返回"`
|
||||
TradeInfo string `json:"trade_info,omitempty" dc:"TradeInfo 出资方信息 可选,扫码交易"`
|
||||
ChannelRetDesc string `json:"channel_ret_desc" dc:"ChannelRetDesc 返回描述信息 必填"`
|
||||
RefundSplitInfo []*RelateOutSplitRspInfo `json:"refund_split_info" dc:"RefundSplitInfo 响应合单域 必填"`
|
||||
}
|
||||
|
||||
// RelateOutSplitRspInfo 响应合单域结构体
|
||||
type RelateOutSplitRspInfo struct {
|
||||
OutSubTradeNo string `json:"out_sub_trade_no" dc:"OutSubTradeNo 外部子退款交易流水号 必填,请求中的商户子流水号"`
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
TermNo string `json:"term_no" dc:"TermNo 终端号 必填,拉卡拉分配的业务终端号"`
|
||||
TradeState string `json:"trade_state" dc:"TradeState 交易状态 必填,INIT-初始化;SUCCESS-交易成功;FAIL-交易失败;DEAL-交易处理中/未知;PROCESSING-交易已受理;TIMEOUT-超时未知;EXCEPTION-异常"`
|
||||
SubTradeNo string `json:"sub_trade_no" dc:"SubTradeNo 拉卡拉子交易流水号 必填"`
|
||||
SubLogNo string `json:"sub_log_no" dc:"SubLogNo 拉卡拉子对账单流水号 必填"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 申请退款金额 必填,单位分,整数型字符"`
|
||||
PayerAmount string `json:"payer_amount" dc:"PayerAmount 实际退款金额 必填,单位分,整数型字符"`
|
||||
TotalAmount string `json:"total_amount" dc:"TotalAmount 交易金额 必填,单位分,整数型字符"`
|
||||
OriginSubLogNo string `json:"origin_sub_log_no,omitempty" dc:"OriginSubLogNo 原拉卡拉子对账单流水号 可选,如果请求中携带,则返回"`
|
||||
OriginSubTradeNo string `json:"origin_sub_trade_no,omitempty" dc:"OriginSubTradeNo 原拉卡拉子交易流水号 可选,如果请求中携带,则返回"`
|
||||
OriginOutSubTradeNo string `json:"origin_out_sub_trade_no,omitempty" dc:"OriginOutSubTradeNo 原商户子交易流水号 可选,如果请求中携带,则返回"`
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package refund
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Refund 统一退货API结构体
|
||||
type Refund[T any] struct {
|
||||
client *common.Client[T]
|
||||
}
|
||||
|
||||
// NewRefund 创建统一退货API实例
|
||||
func NewRefund[T any](client *common.Client[T]) *Refund[T] {
|
||||
return &Refund[T]{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// Refund 发起统一退货请求
|
||||
// request: 统一退货请求参数
|
||||
// 返回统一退货响应结果和错误信息
|
||||
func (api *Refund[T]) Refund(req *RequestDataRefund) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_UNIFIED_RETURN_REFUND_URL
|
||||
// 构建BaseModel请求
|
||||
baseReq := RequestRefund{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := api.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package refund
|
||||
|
||||
// ResponseRefund 统一退货响应结构体
|
||||
// 参考文档:https://o.lakala.com/#/home/document/detail?id=892
|
||||
type ResponseRefund struct {
|
||||
Code string `json:"code" dc:"Code 返回业务代码 必填,通讯成功返回码:000000;交易未知:RFD11105/RFD11112;其他返回码可视为失败"`
|
||||
Msg string `json:"msg" dc:"Msg 返回业务代码描述 必填,如\"成功\""`
|
||||
RespTime string `json:"resp_time" dc:"RespTime 响应时间 必填,格式yyyyMMddHHmmss"`
|
||||
RespData *ResponseDataRefund `json:"resp_data" dc:"RespData 响应数据 必填,具体字段根据接口返回"`
|
||||
}
|
||||
|
||||
func (r *ResponseRefund) SuccessOrFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
||||
// ResponseDataRefund 统一退货响应数据结构体
|
||||
type ResponseDataRefund struct {
|
||||
TradeState string `json:"trade_state" dc:"TradeState 交易状态 必填,INIT-初始化;SUCCESS-交易成功;FAIL-交易失败;DEAL-交易处理中/未知;PROCESSING-交易已受理;TIMEOUT-超时未知;EXCEPTION-异常"`
|
||||
RefundType string `json:"refund_type" dc:"RefundType 退货模式 必填"`
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
OutTradeNo string `json:"out_trade_no" dc:"OutTradeNo 商户请求流水号 必填,请求中的商户请求流水号"`
|
||||
TradeNo string `json:"trade_no" dc:"TradeNo 拉卡拉交易流水号 必填"`
|
||||
LogNo string `json:"log_no" dc:"LogNo 拉卡拉对账单流水号 必填,tradeNo的后14位"`
|
||||
AccTradeNo string `json:"acc_trade_no,omitempty" dc:"AccTradeNo 账户端交易订单号 可选"`
|
||||
AccountType string `json:"account_type,omitempty" dc:"AccountType 钱包类型 可选,微信:WECHAT;支付宝:ALIPAY;银联:UQRCODEPAY;翼支付:BESTPAY;苏宁易付宝:SUNING"`
|
||||
TotalAmount string `json:"total_amount" dc:"TotalAmount 交易金额 必填,单位分,整数数字型字符串"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 申请退款金额 必填,单位分,整数数字型字符串"`
|
||||
PayerAmount string `json:"payer_amount" dc:"PayerAmount 实际退款金额 必填,单位分,整数数字型字符串"`
|
||||
TradeTime string `json:"trade_time,omitempty" dc:"TradeTime 退款时间 可选,实际退款时间。yyyyMMddHHmmss"`
|
||||
OriginLogNo string `json:"origin_log_no,omitempty" dc:"OriginLogNo 原拉卡拉对账单流水号 可选,如果请求中携带,则返回"`
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty" dc:"OriginTradeNo 原拉卡拉交易流水号 可选,如果请求中携带,则返回"`
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty" dc:"OriginOutTradeNo 原商户请求流水号 可选,如果请求中携带,则返回"`
|
||||
UpIssAddData string `json:"up_iss_add_data,omitempty" dc:"UpIssAddData 单品营销附加数据 可选,扫码交易,参与单品营销优惠时返回"`
|
||||
UpCouponInfo string `json:"up_coupon_info,omitempty" dc:"UpCouponInfo 银联优惠信息 可选,扫码交易,参与单品营销优惠时返回"`
|
||||
TradeInfo string `json:"trade_info,omitempty" dc:"TradeInfo 出资方信息 可选,扫码交易"`
|
||||
ChannelRetDesc string `json:"channel_ret_desc" dc:"ChannelRetDesc 返回描述信息 必填"`
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
package refund
|
||||
|
||||
// RequestRefund 统一退货基础请求结构体
|
||||
// 参考文档:https://o.lakala.com/#/home/document/detail?id=894
|
||||
type RequestRefund struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *RequestDataRefund `json:"req_data"`
|
||||
}
|
||||
|
||||
// RequestDataRefund 统一退货请求数据结构体
|
||||
// 注意:origin_out_trade_no、origin_log_no、origin_trade_no至少一个必填(调用收银台下单接口拉起交易后发起退款时至少要传两个)
|
||||
// 优先级顺序:origin_trade_no > origin_log_no > origin_out_trade_no
|
||||
type RequestDataRefund struct {
|
||||
MerchantNo string `json:"merchant_no"` // merchant_no: 商户号 (必填,拉卡拉分配的商户号,String(15))
|
||||
TermNo string `json:"term_no"` // term_no: 终端号 (必填,拉卡拉分配的终端号,String(8))
|
||||
OutTradeNo string `json:"out_trade_no"` // out_trade_no: 商户请求流水号 (必填,商户系统唯一,String(32))
|
||||
RefundAmount string `json:"refund_amount"` // refund_amount: 退款金额 (必填,单位分,整数数字型字符,String(12))
|
||||
RefundReason string `json:"refund_reason,omitempty"` // refund_reason: 退货原因 (可选,String(32))
|
||||
OriginLogNo string `json:"origin_log_no,omitempty"` // origin_log_no: 拉卡拉对账单流水号 (可选,正交易返回的拉卡拉对账单流水号,String(14))
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // origin_out_trade_no: 原商户交易流水号 (可选,String(32))
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty"` // origin_trade_no: 原交易拉卡拉交易订单号 (可选,String(32))
|
||||
LocationInfo *LocationInfo `json:"location_info"` // location_info: 地址位置信息 (必填)
|
||||
RefundAccMode string `json:"refund_acc_mode,omitempty"` // refund_acc_mode: 退货账户模式 (可选,00退货账户余额 05商户余额 06终端余额 30终点账户,String(2))
|
||||
NotifyURL string `json:"notify_url,omitempty"` // notify_url: 后台通知地址 (可选,交易结果通知地址,String(128))
|
||||
RefundAmtSts string `json:"refund_amt_sts,omitempty"` // refund_amt_sts: 退货资金状态 (可选,00 分账前,01 分账后;分账交易部分退货的情况,需要前端上送交易的分账状态,String(2))
|
||||
}
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // request_ip: 请求IP (必填)
|
||||
Location string `json:"location"` // location: 位置信息 (必填,如经纬度等)
|
||||
BaseStation string `json:"base_station,omitempty"` // base_station: 基站信息 (可选)
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
package refundfee
|
||||
|
|
@ -1 +0,0 @@
|
|||
package refundfee
|
||||
|
|
@ -1 +0,0 @@
|
|||
package refundfee
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package refundquery
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type RefundQuery[T any] struct {
|
||||
client *common.Client[T]
|
||||
}
|
||||
|
||||
// NewRefundQuery 创建统一退货查询API实例
|
||||
func NewRefundQuery[T any](client *common.Client[T]) *RefundQuery[T] {
|
||||
return &RefundQuery[T]{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// RefundQuery 发起统一退货查询请求
|
||||
func (api *RefundQuery[T]) RefundQuery(req *RequestDataRefundQuery) (*T, error) {
|
||||
// 构建请求参数
|
||||
url := consts.BASE_URL + consts.LKL_UNIFIED_RETURN_REFUND_QUERY_URL
|
||||
// 构建BaseModel请求
|
||||
baseReq := RequestRefundQuery{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
respBody, err := api.client.DoRequest(url, baseReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return respBody, nil
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package refundquery
|
||||
|
||||
// RequestRefundQuery 统一退货查询请求结构体
|
||||
// API文档: https://o.lakala.com/#/home/document/detail?id=893
|
||||
type RequestRefundQuery struct {
|
||||
ReqTime string `json:"req_time" dc:"ReqTime 请求时间 格式yyyyMMddHHmmss"`
|
||||
Version string `json:"version" dc:"Version 版本号 固定值3.0"`
|
||||
ReqData *RequestDataRefundQuery `json:"req_data" dc:"ReqData 请求数据"`
|
||||
}
|
||||
|
||||
// RequestDataRefundQuery 统一退货查询请求数据结构体
|
||||
// API文档: https://o.lakala.com/#/home/document/detail?id=893
|
||||
type RequestDataRefundQuery struct {
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号,String(15)"`
|
||||
TermNo string `json:"term_no" dc:"TermNo 终端号 必填,拉卡拉分配的业务终端号,String(8)"`
|
||||
OutTradeNo string `json:"out_trade_no,omitempty" dc:"OutTradeNo 商户交易流水号 选填,下单时的商户请求流水号,String(32) 与拉卡拉交易流水号二选一"`
|
||||
TradeNo string `json:"trade_no,omitempty" dc:"TradeNo 拉卡拉交易流水号 选填,拉卡拉交易流水号,String(32) 与商户交易流水号二选一"`
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package refundquery
|
||||
|
||||
// ResponseRefundQuery 统一退货查询响应结构体
|
||||
// API文档: https://o.lakala.com/#/home/document/detail?id=893
|
||||
type ResponseRefundQuery struct {
|
||||
Code string `json:"code" dc:"Code 响应码 RFD00000#成功、RFD11112#网络请求超时"`
|
||||
Msg string `json:"msg" dc:"Msg 响应描述"`
|
||||
Data *ResponseDataRefundQuery `json:"data,omitempty" dc:"Data 响应数据"`
|
||||
Sign string `json:"sign" dc:"Sign 签名"`
|
||||
}
|
||||
|
||||
// ResponseDataRefundQuery 统一退货查询响应数据结构体
|
||||
// API文档: https://o.lakala.com/#/home/document/detail?id=893
|
||||
type ResponseDataRefundQuery struct {
|
||||
OutTradeNo string `json:"out_trade_no" dc:"OutTradeNo 商户请求流水号 必填,原退款交易商户请求流水号(扫码交易返回)"`
|
||||
TradeTime string `json:"trade_time" dc:"TradeTime 交易时间 必填,交易时间yyyyMMddHHmmss"`
|
||||
TradeState string `json:"trade_state" dc:"TradeState 交易状态 必填,INIT-初始化;SUCCESS-交易成功;FAIL-交易失败;DEAL-交易处理中/未知;TIMEOUT-超时未知;EXCEPTION-异常"`
|
||||
TradeNo string `json:"trade_no" dc:"TradeNo 拉卡拉商户订单号 必填,拉卡拉生成的交易流水"`
|
||||
LogNo string `json:"log_no" dc:"LogNo 拉卡拉对账单流水号 必填,拉卡拉生成的对账单流水号(新增)"`
|
||||
AccTradeNo string `json:"acc_trade_no,omitempty" dc:"AccTradeNo 账户端交易订单号 选填,账户端交易流水号,String(32)"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 交易金额 必填"`
|
||||
PayMode string `json:"pay_mode,omitempty" dc:"PayMode 支付方式 选填,00 借记卡 01 贷记卡 02 准贷记卡 银行卡交易返回"`
|
||||
CrdNo string `json:"crd_no,omitempty" dc:"CrdNo 卡号 选填,脱敏卡号,前六后四,中间用*替换"`
|
||||
AccountType string `json:"account_type,omitempty" dc:"AccountType 钱包类型 选填,微信:WECHAT 支付宝:ALIPAY 银联:UNION 翼支付: BESTPAY 苏宁易付宝: SUNING 扫码交易返回"`
|
||||
PayerAmount string `json:"payer_amount,omitempty" dc:"PayerAmount 付款人实付金额 选填,实际退款金额,单位分 扫码交易返回"`
|
||||
AccSettleAmount string `json:"acc_settle_amount,omitempty" dc:"AccSettleAmount 账户端结算金额 选填,账户端应结订单金额,单位分 扫码交易返回"`
|
||||
AccMdiscountAmount string `json:"acc_mdiscount_amount,omitempty" dc:"AccMdiscountAmount 商户侧优惠金额(账户端) 选填,商户优惠金额,单位分 扫码交易返回"`
|
||||
AccDiscountAmount string `json:"acc_discount_amount,omitempty" dc:"AccDiscountAmount 账户端优惠金额 选填,拉卡拉优惠金额, 扫码交易返回"`
|
||||
ChannelRetDesc string `json:"channel_ret_desc" dc:"ChannelRetDesc 返回描述信息 必填,code#msg:RFD00000#成功、RFD11112#网络请求超时"`
|
||||
RefundSplitInfo []*RelateOutSplitRspInfo `json:"refund_split_info,omitempty" dc:"RefundSplitInfo 退款拆单信息 选填,合单交易退款查询时返回"`
|
||||
OriginLogNo string `json:"origin_log_no" dc:"OriginLogNo 拉卡拉对账单流水号 必填,原交易拉卡拉对账单流水号"`
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no" dc:"OriginOutTradeNo 原商户交易流水号 必填"`
|
||||
OriginTradeNo string `json:"origin_trade_no" dc:"OriginTradeNo 原交易拉卡拉交易订单号 必填"`
|
||||
OriginTotalAmount string `json:"origin_total_amount" dc:"OriginTotalAmount 原交易金额 必填,原正交易订单金额"`
|
||||
RefundType string `json:"refund_type,omitempty" dc:"RefundType 退货模式 选填"`
|
||||
}
|
||||
|
||||
// RelateOutSplitRspInfo 退款拆单信息结构体
|
||||
// API文档: https://o.lakala.com/#/home/document/detail?id=893
|
||||
type RelateOutSplitRspInfo struct {
|
||||
OutSubTradeNo string `json:"out_sub_trade_no" dc:"OutSubTradeNo 外部子退款交易流水号 必填,商户子交易流水号,商户号下唯一"`
|
||||
MerchantNo string `json:"merchant_no" dc:"MerchantNo 商户号 必填,拉卡拉分配的商户号"`
|
||||
TermNo string `json:"term_no" dc:"TermNo 终端号 必填,拉卡拉分配的业务终端号"`
|
||||
RefundAmount string `json:"refund_amount" dc:"RefundAmount 申请退款金额 必填,单位分,整数型字符"`
|
||||
SubTradeNo string `json:"sub_trade_no,omitempty" dc:"SubTradeNo 拉卡拉子交易流水号 选填"`
|
||||
SubLogNo string `json:"sub_log_no,omitempty" dc:"SubLogNo 对账单子流水号 选填,sub_trade_no后14位"`
|
||||
TradeState string `json:"trade_state,omitempty" dc:"TradeState 子交易状态 选填,SUCCESS-交易成功 FAIL-交易失败"`
|
||||
ResultCode string `json:"result_code,omitempty" dc:"ResultCode 处理结果码 选填"`
|
||||
ResultMsg string `json:"result_msg,omitempty" dc:"ResultMsg 处理描述 选填"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断交易是否成功
|
||||
// 返回true表示交易成功,false表示交易失败或处理中
|
||||
func (r *ResponseRefundQuery) SuccessOrFail() bool {
|
||||
return r.Code == "000000"
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package unifiedreturn
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/unifiedreturn/mergerefund"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/unifiedreturn/refund"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/unifiedreturn/refundquery"
|
||||
)
|
||||
|
||||
type Server[T any] struct {
|
||||
Client *common.Client[T]
|
||||
MergeRefound *mergerefund.MergeRefund[T]
|
||||
Refound *refund.Refund[T]
|
||||
RefoundQuery *refundquery.RefundQuery[T]
|
||||
}
|
||||
|
||||
// NewServer 创建拉卡拉统一退货服务实例
|
||||
func NewServer[T any](ctx context.Context, cfgJson string) *Server[T] {
|
||||
client := common.NewClient[T](ctx, cfgJson)
|
||||
return &Server[T]{
|
||||
Client: client,
|
||||
MergeRefound: mergerefund.NewMergeRefund[T](client),
|
||||
Refound: refund.NewRefund[T](client),
|
||||
RefoundQuery: refundquery.NewRefundQuery[T](client),
|
||||
}
|
||||
}
|
||||
|
||||
// MergeRefund 合单退货
|
||||
func (u *Server[T]) MergeRefund(req *mergerefund.RequestDataMergeRefund) (*T, error) {
|
||||
return u.MergeRefound.MergeRefund(req)
|
||||
}
|
||||
|
||||
// Refund 退货
|
||||
func (u *Server[T]) Refund(req *refund.RequestDataRefund) (*T, error) {
|
||||
return u.Refound.Refund(req)
|
||||
}
|
||||
|
||||
// RefundQuery 退货查询
|
||||
func (u *Server[T]) RefundQuery(req *refundquery.RequestDataRefundQuery) (*T, error) {
|
||||
return u.RefoundQuery.RefundQuery(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/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-平台分润规则(分润规则必传)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ type BalanceQueryReqData struct {
|
|||
// 账号类型(01:收款账户,02:付款账户,03:分账商户账户,04:分账接收方账户,05:充值代付账户,06:结算代付账户)-未上送则默认01,非必传,最大长度32
|
||||
PayType consts.PayType `json:"pay_type"`
|
||||
// 账户标志(01:一般账户;03:虚户)-未上送则默认01,非必传,最大长度32
|
||||
MgtFlag consts.MgtFlag `json:"mgt_flag"`
|
||||
MgtFlag string `json:"mgt_flag"`
|
||||
}
|
||||
|
||||
// BalanceQueryResponse 余额查询响应结构体
|
||||
|
|
@ -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 判断余额查询请求是否成功
|
||||
|
|
|
|||
|
|
@ -49,10 +49,6 @@ type MerValidateResponse struct {
|
|||
CmdRetCode string `json:"cmdRetCode"`
|
||||
// ReqId 请求ID
|
||||
ReqId string `json:"reqId"`
|
||||
// md 随机字符串
|
||||
Md string `json:"md"`
|
||||
// RespData 响应业务参数
|
||||
RespData *MerValidateResponseData `json:"respData"`
|
||||
// RetCode 返回码
|
||||
RetCode string `json:"retCode"`
|
||||
// RetMsg 返回消息
|
||||
|
|
@ -63,13 +59,6 @@ type MerValidateResponse struct {
|
|||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
type MerValidateResponseData struct {
|
||||
// OrgCode 机构代码
|
||||
OrgCode string `json:"orgCode"`
|
||||
// OrderNo 订单号
|
||||
OrderNo string `json:"orderNo"`
|
||||
}
|
||||
|
||||
func (t *MerValidateResponse) SuccessOrFail() bool {
|
||||
return t.RetCode == "000000"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ type MerchantApplyRequest struct {
|
|||
ReqId string `json:"reqId"` // 请求时间,格式为yyyyMMddHHmmss,必填
|
||||
Timestamp int64 `json:"timestamp"` // 接口版本,固定值"1.0",必填
|
||||
Ver string `json:"ver"` // 接口版本,固定值"1.0",必填
|
||||
ReqData *MerchantApplyReqData `json:"reqData"` // 请求业务参数,必填
|
||||
ReqData *MerchantApplyReqData `json:"req_data"` // 请求业务参数,必填
|
||||
}
|
||||
|
||||
// MerchantApplyReqData 商户进件请求业务数据结构体
|
||||
|
|
@ -81,17 +81,16 @@ 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 商户进件响应结构体
|
||||
|
||||
type MerchantApplyResponse struct {
|
||||
RetCode string `json:"retCode"` // 响应码,成功为"0000",其他为错误码
|
||||
RetMsg string `json:"retMsg"` // 响应描述
|
||||
Timestamp int64 `json:"timestamp"` // 响应描述
|
||||
Md string `json:"md"`
|
||||
RetCode string `json:"retCode"` // 响应码,成功为"0000",其他为错误码
|
||||
RetMsg string `json:"retMsg"` // 响应描述
|
||||
Timestamp int64 `json:"timestamp"` // 响应描述
|
||||
Ver string `json:"ver"` // 响应描述
|
||||
ReqId string `json:"reqId"` // 响应描述
|
||||
CmdRetCode string `json:"cmdRetCode"` // 响应描述
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ type QueryMerResponse struct {
|
|||
RespData *QueryMerResponseData `json:"respData"`
|
||||
// RetCode 返回码
|
||||
RetCode string `json:"retCode"`
|
||||
// md 随机字符串
|
||||
Md string `json:"md"`
|
||||
// RetMsg 返回消息
|
||||
RetMsg string `json:"retMsg"`
|
||||
// Timestamp 时间戳
|
||||
|
|
@ -54,12 +52,8 @@ type QueryMerResponse struct {
|
|||
// QueryMerResponseData 商户进件信息查询响应业务参数
|
||||
|
||||
type QueryMerResponseData struct {
|
||||
// OrgCode 机构代码
|
||||
OrgCode string `json:"orgCode"`
|
||||
// OrderNo 订单号
|
||||
OrderNo string `json:"orderNo"`
|
||||
// ContractId 进件ID
|
||||
ContractId string `json:"contractId"`
|
||||
// ContractStatus 进件状态
|
||||
// 未提交:NO_COMMIT
|
||||
// 已提交:COMMIT
|
||||
|
|
@ -69,12 +63,16 @@ type QueryMerResponseData struct {
|
|||
// 审核通过:WAIT_FOR_CONTACT
|
||||
// 审核驳回:INNER_CHECK_REJECTED
|
||||
ContractStatus string `json:"contractStatus"`
|
||||
// OrgCode 机构代码
|
||||
OrgCode string `json:"orgCode"`
|
||||
// ContractId 进件ID
|
||||
ContractId string `json:"contractId"`
|
||||
// MerInnerNo 拉卡拉内部商户号(该属性审核通过才有)
|
||||
MerInnerNo string `json:"merInnerNo"`
|
||||
// ContractMemo 进件描述
|
||||
// 进件审核通过,返回"审核通过"
|
||||
// 进件审核驳回,返回具体的驳回理由
|
||||
ContractMemo string `json:"contractMemo"`
|
||||
// MerInnerNo 拉卡拉内部商户号(该属性审核通过才有)
|
||||
MerInnerNo string `json:"merInnerNo"`
|
||||
// MerCupNo 银联商户号(该属性审核通过才有)
|
||||
MerCupNo string `json:"merCupNo"`
|
||||
// TermDatas 终端列表信息(该属性审核通过并且是增商、增终进件才有)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -38,10 +38,6 @@ type ReConfSubmitResponse struct {
|
|||
ReqId string `json:"reqId"`
|
||||
// RetCode 返回码
|
||||
RetCode string `json:"retCode"`
|
||||
// md 随机字符串
|
||||
Md string `json:"md"`
|
||||
// RespData 响应业务参数
|
||||
RespData *ReConfSubmitResponseData `json:"respData"`
|
||||
// RetMsg 返回消息
|
||||
RetMsg string `json:"retMsg"`
|
||||
// Timestamp 时间戳
|
||||
|
|
@ -49,12 +45,6 @@ type ReConfSubmitResponse struct {
|
|||
// Ver 版本号
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
type ReConfSubmitResponseData struct {
|
||||
// OrgCode 机构代码
|
||||
OrgCode string `json:"orgCode"`
|
||||
// OrderNo 订单号
|
||||
OrderNo string `json:"orderNo"`
|
||||
}
|
||||
|
||||
func (t *ReConfSubmitResponse) 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