重构账户与商户服务模块
- 移除旧版 account.go 文件中的账户服务实现 - 新增聚合扫码关单、退款、撤销等接口实现 - 新增聚合被扫、主扫及加密接口实现 - 新增交易查询与支付宝吱口令申请接口 - 重构统一退货及退货查询接口,优化泛型使用 - 移除旧版商户进件相关接口实现 - 调整部分服务结构体命名与参数传递方式 - 统一请求时间格式并优化代码结构
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package relationclose
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// RelationCloseServer 聚合扫码关单API结构体
|
||||
type RelationCloseServer struct {
|
||||
Client *common.Client[RelationCloseResponse]
|
||||
}
|
||||
|
||||
// NewAPI 创建聚合扫码关单API实例
|
||||
func NewRelationCloseServer(client *common.Client[RelationCloseResponse]) *RelationCloseServer {
|
||||
return &RelationCloseServer{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// RelationClose 执行聚合扫码关单请求
|
||||
// - merchantNo: 商户号
|
||||
// - termNo: 终端号
|
||||
// - 原交易标识:originOutTradeNo、originTradeNo、(originOutOrderSource+originOutOrderNo) 三者必选其一
|
||||
// - locationInfo: 地址位置信息(风控要求必送)
|
||||
func (a *RelationCloseServer) RelationClose(reqData *RelationCloseRequestData) (*RelationCloseResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &RelationCloseRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 设置API路径 - 使用consts中的生产环境URL
|
||||
url := consts.BASE_URL + consts.LKL_BASE_URL_RELATION_CLOSE_URL
|
||||
|
||||
// 发送请求 - 使用consts中定义的聚合扫码关单URL
|
||||
return a.Client.DoRequest(url, request)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package relationclose
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址 (必填)
|
||||
BaseStation string `json:"base_station,omitempty"` // 基站信息 (可选)
|
||||
Location string `json:"location,omitempty"` // 纬度,经度 (可选)
|
||||
}
|
||||
|
||||
// RelationCloseRequestData 聚合扫码关单请求数据结构体
|
||||
type RelationCloseRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号 (必填)
|
||||
TermNo string `json:"term_no"` // 终端号 (必填)
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // 原商户交易流水号 (可选)
|
||||
OriginTradeNo string `json:"origin_trade_no,omitempty"` // 原交易拉卡拉交易流水号 (可选)
|
||||
OriginOutOrderSource string `json:"origin_out_order_source,omitempty"` // 原订单外部订单来源 (可选)
|
||||
OriginOutOrderNo string `json:"origin_out_order_no,omitempty"` // 原订单外部商户订单号 (可选)
|
||||
LocationInfo *LocationInfo `json:"location_info"` // 地址位置信息 (必填)
|
||||
}
|
||||
|
||||
// RelationCloseRequest 聚合扫码关单请求结构体
|
||||
type RelationCloseRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *RelationCloseRequestData `json:"req_data"`
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package relationclose
|
||||
|
||||
// RelationCloseResponseData 聚合扫码关单响应数据结构体
|
||||
type RelationCloseResponseData struct {
|
||||
OriginTradeNo string `json:"origin_trade_no"` // 原拉卡拉订单号
|
||||
OriginOutTradeNo string `json:"origin_out_trade_no"` // 原商户请求流水号
|
||||
OriginOutOrderSource string `json:"origin_out_order_source,omitempty"` // 原订单外部订单来源
|
||||
OriginOutOrderNo string `json:"origin_out_order_no,omitempty"` // 原订单外部商户订单号
|
||||
TradeTime string `json:"trade_time"` // 交易时间
|
||||
}
|
||||
|
||||
// RelationCloseResponse 聚合扫码关单响应结构体
|
||||
type RelationCloseResponse struct {
|
||||
RespTime string `json:"resp_time"`
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RespData *RelationCloseResponseData `json:"resp_data,omitempty"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *RelationCloseResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
Reference in New Issue
Block a user