From 99538ffc9b0066a4dd98fb100f17d5c0d541edba Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Fri, 17 Jan 2020 10:27:34 -0500 Subject: [PATCH] do not cache notification responses when system time has been changed (for example in a test) --- .../main/java/bubble/model/cloud/notify/NotificationType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationType.java b/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationType.java index 26c19df0..f81994db 100644 --- a/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationType.java +++ b/bubble-server/src/main/java/bubble/model/cloud/notify/NotificationType.java @@ -21,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap; import static bubble.ApiConstants.enumFromString; import static org.cobbzilla.util.daemon.ZillaRuntime.die; +import static org.cobbzilla.util.daemon.ZillaRuntime.getSystemTimeOffset; import static org.cobbzilla.util.json.JsonUtil.json; import static org.cobbzilla.util.reflect.ReflectionUtil.forName; import static org.cobbzilla.util.reflect.ReflectionUtil.instantiate; @@ -135,6 +136,7 @@ public enum NotificationType { // payment validation requests are never cached, because the response depends on data outside the message // specifically, if the user does not have any validated email address, an error is returned // but an identical notification can later return a different response, after the email has been validated - return this != payment_driver_validate; + // also, do not cache if the system time has been altered + return this != payment_driver_validate && getSystemTimeOffset() == 0; } }