@@ -52,9 +52,10 @@ class RealOptOutConfirmationReporter @Inject constructor(
5252 if (activeBrokers.isEmpty() || allValidRequestedOptOutJobs.isEmpty()) return @withContext
5353
5454 allValidRequestedOptOutJobs.also {
55+ // Fire 7 day pixel
5556 it.attemptFirePixelForConfirmationDay(
5657 activeBrokers,
57- 7 ,
58+ INTERVAL_DAY_7 ,
5859 { jobRecord -> jobRecord.confirmation7dayReportSentDateMs == 0L },
5960 { brokerUrl -> pixelSender.reportBrokerOptOutConfirmed7Days(brokerUrl) },
6061 { brokerUrl -> pixelSender.reportBrokerOptOutUnconfirmed7Days(brokerUrl) },
@@ -63,9 +64,10 @@ class RealOptOutConfirmationReporter @Inject constructor(
6364 },
6465 )
6566
67+ // Fire 14 day pixel
6668 it.attemptFirePixelForConfirmationDay(
6769 activeBrokers,
68- 14 ,
70+ INTERVAL_DAY_14 ,
6971 { jobRecord -> jobRecord.confirmation14dayReportSentDateMs == 0L },
7072 { brokerUrl -> pixelSender.reportBrokerOptOutConfirmed14Days(brokerUrl) },
7173 { brokerUrl -> pixelSender.reportBrokerOptOutUnconfirmed14Days(brokerUrl) },
@@ -74,16 +76,29 @@ class RealOptOutConfirmationReporter @Inject constructor(
7476 },
7577 )
7678
79+ // Fire 21 day pixel
7780 it.attemptFirePixelForConfirmationDay(
7881 activeBrokers,
79- 21 ,
82+ INTERVAL_DAY_21 ,
8083 { jobRecord -> jobRecord.confirmation21dayReportSentDateMs == 0L },
8184 { brokerUrl -> pixelSender.reportBrokerOptOutConfirmed21Days(brokerUrl) },
8285 { brokerUrl -> pixelSender.reportBrokerOptOutUnconfirmed21Days(brokerUrl) },
8386 { jobRecord, now ->
8487 pirSchedulingRepository.markOptOutDay21ConfirmationPixelSent(jobRecord.extractedProfileId, now)
8588 },
8689 )
90+
91+ // Fire 42 day pixel
92+ it.attemptFirePixelForConfirmationDay(
93+ activeBrokers,
94+ INTERVAL_DAY_42 ,
95+ { jobRecord -> jobRecord.confirmation42dayReportSentDateMs == 0L },
96+ { brokerUrl -> pixelSender.reportBrokerOptOutConfirmed42Days(brokerUrl) },
97+ { brokerUrl -> pixelSender.reportBrokerOptOutUnconfirmed42Days(brokerUrl) },
98+ { jobRecord, now ->
99+ pirSchedulingRepository.markOptOutDay42ConfirmationPixelSent(jobRecord.extractedProfileId, now)
100+ },
101+ )
87102 }
88103 }
89104 }
@@ -120,4 +135,11 @@ class RealOptOutConfirmationReporter @Inject constructor(
120135 ): Boolean {
121136 return now >= this .optOutRequestedDateInMillis + TimeUnit .DAYS .toMillis(interval)
122137 }
138+
139+ companion object {
140+ private const val INTERVAL_DAY_7 = 7L
141+ private const val INTERVAL_DAY_14 = 14L
142+ private const val INTERVAL_DAY_21 = 21L
143+ private const val INTERVAL_DAY_42 = 42L
144+ }
123145}
0 commit comments