Skip to content

Commit

Permalink
Aadhaar otp and it's validation
Browse files Browse the repository at this point in the history
  • Loading branch information
DnyaneshWarade committed May 3, 2022
1 parent 16ef737 commit 420b5b2
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
43 changes: 42 additions & 1 deletion frontend/src/services/dygnifyAxiosOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,45 @@ function dygnifyGetMobileDetails(reqId, phoneNo, bearerToken) {
return api_options;
}

function dygnifySendAadhaarOTP(aadhaarNo, name, bearerToken) {
var data = JSON.stringify({
"aadhaarNo": aadhaarNo,
"name": name
});

var api_options = {
method: 'post',
url: process.env.REACT_APP_DYGNIFY_URL + 'utility/getAadhaarOTP',
headers: {
'Authorization': bearerToken,
'Content-Type': 'application/json'
},
data: data
}

return api_options;
}

function dygnifyValidateAadhaarOTP(otp, accessKey, caseId, bearerToken) {
var data = JSON.stringify({
"otp": otp,
"accessKey": accessKey,
"caseId": caseId
});

var api_options = {
method: 'post',
url: process.env.REACT_APP_DYGNIFY_URL + 'utility/validateAadhaarOTP',
headers: {
'Authorization': bearerToken,
'Content-Type': 'application/json'
},
data: data
}

return api_options;
}

module.exports = {
dygnifyBusinessOwnerCreationOption,
dygnifycreateBusinessOptions,
Expand Down Expand Up @@ -522,5 +561,7 @@ module.exports = {
dygnifyKycOCR,
dygnifySendMobileOTP,
dygnifyValidateMobileOTP,
dygnifyGetMobileDetails
dygnifyGetMobileDetails,
dygnifySendAadhaarOTP,
dygnifyValidateAadhaarOTP
}
28 changes: 28 additions & 0 deletions frontend/src/services/serviceHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,32 @@ export async function getOCRFetch(file, bearerToken) {
console.log(error);
}
return { 'status': false };
}

export async function sendAadhaarOTP(aadhaarNo, name, bearerToken) {
try {
if (aadhaarNo && name && bearerToken) {
let aadhaarOTPRes = await axiosHttpService(dygnifySendAadhaarOTP(aadhaarNo, name, bearerToken));
if (aadhaarOTPRes.code === 200) {
return { 'status': true, data: aadhaarOTPRes.res };
}
}
} catch (error) {
console.log(error);
}
return { 'status': false };
}

export async function ValidateAadhaarOTP(otp, accessKey, caseId, bearerToken) {
try {
if (otp && accessKey && caseId && bearerToken) {
let otpValidationRes = await axiosHttpService(dygnifyValidateAadhaarOTP(otp, accessKey, caseId, bearerToken));
if (otpValidationRes.code === 200) {
return { 'status': true, data: otpValidationRes.res };
}
}
} catch (error) {
console.log(error);
}
return { 'status': false };
}

0 comments on commit 420b5b2

Please sign in to comment.