Skip to content

map mandate_refernce to resource_id - #6

Open
AkshayaFoiger wants to merge 1 commit into
mainfrom
trial
Open

map mandate_refernce to resource_id#6
AkshayaFoiger wants to merge 1 commit into
mainfrom
trial

Conversation

@AkshayaFoiger

@AkshayaFoiger AkshayaFoiger commented May 8, 2025

Copy link
Copy Markdown
Owner

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 Bito

This pull request enhances the transaction response handling in the Stripe connector by updating the mapping of mandate_reference to resource_id, improving the accuracy of transaction data.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2 - The changes are straightforward and primarily involve mapping updates, making the review process relatively simple.

Summary by CodeRabbit

  • Bug Fixes
    • Updated transaction responses to use the mandate reference for resource identification instead of the Stripe transaction ID. This affects how transactions are identified in responses.

@coderabbitai

coderabbitai Bot commented May 8, 2025

Copy link
Copy Markdown

Walkthrough

The change updates the way the TransactionResponse is constructed in the Stripe connector transformer. It now sets the resource_id field to use the mandate_reference instead of the Stripe transaction id, and ensures the mandate_reference is cloned and boxed. No other logic or control flow is modified.

Changes

File(s) Change Summary
crates/router/src/connector/stripe/transformers.rs Modified TryFrom implementation: resource_id now uses mandate_reference, which is also cloned.

Poem

In the land of Stripe, IDs once reigned,
But now the mandate is what’s retained.
A clone, a box, a gentle shift,
Resource identity gets a lift.
With every hop, the rabbits cheer,
For tidy code and logic clear! 🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 e4fca25 and 81f1bdc.

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

2540-2542: Mapping mandate_reference to resource_id successfully implemented.

The changes correctly implement the mapping of mandate_reference to resource_id while maintaining the original Stripe transaction ID in connector_response_reference_id. This enables better mandate tracking through the resource identifier while preserving backward compatibility.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

@AkshayaFoiger

Copy link
Copy Markdown
Owner Author

@coderabbitai is marking resource_id to mandate id correct according to hyperswitch implementation

@coderabbitai

coderabbitai Bot commented May 8, 2025

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's check the actual diff of the changes
git diff e4fca2589bd7b59d3cff18b96a4d1ba518d47cfb 81f1bdc9fe0611d8ce6c8b9da32ed5b2b64d47af -- crates/router/src/connector/stripe/transformers.rs

Length of output: 1150


@AkshayaFoiger Yes, mapping the resource_id to the mandate reference instead of the Stripe transaction ID appears to be correct for the Hyperswitch implementation. The change ensures that:

  1. The resource_id now uses the mandate reference value (mandate_reference.clone())
  2. The original Stripe transaction ID is still preserved in the connector_response_reference_id field
  3. The mandate_reference is properly cloned before being boxed

This approach maintains all the necessary information while establishing the mandate reference as the primary identifier, which seems to align with Hyperswitch's intended implementation pattern.


✏️ Learnings added
Learnt from: AkshayaFoiger
URL: https://github.com/AkshayaFoiger/hyperswitch/pull/6

Timestamp: 2025-05-08T19:55:53.695Z
Learning: In the Hyperswitch implementation for the Stripe connector, the `resource_id` field should use the mandate reference value rather than the Stripe transaction ID, with the original Stripe ID preserved in the `connector_response_reference_id` field.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

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