重构账户与商户服务模块
- 移除旧版 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"
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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"`
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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"` // 请求数据
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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"`
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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"` // 请求数据
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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"`
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
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"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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"` // 请求数据
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user