-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from credebl/merge-dev-prod-nov21
Merge develop to prod
- Loading branch information
Showing
103 changed files
with
5,289 additions
and
1,932 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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 |
---|---|---|
@@ -0,0 +1,175 @@ | ||
import type download from 'downloadjs'; | ||
import { apiRoutes } from '../config/apiRoutes'; | ||
import { storageKeys } from '../config/CommonConstant'; | ||
import { | ||
getHeaderConfigs, | ||
getHeaderConfigsForFormData, | ||
} from '../config/GetHeaderConfigs'; | ||
import { axiosGet, axiosPost } from '../services/apiRequests'; | ||
import { getFromLocalStorage } from './Auth'; | ||
|
||
export const getSchemaCredDef = async () => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.credefList}`; | ||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const DownloadCsvTemplate = async () => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const credDefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}/${credDefId}${apiRoutes.Issuance.download}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
// bulk issuance | ||
|
||
// upload file | ||
|
||
export const uploadCsvFile = async (payload: any) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const credefId = await getFromLocalStorage(storageKeys.CRED_DEF_ID); | ||
|
||
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.uploadCsv}?credDefId=${credefId}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
payload: payload, | ||
config: await getHeaderConfigsForFormData(), | ||
}; | ||
|
||
try { | ||
return await axiosPost(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
//get file data | ||
|
||
export const getCsvFileData = async ( | ||
requestId: any, | ||
pageNumber: number, | ||
pageSize: number, | ||
search: string, | ||
) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}/${requestId}${apiRoutes.Issuance.bulk.preview}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const issueBulkCredential = async (requestId: string, clientId: string) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}/${requestId}${apiRoutes.Issuance.bulk.bulk}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
payload: { | ||
clientId | ||
} | ||
}; | ||
|
||
try { | ||
return await axiosPost(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const retryBulkIssuance = async (fileId:string) => { | ||
const socketId= await getFromLocalStorage(storageKeys.SOCKET_ID) | ||
|
||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}/${fileId}${apiRoutes.Issuance.bulk.retry}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
payload:{clientId:socketId}, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosPost(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const getFilesHistory = async ( | ||
pageNumber: number, | ||
pageSize: number, | ||
search: string, | ||
) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}${apiRoutes.Issuance.bulk.files}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const getFilesDataHistory = async ( | ||
requestId: string, | ||
pageNumber: number, | ||
pageSize: number, | ||
search: string, | ||
sortBy:string | ||
) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.organizations.root}/${orgId}/${requestId}${apiRoutes.Issuance.bulk.filesData}?pageNumber=${pageNumber}&pageSize=${pageSize}&search=${search}&sortBy=${sortBy}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; |
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
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
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
Oops, something went wrong.