Conversation
📝 WalkthroughWalkthroughThe PR modifies payment flow handling by removing automatic payment completion logic from PaymentProvider and adding conditional task navigation in PaymentComponent that refetches process state to determine if task position has changed before proceeding. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/publish |
PR release:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/features/payment/PaymentProvider.tsx`:
- Around line 65-67: The component currently treats missing applicationMetadata
as "no webhook" which allows skipPayment() to run prematurely; update the logic
around useApplicationMetadata and supportsPaymentWebhook so auto-advance is
gated until applicationMetadata is resolved — e.g., derive a tri-state
(unknown/true/false) by not calling supportsPaymentWebhook or by returning
undefined when applicationMetadata is undefined, then ensure the code paths that
call skipPayment(), auto-advance, or branches using supportsPaymentWebhook
(references: useApplicationMetadata, applicationMetadata,
supportsPaymentWebhook, skipPayment) explicitly check for metadata being
resolved (applicationMetadata !== undefined) or for supportsPaymentWebhook !==
undefined before proceeding so skipPayment only runs once webhook capability is
known.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/features/payment/PaymentProvider.tsxsrc/layout/Payment/PaymentComponent.tsxsrc/utils/versioning/versions.ts
| const applicationMetadata = useApplicationMetadata(); | ||
| const supportsPaymentWebhook = appSupportsPaymentWebhook(applicationMetadata?.altinnNugetVersion); | ||
|
|
There was a problem hiding this comment.
Gate auto-advance until application metadata is resolved.
Right now, unknown metadata is treated as “no webhook support”, so skipPayment() may still run before webhook capability is known.
Suggested fix
const applicationMetadata = useApplicationMetadata();
- const supportsPaymentWebhook = appSupportsPaymentWebhook(applicationMetadata?.altinnNugetVersion);
+ const hasResolvedApplicationMetadata = applicationMetadata !== undefined;
+ const supportsPaymentWebhook = applicationMetadata
+ ? appSupportsPaymentWebhook(applicationMetadata.altinnNugetVersion)
+ : false;
@@
useEffect(() => {
+ if (!hasResolvedApplicationMetadata) {
+ return;
+ }
if (isPaymentProcess && paymentCompleted && !isPdf && !supportsPaymentWebhook) {
skipPayment();
}
- }, [isPaymentProcess, paymentCompleted, skipPayment, isPdf, supportsPaymentWebhook]);
+ }, [
+ hasResolvedApplicationMetadata,
+ isPaymentProcess,
+ paymentCompleted,
+ skipPayment,
+ isPdf,
+ supportsPaymentWebhook,
+ ]);Also applies to: 93-97
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/features/payment/PaymentProvider.tsx` around lines 65 - 67, The component
currently treats missing applicationMetadata as "no webhook" which allows
skipPayment() to run prematurely; update the logic around useApplicationMetadata
and supportsPaymentWebhook so auto-advance is gated until applicationMetadata is
resolved — e.g., derive a tri-state (unknown/true/false) by not calling
supportsPaymentWebhook or by returning undefined when applicationMetadata is
undefined, then ensure the code paths that call skipPayment(), auto-advance, or
branches using supportsPaymentWebhook (references: useApplicationMetadata,
applicationMetadata, supportsPaymentWebhook, skipPayment) explicitly check for
metadata being resolved (applicationMetadata !== undefined) or for
supportsPaymentWebhook !== undefined before proceeding so skipPayment only runs
once webhook capability is known.
|
|
/publish |
PR release:
|


Description
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit