Skip to content

fix(router): conditionally store saved cards with cvc in temp locker … - #4

Open
AkshayaFoiger wants to merge 1 commit into
mainfrom
complete-auth-cvv
Open

fix(router): conditionally store saved cards with cvc in temp locker …#4
AkshayaFoiger wants to merge 1 commit into
mainfrom
complete-auth-cvv

Conversation

@AkshayaFoiger

@AkshayaFoiger AkshayaFoiger commented Apr 23, 2025

Copy link
Copy Markdown
Owner

…based on config

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

Summary by CodeRabbit

  • Bug Fixes
    • Ensured that payment tokens are correctly retrieved and assigned when not already set during payment processing.

Summary by Bito

This PR updates the payments helper module to conditionally fetch payment tokens when missing, using asynchronous retrieval via the payment_methods function. The changes enhance payment process reliability, improve saved card handling, and strengthen error resilience in the payment flow.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 1

@coderabbitai

coderabbitai Bot commented Apr 23, 2025

Copy link
Copy Markdown

Walkthrough

A conditional logic block was added within the existing make_pm_data asynchronous function in the payment helpers module. This new block checks if the token field in payment_data is None for certain feature flags. If the token is missing, the function retrieves it using another core function and assigns the result to payment_data.token. The overall function signature and public interface remain unchanged.

Changes

File Change Summary
crates/router/src/core/payments/helpers.rs Added logic in make_pm_data to check and retrieve a payment token if it is not already set in payment_data.

Poem

In the warren of payments, a token was missed,
So a helper hopped in, ensuring none are dismissed.
Now if a token is missing, it’s fetched with great care,
And payment data’s complete—no gaps anywhere!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0797ea8 and 7cb0b51.

📒 Files selected for processing (1)
  • crates/router/src/core/payments/helpers.rs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Check compilation for V2 features
  • GitHub Check: Check compilation on MSRV toolchain (ubuntu-latest)
  • GitHub Check: Check wasm build
  • GitHub Check: Verify consistency of migrations with schema.rs file
🔇 Additional comments (1)
crates/router/src/core/payments/helpers.rs (1)

2646-2658: Token retrieval logic enhancement looks good.

This change adds a fallback mechanism to retrieve and set the payment token when it's not already present. The implementation correctly handles error propagation and only performs the additional call when necessary.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bito-code-review

bito-code-review Bot commented Apr 23, 2025

Copy link
Copy Markdown

Code Review Agent Run #3f7c7d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 7cb0b51..7cb0b51
    • crates/router/src/core/payments/helpers.rs
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at mownika.pyla@juspay.in.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

Copy link
Copy Markdown

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Bug Fix - Conditional Update to Payment Token

helpers.rs - Added a conditional block to check and retrieve a missing payment token, ensuring reliable payment processing.

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