X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2Futil%2FNotary.java;h=c349a0f92ad61f5fa8049f9c71e0643c28325b13;hb=2b830056b1464c52e071f1cf16e4e4304c63c6c7;hp=a619da53563e3b60f5d0849458ddf17f50b26b0a;hpb=08c941629aea14473e5c42ab6f5d590be4af4bf8;p=gigi.git diff --git a/src/club/wpia/gigi/util/Notary.java b/src/club/wpia/gigi/util/Notary.java index a619da53..c349a0f9 100644 --- a/src/club/wpia/gigi/util/Notary.java +++ b/src/club/wpia/gigi/util/Notary.java @@ -3,7 +3,6 @@ package club.wpia.gigi.util; import java.io.IOException; import java.text.ParseException; import java.util.Calendar; -import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Map; @@ -45,7 +44,7 @@ public class Notary { } public static boolean checkVerificationIsPossible(User agent, Name target) { - try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT 1 FROM `notary` where `to`=? and `from`=? and `method` = ? ::`notaryType` AND `deleted` IS NULL AND `when` > (now() - interval '1 days' * ?)")) { + try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT 1 FROM `notary` where `to`=? and `from`=? and `method` = ? ::`notaryType` AND `deleted` IS NULL AND `when` > (now() - interval '1 days' * ?::INTEGER)")) { ps.setInt(1, target.getId()); ps.setInt(2, agent.getId()); ps.setEnum(3, VerificationType.FACE_TO_FACE); @@ -55,9 +54,9 @@ public class Notary { } } - public static final Group AGENT_BLOCKED = Group.BLOCKEDASSURER; + public static final Group AGENT_BLOCKED = Group.BLOCKED_AGENT; - public static final Group APPLICANT_BLOCKED = Group.BLOCKEDASSUREE; + public static final Group APPLICANT_BLOCKED = Group.BLOCKED_APPLICANT; public static final Group VERIFY_NOTIFICATION = Group.VERIFY_NOTIFICATION; @@ -93,13 +92,11 @@ public class Notary { gae.mergeInto(new GigiApiException("You must enter the date when you met the applicant.")); } else { try { - Date d = DateSelector.getDateFormat().parse(date); - Calendar gc = GregorianCalendar.getInstance(); - gc.setTimeInMillis(System.currentTimeMillis()); - gc.add(Calendar.HOUR_OF_DAY, 12); - if (d.getTime() > gc.getTimeInMillis()) { + DayDate d = new DayDate(DateSelector.getDateFormat().parse(date).getTime()); + if (d.start().getTime() > System.currentTimeMillis()) { gae.mergeInto(new GigiApiException("You must not enter a date in the future.")); } + Calendar gc = GregorianCalendar.getInstance(); gc.setTimeInMillis(System.currentTimeMillis()); gc.add(Calendar.MONTH, -LIMIT_MAX_MONTHS_VERIFICATION); if (d.getTime() < gc.getTimeInMillis()) { @@ -207,12 +204,12 @@ public class Notary { } if (t == VerificationType.NUCLEUS) { - if ( !agent.isInGroup(Group.NUCLEUS_ASSURER)) { + if ( !agent.isInGroup(Group.NUCLEUS_AGENT)) { throw new GigiApiException("RA Agent needs to be Nucleus RA Agent."); } return; } else if (t == VerificationType.TTP_ASSISTED) { - if ( !agent.isInGroup(Group.TTP_ASSURER)) { + if ( !agent.isInGroup(Group.TTP_AGENT)) { throw new GigiApiException("RA Agent needs to be TTP RA Agent."); } if ( !applicant.isInGroup(Group.TTP_APPLICANT)) {