fix: 微信支付V3退款测试异常

Closes #8
This commit is contained in:
felord.cn
2021-02-04 21:18:11 +08:00
committed by felord.cn
parent 043ccfd08f
commit 977a6b33a4
3 changed files with 43 additions and 3 deletions

View File

@@ -18,8 +18,46 @@
package cn.felord.payment.wechat.enumeration;
/**
* 退款成功事件.
*
* @author felord.cn
* @since 1.0.6.RELEASE
*/
public enum RefundStatus {
/**
* 退款异常事件.
*
* @since 1.0.6.RELEASE
*/
ABNORMAL("REFUND.ABNORMAL"),
/**
* 退款关闭事件.
*
* @since 1.0.6.RELEASE
*/
CLOSED("REFUND.CLOSED"),
/**
* 支付成功事件.
*
* @since 1.0.0.RELEASE
*/
TRANSACTION("TRANSACTION.SUCCESS");
/**
* The Event.
*/
private final String refundStatus;
/**
* Instantiates a new Event type.
*
* @param refundStatus the event
*/
RefundStatus(String refundStatus) {
this.refundStatus = refundStatus;
}
public String getRefundStatus() {
return refundStatus;
}
}

View File

@@ -280,6 +280,8 @@ public class WechatDirectPayApi extends AbstractApi {
URI uri = UriComponentsBuilder.fromHttpUrl(type.uri(WeChatServer.CHINA))
.build()
.toUri();
WechatPayProperties.V3 v3 = this.wechatMetaBean().getV3();
params.setNotifyUrl(v3.getDomain().concat(params.getNotifyUrl()));
return Post(uri, params);
}))
.consumer(wechatResponseEntity::convert)

View File

@@ -283,9 +283,9 @@ public class WechatPayCallback {
CallbackParams callbackParams = resolve(params);
String eventType = callbackParams.getEventType();
if (!Objects.equals(eventType, EventType.REFUND_CLOSED.event)||
!Objects.equals(eventType,EventType.REFUND_ABNORMAL.event)||
!Objects.equals(eventType,EventType.REFUND_SUCCESS.event)) {
if (!(Objects.equals(eventType, EventType.REFUND_CLOSED.event) ||
Objects.equals(eventType, EventType.REFUND_ABNORMAL.event) ||
Objects.equals(eventType, EventType.REFUND_SUCCESS.event))) {
log.error("wechat pay event type is not matched, callbackParams {}", callbackParams);
throw new PayException(" wechat pay event type is not matched");
}