mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -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
|
- filename: machines/bleShare/scan/scanMachine.ts
|
||||||
checksum: a514c958ca3da3c5b22a1a95ad680af8f05fb22638fab79b3842aa8fcc1b4a17
|
checksum: a514c958ca3da3c5b22a1a95ad680af8f05fb22638fab79b3842aa8fcc1b4a17
|
||||||
version: ""
|
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: {
|
checkingServerData: {
|
||||||
description:
|
description:
|
||||||
"Download VC data from the server. Uses polling method to check when it's available.",
|
"Download VC data from the server. Uses polling method to check when it's available.",
|
||||||
initial: 'verifyingDownloadLimitExpiry',
|
initial: 'loadDownloadLimitConfig',
|
||||||
states: {
|
states: {
|
||||||
|
loadDownloadLimitConfig: {
|
||||||
|
invoke: {
|
||||||
|
src: 'loadDownloadLimitConfig',
|
||||||
|
onDone: {
|
||||||
|
actions: ['setMaxDownloadCount', 'setDownloadInterval'],
|
||||||
|
target: 'verifyingDownloadLimitExpiry',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
verifyingDownloadLimitExpiry: {
|
verifyingDownloadLimitExpiry: {
|
||||||
|
entry: ['incrementDownloadCounter'],
|
||||||
invoke: {
|
invoke: {
|
||||||
src: 'checkDownloadExpiryLimit',
|
src: 'checkDownloadExpiryLimit',
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'checkingStatus',
|
target: 'checkingStatus',
|
||||||
actions: ['setMaxDownloadCount', 'setDownloadInterval'],
|
|
||||||
},
|
},
|
||||||
onError: {
|
onError: {
|
||||||
actions: [
|
actions: [
|
||||||
@@ -201,12 +210,9 @@ export const ExistingMosipVCItemMachine =
|
|||||||
DOWNLOAD_READY: {
|
DOWNLOAD_READY: {
|
||||||
target: 'downloadingCredential',
|
target: 'downloadingCredential',
|
||||||
},
|
},
|
||||||
FAILED: [
|
FAILED: {
|
||||||
{
|
actions: 'sendDownloadLimitExpire',
|
||||||
actions: ['incrementDownloadCounter'],
|
},
|
||||||
target: 'verifyingDownloadLimitExpiry',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
downloadingCredential: {
|
downloadingCredential: {
|
||||||
@@ -1090,14 +1096,6 @@ export const ExistingMosipVCItemMachine =
|
|||||||
Number((event.data as DownloadProps).downloadInterval),
|
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) => {
|
setCredential: model.assign((context, event) => {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case 'STORE_RESPONSE':
|
case 'STORE_RESPONSE':
|
||||||
@@ -1273,26 +1271,27 @@ export const ExistingMosipVCItemMachine =
|
|||||||
},
|
},
|
||||||
|
|
||||||
services: {
|
services: {
|
||||||
checkDownloadExpiryLimit: async context => {
|
loadDownloadLimitConfig: async context => {
|
||||||
var resp = await getAllConfigurations();
|
var resp = await getAllConfigurations();
|
||||||
const maxLimit: number = resp.vcDownloadMaxRetry;
|
const maxLimit: number = resp.vcDownloadMaxRetry;
|
||||||
const vcDownloadPoolInterval: number = resp.vcDownloadPoolInterval;
|
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 = {
|
const downloadProps: DownloadProps = {
|
||||||
maxDownloadLimit: maxLimit,
|
maxDownloadLimit: maxLimit,
|
||||||
downloadInterval: vcDownloadPoolInterval,
|
downloadInterval: vcDownloadPoolInterval,
|
||||||
};
|
};
|
||||||
|
|
||||||
return downloadProps;
|
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 => {
|
addWalletBindnigId: async context => {
|
||||||
const response = await request(
|
const response = await request(
|
||||||
API_URLS.walletBinding.method,
|
API_URLS.walletBinding.method,
|
||||||
@@ -1395,10 +1394,12 @@ export const ExistingMosipVCItemMachine =
|
|||||||
case 'FAILED':
|
case 'FAILED':
|
||||||
default:
|
default:
|
||||||
callback(model.events.FAILED());
|
callback(model.events.FAILED());
|
||||||
|
clearInterval(pollInterval);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
callback(model.events.FAILED());
|
callback(model.events.FAILED());
|
||||||
|
clearInterval(pollInterval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user