You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Vijay Akula <vi...@gmail.com> on 2020/05/18 15:38:18 UTC

[validator] Thoughts on having only isVaild method implemented for a check digit but not the generate method

Hi,

I am working on an implementation for check digit validation for the
Australian Medicare card algorithm[1] and want to contribute the same to
the commons validator open-source project. Before submitting a PR, I wanted
to reach out to the developers and gather their thoughts around having just
a check digit validation piece of an algorithm implemented but not the
check digit generation piece.
I ask this because, in the case of the Australian Medicare algorithm, the
generation of the check digit is done by only one entity(i.e the government
when generating the medicare number). All the other users of this algorithm
just use the validation logic to verify that the check digit appended to a
string is correct. To represent that only the validation is supported but
not the generation, I was thinking of overriding the generate method
extended from ModulusCheckDigit abstract class and throw an
UnsupportedOperationException.

Please let me know any thoughts or suggestions around this.

[1] https://www.clearwater.com.au/code/medicare

Thanks
Vijay

Re: [validator] Thoughts on having only isVaild method implemented for a check digit but not the generate method

Posted by sebb <se...@gmail.com>.
On Tue, 19 May 2020 at 12:14, Vijay Akula
<vi...@gmail.com> wrote:
>
> Hi,
>
> I am working on an implementation for check digit validation for the
> Australian Medicare card algorithm[1] and want to contribute the same to
> the commons validator open-source project. Before submitting a PR, I wanted
> to reach out to the developers and gather their thoughts around having just
> a check digit validation piece of an algorithm implemented but not the
> check digit generation piece.
> I ask this because, in the case of the Australian Medicare algorithm, the
> generation of the check digit is done by only one entity(i.e the government
> when generating the medicare number). All the other users of this algorithm
> just use the validation logic to verify that the check digit appended to a
> string is correct. To represent that only the validation is supported but
> not the generation, I was thinking of overriding the generate method
> extended from ModulusCheckDigit abstract class and throw an
> UnsupportedOperationException.
>
> Please let me know any thoughts or suggestions around this.

Generation of the check digit is always done by the issuer.
Validator allows one to calculate check digits for all existing algorithms.

I see no reason to treat the Medicare algorithm differently from any
other algorithm.

> [1] https://www.clearwater.com.au/code/medicare
>
> Thanks
> Vijay

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org