@Test public void testCreateSign() throws Exception { }
@Override public String createSign(Long accountId, OrderFormData formData) throws Exception { Date date = new Date(); Orders order = formData.getOrder(); List<CommodityAmount> caList = formData.getCaList(); Long orderId = getRebuildOrderId(accountId, date, order); String orderTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + orderId; Map<String, String> map = new HashMap<String, String>(); map.put("app_id", AlipayConfig.partner); map.put("method", "alipay.trade.app.pay"); map.put("format", "json"); map.put("charset", "utf-8"); map.put("sign_type", "RSA"); map.put("version", "1.0"); map.put("notify_url", "===="); Map<String, String> m = new HashMap<String, String>(); m.put("body", "测试"); m.put("subject", ""); m.put("out_trade_no", orderTradeNo); m.put("timeout_express", "30m"); m.put("total_amount", order.getPrice()+""); m.put("seller_id", AlipayConfig.partner); m.put("product_code", "QUICK_MSECURITY_PAY"); JSONObject bizcontentJson= JSON.parseObject(JSONObject.toJSONString(m)); map.put("biz_content", bizcontentJson.toString()); String rsaSign = AlipaySignature.rsaSign(map, AlipayConfig.private_key, "utf-8"); Map<String, String> map4 = new HashMap<String, String>(); map4.put("method", "alipay.trade.app.pay"); map4.put("format", "json"); map4.put("charset", "utf-8"); map4.put("sign_type", "RSA"); map4.put("version", "1.0"); map4.put("notify_url", URLEncoder.encode("==","UTF-8")); map4.put("biz_content", URLEncoder.encode(bizcontentJson.toString(), "UTF-8")); String json4 = ""; json4=json4 + "&sign=" + URLEncoder.encode(rsaSign, "UTF-8"); return json4.toString(); }
AliPayServiceImpl implements IAliPayService { @Override public String createSign(Long accountId, OrderFormData formData) throws Exception { Date date = new Date(); Orders order = formData.getOrder(); List<CommodityAmount> caList = formData.getCaList(); Long orderId = getRebuildOrderId(accountId, date, order); String orderTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + orderId; Map<String, String> map = new HashMap<String, String>(); map.put("app_id", AlipayConfig.partner); map.put("method", "alipay.trade.app.pay"); map.put("format", "json"); map.put("charset", "utf-8"); map.put("sign_type", "RSA"); map.put("version", "1.0"); map.put("notify_url", "===="); Map<String, String> m = new HashMap<String, String>(); m.put("body", "测试"); m.put("subject", ""); m.put("out_trade_no", orderTradeNo); m.put("timeout_express", "30m"); m.put("total_amount", order.getPrice()+""); m.put("seller_id", AlipayConfig.partner); m.put("product_code", "QUICK_MSECURITY_PAY"); JSONObject bizcontentJson= JSON.parseObject(JSONObject.toJSONString(m)); map.put("biz_content", bizcontentJson.toString()); String rsaSign = AlipaySignature.rsaSign(map, AlipayConfig.private_key, "utf-8"); Map<String, String> map4 = new HashMap<String, String>(); map4.put("method", "alipay.trade.app.pay"); map4.put("format", "json"); map4.put("charset", "utf-8"); map4.put("sign_type", "RSA"); map4.put("version", "1.0"); map4.put("notify_url", URLEncoder.encode("==","UTF-8")); map4.put("biz_content", URLEncoder.encode(bizcontentJson.toString(), "UTF-8")); String json4 = ""; json4=json4 + "&sign=" + URLEncoder.encode(rsaSign, "UTF-8"); return json4.toString(); } }
AliPayServiceImpl implements IAliPayService { @Override public String createSign(Long accountId, OrderFormData formData) throws Exception { Date date = new Date(); Orders order = formData.getOrder(); List<CommodityAmount> caList = formData.getCaList(); Long orderId = getRebuildOrderId(accountId, date, order); String orderTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + orderId; Map<String, String> map = new HashMap<String, String>(); map.put("app_id", AlipayConfig.partner); map.put("method", "alipay.trade.app.pay"); map.put("format", "json"); map.put("charset", "utf-8"); map.put("sign_type", "RSA"); map.put("version", "1.0"); map.put("notify_url", "===="); Map<String, String> m = new HashMap<String, String>(); m.put("body", "测试"); m.put("subject", ""); m.put("out_trade_no", orderTradeNo); m.put("timeout_express", "30m"); m.put("total_amount", order.getPrice()+""); m.put("seller_id", AlipayConfig.partner); m.put("product_code", "QUICK_MSECURITY_PAY"); JSONObject bizcontentJson= JSON.parseObject(JSONObject.toJSONString(m)); map.put("biz_content", bizcontentJson.toString()); String rsaSign = AlipaySignature.rsaSign(map, AlipayConfig.private_key, "utf-8"); Map<String, String> map4 = new HashMap<String, String>(); map4.put("method", "alipay.trade.app.pay"); map4.put("format", "json"); map4.put("charset", "utf-8"); map4.put("sign_type", "RSA"); map4.put("version", "1.0"); map4.put("notify_url", URLEncoder.encode("==","UTF-8")); map4.put("biz_content", URLEncoder.encode(bizcontentJson.toString(), "UTF-8")); String json4 = ""; json4=json4 + "&sign=" + URLEncoder.encode(rsaSign, "UTF-8"); return json4.toString(); }  }
AliPayServiceImpl implements IAliPayService { @Override public String createSign(Long accountId, OrderFormData formData) throws Exception { Date date = new Date(); Orders order = formData.getOrder(); List<CommodityAmount> caList = formData.getCaList(); Long orderId = getRebuildOrderId(accountId, date, order); String orderTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + orderId; Map<String, String> map = new HashMap<String, String>(); map.put("app_id", AlipayConfig.partner); map.put("method", "alipay.trade.app.pay"); map.put("format", "json"); map.put("charset", "utf-8"); map.put("sign_type", "RSA"); map.put("version", "1.0"); map.put("notify_url", "===="); Map<String, String> m = new HashMap<String, String>(); m.put("body", "测试"); m.put("subject", ""); m.put("out_trade_no", orderTradeNo); m.put("timeout_express", "30m"); m.put("total_amount", order.getPrice()+""); m.put("seller_id", AlipayConfig.partner); m.put("product_code", "QUICK_MSECURITY_PAY"); JSONObject bizcontentJson= JSON.parseObject(JSONObject.toJSONString(m)); map.put("biz_content", bizcontentJson.toString()); String rsaSign = AlipaySignature.rsaSign(map, AlipayConfig.private_key, "utf-8"); Map<String, String> map4 = new HashMap<String, String>(); map4.put("method", "alipay.trade.app.pay"); map4.put("format", "json"); map4.put("charset", "utf-8"); map4.put("sign_type", "RSA"); map4.put("version", "1.0"); map4.put("notify_url", URLEncoder.encode("==","UTF-8")); map4.put("biz_content", URLEncoder.encode(bizcontentJson.toString(), "UTF-8")); String json4 = ""; json4=json4 + "&sign=" + URLEncoder.encode(rsaSign, "UTF-8"); return json4.toString(); }  JSONObject createTemporaryOrder(OrderFormData data); @CachePut(key = "#data.order.id+''+#data.order.userAccountId") OrderFormData putCacheOrderFormData(OrderFormData data); @Cacheable(key = "#data.order.id+''+#data.order.userAccountId") OrderFormData getCacheTemporaryOrder(OrderFormData data); @CacheEvict(key = "#data.order.id+''+#data.order.userAccountId") void removeTemporaryOrder(OrderFormData data); @Override boolean checkAliPayOrderValidator(Map params); @Override String createSign(Long accountId, OrderFormData formData); }
AliPayServiceImpl implements IAliPayService { @Override public String createSign(Long accountId, OrderFormData formData) throws Exception { Date date = new Date(); Orders order = formData.getOrder(); List<CommodityAmount> caList = formData.getCaList(); Long orderId = getRebuildOrderId(accountId, date, order); String orderTradeNo = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + orderId; Map<String, String> map = new HashMap<String, String>(); map.put("app_id", AlipayConfig.partner); map.put("method", "alipay.trade.app.pay"); map.put("format", "json"); map.put("charset", "utf-8"); map.put("sign_type", "RSA"); map.put("version", "1.0"); map.put("notify_url", "===="); Map<String, String> m = new HashMap<String, String>(); m.put("body", "测试"); m.put("subject", ""); m.put("out_trade_no", orderTradeNo); m.put("timeout_express", "30m"); m.put("total_amount", order.getPrice()+""); m.put("seller_id", AlipayConfig.partner); m.put("product_code", "QUICK_MSECURITY_PAY"); JSONObject bizcontentJson= JSON.parseObject(JSONObject.toJSONString(m)); map.put("biz_content", bizcontentJson.toString()); String rsaSign = AlipaySignature.rsaSign(map, AlipayConfig.private_key, "utf-8"); Map<String, String> map4 = new HashMap<String, String>(); map4.put("method", "alipay.trade.app.pay"); map4.put("format", "json"); map4.put("charset", "utf-8"); map4.put("sign_type", "RSA"); map4.put("version", "1.0"); map4.put("notify_url", URLEncoder.encode("==","UTF-8")); map4.put("biz_content", URLEncoder.encode(bizcontentJson.toString(), "UTF-8")); String json4 = ""; json4=json4 + "&sign=" + URLEncoder.encode(rsaSign, "UTF-8"); return json4.toString(); }  JSONObject createTemporaryOrder(OrderFormData data); @CachePut(key = "#data.order.id+''+#data.order.userAccountId") OrderFormData putCacheOrderFormData(OrderFormData data); @Cacheable(key = "#data.order.id+''+#data.order.userAccountId") OrderFormData getCacheTemporaryOrder(OrderFormData data); @CacheEvict(key = "#data.order.id+''+#data.order.userAccountId") void removeTemporaryOrder(OrderFormData data); @Override boolean checkAliPayOrderValidator(Map params); @Override String createSign(Long accountId, OrderFormData formData);  }