1
0
mirror of synced 2025-12-23 10:39:27 +08:00

🎨 #1458 微信支付createOrder方法增加一个重载实现

调用 WxPayService 的 <T> T createOrder(WxPayUnifiedOrderRequest request) 时,经常找源码来看返回什么样的实体类,再强制转换。

通常在业务中使用此方法时,可以明确交易类型,所以添加一个交易类型的类,设置交易类型的同时,顺便作为确定 createOrder 返回类型的参数传入。
This commit is contained in:
JoeWoo
2020-03-22 11:13:36 +08:00
committed by GitHub
parent 6f7bc7c02c
commit d3b58e3174
4 changed files with 93 additions and 0 deletions

View File

@@ -144,6 +144,24 @@ public class BaseWxPayServiceImplTest {
log.warn(this.payService.getWxApiData().toString());
}
@Test
public void testCreateOrderSpecific() throws Exception {
// Won't compile
// WxPayMpOrderResult result = payService.createOrder(TradeType.Specific.APP, new WxPayUnifiedOrderRequest());
payService.createOrder(
TradeType.Specific.JSAPI,
WxPayUnifiedOrderRequest.newBuilder()
.body("我去")
.totalFee(1)
.productId("aaa")
.spbillCreateIp("11.1.11.1")
.notifyUrl("111111")
.outTradeNo("111111290")
.build()
)
.getAppId();
}
/**
* Test get pay info.
*