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: a0c2a6bc823fdeac193875a04ea04e7d9a81cbc2
- Task ID: juspay__hyperswitch-8934
- Version: v1.116.0
TASK DESCRIPTION: Bug: Update traditional chinese locale for payent link expired
Update traditional chinese locale for payent link expired
DETAILED CONTEXT & HINTS:
Type of Change
- Bugfix
- New feature
- Enhancement
- Refactoring
- Dependency updates
- Documentation
- CI/CD
Description
We need to update traditional chinese locale for payment link expired.
Additional Changes
- This PR modifies the API contract
- This PR modifies the database schema
- This PR modifies application configuration/environment variables
Motivation and Context
Raised by the merchant to update the locale to the correct one as shared by them.
How did you test it?
use below curl for payment link create and wait for 60 secs for payment link to get expired:
codecurl --location 'http://localhost:8080/payments' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'api-key: ***' \ --header 'Accept-Language: zh-Hant' \ --data '{ "amount": 10, "setup_future_usage": "off_session", "currency": "EUR", "payment_link": true, "session_expiry": 60, "return_url": "https://google.com", "payment_link_config": { "theme": "#14356f", "logo": "https://logo.com/wp-content/uploads/2020/08/zurich.svg", "seller_name": "Zurich Inc." } }' Assistant
I need to address a bug related to updating the Traditional Chinese locale for payment link expired messages. Let me start by understanding the codebase structure and locating the relevant files.
First, I'll explore the repository structure to understand where locale files might be located:
Assistant
I see there's a
zh.ymlfile which likely corresponds to Chinese locales. Let me also search for payment link related code and "expired" messages to understand the context better.Assistant
Let me search more broadly for "expired" or "payment link" related terms:
Assistant
Let me search for payment link related terms in Rust files:
Assistant
Let me check for "link_expired" specifically in the codebase:
Assistant
Let me search for "expired" in the Rust files to find where this message might be defined:
Assistant
Let me look for payment link related code specifically in the locales directory and also check if there are any files that might contain the translation key for payment link expired:
Assistant
Now let me also check if there's a "zh-hant.yml" or similar file for Traditional Chinese:
Assistant
Let me also look at the English locale file to understand the structure better:
Assistant
Now let me search more specifically for payment link related keys that might contain expired message:
Assistant
(no content)
Assistant
Now I need to understand what specific message is displayed when a payment link expires. Let me search for payment link status handling or similar:
Assistant
Let me look at the payment_link.rs file that was identified to understand how the status is handled:
Assistant
Now I need to look for how the localization is handled in the frontend templates or where the actual "expired" message might be displayed. Let me check the API models to understand the structure better:
Assistant
Let me search more specifically for PaymentLinkStatus definition:
Assistant
(no content)
Assistant
(no content)
Assistant
(no content)
Assistant
(no content)
Assistant
Let me look for the actual localization keys that might be used for displaying payment link expired messages. I need to check how translations work in the system. Let me also look for any localization or translation related code:
Assistant
Looking at the task description again, I understand that we need to update the Traditional Chinese locale for payment link expired message. From what I've found in the codebase, the
PaymentLinkStatus::Expiredenum is used but there's no specific localized message for this in the locale files.Based on the issue description and the user's curl example showing
Accept-Language: zh-Hant, I need to check what the actual message that should be shown when a payment link is expired should be in Traditional Chinese. Since I don't see an explicit "expired" message in the locale files yet, I'll create a task list and then make the appropriate change.Let me create a proper plan to make the fix:
Assistant
Let me first look for any existing tests or examples that might show what the expected Traditional Chinese message should be:
Assistant
Let me first check if there are any test files that might reveal what the expected message is:
Assistant
Let me search in a broader way for payment link related tests:
Assistant
Let me take a closer look at the current structure of the Chinese locale file and see if I can find what would be the appropriate message for "expired" in Traditional Chinese. Based on the context and looking at the payment link status logic, when a payment link is expired, it should show a message indicating that the link has expired.
Since I need to update the Traditional Chinese locale, and from the user's curl example, they mentioned "Accept-Language: zh-Hant", I need to add the appropriate translation. Looking at the existing Chinese locale file, I see it's a simplified Chinese (zh.yml) file but I don't see a Traditional Chinese version.
Let me update the todo list to be more specific:
Assistant
Looking at the issue description again, I notice that the user said they were raising the issue because a merchant wanted the locale to be updated to the correct one as shared by them. The issue is about updating the Traditional Chinese localization for payment link expired.
Let me first read the current Chinese locale file to understand its structure:
Assistant
I need to create a proper Traditional Chinese locale file (zh-hant.yml) or add the missing translation to the existing one. Looking at the task and the user's example showing "Accept-Language: zh-Hant", they're expecting Traditional Chinese.
Based on the user's issue and the fact that they provided the curl example with
zh-Hant, it seems like the requirement is to add proper Traditional Chinese localization.Looking at the code, I need to add the appropriate message for when a payment link has expired. Since the payment link status logic in
payment_link.rsreturnsPaymentLinkStatus::Expired, and from the API model I saw there's aPaymentLinkStatusenum withExpiredvariant, I need to make sure that when a payment link is expired, there's a proper message shown.However, I don't see an explicit message being stored in the locale files for "expired". Let me think about this differently.
In the payment_link.rs file, I saw that when a payment link is expired, the system shows a payment link status page with the status. Looking at the flow, it seems like the status is displayed rather than a specific localized message about expiration.
Assistant
I need to check how the localization is actually used in the frontend or backend to understand where exactly the "payment link expired" message would appear. Based on the code I reviewed, I see that when a payment link status is checked, it returns , but I don't see where this gets localized to a specific message text.
Assistant
Let me take a step back and think about this more systematically. Since I can't find the specific "payment link expired" message in the codebase but the user is reporting this as a bug to be fixed, and the task involves "Traditional Chinese locale for payment link expired", let me understand what might be missing.
Based on the issue description, it sounds like there may be a missing or incorrect localization for the scenario when a payment link has expired. The user mentioned they got a request from a merchant to update the locale to the correct one.
Looking at the payment link logic and the code in
payment_link.rs, I see that when a payment link has expired, it sets the status toPaymentLinkStatus::Expiredand shows it in the payment link status page. This means that there might be a template or some rendering code that looks for a particular translation key for "expired".However, I don't see a specific translation key for "expired" in the existing locales. Let me approach this by first understanding how this would work in practice.
Let me just create the Traditional Chinese locale file as the primary action, and based on typical practices for payment system UIs, the "expired" message would likely be something like "支付連結已過期" or "Payment Link Expired".
Assistant
Looking at this issue more systematically, since I don't have access to write files in the environment, I'll have to work around that constraint. Based on the issue description and what I can observe in the codebase:
- The issue is about updating the Traditional Chinese locale for payment link expired
- The user is specifically mentioning
Accept-Language: zh-Hant - In payment_link.rs, I can see there's logic for handling payment link status checking
- Looking at the existing
zh.ymlfile, it's for Simplified Chinese, but there's no Traditional Chinese version (zh-hant.yml) - The payment_link status flow returns
PaymentLinkStatus::Expiredwhen a payment link has expired
The most logical solution is to create a Traditional Chinese locale file that follows the same structure as the Simplified Chinese one, but I can't write files directly due to permissions.
Let me check if there are existing patterns in the codebase where similar localization would be handled:
Assistant
(no content)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.