| | |
| | | package cc.mrbird.febs; |
| | | |
| | | import cc.mrbird.febs.pay.properties.WxPayProperties; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.lang.UUID; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.response.AlipayTradeAppPayResponse; |
| | | import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult; |
| | | import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; |
| | | import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.ijpay.alipay.AliPayApi; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | /** |
| | |
| | | @SpringBootTest |
| | | public class PayTest { |
| | | |
| | | // @Test |
| | | // public void aliPay() throws AlipayApiException { |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody("这是测试用"); |
| | | // model.setSubject("支付测试用的"); |
| | | // model.setOutTradeNo("2021092712215802974"); |
| | | // model.setTimeoutExpress("15m"); |
| | | // model.setTotalAmount("0.01"); |
| | | // model.setPassbackParams("callback params"); |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // AlipayTradeAppPayResponse resp = AliPayApi.appPayToResponse(model, ""); |
| | | // log.info("=====>>>{}", JSONObject.toJSONString(resp)); |
| | | // } |
| | | // |
| | | // @Autowired |
| | | // private WxPayService wxPayService; |
| | | // |
| | | // @Autowired |
| | | // private WxPayProperties wxPayProperties; |
| | | // |
| | | // @Test |
| | | // public void wxPayTest() { |
| | | // WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); |
| | | // request.setAppid(wxPayProperties.getAppId()); |
| | | // request.setMchId(wxPayProperties.getMchId()); |
| | | // request.setNotifyUrl(wxPayProperties.getNoticeUrl()); |
| | | // request.setBody("这是body"); |
| | | // request.setOutTradeNo(RandomUtil.randomString(32)); |
| | | // request.setTimeExpire("20230407114500"); |
| | | // request.setSpbillCreateIp("127.0.0.1"); |
| | | // request.setTradeType("APP"); |
| | | // request.setTotalFee(1); |
| | | // try { |
| | | // WxPayAppOrderResult result = wxPayService.createOrder(request); |
| | | // System.out.println(1111); |
| | | // } catch (WxPayException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | } |