hyperswitch
hyperswitch copied to clipboard
feat(payout_link): add localisation support for payout link's templates
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Described in #5559
This uses a forked version of rust-i18n
which handles string index slicing
original - https://github.com/longbridgeapp/rust-i18n
forked - https://github.com/kashif-m/rust-i18n/commits/v3.1.1-safe
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
How did you test it?
1. Create a payout link (without passing any locale in create request)
curl --location 'http://localhost:8080/payouts/create' \ --header 'Content-Type: application/json' \ --header 'api-key: dev_cp78v8fT2C03KkEClI9aBMrqKF6N0SBLyUjasXtUQMbLTasfR2LJwjg0LlNHY060' \ --data '{ "amount": 1, "currency": "EUR", "customer_id": "cus_05845u0qSuOENDnHLqTl", "description": "Its my first payout request", "billing": { "address": { "city": "Hoogeveen", "country": "NL", "line1": "Raadhuisplein", "line2": "92", "zip": "7901 BW", "state": "FL", "first_name": "John", "last_name": "Doe" }, "phone": { "number": "0650242319", "country_code": "+31" } }, "entity_type": "Individual", "confirm": false, "auto_fulfill": true, "session_expiry": 1000000, "priority": "instant", "profile_id": "pro_Qr3Tm0ncxuiKXvdt6u2H", "payout_link": true, "payout_link_config": { "theme": "#0066ff", "logo": "https://hyperswitch.io/favicon.ico", "merchant_name": "HyperSwitch Inc." } }'
2. Create a payout link (pass locale in create request)
curl --location 'http://localhost:8080/payouts/create' \ --header 'Accept-Language: fr' \ --header 'Content-Type: application/json' \ --header 'api-key: dev_cp78v8fT2C03KkEClI9aBMrqKF6N0SBLyUjasXtUQMbLTasfR2LJwjg0LlNHY060' \ --data '{ "amount": 1, "currency": "EUR", "customer_id": "cus_05845u0qSuOENDnHLqTl", "description": "Its my first payout request", "billing": { "address": { "city": "Hoogeveen", "country": "NL", "line1": "Raadhuisplein", "line2": "92", "zip": "7901 BW", "state": "FL", "first_name": "John", "last_name": "Doe" }, "phone": { "number": "0650242319", "country_code": "+31" } }, "entity_type": "Individual", "confirm": false, "auto_fulfill": true, "session_expiry": 1000000, "priority": "instant", "profile_id": "pro_Qr3Tm0ncxuiKXvdt6u2H", "payout_link": true, "payout_link_config": { "theme": "#0066ff", "logo": "https://hyperswitch.io/favicon.ico", "merchant_name": "HyperSwitch Inc." } }'fr
zh
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible