Skip to content

Commit

Permalink
Merge pull request #1152 from Sohandey/release-1.2.0.1
Browse files Browse the repository at this point in the history
MOSIP-29286
  • Loading branch information
Sohandey authored Oct 19, 2023
2 parents f519634 + 2652092 commit 8674948
Show file tree
Hide file tree
Showing 12 changed files with 400 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import org.yaml.snakeyaml.Yaml;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.jknack.handlebars.Context;
import com.github.jknack.handlebars.Handlebars;
Expand Down Expand Up @@ -5744,5 +5745,30 @@ public static boolean isElementPresent(JSONArray inputArray, String element) {
}
return false;
}

public static String ekycDataDecryption(String url, JSONObject kycDataForDecryption, String partnerName,
Boolean keyFileNameByPartnerName) {
url = url + properties.getProperty("decryptKycUrl");

ObjectMapper mapper = new ObjectMapper();
Map<String, String> map = null;
try {
map = mapper.readValue(kycDataForDecryption.toString(), Map.class);
} catch (JsonProcessingException e) {
logger.error(e.getMessage());
}

HashMap<String, Object> queryParamMap = new HashMap<>();
queryParamMap.put("partnerName", partnerName);
queryParamMap.put("moduleName", BaseTestCase.certsForModule);

queryParamMap.put("keyFileNameByPartnerName", keyFileNameByPartnerName);

Response response = RestClient.postRequestWithQueryParamsAndBody(url, map, queryParamMap,
MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN);
GlobalMethods.reportResponse(response.getHeaders().asList().toString(), url, response);

return response.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ public String getTokenByRole(String role, String tokenType) {
if (!kernelCmnLib.isValidToken(batchJobToken))
batchJobToken = kernelAuthLib.getPreRegToken();
return batchJobToken;

case "invalidBatch":
if (!kernelCmnLib.isValidToken(batchJobToken))
invalidBatchJobToken = kernelAuthLib.getPreRegInvalidToken();
return invalidBatchJobToken;


case "invalid":
return "anyRandomString";
case "regAdmin":
Expand Down Expand Up @@ -463,6 +470,27 @@ public String getPreRegToken() {
cookie = otpValidate.getCookie(GlobalConstants.AUTHORIZATION);
return cookie;
}

@SuppressWarnings("unchecked")
public String getPreRegInvalidToken() {
JSONObject actualRequest_generation = getRequestJson("config/prereg_SendOtp.json");
actualRequest_generation.put(GlobalConstants.REQUESTTIME, clib.getCurrentUTCTime());
((JSONObject) actualRequest_generation.get(GlobalConstants.REQUEST)).put("langCode",
BaseTestCase.getLanguageList().get(0));
((JSONObject) actualRequest_generation.get(GlobalConstants.REQUEST)).get("userId").toString();
JSONObject actualRequest_validation = getRequestJson("config/prereg_ValidateOtp.json");
appl.postWithJson(preregSendOtp, actualRequest_generation);
String otp = null;
if (proxy)
otp = "111222";
else {
}
((JSONObject) actualRequest_validation.get(GlobalConstants.REQUEST)).put("otp", otp);
actualRequest_validation.put(GlobalConstants.REQUESTTIME, clib.getCurrentUTCTime());
Response otpValidate = appl.postWithJson(preregValidateOtp, actualRequest_validation);
cookie = otpValidate.getCookie(GlobalConstants.AUTHORIZATION);
return cookie;
}

@SuppressWarnings("unchecked")
public String getAuthForRegistrationProcessor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public class BaseTestCase {
public static HashMap<String, String> regCenterId = new HashMap<>();
public static String expiredPreId = null;
public String batchJobToken = null;
public String invalidBatchJobToken = null;

public static List<String> expiredPreRegIds = null;
public static List<String> consumedPreRegIds = null;
public static Map<?, ?> residentQueries;
Expand Down Expand Up @@ -390,7 +392,7 @@ public static void mapUserToZone() {
String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl");
org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest);
JSONObject request = new JSONObject();
request.put("zoneCode", props.get("zoneCode_to_beMapped"));
request.put("zoneCode", ZonelocationCode);
request.put("userId", BaseTestCase.currentModule + "-" + ConfigManager.getUserAdminName());
request.put("langCode", BaseTestCase.getLanguageList().get(0));
request.put(GlobalConstants.ISACTIVE, GlobalConstants.TRUE_STRING);
Expand All @@ -410,7 +412,7 @@ public static void mapUserToZone(String user, String zone) {
String url = ApplnURI + propsKernel.getProperty("zoneMappingUrl");
org.json.simple.JSONObject actualrequest = getRequestJson(zoneMappingRequest);
JSONObject request = new JSONObject();
request.put("zoneCode", zone);
request.put("zoneCode", ZonelocationCode);
request.put("userId", user);
request.put("langCode", BaseTestCase.getLanguageList().get(0));
request.put(GlobalConstants.ISACTIVE, GlobalConstants.TRUE_STRING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void setResultTestName(ITestResult result) {
public void waittime() {

try {
if (BaseTestCase.currentModule.equals("idrepo")) {
if (BaseTestCase.currentModule.equals("auth")) {
logger.info("waiting for " + properties.getProperty("Delaytime") + " mili secs after UIN Generation In IDREPO"); //
Thread.sleep(Long.parseLong(properties.getProperty("Delaytime")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.mosip.testrig.apirig.authentication.fw.util.AuthenticationTestException;
import io.mosip.testrig.apirig.authentication.fw.util.OutputValidationUtil;
import io.mosip.testrig.apirig.authentication.fw.util.ReportUtil;
import io.mosip.testrig.apirig.global.utils.GlobalMethods;
import io.mosip.testrig.apirig.ida.certificate.PartnerRegistration;
import io.mosip.testrig.apirig.kernel.util.ConfigManager;
import io.mosip.testrig.apirig.service.BaseTestCase;
Expand Down Expand Up @@ -169,7 +170,13 @@ public void test(TestCaseDTO testCaseDTO) throws AuthenticationTestException, Ad
JSONObject resJsonObject = new JSONObject(response.asString());
String res = "";
try {
res = resJsonObject.get("response").toString();
//res = resJsonObject.get("response").toString();
resJsonObject = new JSONObject(response.getBody().asString()).getJSONObject("authResponse")
.getJSONObject("body").getJSONObject("response");

res= AdminTestUtil.ekycDataDecryption( url, resJsonObject, PartnerRegistration.ekycPartnerId,
true);

} catch (JSONException e) {
logger.error(e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ mobileIdAutoGeneratedIdPropFileName=/mobileId/autoGeneratedId.properties
fetchLocationData=/v1/masterdata/locations/all
fetchLocationLevel=/v1/masterdata/locations/level/
fetchTitle=/v1/masterdata/title
fetchZone=/v1/masterdata/zones/zonename
fetchZone=/v1/masterdata/zones/zonename
decryptKycUrl=/v1/identity/decryptEkycData
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,138 @@ AddIdentity:
"introducerRID": "212124324784879",
"introducerUIN": "212124324784879",
"category": "individualBiometrics",
"requesttime": "$TIMESTAMP$"
}'
output: '{
"status":"ACTIVATED"
}'
IdRepository_AddIdentity_with_less_then_10_digit_phone:
endPoint: /idrepository/v1/identity/
role: idrepo
restMethod: post
inputTemplate: idRepository/AddIdentity/addIdentity_$LANGNUMBER$
outputTemplate: idRepository/AddIdentity/addIdentityResult
input: '{
"value": "$BIOVALUE$",
"id": "mosip.id.create",
"registrationId": "$RID$",
"addressCopy": "Y",
"biometricReferenceId": "23452353",
"UIN": "$UIN$",
"dateOfBirth": "1992/04/15",
"postalCode": "14022",
"email": "[email protected]",
"phone": "4732626",
"mobileno": "4732626",
"referenceIdentityNumber": "6789545678878",
"version": "v1",
"introducerRID": "212124324784879",
"introducerUIN": "212124324784879",
"category": "individualBiometrics",
"requesttime": "$TIMESTAMP$"
}'
output: '{
"status":"ACTIVATED"
}'
IdRepository_AddIdentity_with_more_then_10_digit_phone:
endPoint: /idrepository/v1/identity/
role: idrepo
restMethod: post
inputTemplate: idRepository/AddIdentity/addIdentity_$LANGNUMBER$
outputTemplate: idRepository/AddIdentity/addIdentityResult
input: '{
"value": "$BIOVALUE$",
"id": "mosip.id.create",
"registrationId": "$RID$",
"addressCopy": "Y",
"biometricReferenceId": "23452353",
"UIN": "$UIN$",
"dateOfBirth": "1992/04/15",
"postalCode": "14022",
"email": "[email protected]",
"phone": "47326261234",
"mobileno": "47326261234",
"referenceIdentityNumber": "6789545678878",
"version": "v1",
"introducerRID": "212124324784879",
"introducerUIN": "212124324784879",
"category": "individualBiometrics",
"requesttime": "$TIMESTAMP$"
}'
output: '{
"status":"ACTIVATED"
}'
IdRepository_AddIdentity_withcharacter_as_Phone_number:
endPoint: /idrepository/v1/identity/
role: idrepo
restMethod: post
inputTemplate: idRepository/AddIdentity/addIdentity_$LANGNUMBER$
outputTemplate: idRepository/AddIdentity/addIdentityResult
input: '{
"value": "$BIOVALUE$",
"id": "mosip.id.create",
"registrationId": "$RID$",
"addressCopy": "Y",
"biometricReferenceId": "23452353",
"UIN": "$UIN$",
"dateOfBirth": "1992/04/15",
"postalCode": "14022",
"email": "[email protected]",
"phone": "abcdefghijak",
"mobileno": "abcdefghijak",
"referenceIdentityNumber": "6789545678878",
"version": "v1",
"introducerRID": "212124324784879",
"introducerUIN": "212124324784879",
"category": "individualBiometrics",
"requesttime": "$TIMESTAMP$"
}'
output: '{
"status":"ACTIVATED"
}'
IdRepository_AddIdentity_with_empty_Phone_number:
endPoint: /idrepository/v1/identity/
role: idrepo
restMethod: post
inputTemplate: idRepository/AddIdentity/addIdentity_$LANGNUMBER$
outputTemplate: idRepository/AddIdentity/addIdentityResult
input: '{
"value": "$BIOVALUE$",
"id": "mosip.id.create",
"registrationId": "$RID$",
"addressCopy": "Y",
"biometricReferenceId": "23452353",
"UIN": "$UIN$",
"dateOfBirth": "1992/04/15",
"postalCode": "14022",
"email": "[email protected]",
"phone": "",
"mobileno": "",
"referenceIdentityNumber": "6789545678878",
"version": "v1",
"introducerRID": "212124324784879",
"introducerUIN": "212124324784879",
"category": "individualBiometrics",
"requesttime": "$TIMESTAMP$"
}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,22 @@ UpdatePreRegStatus:
"statusCode": "Pending_Appointment"
}'
output: '{
}'
Prereg_UpdatePreRegStatus_without_update_prereg_status_sid:
endPoint: /preregistration/v1/applications/prereg/status/{preRegistrationId}?statusCode={statusCode}
role: batch
checkErrorsOnlyInResponse: true
restMethod: get
inputTemplate: preReg/UpdatePreRegStatus/updatePreRegStatus
outputTemplate: preReg/error
input: '{
"preRegistrationId": "$ID:CreatePrereg_book_appoinment_without_update_prereg_status_sid_preRegistrationId$",
"statusCode": "Pending_Appointment"
}'
output: '{
"errors": [
{
"errorCode": "PRG_PAM_APP_023"
}
]
}'
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ CreatePrereg:
"id": "mosip.pre-registration.demographic.create"
}'
output: '{
}'
Prereg_CreatePrereg_book_appoinment_without_update_prereg_status_sid:
endPoint: /preregistration/v1/applications/prereg
role: batch
checkErrorsOnlyInResponse: true
restMethod: post
inputTemplate: preReg/createPrereg/createPrereg
outputTemplate: preReg/createPrereg/createPreregResult
input: '{
"postalCode": "14022",
"phone": "8249742850",
"email": "[email protected]",
"IDSchemaVersion": $SCHEMAVERSION$,
"dateOfBirth": "1996/01/01",
"version": "1.0",
"langCode": "$1STLANG$",
"requesttime": "$TIMESTAMP$",
"id": "mosip.pre-registration.demographic.create"
}'
output: '{
}'
Prereg_CreatePrereg_All_Valid_Smoke_UpdateDocRefID_sid:
endPoint: /preregistration/v1/applications/prereg
Expand Down Expand Up @@ -474,4 +494,30 @@ CreatePrereg:
"errorCode": "KER-IOV-004"
}
]
}'
}'
Prereg_CreatePrereg_Invalid_OTP_Neg:
endPoint: /preregistration/v1/applications/prereg
role: invalidBatch
checkErrorsOnlyInResponse: true
restMethod: post
inputTemplate: preReg/createPrereg/createPrereg
outputTemplate: preReg/error
input: '{
"postalCode": "14022",
"phone": "8249742850",
"mobileno": "8249742850",
"email": "[email protected]",
"IDSchemaVersion": $SCHEMAVERSION$,
"dateOfBirth": "1996/01/01",
"version": "1.0",
"langCode": "$1STLANG$",
"requesttime": "$TIMESTAMP$",
"id": "mosip.pre-registration.demographic.create"
}'
output: '{
"errors": [
{
"errorCode": "KER-IOV-004"
}
]
}'
Loading

0 comments on commit 8674948

Please sign in to comment.