mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #1556 增加微信支付或退款回调的时候返回xml字符串方法
This commit is contained in:
@@ -60,4 +60,31 @@ public class WxPayNotifyResponse {
|
||||
return xstream.toXML(response).replace("\n", "").replace(" ", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fail string.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @return the string
|
||||
*/
|
||||
public static String failResp(String msg) {
|
||||
return generateXml(FAIL, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Success string.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @return the string
|
||||
*/
|
||||
public static String successResp(String msg) {
|
||||
return generateXml(SUCCESS, msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 使用格式化字符串生成xml字符串
|
||||
*/
|
||||
private static String generateXml(String code, String msg) {
|
||||
return String.format("<xml><return_code><![CDATA[%s]]></return_code><return_msg><![CDATA[%s]]></return_msg></xml>", code, msg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user