| | |
| | | package com.ks.vip.util; |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.google.gson.Gson; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.alipay.AlipayH5PayUtil; |
| | | import org.yeshi.utils.entity.alipay.AlipayAppInfo; |
| | | import org.yeshi.utils.entity.wx.WXAPPInfo; |
| | |
| | | import java.util.Properties; |
| | | |
| | | public class PayUtil { |
| | | |
| | | final static Logger logger = LoggerFactory.getLogger(PayUtil.class); |
| | | |
| | | |
| | | public static AlipayAppInfo getAlipayApp() { |
| | |
| | | String mchSerialNo = properties.getProperty("mch_serial_no"); |
| | | String apiV3Key = properties.getProperty("api_v3_key"); |
| | | |
| | | |
| | | WXAPPInfo app = new WXAPPInfo(appId, mchId, mchSerialNo, privateKey, apiV3Key); |
| | | |
| | | return app; |
| | |
| | | * @param money |
| | | * @return |
| | | */ |
| | | public static String getVipChargeAlipayForm(String goodsTitle, String orderNo, BigDecimal money,String notifyUrl,String returnUrl) { |
| | | public static String getVipChargeAlipayForm(String goodsTitle, String orderNo, BigDecimal money, String notifyUrl, String returnUrl) { |
| | | try { |
| | | AlipayAppInfo appInfo = getAlipayApp(); |
| | | String form = AlipayH5PayUtil.createOrderForm(appInfo, orderNo, money, goodsTitle, returnUrl, notifyUrl); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String createWXOrder(String ip, String orderNo, BigDecimal money, String title,String notifyUrl,String returnUrl) throws Exception { |
| | | public static String createWXOrder(String ip, String orderNo, BigDecimal money, String title, String notifyUrl, String returnUrl) throws Exception { |
| | | WXPlaceOrderParams params = new WXPlaceOrderParams(); |
| | | params.setIp(ip); |
| | | params.setOrderNo(orderNo); |
| | |
| | | params.setFee(money); |
| | | params.setBody(title); |
| | | params.setApp(getWXAPP()); |
| | | |
| | | logger.info("微信支付表单数据:{}", new Gson().toJson(params)); |
| | | String payUrl = WXPayV3Util.createH5Order(params, returnUrl); |
| | | return payUrl; |
| | | } |