sat-rfc-validator Validator for México Taxpayer Ids

  1. Requirements
  2. Usage

RFC is the mexican taxpayer is provided by Mexico tax authority (SAT). Following rules apply:

  1. Valid characters are: 0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZ&$%#@§
  2. Must be 12 or 13 characters long.
    • If the taxpayer is a company, is 12 characters long.
    • If the taxpayer is a person, is 13 characters long.

The RFC consists of 3 parts:

  1. Letters and characters extracted from the name of the taxpayer.
    • If the taxpayer is a company, this part is the first 3 characters of the RFC.
    • If the taxpayer is a person, this part is the first 4 characters of the RFC.
  2. The following 6 characters, which represents a valid date in the format YYMMDD. This is the taxpayer's date of registration at SAT
  3. Last 3 characters: A checksum. I don't have a reliable algorithm to calculate this. The only rule applied here is that the last character must be a number or the letter 'A'.

Requirements

Was developed and tested with Yii 1.1.9.

Usage

Copy satRfc.php to a subfolder of protected (e.g.: protected/extensions/validators) Call it as a regular validator.

class MyModel extends CModel {
    //[....]
    public function rules()
    {
        return array(
            //[....]
            array('rfc', 'ext.validators.satRfcValidator'),
        );
    }
}
1 0
1 follower
332 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Developed by: jmariani
Created on: Jan 15, 2012
Last updated: 12 years ago

Downloads

show all

Related Extensions