mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-07 20:53:54 -05:00
fix(INJI-536):check status failed while downloading vc (#1032)
Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
This commit is contained in:
@@ -83,3 +83,6 @@ fileignoreconfig:
|
||||
- filename: machines/bleShare/scan/scanMachine.ts
|
||||
checksum: a514c958ca3da3c5b22a1a95ad680af8f05fb22638fab79b3842aa8fcc1b4a17
|
||||
version: ""
|
||||
- filename: locales/spa.json
|
||||
checksum: eac9685c6b205ece5759e414669d27ad7ce383453d7b5e7d9f5ce75d290cc860
|
||||
version: ""
|
||||
1168
locales/spa.json
1168
locales/spa.json
File diff suppressed because it is too large
Load Diff
@@ -171,14 +171,23 @@ export const ExistingMosipVCItemMachine =
|
||||
checkingServerData: {
|
||||
description:
|
||||
"Download VC data from the server. Uses polling method to check when it's available.",
|
||||
initial: 'verifyingDownloadLimitExpiry',
|
||||
initial: 'loadDownloadLimitConfig',
|
||||
states: {
|
||||
loadDownloadLimitConfig: {
|
||||
invoke: {
|
||||
src: 'loadDownloadLimitConfig',
|
||||
onDone: {
|
||||
actions: ['setMaxDownloadCount', 'setDownloadInterval'],
|
||||
target: 'verifyingDownloadLimitExpiry',
|
||||
},
|
||||
},
|
||||
},
|
||||
verifyingDownloadLimitExpiry: {
|
||||
entry: ['incrementDownloadCounter'],
|
||||
invoke: {
|
||||
src: 'checkDownloadExpiryLimit',
|
||||
onDone: {
|
||||
target: 'checkingStatus',
|
||||
actions: ['setMaxDownloadCount', 'setDownloadInterval'],
|
||||
},
|
||||
onError: {
|
||||
actions: [
|
||||
@@ -201,12 +210,9 @@ export const ExistingMosipVCItemMachine =
|
||||
DOWNLOAD_READY: {
|
||||
target: 'downloadingCredential',
|
||||
},
|
||||
FAILED: [
|
||||
{
|
||||
actions: ['incrementDownloadCounter'],
|
||||
target: 'verifyingDownloadLimitExpiry',
|
||||
},
|
||||
],
|
||||
FAILED: {
|
||||
actions: 'sendDownloadLimitExpire',
|
||||
},
|
||||
},
|
||||
},
|
||||
downloadingCredential: {
|
||||
@@ -1090,14 +1096,6 @@ export const ExistingMosipVCItemMachine =
|
||||
Number((event.data as DownloadProps).downloadInterval),
|
||||
}),
|
||||
|
||||
storeTag: send(
|
||||
context => {
|
||||
const {serviceRefs, ...data} = context;
|
||||
return StoreEvents.SET(context.vcMetadata.getVcKey(), data);
|
||||
},
|
||||
{to: context => context.serviceRefs.store},
|
||||
),
|
||||
|
||||
setCredential: model.assign((context, event) => {
|
||||
switch (event.type) {
|
||||
case 'STORE_RESPONSE':
|
||||
@@ -1273,26 +1271,27 @@ export const ExistingMosipVCItemMachine =
|
||||
},
|
||||
|
||||
services: {
|
||||
checkDownloadExpiryLimit: async context => {
|
||||
loadDownloadLimitConfig: async context => {
|
||||
var resp = await getAllConfigurations();
|
||||
const maxLimit: number = resp.vcDownloadMaxRetry;
|
||||
const vcDownloadPoolInterval: number = resp.vcDownloadPoolInterval;
|
||||
console.log(maxLimit);
|
||||
if (maxLimit <= context.downloadCounter) {
|
||||
throw new Error(
|
||||
'Download limit expired for request id: ' +
|
||||
context.vcMetadata.requestId,
|
||||
);
|
||||
}
|
||||
|
||||
const downloadProps: DownloadProps = {
|
||||
maxDownloadLimit: maxLimit,
|
||||
downloadInterval: vcDownloadPoolInterval,
|
||||
};
|
||||
|
||||
return downloadProps;
|
||||
},
|
||||
|
||||
checkDownloadExpiryLimit: async context => {
|
||||
if (context.downloadCounter > context.maxDownloadCount) {
|
||||
throw new Error(
|
||||
'Download limit expired for request id: ' +
|
||||
context.vcMetadata.requestId,
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
addWalletBindnigId: async context => {
|
||||
const response = await request(
|
||||
API_URLS.walletBinding.method,
|
||||
@@ -1395,10 +1394,12 @@ export const ExistingMosipVCItemMachine =
|
||||
case 'FAILED':
|
||||
default:
|
||||
callback(model.events.FAILED());
|
||||
clearInterval(pollInterval);
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
callback(model.events.FAILED());
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user