feat:通知请求参数解密返回参数T支持String类型

main
tianhao 2026-05-26 11:10:38 +08:00
parent 4615b3fccd
commit 849aa32f4f
3 changed files with 7 additions and 5 deletions

View File

@ -101,7 +101,8 @@ public interface ApiClient {
String bodyCiphertext = requestJson.get("body").getAsString();
// 对称解密后body 明文
String bodyPlain = getProfile().getPrivacy().getSecretCipher().decrypt(Strings.toBytes(secretKeyPlain), Strings.toBytes(bodyCiphertext));
return Json.fromJson(bodyPlain, requestClass);
// T支持返回String
return requestClass == String.class ? requestClass.cast(bodyPlain) : Json.fromJson(bodyPlain, requestClass);
}
/**

View File

@ -19,9 +19,9 @@ public class NotifyHandler {
/**
*
*
* @param requestJsonStr JSON
* @param requestClass Class
* @return
* @param requestJsonStr JSONheaderbody
* @param requestClass Class
* @return Object
* @author H.T
* @since 2026/5/19
*/
@ -33,7 +33,7 @@ public class NotifyHandler {
*
*
* @param responseObject Object
* @return JSON
* @return JSONheaderbody
* @author H.T
* @since 2026/5/19
*/

View File

@ -35,6 +35,7 @@ class NotifyHandlerTest {
System.err.println(jsonObject);
System.out.println(notifyHandler.decryptRequest(jsonObject.toString(), OfflineRechargeRefundRequest.class));
System.out.println(notifyHandler.decryptRequest(jsonObject.toString(), String.class));
}
@Test