退款查询对账接口定义
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
index 430499c..dd978bb 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/ThirdPayCall.kt
@@ -374,7 +374,7 @@
/**
* 大理农商行银行卡代扣消费
* */
- fun callCitizenCardPay(config: Map<String, String?>, transdate: String, transtime: String, refno: String, amount:Double, bankcardno: String, name: String, idtype: String, idno: String, phone: String): CallBackResp {
+ fun callCitizenCardPay(config: Map<String, String?>, transdate: String, transtime: String, refno: String, amount:Double, bankcardno: String, name: String, idtype: String, idno: String): CallBackResp {
val resp = CallBackResp()
val ip = config["socket.ip"]
val port = config["socket.port"]
@@ -445,6 +445,176 @@
}
}
+ /**
+ * 大理农商行银行卡消费退款
+ * */
+ fun CallCitizenCardPayRefund(config: Map<String, String?>, transdate: String, transtime: String, refno: String, originRefno:String, amount:Double): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.oriSn = originRefno
+ this.amount = MoneyUtil.YuanToFen(amount)
+ this.description="市民卡代扣消费退款"
+ }
+ logger.info("请求消费退款发送报文:\n${req.payRefundXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.payRefundXml)
+ logger.info("请求消费退款返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求消费退款返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ } else {
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ //fixme: 查询逻辑?
+ resp.retcode = "99"
+ resp.retmsg = "请求消费退款异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ /**
+ * 大理农商行银行卡消费退款结果查询
+ * */
+ fun CallCitizenCardPayQueryResult(config: Map<String, String?>, transdate: String, transtime: String, refno: String, originRefno:String): CallBackResp{
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.oriSn = originRefno
+ }
+ logger.info("请求查询结果发送报文:\n${req.queryResultXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.queryResultXml)
+ logger.info("请求查询结果返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求查询结果返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if("0401" == returnResp.code){
+ //原流水不存在
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("dtlstatus", "notfind")
+ }else if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ when(returnResp.status){
+ "0" -> resp.add("dtlstatus", "success")
+ "2" -> resp.add("dtlstatus", "refund")
+ else -> resp.add("dtlstatus", "fail")
+ }
+ } else {
+ //查询失败
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求查询结果异常!e:${e.message}"
+ return resp
+ }
+ }
+
+ fun CallCitizenCardChkfile(config: Map<String, String?>, transdate: String, transtime: String, refno: String, chkdate:String): CallBackResp {
+ val resp = CallBackResp()
+ val ip = config["socket.ip"]
+ val port = config["socket.port"]
+ if (ip.isNullOrEmpty() || port.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "市民卡socket的IP和端口未配置"
+ return resp
+ }
+
+ val req = DlpayReq().apply {
+ this.transdate = transdate
+ this.transtime = transtime
+ this.sn = refno
+ this.chkdate = chkdate
+ }
+ logger.info("请求[$chkdate]对账发送报文:\n${req.chkfileXml}")
+ try {
+ val returnXml = DlpayUtil.send(ip, port.toInt(), 10, req.chkfileXml)
+ logger.info("请求[$chkdate]对账返回报文[$refno]:\n$returnXml")
+ if (returnXml.isNullOrEmpty()) {
+ resp.retcode = "99"
+ resp.retmsg = "请求[$chkdate]对账返回报文为空"
+ return resp
+ }
+ val returnResp = XmlUtils.getXmlToObject<DlpayResp>(returnXml.substring(8), "GBK", DlpayResp::class.java)
+ if (null == returnResp) {
+ resp.retcode = "99"
+ resp.retmsg = "解析返回报文错误!"
+ return resp
+ }
+
+ if ("0000" == returnResp.code) {
+ resp.retcode = "0"
+ resp.retmsg = "success"
+ resp.add("outtradeno", returnResp.bankjourno) //银行流水号
+ resp.add("filename", returnResp.filename)
+
+ } else {
+ //查询失败
+ resp.retcode = "99"
+ resp.retmsg = returnResp.message
+ }
+ return resp
+ } catch (e: Exception) {
+ e.printStackTrace()
+ resp.retcode = "99"
+ resp.retmsg = "请求[$chkdate]对账异常!e:${e.message}"
+ return resp
+ }
+ }
+
fun CallCitizenCardPay(config: Map<String, String?>, paydtl: TShopdtl): CallBackResp {
val resp = CallBackResp()
resp.retcode = "0"