feat(institutions): add filtering and sorting functionality for institution#503
Open
sundayonah wants to merge 1 commit into
Open
feat(institutions): add filtering and sorting functionality for institution#503sundayonah wants to merge 1 commit into
sundayonah wants to merge 1 commit into
Conversation
…tution selection - Introduced `filterAndSortInstitutions` function to filter institutions by name and sort them, prioritizing mobile money types and specific NGN institution codes. - Updated `AddRefundAccountModal` and `RecipientDetailsForm` components to utilize the new filtering and sorting logic, improving code readability and maintainability. - Added a constant for NGN priority institution codes to streamline sorting logic.
Contributor
📝 WalkthroughWalkthroughThis PR consolidates duplicated institution filtering and sorting logic from two components into shared utilities. ChangesInstitution Filtering and Sorting Consolidation
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filterAndSortInstitutionsandcompareInstitutionsForDisplayinapp/utils.ts.NGN_PRIORITY_INSTITUTION_CODES(Opay, PalmPay, Moniepoint, Kuda) so sort order is defined in one place.RecipientDetailsForm→ Select institution modal) and on-ramp (AddRefundAccountModalrefund bank picker) so both flows show the same order.Description
Off-ramp institution selection already sorted providers with mobile money first, pinned NGN fintech codes, then A–Z. On-ramp refund account setup only sorted mobile money first and then A–Z, so popular fintechs (Opay, PalmPay, Moniepoint, Kuda) did not appear in the same positions as on the swap flow.
This PR centralizes filter and sort behavior so both pickers stay consistent and easier to maintain.
Sort order:
mobile_moneyinstitutions firstOPAYNGPC,PALMNGPC,MONINGPC,KUDANGPC)localeCompare)Files touched:
app/utils.ts—NGN_PRIORITY_INSTITUTION_CODES,compareInstitutionsForDisplay,filterAndSortInstitutionsapp/components/recipient/RecipientDetailsForm.tsx— off-ramp Select institution modalapp/components/AddRefundAccountModal.tsx— on-ramp refund bank selection stepBreaking changes: None (display order only).
Alternatives considered: Duplicating the comparator in
AddRefundAccountModal(rejected; drift risk). Strict A–Z only (rejected; product wants mobile money and priority fintechs on top).API / contracts: No API or database changes.
References
N/A
Testing
Manual:
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit