重构账户与商户服务模块

- 移除旧版 account.go 文件中的账户服务实现
- 新增聚合扫码关单、退款、撤销等接口实现
- 新增聚合被扫、主扫及加密接口实现
- 新增交易查询与支付宝吱口令申请接口
- 重构统一退货及退货查询接口,优化泛型使用
- 移除旧版商户进件相关接口实现
- 调整部分服务结构体命名与参数传递方式
- 统一请求时间格式并优化代码结构
This commit is contained in:
2025-10-21 13:24:24 +08:00
parent 7777630306
commit 7b9657a9e8
62 changed files with 1061 additions and 2040 deletions
+33
View File
@@ -0,0 +1,33 @@
package relationRefund
import (
"github.com/black1552/lkl_sdk/consts"
"github.com/black1552/lkl_sdk/lklsdk/common"
"github.com/gogf/gf/v2/os/gtime"
)
// RelationRefundServer 聚合扫码退款API结构体
type RelationRefundServer struct {
Client *common.Client[RelationRefundResponse]
}
// NewRelationRefundServer 创建聚合扫码退款API实例
func NewRelationRefundServer(client *common.Client[RelationRefundResponse]) *RelationRefundServer {
return &RelationRefundServer{
Client: client,
}
}
// RelationRefund 聚合扫码退款方法
// - reqData: 退款请求数据
func (a *RelationRefundServer) RelationRefund(reqData *RelationRefundRequestData) (*RelationRefundResponse, error) {
// 构建请求结构体
request := &RelationRefundRequest{
ReqTime: gtime.Now().Format("20060102150405"),
Version: "3.0",
ReqData: reqData,
}
// 调用Client发送请求
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_RELATION_REFUND_URL, request)
}
@@ -0,0 +1,29 @@
package relationRefund
// LocationInfo 地址位置信息结构体
type LocationInfo struct {
RequestIP string `json:"request_ip"` // 请求方IP地址,必填
BaseStation string `json:"base_station,omitempty"` // 基站信息,可选
Location string `json:"location,omitempty"` // 维度,经度,可选
}
// RelationRefundRequestData 聚合扫码退款请求数据结构体
type RelationRefundRequestData struct {
MerchantNo string `json:"merchant_no"` // 商户号,必填
TermNo string `json:"term_no"` // 终端号,必填
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,必填
RefundAmount string `json:"refund_amount"` // 退款金额,必填
RefundReason string `json:"refund_reason"` // 退款原因,必填
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // 原商户交易流水号,可选(退款时origin_out_trade_no,origin_trade_no,origin_log_no必送其一)
OriginTradeNo string `json:"origin_trade_no,omitempty"` // 原拉卡拉交易流水号,可选
OriginLogNo string `json:"origin_log_no,omitempty"` // 原对账单流水号,可选
TradeReqDate string `json:"trade_req_date,omitempty"` // 交易请求日期,可选(送原商户交易流水号退款时必填)
LocationInfo LocationInfo `json:"location_info"` // 地址位置信息,必填
}
// RelationRefundRequest 聚合扫码退款请求结构体
type RelationRefundRequest struct {
ReqTime string `json:"req_time"`
Version string `json:"version"`
ReqData *RelationRefundRequestData `json:"req_data"`
}
@@ -0,0 +1,34 @@
package relationRefund
// RelationRefundResponseData 聚合扫码退款响应数据结构体
type RelationRefundResponseData struct {
MerchantNo string `json:"merchant_no"` // 商户号
OutTradeNo string `json:"out_trade_no"` // 商户请求流水号
TradeNo string `json:"trade_no"` // 拉卡拉退款单号
LogNo string `json:"log_no"` // 拉卡拉对账单流水号
AccTradeNo string `json:"acc_trade_no,omitempty"` // 账户端交易订单号
AccountType string `json:"account_type,omitempty"` // 钱包类型
TotalAmount string `json:"total_amount"` // 交易金额
RefundAmount string `json:"refund_amount"` // 申请退款金额
PayerAmount string `json:"payer_amount"` // 实际退款金额
TradeTime string `json:"trade_time,omitempty"` // 退款时间
OriginTradeNo string `json:"origin_trade_no,omitempty"` // 原拉卡拉订单号
OriginOutTradeNo string `json:"origin_out_trade_no,omitempty"` // 原商户请求流水号
UpIssAddnData string `json:"up_iss_addn_data,omitempty"` // 单品营销附加数据
UpCouponInfo string `json:"up_coupon_info,omitempty"` // 银联优惠信息、出资方信息
TradeInfo string `json:"trade_info,omitempty"` // 出资方信息
FundBillList string `json:"fund_bill_list,omitempty"` // 交易支付使用的资金渠道
}
// RelationRefundResponse 聚合扫码退款响应结构体
type RelationRefundResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
RespTime string `json:"resp_time"`
RespData *RelationRefundResponseData `json:"resp_data,omitempty"`
}
// SuccessOrFail 判断响应是否成功
func (r *RelationRefundResponse) SuccessOrFail() bool {
return r.Code == "BBS00000"
}