/** * 支付宝提交 微信接口<br> * * @author 侯杨<br> * 2014-9-21 * @update * @param * @return * @exception/throws * @see OrderManagerAction#getAlipayForm * @since vmaque1.5 */ private String getAlipayForm_PhoneWeixin( ConSumerOrderData conSumerOrderData, GoodsInfoData goodsInfoData) { HashMap<String, String> hm = new HashMap<String, String>(); hm.put("body", goodsInfoData.getGoodsDes()); // 填写在跳到支付宝页面上显示的付款内容信息 hm.put("subject", goodsInfoData.getGoodsName()); // 填写在跳到支付宝页面上显示的付款标题信息 hm.put("out_trade_no", conSumerOrderData.getOrderCode()); // 外部交易号,最好具有唯一性,在获取支付宝发来的付款信息时使用. hm.put("agent", AlipayConfig.partner); // partnerId(合作伙伴ID) hm.put("payment_type", "1"); // 支付类型 1=商品购买,2=服务购买,... hm.put("price", String.valueOf(conSumerOrderData.getPrice())); // 订单金额信息 hm.put("quantity", "1"); // 订单商品数量,一般都是写1,它是按照整个订单包来计算 return AlipayService.create_direct_token_by_userWeixin(hm); // securityCode(安全码) }
/** * 创建支付宝提交Form PC端<br> * * @author 冯鑫<br> * 2014-9-12 * @update * @param ConSumerOrderData conSumerOrderData * @return String * @see OrderManagerAction#getAlipayForm * @since vmaque1.5 */ private String getAlipayForm(ConSumerOrderData conSumerOrderData, GoodsInfoData goodsInfoData) { HashMap<String, String> hm = new HashMap<String, String>(); if (goodsInfoData.getGoodsDes() != null && !"".equals(goodsInfoData.getGoodsDes())) { hm.put("body", goodsInfoData.getGoodsDes().trim()); // 填写在跳到支付宝页面上显示的付款内容信息 } hm.put("subject", goodsInfoData.getGoodsName()); // 填写在跳到支付宝页面上显示的付款标题信息 hm.put("out_trade_no", conSumerOrderData.getOrderCode()); // 外部交易号,最好具有唯一性,在获取支付宝发来的付款信息时使用. hm.put("agent", AlipayConfig.partner); // partnerId(合作伙伴ID) hm.put("payment_type", "1"); // 支付类型 1=商品购买,2=服务购买,... hm.put("price", String.valueOf(conSumerOrderData.getPrice())); // 订单金额信息 /*hm.put("price","0.01");//订单金额信息 */ hm.put("quantity", "1"); // 订单商品数量,一般都是写1,它是按照整个订单包来计算 hm.put( "extra_common_param", conSumerUserData.getRedPackageId() + "_" + conSumerUserData.getcId() + "_" + conSumerUserData.getsId()); // 红包使用自定义参数 return AlipayService.create_direct_pay_by_user(hm); // securityCode(安全码) }
/** * 生成订单,跳转到微信支付<br> * * @author 侯杨<br> * 2015-01-13 * @throws IOException * @update * @see OrderManagerAction#toweixinPayOrder * @since vmaque2.0 */ public void toweixinPayOrder() throws IOException { String price = request.getParameter("price"); String paytype = request.getParameter("paytype"); // 支付方式 // 商品总价赋值 conSumerUserData.setPayType(Integer.parseInt(paytype)); commodityConfigData.setConfigPrice(Double.parseDouble(price)); conSumerOrderData = orderManagerFacade.createOrder( commodityConfigData, conSumerUserData, pageDomainName, goodsNum); GoodsInfoData goodsInfoData = new GoodsInfoData(); goodsInfoData.setId(commodityConfigData.getGoodsInfoData().getId()); goodsInfoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData); conSumerOrderData.setPrice(Double.parseDouble(price)); conSumerOrderData.setGoodsName(goodsInfoData.getGoodsName()); if (conSumerOrderData != null) { conSumerOrderData.setConSumerUserData(conSumerUserData); JSONObject object = JSONObject.fromObject(conSumerOrderData); response.getWriter().print(object); } else { response.getWriter().print("1"); } }