Ejemplo n.º 1
0
 /**
  * 构造充值对账查询接口
  *
  * @param sParaTemp 请求参数集合
  * @return 表单提交HTML信息
  * @author taiqichao
  */
 public static String accountPageQueryForRecharge(Map<String, String> sParaTemp) {
   // 增加基本配置
   sParaTemp.put("service", "account.page.query");
   sParaTemp.put("partner", PaymentConstant.getInstance().getProperty("ALIPAY_PARTNER_RECHARGE"));
   sParaTemp.put("_input_charset", AlipayConfig.input_charset);
   // 除去数组中的空值和签名参数
   Map<String, String> sPara = AlipayCore.paraFilter(sParaTemp);
   // 生成签名结果
   String prestr =
       AlipayCore.createLinkString(sPara)
           + PaymentConstant.getInstance().getProperty("ALIPAY_KEY_RECHARGE");
   // 签名结果与签名方式加入请求提交参数组中
   sPara.put("sign", AlipayMd5Encrypt.md5(prestr));
   sPara.put("sign_type", AlipayConfig.sign_type);
   String url =
       PaymentConstant.getInstance().getProperty("ALIPAY_RECON_QUERY_URL")
           + "_input_charset="
           + AlipayConfig.input_charset;
   return HttpsUtil.requestPostForm(url, sPara, AlipayConfig.input_charset, "GBK");
 }
Ejemplo n.º 2
0
 /**
  * 验证消息是否是支付宝发出的合法消息
  *
  * @param params 通知返回来的参数数组
  * @return 验证结果
  */
 public static boolean verify(Map<String, String> params) {
   String mysign = getMysign(params);
   String responseTxt = "true";
   if (params.get("notify_id") != null) {
     String partner = PaymentConstant.getInstance().getProperty("ALIPAY_PARTNER");
     String veryfy_url =
         PaymentConstant.getInstance().getProperty("ALIPAY_REFUNDMENT_VERIFY_URL")
             + "service=notify_verify&partner="
             + partner
             + "&notify_id="
             + params.get("notify_id");
     responseTxt = HttpsUtil.requestPostForm(veryfy_url, new HashMap<String, String>());
   }
   String sign = "";
   if (params.get("sign") != null) {
     sign = params.get("sign");
   }
   if (mysign.equals(sign) && responseTxt.equals("true")) {
     return true;
   } else {
     return false;
   }
 }
Ejemplo n.º 3
0
 /**
  * 构造模拟远程HTTP的POST请求,获取支付宝的返回XML处理结果
  *
  * @param sParaTemp 请求参数数组
  * @param gateway 网关地址
  * @return 支付宝返回XML处理结果
  * @throws Exception
  */
 public static String sendPostInfo(Map<String, String> sParaTemp, String reqURL) {
   // 待请求参数数组
   Map<String, String> sPara = buildRequestPara(sParaTemp);
   String url = reqURL + "_input_charset=" + AlipayConfig.input_charset;
   return HttpsUtil.requestPostForm(url, sPara, AlipayConfig.input_charset, "GBK");
 }