Skip to content

Commit

Permalink
MOSIP-37900 : Integration with API: API Review Comments (#1045)
Browse files Browse the repository at this point in the history
Signed-off-by: sudeep <[email protected]>
  • Loading branch information
Sudeep7353 authored Dec 19, 2024
1 parent 19b9720 commit 2308365
Show file tree
Hide file tree
Showing 19 changed files with 47 additions and 77 deletions.
2 changes: 1 addition & 1 deletion pmp-revamp-ui/public/i18n/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"policyNameDescription": "وصف اسم السياسة",
"comments": "تعليقات",
"adminComments": "تعليقات المشرف",
"partnerComments": "تعليقات الشريك",
"partnerComment": "تعليقات الشريك",
"back": "خلف",
"createdOn": "تم إنشاؤها على"
},
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/public/i18n/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
"policyNameDescription": "Policy Name Description",
"comments": "Comments",
"adminComments": "Admin Comments",
"partnerComments": "Partner's Comments",
"partnerComment": "Partner's Comments",
"back": "Back",
"createdOn": "Created On"
},
Expand Down
2 changes: 1 addition & 1 deletion pmp-revamp-ui/public/i18n/fra.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"policyNameDescription": "Nom de la stratégie Description",
"comments": "commentaires",
"adminComments": "Commentaires de l'administrateur",
"partnerComments": "Commentaires du partenaire",
"partnerComment": "Commentaires du partenaire",
"back": "Dos",
"createdOn": "Créé sur"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function AdminDevicesList() {
const [applyFilter, setApplyFilter] = useState(false);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showDeviceDetailApproveRejectPopup, setShowDeviceDetailApproveRejectPopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [filterAttributes, setFilterAttributes] = useState({
deviceId: null,
Expand Down Expand Up @@ -178,10 +177,6 @@ function AdminDevicesList() {

const deactivateDevice = (selectedDevice) => {
if (selectedDevice.status === "approved") {
const request = createRequest({
deviceId: selectedDevice.deviceId,
}, "mosip.pms.deactivate.device.post", true);
setDeactivateRequest(request);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand Down Expand Up @@ -360,7 +355,7 @@ function AdminDevicesList() {
<img src={device.status === 'approved' ? deactivateIcon : disableDeactivateIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} request={deactivateRequest} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.descriptionForAdmin' />
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.descriptionForAdmin' />
)}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function AdminFtmList() {
const [applyFilter, setApplyFilter] = useState(false);
const [isApplyFilterClicked, setIsApplyFilterClicked] = useState(false);
const [showFtmApproveRejectPopup, setShowFtmApproveRejectPopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [filterAttributes, setFilterAttributes] = useState({
partnerId: null,
Expand Down Expand Up @@ -172,10 +171,6 @@ function AdminFtmList() {

const deactivateFtmDetails = (ftm) => {
if (ftm.status === "approved") {
const request = createRequest({
ftmId: ftm.ftmId,
}, "mosip.pms.deactivate.ftm.post", true);
setDeactivateRequest(request);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand Down Expand Up @@ -334,7 +329,7 @@ function AdminFtmList() {
<img src={ftm.status === 'approved' ? deactivateIcon : disableDeactivateIcon} alt="" className={`${isLoginLanguageRTL ? "pl-2" : "pr-2"}`} />
</div>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, ftm)} popupData={{ ...ftm, isDeactivateFtm: true }} request={deactivateRequest} headerMsg='deactivateFtmPopup.headerMsg' descriptionMsg='deactivateFtmPopup.description' />
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, ftm)} popupData={{ ...ftm, isDeactivateFtm: true }} headerMsg='deactivateFtmPopup.headerMsg' descriptionMsg='deactivateFtmPopup.description' />
)}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function ViewAdminFtmChipDetails() {
setErrorCode("");
setErrorMsg("");
try {
const response = await HttpService.get(getPartnerManagerUrl('/ftpchipdetail/' + selectedFtmDetails.ftmId + '/original-ftm-certificate', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/ftpchipdetail/' + selectedFtmDetails.ftmId + '/certificate-data', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function ViewPolicyRequestDetails() {
<div className="flex bg-alice-green w-full flex-col p-4 relative rounded-md">
<div className={`w-0 h-0 border-t-[0.5rem] border-t-transparent border-b-[0.5rem] border-b-transparent absolute top-4 ${isLoginLanguageRTL ? "-right-[0.38rem] border-l-[#F2F5FC] border-l-[7px]" : "-left-[0.38rem] border-r-[#F2F5FC] border-r-[7px]"}`}></div>
<h4 className="text-sm text-[#031640]">
{t("viewPolicyDetails.partnerComments")}
{t("viewPolicyDetails.partnerComment")}
</h4>
<span className="text-sm mt-3 break-words">
{policyRequestDetails.requestDetail}
Expand Down
38 changes: 14 additions & 24 deletions pmp-revamp-ui/src/pages/common/ApproveRejectPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,20 @@ function ApproveRejectPopup({ popupData, closePopUp, approveRejectResponse, titl
);
}
if (popupData.isDeviceRequest) {
if (status === "approved") {
const request = createRequest({
partnerId: popupData.partnerId,
sbiId: popupData.sbiId,
deviceDetailId: popupData.deviceId
}, "mosip.pms.approve.mapping.device.to.sbi.post", true);
response = await HttpService.post(getPartnerManagerUrl(`/admin/approve-mapping-device-to-sbi`, process.env.NODE_ENV), request, {
headers: {
'Content-Type': 'application/json'
}
});

} else {
const request = createRequest({
partnerId: popupData.partnerId,
sbiId: popupData.sbiId,
deviceDetailId: popupData.deviceId
}, "mosip.pms.reject.mapping.device.to.sbi.post", true);
response = await HttpService.post(getPartnerManagerUrl(`/admin/reject-mapping-device-to-sbi`, process.env.NODE_ENV), request, {
headers: {
'Content-Type': 'application/json'
}
});
}
const request = createRequest({
partnerId: popupData.partnerId,
sbiId: popupData.sbiId,
deviceDetailId: popupData.deviceId,
status: status === "approved" ? 'Activate' : 'De-activate'
}, "mosip.pms.mapping.device.to.sbi.post", true);

const url = getPartnerManagerUrl(`/devicedetail/${popupData.deviceId}/approval`, process.env.NODE_ENV);

response = await HttpService.post(url, request, {
headers: {
'Content-Type': 'application/json'
}
});
}
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
6 changes: 3 additions & 3 deletions pmp-revamp-ui/src/pages/common/DeactivatePopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ function DeactivatePopup({ onClickConfirm, closePopUp, popupData, request, heade
}
});
} else if (popupData.isDeactivateDevice) {
response = await HttpService.post(getPartnerManagerUrl(`/devicedetail/deactivate-device`, process.env.NODE_ENV), request, {
response = await HttpService.patch(getPartnerManagerUrl(`/devicedetail/${popupData.deviceId}`, process.env.NODE_ENV), {
headers: {
'Content-Type': 'application/json'
}
});
} else if (popupData.isDeactivateSbi) {
response = await HttpService.post(getPartnerManagerUrl(`/securebiometricinterface/deactivate-sbi`, process.env.NODE_ENV), request, {
response = await HttpService.patch(getPartnerManagerUrl(`/securebiometricinterface/${popupData.sbiId}`, process.env.NODE_ENV), {
headers: {
'Content-Type': 'application/json'
}
});
} else if (popupData.isDeactivateFtm) {
response = await HttpService.post(getPartnerManagerUrl(`/ftpchipdetail/deactivate-ftm`, process.env.NODE_ENV), request, {
response = await HttpService.patch(getPartnerManagerUrl(`/ftpchipdetail/${popupData.ftmId}`, process.env.NODE_ENV), {
headers: {
'Content-Type': 'application/json'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function ApiKeysList() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/api-keys-for-auth-partners', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/partners/auth-partner-api-keys', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function PartnerCertificatesList() {
useEffect(() => {
const fetchData = async () => {
try {
const response = await HttpService.get(getPartnerManagerUrl('/partners/partner-certificates', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/partners/partner-certificates-details', process.env.NODE_ENV));
if (response != null) {
const responseData = response.data;
if (responseData.errors && responseData.errors.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ function DevicesList() {
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [firstIndex, setFirstIndex] = useState(0);
const [devicesList, setDevicesList] = useState([]);
const [deactivateRequest, setDeactivateRequest] = useState({});
const [filteredDevicesList, setFilteredDevicesList] = useState([]);
const [viewDeviceId, setViewDeviceId] = useState(-1);
const [canAddDevices, setCanAddDevices] = useState(true);
Expand Down Expand Up @@ -73,7 +72,7 @@ function DevicesList() {
setDataLoaded(false);

let sbiId = sbiData.sbiId;
const response = await HttpService.get(getPartnerManagerUrl(`/securebiometricinterface/sbi-devices/${sbiId}`, process.env.NODE_ENV), {
const response = await HttpService.get(getPartnerManagerUrl(`/securebiometricinterface/${sbiId}/devices`, process.env.NODE_ENV), {
headers: {
'Content-Type': 'application/json'
}
Expand Down Expand Up @@ -175,10 +174,6 @@ function DevicesList() {

const showDeactivateDevice = (selectedDevice) => {
if (selectedDevice.status === "approved") {
const request = createRequest({
deviceId: selectedDevice.id,
}, "mosip.pms.deactivate.device.post", true);
setDeactivateRequest(request);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand All @@ -191,7 +186,7 @@ function DevicesList() {
// Update the specific row in the state with the new status
setDevicesList((prevList) =>
prevList.map(device =>
device.id === selectedDevice.id ? { ...device, status: "deactivated", isActive: false } : device
device.deviceId === selectedDevice.deviceId ? { ...device, status: "deactivated", isActive: false } : device
)
);
}
Expand Down Expand Up @@ -330,7 +325,7 @@ function DevicesList() {
{t('devicesList.deActivate')}
</p>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} request={deactivateRequest} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.description' />
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, device)} popupData={{ ...device, isDeactivateDevice: true }} headerMsg='deactivateDevicePopup.headerMsg' descriptionMsg='deactivateDevicePopup.description' />
)}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function SbiList() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/sbi-details', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/securebiometricinterface', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function FtmList() {
const [filteredftmList, setFilteredFtmList] = useState([]);
const [viewFtmId, setViewFtmId] = useState(-1);
const [showDeactivatePopup, setShowDeactivatePopup] = useState(false);
const [deactivateRequest, setDeactivateRequest] = useState({});
const defaultFilterQuery = {
partnerId: "",
make: ""
Expand All @@ -52,7 +51,7 @@ function FtmList() {
const fetchData = async () => {
try {
setDataLoaded(false);
const response = await HttpService.get(getPartnerManagerUrl('/partners/ftm-chip-details', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/ftpchipdetail', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData && responseData.response) {
Expand Down Expand Up @@ -168,10 +167,6 @@ function FtmList() {

const showDeactivateFtm = (selectedFtmData) => {
if (selectedFtmData.status === "approved") {
const request = createRequest({
ftmId: selectedFtmData.ftmId,
}, "mosip.pms.deactivate.ftm.post", true);
setDeactivateRequest(request);
setShowDeactivatePopup(true);
document.body.style.overflow = "hidden";
}
Expand Down Expand Up @@ -309,7 +304,7 @@ function FtmList() {
{t('ftmList.deActivate')}
</p>
{showDeactivatePopup && (
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, ftm)} popupData={{ ...ftm, isDeactivateFtm: true }} request={deactivateRequest} headerMsg='deactivateFtmPopup.headerMsg' descriptionMsg='deactivateFtmPopup.description' />
<DeactivatePopup closePopUp={closeDeactivatePopup} onClickConfirm={(deactivationResponse) => onClickConfirmDeactivate(deactivationResponse, ftm)} popupData={{ ...ftm, isDeactivateFtm: true }} headerMsg='deactivateFtmPopup.headerMsg' descriptionMsg='deactivateFtmPopup.description' />
)}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function ViewFtmChipDetails() {
setErrorCode("");
setErrorMsg("");
try {
const response = await HttpService.get(getPartnerManagerUrl('/ftpchipdetail/' + ftmId + '/original-ftm-certificate', process.env.NODE_ENV));
const response = await HttpService.get(getPartnerManagerUrl('/ftpchipdetail/' + ftmId + '/certificate-data', process.env.NODE_ENV));
if (response) {
const responseData = response.data;
if (responseData.errors && responseData.errors.length > 0) {
Expand Down
Loading

0 comments on commit 2308365

Please sign in to comment.