Skip to content

Create cpf-cd (check digits) #26

@juliolmuller

Description

@juliolmuller

Create a new package cpf-cd to calculate check digits (dígitos verificadores) for CPF. Although the logic of calculating these numbers are already implemented inside cpf-gen, these should be removed from that in the next major version in favor of this package.

  • Create a class CpfCheckDigits to lazyly calculate first and second checkdigits. The base CPF for the calculation should be passed to the constructor and validated accordingly:
    • CPF provided should have between 9 and 11 digits after sanitization. Throw exception if not met.
    • Repeated sequences of digits (e.g. 111.111.111-*, 222.222.222-*, 333.333.333-* nad so on) are considered invalid CPF's, so the input of these value should throw an exception.
    • CPF should be provided as string, list of strings or list of integers.
  • All errors thrown by the package should be custom, prefixed with CpfCheckDigits*TypeError for type errors and CpfCheckDigits*Exception for other exceptions.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions