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_0 (already cloned)
- Base commit: c5c0e677f2a2d43170a66330c98e0ebc4d771717
- Task ID: juspay__hyperswitch-8389
- Version: v1.114.0
TASK DESCRIPTION: Bug: [FEATURE] Kv Redis feature for V2 models
Feature Description
Extend kv support for v2 models
Possible Implementation
Use existing construct to extend to v2 models
Have you spent some time checking if this feature request has been raised before?
- I checked and didn't find a similar issue
Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to submit a PR?
Yes, I am willing to submit a PR!
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
#8389
- Added Kv Redis support to - payment_intent V2, payment_attempt V2 models
- Added enable Kv route for v2 merchant-account
added enable kv api for v2 merchant account
curl --location 'https://<host>/v2/merchant-accounts/:mid/kv' \ --header 'Authorization: admin-api-key=***' \ --header 'x-organization-id:***' \ --header 'Content-Type: application/json' \ --data '{"kv_enabled" : true}'Additional Changes
- This PR modifies the API contract
Assistant
I'll help you implement KV Redis support for V2 models in the hyperswitch repository. Let me start by understanding the current state and structure of the codebase to identify where changes need to be made.
First, let me explore the repository structure to understand how KV Redis is currently implemented and where V2 models are defined.
Assistant
Let me first explore the codebase to understand the current KV Redis implementation and locate V2 models:
Assistant
(no content)
Assistant
Now let me examine the specific V2 models to understand their structure and how they relate to KV storage:
Assistant
Let me now check the payment attempt V2 model to understand its structure:
Assistant
Let me continue reading the payment attempt file to see more of its structure:
Assistant
Let me check how KV Redis is implemented in the codebase and examine the current storage scheme:
Assistant
Now let me check how the KV router store works and where merchant accounts are defined:
Assistant
Let me examine the merchant account routes to understand how KV is enabled:
Assistant
Let me now check the admin core module to see how KV is handled:
Assistant
Let me continue looking at the admin core module to find the KV-related functions:
Assistant
(no content)
Assistant
(no content)
Assistant
Let me read those KV functions:
Assistant
Now I need to understand what V2 models need KV support by examining the storage implementations. Let me check the diesel models to understand the structures:
Assistant
Let me find the V2 schema files:
Assistant
(no content)
Assistant
Let me check for the actual schema files:
Assistant
Let me look for the diesel models folder structure:
Assistant
(no content)
Assistant
Perfect! I found the V2 schema file. Now let me read it to understand what models exist:
Assistant
Let me check more of the schema file to find payment_intent and payment_attempt tables:
Assistant
Let me see the end of the file to understand all the V2 tables:
Assistant
Great! I can see that the V2 schema does indeed contain both
payment_intentandpayment_attempttables. Now let me understand how KV is used with V1 models by looking at how it's currently implemented for V1 payment intents:- User
Here are the existing contents of your todo list:
[1. [pending] Explore current KV Redis implementation in the codebase 2. [pending] Identify V2 models that need KV support 3. [pending] Find merchant account V2 API routes 4. [pending] Examine existing KV Redis functionality for V1 models 5. [pending] Implement KV Redis support for V2 payment_intent and payment_attempt models 6. [pending] Add enable KV route for V2 merchant accounts]
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.