Skip to content

Dev#543

Merged
shubhmjain30 merged 3 commits intomainfrom
dev
Apr 2, 2026
Merged

Dev#543
shubhmjain30 merged 3 commits intomainfrom
dev

Conversation

@shubhmjain30
Copy link
Copy Markdown
Member

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

🚨 Checklist:

  • Make sure you are requesting to pull your topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against our dev branch (left side). Also, you should start your branch off our dev branch.
  • Your code follows the code style of this project.
  • Your change requires a change to the documentation.
  • You have updated the documentation accordingly.
  • You have read the Contributing Guide.
  • You have self-reviewed your code.
  • You have added unit-tests that prove my fix is effective or that my feature works.
  • Lint and unit-tests pass locally with your changes.
  • You have added necessary comments for complex logic.
  • Any dependent changes have been merged and published in downstream modules.

Further comments

🙏 Thank you!

Thank you for contributing to this project. We appreciate your time and effort. 🎉

- Adjusted the indentation for better readability and consistency in the
  AddRecipientStep component. This change does not affect functionality
  but improves code maintainability.
- Enhance the OTP handling logic to display error messages for
  unhandled response types from the API. This includes showing
  appropriate toast notifications when the API returns unexpected
  response_type_ids, improving user feedback during the OTP
  submission process.
fix: handle unhandled response types in OTP flow
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wlc-webapp Ready Ready Preview, Comment Apr 2, 2026 6:28am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
satin-uat Ignored Ignored Apr 2, 2026 6:28am

Request Review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces error handling for unhandled API responses in the handleFetchBalance function by displaying a toast notification. It also adds a corresponding unit test and fixes indentation in the AddRecipientStep component. Feedback suggests using a more generic error title in the toast notification to accurately reflect different failure scenarios and recommends providing a more comprehensive mock for the useDigiKhataApi hook in tests to prevent potential runtime errors.

// Handle all other cases (e.g., Send OTP Failed or any unhandled response_type_id)
else {
toast({
title: res?.data?.message ?? "Send OTP Failed",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fallback title "Send OTP Failed" might be misleading here. The handleFetchBalance function is also responsible for direct balance updates (response type 309) which don't involve sending an OTP. A more generic title like "Request Failed" or "Fetch Balance Failed" would be more accurate.

Suggested change
title: res?.data?.message ?? "Send OTP Failed",
title: res?.data?.message ?? "Request Failed",

Comment on lines +15 to +23
jest.mock("features/digikhata/hooks/useDigiKhataApi", () => ({
__esModule: true,
useDigiKhataApi: () => ({
generateSenderOtp: mockGenerateSenderOtp,
isGeneratingSenderOtp: false,
verifySenderOtp: jest.fn(),
isVerifyingSenderOtp: false,
}),
}));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The mock for useDigiKhataApi is incomplete. It only includes 4 of the many properties returned by the hook. Since DigiKhataPage orchestrates multiple steps (e.g., AddRecipientStep, PanVerificationStep) that consume other parts of this hook, this mock will cause runtime errors if those steps are rendered during testing. Consider providing a more complete mock or using a helper to generate a default mock state.

@shubhmjain30 shubhmjain30 merged commit 3ca2657 into main Apr 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant