Codota Logo
WechatPayCoreConfig
Code IndexAdd Codota to your IDE (free)

How to use
WechatPayCoreConfig
in
cn.minsin.core.init

Best Java code snippets using cn.minsin.core.init.WechatPayCoreConfig (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: cn.minsin/mutils-wechat-wechatpay-core

/**
 * 生成签名
 * 
 * @param sortMap
 * @return
 */
protected static String createSign(SortedMap<String, String> sortMap) {
  return SignUtil.createSign(sortMap, payconfig.getPartnerKey());
}
origin: cn.minsin/mutils-wechat-wechatpay-core

/**
 * 发起微信转账(提现)
 * 
 * @param model 发起提现的包装类
 * @return
 * @throws MutilsErrorException
 */
public static Map<String, String> createWithdrawXml(WithdrawModel model) throws MutilsErrorException {
  String xml = model.toXml(payconfig.getPartnerKey());
  log.info("withdraw xml is {}", xml);
  CloseableHttpClient httpclient = null;
  CloseableHttpResponse response = null;
  try {
    httpclient = HttpClientUtil.getSSLInstance(payconfig.getPartnerId(), payconfig.getCertificatePath(),
        payconfig.getCertificateFormat());
    HttpPost httpost = HttpClientUtil.getPostMethod(payconfig.getWithdrawUrl());
    httpost.setEntity(new StringEntity(xml, "UTF-8"));
    response = httpclient.execute(httpost);
    String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
    log.info("withdraw json is {}", jsonStr);
    return ParseXmlUtil.doXMLParse(jsonStr);
  } catch (Exception e) {
    throw new MutilsErrorException(e, "发起转账失败");
  } finally {
    IOUtil.close(httpclient, response);
  }
}
origin: cn.minsin/mutils-wechat-wechatpay-core

/**
 * 发起退款申请
 * 
 * @param model
 * @return
 * @throws MutilsErrorException
 */
protected static RefundReturnModel createRefundRequest(RefundModel model) throws MutilsErrorException {
  String xmlParam = model.toXml(payconfig.getPartnerKey());
  log.info("refund xml is {}", xmlParam);
  CloseableHttpClient httpclient = null;
  CloseableHttpResponse response = null;
  try {
    httpclient = HttpClientUtil.getSSLInstance(payconfig.getPartnerId(), payconfig.getCertificatePath(),
        payconfig.getCertificateFormat());
    HttpPost httpost = HttpClientUtil.getPostMethod(payconfig.getRefundUrl());
    httpost.setEntity(new StringEntity(xmlParam, "UTF-8"));
    response = httpclient.execute(httpost);
    String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
    log.info("refund json is {}", jsonStr);
    return MapUtil.mapToObject(ParseXmlUtil.doXMLParse(jsonStr), RefundReturnModel.class);
  } catch (Exception e) {
    throw new MutilsErrorException(e, "发起退款失败");
  } finally {
    IOUtil.close(httpclient, response);
  }
}
origin: cn.minsin/mutils-wechat-app

/**
 * 创建APP支付的请求参数 APP将用其发起微信支付
 * 
 * @param model 下单时的包装对象
 * @return APP能发起的请求的包装内容
 * @throws Exception 
 */
public static Map<String, String> createAppPayParamter(AppOrderPayModel model) throws Exception{
    Map<String, String> doXMLParse = createUnifiedOrder(model);
    checkMap(doXMLParse);
    SortedMap<String, String> sortMap = new TreeMap<>();
    String appId = doXMLParse.get("appid");
    String nonceStr = doXMLParse.get("nonce_str");
    String prepayid = doXMLParse.get("prepay_id");
    String timeStamp = String.valueOf(System.currentTimeMillis() / 1000);
    sortMap.put("appid", appId);
    sortMap.put("partnerid", payconfig.getPartnerId());
    sortMap.put("noncestr", nonceStr);
    sortMap.put("package", "Sign=WXPay");
    sortMap.put("timestamp", timeStamp);
    sortMap.put("prepayid", prepayid);
    sortMap.put("sign", createSign(sortMap));
    return sortMap;
}
 
origin: cn.minsin/mutils-wechat-wechatpay-core

/**
 * 统一下单接口 用于生成 预支付id 及二维码id
 * 
 * @param model 预下单的对象
 * @return
 * @throws ParseException 
 * @throws MutilsErrorException
 * @throws IOException
 * @throws JDOMException 
 */
protected static Map<String, String> createUnifiedOrder(BaseWeChatPayModel model) throws ParseException, IOException, MutilsErrorException, JDOMException {
  CloseableHttpClient httpclient = HttpClientUtil.getInstance();// 先初始化;
  CloseableHttpResponse response = null;
  try {
    HttpPost httpost = HttpClientUtil.getPostMethod(payconfig.getUnifiedOrderUrl());
    String xmlParam = model.toXml(payconfig.getPartnerKey());
    log.info("createUnifiedOrder xml is {}", xmlParam);
    httpost.setEntity(new StringEntity(xmlParam, "UTF-8"));
    response = httpclient.execute(httpost);
    String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
    log.info("createUnifiedOrder json is {}", jsonStr);
    if (jsonStr.indexOf("FAIL") != -1) {
      throw new MutilsErrorException(jsonStr);
    }
    return ParseXmlUtil.doXMLParse(jsonStr);
  } finally {
    IOUtil.close(httpclient, response);
  }
}
cn.minsin.core.initWechatPayCoreConfig

Most used methods

  • getPartnerId
  • getCertificateFormat
  • getCertificatePath
  • getPartnerKey
  • getRefundUrl
  • getUnifiedOrderUrl
  • getWithdrawUrl

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • runOnUiThread (Activity)
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now