Merge branch 'menu' of https://github.com/black1552/lkl_sdk into menu
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package transpreorder
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"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)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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"`
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package transpreorder
|
||||
|
||||
type TransPreorderResponse struct {
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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"`
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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)
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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"`
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package relationRevoked
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"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)
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
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"`
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
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"
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package transmicropay
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// API 聚合被扫API结构体
|
||||
type TransMicropayServer struct {
|
||||
Client *common.Client[TransMicropayResponse]
|
||||
}
|
||||
|
||||
// NewAPI 创建聚合被扫API实例
|
||||
func NewTransMicropayServer(client *common.Client[TransMicropayResponse]) *TransMicropayServer {
|
||||
return &TransMicropayServer{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransMicropay 执行聚合被扫请求
|
||||
// - merchantNo: 商户号
|
||||
// - termNo: 终端号
|
||||
// - outTradeNo: 商户交易流水号
|
||||
// - authCode: 支付授权码
|
||||
// - totalAmount: 金额
|
||||
// - locationInfo: 地址位置信息
|
||||
// - 其他可选参数通过TransMicropayRequestData的其他字段设置
|
||||
func (a *TransMicropayServer) TransMicropay(reqData *TransMicropayRequestData) (*TransMicropayResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &TransMicropayRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 发送请求 - 使用consts中定义的聚合被扫URL
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_MICROPAY_URL, request)
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package transmicropay
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址 (必填)
|
||||
BaseStation string `json:"base_station,omitempty"` // 基站信息 (可选)
|
||||
Location string `json:"location,omitempty"` // 纬度,经度 (银联二维码交易必填)
|
||||
}
|
||||
|
||||
// GoodsInfo 商品信息结构体
|
||||
type GoodsInfo struct {
|
||||
GoodsId string `json:"goods_id,omitempty"` // 商品ID (可选)
|
||||
GoodsName string `json:"goods_name,omitempty"` // 商品名称 (可选)
|
||||
Price string `json:"price,omitempty"` // 商品单价 (可选)
|
||||
Quantity string `json:"quantity,omitempty"` // 商品数量 (可选)
|
||||
CategoryId string `json:"category_id,omitempty"` // 商品类目ID (可选)
|
||||
Body string `json:"body,omitempty"` // 商品描述 (可选)
|
||||
}
|
||||
|
||||
// AccBusiFields 账户端业务信息域结构体
|
||||
type AccBusiFields struct {
|
||||
ExtendParams string `json:"extend_params,omitempty"` // 业务扩展参数 (可选)
|
||||
GoodsDetail string `json:"goods_detail,omitempty"` // 商品详情 (可选)
|
||||
StoreId string `json:"store_id,omitempty"` // 商户门店编号 (可选)
|
||||
AlipayStoreId string `json:"alipay_store_id,omitempty"` // 支付宝店铺编号 (不再使用)
|
||||
TimeoutExpress string `json:"timeout_express,omitempty"` // 交易有效时间 (可选)
|
||||
DisablePayChannels string `json:"disable_pay_channels,omitempty"` // 支付宝禁用支付渠道 (可选)
|
||||
BusinessParams string `json:"business_params,omitempty"` // 商户传入业务信息 (可选)
|
||||
MinAge string `json:"min_age,omitempty"` // 允许的最小买家年龄 (可选)
|
||||
PromoParams string `json:"promo_params,omitempty"` // 优惠明细 (可选)
|
||||
}
|
||||
|
||||
// TransMicropayRequestData 聚合被扫请求数据结构体
|
||||
type TransMicropayRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号 (必填)
|
||||
TermNo string `json:"term_no"` // 终端号 (必填)
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号 (必填)
|
||||
AuthCode string `json:"auth_code"` // 支付授权码 (必填)
|
||||
TotalAmount string `json:"total_amount"` // 金额 (必填)
|
||||
LocationInfo *LocationInfo `json:"location_info"` // 地址位置信息 (必填)
|
||||
BusiMode string `json:"busi_mode,omitempty"` // 业务模式 (可选)
|
||||
Subject string `json:"subject,omitempty"` // 订单标题 (可选,微信支付必送)
|
||||
PayOrderNo string `json:"pay_order_no,omitempty"` // 支付业务订单号 (可选)
|
||||
NotifyURL string `json:"notify_url,omitempty"` // 商户通知地址 (可选)
|
||||
SettleType string `json:"settle_type,omitempty"` // 结算类型 (可选)
|
||||
Remark string `json:"remark,omitempty"` // 备注 (可选)
|
||||
ScanType string `json:"scan_type,omitempty"` // 扫码类型 (可选)
|
||||
AccBusiFields *AccBusiFields `json:"acc_busi_fields,omitempty"` // 账户端业务信息域 (可选)
|
||||
}
|
||||
|
||||
// TransMicropayRequest 聚合被扫请求结构体
|
||||
type TransMicropayRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *TransMicropayRequestData `json:"req_data"`
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package transmicropay
|
||||
|
||||
// TransMicropayResponseData 聚合被扫响应数据结构体
|
||||
type TransMicropayResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
TermNo string `json:"term_no"` // 终端号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号
|
||||
TradeNo string `json:"trade_no"` // 拉卡拉交易流水号
|
||||
LogNo string `json:"log_no"` // 拉卡拉对账单流水号
|
||||
TotalAmount string `json:"total_amount"` // 交易总金额
|
||||
TradeTime string `json:"trade_time"` // 交易时间
|
||||
PayStatus string `json:"pay_status"` // 支付状态
|
||||
OrderDesc string `json:"order_desc,omitempty"` // 订单描述
|
||||
PayAmount string `json:"pay_amount,omitempty"` // 实际支付金额
|
||||
PayChannel string `json:"pay_channel,omitempty"` // 支付渠道
|
||||
ChannelTradeNo string `json:"channel_trade_no,omitempty"` // 渠道交易号
|
||||
AuthCode string `json:"auth_code,omitempty"` // 支付授权码
|
||||
}
|
||||
|
||||
// TransMicropayResponse 聚合被扫响应结构体
|
||||
type TransMicropayResponse struct {
|
||||
RespTime string `json:"resp_time"`
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RespData *TransMicropayResponseData `json:"resp_data,omitempty"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *TransMicropayResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package transMicropayEncry
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// TransMicropayEncryServer 聚合扫码被扫接口(全报文加密)服务结构体
|
||||
type TransMicropayEncryServer[T any] struct {
|
||||
Client *common.Client[T]
|
||||
}
|
||||
|
||||
// NewTransMicropayEncryServer 创建聚合扫码被扫接口(全报文加密)服务实例
|
||||
func NewTransMicropayEncryServer(client *common.Client[TransMicropayEncryResponse]) *TransMicropayEncryServer[TransMicropayEncryResponse] {
|
||||
return &TransMicropayEncryServer[TransMicropayEncryResponse]{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransMicropayEncry 聚合扫码被扫接口(全报文加密)接口
|
||||
func (a *TransMicropayEncryServer[TransMicropayEncryResponse]) TransMicropayEncry(reqData *TransMicropayEncryRequestData) (*TransMicropayEncryResponse, error) {
|
||||
// 构建请求体
|
||||
request := &TransMicropayEncryRequest{
|
||||
ReqTime: gtime.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 调用Client发送请求
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_MICROPAY_ENCRY_URL, request)
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package transMicropayEncry
|
||||
|
||||
// LocationInfo 地址位置信息,风控要求必送
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址,必填
|
||||
BaseStation string `json:"base_station"` // 客户端设备的基站信息
|
||||
Location string `json:"location"` // 商户终端的地理位置,整体格式:纬度,经度
|
||||
}
|
||||
|
||||
// AccBusiFields 账户端业务信息域
|
||||
type AccBusiFields struct {
|
||||
ExtendParams map[string]interface{} `json:"extend_params"` // 支付宝业务扩展参数,主要用于花呗分期
|
||||
BusinessParams string `json:"business_params"` // 商户传入业务信息
|
||||
GoodsDetail string `json:"goods_detail"` // 订单包含的商品列表信息,Json数组
|
||||
StoreID string `json:"store_id"` // 商户门店编号
|
||||
TimeoutExpress string `json:"timeout_express"` // 交易有效时间,以分钟为单位
|
||||
DisablePayChannels string `json:"disable_pay_channels"` // 支付宝禁用支付渠道
|
||||
MinAge string `json:"min_age"` // 允许的最小买家年龄
|
||||
PriorityPayAssets map[string]interface{} `json:"priority_pay_assets"` // 优先使用资产
|
||||
}
|
||||
|
||||
// TransMicropayEncryRequestData 聚合扫码被扫接口(全报文加密)请求数据
|
||||
type TransMicropayEncryRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必填
|
||||
TermNo string `json:"term_no"` // 终端号,必填
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,必填
|
||||
AuthCode string `json:"auth_code"` // 支付授权码,必填
|
||||
TotalAmount string `json:"total_amount"` // 金额,必填,单位分,整数型字符
|
||||
LocationInfo LocationInfo `json:"location_info"` // 地址位置信息,必填
|
||||
BusiMode string `json:"busi_mode"` // 业务模式,可选:ACQ-收单,不填默认为"ACQ-收单"
|
||||
Subject string `json:"subject"` // 订单标题,可选,微信支付必送
|
||||
PayOrderNo string `json:"pay_order_no"` // 拉卡拉支付业务订单号,可选
|
||||
NotifyURL string `json:"notify_url"` // 商户通知地址,可选
|
||||
SettleType string `json:"settle_type"` // 结算类型,可选:"0"或者空,常规结算方式
|
||||
Remark string `json:"remark"` // 备注,可选
|
||||
ScanType string `json:"scan_type"` // 扫码类型,可选:0或不填:扫码支付,1:支付宝刷脸支付,2: 微信刷脸支付
|
||||
IdentityInfo string `json:"identity_info"` // 实名支付信息,可选,json字符串
|
||||
AccBusiFields AccBusiFields `json:"acc_busi_fields"` // 账户端业务信息域,可选
|
||||
}
|
||||
|
||||
// TransMicropayEncryRequest 聚合扫码被扫接口(全报文加密)请求结构
|
||||
type TransMicropayEncryRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
Version string `json:"version"` // 版本号
|
||||
ReqData *TransMicropayEncryRequestData `json:"req_data"` // 请求数据
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package transMicropayEncry
|
||||
|
||||
// TransMicropayEncryResponseData 聚合扫码被扫接口(全报文加密)响应数据
|
||||
type TransMicropayEncryResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
TermNo string `json:"term_no"` // 终端号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号
|
||||
TotalAmount string `json:"total_amount"` // 金额,单位分
|
||||
PayOrderNo string `json:"pay_order_no"` // 拉卡拉订单系统订单号
|
||||
TradeType string `json:"trade_type"` // 交易类型
|
||||
Status string `json:"status"` // 交易状态
|
||||
PayTime string `json:"pay_time"` // 支付完成时间
|
||||
}
|
||||
|
||||
// TransMicropayEncryResponse 聚合扫码被扫接口(全报文加密)响应结构
|
||||
type TransMicropayEncryResponse struct {
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
Version string `json:"version"` // 版本号
|
||||
Code string `json:"code"` // 响应码
|
||||
Msg string `json:"msg"` // 响应信息
|
||||
RespData *TransMicropayEncryResponseData `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *TransMicropayEncryResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package transPreorder
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// API 聚合主扫API结构体
|
||||
type TransPreorderServer struct {
|
||||
client *common.Client[TransPreorderResponse]
|
||||
}
|
||||
|
||||
// NewAPI 创建聚合主扫API实例
|
||||
func NewTransPreorderServer(client *common.Client[TransPreorderResponse]) *TransPreorderServer {
|
||||
return &TransPreorderServer{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransPreorder 执行聚合主扫交易
|
||||
func (a *TransPreorderServer) TransPreorder(req *TransPreorderRequestData) (*TransPreorderResponse, error) {
|
||||
// 构建BaseModel请求
|
||||
baseReq := TransPreorderRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
// 发送请求
|
||||
return a.client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_PREORDER_URL, baseReq)
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package transPreorder
|
||||
|
||||
// LocationInfo 地址位置信息结构体
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址 (必填)
|
||||
BaseStation string `json:"base_station,omitempty"` // 基站信息 (可选)
|
||||
Location string `json:"location,omitempty"` // 纬度,经度 (可选,银联二维码交易必填)
|
||||
}
|
||||
|
||||
// GoodsInfo 商品信息结构体
|
||||
type GoodsInfo struct {
|
||||
GoodsId string `json:"goods_id,omitempty"` // 商品ID (可选)
|
||||
GoodsName string `json:"goods_name,omitempty"` // 商品名称 (可选)
|
||||
Price string `json:"price,omitempty"` // 商品单价 (可选)
|
||||
Quantity string `json:"quantity,omitempty"` // 商品数量 (可选)
|
||||
CategoryId string `json:"category_id,omitempty"` // 商品类目ID (可选)
|
||||
Body string `json:"body,omitempty"` // 商品描述 (可选)
|
||||
}
|
||||
|
||||
// AccBusiFields 账户端业务信息域结构体
|
||||
type AccBusiFields struct {
|
||||
UserId string `json:"user_id,omitempty"` // 买家在支付宝的用户id (支付宝JSAPI支付必填)
|
||||
TimeoutExpress string `json:"timeout_express,omitempty"` // 预下单有效时间 (可选)
|
||||
ExtendParams string `json:"extend_params,omitempty"` // 业务扩展参数 (可选)
|
||||
GoodsDetail string `json:"goods_detail,omitempty"` // 商品详情 (可选)
|
||||
StoreId string `json:"store_id,omitempty"` // 商户门店编号 (可选)
|
||||
BusinessParams string `json:"business_params,omitempty"` // 商户传入业务信息 (可选)
|
||||
MinAge string `json:"min_age,omitempty"` // 允许的最小买家年龄 (可选)
|
||||
PromoParams string `json:"promo_params,omitempty"` // 优惠明细 (可选)
|
||||
EnablePayChannels string `json:"enable_pay_channels,omitempty"` // 支付通道 (可选)
|
||||
}
|
||||
|
||||
// TransPreorderRequestData 预订单请求数据结构体
|
||||
type TransPreorderRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号 (必填)
|
||||
TermNo string `json:"term_no"` // 终端号 (必填)
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号 (必填)
|
||||
AccountType string `json:"account_type"` // 钱包类型 (必填)
|
||||
TransType string `json:"trans_type"` // 接入方式 (必填)
|
||||
TotalAmount string `json:"total_amount"` // 金额 (必填)
|
||||
LocationInfo *LocationInfo `json:"location_info"` // 地址位置信息 (必填)
|
||||
BusiMode string `json:"busi_mode,omitempty"` // 业务模式 (可选)
|
||||
Subject string `json:"subject,omitempty"` // 订单标题 (可选,微信支付必送)
|
||||
PayOrderNo string `json:"pay_order_no,omitempty"` // 支付业务订单号 (可选)
|
||||
NotifyURL string `json:"notify_url,omitempty"` // 商户通知地址 (可选)
|
||||
SettleType string `json:"settle_type,omitempty"` // 结算类型 (可选)
|
||||
Remark string `json:"remark,omitempty"` // 备注 (可选)
|
||||
AccBusiFields *AccBusiFields `json:"acc_busi_fields,omitempty"` // 账户端业务信息域 (可选)
|
||||
CompleteNotifyURL string `json:"complete_notify_url,omitempty"` // 发货确认通知地址 (可选)
|
||||
GoodsTag string `json:"goods_tag,omitempty"` // 商品标签 (可选)
|
||||
GoodsInfo []*GoodsInfo `json:"goods_info,omitempty"` // 商品信息 (可选)
|
||||
}
|
||||
|
||||
// TransPreorderRequest 预订单请求结构体
|
||||
type TransPreorderRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *TransPreorderRequestData `json:"req_data"`
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package transPreorder
|
||||
|
||||
// ResponseData 聚合主扫响应数据结构体
|
||||
type ResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
TermNo string `json:"term_no"` // 终端号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号
|
||||
TradeNo string `json:"trade_no"` // 拉卡拉交易流水号
|
||||
LogNo string `json:"log_no"` // 拉卡拉对账单流水号
|
||||
TotalAmount string `json:"total_amount"` // 交易总金额
|
||||
TradeTime string `json:"trade_time"` // 交易时间
|
||||
PayStatus string `json:"pay_status"` // 支付状态
|
||||
OrderDesc string `json:"order_desc,omitempty"` // 订单描述
|
||||
PayAmount string `json:"pay_amount,omitempty"` // 实际支付金额
|
||||
PayChannel string `json:"pay_channel,omitempty"` // 支付渠道
|
||||
ChannelTradeNo string `json:"channel_trade_no,omitempty"` // 渠道交易号
|
||||
QrCode string `json:"qr_code,omitempty"` // 支付二维码内容 (NATIVE支付时返回)
|
||||
CodeURL string `json:"code_url,omitempty"` // 二维码链接 (NATIVE支付时返回)
|
||||
PayParams string `json:"pay_params,omitempty"` // 支付参数 (JSAPI/APP支付时返回)
|
||||
AppId string `json:"app_id,omitempty"` // 应用ID
|
||||
MchId string `json:"mch_id,omitempty"` // 商户号
|
||||
PrepayId string `json:"prepay_id,omitempty"` // 预支付交易会话ID
|
||||
}
|
||||
|
||||
// Response 预订单响应结构体
|
||||
type TransPreorderResponse struct {
|
||||
RespTime string `json:"resp_time"`
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RespData *ResponseData `json:"resp_data,omitempty"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *TransPreorderResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package transPreorederEncry
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// TransPreorderEncryServer 聚合扫码主扫交易(全报文加密)服务结构体
|
||||
type TransPreorderEncryServer[T any] struct {
|
||||
Client *common.Client[T]
|
||||
}
|
||||
|
||||
// NewTransPreorderEncryServer 创建聚合扫码主扫交易(全报文加密)服务实例
|
||||
func NewTransPreorderEncryServer(client *common.Client[TransPreorederEncryResponse]) *TransPreorderEncryServer[TransPreorederEncryResponse] {
|
||||
return &TransPreorderEncryServer[TransPreorederEncryResponse]{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransPreorderEncry 聚合扫码主扫交易(全报文加密)接口
|
||||
func (a *TransPreorderEncryServer[TransPreorederEncryResponse]) TransPreorderEncry(reqData *TransPreorederEncryRequestData) (*TransPreorederEncryResponse, error) {
|
||||
// 构建请求体
|
||||
request := &TransPreorederEncryRequest{
|
||||
ReqTime: gtime.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 调用Client发送请求
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_PREORDER_ENCRY_URL, request)
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package transPreorederEncry
|
||||
|
||||
// LocationInfo 地址位置信息,风控要求必送
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址,必填
|
||||
BaseStation string `json:"base_station"` // 客户端设备的基站信息(主扫时基站信息使用该字段)
|
||||
Location string `json:"location"` // 商户终端的地理位置,整体格式:纬度,经度
|
||||
}
|
||||
|
||||
// AccBusiFields 账户端业务信息域
|
||||
type AccBusiFields struct {
|
||||
UserID string `json:"user_id"` // 买家在支付宝的用户id
|
||||
TimeoutExpress string `json:"timeout_express"` // 预下单有效时间,以分钟为单位
|
||||
ExtendParams map[string]interface{} `json:"extend_params"` // 支付宝业务扩展参数
|
||||
GoodsDetail string `json:"goods_detail"` // 订单包含的商品列表信息,Json数组
|
||||
StoreID string `json:"store_id"` // 商户门店编号
|
||||
DisablePayChannels string `json:"disable_pay_channels"` // 支付宝禁用支付渠道
|
||||
BusinessParams string `json:"business_params"` // 商户传入业务信息
|
||||
MinAge string `json:"min_age"` // 允许的最小买家年龄
|
||||
}
|
||||
|
||||
// RequestData 聚合扫码主扫交易(全报文加密)请求数据
|
||||
type TransPreorederEncryRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必填
|
||||
TermNo string `json:"term_no"` // 终端号,必填
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,必填
|
||||
AccountType string `json:"account_type"` // 钱包类型,必填:WECHAT、ALIPAY、UQRCODEPAY等
|
||||
TransType string `json:"trans_type"` // 接入方式,必填:41:NATIVE、51:JSAPI、71:微信小程序支付、61:APP支付
|
||||
TotalAmount string `json:"total_amount"` // 金额,必填,单位分,整数型字符
|
||||
LocationInfo *LocationInfo `json:"location_info"` // 地址位置信息,必填
|
||||
BusiMode string `json:"busi_mode"` // 业务模式,可选:ACQ-收单,不填默认为"ACQ-收单"
|
||||
Subject string `json:"subject"` // 订单标题,可选,微信支付必送
|
||||
PayOrderNo string `json:"pay_order_no"` // 支付业务订单号,可选
|
||||
NotifyURL string `json:"notify_url"` // 商户通知地址,可选
|
||||
SettleType string `json:"settle_type"` // 结算类型,可选:"0"或者空为常规结算,"1"为拉卡拉分账
|
||||
Remark string `json:"remark"` // 备注,可选
|
||||
IdentityInfo string `json:"identity_info"` // 实名支付信息,可选,json字符串
|
||||
AccBusiFields *AccBusiFields `json:"acc_busi_fields"` // 账户端业务信息域,可选
|
||||
}
|
||||
|
||||
// Request 聚合扫码主扫交易(全报文加密)请求结构
|
||||
type TransPreorederEncryRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
Version string `json:"version"` // 版本号
|
||||
ReqData *TransPreorederEncryRequestData `json:"req_data"` // 请求数据
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package transPreorederEncry
|
||||
|
||||
// TransPreorederEncryResponseData 聚合扫码主扫交易(全报文加密)响应数据
|
||||
type TransPreorederEncryResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
TermNo string `json:"term_no"` // 终端号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号
|
||||
TotalAmount string `json:"total_amount"` // 金额,单位分
|
||||
PayOrderNo string `json:"pay_order_no"` // 拉卡拉订单系统订单号
|
||||
CodeUrl string `json:"code_url"` // 二维码内容,用于生成支付二维码
|
||||
TradeType string `json:"trade_type"` // 交易类型
|
||||
}
|
||||
|
||||
// TransPreorederEncryResponse 聚合扫码主扫交易(全报文加密)响应结构
|
||||
type TransPreorederEncryResponse struct {
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
Version string `json:"version"` // 版本号
|
||||
Code string `json:"code"` // 响应码
|
||||
Msg string `json:"msg"` // 响应信息
|
||||
RespData TransPreorederEncryResponseData `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *TransPreorederEncryResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package transquery
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// API 聚合扫码交易查询API结构体
|
||||
type API struct {
|
||||
Client *common.Client[TransQueryResponse]
|
||||
}
|
||||
|
||||
// NewAPI 创建聚合扫码交易查询API实例
|
||||
func NewAPI(client *common.Client[TransQueryResponse]) *API {
|
||||
return &API{
|
||||
Client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransQuery 执行聚合扫码交易查询请求
|
||||
// - merchantNo: 商户号
|
||||
// - termNo: 终端号
|
||||
// - outTradeNo: 商户交易流水号(可选,与tradeNo二选一)
|
||||
// - tradeNo: 拉卡拉交易流水号(可选,与outTradeNo二选一)
|
||||
func (a *API) TransQuery(reqData *TransQueryRequestData) (*TransQueryResponse, error) {
|
||||
// 构建请求结构体
|
||||
request := &TransQueryRequest{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
|
||||
// 发送请求 - 使用consts中定义的聚合扫码交易查询URL
|
||||
return a.Client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_QUERY_URL, request)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package transquery
|
||||
|
||||
// TransQueryRequestData 聚合扫码交易查询请求数据结构体
|
||||
type TransQueryRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号 (必填)
|
||||
TermNo string `json:"term_no"` // 终端号 (必填)
|
||||
OutTradeNo string `json:"out_trade_no,omitempty"` // 商户交易流水号 (可选,与trade_no二选一)
|
||||
TradeNo string `json:"trade_no,omitempty"` // 拉卡拉交易流水号 (可选,与out_trade_no二选一)
|
||||
}
|
||||
|
||||
// TransQueryRequest 聚合扫码交易查询请求结构体
|
||||
type TransQueryRequest struct {
|
||||
ReqTime string `json:"req_time"`
|
||||
Version string `json:"version"`
|
||||
ReqData *TransQueryRequestData `json:"req_data"`
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package transquery
|
||||
|
||||
// SplitInfo 拆单信息结构体
|
||||
type 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"` // 金额
|
||||
}
|
||||
|
||||
// RefundSplitInfo 合单退款拆单信息结构体
|
||||
type RefundSplitInfo struct {
|
||||
OutSubTradeNo string `json:"out_sub_trade_no"` // 外部子退款交易流水号
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
TermNo string `json:"term_no"` // 终端号
|
||||
RefundAmount string `json:"refund_amount"` // 申请退款金额
|
||||
SubTradeNo string `json:"sub_trade_no,omitempty"` // 拉卡拉子交易流水号
|
||||
SubLogNo string `json:"sub_log_no,omitempty"` // 对账单子流水号
|
||||
TradeState string `json:"trade_state,omitempty"` // 子交易状态
|
||||
ResultCode string `json:"result_code,omitempty"` // 处理结果码
|
||||
ResultMsg string `json:"result_msg,omitempty"` // 处理描述
|
||||
}
|
||||
|
||||
// AccRespFields 账户端返回信息域结构体
|
||||
type AccRespFields struct {
|
||||
UserId string `json:"user_id,omitempty"` // 买家在支付宝的用户id
|
||||
StoreId string `json:"store_id,omitempty"` // 商户门店编号
|
||||
AlipayStoreId string `json:"alipay_store_id,omitempty"` // 支付宝店铺编号(不再使用)
|
||||
FundBillList string `json:"fund_bill_list,omitempty"` // 交易支付使用的资金渠道
|
||||
VoucherDetailList string `json:"voucher_detail_list,omitempty"` // 所有优惠券信息
|
||||
HbFqPayInfo string `json:"hb_fq_pay_info,omitempty"` // 花呗分期支付信息
|
||||
}
|
||||
|
||||
// TransQueryResponseData 聚合扫码交易查询响应数据结构体
|
||||
type TransQueryResponseData 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,omitempty"` // 交易大类
|
||||
SplitAttr string `json:"split_attr,omitempty"` // 拆单属性
|
||||
SplitInfo []*SplitInfo `json:"split_info,omitempty"` // 拆单信息
|
||||
AccTradeNo string `json:"acc_trade_no"` // 账户端交易订单号
|
||||
AccountType string `json:"account_type"` // 钱包类型
|
||||
TradeState string `json:"trade_state"` // 交易状态
|
||||
TradeStateDesc string `json:"trade_state_desc,omitempty"` // 交易状态描述
|
||||
TotalAmount string `json:"total_amount"` // 订单金额
|
||||
PayerAmount string `json:"payer_amount,omitempty"` // 付款人实付金额
|
||||
AccSettleAmount string `json:"acc_settle_amount,omitempty"` // 账户端结算金额
|
||||
AccMDiscountAmount string `json:"acc_mdiscount_amount,omitempty"` // 商户侧优惠金额(账户端)
|
||||
AccDiscountAmount string `json:"acc_discount_amount,omitempty"` // 账户端优惠金额
|
||||
AccOtherDiscountAmount string `json:"acc_other_discount_amount,omitempty"` // 账户端其它优惠金额
|
||||
TradeTime string `json:"trade_time"` // 交易完成时间
|
||||
UserId1 string `json:"user_id1,omitempty"` // 用户标识1
|
||||
UserId2 string `json:"user_id2,omitempty"` // 用户标识2
|
||||
BankType string `json:"bank_type,omitempty"` // 付款银行
|
||||
CardType string `json:"card_type,omitempty"` // 银行卡类型
|
||||
AccActivityId string `json:"acc_activity_id,omitempty"` // 活动ID
|
||||
TradeReqDate string `json:"trade_req_date"` // 交易请求日期
|
||||
AccRespFields *AccRespFields `json:"acc_resp_fields,omitempty"` // 账户端返回信息域
|
||||
RefundSplitInfo []*RefundSplitInfo `json:"refund_split_info,omitempty"` // 合单退款拆单信息
|
||||
}
|
||||
|
||||
// TransQueryResponse 聚合扫码交易查询响应结构体
|
||||
type TransQueryResponse struct {
|
||||
RespTime string `json:"resp_time"`
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
RespData *TransQueryResponseData `json:"resp_data,omitempty"`
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断响应是否成功
|
||||
func (r *TransQueryResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package transShareCode
|
||||
|
||||
import (
|
||||
"github.com/black1552/lkl_sdk/consts"
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// TransShareCodeServer 聚合扫码申请支付宝吱口令服务
|
||||
type TransShareCodeServer struct {
|
||||
client *common.Client[TransShareCodeResponse]
|
||||
}
|
||||
|
||||
// NewTransShareCodeServer 创建聚合扫码申请支付宝吱口令服务实例
|
||||
func NewTransShareCodeServer(client *common.Client[TransShareCodeResponse]) *TransShareCodeServer {
|
||||
return &TransShareCodeServer{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// TransShareCode 聚合扫码申请支付宝吱口令
|
||||
func (s *TransShareCodeServer) TransShareCode(reqData *TransShareCodeRequestData) (*TransShareCodeResponse, error) {
|
||||
// 构建请求
|
||||
request := &TransShareCodeRequest{
|
||||
ReqTime: gtime.Now().Format("20060102150405"),
|
||||
Version: "3.0",
|
||||
ReqData: reqData,
|
||||
}
|
||||
return s.client.DoRequest(consts.BASE_URL+consts.LKL_BASE_URL_TRANS_SHARE_CODE_URL, request)
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package transShareCode
|
||||
|
||||
// LocationInfo 地址位置信息
|
||||
type LocationInfo struct {
|
||||
RequestIP string `json:"request_ip"` // 请求方IP地址,必填
|
||||
BaseStation string `json:"base_station"` // 客户端设备的基站信息
|
||||
Location string `json:"location"` // 商户终端的地理位置,整体格式:纬度,经度
|
||||
}
|
||||
|
||||
// ExtInfo 扩展内容,主要满足花呗分期相关的额鉴权验等功能
|
||||
type ExtInfo struct {
|
||||
FqNumber string `json:"fq_number"` // 花呗分期期数,支付宝花呗分期必送字段: 花呗分期数 3:3期 6:6期 12:12期
|
||||
FqSellerPercent string `json:"fq_seller_percent"` // 卖家承担手续费比例,支付宝花呗分期必送字段: 卖家承担收费比例,商家承担手续费传入100,用户承担手续费传入0
|
||||
}
|
||||
|
||||
// AccBusiFields 账户端业务信息域
|
||||
type AccBusiFields struct {
|
||||
Source string `json:"source"` // 业务来源,必填
|
||||
BizLink string `json:"biz_link"` // 跳转业务链接,必填
|
||||
SellerID string `json:"seller_id"` // 卖家支付宝ID,可选
|
||||
ExtInfo *ExtInfo `json:"ext_info"` // 扩展内容,可选
|
||||
}
|
||||
|
||||
// TransShareCodeRequestData 请求数据
|
||||
type TransShareCodeRequestData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号,必填
|
||||
TermNo string `json:"term_no"` // 终端号,必填
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户交易流水号,必填
|
||||
AccountType string `json:"account_type"` // 钱包类型,必填,支付宝:ALIPAY
|
||||
TotalAmount string `json:"total_amount"` // 金额,必填,单位分,整数型字符
|
||||
LocationInfo LocationInfo `json:"location_info"` // 地址位置信息,必填
|
||||
CodeValidPeriod string `json:"code_valid_period"` // 码有效期,可选,秒为单位,整型
|
||||
AccBusiFields *AccBusiFields `json:"acc_busi_fields"` // 账户端业务信息域,可选
|
||||
}
|
||||
|
||||
// TransShareCodeRequest 整体请求结构
|
||||
type TransShareCodeRequest struct {
|
||||
ReqTime string `json:"req_time"` // 请求时间
|
||||
Version string `json:"version"` // 版本号
|
||||
ReqData *TransShareCodeRequestData `json:"req_data"` // 请求数据
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package transShareCode
|
||||
|
||||
// AccRespFields 账户端返回信息域
|
||||
type AccRespFields struct {
|
||||
ShareToken string `json:"share_token"` // 吱口令,必填
|
||||
ExpireDate string `json:"expire_date"` // 吱口令失效时间,可选,若为空则表示永久有效
|
||||
}
|
||||
|
||||
// TransShareCodeResponseData 响应数据
|
||||
type TransShareCodeResponseData struct {
|
||||
MerchantNo string `json:"merchant_no"` // 商户号
|
||||
OutTradeNo string `json:"out_trade_no"` // 商户请求流水号
|
||||
TradeNo string `json:"trade_no"` // 拉卡拉交易流水号
|
||||
AccRespFields *AccRespFields `json:"acc_resp_fields"` // 账户端返回信息域
|
||||
}
|
||||
|
||||
// TransShareCodeResponse 整体响应结构
|
||||
type TransShareCodeResponse struct {
|
||||
Code string `json:"code"` // 响应码
|
||||
Msg string `json:"msg"` // 响应信息
|
||||
RespTime string `json:"resp_time"` // 响应时间
|
||||
RespData *TransShareCodeResponseData `json:"resp_data"` // 响应数据
|
||||
}
|
||||
|
||||
// SuccessOrFail 判断请求是否成功
|
||||
func (r *TransShareCodeResponse) SuccessOrFail() bool {
|
||||
return r.Code == "BBS00000"
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto"
|
||||
"crypto/rand"
|
||||
"crypto/rsa"
|
||||
"crypto/sha256"
|
||||
"crypto/x509"
|
||||
"encoding/base64"
|
||||
"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"
|
||||
)
|
||||
|
||||
// Client 拉卡拉SDK客户端
|
||||
type Client[T any] struct {
|
||||
Config *Config
|
||||
response T
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewClient 创建拉卡拉SDK客户端
|
||||
func NewClient[T any](ctx context.Context, cfgJson string) *Client[T] {
|
||||
var config *Config
|
||||
err := gconv.Struct(cfgJson, &config)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &Client[T]{
|
||||
Config: config,
|
||||
ctx: ctx,
|
||||
}
|
||||
}
|
||||
func (c *Client[T]) generateNonceStr() string {
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
nonce := make([]byte, 12)
|
||||
for i := range nonce {
|
||||
nonce[i] = letterBytes[ran.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(nonce)
|
||||
}
|
||||
|
||||
// generateSign 生成签名
|
||||
func (c *Client[T]) generateSign(request []byte) (string, error) {
|
||||
// 生成随机字符串
|
||||
nonceStr := c.generateNonceStr()
|
||||
// 获取当前时间戳(秒)
|
||||
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))
|
||||
|
||||
// 计算签名
|
||||
hashed := sha256.Sum256([]byte(signData))
|
||||
|
||||
privateKey, err := c.loadPrivateKey()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
signature, err := rsa.SignPKCS1v15(rand.Reader, privateKey, crypto.SHA256, hashed[:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
signatureBase64 := base64.StdEncoding.EncodeToString(signature)
|
||||
|
||||
// 构建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)
|
||||
return authorization, nil
|
||||
}
|
||||
|
||||
func (c *Client[T]) loadPrivateKey() (*rsa.PrivateKey, error) {
|
||||
block, _ := pem.Decode(gfile.GetBytes(c.Config.PrivateKey))
|
||||
if block == nil {
|
||||
return nil, fmt.Errorf("无法解码私钥PEM数据")
|
||||
}
|
||||
// 解析PKCS#8格式私钥
|
||||
privateKey, err := x509.ParsePKCS8PrivateKey(block.Bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return privateKey.(*rsa.PrivateKey), nil
|
||||
}
|
||||
|
||||
// DoRequest 发送HTTP请求
|
||||
func (c *Client[T]) DoRequest(url string, reqData interface{}) (*T, error) {
|
||||
jsonStr, err := gjson.EncodeString(reqData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("请求参数转JSON字符串失败: %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)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("生成签名失败: %v", err)
|
||||
}
|
||||
header := map[string]string{
|
||||
"Authorization": auth,
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
}
|
||||
// 设置其他必要的请求头
|
||||
|
||||
return utils.NewClient[T](reqJson, url, header).Post(c.ctx)
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// CleanJSON 清理JSON字符串中的空值和0值字段
|
||||
func CleanJSON(jsonStr string) ([]byte, error) {
|
||||
var data interface{}
|
||||
|
||||
// 解析JSON字符串
|
||||
if err := json.Unmarshal([]byte(jsonStr), &data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 递归清理数据
|
||||
cleaned := cleanData(data)
|
||||
|
||||
// 转换回JSON字符串
|
||||
result, err := json.Marshal(cleaned)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// 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:"回调地址"`
|
||||
}
|
||||
@@ -1,26 +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 struct {
|
||||
client *common.Client[ResponseMergeRefund]
|
||||
}
|
||||
|
||||
func NewMergeRefund(client *common.Client[ResponseMergeRefund]) *MergeRefund {
|
||||
return &MergeRefund{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
func (t *MergeRefund) MergeRefund(req *RequestDataMergeRefund) (*ResponseMergeRefund, error) {
|
||||
// 构建BaseModel请求
|
||||
baseReq := RequestMergeRefund{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
return t.client.DoRequest(consts.BASE_URL+consts.LKL_UNIFIED_RETURN_MERGE_REFUND_URL, baseReq)
|
||||
}
|
||||
@@ -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 struct {
|
||||
client *common.Client[ResponseRefund]
|
||||
}
|
||||
|
||||
// NewRefund 创建统一退货API实例
|
||||
func NewRefund(client *common.Client[ResponseRefund]) *Refund {
|
||||
return &Refund{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// Refund 发起统一退货请求
|
||||
// request: 统一退货请求参数
|
||||
// 返回统一退货响应结果和错误信息
|
||||
func (api *Refund) Refund(req *RequestDataRefund) (*ResponseRefund, 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,30 +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 struct {
|
||||
client *common.Client[ResponseRefundQuery]
|
||||
}
|
||||
|
||||
// NewRefundQuery 创建统一退货查询API实例
|
||||
func NewRefundQuery(client *common.Client[ResponseRefundQuery]) *RefundQuery {
|
||||
return &RefundQuery{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
// RefundQuery 发起统一退货查询请求
|
||||
func (api *RefundQuery) RefundQuery(req *RequestDataRefundQuery) (*ResponseRefundQuery, error) {
|
||||
// 构建BaseModel请求
|
||||
baseReq := RequestRefundQuery{
|
||||
ReqTime: gtime.Now().Format("YmdHis"),
|
||||
Version: "3.0",
|
||||
ReqData: req,
|
||||
}
|
||||
|
||||
return api.client.DoRequest(consts.BASE_URL+consts.LKL_UNIFIED_RETURN_REFUND_QUERY_URL, baseReq)
|
||||
}
|
||||
@@ -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,40 +0,0 @@
|
||||
package unifiedreturn
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/black1552/lkl_sdk/lklsdk/common"
|
||||
mergeRefund "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 struct {
|
||||
MergeRefound *mergeRefund.MergeRefund
|
||||
Refound *refund.Refund
|
||||
RefoundQuery *refundquery.RefundQuery
|
||||
}
|
||||
|
||||
// NewServer 创建拉卡拉统一退货服务实例
|
||||
func NewServer(ctx context.Context, cfgJson string) *Server {
|
||||
return &Server{
|
||||
MergeRefound: mergeRefund.NewMergeRefund(common.NewClient[mergeRefund.ResponseMergeRefund](ctx, cfgJson)),
|
||||
Refound: refund.NewRefund(common.NewClient[refund.ResponseRefund](ctx, cfgJson)),
|
||||
RefoundQuery: refundquery.NewRefundQuery(common.NewClient[refundquery.ResponseRefundQuery](ctx, cfgJson)),
|
||||
}
|
||||
}
|
||||
|
||||
// MergeRefund 合单退货
|
||||
func (u *Server) MergeRefund(req *mergeRefund.RequestDataMergeRefund) (*mergeRefund.ResponseMergeRefund, error) {
|
||||
return u.MergeRefound.MergeRefund(req)
|
||||
}
|
||||
|
||||
// Refund 退货
|
||||
func (u *Server) Refund(req *refund.RequestDataRefund) (*refund.ResponseRefund, error) {
|
||||
return u.Refound.Refund(req)
|
||||
}
|
||||
|
||||
// RefundQuery 退货查询
|
||||
func (u *Server) RefundQuery(req *refundquery.RequestDataRefundQuery) (*refundquery.ResponseRefundQuery, error) {
|
||||
return u.RefoundQuery.RefundQuery(req)
|
||||
}
|
||||
Reference in New Issue
Block a user