| | |
| | | */ |
| | | package com.java110.api.smo.payment.adapt.wechatPay; |
| | | |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.api.properties.WechatAuthProperties; |
| | | import com.java110.api.smo.payment.adapt.IPayAdapt; |
| | | import com.java110.core.factory.WechatFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.smallWeChat.SmallWeChatDto; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.WechatConstant; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.util.PayUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum); |
| | | SortedMap<String, String> resultMap = new TreeMap<String, String>(); |
| | | //生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元 |
| | | double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue("HC_ENV"), money); |
| | | double payAmount = PayUtil.getPayAmountByEnv(MappingCache.getValue(MappingConstant.ENV_DOMAIN,"HC_ENV"), money); |
| | | //添加或更新支付记录(参数跟进自己业务需求添加) |
| | | |
| | | Map<String, String> resMap = null; |
| | |
| | | String tradeType, double payAmount, String openid, |
| | | SmallWeChatDto smallWeChatDto, String notifyUrl) throws Exception { |
| | | |
| | | String systemName = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_GOOD_NAME); |
| | | //String systemName = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_GOOD_NAME); |
| | | |
| | | if (feeName.length() > 127) { |
| | | feeName = feeName.substring(0, 126); |
| | | } |
| | | |
| | | SortedMap<String, String> paramMap = new TreeMap<String, String>(); |
| | | paramMap.put("appid", smallWeChatDto.getAppId()); |
| | | paramMap.put("mch_id", smallWeChatDto.getMchId()); |
| | | paramMap.put("nonce_str", PayUtil.makeUUID(32)); |
| | | paramMap.put("body", systemName + feeName); |
| | | paramMap.put("body", feeName); |
| | | paramMap.put("out_trade_no", orderNum); |
| | | paramMap.put("total_fee", PayUtil.moneyToIntegerStr(payAmount)); |
| | | paramMap.put("spbill_create_ip", PayUtil.getLocalIp()); |