微信支付完善

This commit is contained in:
xiafang
2020-12-09 14:56:34 +08:00
parent 2245657838
commit c600a3b76e
2 changed files with 5 additions and 8 deletions

View File

@@ -47,10 +47,7 @@ wechat:
domain: https://xxxx.xxx.com domain: https://xxxx.xxx.com
# 商户 api 证书 必填 # 商户 api 证书 必填
cert-path: apiclient_cert.p12 cert-path: apiclient_cert.p12
# 微信服务号 优惠券必须
mp:
app-id: xxxxxxxxx
app-secret: xxxxxxxxxxxxxxxxxxx
``` ```
然后启用`@EnableWechatPay`注解: 然后启用`@EnableWechatPay`注解:
```java ```java

View File

@@ -103,7 +103,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
private RequestEntity<?> sendStocksFunction(WechatPayV3Type type, StocksSendParams params) { private RequestEntity<?> sendStocksFunction(WechatPayV3Type type, StocksSendParams params) {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3(); WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
params.setAppid(v3.getApp().getAppId()); params.setAppid(v3.getAppId());
params.setStockCreatorMchid(v3.getMchId()); params.setStockCreatorMchid(v3.getMchId());
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA)) URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build() .build()
@@ -265,7 +265,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3(); WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(); MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
queryParams.add("appid", v3.getApp().getAppId()); queryParams.add("appid", v3.getAppId());
MultiValueMap<String, String> pathParams = new LinkedMultiValueMap<>(); MultiValueMap<String, String> pathParams = new LinkedMultiValueMap<>();
pathParams.add("openid", params.getOpenId()); pathParams.add("openid", params.getOpenId());
@@ -331,7 +331,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3(); WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(); MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
queryParams.add("appid", v3.getApp().getAppId()); queryParams.add("appid", v3.getAppId());
queryParams.add("creator_mchid", v3.getMchId()); queryParams.add("creator_mchid", v3.getMchId());
String senderMchId = params.getSenderMchId(); String senderMchId = params.getSenderMchId();
if (StringUtils.hasText(senderMchId)) { if (StringUtils.hasText(senderMchId)) {
@@ -451,7 +451,7 @@ public class WechatMarketingFavorApi extends AbstractApi {
* *
* @param notifyUrl the notify url * @param notifyUrl the notify url
* @return the wechat response entity * @return the wechat response entity
* @see WechatPayCallback#wechatPayCouponCallback(String, ResponseSignVerifyParams, Consumer) WechatPayCallback#wechatPayCouponCallback(ResponseSignVerifyParams, Consumer) * @see WechatPayCallback#couponCallback(ResponseSignVerifyParams, Consumer)
*/ */
public WechatResponseEntity<ObjectNode> setMarketingFavorCallback(String notifyUrl) { public WechatResponseEntity<ObjectNode> setMarketingFavorCallback(String notifyUrl) {
WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>(); WechatResponseEntity<ObjectNode> wechatResponseEntity = new WechatResponseEntity<>();