feat(basePay): 添加测试环境支持和新功能
- 为 transPreorder 和 relationClose 添加测试环境请求方法 - 更新所有模块导入路径,统一使用新的 common 包 - 重构多个结构体和服务命名以提高一致性 - 新增 labs 包整合基础支付相关功能模块 - 创建 SDK 入口文件便于统一管理和调用 - 在 consts 中增加 BASE_TEST_URL 常量定义 - 优化请求数据结构体字段注释和文档标签 - 移除冗余代码并调整部分函数签名以增强可读性
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package transpreorder
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/common"
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type TransPreorder struct {
|
||||
client *common.Client[TransPreorderResponse]
|
||||
}
|
||||
|
||||
func NewTransPreorderApi(client *common.Client[TransPreorderResponse]) *TransPreorder {
|
||||
return &TransPreorder{client: client}
|
||||
}
|
||||
|
||||
func (tp *TransPreorder) TransPreorder(reqData *TransPreorderRequestData) (*TransPreorderResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &TransPreorderRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
return tp.client.DoRequest(consts.BASE_URL+consts.LKL_DCP_TRANS_PREORDER_URL, request)
|
||||
}
|
||||
func (tp *TransPreorder) TransPreorderTest(reqData *TransPreorderRequestData) (*TransPreorderResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &TransPreorderRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
return tp.client.DoRequest(consts.BASE_TEST_URL+consts.LKL_DCP_TRANS_PREORDER_URL, request)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package transpreorder
|
||||
|
||||
type TransPreorderRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *TransPreorderRequestData `json:"req_data"`
|
||||
}
|
||||
|
||||
type TransPreorderRequestData struct {
|
||||
OutTradeNo string `json:"out_trade_no"`
|
||||
TotalAmount string `json:"total_amount"`
|
||||
Subject string `json:"subject"`
|
||||
Body string `json:"body"`
|
||||
NotifyUrl string `json:"notify_url"`
|
||||
ExpireTime string `json:"expire_time"`
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package transpreorder
|
||||
|
||||
type TransPreorderResponse struct {
|
||||
}
|
||||
Reference in New Issue
Block a user