-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix Consent manager issues in CDS TK #27
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b5ca2c4
Update revoked consent details in UI after revoking
anjuchamantha d69e238
Remove useless link in consentmgr footer
anjuchamantha 77f1cc2
Fix consent confirmation pdf file issues
anjuchamantha bc9ac5d
Fix consentmgr ADR logo not showing issue
anjuchamantha c76c093
Fix consentmgr accredation typo
anjuchamantha e5817f1
Get sharing duration for onceOff consents in consent manager
anjuchamantha 377316a
Refactor date titles for consent manager consents
anjuchamantha 1a94ee4
Fix Customer Care Officer not able to revoke the consent issue
anjuchamantha 7feaaee
Allowing CustomerCareOfficer to view consent amendment history
anjuchamantha 5d38d86
Revoke consent if all the mappings are deactivated
anjuchamantha c68d45b
Show consent amendment history details to customer care officer
anjuchamantha 8dfced3
Send correct consent amended time
anjuchamantha 6fcc5a4
Merge branch 'main' into consent-mgr-issues
anjuchamantha 32c32e1
Code refactoring in consent manager consent pdf generation
anjuchamantha ca7d479
Change consent `revoked` status to `Revoked`
anjuchamantha db666b9
Fix consent manager pdf key date issues
anjuchamantha 44eff1d
Show accounts in consent pdf only if accounts are there
anjuchamantha 49af6e9
Merge branch 'main' into consent-mgr-issues
anjuchamantha 8a8b7f0
Bug fix in consent manager pdf generation
anjuchamantha eaaa2e7
Merge branch 'main' into consent-mgr-issues
anjuchamantha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
94 changes: 94 additions & 0 deletions
94
react-apps/self-care-portal-frontend/toolkit/src/detailedAgreementPage/ProfileMain.jsx
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,94 @@ | ||
/** | ||
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). | ||
* | ||
* WSO2 LLC. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React, {useState} from "react"; | ||
import {Container} from "react-bootstrap"; | ||
import {Link} from "react-router-dom"; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { faDownload } from '@fortawesome/free-solid-svg-icons'; | ||
import {withdrawLang, lang} from "../specConfigs"; | ||
import ADRLogo from "../images/ADRLogo.png"; | ||
import moment from "moment"; | ||
import {specConfigurations} from "../specConfigs/specConfigurations"; | ||
import { getExpireTimeFromConsent } from "../services/utils"; | ||
import { generatePDF } from "../../../toolkit/src/services/cdsUtils"; | ||
|
||
|
||
export const ProfileMain = ({consent, infoLabel, appicationName, logoURL}) => { | ||
|
||
const [isImageError, setIsImageError] = useState(false); | ||
const consentConsentId = consent.consentId; | ||
const currentDate = moment().format("YYYY-MM-DDTHH:mm:ss[Z]"); | ||
|
||
const handleImageError = () => { | ||
setIsImageError(true); | ||
}; | ||
|
||
if (logoURL === undefined || logoURL === '') { | ||
logoURL = ADRLogo | ||
} | ||
|
||
function isNotExpired() { | ||
try { | ||
let expireTimeFromConsent = getExpireTimeFromConsent(consent, "YYYY-MM-DDTHH:mm:ss[Z]"); | ||
if (!expireTimeFromConsent) { | ||
return true; | ||
} | ||
return moment(currentDate) | ||
.isBefore(expireTimeFromConsent); | ||
} catch (e) { | ||
return true; | ||
} | ||
} | ||
|
||
const consentStatusLabel = (consent.currentStatus.toLowerCase() === | ||
specConfigurations.status.authorised.toLowerCase() && !isNotExpired()) | ||
? specConfigurations.status.expired : infoLabel.label; | ||
return ( | ||
<Container className="profileMain"> | ||
<img id="profileLogo" onError={handleImageError} src={isImageError ? ADRLogo : logoURL} width="50" height="50"/> | ||
<h4 className="mt-3">{appicationName}</h4> | ||
<> | ||
<div className="confirmLink"> | ||
<a id="confirmationReportLink" href="javascript:void(0);" | ||
onClick={() => generatePDF(consent, appicationName, consentStatusLabel)}> | ||
{`${infoLabel.profile.confirmation} `} | ||
<FontAwesomeIcon icon={faDownload} size="2xs" id= "downloadIcon"/> | ||
</a> | ||
</div> | ||
{consent.currentStatus.toLowerCase() === | ||
specConfigurations.status.authorised.toLowerCase() && isNotExpired() ? ( | ||
<div className="actionButtons"> | ||
<div className="actionBtnDiv"> | ||
<Link | ||
to={`/consentmgr/${consentConsentId}/withdrawal-step-1`} | ||
className="withdrawBtn" | ||
> | ||
{withdrawLang.detailedConsentPageStopSharingBtn} | ||
</Link> | ||
</div> | ||
</div> | ||
) : ( | ||
<div className="actionButtons"> | ||
</div> | ||
) | ||
} | ||
</> | ||
</Container> | ||
); | ||
}; |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Where are we revoking the tokens in CustomerCareOfficer scenario?
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.
The
revokeConsentWithReason
[1] method calls >revokeConsentWithReason
[2] in accelerator which calls >revokeTokens
[3] method.[1]
reference-implementation-consumerdatastandards-au/components/org.wso2.openbanking.cds.consent.extensions/src/main/java/org/wso2/openbanking/cds/consent/extensions/admin/impl/CDSConsentAdminHandler.java
Line 300 in 8dfced3
[2] https://github.com/wso2/financial-services-accelerator/blob/f1f8302b549aefa6a1ecf403de2ba19ddbf77b72/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java#L302
[3] https://github.com/wso2/financial-services-accelerator/blob/f1f8302b549aefa6a1ecf403de2ba19ddbf77b72/open-banking-accelerator/components/consent-management/com.wso2.openbanking.accelerator.consent.mgt.service/src/main/java/com/wso2/openbanking/accelerator/consent/mgt/service/impl/ConsentCoreServiceImpl.java#L372