You are working on the hyperswitch repository (Rust payment processing system).…
- User
You are working on the hyperswitch repository (Rust payment processing system).
REPOSITORY SETUP:
- Repository: juspay/hyperswitch
- Working directory: ./repos/hyperswitch_pool_7 (already cloned)
- Base commit: d91cf70ae346cbf613ce5c1cfad2ae8a28c71d1c
- Task ID: juspay__hyperswitch-8176
- Version: v1.114.0
TASK DESCRIPTION: Bug: Properly Handle encoded_data in PSync flow [v2]
PSync is failing for adyen with error:
validate_psync_reference_id failed. We need to pass theencoded_datain payment_attemptDETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
Add
encoded_datafromPaymentsRetrieveRequestinpayment_attemptinsideget_trackersfor PSyncAdditional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
Closes #8176
How did you test it?
No visible changes in API response. Verified that payment status changes to
succeeded.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
Assistant
I'll tackle this bug fix for the PSync flow with Adyen. Let me first understand the issue and locate the relevant files.
The bug is that
validate_psync_reference_id failedwhen using PSync with Adyen, and we need to properly handleencoded_datain thepayment_attemptwithin theget_trackersfunction.Let me start by exploring the codebase to understand the structure and locate the relevant files.
Assistant
Let me start by exploring the codebase to understand the structure and locate the relevant files related to PSync flow and payment attempts.
Assistant
(no content)
Assistant
Now let me search for the specific error mentioned in the issue: "validate_psync_reference_id failed".
Assistant
Let me examine the Adyen connector implementation where the error occurs:
Assistant
(no content)
Assistant
Let me look at the psync_flow.rs file to understand the flow:
Assistant
Now let me examine the transformer functions that handle constructing router data for PSync:
Assistant
(no content)
Assistant
Let me search for the specific function construct_router_data_for_psync:
Assistant
Let me continue searching for this function:
Assistant
Let me check what the specific function looks like in the transformers file by looking further down:
Assistant
Let me search more specifically for the PSync related transformers:
Assistant
Let me check the PaymentsRetrieveRequest definition more closely:
Assistant
Now let me check the v2 version of the PaymentsRetrieveRequest to understand its structure better:
Assistant
Let me also examine the payment_attempt structure to understand how it relates to PSync:
Assistant
Let me look specifically at how the PSync flow handles the request data to understand how to pass encoded_data:
Assistant
Let me now look at the payment_attempt model to see if it has encoded_data:
Assistant
Let me look for how encoded_data is used in PSync context in Adyen connector:
Assistant
Let me examine how payment attempt is being constructed during PSync flow to understand where encoded_data should be passed. Let me look more closely at the psync_flow.rs file again to find the issue:
Assistant
Looking at the issue description, the key point is that "we need to pass the
encoded_datain payment_attempt". The issue is that when validating PSync reference ID in Adyen connector, thevalidate_psync_reference_idfunction is failing. This suggests that theencoded_datafield in thePaymentsRetrieveRequestis not being correctly passed through to thepayment_attempt.Let me check what
encoded_datashould contain. Looking at the context, this seems to be related to payment connector reference ID validation in PSync flow. In the PSync flow, we have thePaymentsRetrieveRequestwith aparamfield that likely contains encoded data, but it's not being passed into the payment attempt in the right way.Let me look at how PSync gets the payment attempt from the get_trackers and understand where the connection should be made:
Assistant
Let me search for more specific information about how PSync data flows through the system to understand where encoded_data needs to be added:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.