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

IBAN Validation return value #101

Closed
guimar86 opened this issue Jan 8, 2023 · 13 comments
Closed

IBAN Validation return value #101

guimar86 opened this issue Jan 8, 2023 · 13 comments
Milestone

Comments

@guimar86
Copy link

guimar86 commented Jan 8, 2023

I think this is more of discussion than an issue but could it be possible for the methods of iban validation to return something other than exceptions?

@FrankHossfeld
Copy link

Are you talking about the two validate-methods inside the IbanUtils-class? Something like a isValid-method returning a boolean?

@guimar86
Copy link
Author

Yes exactly. As a library it would be best to have method overloads to those validation methods that return either a boolean or a complex object.

@FrankHossfeld
Copy link

I like the idea. for me, throwing and catching exceptions is ok, but I prefer validation methods with boolean value. But this is my personal opinion:

I'll open an issue in my repo (which was a fork a long time ago) and will do some coding. I'll leave the existing methods untouched (due to force no one to refactor their code) and create new methods beside. IIRC, the validation class is the same as in this repo. So we can create here a PR later.

@guimar86
Copy link
Author

Thanks

@FrankHossfeld
Copy link

I spent some time on a draft. Without change, it behave in the same way as it does today.

In case you prefer a boolean as return value, you need to set:

Iban4gConfig.INSTANCE.setReturnMethod(Iban4gConfig.ReturnMethod.RETURN_VALUE);

This needs to be done once, at the start of the application. Now, it is possible to validate this way (without throwing an exception):

boolean valid = IbanUtil.validate("AT611904300234573201", IbanFormat.Default);

Not sure, if this is the best implementation, but it works.

Note, some exception will continue throwing. F.e.: calculateCheckDigit.

@ghost
Copy link

ghost commented Jan 11, 2023

Hi Frank,
Thanks for the quick feedback, I will test and feedback asap.

@FrankHossfeld
Copy link

@guillenmartins
Please, keep in mind, I'll implemented the draft here: https://github.com/NaluKit/iban4g

@ghost
Copy link

ghost commented Jan 11, 2023

Okay, I will pull it from there

@FrankHossfeld
Copy link

May be it is easier to copy the IbanUtil- and Iban4gConfig-class to a fork of iban4j, fix the package and test that build.

@arturmkrtchyan
Copy link
Owner

@FrankHossfeld thanks for your help here! I'm really not managing to do anything helpful here. Would you be open to become a collaborator on the project and lead those changes/efforts ?

@FrankHossfeld
Copy link

FrankHossfeld commented Jan 12, 2023

@arturmkrtchyan iban4j is an awesome lib and thanks for offering to become a collaborator. In general, I'll be open becoming a collaborator.

I created iban4g to get iban4j work with Java and GWT/J2CL. I need to replace a few code lines (which are not part of the emulation library) and add a few files. The API itself is unchanged! In a normal Java application there is no change, except that the sources are part of the lib and a XML-file is added to the artifact.Inside a pure Java application iban4g can be used in the same way as iban4j. Also I need add GWT and J2CL Maven test modules to ensure it will work with J2CL and GWT.

iban4g has a lot of fixes and added PRs that are missing in iban4j.

I have only a limited free time to support Open Source and as you can imagine, I don't want to maintain two libraries which does at least the same.

The questions are:

  • will we find a way putting both libs together?
  • will people accept that a lib they are using has stuff related to GWT and J2CL? (To make clear: you will not have any dependecy to GWT or J2CL in your Java application)

I'll think, that it also question that should be discussed with the users of iban4j.

@arturmkrtchyan Feel free to PM me here: https://gitter.im/Nalukit42/Lobby (using 'chat privately') to discuss further

@FrankHossfeld
Copy link

@arturmkrtchyan I suggest to open a discussion here. What do you think?

@hajk1 hajk1 added this to the 3.2.7-RELEASE milestone Aug 9, 2023
@hajk1
Copy link
Collaborator

hajk1 commented Aug 25, 2023

Feature merged onto master and will be released soon

@hajk1 hajk1 closed this as completed Aug 25, 2023
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

No branches or pull requests

4 participants