Commit 84c14c43 authored by wangp's avatar wangp

lakala 聚合扫码-交易查询

parent 6fd3ca09
...@@ -115,3 +115,4 @@ lakala: ...@@ -115,3 +115,4 @@ lakala:
url_micropay: 'https://test.wsmsd.cn/sit/api/v3/labs/trans/micropay' #聚合被扫(扫码枪) url_micropay: 'https://test.wsmsd.cn/sit/api/v3/labs/trans/micropay' #聚合被扫(扫码枪)
url_refund: 'https://test.wsmsd.cn/sit/api/v3/labs/relation/refund' #聚合扫码-退款交易 url_refund: 'https://test.wsmsd.cn/sit/api/v3/labs/relation/refund' #聚合扫码-退款交易
url_trade_refund: 'https://test.wsmsd.cn/sit/api/v3/lams/trade/trade_refund' #统一退货接口 url_trade_refund: 'https://test.wsmsd.cn/sit/api/v3/lams/trade/trade_refund' #统一退货接口
url_order_state: 'https://test.wsmsd.cn/sit/api/v3/labs/query/tradequery' #聚合扫码-交易查询
...@@ -115,3 +115,4 @@ lakala: ...@@ -115,3 +115,4 @@ lakala:
url_micropay: 'https://s2.lakala.com/api/v3/labs/trans/micropay' #聚合被扫(扫码枪) url_micropay: 'https://s2.lakala.com/api/v3/labs/trans/micropay' #聚合被扫(扫码枪)
url_refund: 'https://s2.lakala.com/api/v3/labs/relation/refund' #聚合扫码-退款交易 url_refund: 'https://s2.lakala.com/api/v3/labs/relation/refund' #聚合扫码-退款交易
url_trade_refund: 'https://s2.lakala.com/api/v3/lams/trade/trade_refund' #统一退货接口 url_trade_refund: 'https://s2.lakala.com/api/v3/lams/trade/trade_refund' #统一退货接口
url_order_state: 'https://s2.lakala.com/api/v3/labs/query/tradequery' #聚合扫码-交易查询
...@@ -81,5 +81,42 @@ func (l *PayController) UnifiedRefund(c *gin.Context) { ...@@ -81,5 +81,42 @@ func (l *PayController) UnifiedRefund(c *gin.Context) {
return return
} }
base.ResponseSuccess(c, rtn)
}
// OrderState 拉卡拉支付查询
// @Summary 拉卡拉支付查询
// @Description 拉卡拉支付查询
// @Tags 拉卡拉支付查询
// @Accept application/json
// @Produce application/json
// @Param body body models.OrderStateInput true "参数"
// @Param language header string ture "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文"
// @Success 200
// @router /api/v1/pay/order_state [post]
func (l *PayController) OrderState(c *gin.Context) {
ph := new(models.OrderStateInput)
//fmt.Println("ContentType="+c.ContentType())
err := c.ShouldBindJSON(ph)
if err != nil {
zap.L().Error(err.Error()) //logs错误日志
base.ResponseErrorWithMsg(c, base.ServerError)
return
}
//// clientIp ip
//ip := c.ClientIP()
////fmt.Println("ip="+ip)
// 拉卡拉支付查询
rtn, err := pay.OrderState(ph)
if err != nil {
zap.L().Error(err.Error())
//base.ResponseErrorWithMsg(c, base.ServerError)
base.ResponseErrorMsg(c, err.Error())
return
}
base.ResponseSuccess(c, rtn) base.ResponseSuccess(c, rtn)
} }
\ No newline at end of file
...@@ -23,9 +23,9 @@ var doc = `{ ...@@ -23,9 +23,9 @@ var doc = `{
"host": "{{.Host}}", "host": "{{.Host}}",
"basePath": "{{.BasePath}}", "basePath": "{{.BasePath}}",
"paths": { "paths": {
"/api/v1/pay/unified_order": { "/api/v1/pay/cashier_notice": {
"post": { "post": {
"description": "拉卡拉统一支付", "description": "拉卡拉统一支付回调(收银台)",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -33,9 +33,9 @@ var doc = `{ ...@@ -33,9 +33,9 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"拉卡拉统一支付" "拉卡拉统一支付回调"
], ],
"summary": "拉卡拉统一支付", "summary": "拉卡拉统一支付回调(收银台)",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -43,7 +43,7 @@ var doc = `{ ...@@ -43,7 +43,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.PlaceAnOrderParamInput" "$ref": "#/definitions/models.CashierNoticeInput"
} }
}, },
{ {
...@@ -60,9 +60,9 @@ var doc = `{ ...@@ -60,9 +60,9 @@ var doc = `{
} }
} }
}, },
"/api/v1/pay/unified_refund": { "/api/v1/pay/order_state": {
"post": { "post": {
"description": "拉卡拉退款", "description": "拉卡拉支付查询",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -70,9 +70,9 @@ var doc = `{ ...@@ -70,9 +70,9 @@ var doc = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"拉卡拉退款" "拉卡拉支付查询"
], ],
"summary": "拉卡拉退款", "summary": "拉卡拉支付查询",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -80,7 +80,7 @@ var doc = `{ ...@@ -80,7 +80,7 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.RefundParamInput" "$ref": "#/definitions/models.OrderStateInput"
} }
}, },
{ {
...@@ -97,9 +97,9 @@ var doc = `{ ...@@ -97,9 +97,9 @@ var doc = `{
} }
} }
}, },
"/api/v1/pay/wx_notice": { "/api/v1/pay/scan_notice": {
"post": { "post": {
"description": "拉卡拉统一支付微信回调", "description": "拉卡拉统一支付回调(聚合扫码)",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -109,7 +109,44 @@ var doc = `{ ...@@ -109,7 +109,44 @@ var doc = `{
"tags": [ "tags": [
"拉卡拉统一支付回调" "拉卡拉统一支付回调"
], ],
"summary": "拉卡拉统一支付微信回调", "summary": "拉卡拉统一支付回调(聚合扫码)",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ScanNoticeInput"
}
},
{
"type": "string",
"description": "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文",
"name": "language",
"in": "header"
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/api/v1/pay/unified_order": {
"post": {
"description": "拉卡拉统一支付",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"拉卡拉统一支付"
],
"summary": "拉卡拉统一支付",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -117,7 +154,44 @@ var doc = `{ ...@@ -117,7 +154,44 @@ var doc = `{
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.WxNoticeInput" "$ref": "#/definitions/models.PlaceAnOrderParamInput"
}
},
{
"type": "string",
"description": "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文",
"name": "language",
"in": "header"
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/api/v1/pay/unified_refund": {
"post": {
"description": "拉卡拉退款",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"拉卡拉退款"
],
"summary": "拉卡拉退款",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.RefundParamInput"
} }
}, },
{ {
...@@ -136,70 +210,163 @@ var doc = `{ ...@@ -136,70 +210,163 @@ var doc = `{
} }
}, },
"definitions": { "definitions": {
"models.CashierNoticeInput": {
"type": "object",
"properties": {
"channel_id": {
"description": "渠道号",
"type": "string"
},
"merchant_no": {
"description": "结算商户号",
"type": "string"
},
"order_create_time": {
"description": "订单创建时间",
"type": "string"
},
"order_efficient_time": {
"description": "订单有效时间",
"type": "string"
},
"order_info": {
"description": "订单描述",
"type": "string"
},
"order_status": {
"description": "订单状态",
"type": "string"
},
"order_trade_info": {
"type": "object"
},
"out_order_no": {
"description": "商户订单号",
"type": "string"
},
"pay_order_no": {
"description": "支付订单号",
"type": "string"
},
"split_info": {
"type": "object"
},
"term_no": {
"description": "结算终端号",
"type": "string"
},
"total_amount": {
"description": "订单金额,单位:分",
"type": "integer"
},
"trans_merchant_no": {
"description": "交易商户号",
"type": "string"
},
"trans_term_no": {
"description": "交易终端号",
"type": "string"
}
}
},
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": { "models.PlaceAnOrderParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"app_id": { "app_id": {
"description": "wxAppId source code 2 小程序支付时必传、同时小程序支付必须关联了商户号支付",
"type": "string" "type": "string"
}, },
"attach_info": { "attach_info": {
"description": "附加信息",
"type": "string"
},
"auth_codes": {
"description": "LAKALA签约协议号列表",
"type": "string" "type": "string"
}, },
"customer": { "customer": {
"description": "顾客信息",
"type": "string" "type": "string"
}, },
"dynamic_id": { "dynamic_id": {
"description": "顾客手机条码的内容",
"type": "string" "type": "string"
}, },
"goods_des": { "goods_des": {
"description": "商品描述",
"type": "string" "type": "string"
}, },
"goods_detail": { "goods_detail": {
"description": "商品详情",
"type": "string" "type": "string"
}, },
"goods_price": { "goods_price": {
"description": "商品金额,个位为分",
"type": "number" "type": "number"
}, },
"is_serve": { "is_serve": {
"description": "0直连模式 1服务商模式",
"type": "integer" "type": "integer"
}, },
"notice_url": { "notice_url": {
"description": "客户端回调的url",
"type": "string" "type": "string"
}, },
"open_id": { "open_id": {
"description": "此参数 支付类型是 JS API 的时候 必传",
"type": "string" "type": "string"
}, },
"operator": { "operator": {
"description": "操作员",
"type": "string" "type": "string"
}, },
"pay_type": { "pay_type": {
"description": "支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧",
"type": "integer" "type": "integer"
}, },
"platform_info": { "platform_info": {
"description": "平台信息",
"type": "string" "type": "string"
}, },
"platform_type": { "platform_type": {
"description": "平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile",
"type": "integer" "type": "integer"
}, },
"quit_url": { "quit_url": {
"description": "返回按钮 可用于用户付款中途退出并返回到该参数指定的商户网站地址, 支付方式为 支付宝手机网站时 必传(尽量传)",
"type": "string" "type": "string"
}, },
"return_url": { "return_url": {
"description": "用户在完成支付后,会根据商户在请求支付API中传入的前台回跳地址return_url自动跳转return_url地址页面(必传)",
"type": "string" "type": "string"
}, },
"source_code": { "source_code": {
"description": "支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营 17:微信JASPI-必康自营",
"type": "integer" "type": "integer"
}, },
"store_sn": { "store_sn": {
"description": "商户门店编号",
"type": "string" "type": "string"
}, },
"sub_mchid": { "sub_mchid": {
"description": "通过进件接口申请的支付商户号、这是由微信生成并下发的",
"type": "string" "type": "string"
}, },
"wap_name": { "wap_name": {
"description": "WAP网站名称, 支付方式为微信MWEB时 必传",
"type": "string" "type": "string"
}, },
"wap_url": { "wap_url": {
"description": "WAP网站URL地址, 支付方式为微信MWEB时 必传",
"type": "string" "type": "string"
} }
} }
...@@ -207,57 +374,113 @@ var doc = `{ ...@@ -207,57 +374,113 @@ var doc = `{
"models.RefundParamInput": { "models.RefundParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"goods_price": { "refund_amount": {
"description": "退款金额,个位为分",
"type": "number" "type": "number"
}, },
"order_id": { "refund_no": {
"description": "退款号:原对账单流水号",
"type": "string"
},
"refund_reason": {
"description": "退款原因",
"type": "string" "type": "string"
} }
} }
}, },
"models.WxNoticeInput": { "models.ScanNoticeInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"channel_id": { "acc_activity_id": {
"description": "活动ID",
"type": "string" "type": "string"
}, },
"merchant_no": { "acc_discount_amount": {
"description": "账户端优惠金额",
"type": "string" "type": "string"
}, },
"order_create_time": { "acc_mdiscount_amount": {
"description": "商户侧优惠金额(账户端)",
"type": "string" "type": "string"
}, },
"order_efficient_time": { "acc_other_discount_amount": {
"description": "账户端其它优惠金额(待上线)",
"type": "string" "type": "string"
}, },
"order_info": { "acc_settle_amount": {
"description": "账户端结算金额",
"type": "string" "type": "string"
}, },
"order_status": { "acc_trade_no": {
"description": "账户端交易订单号",
"type": "string" "type": "string"
}, },
"order_trade_info": { "account_type": {
"type": "object" "description": "钱包类型",
"type": "string"
}, },
"out_order_no": { "bank_type": {
"description": "付款银行",
"type": "string" "type": "string"
}, },
"pay_order_no": { "card_type": {
"description": "银行卡类型",
"type": "string" "type": "string"
}, },
"split_info": { "hb_fq_pay_info": {
"description": "花呗分期支付信息(未上线)",
"type": "object" "type": "object"
}, },
"term_no": { "log_no": {
"description": "拉卡拉对账单流水号",
"type": "string"
},
"merchant_no": {
"description": "商户号",
"type": "string"
},
"out_trade_no": {
"description": "商户交易流水号",
"type": "string"
},
"payer_amount": {
"description": "付款人实付金额",
"type": "string"
},
"remark": {
"description": "备注",
"type": "string"
},
"settle_merchant_no": {
"description": "结算商户号",
"type": "string"
},
"settle_term_no": {
"description": "结算终端号",
"type": "string" "type": "string"
}, },
"total_amount": { "total_amount": {
"type": "integer" "description": "订单金额",
"type": "string"
}, },
"trans_merchant_no": { "trade_no": {
"description": "拉卡拉交易流水号",
"type": "string" "type": "string"
}, },
"trans_term_no": { "trade_status": {
"description": "交易状态",
"type": "string"
},
"trade_time": {
"description": "交易完成时间",
"type": "string"
},
"user_id1": {
"description": "用户标识1",
"type": "string"
},
"user_id2": {
"description": "用户标识2",
"type": "string" "type": "string"
} }
} }
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
"version": "1.0" "version": "1.0"
}, },
"paths": { "paths": {
"/api/v1/pay/unified_order": { "/api/v1/pay/cashier_notice": {
"post": { "post": {
"description": "拉卡拉统一支付", "description": "拉卡拉统一支付回调(收银台)",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"拉卡拉统一支付" "拉卡拉统一支付回调"
], ],
"summary": "拉卡拉统一支付", "summary": "拉卡拉统一支付回调(收银台)",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.PlaceAnOrderParamInput" "$ref": "#/definitions/models.CashierNoticeInput"
} }
}, },
{ {
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
} }
} }
}, },
"/api/v1/pay/unified_refund": { "/api/v1/pay/order_state": {
"post": { "post": {
"description": "拉卡拉退款", "description": "拉卡拉支付查询",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -54,9 +54,9 @@ ...@@ -54,9 +54,9 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"拉卡拉退款" "拉卡拉支付查询"
], ],
"summary": "拉卡拉退款", "summary": "拉卡拉支付查询",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.RefundParamInput" "$ref": "#/definitions/models.OrderStateInput"
} }
}, },
{ {
...@@ -81,9 +81,9 @@ ...@@ -81,9 +81,9 @@
} }
} }
}, },
"/api/v1/pay/wx_notice": { "/api/v1/pay/scan_notice": {
"post": { "post": {
"description": "拉卡拉统一支付微信回调", "description": "拉卡拉统一支付回调(聚合扫码)",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -93,7 +93,44 @@ ...@@ -93,7 +93,44 @@
"tags": [ "tags": [
"拉卡拉统一支付回调" "拉卡拉统一支付回调"
], ],
"summary": "拉卡拉统一支付微信回调", "summary": "拉卡拉统一支付回调(聚合扫码)",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ScanNoticeInput"
}
},
{
"type": "string",
"description": "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文",
"name": "language",
"in": "header"
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/api/v1/pay/unified_order": {
"post": {
"description": "拉卡拉统一支付",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"拉卡拉统一支付"
],
"summary": "拉卡拉统一支付",
"parameters": [ "parameters": [
{ {
"description": "参数", "description": "参数",
...@@ -101,7 +138,44 @@ ...@@ -101,7 +138,44 @@
"in": "body", "in": "body",
"required": true, "required": true,
"schema": { "schema": {
"$ref": "#/definitions/models.WxNoticeInput" "$ref": "#/definitions/models.PlaceAnOrderParamInput"
}
},
{
"type": "string",
"description": "语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文",
"name": "language",
"in": "header"
}
],
"responses": {
"200": {
"description": ""
}
}
}
},
"/api/v1/pay/unified_refund": {
"post": {
"description": "拉卡拉退款",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"拉卡拉退款"
],
"summary": "拉卡拉退款",
"parameters": [
{
"description": "参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.RefundParamInput"
} }
}, },
{ {
...@@ -120,70 +194,163 @@ ...@@ -120,70 +194,163 @@
} }
}, },
"definitions": { "definitions": {
"models.CashierNoticeInput": {
"type": "object",
"properties": {
"channel_id": {
"description": "渠道号",
"type": "string"
},
"merchant_no": {
"description": "结算商户号",
"type": "string"
},
"order_create_time": {
"description": "订单创建时间",
"type": "string"
},
"order_efficient_time": {
"description": "订单有效时间",
"type": "string"
},
"order_info": {
"description": "订单描述",
"type": "string"
},
"order_status": {
"description": "订单状态",
"type": "string"
},
"order_trade_info": {
"type": "object"
},
"out_order_no": {
"description": "商户订单号",
"type": "string"
},
"pay_order_no": {
"description": "支付订单号",
"type": "string"
},
"split_info": {
"type": "object"
},
"term_no": {
"description": "结算终端号",
"type": "string"
},
"total_amount": {
"description": "订单金额,单位:分",
"type": "integer"
},
"trans_merchant_no": {
"description": "交易商户号",
"type": "string"
},
"trans_term_no": {
"description": "交易终端号",
"type": "string"
}
}
},
"models.OrderStateInput": {
"type": "object",
"properties": {
"order_id": {
"description": "订单号",
"type": "string"
}
}
},
"models.PlaceAnOrderParamInput": { "models.PlaceAnOrderParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"app_id": { "app_id": {
"description": "wxAppId source code 2 小程序支付时必传、同时小程序支付必须关联了商户号支付",
"type": "string" "type": "string"
}, },
"attach_info": { "attach_info": {
"description": "附加信息",
"type": "string"
},
"auth_codes": {
"description": "LAKALA签约协议号列表",
"type": "string" "type": "string"
}, },
"customer": { "customer": {
"description": "顾客信息",
"type": "string" "type": "string"
}, },
"dynamic_id": { "dynamic_id": {
"description": "顾客手机条码的内容",
"type": "string" "type": "string"
}, },
"goods_des": { "goods_des": {
"description": "商品描述",
"type": "string" "type": "string"
}, },
"goods_detail": { "goods_detail": {
"description": "商品详情",
"type": "string" "type": "string"
}, },
"goods_price": { "goods_price": {
"description": "商品金额,个位为分",
"type": "number" "type": "number"
}, },
"is_serve": { "is_serve": {
"description": "0直连模式 1服务商模式",
"type": "integer" "type": "integer"
}, },
"notice_url": { "notice_url": {
"description": "客户端回调的url",
"type": "string" "type": "string"
}, },
"open_id": { "open_id": {
"description": "此参数 支付类型是 JS API 的时候 必传",
"type": "string" "type": "string"
}, },
"operator": { "operator": {
"description": "操作员",
"type": "string" "type": "string"
}, },
"pay_type": { "pay_type": {
"description": "支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧",
"type": "integer" "type": "integer"
}, },
"platform_info": { "platform_info": {
"description": "平台信息",
"type": "string" "type": "string"
}, },
"platform_type": { "platform_type": {
"description": "平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile",
"type": "integer" "type": "integer"
}, },
"quit_url": { "quit_url": {
"description": "返回按钮 可用于用户付款中途退出并返回到该参数指定的商户网站地址, 支付方式为 支付宝手机网站时 必传(尽量传)",
"type": "string" "type": "string"
}, },
"return_url": { "return_url": {
"description": "用户在完成支付后,会根据商户在请求支付API中传入的前台回跳地址return_url自动跳转return_url地址页面(必传)",
"type": "string" "type": "string"
}, },
"source_code": { "source_code": {
"description": "支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营 17:微信JASPI-必康自营",
"type": "integer" "type": "integer"
}, },
"store_sn": { "store_sn": {
"description": "商户门店编号",
"type": "string" "type": "string"
}, },
"sub_mchid": { "sub_mchid": {
"description": "通过进件接口申请的支付商户号、这是由微信生成并下发的",
"type": "string" "type": "string"
}, },
"wap_name": { "wap_name": {
"description": "WAP网站名称, 支付方式为微信MWEB时 必传",
"type": "string" "type": "string"
}, },
"wap_url": { "wap_url": {
"description": "WAP网站URL地址, 支付方式为微信MWEB时 必传",
"type": "string" "type": "string"
} }
} }
...@@ -191,57 +358,113 @@ ...@@ -191,57 +358,113 @@
"models.RefundParamInput": { "models.RefundParamInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"goods_price": { "refund_amount": {
"description": "退款金额,个位为分",
"type": "number" "type": "number"
}, },
"order_id": { "refund_no": {
"description": "退款号:原对账单流水号",
"type": "string"
},
"refund_reason": {
"description": "退款原因",
"type": "string" "type": "string"
} }
} }
}, },
"models.WxNoticeInput": { "models.ScanNoticeInput": {
"type": "object", "type": "object",
"properties": { "properties": {
"channel_id": { "acc_activity_id": {
"description": "活动ID",
"type": "string" "type": "string"
}, },
"merchant_no": { "acc_discount_amount": {
"description": "账户端优惠金额",
"type": "string" "type": "string"
}, },
"order_create_time": { "acc_mdiscount_amount": {
"description": "商户侧优惠金额(账户端)",
"type": "string" "type": "string"
}, },
"order_efficient_time": { "acc_other_discount_amount": {
"description": "账户端其它优惠金额(待上线)",
"type": "string" "type": "string"
}, },
"order_info": { "acc_settle_amount": {
"description": "账户端结算金额",
"type": "string" "type": "string"
}, },
"order_status": { "acc_trade_no": {
"description": "账户端交易订单号",
"type": "string" "type": "string"
}, },
"order_trade_info": { "account_type": {
"type": "object" "description": "钱包类型",
"type": "string"
}, },
"out_order_no": { "bank_type": {
"description": "付款银行",
"type": "string" "type": "string"
}, },
"pay_order_no": { "card_type": {
"description": "银行卡类型",
"type": "string" "type": "string"
}, },
"split_info": { "hb_fq_pay_info": {
"description": "花呗分期支付信息(未上线)",
"type": "object" "type": "object"
}, },
"term_no": { "log_no": {
"description": "拉卡拉对账单流水号",
"type": "string"
},
"merchant_no": {
"description": "商户号",
"type": "string"
},
"out_trade_no": {
"description": "商户交易流水号",
"type": "string"
},
"payer_amount": {
"description": "付款人实付金额",
"type": "string"
},
"remark": {
"description": "备注",
"type": "string"
},
"settle_merchant_no": {
"description": "结算商户号",
"type": "string"
},
"settle_term_no": {
"description": "结算终端号",
"type": "string" "type": "string"
}, },
"total_amount": { "total_amount": {
"type": "integer" "description": "订单金额",
"type": "string"
}, },
"trans_merchant_no": { "trade_no": {
"description": "拉卡拉交易流水号",
"type": "string" "type": "string"
}, },
"trans_term_no": { "trade_status": {
"description": "交易状态",
"type": "string"
},
"trade_time": {
"description": "交易完成时间",
"type": "string"
},
"user_id1": {
"description": "用户标识1",
"type": "string"
},
"user_id2": {
"description": "用户标识2",
"type": "string" "type": "string"
} }
} }
......
definitions: definitions:
models.CashierNoticeInput:
properties:
channel_id:
description: 渠道号
type: string
merchant_no:
description: 结算商户号
type: string
order_create_time:
description: 订单创建时间
type: string
order_efficient_time:
description: 订单有效时间
type: string
order_info:
description: 订单描述
type: string
order_status:
description: 订单状态
type: string
order_trade_info:
type: object
out_order_no:
description: 商户订单号
type: string
pay_order_no:
description: 支付订单号
type: string
split_info:
type: object
term_no:
description: 结算终端号
type: string
total_amount:
description: 订单金额,单位:分
type: integer
trans_merchant_no:
description: 交易商户号
type: string
trans_term_no:
description: 交易终端号
type: string
type: object
models.OrderStateInput:
properties:
order_id:
description: 订单号
type: string
type: object
models.PlaceAnOrderParamInput: models.PlaceAnOrderParamInput:
properties: properties:
app_id: app_id:
description: wxAppId source code 2 小程序支付时必传、同时小程序支付必须关联了商户号支付
type: string type: string
attach_info: attach_info:
description: 附加信息
type: string
auth_codes:
description: LAKALA签约协议号列表
type: string type: string
customer: customer:
description: 顾客信息
type: string type: string
dynamic_id: dynamic_id:
description: 顾客手机条码的内容
type: string type: string
goods_des: goods_des:
description: 商品描述
type: string type: string
goods_detail: goods_detail:
description: 商品详情
type: string type: string
goods_price: goods_price:
description: 商品金额,个位为分
type: number type: number
is_serve: is_serve:
description: 0直连模式 1服务商模式
type: integer type: integer
notice_url: notice_url:
description: 客户端回调的url
type: string type: string
open_id: open_id:
description: 此参数 支付类型是 JS API 的时候 必传
type: string type: string
operator: operator:
description: 操作员
type: string type: string
pay_type: pay_type:
description: 支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧
type: integer type: integer
platform_info: platform_info:
description: 平台信息
type: string type: string
platform_type: platform_type:
description: 平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
type: integer type: integer
quit_url: quit_url:
description: 返回按钮 可用于用户付款中途退出并返回到该参数指定的商户网站地址, 支付方式为 支付宝手机网站时 必传(尽量传)
type: string type: string
return_url: return_url:
description: 用户在完成支付后,会根据商户在请求支付API中传入的前台回跳地址return_url自动跳转return_url地址页面(必传)
type: string type: string
source_code: source_code:
description: 支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户
6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡)
16:微信小程序-必康自营 17:微信JASPI-必康自营
type: integer type: integer
store_sn: store_sn:
description: 商户门店编号
type: string type: string
sub_mchid: sub_mchid:
description: 通过进件接口申请的支付商户号、这是由微信生成并下发的
type: string type: string
wap_name: wap_name:
description: WAP网站名称, 支付方式为微信MWEB时 必传
type: string type: string
wap_url: wap_url:
description: WAP网站URL地址, 支付方式为微信MWEB时 必传
type: string type: string
type: object type: object
models.RefundParamInput: models.RefundParamInput:
properties: properties:
goods_price: refund_amount:
description: 退款金额,个位为分
type: number type: number
order_id: refund_no:
description: 退款号:原对账单流水号
type: string
refund_reason:
description: 退款原因
type: string type: string
type: object type: object
models.WxNoticeInput: models.ScanNoticeInput:
properties: properties:
channel_id: acc_activity_id:
description: 活动ID
type: string type: string
merchant_no: acc_discount_amount:
description: 账户端优惠金额
type: string type: string
order_create_time: acc_mdiscount_amount:
description: 商户侧优惠金额(账户端)
type: string type: string
order_efficient_time: acc_other_discount_amount:
description: 账户端其它优惠金额(待上线)
type: string type: string
order_info: acc_settle_amount:
description: 账户端结算金额
type: string type: string
order_status: acc_trade_no:
description: 账户端交易订单号
type: string type: string
order_trade_info: account_type:
type: object description: 钱包类型
out_order_no:
type: string type: string
pay_order_no: bank_type:
description: 付款银行
type: string type: string
split_info: card_type:
description: 银行卡类型
type: string
hb_fq_pay_info:
description: 花呗分期支付信息(未上线)
type: object type: object
term_no: log_no:
description: 拉卡拉对账单流水号
type: string
merchant_no:
description: 商户号
type: string
out_trade_no:
description: 商户交易流水号
type: string
payer_amount:
description: 付款人实付金额
type: string
remark:
description: 备注
type: string
settle_merchant_no:
description: 结算商户号
type: string
settle_term_no:
description: 结算终端号
type: string type: string
total_amount: total_amount:
type: integer description: 订单金额
trans_merchant_no:
type: string type: string
trans_term_no: trade_no:
description: 拉卡拉交易流水号
type: string
trade_status:
description: 交易状态
type: string
trade_time:
description: 交易完成时间
type: string
user_id1:
description: 用户标识1
type: string
user_id2:
description: 用户标识2
type: string type: string
type: object type: object
info: info:
...@@ -88,18 +209,18 @@ info: ...@@ -88,18 +209,18 @@ info:
title: 谛宝多多平台 title: 谛宝多多平台
version: "1.0" version: "1.0"
paths: paths:
/api/v1/pay/unified_order: /api/v1/pay/cashier_notice:
post: post:
consumes: consumes:
- application/json - application/json
description: 拉卡拉统一支付 description: 拉卡拉统一支付回调(收银台)
parameters: parameters:
- description: 参数 - description: 参数
in: body in: body
name: body name: body
required: true required: true
schema: schema:
$ref: '#/definitions/models.PlaceAnOrderParamInput' $ref: '#/definitions/models.CashierNoticeInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header in: header
name: language name: language
...@@ -109,21 +230,21 @@ paths: ...@@ -109,21 +230,21 @@ paths:
responses: responses:
"200": "200":
description: "" description: ""
summary: 拉卡拉统一支付 summary: 拉卡拉统一支付回调(收银台)
tags: tags:
- 拉卡拉统一支付 - 拉卡拉统一支付回调
/api/v1/pay/unified_refund: /api/v1/pay/order_state:
post: post:
consumes: consumes:
- application/json - application/json
description: 拉卡拉退款 description: 拉卡拉支付查询
parameters: parameters:
- description: 参数 - description: 参数
in: body in: body
name: body name: body
required: true required: true
schema: schema:
$ref: '#/definitions/models.RefundParamInput' $ref: '#/definitions/models.OrderStateInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header in: header
name: language name: language
...@@ -133,21 +254,21 @@ paths: ...@@ -133,21 +254,21 @@ paths:
responses: responses:
"200": "200":
description: "" description: ""
summary: 拉卡拉退款 summary: 拉卡拉支付查询
tags: tags:
- 拉卡拉退款 - 拉卡拉支付查询
/api/v1/pay/wx_notice: /api/v1/pay/scan_notice:
post: post:
consumes: consumes:
- application/json - application/json
description: 拉卡拉统一支付微信回调 description: 拉卡拉统一支付回调(聚合扫码)
parameters: parameters:
- description: 参数 - description: 参数
in: body in: body
name: body name: body
required: true required: true
schema: schema:
$ref: '#/definitions/models.WxNoticeInput' $ref: '#/definitions/models.ScanNoticeInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文 - description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header in: header
name: language name: language
...@@ -157,9 +278,57 @@ paths: ...@@ -157,9 +278,57 @@ paths:
responses: responses:
"200": "200":
description: "" description: ""
summary: 拉卡拉统一支付微信回调 summary: 拉卡拉统一支付回调(聚合扫码)
tags: tags:
- 拉卡拉统一支付回调 - 拉卡拉统一支付回调
/api/v1/pay/unified_order:
post:
consumes:
- application/json
description: 拉卡拉统一支付
parameters:
- description: 参数
in: body
name: body
required: true
schema:
$ref: '#/definitions/models.PlaceAnOrderParamInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header
name: language
type: string
produces:
- application/json
responses:
"200":
description: ""
summary: 拉卡拉统一支付
tags:
- 拉卡拉统一支付
/api/v1/pay/unified_refund:
post:
consumes:
- application/json
description: 拉卡拉退款
parameters:
- description: 参数
in: body
name: body
required: true
schema:
$ref: '#/definitions/models.RefundParamInput'
- description: 语言类型 zh-CN简体中文 en-US英文 ja-JP日文 默认中文
in: header
name: language
type: string
produces:
- application/json
responses:
"200":
description: ""
summary: 拉卡拉退款
tags:
- 拉卡拉退款
securityDefinitions: securityDefinitions:
ApiKeyAuth: ApiKeyAuth:
in: header in: header
......
...@@ -2,46 +2,46 @@ package models ...@@ -2,46 +2,46 @@ package models
//聚合收银台-交易通知(回调输入参数) //聚合收银台-交易通知(回调输入参数)
type CashierNoticeInput struct { type CashierNoticeInput struct {
ChannelId string `json:"channel_id" description:"渠道号"` ChannelId string `json:"channel_id"` //渠道号
MerchantNo string `json:"merchant_no" description:"结算商户号"` MerchantNo string `json:"merchant_no"` //结算商户号
OrderCreateTime string `json:"order_create_time" description:"订单创建时间"` OrderCreateTime string `json:"order_create_time"` //订单创建时间
OrderEfficientTime string `json:"order_efficient_time" description:"订单有效时间"` OrderEfficientTime string `json:"order_efficient_time"` //订单有效时间
OrderInfo string `json:"order_info" description:"订单描述"` OrderInfo string `json:"order_info"` //订单描述
OrderStatus string `json:"order_status" description:"订单状态"` OrderStatus string `json:"order_status"` //订单状态
OutOrderNo string `json:"out_order_no" description:"商户订单号"` OutOrderNo string `json:"out_order_no"` //商户订单号
PayOrderNo string `json:"pay_order_no" description:"支付订单号"` PayOrderNo string `json:"pay_order_no"` //支付订单号
TermNo string `json:"term_no" description:"结算终端号"` TermNo string `json:"term_no"` //结算终端号
TotalAmount int64 `json:"total_amount" description:"订单金额,单位:分"` TotalAmount int64 `json:"total_amount"` //订单金额,单位:分
TransMerchantNo string `json:"trans_merchant_no" description:"交易商户号"` TransMerchantNo string `json:"trans_merchant_no"` //交易商户号
TransTermNo string `json:"trans_term_no" description:"交易终端号"` TransTermNo string `json:"trans_term_no"` //交易终端号
OrderTradeInfo interface{} `json:"order_trade_info" description:""` OrderTradeInfo interface{} `json:"order_trade_info"`
SplitInfo interface{} `json:"split_info" description:""` SplitInfo interface{} `json:"split_info"`
} }
//聚合扫码-交易通知(回调输入参数) //聚合扫码-交易通知(回调输入参数)
type ScanNoticeInput struct { type ScanNoticeInput struct {
MerchantNo string `json:"merchant_no" description:"商户号"` MerchantNo string `json:"merchant_no"` //商户号
OutTradeNo string `json:"out_trade_no" description:"商户交易流水号"` OutTradeNo string `json:"out_trade_no"` //商户交易流水号
TradeNo string `json:"trade_no" description:"拉卡拉交易流水号"` TradeNo string `json:"trade_no"` //拉卡拉交易流水号
LogNo string `json:"log_no" description:"拉卡拉对账单流水号"` LogNo string `json:"log_no"` //拉卡拉对账单流水号
AccTradeNo string `json:"acc_trade_no" description:"账户端交易订单号"` AccTradeNo string `json:"acc_trade_no"` //账户端交易订单号
AccountType string `json:"account_type" description:"钱包类型"` AccountType string `json:"account_type"` //钱包类型
SettleMerchantNo string `json:"settle_merchant_no" description:"结算商户号"` SettleMerchantNo string `json:"settle_merchant_no"` //结算商户号
SettleTermNo string `json:"settle_term_no" description:"结算终端号"` SettleTermNo string `json:"settle_term_no"` //结算终端号
TradeStatus string `json:"trade_status" description:"交易状态"` TradeStatus string `json:"trade_status"` //交易状态
TotalAmount string `json:"total_amount" description:"订单金额"` TotalAmount string `json:"total_amount"` //订单金额
PayerAmount string `json:"payer_amount" description:"付款人实付金额"` PayerAmount string `json:"payer_amount"` //付款人实付金额
AccSettleAmount string `json:"acc_settle_amount" description:"账户端结算金额"` AccSettleAmount string `json:"acc_settle_amount"` //账户端结算金额
AccMdiscountAmount string `json:"acc_mdiscount_amount" description:"商户侧优惠金额(账户端)"` AccMdiscountAmount string `json:"acc_mdiscount_amount"` //商户侧优惠金额(账户端)
AccDiscountAmount string `json:"acc_discount_amount" description:"账户端优惠金额"` AccDiscountAmount string `json:"acc_discount_amount"` //账户端优惠金额
AccOtherDiscountAmount string `json:"acc_other_discount_amount" description:"账户端其它优惠金额(待上线)"` AccOtherDiscountAmount string `json:"acc_other_discount_amount"` //账户端其它优惠金额(待上线)
TradeTime string `json:"trade_time" description:"交易完成时间"` TradeTime string `json:"trade_time"` //交易完成时间
UserId1 string `json:"user_id1" description:"用户标识1"` UserId1 string `json:"user_id1"` //用户标识1
UserId2 string `json:"user_id2" description:"用户标识2"` UserId2 string `json:"user_id2"` //用户标识2
AccActivityId string `json:"acc_activity_id" description:"活动ID"` AccActivityId string `json:"acc_activity_id"` //活动ID
BankType string `json:"bank_type" description:"付款银行"` BankType string `json:"bank_type"` //付款银行
CardType string `json:"card_type" description:"银行卡类型"` CardType string `json:"card_type"` //银行卡类型
Remark string `json:"remark" description:"备注"` Remark string `json:"remark"` //备注
HbFqPayInfo interface{} `json:"hb_fq_pay_info" description:"花呗分期支付信息(未上线)"` HbFqPayInfo interface{} `json:"hb_fq_pay_info"` //花呗分期支付信息(未上线)
} }
// CallbackResponse is 回调给业务方的信息 // CallbackResponse is 回调给业务方的信息
......
...@@ -2,55 +2,60 @@ package models ...@@ -2,55 +2,60 @@ package models
//支付 //支付
type PlaceAnOrderParamInput struct { type PlaceAnOrderParamInput struct {
PlatformType uint8 `json:"platform_type" description:"平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile"` PlatformType uint8 `json:"platform_type"` //平台类型 1:saas 2:shop 3:shop mobile 4:收银台 6:bk_shop 7:bk_shop_mobile
PlatformInfo string `json:"platform_info" description:"平台信息"` PlatformInfo string `json:"platform_info"` //平台信息
GoodsDes string `json:"goods_des" description:"商品描述"` GoodsDes string `json:"goods_des"` //商品描述
GoodsDetail string `json:"goods_detail" description:"商品详情"` GoodsDetail string `json:"goods_detail"` //商品详情
AttachInfo string `json:"attach_info" description:"附加信息"` AttachInfo string `json:"attach_info"` //附加信息
GoodsPrice float64 `json:"goods_price" description:"商品金额,个位为分"` GoodsPrice float64 `json:"goods_price"` //商品金额,个位为分
NoticeURL string `json:"notice_url" description:"客户端回调的url"` NoticeURL string `json:"notice_url"` //客户端回调的url
PayType int `json:"pay_type" description:"支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧"` PayType int `json:"pay_type"` //支付渠道 1:微信 2:支付宝 3:拉卡拉 4:收钱吧
SourceCode uint8 `json:"source_code" description:"支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营 17:微信JASPI-必康自营"` SourceCode uint8 `json:"source_code"` //支付方式 1:微信Native 2:微信小程序 3:微信内支付 4:h5 跳微信 5:支付宝(web)-扫码或登录支付宝账户 6:alipay(mobile) 7:alipay(app) 9:B2C 10:bk支付宝web 11:bk 支付宝手机 15:快捷支付(银行卡) 16:微信小程序-必康自营 17:微信JASPI-必康自营
OpenID string `json:"open_id" description:"此参数 支付类型是 JS API 的时候 必传"` OpenID string `json:"open_id"` //此参数 支付类型是 JS API 的时候 必传
WapURL string `json:"wap_url" description:"WAP网站URL地址, 支付方式为微信MWEB时 必传"` WapURL string `json:"wap_url"` //WAP网站URL地址, 支付方式为微信MWEB时 必传
WapName string `json:"wap_name" description:"WAP网站名称, 支付方式为微信MWEB时 必传"` WapName string `json:"wap_name"` //WAP网站名称, 支付方式为微信MWEB时 必传
QuitURL string `json:"quit_url" description:"返回按钮 可用于用户付款中途退出并返回到该参数指定的商户网站地址, 支付方式为 支付宝手机网站时 必传(尽量传)"` QuitURL string `json:"quit_url"` //返回按钮 可用于用户付款中途退出并返回到该参数指定的商户网站地址, 支付方式为 支付宝手机网站时 必传(尽量传)
ReturnURL string `json:"return_url" description:"用户在完成支付后,会根据商户在请求支付API中传入的前台回跳地址return_url自动跳转return_url地址页面(必传)"` ReturnURL string `json:"return_url"` //用户在完成支付后,会根据商户在请求支付API中传入的前台回跳地址return_url自动跳转return_url地址页面(必传)
AppID string `json:"app_id,omitempty" description:"wxAppId source code 2 小程序支付时必传、同时小程序支付必须关联了商户号支付"` AppID string `json:"app_id,omitempty"` //wxAppId source code 2 小程序支付时必传、同时小程序支付必须关联了商户号支付
Operator string `json:"operator" description:"操作员"` Operator string `json:"operator"` //操作员
Customer string `json:"customer" description:"顾客信息"` Customer string `json:"customer"` //顾客信息
DynamicID string `json:"dynamic_id" description:"顾客手机条码的内容"` DynamicID string `json:"dynamic_id"` //顾客手机条码的内容
StoreSn string `json:"store_sn" description:"商户门店编号"` StoreSn string `json:"store_sn"` //商户门店编号
IsServe uint `json:"is_serve" description:"0直连模式 1服务商模式"` IsServe uint `json:"is_serve"` //0直连模式 1服务商模式
OrderId string `json:"-" description:"订单号"` OrderId string `json:"-"` //订单号
SubMchid string `json:"sub_mchid" description:"通过进件接口申请的支付商户号、这是由微信生成并下发的"` SubMchid string `json:"sub_mchid"` //通过进件接口申请的支付商户号、这是由微信生成并下发的
Nonce string `json:"-"` Nonce string `json:"-"`
ServeNoticeUrl string `json:"-" description:"传递给支付渠道的、而不是业务方的"` ServeNoticeUrl string `json:"-"` //传递给支付渠道的、而不是业务方的
AuthCodes string `json:"auth_codes" description:"LAKALA签约协议号列表"` AuthCodes string `json:"auth_codes"` //LAKALA签约协议号列表
} }
//退款 //退款
type RefundParamInput struct { type RefundParamInput struct {
RefundNo string `json:"refund_no" description:"退款号:原对账单流水号"` RefundNo string `json:"refund_no"` //退款号:原对账单流水号
RefundAmount float64 `json:"refund_amount" description:"退款金额,个位为分"` RefundAmount float64 `json:"refund_amount"` //退款金额,个位为分
RefundReason string `json:"refund_reason" description:"退款原因"` RefundReason string `json:"refund_reason"` //退款原因
}
//支付查询
type OrderStateInput struct {
OrderId string `json:"order_id"` //订单号
} }
type LakalaParamInput struct { type LakalaParamInput struct {
Version string `json:"version" description:"版本"` Version string `json:"version"` //版本
ReqTime string `json:"req_time" description:"请求时间"` ReqTime string `json:"req_time"` //请求时间
ReqData LakalaParamData `json:"req_data"` ReqData LakalaParamData `json:"req_data"`
} }
type LakalaParamData struct { type LakalaParamData struct {
OutOrderNo string `json:"out_order_no" description:"商户订单号"` OutOrderNo string `json:"out_order_no"` //商户订单号
MerchantNo string `json:"merchant_no" description:"银联商户号"` MerchantNo string `json:"merchant_no"` //银联商户号
TotalAmount float64 `json:"total_amount" description:"订单金额,单位:分"` TotalAmount float64 `json:"total_amount"` //订单金额,单位:分
OrderEfficientTime string `json:"order_efficient_time" description:"订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天"` OrderEfficientTime string `json:"order_efficient_time"` //订单有效期 格式yyyyMMddHHmmss,最大支持下单时间+2天
NotifyUrl string `json:"notify_url" description:"订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com"` NotifyUrl string `json:"notify_url"` //订单支付成功后商户接收订单通知的地址 http://xxx.xxx.com
CallbackUrl string `json:"callback_url" description:"客户端下单完成支付后返回的商户网页跳转地址"` CallbackUrl string `json:"callback_url"` //客户端下单完成支付后返回的商户网页跳转地址
OrderInfo string `json:"order_info" description:"订单标题,在使用收银台扫码支付时必输入,交易时送往账户端"` OrderInfo string `json:"order_info"` //订单标题,在使用收银台扫码支付时必输入,交易时送往账户端
GoodsMark string `json:"goods_mark" description:"商品信息标识 (1:含商品信息,不填默认不含商品信息)"` GoodsMark string `json:"goods_mark"` //商品信息标识 (1:含商品信息,不填默认不含商品信息)
} }
\ No newline at end of file
...@@ -261,6 +261,18 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -261,6 +261,18 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
return nil, err return nil, err
} }
if input.SourceCode==9 {
//收钱吧(扫码枪)
//调拉卡拉接口
go lakala_post(input, url, orderID, data_json)
//返回值
response := make(map[string]string)
response["payment_order_code"] = orderID //随机生成的订单号
return response, nil
}
//调拉卡拉接口 //调拉卡拉接口
err, response, lakala_rtn := lakala_post(input, url, orderID, data_json) err, response, lakala_rtn := lakala_post(input, url, orderID, data_json)
if err != nil { if err != nil {
...@@ -275,16 +287,10 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{}, ...@@ -275,16 +287,10 @@ func UnifiedOrder(input *models.PlaceAnOrderParamInput, ip string) (interface{},
return nil, err return nil, err
} }
if input.SourceCode==9 {
//收钱吧(扫码枪)
response := make(map[string]string)
response["payment_order_code"] = orderID //随机生成的订单号
return response, nil
}
return response, nil return response, nil
} }
//支付、退款、支付查询 共通调用
func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, data_json []byte) (error, interface{}, interface{}) { func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, data_json []byte) (error, interface{}, interface{}) {
var source_code, platform_type uint8 var source_code, platform_type uint8
...@@ -368,6 +374,10 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat ...@@ -368,6 +374,10 @@ func lakala_post(input *models.PlaceAnOrderParamInput, url, order_id string, dat
response["timeStamp"] = temp3["time_stamp"].(string) response["timeStamp"] = temp3["time_stamp"].(string)
} else if source_code==9 { } else if source_code==9 {
//扫码枪 //扫码枪
//mBody := map[string]string{
// "payment_order_code": orderID,
//}
response["payment_order_code"] = order_id
} }
return nil, response, temp return nil, response, temp
...@@ -545,20 +555,21 @@ func InsertPayBillDetailResponseBody(tx *sql.Tx, billID int64, responseBody inte ...@@ -545,20 +555,21 @@ func InsertPayBillDetailResponseBody(tx *sql.Tx, billID int64, responseBody inte
return nil return nil
} }
//func InsertPayBillDetailResponseBodyString(tx *sql.Tx, billID int64, responseBody string) error { //支付查询 插入db
// func InsertPayBillDetailResponseBodyString(tx *sql.Tx, billID int64, responseBody string) error {
// insertPayBillDetailSQL := `update system_pay_bill_detail set response_body = ? where pay_bill_id = ?`
// result, err := tx.Exec(insertPayBillDetailSQL, responseBody, billID) insertPayBillDetailSQL := `update system_pay_bill_detail set response_body = ? where pay_bill_id = ?`
// if err != nil { result, err := tx.Exec(insertPayBillDetailSQL, responseBody, billID)
// return err if err != nil {
// } return err
// }
// _, err = result.RowsAffected()
// if err != nil { _, err = result.RowsAffected()
// return err if err != nil {
// } return err
// return nil }
//} return nil
}
func GetUID() string { func GetUID() string {
u4 := uID.NewV4() u4 := uID.NewV4()
...@@ -570,8 +581,6 @@ func GetUID() string { ...@@ -570,8 +581,6 @@ func GetUID() string {
return strings.Replace(id, "-", "", -1) return strings.Replace(id, "-", "", -1)
} }
// 拉卡拉退款 // 拉卡拉退款
func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, error) { func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, error) {
fmt.Println("谛宝多多输入参数(退款)") fmt.Println("谛宝多多输入参数(退款)")
...@@ -593,7 +602,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -593,7 +602,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
defer mysql.CloseTx(tx, err) defer mysql.CloseTx(tx, err)
//退款订单存在check //退款订单存在check
log_no, trans_term_no, source_code, platform_type, err := selectRefundBill(tx, input) log_no, trans_term_no, source_code, platform_type, order_create_time, err := selectRefundBill(tx, input)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -716,6 +725,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -716,6 +725,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
data2["refund_type"] = "00" //当商户进件时退货模式配置的为 指定模式退货时,该字段有效。00:退货帐户,05:商户余额退货,06:终端余额退货 data2["refund_type"] = "00" //当商户进件时退货模式配置的为 指定模式退货时,该字段有效。00:退货帐户,05:商户余额退货,06:终端余额退货
data2["origin_card_no"] = "621700*********0114" //原交易银行卡号,银行卡退款必填 data2["origin_card_no"] = "621700*********0114" //原交易银行卡号,银行卡退款必填
//data2["origin_trade_no"] = //原交易拉卡拉交易订单号 //data2["origin_trade_no"] = //原交易拉卡拉交易订单号
data2["origin_trade_date"] = order_create_time //原交易日期:yyyyMMdd
} }
data2["origin_log_no"] = log_no //原对账单流水号 data2["origin_log_no"] = log_no //原对账单流水号
...@@ -753,7 +763,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -753,7 +763,7 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
} }
var input2 models.PlaceAnOrderParamInput var input2 models.PlaceAnOrderParamInput
//input2.SourceCode = source_code input2.SourceCode = source_code
input2.PlatformType = platform_type input2.PlatformType = platform_type
//调拉卡拉接口 //调拉卡拉接口
...@@ -776,9 +786,10 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro ...@@ -776,9 +786,10 @@ func UnifiedRefund(input *models.RefundParamInput, ip string) (interface{}, erro
} }
//退款订单存在check //退款订单存在check
func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, string, uint8, uint8, error) { func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, string, uint8, uint8, string, error) {
var billID int64 var billID int64
var createtime string
var status uint var status uint
var platform_type uint8 var platform_type uint8
var source_code uint8 var source_code uint8
...@@ -786,13 +797,14 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin ...@@ -786,13 +797,14 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
var notice_request2 []byte var notice_request2 []byte
//payment_order_code, paymoney //payment_order_code, paymoney
selectRefundBillSQL := `select b.id, b.result_code, b.source_code, b.platform_type, bd.notice_request_body selectRefundBillSQL := `select b.id, DATE_FORMAT(b.createtime, '%Y%m%d') createtime,
b.result_code, b.source_code, b.platform_type, bd.notice_request_body
from system_pay_bill b from system_pay_bill b
left join system_pay_bill_detail bd on b.id=bd.pay_bill_id left join system_pay_bill_detail bd on b.id=bd.pay_bill_id
where b._type=0 and b.payment_order_code=?` where b._type=0 and b.payment_order_code=?`
err := tx.QueryRow(selectRefundBillSQL, input.RefundNo).Scan(&billID, &status, &source_code, &platform_type, &notice_request2) err := tx.QueryRow(selectRefundBillSQL, input.RefundNo).Scan(&billID, &createtime, &status, &source_code, &platform_type, &notice_request2)
if err != nil { if err != nil {
return "", "", 0, 0, err return "", "", 0, 0, "", err
} }
if source_code==2 || source_code==3 || source_code==9 { if source_code==2 || source_code==3 || source_code==9 {
...@@ -804,13 +816,14 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin ...@@ -804,13 +816,14 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
} }
if err := json.Unmarshal(notice_request2, &notice_request); err != nil { if err := json.Unmarshal(notice_request2, &notice_request); err != nil {
return "", "", 0, 0, err return "", "", 0, 0, "", err
} }
//fmt.Println(notice_request2) //fmt.Println(notice_request2)
//fmt.Println(notice_request) //fmt.Println(notice_request)
fmt.Println("退款订单存在check返回值:") fmt.Println("退款订单存在check返回值:")
fmt.Println(billID) fmt.Println(billID)
fmt.Println(createtime)
fmt.Println(status) fmt.Println(status)
fmt.Println(source_code) fmt.Println(source_code)
fmt.Println(platform_type) fmt.Println(platform_type)
...@@ -818,41 +831,40 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin ...@@ -818,41 +831,40 @@ func selectRefundBill(tx *sql.Tx, input *models.RefundParamInput) (string, strin
// 订单不存在 // 订单不存在
if billID <= 0 { if billID <= 0 {
return "", "", 0, 0, errors.New("订单不存在2") return "", "", 0, 0, "", errors.New("订单不存在2")
} }
// 订单未结算 // 订单未结算
if status != 1 { if status != 1 {
return "", "", 0, 0, errors.New("订单未结算") return "", "", 0, 0, "", errors.New("订单未结算")
} }
if source_code==0 { if source_code==0 {
return "", "", 0, 0, errors.New("「source_code」错误,有效值为[1-6,9,15-17]") return "", "", 0, 0, "", errors.New("「source_code」错误,有效值为[1-6,9,15-17]")
} }
// 获取「对账单流水号」和「交易终端号」,退款用 // 获取「对账单流水号」和「交易终端号」,退款用
var log_no, trans_term_no string var log_no, trans_term_no string
if source_code==2 || source_code==3 || source_code==9 { if source_code==2 || source_code==3 || source_code==9 {
//聚合扫码+聚合被扫 //聚合扫码+聚合被扫
log_no = notice_request.(models.ScanNoticeInput).LogNo log_no = notice_request.(*models.ScanNoticeInput).LogNo
if log_no=="" { if log_no=="" {
return "", "", 0, 0, errors.New("「对账单流水号」未取得错误") return "", "", 0, 0, "", errors.New("「对账单流水号」未取得错误")
} }
} else { } else {
//其它支付 //其它支付
// 针对有的支付,不需要传「交易终端号」时,需要用支付返回的「交易终端号」进行退款 // 针对有的支付,不需要传「交易终端号」时,需要用支付返回的「交易终端号」进行退款
log_no = notice_request.(models.CashierNoticeInput).OrderTradeInfo.(map[string]interface{})["log_no"].(string) log_no = notice_request.(*models.CashierNoticeInput).OrderTradeInfo.(map[string]interface{})["log_no"].(string)
if log_no=="" { if log_no=="" {
return "", "", 0, 0, errors.New("「对账单流水号」未取得错误") return "", "", 0, 0, "", errors.New("「对账单流水号」未取得错误")
} }
trans_term_no = notice_request.(models.CashierNoticeInput).TransTermNo trans_term_no = notice_request.(*models.CashierNoticeInput).TransTermNo
if trans_term_no=="" { if trans_term_no=="" {
//todo return "", "", 0, 0, "", errors.New("「交易终端号」未取得错误")
return "", "", 0, 0, errors.New("「交易终端号」未取得错误")
} }
} }
return log_no, trans_term_no, source_code, platform_type, nil return log_no, trans_term_no, source_code, platform_type, createtime, nil
} }
//InsertRefundBill is 插入 支付订单表中 //InsertRefundBill is 插入 支付订单表中
...@@ -882,3 +894,376 @@ func InsertRefundBill(tx *sql.Tx, p *models.RefundParamInput, refundID string) ( ...@@ -882,3 +894,376 @@ func InsertRefundBill(tx *sql.Tx, p *models.RefundParamInput, refundID string) (
return billID, nil return billID, nil
} }
// 拉卡拉支付查询
func OrderState(input *models.OrderStateInput) (interface{}, error) {
fmt.Println("谛宝多多输入参数(支付查询)")
fmt.Println(input)
//refundID := GetUID()
order_id := input.OrderId
if order_id == "" {
return nil, errors.New("账单不存在")
}
// 插入数据库
db, err := mysql.NewPayConn()
if err != nil {
return 0, err
}
tx, err := db.Begin()
if err != nil {
return nil, err
}
defer mysql.CloseTx(tx, err)
var isExist uint
err = tx.QueryRow(`select count(id) from pay_bill where payment_order_code = ?`, order_id).Scan(&isExist)
if err != nil {
return nil, err
}
if isExist == 0 {
return nil, fmt.Errorf("账单不存在")
}
querySQL := `select id, source_code, result_code, payment_order_code, attach, _type from pay_bill where payment_order_code = ?`
//result := new(models.OrderState)
var result_code uint8
var sourceCode uint
var paymentOrderCode string
var attach string
var billID int64
var billType uint8
err = db.QueryRow(querySQL, order_id).Scan(&billID, &sourceCode,
&result_code, &paymentOrderCode, &attach, &billType)
if err != nil {
return nil, err
}
// 如果是 未结算成功、并且是收钱吧渠道的账单
if result_code == 0 && sourceCode == 9 { //todo wangpei
// 查询收钱吧支付是否成功
state, err := SqbQueryOrderState(tx, paymentOrderCode, attach, billID, billType)
if err != nil {
return nil, err
}
result_code = state
}
return result_code, nil
}
//订单状态 0: 未结算 1: 结算成功 2: 结算失败
func SqbQueryOrderState(tx *sql.Tx, paymentOrderCode, attach string, billID int64, billType uint8) (uint8, error) {
fmt.Println("attachMap: ", attach)
var attachMap map[string]interface{}
err := json.Unmarshal([]byte(attach), &attachMap)
if err != nil {
return 0, err
}
storeSn := attachMap["store_sn"].(string)
if storeSn == "" {
return 0, fmt.Errorf("参数错误")
}
var input2 models.PlaceAnOrderParamInput
//input2.SourceCode = source_code
//input2.PlatformType = platform_type
//url := "https://test.wsmsd.cn/sit/api/v3/labs/query/tradequery" //测试
//url := "https://s2.lakala.com/api/v3/labs/query/tradequery" //正式
url := setting.Conf.Lakala.UrlOrderState //统一退货接口
//todo 参数赋值
data := make(map[string]interface{})
//data["merchant_no"] = merchant_no //商户号
//data["term_no"] = term_no //终端号
//data["out_trade_no"] = out_trade_no //商户交易流水号
//data["trade_no"] = trade_no //拉卡拉交易流水号
data_json, err := json.Marshal(data)
if err != nil {
return 0, err
}
//调拉卡拉接口
err, _, lakala_rtn := lakala_post(&input2, url, "", data_json)
if err != nil {
InsertPayBillDetailResponseBody(tx, billID, lakala_rtn)
return 0, err
}
// 插入成功后返回的结果
err = InsertPayBillDetailResponseBody(tx, billID, lakala_rtn)
if err != nil {
//beego.Error("支付查询请求成功 --- 但退成功后的插入参数失败")
return 0, err
}
//INIT-初始化 CREATE-下单成功 SUCCESS-交易成功 FAIL-交易失败 DEAL-交易处理中
//UNKNOWN-未知状态 CLOSE-订单关闭 PART_REFUND-部分退款 REFUND-全部退款(或订单被撤销)
trade_state := lakala_rtn.(map[string]interface{})["trade_state"] //交易状态
if trade_state != "SUCCESS" {
// 返回未结算
return 0, nil //todo 返回 2: 结算失败 ?
}
querySQL := `select result_code from pay_bill where id = ?`
var resultCode uint
err = tx.QueryRow(querySQL, billID).Scan(&resultCode)
if err != nil {
return 0, errors.New("查询失败:" + err.Error())
}
// 如果支付过、则直接返回
if resultCode != 0 && resultCode != 2 {
// 返回支付成功
return 1, nil
}
// 如果支付成功则改变状态
err = BillPayStateSuccess(tx, billID)
if err != nil {
//beego.Error("改变支付状态为成功时错误: ", err)
tx.Rollback()
return 0, nil
}
return 1, nil
}
// OrderState is 订单状态
//type OrderState2 struct {
// State uint8 `json:"state" description:"订单状态 0: 未结算 1: 结算成功 2: 结算失败"`
//}
//
//// GetOrderState 获取订单状态
//func GetOrderState(orderCode string) (interface{}, error) {
//
// var isExist uint
//
// db, err := common.NewPayConn()
// if err != nil {
// return nil, err
// }
//
// err = db.QueryRow(`select count(id) from pay_bill where payment_order_code = ?`, orderCode).Scan(&isExist)
// if err != nil {
// return nil, err
// }
//
// if isExist == 0 {
// return nil, fmt.Errorf("账单不存在")
// }
//
// querySQL := `select id, source_code, result_code, payment_order_code, attach, _type from pay_bill where payment_order_code = ?`
//
// result := new(models.OrderState)
//
// var sourceCode uint
// var paymentOrderCode string
// var attach string
// var billID int64
// var billType uint8
//
// err = db.QueryRow(querySQL, orderCode).Scan(&billID, &sourceCode,
// &result.State, &paymentOrderCode, &attach, &billType)
// if err != nil {
// return nil, err
// }
//
// // 如果是 未结算成功、并且是收钱吧渠道的账单
// if result.State == 0 && sourceCode == 9 {
// // 查询收钱吧支付是否成功
// state, err := SqbQueryOrderState(paymentOrderCode, attach, billID, billType)
// if err != nil {
// return nil, err
// }
//
// result.State = state
// }
//
// return result, nil
//}
//
//func SqbQueryOrderState2(paymentOrderCode, attach string, billID int64, billType uint8) (uint8, error) {
//
// fmt.Println("attachMap: ", attach)
// var attachMap map[string]interface{}
// err := json.Unmarshal([]byte(attach), &attachMap)
// if err != nil {
// return 0, err
// }
//
// storeSn := attachMap["store_sn"].(string)
// if storeSn == "" {
// return 0, fmt.Errorf("参数错误")
// }
//
// r := make(map[string]interface{}, 0)
// var request models.SqbRequest
// var requestBody models.QuerySalePayRequestBody
// var requestHead models.SqbHead
// requestHead.Appid = beego.AppConfig.String("appid")
// requestHead.SignType = "SHA256"
// requestHead.Version = "1.0.0"
// requestHead.RequestTime = time.Now().Format(time.RFC3339)
// requestHead.Reserve = "{}"
//
// requestBody.BrandCode, _ = strconv.ParseInt(beego.AppConfig.String("brand_code"), 10, 64)
// requestBody.StoreSn = storeSn
// requestBody.WorkstationSn = "0"
// requestBody.CheckSn = paymentOrderCode
//
// request.Body = requestBody
// request.Head = requestHead
// r["request"] = &request
// jRequest, err := json.Marshal(request)
// if err != nil {
// return 0, err
// }
//
// sign := utils.RsaEncryption(string(jRequest), beego.AppConfig.String("encryption_sqb_pri"))
// r["signature"] = sign
//
// fmt.Println("r: ", r)
// finalParam, err := json.Marshal(r)
// if err != nil {
// fmt.Println("json")
// return 0, err
// }
//
// fmt.Println("finalParam: ", string(finalParam))
//
// c := &http.Client{}
//
// req, err := http.NewRequest("POST", beego.AppConfig.String("sql_query_pay_url"), bytes.NewReader(finalParam))
// if err != nil {
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// req.Header.Set("Content-Type", "application/json")
// resp, err := c.Do(req)
// if err != nil {
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// resultBody, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// fmt.Println("url: ", beego.AppConfig.String("sql_query_pay_url"))
// fmt.Println("resultBody: ", string(resultBody))
//
// vb, err := utils.VerificationEncryption(beego.AppConfig.String("unencryption_sqb_pub"), resultBody)
// // 验签失败
// if !vb {
// fmt.Println("验签失败: ", err)
// return 0, errors.New("查询失败:" + err.Error())
// }
// if err != nil {
// fmt.Println("验签失败: ", err)
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// beego.Info("resultBody: ", string(resultBody))
// var result models.SqbResponse
// err = json.Unmarshal(resultBody, &result)
// if err != nil {
// fmt.Println("解析失败: ", err)
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// // OrderStatus 0:已取消 1:待操作 (需要输入密码等等情况) 2:操作中 3:等待结果中 4:支付成功 5: 部分完成 6:操作失败,7:已终止
// if result.Reponse.Body.BizResponse.Data.OrderStatus != 4 {
// // 返回未结算
// return 0, nil
// }
//
// querySQL := `select result_code from pay_bill where id = ?`
//
// db, err := common.NewPayConn()
// if err != nil {
// return 0, err
// }
//
// var resultCode uint
// err = db.QueryRow(querySQL, billID).Scan(&resultCode)
// if err != nil {
// return 0, errors.New("查询失败:" + err.Error())
// }
//
// // 如果支付过、则直接返回
// if resultCode != 0 && resultCode != 2 {
// // 返回支付成功
// return 1, nil
// }
//
// tx, err := db.Begin()
// if err != nil {
// return 0, err
// }
//
// fmt.Println("billID: ", billID)
// // 插入查询支付结果
// err = repository.InsertPayBillDetailResponseBodyString(tx, billID, string(resultBody))
// if err != nil {
// beego.Error("插入查询支付结果时错误: ", err)
// tx.Rollback()
// return 0, err
// }
//
// // 如果支付完成
// if result.Reponse.Body.BizResponse.Data.OrderStatus == 4 {
// // 如果支付成功则改变状态
// err = repository.BillPayStateSuccess(tx, billID)
// if err != nil {
// beego.Error("改变支付状态为成功时错误: ", err)
// tx.Rollback()
// return 0, nil
// }
//
// tx.Commit()
//
// // 返回支付成功
// return 1, nil
// }
//
// tx.Commit()
//
// fmt.Println("result: ", result)
//
// if result.Reponse.Body.BizResponse.Data.OrderStatus == 4 {
// // 返回结算失败
// return 2, nil
// }
//
// return 1, nil
//}
...@@ -19,7 +19,10 @@ func PayRouter (r *gin.Engine) { ...@@ -19,7 +19,10 @@ func PayRouter (r *gin.Engine) {
// 卡拉卡统一支付回调(聚合扫码) // 卡拉卡统一支付回调(聚合扫码)
r.POST(pack.PayUrlPacking("scan_notice"), PayController.ScanNotice) r.POST(pack.PayUrlPacking("scan_notice"), PayController.ScanNotice)
// 卡拉卡统一支付 // 拉卡拉支付查询
r.POST(pack.PayUrlPacking("order_state"), PayController.OrderState)
// 拉卡拉退款
r.POST(pack.PayUrlPacking("unified_refund"), PayController.UnifiedRefund) r.POST(pack.PayUrlPacking("unified_refund"), PayController.UnifiedRefund)
} }
...@@ -120,6 +120,7 @@ type Lakala struct { ...@@ -120,6 +120,7 @@ type Lakala struct {
UrlMicropay string `mapstructure:"url_micropay"` //聚合被扫(扫码枪) UrlMicropay string `mapstructure:"url_micropay"` //聚合被扫(扫码枪)
UrlRefund string `mapstructure:"url_refund"` //聚合扫码-退款交易 UrlRefund string `mapstructure:"url_refund"` //聚合扫码-退款交易
UrlTradeRefund string `mapstructure:"url_trade_refund"` //统一退货接口 UrlTradeRefund string `mapstructure:"url_trade_refund"` //统一退货接口
UrlOrderState string `mapstructure:"url_order_state"` //聚合扫码-交易查询
} }
// Init 支持热修改的viper设置 // Init 支持热修改的viper设置
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment