hyperswitch
hyperswitch copied to clipboard
fix(router): validate each field for migration request body
Type of Change
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
#6300 has inconsistent response due to no validations for each field in migration api request body.
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
test case - test migration api with empty fields. req -
curl --location 'http://localhost:8080/payment_methods/migrate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
"merchant_id": "merchant_id",
"card": {
"card_number": "card_number",
"card_exp_month": "12",
"card_exp_year": "21",
"card_holder_name": "joseph Doe"
},
"customer_id": "customer_id",
"network_transaction_id": "",
"payment_method": "card",
"connector_mandate_details": {},
"network_token": {
"network_token_data": {
"network_token_number": " ",
"network_token_exp_month": "12",
"network_token_exp_year": "21"
},
"network_token_requestor_ref_id": ""
}
}'
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible