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_2 (already cloned)
- Base commit: 4f4e31db24652e72ce50745e9d64618c93c692bc
- Task ID: juspay__hyperswitch-7843
- Version: v1.113.0
TASK DESCRIPTION: Bug: Fix Cypress v2 Core Flows Test Failures
The Cypress tests for v2 failed due to the recent authentication changes introduced in PR #7487 and payment method config changes.
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
- Changed the Authorization in the
commands.jsbecause Authorization changes had been made recently. - Changed field names in
payment_methods_enabledaccordingly as accepted by v2 endpoints.
Additional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
The v2 Cypress Tests were failing due to the recent Authentication Changes in #7487.
How did you test it?
Before
After
Checklist
- I formatted the code
cargo +nightly fmt --all - I addressed lints thrown by
Assistant
I'll help you fix the Cypress v2 Core Flows Test Failures. Let me first understand the issue by examining the repository structure and identifying the relevant files that need to be updated due to the authentication changes in PR #7487.
Assistant
Let me first explore the repository structure to locate the Cypress test files and understand the current setup.
Assistant
Now let me examine the commands.js file which was mentioned as needing updates for authentication changes:
Assistant
Let me examine both commands.js files to see what authentication changes were made:
Assistant
Let me also check the other commands.js file in the main cypress-tests directory:
Assistant
Let me look at the core test files that are failing to understand what needs to be changed. First, let me look at the specific test files that are mentioned as failing:
Assistant
(no content)
Assistant
Now I need to check the Commons.js file to understand the payment_methods_enabled structure:
Assistant
Let me check what changes were made in PR #7487 by looking at the git log and examining the commit referenced in the task description:
Assistant
Let me look at the specific commit mentioned in the task description to understand what changes were made:
Assistant
Let me search for recent authentication related changes that may be affecting the Cypress tests. Let me also check if there are any recent commits related to auth changes:
Assistant
Let me look for any commits related to API key or authentication changes:
Assistant
Now let me look at the specific commit that's mentioned in the PR description to understand what changed in the authentication system:
Assistant
Let me look for specific changes to understand how the authentication has changed in v2 APIs. Let me also search for recent changes to the payment methods enabled structure:
Assistant
Looking at the evidence I've gathered, I can see the main issues that need to be addressed in the Cypress v2 Core Flows test failures:
- The authentication headers have changed from
"api-key": api_keyto something else (likely"Authorization: Bearer"or a different header pattern) in some v2 endpoints - The
payment_methods_enabledfield structure might have changed to be more aligned with the v2 API specifications
Let me update the todos to reflect the current understanding:
- The authentication headers have changed from
Assistant
Looking at the commands.js file more closely, I can see some authentication changes that were made. From lines 817-818 and 859-860, I can see that the routing APIs now use:
codeAuthorization: `Bearer ${api_key}`But most other v2 APIs still seem to use:
code"api-key": api_keyHowever, I need to look more carefully at what specific changes happened in PR #7487 to understand what needs to be fixed. Let me check the specific patterns around authentication headers in the code and compare what's needed versus what's currently implemented.
Based on the information I've gathered and analyzing the differences between the test files and the command implementations, I can see that the main issues are:
- Some authentication mechanisms have shifted to Bearer tokens instead of API keys in some endpoints
- The payment_methods_enabled structure may have changed for v2 compatibility
Let me update the authentication headers properly and fix the payment methods structure as needed.
Assistant
Let me carefully check what changes actually need to be made by looking at the exact authentication patterns used in the file. Looking again at the commands.js file, I noticed that I should make changes to the headers used for some of the v2 APIs. Let me focus on the areas that need to be updated based on the pattern I see in the routing calls.
Looking at the file, I can see some authentication patterns that have changed from
api-keytoAuthorization: Bearerfor certain endpoints (like routing). But for the core APIs like merchant accounts, organizations, etc., theapi-keyheader seems to still be used correctly.The key issue may be that the test files are not aligning with what the API now expects, particularly in how payment_methods_enabled is passed to the merchant connector account creation.
Let me look at the specific payment methods structure that may have changed:
Assistant
Let me take a more strategic approach. Based on the PR description and what I see in the commands.js file, I need to check if there are issues with the
payment_methods_enabledfield structure in the MCA (Merchant Connector Account) creation calls.Let me first identify exactly where the problems lie by checking how the authentication patterns differ in v2 compared to what's expected:
Assistant
I see there are 2 places where Authorization: Bearer is used in the routing APIs. According to the PR description, it looks like there was a shift from using the api-key header to using Bearer token authentication in some cases. Let me now check if there are any recent issues or problems that might be manifesting in the test failures.
Looking more closely at the problem, I believe the issue might be in how the
payment_methods_enabledfield is structured in the v2 API. Let me focus on the key differences between what the tests expect and what v2 might require.Looking at line 470 in the commands.js file, I can see:
javascriptmcaCreateBody.payment_methods_enabled = paymentMethodsEnabled;This line looks like it's passing the payment methods structure, but perhaps in v2 the structure has changed slightly or there's an expectation about how it should be formatted.
Let me update the todo list to be more specific about the actions needed and focus on the key problem areas that I can identify:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.