Skip to content

Commit 9149cd4

Browse files
committed
#1088 微信支付结果通知内容细微调整,希望能解决部分人遇到的变态问题
1 parent b346224 commit 9149cd4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayNotifyResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static String fail(String msg) {
4444
WxPayNotifyResponse response = new WxPayNotifyResponse(FAIL, msg);
4545
XStream xstream = XStreamInitializer.getInstance();
4646
xstream.autodetectAnnotations(true);
47-
return xstream.toXML(response);
47+
return xstream.toXML(response).replace("\n", "").replace(" ", "");
4848
}
4949

5050
/**
@@ -57,7 +57,7 @@ public static String success(String msg) {
5757
WxPayNotifyResponse response = new WxPayNotifyResponse(SUCCESS, msg);
5858
XStream xstream = XStreamInitializer.getInstance();
5959
xstream.autodetectAnnotations(true);
60-
return xstream.toXML(response);
60+
return xstream.toXML(response).replace("\n", "").replace(" ", "");
6161
}
6262

6363
}

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayNotifyResponseTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public class WxPayNotifyResponseTest {
1515
@Test
1616
public void testSuccess() {
1717
final String result = WxPayNotifyResponse.success("OK");
18-
assertThat(result).isEqualTo("<xml>\n" +
19-
" <return_code><![CDATA[SUCCESS]]></return_code>\n" +
20-
" <return_msg><![CDATA[OK]]></return_msg>\n" +
18+
assertThat(result).isEqualTo("<xml>" +
19+
"<return_code><![CDATA[SUCCESS]]></return_code>" +
20+
"<return_msg><![CDATA[OK]]></return_msg>" +
2121
"</xml>");
2222
}
2323
}

0 commit comments

Comments
 (0)