Skip to content

Commit

Permalink
fix: prevent NotFoundPage on successful redemption while still on Ext…
Browse files Browse the repository at this point in the history
…ernalCourseEnrollment (#1197)
  • Loading branch information
adamstankiewicz committed Sep 20, 2024
1 parent f35543e commit f7bcbfe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/course/routes/ExternalCourseEnrollment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const ExternalCourseEnrollment = () => {
// current date is outside the enrollment window of the run.
if (userSubsidyApplicableToCourse.subsidyType === LEARNER_CREDIT_SUBSIDY_TYPE) {
const canRedeemDataCourseRun = redeemabilityPerContentKey.find(r => r.contentKey === courseRunKey);
if (!canRedeemDataCourseRun?.canRedeem) {
if (!canRedeemDataCourseRun?.canRedeem && !canRedeemDataCourseRun?.hasSuccessfulRedemption) {
return <NotFoundPage />;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,21 @@ describe('ExternalCourseEnrollment', () => {
},
LEARNER_CREDIT_SUBSIDY_TYPE,
],
// The auto-selected subsidy type is learner credit, and the specific requested run is already redeemed.
[
{
contentKey: mockCourseRunKey,
hasSuccessfulRedemption: true,
canRedeem: false,
},
LEARNER_CREDIT_SUBSIDY_TYPE,
],
// The specific run is not redeemable via LC, but that's okay because we're not using learner credit anyway.
[
{
contentKey: mockCourseRunKey,
hasSuccessfulRedemption: false,
canRedeem: false, // Not redeemable!?
canRedeem: false, // Not redeemable
},
LICENSE_SUBSIDY_TYPE, // Auto-selected subsidy type is not learner credit anyway, so allow the page to render.
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const RegistrationSummaryCard = ({ priceDetails }) => (
</del>
</div>
<div className="d-flex justify-content-end mr-2.5">
${priceDetails?.price ? `${String(0).padStart(priceDetails.price.toString().length, '0') }.00` : '0.00'} {priceDetails?.currency ? priceDetails.currency : CURRENCY_USD}
{priceDetails?.price ? `$${numberWithPrecision(0)} ${priceDetails?.currency ? priceDetails.currency : CURRENCY_USD}` : '-'}
</div>
<div className="d-flex justify-content-end small font-weight-light text-gray-500 mr-2.5">
<FormattedMessage
Expand Down

0 comments on commit f7bcbfe

Please sign in to comment.