update 汇付

This commit is contained in:
2023-05-13 17:09:11 +08:00
parent 162e6c1d3b
commit 65429a44f0
2 changed files with 105 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Payment;
import com.jsowell.JsowellApplication;
import com.jsowell.adapay.common.CreateAdaPaymentParam;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
@@ -13,12 +14,15 @@ import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.common.util.http.HttpUtils;
import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.DictUtils;
import com.jsowell.common.util.JWTUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils;
import com.jsowell.common.util.id.SnUtils;
import com.jsowell.common.util.id.SnowflakeIdWorker;
import com.jsowell.common.util.ip.AddressUtils;
import com.jsowell.common.util.lianlian.LianLianUtils;
import com.jsowell.netty.command.ykc.IssueQRCodeCommand;
import com.jsowell.netty.command.ykc.ProofreadTimeCommand;
import com.jsowell.netty.handler.HeartbeatRequestHandler;
@@ -30,7 +34,15 @@ import com.jsowell.pile.domain.PileBillingDetail;
import com.jsowell.pile.domain.PileBillingTemplate;
import com.jsowell.pile.domain.PileStationInfo;
import com.jsowell.pile.domain.WxpayCallbackRecord;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.dto.BasicPileDTO;
import com.jsowell.pile.dto.BatchCreatePileDTO;
import com.jsowell.pile.dto.ImportBillingTemplateDTO;
import com.jsowell.pile.dto.LianLianGetTokenDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.QueryStationDTO;
import com.jsowell.pile.dto.RefundableWxPayOrderData;
import com.jsowell.pile.dto.WeixinPayDTO;
import com.jsowell.pile.mapper.MemberBasicInfoMapper;
import com.jsowell.pile.mapper.PileBillingTemplateMapper;
import com.jsowell.pile.service.IOrderBasicInfoService;
@@ -49,7 +61,6 @@ import com.jsowell.service.MemberService;
import com.jsowell.service.OrderService;
import com.jsowell.service.PileRemoteService;
import com.jsowell.service.PileService;
import com.jsowell.thirdparty.domain.StationInfo;
import com.jsowell.thirdparty.service.LianLianService;
import com.jsowell.wxpay.common.WeChatPayParameter;
import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO;
@@ -62,6 +73,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.StopWatch;
@@ -69,7 +81,13 @@ import org.springframework.util.StopWatch;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ActiveProfiles("dev")
@SpringBootTest(classes = JsowellApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -168,15 +186,30 @@ public class SpringBootTestController {
Map<String, Object> paymentParams = Maps.newHashMap();
paymentParams.put("order_no", "fasdftawefawefawsdcaseg");
paymentParams.put("pay_amt", "0.05");
paymentParams.put("app_id", "api_test_a6ac1931-11d6-4d76-8e73-086f8219c9e7");
paymentParams.put("app_id", "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa");
paymentParams.put("pay_channel", "wx_lite");
paymentParams.put("goods_title", "Your goods_title");
paymentParams.put("goods_desc", "Your goods_desc");
paymentParams.put("description", "payment Discription");
Map<String, Object> expendMap = Maps.newHashMap();
expendMap.put("open_id", "o4REX5PYTXvwl_YXs_aGrVAqCh_c");
paymentParams.put("expend", expendMap);
// paymentParams.put("div_members", [{"amount":"0.05", "fee_flag":"Y", "member_id":"member_id_test"}]);
// 调用创建方法,获取 Payment对象_
// 封装对象
CreateAdaPaymentParam createAdaPaymentParam = new CreateAdaPaymentParam();
createAdaPaymentParam.setOrder_no("fasdftawefawefawsdcaseg123");
createAdaPaymentParam.setPay_amt("0.05");
createAdaPaymentParam.setApp_id("app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa"); // todo 后面移动到配置文件中
createAdaPaymentParam.setPay_channel("wx_lite"); // todo 如果以后有支付宝等别的渠道,这里需要做修改,判断是什么渠道的请求
createAdaPaymentParam.setGoods_title("充电费用1");
createAdaPaymentParam.setGoods_desc("充电费用2");
createAdaPaymentParam.setDescription("充电费用3");
createAdaPaymentParam.setExpend(JSONObject.toJSONString( ImmutableMap.of("open_id", "o4REX5PYTXvwl_YXs_aGrVAqCh_c")));
try {
Map<String, Object> response = Payment.create(paymentParams);
// Map<String, Object> response = Payment.create(paymentParams);
Map<String, Object> response = Payment.create(BeanMap.create(createAdaPaymentParam));
System.out.println(response);
} catch (BaseAdaPayException e) {
e.printStackTrace();