Skip to content

A simple library to verify Spanish identity documents like NIF and NIE

License

Notifications You must be signed in to change notification settings

fewlaps/Picoleto

Repository files navigation

Picoleto

Build Status Coverage Status

Picoleto is the gentleman that will validate your Spanish documents:

  • Identity

    • NIF

    • NIE

    • Passport

  • Phones

    • MobileLine
    • LandLine
  • ZipCodes

How does it works?

Give him a document number, and he will tell you which kind of document it is and if it is a valid or a fake one!

Now You can do the same with phones and zipcodes!

Validate a Document,Phone or ZipCode:

String document = "71573454F";
boolean documentValid = Picoleto.withDocument(document).isValid();

String phone = "616333383";
boolean phoneValid = Picoleto.withPhone(phone).isValid();

String zipCode = "17750";
boolean zipCodeValid = Picoleto.withZipCode(zipCode).isValid();

Want to know the document type?

String document = "71573454F";
int documentType = Picoleto.withDocument(document).getType();

if (documentType == Picoleto.TYPE_NIF) {
    //TODO Your NIF stuff
} else if (documentType == Picoleto.TYPE_NIE) {
    //TODO Your NIE stuff
} else if (documentType == Picoleto.TYPE_PASSPORT) {
    //TODO Your PASSPORT stuff
} else if (documentType == Picoleto.INVALID_DOCUMENT) {
    //TODO don't try to fool the picoleto!!
}

If you want know the type of phone

String phone = "616333383";
int phoneType = Picoleto.withPhone(phone).getType();

if (phoneType == Picoleto.TYPE_MOBILE_LINE) {
    //TODO Your Mobile line stuff
} else if (phoneType == Picoleto.TYPE_LANE_LINE) {
    //TODO Your Land line stuff
} else if (phoneType == Picoleto.INVALID_PHONE_NUMBER) {
    //TODO Not a Spanish line
}

Download

  • Grab via gradle:
repositories { jcenter() }

implementation 'com.fewlaps.picoleto:picoleto:1.2.0'
  • Grab via Maven:
<dependency>
  <groupId>com.fewlaps.picoleto</groupId>
  <artifactId>picoleto</artifactId>
  <version>1.2.0</version>
  <type>pom</type>
</dependency>

Or check bintray to get the latest jar file

About

A simple library to verify Spanish identity documents like NIF and NIE

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages