@Override
 public String createOrder(
     String partnerId,
     String serverId,
     String partnerUserId,
     BigDecimal amount,
     String tradeName,
     String qn) {
   qn = "tkp_money" + qn;
   TradeInfo info = createOrderInfo(partnerId, serverId, partnerUserId, amount, tradeName, qn);
   try {
     PublicKey publicKey = RSAHelper.getPublicKey(HongKongSdk.instance().getPublicKey());
     // 加解密类
     Cipher cipher = Cipher.getInstance("RSA"); // Cipher.getInstance("RSA/ECB/PKCS1Padding");
     // 明文
     byte[] plainText = info.getTradeId().getBytes();
     // 加密
     cipher.init(Cipher.ENCRYPT_MODE, publicKey);
     byte[] enBytes = cipher.doFinal(plainText);
     info.setTradeId(Base64.encode(enBytes));
   } catch (Exception e) {
     logger.error("encode error!", e);
   }
   return Json.toJson(info);
 }
Exemple #2
0
 @Override
 public String createOrder(
     String partnerId,
     String serverId,
     String partnerUserId,
     BigDecimal amount,
     String tradeName) {
   String tradeNameDecode = tradeName;
   try {
     tradeNameDecode = new String(tradeNameDecode.getBytes("ISO_8859-1"));
   } catch (UnsupportedEncodingException e) {
     logger.error(e);
   }
   logger.info("Vivo createOrder tradeNameDecode = " + tradeNameDecode);
   TradeInfo info = createOrderInfo(partnerId, serverId, partnerUserId, amount, tradeName);
   info.setNotifyUrl("http://wapi.andr.hw.fantingame.com:80/webApi/vivoPayment.do");
   //		info.setNotifyUrl("http://203.195.190.121:8089/webApi/vivoPayment.do");
   logger.info("vivo orderInfo:" + info.getNotifyUrl());
   createServerOrder(info);
   return Json.toJson(info);
 }