diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/telephony/CarrierData.java b/service/src/main/java/org/whispersystems/textsecuregcm/telephony/CarrierData.java index 499bb59a3..7e8174975 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/telephony/CarrierData.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/telephony/CarrierData.java @@ -10,12 +10,18 @@ import java.util.Optional; /// Line type and home network information for a specific phone number. /// /// @param carrierName the name of the network operator for the specified phone number -/// @param lineType the line type for the specified phone number -/// @param mcc the mobile country code (MCC) of the phone number's home network if known; may be empty if the phone -/// number is not a mobile number -/// @param mnc the mobile network code (MNC) of the phone number's home network if known; may be empty if the phone -/// number is not a mobile number -public record CarrierData(String carrierName, LineType lineType, Optional mcc, Optional mnc) { +/// @param lineType the line type for the specified phone number +/// @param mcc the mobile country code (MCC) of the phone number's home network if known; may be empty if the +/// phone number is not a mobile number +/// @param mnc the mobile network code (MNC) of the phone number's home network if known; may be empty if the +/// phone number is not a mobile number +/// @param isPorted indicates whether the number has been ported from its original network to another network; may be +/// empty if not known +public record CarrierData(String carrierName, + LineType lineType, + Optional mcc, + Optional mnc, + Optional isPorted) { public enum LineType { MOBILE, diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProvider.java b/service/src/main/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProvider.java index 12ccce8b2..0ed65bfbf 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProvider.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProvider.java @@ -147,7 +147,7 @@ public class HlrLookupCarrierDataProvider implements CarrierDataProvider { networkDetails.name(), lineType(result.telephoneNumberType()), mccFromMccMnc(networkDetails.mccmnc()), - mncFromMccMnc(networkDetails.mccmnc()))); + mncFromMccMnc(networkDetails.mccmnc()), Optional.empty())); } private static Tag getCreditsSpentTag(final HlrLookupResult hlrLookupResult) { diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/VerificationSessionsTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/VerificationSessionsTest.java index b5a9fb0b8..b1d2937de 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/VerificationSessionsTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/VerificationSessionsTest.java @@ -65,7 +65,7 @@ class VerificationSessionsTest { final Optional absentSession = verificationSessions.findForKey(sessionId).join(); assertTrue(absentSession.isEmpty()); - final VerificationSession session = new VerificationSession(null, new CarrierData("Test", CarrierData.LineType.MOBILE, Optional.of("123"), Optional.empty()), + final VerificationSession session = new VerificationSession(null, new CarrierData("Test", CarrierData.LineType.MOBILE, Optional.of("123"), Optional.empty(), Optional.empty()), List.of(VerificationSession.Information.PUSH_CHALLENGE), Collections.emptyList(), null, null, true, clock.millis(), clock.millis(), Duration.ofMinutes(1).toSeconds()); @@ -80,7 +80,7 @@ class VerificationSessionsTest { assertInstanceOf(ConditionalCheckFailedException.class, t, "inserting with the same key should fail conditional checks"); - final VerificationSession updatedSession = new VerificationSession(null, new CarrierData("Test", CarrierData.LineType.MOBILE, Optional.of("123"), Optional.empty()), Collections.emptyList(), + final VerificationSession updatedSession = new VerificationSession(null, new CarrierData("Test", CarrierData.LineType.MOBILE, Optional.of("123"), Optional.empty(), Optional.empty()), Collections.emptyList(), List.of(VerificationSession.Information.PUSH_CHALLENGE), null, null, true, clock.millis(), clock.millis(), Duration.ofMinutes(2).toSeconds()); verificationSessions.update(sessionId, updatedSession).join(); diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProviderTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProviderTest.java index 97c67ce9d..ee4922fde 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProviderTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/telephony/hlrlookup/HlrLookupCarrierDataProviderTest.java @@ -110,7 +110,8 @@ class HlrLookupCarrierDataProviderTest { final Optional maybeCarrierData = hlrLookupCarrierDataProvider.lookupCarrierData(PhoneNumberUtil.getInstance().getExampleNumber("US"), Duration.ZERO); - assertEquals(Optional.of(new CarrierData("Virgin Mobile", CarrierData.LineType.MOBILE, Optional.of("234"), Optional.of("38"))), + assertEquals(Optional.of(new CarrierData("Virgin Mobile", CarrierData.LineType.MOBILE, Optional.of("234"), Optional.of("38"), + Optional.empty())), maybeCarrierData); }