-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INJICERT-607] Mock postgres plugin implementation for brazil-usecases #81
Conversation
Signed-off-by: Piyush7034 <[email protected]>
Signed-off-by: Piyush7034 <[email protected]>
Signed-off-by: Piyush7034 <[email protected]>
for(int i=1;i<mockData.length;i++) { | ||
jsonRes.put(includeFields.get(i), mockData[i]); | ||
} | ||
jsonRes.put("id", "https://piyush7034.github.io/statement.json#StatementCredential"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the id
field from plugin, we have a workaround from certify side to get this done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed id field from plugin
Signed-off-by: Piyush7034 <[email protected]>
@Override | ||
public JSONObject fetchData(Map<String, Object> identityDetails) throws DataProviderExchangeException { | ||
try { | ||
String individualId = (String) identityDetails.get("sub"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to get scope
and fetch the SQL table name based on this via config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the scope-query mapping configuration to get fields and query for returning specific identity data
if (individualId != null) { | ||
Object[] mockData = mockDataRepository.getIdentityDataFromIndividualId(individualId); | ||
JSONObject jsonRes = new JSONObject(); | ||
for(int i=1;i<mockData.length;i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the index starting from 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Index changed to 0
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
@ConditionalOnProperty(value = "mosip.certify.postgres.credential.name", havingValue = "StatementData") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge the two interface implementations into one and create a mapping between the scope
and the query required to fetch the VC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the common interface implementation for the repository and the scope-query mapping
… scopes Signed-off-by: Piyush7034 <[email protected]>
@Override | ||
public Object[] getIdentityDataFromIndividualId(String id, String queryString) { | ||
Query query = entityManager.createNativeQuery(queryString); | ||
query.setParameter("id", id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the id field hardcoded ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "id" field is the identifier in raw query. So adding it as "id" in the query parameter
...sip/certify/mockpostgresdataprovider/integration/service/MockPostgresDataProviderPlugin.java
Outdated
Show resolved
Hide resolved
...sip/certify/mockpostgresdataprovider/integration/service/MockPostgresDataProviderPlugin.java
Outdated
Show resolved
Hide resolved
...io/mosip/certify/mockpostgresdataprovider/integration/repository/MockDataRepositoryImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Piyush7034 <[email protected]>
No description provided.