Forráskód Böngészése

东信支付api完善

yq 3 éve
szülő
commit
a6e698cbcf

+ 0 - 19
src/main/java/com/usky/dxtop/common/utils/QRCodeUtil.java

@@ -160,23 +160,4 @@ public class QRCodeUtil {
         return QRCodeUtil.decode(new File(path));
     }
 
-
-    public static void main(String[] args) throws Exception {
-        // 存放在二维码中的内容
-        String scanPayApi = TopApi.generateScanPayApi(TopApi.getOrderNumber(),
-                1,
-                "测试回调",null,null,null,null,null,null);
-        // 嵌入二维码的图片路径
-//        String imgPath = "C:/Users/pc/Desktop/dog.jpg";
-        // 生成的二维码的路径及名称
-        String destPath = "C:/Users/pc/Desktop/test.jpg";
-        //生成二维码
-        QRCodeUtil.encode(scanPayApi, null, destPath, true);
-        // 解析二维码
-        String str = QRCodeUtil.decode(destPath);
-        // 打印出解析出的内容
-        System.out.println(str);
-
-    }
-
 }

+ 191 - 1
src/main/java/com/usky/dxtop/service/api/OneCardApi.java

@@ -1,6 +1,7 @@
 package com.usky.dxtop.service.api;
 
 
+import java.util.Date;
 import java.util.TreeMap;
 
 /**
@@ -46,9 +47,14 @@ public class OneCardApi {
     private static final String LOGS = String.format("%s/%s",URL,"partner/logs");
 
 
+    /**
+     * 公用的请求参数
+     * @return
+     */
     public static TreeMap<String, Object> getCommonParam(){
         TreeMap<String, Object> tMap = new TreeMap<>();
         tMap.put("v",3);
+        tMap.put("d",new Date());
         tMap.put("shop",3);
         tMap.put("term",3);
         tMap.put("oper",3);
@@ -58,7 +64,7 @@ public class OneCardApi {
 
     /**
      * 寻卡参数
-     * @param t
+     * @param t (11按卡号,21按唯一识别号,22 按姓名,23 按身份证号,24 按订餐手机号)
      * @param q
      * @return
      */
@@ -68,4 +74,188 @@ public class OneCardApi {
         commonParam.put("q",q);
         return commonParam;
     }
+
+    /**
+     * 读卡
+     * @param cid 物理卡号
+     * @param cno   交易卡面编码
+     * @param account 是否需要获取多账户信息:可选参数,如传值必须传入 all
+     * @return
+     */
+    public static TreeMap<String, Object> getReadCardParam(String cid,String cno,String account){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("account",account);
+        return commonParam;
+    }
+
+
+    /**
+     * 卡消费
+     * @param cid 物理卡号
+     * @param cno   交易卡面编码
+     * @param amt   交易金额
+     * @return
+     */
+    public static TreeMap<String, Object> getPayParam(String cid,String cno,Double amt,Long invoice){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("amt",amt);
+        commonParam.put("invoice",invoice);
+        return commonParam;
+    }
+
+
+    /**
+     * 卡充值撤销
+     * @param cid
+     * @param cno
+     * @param seq 编号
+     * @param amt 退还金额
+     * @return
+     */
+    public static TreeMap<String, Object> getUnPayParam(String cid,String cno,Long seq,Double amt){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("amt",amt);
+        commonParam.put("seq",seq);
+        return commonParam;
+    }
+
+
+    /**
+     * 卡充值
+     * @param cid
+     * @param cno
+     * @param amt 金额
+     * @param invoice
+     * @param cashbox 钱箱参数4支付表5微信
+     * @return
+     */
+    public static TreeMap<String, Object> getChargeParam(String cid,String cno,Double amt,Long invoice,Integer cashbox){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("amt",amt);
+        commonParam.put("cashbox",cashbox);
+        commonParam.put("invoice",invoice);
+        return commonParam;
+    }
+
+    /**
+     * 取消卡充值
+     * @param cid
+     * @param cno
+     * @param amt
+     * @param msg 取消原因
+     * @return
+     */
+    public static TreeMap<String, Object> getUnChargeParam(String cid,String cno,Double amt,String msg){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("amt",amt);
+        commonParam.put("cashbox",msg);
+        return commonParam;
+    }
+
+
+    /**
+     * 终端的充值,消费,撤单记录
+     * @param date 日期
+     * @param pi 页数
+     * @param ps 条数
+     * @return
+     */
+    public static TreeMap<String, Object> getReconciliationParam(Integer date,Integer pi,Integer ps){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("date",date);
+        commonParam.put("pi",pi);
+        commonParam.put("ps",ps);
+        return commonParam;
+    }
+
+
+    /**
+     * 卡日志查询
+     * @param t (1 查询卡消费日志(包含消费撤单日志),2 查询卡充值日志(包含充值撤单日志),3 查询卡消费和充值日志(包含消费和充值撤
+     * 单日志)4 查询卡事务日志(不含消费和充值的其它相
+     * 关日志))
+     * @param cid
+     * @param cno
+     * @param account
+     * @param pi
+     * @param ps
+     * @return
+     */
+    public static TreeMap<String, Object> getCardLogsParam(Integer t,String cid,String cno,Integer account,Integer pi,Integer ps){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("t",t);
+        commonParam.put("cid",cid);
+        commonParam.put("cno",cno);
+        commonParam.put("account",account);
+        commonParam.put("pi",pi);
+        commonParam.put("ps",ps);
+        return commonParam;
+    }
+
+    /**
+     * 日期查询卡消费日志
+     * @param t
+     * @param cid
+     * @param cno
+     * @param account
+     * @param sd
+     * @param ed
+     * @param pi
+     * @param ps
+     * @return
+     */
+    public static TreeMap<String, Object> getCardLogsByDateParam(Integer t,String cid,String cno,Integer account,
+            Date sd,Date ed
+            ,Integer pi,Integer ps){
+        TreeMap<String, Object> commonParam = getCardLogsParam(t, cid, cno, account, pi, ps);
+        commonParam.put("sd",sd);
+        commonParam.put("ed",ed);
+        return commonParam;
+    }
+
+    /**
+     * 全部日志
+     * @param t
+     * @param account
+     * @param sd
+     * @param ed
+     * @param pi
+     * @param ps
+     * @return
+     */
+    public static TreeMap<String, Object> getCardLogsByAllParam(Integer t,Integer account, Date sd,Date ed,Integer pi,Integer ps){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("t",t);
+        commonParam.put("account",account);
+        commonParam.put("pi",pi);
+        commonParam.put("ps",ps);
+        commonParam.put("sd",sd);
+        commonParam.put("ed",ed);
+        return commonParam;
+    }
+
+    /**
+     * 卡支付二维码
+     * @param cid
+     * @param timeOut
+     * @param unique
+     * @return
+     */
+    public static TreeMap<String, Object> getCardQrCodeParam(String cid,Integer timeOut,String unique){
+        TreeMap<String, Object> commonParam = getCommonParam();
+        commonParam.put("t",cid);
+        commonParam.put("account",timeOut);
+        commonParam.put("pi",unique);
+        return commonParam;
+    }
 }

+ 0 - 17
src/main/java/com/usky/dxtop/service/api/TopApi.java

@@ -75,23 +75,6 @@ public class TopApi {
         return tMap;
     }
 
-    /**
-     * 扫码支付api
-     * @param merchantOrderNo
-     * @param amount
-     * @param note
-     * @return
-     */
-    public static String generateScanPayApi(String merchantOrderNo,Integer amount,String note,
-                                            String storeNo,String backUrl,String orderNumber,
-                                            String validTime,String remark,String goods){
-        TreeMap<String, String> params = generateScanPayApiParam(merchantOrderNo, amount, note,
-                storeNo,backUrl,orderNumber,validTime,remark,goods);
-        return String.format("%s?%s&sign=%s",SCAN_TO_PAY_URL,
-                joinParam(params),
-                signData(params));
-    }
-
 
     public static TreeMap<String, String> generateDealSelectParam(String merchantOrderNo,String storeNo,String trxid,String groupNo){
         TreeMap<String, String> tMap = new TreeMap<>();