Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mpesa): Validate mPesa tax id format #2479

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maniamartial
Copy link
Contributor

Tax id starts should start with capital letter, also end in capital letter and in between contain 8 numerical numbers.
Validating this using regez expression before initiating a transaction.
eg .
image

…mat f tax id before initiating mpesa transaction
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.67%. Comparing base (df327b8) to head (9376777).
Report is 70 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2479      +/-   ##
==========================================
- Coverage   36.83%   36.67%   -0.17%     
==========================================
  Files         403      407       +4     
  Lines       32152    32386     +234     
==========================================
+ Hits        11843    11876      +33     
- Misses      20309    20510     +201     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if(this.taxIdInput){
if (!pattern.test(this.taxIdInput)) {
throw new DashboardError(
"Tax ID should be in the format 'A123456789A'",
Copy link
Contributor

@shadrak98 shadrak98 Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't show example Tax ID in the error message. Rather inform them about the correct format or just throw "invalid tax id".

Can you please also add somewhere in comment that this format is only applicable for Kenya?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OKay, I will

@shadrak98
Copy link
Contributor

shadrak98 commented Feb 17, 2025

@maniamartial Please setup pre-commit in your local before raising a PR for linting.

@shadrak98 shadrak98 removed the request for review from BreadGenie February 19, 2025 12:33
@shadrak98 shadrak98 changed the title feat - Validating the tax pattern to ensure user enters the right format f tax id before initiating mpesa transaction fix(mpesa): Validate mPesa tax id format Feb 28, 2025
@shadrak98
Copy link
Contributor

@maniamartial is this ready to merge?

@maniamartial
Copy link
Contributor Author

@shadrak98 Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants