hyperswitch
hyperswitch copied to clipboard
refactor(FRM): refactor frm configs
Type of Change
- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
This PR contains
- Depricating FRM action and rule setting on hyperswitch end.
- revising the new FRM configs
- Taking actions based on frm status .
- Few bugs of previous PR described here.
Additional Changes
- [x] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Previously frm configuration when creating merchant connector for FRM connector used to be like
"frm_configs": [
{
"gateway": "stripe",
"payment_methods": [
{
"payment_method": "card",
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa"
],
"flow": "post",
"action": "cancel_txn"
},
{
"payment_method_type": "debit",
"card_networks": [
"Visa"
],
"flow": "post",
"action": "manual_review"
}
]
}
]
}
]
This has been modified to
"frm_configs": [
{
"gateway": "stripe",
"payment_methods": [
{
"payment_method": "card",
"flow": "post"
},
{
"payment_method": "wallet",
"flow": "pre"
}
]
}
]
Motivation and Context
Frm action is depricated because the levarage of manual review now has been moved to frm connector. We consume webhooks from frm connectors and take appropriate action. We also depricated merchant to configure rules from hyperswitch end since he already sets up rules in frm, so we solely depends on FRM status to take action.
PreAuth flow :
- FRAUD -> Cancel Payment
- LEGIT -> Continue transaction
- MANUAL_REVIEW -> We don't support Manual review since there will be no customer for completing the payment.
PostAuth flow :
- FRAUD -> Cancel Payment
- LEGIT -> continue transaction
- MANUAL_REVIEW -> Approve/ Decline based on webhook recieved from frm connector.
How did you test it?
Tested using postman.
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