1. WeixinPay(生成二维码,及回调方法案例)

  1. import java.awt.image.BufferedImage;
  2. import java.io.*;
  3. import java.net.URLEncoder;
  4. import java.util.*;
  5. import javax.imageio.ImageIO;
  6. import javax.servlet.http.HttpServletRequest;
  7. import javax.servlet.http.HttpServletResponse;
  8. import org.apache.commons.lang.StringUtils;
  9. import org.apache.log4j.Logger;
  10. import com.google.zxing.BarcodeFormat;
  11. import com.google.zxing.MultiFormatWriter;
  12. import com.google.zxing.WriterException;
  13. import com.google.zxing.common.BitMatrix;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RequestMethod;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import org.springframework.web.servlet.ModelAndView;
  18. @RestController
  19. @RequestMapping("/weixin")
  20. public class WeixinPay {
  21. public static Logger lg = Logger.getLogger(WeixinPay.class);
  22. private static final int BLACK = 0xff000000;
  23. private static final int WHITE = 0xFFFFFFFF;
  24. /**
  25. * 获取微信支付的二维码地址
  26. *
  27. * @return
  28. * @throws Exception
  29. * @author chenp
  30. */
  31. public static String getCodeUrl(WeChatParams ps) throws Exception {
  32. /**
  33. * 账号信息
  34. */
  35. String appid = WeChatConfig.APPID;//微信服务号的appid
  36. String mch_id = WeChatConfig.MCHID; //微信支付商户号
  37. String key = WeChatConfig.APIKEY; // 微信支付的API密钥
  38. String notify_url = WeChatConfig.WECHAT_NOTIFY_URL_PC;//回调地址【注意,这里必须要使用外网的地址】
  39. String ufdoder_url = WeChatConfig.UFDODER_URL;//微信下单API地址
  40. String trade_type = "NATIVE"; //类型【网页扫码支付】
  41. /**
  42. * 时间字符串
  43. */
  44. String currTime = PayForUtil.getCurrTime();
  45. String strTime = currTime.substring(8, currTime.length());
  46. String strRandom = PayForUtil.buildRandom(4) + "";
  47. String nonce_str = strTime + strRandom;
  48. /**
  49. * 参数封装
  50. */
  51. SortedMap<Object, Object> packageParams = new TreeMap<Object, Object>();
  52. packageParams.put("appid", appid);
  53. packageParams.put("mch_id", mch_id);
  54. packageParams.put("nonce_str", nonce_str);//随机字符串
  55. packageParams.put("body", ps.body);//支付的商品名称
  56. packageParams.put("out_trade_no", ps.out_trade_no + nonce_str);//商户订单号【备注:每次发起请求都需要随机的字符串,否则失败。】
  57. packageParams.put("total_fee", ps.total_fee);//支付金额
  58. packageParams.put("spbill_create_ip", PayForUtil.localIp());//客户端主机
  59. packageParams.put("notify_url", notify_url);
  60. packageParams.put("trade_type", trade_type);
  61. packageParams.put("attach", ps.attach);//额外的参数【业务类型+会员ID+支付类型】
  62. String sign = PayForUtil.createSign("UTF-8", packageParams, key); //获取签名
  63. packageParams.put("sign", sign);
  64. String requestXML = PayForUtil.getRequestXml(packageParams);//将请求参数转换成String类型
  65. // lg.info("微信支付请求参数的报文" + requestXML);
  66. String resXml = HttpUtil.postData(ufdoder_url, requestXML); //解析请求之后的xml参数并且转换成String类型
  67. Map map = XMLUtil.doXMLParse(resXml);
  68. // lg.info("微信支付响应参数的报文" + resXml);
  69. String urlCode = (String) map.get("code_url");
  70. return urlCode;
  71. }
  72. /**
  73. * 将路径生成二维码图片
  74. *
  75. * @param content
  76. * @param response
  77. * @author chenp
  78. */
  79. @SuppressWarnings({"unchecked", "rawtypes"})
  80. public static void encodeQrcode(String content, HttpServletResponse response) {
  81. if (StringUtils.isBlank(content)) {
  82. return;
  83. }
  84. MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
  85. Map hints = new HashMap();
  86. BitMatrix bitMatrix = null;
  87. try {
  88. bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, 250, 250, hints);
  89. BufferedImage image = toBufferedImage(bitMatrix);
  90. //输出二维码图片流
  91. try {
  92. System.out.println(image);
  93. ImageIO.write(image, "png", response.getOutputStream());
  94. } catch (IOException e) {
  95. e.printStackTrace();
  96. }
  97. } catch (WriterException e1) {
  98. e1.printStackTrace();
  99. }
  100. }
  101. /**
  102. * 类型转换
  103. *
  104. * @param matrix
  105. * @return
  106. * @author chenp
  107. */
  108. public static BufferedImage toBufferedImage(BitMatrix matrix) {
  109. int width = matrix.getWidth();
  110. int height = matrix.getHeight();
  111. BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
  112. for (int x = 0; x < width; x++) {
  113. for (int y = 0; y < height; y++) {
  114. image.setRGB(x, y, matrix.get(x, y) == true ? BLACK : WHITE);
  115. }
  116. }
  117. return image;
  118. }
  119. // 特殊字符处理
  120. public static String UrlEncode(String src) throws UnsupportedEncodingException {
  121. return URLEncoder.encode(src, "UTF-8").replace("+", "%20");
  122. }
  123. @RequestMapping(value = "/wechat_notify_url_pc", method = RequestMethod.POST)
  124. public static boolean wechat_notify_url_pc(HttpServletRequest request, HttpServletResponse response) throws Exception {
  125. //读取参数
  126. InputStream inputStream;
  127. StringBuffer sb = new StringBuffer();
  128. inputStream = request.getInputStream();
  129. String s;
  130. BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
  131. while ((s = in.readLine()) != null) {
  132. sb.append(s);
  133. }
  134. in.close();
  135. inputStream.close();
  136. //解析xml成map
  137. Map<String, String> m = new HashMap<String, String>();
  138. m = XMLUtil.doXMLParse(sb.toString());
  139. //过滤空 设置 TreeMap
  140. SortedMap<Object, Object> packageParams = new TreeMap<Object, Object>();
  141. Iterator<String> it = m.keySet().iterator();
  142. while (it.hasNext()) {
  143. String parameter = it.next();
  144. String parameterValue = m.get(parameter);
  145. String v = "";
  146. if (null != parameterValue) {
  147. v = parameterValue.trim();
  148. }
  149. packageParams.put(parameter, v);
  150. }
  151. // 微信支付的API密钥
  152. String key = WeChatConfig.APIKEY; // key
  153. lg.info("微信支付返回回来的参数:" + packageParams);
  154. //判断签名是否正确
  155. if (PayForUtil.isTenpaySign("UTF-8", packageParams, key)) {
  156. //------------------------------
  157. //处理业务开始
  158. //------------------------------
  159. String resXml = "";
  160. if ("SUCCESS".equals((String) packageParams.get("result_code"))) {
  161. // 这里是支付成功
  162. //执行自己的业务逻辑开始
  163. String app_id = (String) packageParams.get("appid");
  164. String mch_id = (String) packageParams.get("mch_id");
  165. String openid = (String) packageParams.get("openid");
  166. String is_subscribe = (String) packageParams.get("is_subscribe");//是否关注公众号
  167. //附加参数【商标申请_0bda32824db44d6f9611f1047829fa3b_15460】--【业务类型_会员ID_订单号】
  168. String attach = (String) packageParams.get("attach");
  169. //商户订单号
  170. String out_trade_no = (String) packageParams.get("out_trade_no");
  171. //付款金额【以分为单位】
  172. String total_fee = (String) packageParams.get("total_fee");
  173. //微信生成的交易订单号
  174. String transaction_id = (String) packageParams.get("transaction_id");//微信支付订单号
  175. //支付完成时间
  176. String time_end = (String) packageParams.get("time_end");
  177. lg.info("app_id:" + app_id);
  178. lg.info("mch_id:" + mch_id);
  179. lg.info("openid:" + openid);
  180. lg.info("is_subscribe:" + is_subscribe);
  181. lg.info("out_trade_no:" + out_trade_no);
  182. lg.info("total_fee:" + total_fee);
  183. lg.info("额外参数_attach:" + attach);
  184. lg.info("time_end:" + time_end);
  185. //执行自己的业务逻辑结束
  186. lg.info("支付成功");
  187. //通知微信.异步确认成功.必写.不然会一直通知后台.八次之后就认为交易失败了.
  188. resXml = "<xml>" + "<return_code><![CDATA[SUCCESS]]></return_code>"
  189. + "<return_msg><![CDATA[OK]]></return_msg>" + "</xml> ";
  190. } else {
  191. lg.info("支付失败,错误信息:" + packageParams.get("err_code"));
  192. resXml = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>"
  193. + "<return_msg><![CDATA[报文为空]]></return_msg>" + "</xml> ";
  194. }
  195. //------------------------------
  196. //处理业务完毕
  197. //------------------------------
  198. BufferedOutputStream out = new BufferedOutputStream(
  199. response.getOutputStream());
  200. out.write(resXml.getBytes());
  201. out.flush();
  202. out.close();
  203. System.out.println(true);
  204. return true;
  205. } else {
  206. lg.info("通知签名验证失败");
  207. System.out.println(false);
  208. return false;
  209. }
  210. }
  211. }

2. WeChatConfig(微信支付配置)

  1. /**
  2. * 微信支付配置文件
  3. *
  4. * @author chenp
  5. */
  6. public class WeChatConfig {
  7. /**
  8. * 微信服务号APPID
  9. */
  10. public static String APPID = "wx76c8ad8ab54e6682";
  11. /**
  12. * 微信支付的商户号
  13. */
  14. public static String MCHID = "1537414481";
  15. /**
  16. * 微信支付的API密钥
  17. */
  18. public static String APIKEY = "38f50b7bc07c66b63d638ae851d50165";
  19. /**
  20. * 微信支付成功之后的回调地址【注意:当前回调地址必须是公网能够访问的地址】
  21. */
  22. public static String WECHAT_NOTIFY_URL_PC = "http://kyhvip.zicp.vip/Commercialization/wxPays";
  23. /**
  24. * 微信统一下单API地址
  25. */
  26. public static String UFDODER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
  27. /**
  28. * true为使用真实金额支付,false为使用测试金额支付(1分)
  29. */
  30. public static String WXPAY = "";
  31. }

3. PayForUtil(判断签名)

  1. import java.net.Inet4Address;
  2. import java.net.InetAddress;
  3. import java.net.InterfaceAddress;
  4. import java.net.NetworkInterface;
  5. import java.net.SocketException;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Date;
  8. import java.util.Enumeration;
  9. import java.util.Iterator;
  10. import java.util.List;
  11. import java.util.Map;
  12. import java.util.Set;
  13. import java.util.SortedMap;
  14. import org.apache.log4j.Logger;
  15. public class PayForUtil {
  16. private static Logger lg = Logger.getLogger(PayForUtil.class);
  17. /**
  18. * 是否签名正确,规则是:按参数名称a-z排序,遇到空值的参数不参加签名。
  19. *
  20. * @return boolean
  21. */
  22. public static boolean isTenpaySign(String characterEncoding, SortedMap<Object, Object> packageParams, String API_KEY) {
  23. StringBuffer sb = new StringBuffer();
  24. Set es = packageParams.entrySet();
  25. Iterator it = es.iterator();
  26. while (it.hasNext()) {
  27. Map.Entry entry = (Map.Entry) it.next();
  28. String k = (String) entry.getKey();
  29. String v = (String) entry.getValue();
  30. if (!"sign".equals(k) && null != v && !"".equals(v)) {
  31. sb.append(k + "=" + v + "&");
  32. }
  33. }
  34. sb.append("key=" + API_KEY);
  35. //算出摘要
  36. String mysign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toLowerCase();
  37. String tenpaySign = ((String) packageParams.get("sign")).toLowerCase();
  38. return tenpaySign.equals(mysign);
  39. }
  40. /**
  41. * @param characterEncoding 编码格式
  42. * @param parameters 请求参数
  43. * @return
  44. * @author chenp
  45. * @Description:sign签名
  46. */
  47. public static String createSign(String characterEncoding, SortedMap<Object, Object> packageParams, String API_KEY) {
  48. StringBuffer sb = new StringBuffer();
  49. Set es = packageParams.entrySet();
  50. Iterator it = es.iterator();
  51. while (it.hasNext()) {
  52. Map.Entry entry = (Map.Entry) it.next();
  53. String k = (String) entry.getKey();
  54. String v = (String) entry.getValue();
  55. if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k)) {
  56. sb.append(k + "=" + v + "&");
  57. }
  58. }
  59. sb.append("key=" + API_KEY);
  60. String sign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toUpperCase();
  61. return sign;
  62. }
  63. /**
  64. * @param parameters 请求参数
  65. * @return
  66. * @author chenp
  67. * @Description:将请求参数转换为xml格式的string
  68. */
  69. public static String getRequestXml(SortedMap<Object, Object> parameters) {
  70. StringBuffer sb = new StringBuffer();
  71. sb.append("<xml>");
  72. Set es = parameters.entrySet();
  73. Iterator it = es.iterator();
  74. while (it.hasNext()) {
  75. Map.Entry entry = (Map.Entry) it.next();
  76. String k = (String) entry.getKey();
  77. String v = (String) entry.getValue();
  78. if ("attach".equalsIgnoreCase(k) || "body".equalsIgnoreCase(k) || "sign".equalsIgnoreCase(k)) {
  79. sb.append("<" + k + ">" + "<![CDATA[" + v + "]]></" + k + ">");
  80. } else {
  81. sb.append("<" + k + ">" + v + "</" + k + ">");
  82. }
  83. }
  84. sb.append("</xml>");
  85. return sb.toString();
  86. }
  87. /**
  88. * 取出一个指定长度大小的随机正整数.
  89. *
  90. * @param length int 设定所取出随机数的长度。length小于11
  91. * @return int 返回生成的随机数。
  92. */
  93. public static int buildRandom(int length) {
  94. int num = 1;
  95. double random = Math.random();
  96. if (random < 0.1) {
  97. random = random + 0.1;
  98. }
  99. for (int i = 0; i < length; i++) {
  100. num = num * 10;
  101. }
  102. return (int) ((random * num));
  103. }
  104. /**
  105. * 获取当前时间 yyyyMMddHHmmss
  106. *
  107. * @return String
  108. * @author chenp
  109. */
  110. public static String getCurrTime() {
  111. Date now = new Date();
  112. SimpleDateFormat outFormat = new SimpleDateFormat("yyyyMMddHHmmss");
  113. String s = outFormat.format(now);
  114. return s;
  115. }
  116. /**
  117. * 获取本机IP地址
  118. *
  119. * @return
  120. * @author chenp
  121. */
  122. public static String localIp() {
  123. String ip = null;
  124. Enumeration allNetInterfaces;
  125. try {
  126. allNetInterfaces = NetworkInterface.getNetworkInterfaces();
  127. while (allNetInterfaces.hasMoreElements()) {
  128. NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
  129. List<InterfaceAddress> InterfaceAddress = netInterface.getInterfaceAddresses();
  130. for (InterfaceAddress add : InterfaceAddress) {
  131. InetAddress Ip = add.getAddress();
  132. if (Ip != null && Ip instanceof Inet4Address) {
  133. ip = Ip.getHostAddress();
  134. }
  135. }
  136. }
  137. } catch (SocketException e) {
  138. lg.warn("获取本机Ip失败:异常信息:" + e.getMessage());
  139. }
  140. return ip;
  141. }
  142. }

4. MD5Util(加密类)

  1. import java.security.MessageDigest;
  2. /**
  3. * Md5加密类
  4. *
  5. * @author chenp
  6. */
  7. public class MD5Util {
  8. private static String byteArrayToHexString(byte b[]) {
  9. StringBuffer resultSb = new StringBuffer();
  10. for (int i = 0; i < b.length; i++) {
  11. resultSb.append(byteToHexString(b[i]));
  12. }
  13. return resultSb.toString();
  14. }
  15. private static String byteToHexString(byte b) {
  16. int n = b;
  17. if (n < 0) {
  18. n += 256;
  19. }
  20. int d1 = n / 16;
  21. int d2 = n % 16;
  22. return hexDigits[d1] + hexDigits[d2];
  23. }
  24. public static String MD5Encode(String origin, String charsetname) {
  25. String resultString = null;
  26. try {
  27. resultString = new String(origin);
  28. MessageDigest md = MessageDigest.getInstance("MD5");
  29. if (charsetname == null || "".equals(charsetname)) {
  30. resultString = byteArrayToHexString(md.digest(resultString
  31. .getBytes()));
  32. } else {
  33. resultString = byteArrayToHexString(md.digest(resultString
  34. .getBytes(charsetname)));
  35. }
  36. } catch (Exception exception) {
  37. }
  38. return resultString;
  39. }
  40. private static final String hexDigits[] = {"0", "1", "2", "3", "4", "5",
  41. "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
  42. }

5. HttpUtil(Http请求)

  1. private final static int CONNECT_TIMEOUT = 5000; // in milliseconds 连接超时的时间
  2. private final static String DEFAULT_ENCODING = "UTF-8"; //字符串编码
  3. private static Logger lg = Logger.getLogger(HttpUtil.class);
  4. public static String postData(String urlStr, String data) {
  5. return postData(urlStr, data, null);
  6. }
  7. /**
  8. * post数据请求
  9. *
  10. * @param urlStr
  11. * @param data
  12. * @param contentType
  13. * @return
  14. */
  15. public static String postData(String urlStr, String data, String contentType) {
  16. BufferedReader reader = null;
  17. try {
  18. URL url = new URL(urlStr);
  19. URLConnection conn = url.openConnection();
  20. conn.setDoOutput(true);
  21. conn.setConnectTimeout(CONNECT_TIMEOUT);
  22. conn.setReadTimeout(CONNECT_TIMEOUT);
  23. if (contentType != null)
  24. conn.setRequestProperty("content-type", contentType);
  25. OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream(), DEFAULT_ENCODING);
  26. if (data == null)
  27. data = "";
  28. writer.write(data);
  29. writer.flush();
  30. writer.close();
  31. reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), DEFAULT_ENCODING));
  32. StringBuilder sb = new StringBuilder();
  33. String line = null;
  34. while ((line = reader.readLine()) != null) {
  35. sb.append(line);
  36. sb.append("\r\n");
  37. }
  38. return sb.toString();
  39. } catch (IOException e) {
  40. lg.info("Error connecting to " + urlStr + ": " + e.getMessage());
  41. } finally {
  42. try {
  43. if (reader != null) {
  44. reader.close();
  45. }
  46. } catch (IOException e) {
  47. }
  48. }
  49. return null;
  50. }
  51. }

6. WeChatParams(支付参数实体类)

  1. /**
  2. * 微信支付需要的一些参数
  3. *
  4. * @author chenp
  5. */
  6. //@Data//此注解代替了set、get方法,如果不想用这个注解也可以自己写set、get方法。
  7. public class WeChatParams {
  8. public String total_fee;//订单金额【备注:以分为单位】
  9. public String body;//商品名称
  10. public String out_trade_no;//商户订单号
  11. public String attach;//附加参数
  12. public String memberid;//会员ID
  13. public String getTotal_fee() {
  14. return total_fee;
  15. }
  16. public void setTotal_fee(String total_fee) {
  17. this.total_fee = total_fee;
  18. }
  19. public String getBody() {
  20. return body;
  21. }
  22. public void setBody(String body) {
  23. this.body = body;
  24. }
  25. public String getOut_trade_no() {
  26. return out_trade_no;
  27. }
  28. public void setOut_trade_no(String out_trade_no) {
  29. this.out_trade_no = out_trade_no;
  30. }
  31. public String getAttach() {
  32. return attach;
  33. }
  34. public void setAttach(String attach) {
  35. this.attach = attach;
  36. }
  37. public String getMemberid() {
  38. return memberid;
  39. }
  40. public void setMemberid(String memberid) {
  41. this.memberid = memberid;
  42. }
  43. }

7. XMLUtil(xml解析类)

  1. /**
  2. * 解析xml,返回第一级元素键值对。如果第一级元素有子节点,则此节点的值是子节点的xml数据。
  3. *
  4. * @param strxml
  5. * @return
  6. * @throws JDOMException
  7. * @throws IOException
  8. */
  9. public static Map doXMLParse(String strxml) throws JDOMException, IOException {
  10. strxml = strxml.replaceFirst("encoding=\".*\"", "encoding=\"UTF-8\"");
  11. if (null == strxml || "".equals(strxml)) {
  12. return null;
  13. }
  14. Map m = new HashMap();
  15. InputStream in = new ByteArrayInputStream(strxml.getBytes("UTF-8"));
  16. SAXBuilder builder = new SAXBuilder();
  17. Document doc = builder.build(in);
  18. Element root = doc.getRootElement();
  19. List list = root.getChildren();
  20. Iterator it = list.iterator();
  21. while (it.hasNext()) {
  22. Element e = (Element) it.next();
  23. String k = e.getName();
  24. String v = "";
  25. List children = e.getChildren();
  26. if (children.isEmpty()) {
  27. v = e.getTextNormalize();
  28. } else {
  29. v = XMLUtil.getChildrenText(children);
  30. }
  31. m.put(k, v);
  32. }
  33. //关闭流
  34. in.close();
  35. return m;
  36. }
  37. /**
  38. * 获取子结点的xml
  39. *
  40. * @param children
  41. * @return String
  42. */
  43. public static String getChildrenText(List children) {
  44. StringBuffer sb = new StringBuffer();
  45. if (!children.isEmpty()) {
  46. Iterator it = children.iterator();
  47. while (it.hasNext()) {
  48. Element e = (Element) it.next();
  49. String name = e.getName();
  50. String value = e.getTextNormalize();
  51. List list = e.getChildren();
  52. sb.append("<" + name + ">");
  53. if (!list.isEmpty()) {
  54. sb.append(XMLUtil.getChildrenText(list));
  55. }
  56. sb.append(value);
  57. sb.append("</" + name + ">");
  58. }
  59. }
  60. return sb.toString();
  61. }
  62. }

8. 支付案例,及回调案例

  1. /*
  2. *订单支付案例
  3. */
  4. @RequestMapping("/wxPay")
  5. public void wxPay(WeChatParams ps, HttpServletResponse response,HttpServletRequest request) {
  6. double a = 0.01;
  7. int soloa = (int) (a*100);
  8. ps.setBody("天赐场测试订单");
  9. ps.setTotal_fee(""+soloa);
  10. ps.setOut_trade_no("OR2019090210022");
  11. ps.setAttach("xiner");
  12. ps.setMemberid("888");
  13. String urlCode = null;
  14. try {
  15. urlCode = WeixinPay.getCodeUrl(ps);
  16. } catch (Exception e) {
  17. e.printStackTrace();
  18. }
  19. WeixinPay.encodeQrcode(urlCode,response);
  20. }
  21. /*
  22. *订单支付回调方法
  23. */
  24. @RequestMapping(value = "/wxPays")
  25. public void wxPays(HttpServletResponse response,HttpServletRequest request) throws Exception {
  26. boolean b = false;
  27. b = WeixinPay.wechat_notify_url_pc(request, response);
  28. if (true){
  29. login();
  30. }else {
  31. response.sendRedirect("/index/logins");
  32. }
  33. }

9.所需依赖

  1. <!--微信支付依赖-->
  2. <dependency>
  3. <groupId>jdom</groupId>
  4. <artifactId>jdom</artifactId>
  5. <version>1.1</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>commons-lang</groupId>
  9. <artifactId>commons-lang</artifactId>
  10. <version>2.6</version>
  11. </dependency>
  12. <dependency>
  13. <groupId>com.google.zxing</groupId>
  14. <artifactId>core</artifactId>
  15. <version>3.4.0</version>
  16. </dependency>
  17. <dependency>
  18. <groupId>com.thoughtworks.xstream</groupId>
  19. <artifactId>xstream</artifactId>
  20. <version>1.4.11.1</version>
  21. </dependency>