-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ES-1689] Updated the review comments
Signed-off-by: Venkata Saidurga Polamraju <[email protected]>
- Loading branch information
1 parent
9b77fdb
commit b1aab96
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ public void kycAuth_withInvalidIdentity_thenFail() { | |
} | ||
|
||
@Test | ||
public void kycAuth_withInvalidTrnHash_thenFail() { | ||
public void kycAuth_withoutSendOTPInvocation_thenFail() { | ||
List<Map<String,String>> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") | ||
,Map.of("id","fullName","type","text","format","") | ||
,Map.of("id","dateOfBirth","type","date","format","yyyy-MM-dd")); | ||
|
@@ -150,6 +150,44 @@ public void kycAuth_withInvalidTrnHash_thenFail() { | |
} | ||
} | ||
|
||
@Test | ||
public void kycAuth_withSendOTPInvocation_thenPass() { | ||
List<Map<String,String>> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") | ||
,Map.of("id","fullName","type","text","format","") | ||
,Map.of("id","dateOfBirth","type","date","format","yyyy-MM-dd")); | ||
ReflectionTestUtils.setField(authenticationService,"otpChannels",Arrays.asList("email","phone")); | ||
ReflectionTestUtils.setField(authenticationService, "fieldDetailList", fieldDetailList); | ||
ReflectionTestUtils.setField(authenticationService, "fieldLang", "eng"); | ||
ReflectionTestUtils.setField(authenticationService,"objectMapper",new ObjectMapper()); | ||
ReflectionTestUtils.setField(authenticationService,"trnHash",new ArrayList<>()); | ||
|
||
KycAuthDto kycAuthDto = new KycAuthDto(); | ||
kycAuthDto.setOtp("111111"); | ||
kycAuthDto.setIndividualId("individualId"); | ||
kycAuthDto.setTransactionId("transactionId"); | ||
|
||
IdentityData identityData = new IdentityData(); | ||
identityData.setDateOfBirth("1987/11/25"); | ||
identityData.setIndividualId("individualId"); | ||
identityData.setEmail("[email protected]"); | ||
identityData.setPhone("1234567890"); | ||
LanguageValue languageValue = new LanguageValue(); | ||
languageValue.setLanguage("eng"); | ||
languageValue.setValue("Siddharth K Mansour"); | ||
identityData.setFullName(List.of(languageValue)); | ||
SendOtpDto sendOtpDto=new SendOtpDto(); | ||
sendOtpDto.setIndividualId("individualId"); | ||
sendOtpDto.setOtpChannels(Arrays.asList("email","phone")); | ||
sendOtpDto.setTransactionId("transactionId"); | ||
|
||
Mockito.when(identityService.getIdentity("individualId")).thenReturn(identityData); | ||
authenticationService.sendOtp("relyingPartyId", "clientId", sendOtpDto); | ||
Mockito.when(identityService.getIdentityV2(Mockito.anyString())).thenReturn(this.identityData); | ||
Mockito.when(authRepository.save(Mockito.any())).thenReturn(new KycAuth()); | ||
KycAuthResponseDto kycAuthResponseDto = authenticationService.kycAuth("relyingPartyId", "clientId", kycAuthDto); | ||
Assert.assertTrue(kycAuthResponseDto.isAuthStatus()); | ||
} | ||
|
||
@Test | ||
public void kycAuth_withInValidTransactionId_thenFail() { | ||
List<Map<String,String>> fieldDetailList = List.of(Map.of("id","individualId","type","text","format","string") | ||
|