feat(basePay): 添加测试环境支持和新功能
- 为 transPreorder 和 relationClose 添加测试环境请求方法 - 更新所有模块导入路径,统一使用新的 common 包 - 重构多个结构体和服务命名以提高一致性 - 新增 labs 包整合基础支付相关功能模块 - 创建 SDK 入口文件便于统一管理和调用 - 在 consts 中增加 BASE_TEST_URL 常量定义 - 优化请求数据结构体字段注释和文档标签 - 移除冗余代码并调整部分函数签名以增强可读性
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package relationRevoked
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/common"
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// RelationRevokedServer 聚合扫码撤销API结构体
|
||||
type RelationRevokedServer struct {
|
||||
Client *common.Client[RelationRevokedResponse]
|
||||
}
|
||||
|
||||
// NewRelationRevokedServer 创建聚合扫码撤销API实例
|
||||
func NewRelationRevokedServer(client *common.Client[RelationRevokedResponse]) *RelationRevokedServer {
|
||||
return &RelationRevokedServer{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// RelationRevoked 聚合扫码撤销方法
|
||||
// - reqData: 撤销请求数据
|
||||
func (a *RelationRevokedServer) RelationRevoked(reqData *RelationRevokedRequestData) (*RelationRevokedResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &RelationRevokedRequest{
|
||||
ReqTime: gtime.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 调用Client发送请求
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_RELATION_REVOKED_URL, request)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package relationRevoked
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址,必填
|
||||
BaseStation string `json:"base_station,omitempty"` // 基站信息,可选
|
||||
Location string `json:"location,omitempty"` // 维度,经度,可选
|
||||
}
|
||||
|
||||
// RelationRevokedRequestData 聚合扫码撤销请求数据结构体
|
||||
type RelationRevokedRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必填
|
||||
TermNo string `json:"term_no"` // 终端号,必填
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,必填
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // 原商户交易流水号,可选(撤销时origin_out_trade_no,origin_trade_no必送其一)
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty"` // 原拉卡拉交易流水号,可选(撤销时origin_out_trade_no,origin_trade_no必送其一)
|
||||
LocationInfo LocationInfo `json:"location_info"` // 地址位置信息,必填
|
||||
}
|
||||
|
||||
// RelationRevokedRequest 聚合扫码关单请求结构体
|
||||
type RelationRevokedRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *RelationRevokedRequestData `json:"req_data"`
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package relationRevoked
|
||||
|
||||
// RelationRevokedResponseData 聚合扫码撤销响应数据结构体
|
||||
type RelationRevokedResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户请求流水号
|
||||
TradeNo string `json:"trade_no,omitempty"` // 拉卡拉商户订单号
|
||||
LogNo string `json:"log_no"` // 拉卡拉对账单流水号
|
||||
AccTradeNo string `json:"acc_trade_no,omitempty"` // 账户端交易订单号
|
||||
AccountType string `json:"account_type"` // 钱包类型
|
||||
TotalAmount string `json:"total_amount"` // 交易金额
|
||||
TradeTime string `json:"trade_time"` // 交易完成时间
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // 原商户请求流水号
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty"` // 原拉卡拉交易流水号
|
||||
}
|
||||
|
||||
// RelationRevokedResponse 聚合扫码撤销响应结构体
|
||||
type RelationRevokedResponse struct {
|
||||
Code string `json:"code"` // 响应码
|
||||
Msg string `json:"msg"` // 响应信息
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
RespData RelationRevokedResponseData `json:"resp_data,omitempty"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *RelationRevokedResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
Reference in New Issue
Block a user