-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(connectors): [worldpayvantiv] add connector mandate support #8546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Changed Files
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
WalkthroughThe changes refactor mandate information extraction for card payments by moving the Changes
Sequence Diagram(s)sequenceDiagram
participant Requester
participant PayboxConnector
participant Utils
Requester->>PayboxConnector: Initiate Mandate Payment Authorization
PayboxConnector->>Utils: get_card_mandate_info()
Utils-->>PayboxConnector: CardMandateInfo or Error
PayboxConnector-->>Requester: Proceed with authorization or error
sequenceDiagram
participant Requester
participant WorldpayVantivConnector
participant Utils
Requester->>WorldpayVantivConnector: Initiate Mandate Payment Authorization
WorldpayVantivConnector->>Utils: get_card_mandate_info() (if needed)
Utils-->>WorldpayVantivConnector: CardMandateInfo or Error
WorldpayVantivConnector->>WorldpayVantivConnector: get_processing_info()
WorldpayVantivConnector->>WorldpayVantivConnector: get_vantiv_card_data()
WorldpayVantivConnector-->>Requester: Authorization request with tokenization/mandate info
WorldpayVantivConnector-->>Requester: Response with tokenization/mandate info
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Clippy (1.86.0)
error: failed to get Caused by: Caused by: Caused by: Caused by: ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs (1)
540-588
: Consider adding more specific error context.The refactored function is well-structured and handles all mandate scenarios appropriately. However, when
get_card_mandate_info()
fails, it might be helpful to add context about which mandate scenario failed.Consider wrapping the error with context:
- let card_mandate_data = request.get_card_mandate_info()?; + let card_mandate_data = request.get_card_mandate_info() + .change_context(errors::ConnectorError::MissingRequiredField { + field_name: "card_mandate_info" + })?;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs
(2 hunks)crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
(18 hunks)crates/hyperswitch_connectors/src/utils.rs
(3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: swangi-kumari
PR: juspay/hyperswitch#8199
File: crates/api_models/src/payments.rs:5633-5648
Timestamp: 2025-06-11T07:14:32.038Z
Learning: The absence of the `merchant_connector_details` field in the `PaymentsStatusRequest` struct (in `crates/api_models/src/payments.rs`) is intentional and should not be added, as per project owner guidance.
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs (1)
Learnt from: swangi-kumari
PR: juspay/hyperswitch#8199
File: crates/api_models/src/payments.rs:5633-5648
Timestamp: 2025-06-11T07:14:32.038Z
Learning: The absence of the `merchant_connector_details` field in the `PaymentsStatusRequest` struct (in `crates/api_models/src/payments.rs`) is intentional and should not be added, as per project owner guidance.
crates/hyperswitch_connectors/src/utils.rs (1)
undefined
<retrieved_learning>
Learnt from: swangi-kumari
PR: #8199
File: crates/api_models/src/payments.rs:5633-5648
Timestamp: 2025-06-11T07:14:32.038Z
Learning: The absence of the merchant_connector_details
field in the PaymentsStatusRequest
struct (in crates/api_models/src/payments.rs
) is intentional and should not be added, as per project owner guidance.
</retrieved_learning>
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs (1)
Learnt from: swangi-kumari
PR: juspay/hyperswitch#8199
File: crates/api_models/src/payments.rs:5633-5648
Timestamp: 2025-06-11T07:14:32.038Z
Learning: The absence of the `merchant_connector_details` field in the `PaymentsStatusRequest` struct (in `crates/api_models/src/payments.rs`) is intentional and should not be added, as per project owner guidance.
⏰ Context from checks skipped due to timeout of 900000ms (5)
- GitHub Check: Validate generated OpenAPI spec file
- GitHub Check: Check wasm build
- GitHub Check: Check compilation for V2 features
- GitHub Check: Check compilation on MSRV toolchain (ubuntu-latest)
- GitHub Check: Run Cypress tests
🔇 Additional comments (11)
crates/hyperswitch_connectors/src/utils.rs (3)
245-249
: Well-structured mandate info struct with proper security handling.The
CardMandateInfo
struct is well-designed with appropriate use ofSecret<String>
for sensitive card expiration data. The derive macros are appropriate for the intended use case.
1712-1712
: Clean trait method signature for centralized mandate extraction.The new trait method provides a clean interface for extracting mandate information across different payment connectors, promoting code reuse and consistency.
1948-1967
: Excellent error handling and data extraction logic.The implementation properly handles all edge cases:
- Correctly extracts card expiration data from the nested structure
- Provides specific error messages for missing required fields
- Uses appropriate error types for different failure scenarios
- Maintains security by preserving
Secret<String>
wrapperThe pattern matching and Option handling are idiomatic Rust code.
crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs (2)
27-27
: LGTM: Clean import update for refactored mandate extraction.The import changes correctly bring in the required
CardMandateInfo
andPaymentsAuthorizeRequestData
trait for the centralized mandate extraction approach.
464-464
: LGTM: Excellent refactoring to centralize mandate data extraction.The change from manual mandate data extraction to using the
get_card_mandate_info()
trait method is a clean improvement that:
- Centralizes mandate extraction logic in a shared utility
- Reduces code duplication across connectors
- Maintains proper error handling with the
?
operator- Follows DRY principles and improves maintainability
This aligns well with the broader PR objective to standardize mandate handling across connectors.
crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs (6)
11-11
: LGTM!The imports are correctly added and necessary for the mandate functionality.
Also applies to: 18-18
235-240
: LGTM!The
TokenizationData
struct is well-designed with appropriate use ofSecret<String>
for sensitive fields.
242-247
: LGTM!The struct modifications properly implement the dual card/token payment support with appropriate serialization attributes.
Also applies to: 175-185, 199-209
2883-2920
: LGTM!Good extraction of card data logic into a helper function. The function correctly handles all payment method types and returns
None
for mandate payments where card data isn't needed.
789-798
: LGTM!The
TokenResponse
struct and its conversion toMandateReference
are properly implemented. The use ofexpose()
is appropriate here as the token needs to be accessible in the mandate reference.Also applies to: 1176-1185
453-453
: LGTM!The integration of the helper function and mandate processing info is clean and correct.
Also applies to: 502-504, 518-520
The base branch was changed.
…ayload-webhooks * 'main' of github.com:juspay/hyperswitch: refactor(connector): Move connector mappings and endpoints to dedicated modules (#8562) ci(cypress): fix `hipay` test cases (#8563) chore(version): 2025.07.09.0 fix(payment_method): update entity id used for Vault to global customer id (#8380) refactor(routing): add conditional check for invoking DE routing flows (#8559) feat(connector): [AUTHIPAY] Integrate cards non 3ds payments (#8266) ci(cypress): add payu connector (#8567) feat(connector): [silverflow] template code (#8553) chore(version): 2025.07.08.0 feat(cypress): [worldpayvantiv] add cypress test (#8234) feat(connectors): [worldpayvantiv] add connector mandate support (#8546) feat(connector): [Celero] add Connector Template Code (#8489) feat(payment-methods): create payment_token in vault confirm / do payment-confirm with temp token from session (#8525) ci(cypress): Add Tsys,Square cypress test (#8543) chore(version): 2025.07.07.0
Type of Change
Description
Add connector mandate support for vantiv cards
Note: This feature has to be enabled at Vantiv
How did you test it?
Create a Customer Initiated Mandate
Response
Psync
Create a Merchant Initiated Transaction
Response
Psync
Checklist
cargo +nightly fmt --all
cargo clippy
Summary by CodeRabbit
New Features
Bug Fixes
Refactor