@@ -98,6 +98,7 @@ public function testWrongTypeWithoutValidation(string $method, string $field): v
9898 'phone_was_verification_successful ' ,
9999 'was_3d_secure_successful ' ,
100100 'was_authorized ' ,
101+ 'was_verification_successful ' ,
101102 ];
102103 if (\in_array ($ field , $ booleans , true )) {
103104 $ values [] = 'true ' ;
@@ -141,7 +142,7 @@ public static function allFields(): array
141142 'withDevice ' => [
142143 'accept_language ' , 'ip_address ' , 'session_age ' , 'session_id ' , 'tracking_token ' , 'user_agent ' ,
143144 ],
144- 'withEmail ' => ['address ' , 'domain ' ],
145+ 'withEmail ' => ['address ' , 'domain ' , ' verification_time ' , ' was_verification_successful ' ],
145146 'withEvent ' => ['party ' , 'shop_id ' , 'time ' , 'transaction_id ' , 'type ' ],
146147 'withOrder ' => [
147148 'affiliate_id ' , 'amount ' , 'currency ' , 'discount_code ' , 'has_gift_message ' , 'is_gift ' ,
@@ -342,7 +343,11 @@ public static function invalidValues(): array
342343 'token ' => '4111111111111111 ' ,
343344 ]],
344345 'withDevice ' => ['device ' , ['ip_address ' => 'not an IP ' , 'session_age ' => -1.5 , 'session_id ' => '' ]],
345- 'withEmail ' => ['email ' , ['address ' => 'not an email ' , 'domain ' => 'not a domain ' ]],
346+ 'withEmail ' => ['email ' , [
347+ 'address ' => 'not an email ' ,
348+ 'domain ' => 'not a domain ' ,
349+ 'verification_time ' => 'not a time ' ,
350+ ]],
346351 'withEvent ' => ['event ' , ['party ' => 'other ' , 'time ' => 'not a time ' , 'type ' => 'other ' ]],
347352 'withOrder ' => ['order ' , ['amount ' => -1.5 , 'currency ' => 'usd ' , 'referrer_uri ' => 'not a URL ' ]],
348353 'withPayment ' => ['payment ' , ['method ' => 'other ' , 'processor ' => 'other ' ]],
@@ -481,7 +486,9 @@ public function testFullInsightsRequestUsingNamedArgs(string $class, string $ser
481486 )
482487 ->withEmail (
483488 address: '977577b140bfb7c516e4746204fbdb01 ' ,
484- domain: 'maxmind.com '
489+ domain: 'maxmind.com ' ,
490+ wasVerificationSuccessful: true ,
491+ verificationTime: '2026-10-01T14:30:00Z '
485492 )
486493 ->withEvent (
487494 party: 'customer ' ,
@@ -1208,6 +1215,108 @@ public function testBadShippingPhoneWasVerificationSuccessful(): void
12081215 )->withShipping (['phone_was_verification_successful ' => 'true ' ]);
12091216 }
12101217
1218+ /**
1219+ * @dataProvider goodTimes
1220+ */
1221+ public function testGoodEmailVerificationTimes (string $ time ): void
1222+ {
1223+ $ result = $ this ->createMinFraudRequestWithFullResponse (
1224+ 'insights ' ,
1225+ 0
1226+ )->withEmail (['verification_time ' => $ time ]);
1227+
1228+ $ this ->assertSame (
1229+ $ time ,
1230+ $ result ->jsonSerialize ()['content ' ]['email ' ]['verification_time ' ],
1231+ );
1232+ }
1233+
1234+ /**
1235+ * @dataProvider badTimes
1236+ */
1237+ public function testBadEmailVerificationTime (string $ time ): void
1238+ {
1239+ $ this ->expectException (InvalidInputException::class);
1240+ $ this ->expectExceptionMessage ('valid RFC 3339 ' );
1241+
1242+ $ this ->createMinFraudRequestWithFullResponse (
1243+ 'insights ' ,
1244+ 0
1245+ )->withEmail (['verification_time ' => $ time ]);
1246+ }
1247+
1248+ public function testEmailWasVerificationSuccessfulFalse (): void
1249+ {
1250+ $ result = $ this ->createMinFraudRequestWithFullResponse (
1251+ 'insights ' ,
1252+ 0
1253+ )->withEmail (wasVerificationSuccessful: false );
1254+
1255+ $ this ->assertFalse (
1256+ $ result ->jsonSerialize ()['content ' ]['email ' ]['was_verification_successful ' ],
1257+ );
1258+ }
1259+
1260+ public function testBadEmailWasVerificationSuccessful (): void
1261+ {
1262+ $ this ->expectException (InvalidInputException::class);
1263+ $ this ->expectExceptionMessage (
1264+ 'Expected was_verification_successful to be in [boolean] but was string ' ,
1265+ );
1266+
1267+ $ this ->createMinFraudRequestWithFullResponse (
1268+ 'insights ' ,
1269+ 0
1270+ )->withEmail (['was_verification_successful ' => 'true ' ]);
1271+ }
1272+
1273+ public function testEmailWasVerificationSuccessfulFalseArray (): void
1274+ {
1275+ $ result = $ this ->createMinFraudRequestWithFullResponse (
1276+ 'insights ' ,
1277+ 0
1278+ )->withEmail (['was_verification_successful ' => false ]);
1279+
1280+ $ this ->assertFalse (
1281+ $ result ->jsonSerialize ()['content ' ]['email ' ]['was_verification_successful ' ],
1282+ );
1283+ }
1284+
1285+ public function testEmailWasVerificationSuccessfulFalseWith (): void
1286+ {
1287+ $ result = $ this ->createMinFraudRequestWithFullResponse (
1288+ 'insights ' ,
1289+ 0
1290+ )->with (['email ' => ['was_verification_successful ' => false ]]);
1291+
1292+ $ this ->assertFalse (
1293+ $ result ->jsonSerialize ()['content ' ]['email ' ]['was_verification_successful ' ],
1294+ );
1295+ }
1296+
1297+ public function testEmailVerificationWithHashing (): void
1298+ {
1299+ $ result = $ this ->createMinFraudRequestWithFullResponse (
1300+ 'insights ' ,
1301+ 0 ,
1302+ ['hashEmail ' => true ],
1303+ )->withEmail ([
1304+ 'address ' => 'test@gmail.com ' ,
1305+ 'verification_time ' => '2026-10-01T14:30:00Z ' ,
1306+ 'was_verification_successful ' => false ,
1307+ ]);
1308+
1309+ $ this ->assertSame (
1310+ [
1311+ 'address ' => '1aedb8d9dc4751e229a335e371db8058 ' ,
1312+ 'verification_time ' => '2026-10-01T14:30:00Z ' ,
1313+ 'was_verification_successful ' => false ,
1314+ 'domain ' => 'gmail.com ' ,
1315+ ],
1316+ $ result ->jsonSerialize ()['content ' ]['email ' ],
1317+ );
1318+ }
1319+
12111320 /**
12121321 * @dataProvider badIins
12131322 */
0 commit comments