Skip to content

refactor: update recipient deletion logic in DigiKhata API#553

Merged
shubhmjain30 merged 4 commits intodevfrom
refactor/digikhata
Apr 10, 2026
Merged

refactor: update recipient deletion logic in DigiKhata API#553
shubhmjain30 merged 4 commits intodevfrom
refactor/digikhata

Conversation

@shubhmjain30
Copy link
Copy Markdown
Member

  • Refactor the recipient deletion process to use beneficiary_id instead of recipient_id for improved clarity and consistency.
  • Update the verifyDeleteRecipientOtp function to include recipient_id from the pendingDeleteRecipient state, ensuring accurate OTP verification.

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. 🎉

- Refactor the recipient deletion process to use beneficiary_id instead of
  recipient_id for improved clarity and consistency.
- Update the verifyDeleteRecipientOtp function to include recipient_id
  from the pendingDeleteRecipient state, ensuring accurate OTP verification.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 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 10, 2026 6:39am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
satin-uat Ignored Ignored Apr 10, 2026 6:39am

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 refactors the recipient deletion flow by transitioning from recipient_id to beneficiary_id for OTP requests and introducing a dedicated payload interface for verification. Feedback highlights a critical inconsistency in the onResend logic which still utilizes the old identifier, and suggests using beneficiary_id during the verification step to ensure consistency across the deletion process.


const handleDeleteRecipient = async (recipient: Recipient) => {
const res = await sendDeleteRecipientOtp(recipient.recipient_id);
const res = await sendDeleteRecipientOtp(recipient.beneficiary_id ?? 0);
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.

high

The refactor to use beneficiary_id for recipient deletion is inconsistent with the onResend logic in the OtpModal (line 645), which still passes recipient_id to sendDeleteRecipientOtp. Since the function signature was updated in useDigiKhataApi.ts to expect beneficiaryId and send it as beneficiary_id in the request body, the resend functionality will fail or target the wrong identifier. Please update the onResend handler to use pendingDeleteRecipient.beneficiary_id ?? 0.

const res = await verifyDeleteRecipientOtp({
otp,
otp_ref_id: deleteOtpRefId,
recipient_id: pendingDeleteRecipient.recipient_id,
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

This call site should use beneficiary_id to match the intended refactor for the deletion flow, ensuring that the same identifier is used for both the OTP request and the verification step.

Suggested change
recipient_id: pendingDeleteRecipient.recipient_id,
beneficiary_id: pendingDeleteRecipient.beneficiary_id ?? 0,

- Changed the recipient ID used in the resend OTP function to
  utilize beneficiary_id instead of recipient_id. This ensures
  the correct identifier is used for OTP operations related to
  recipient deletion.
- Update the RecipientsStep component to only display the delete button
  if the recipient has a valid beneficiary_id. This change improves the
  user interface by preventing unnecessary actions on recipients without
  a beneficiary ID.
@shubhmjain30 shubhmjain30 merged commit 1f9a1bc into dev Apr 10, 2026
3 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