@@ 124-140 (lines=17) @@ | ||
121 | * @param string $number Number of RUC Natural Person |
|
122 | * @return string|null |
|
123 | */ |
|
124 | public function validateNaturalPersonRuc($number) |
|
125 | { |
|
126 | $this->setError(''); |
|
127 | ||
128 | try { |
|
129 | $this->initValidation($number, $this->lenght['ruc']); |
|
130 | $this->provinceCodeValidation(substr($number, 0, 2)); |
|
131 | $this->thirdDigitValidation($number[2], self::NaturalPerson); |
|
132 | $this->theLastDigitsValidation(substr($number, 10, 3), self::NaturalPerson); |
|
133 | $this->moduleTen($number); |
|
134 | } catch (EcuadorIdentificationException $e) { |
|
135 | $this->setError($e->getMessage()); |
|
136 | return null; |
|
137 | } |
|
138 | ||
139 | return $this->billingCode['ruc']; |
|
140 | } |
|
141 | ||
142 | /** |
|
143 | * Validates the Ecuadorian RUC of Private Companies |
|
@@ 148-164 (lines=17) @@ | ||
145 | * @param string $number Number of RUC Private Companies |
|
146 | * @return string|null |
|
147 | */ |
|
148 | public function validatePrivateCompanyRuc($number) |
|
149 | { |
|
150 | $this->setError(''); |
|
151 | ||
152 | try { |
|
153 | $this->initValidation($number, $this->lenght['ruc']); |
|
154 | $this->provinceCodeValidation(substr($number, 0, 2)); |
|
155 | $this->thirdDigitValidation($number[2], self::PrivateCompany); |
|
156 | $this->theLastDigitsValidation(substr($number, 10, 3), self::PrivateCompany); |
|
157 | $this->moduleEleven($number, self::PrivateCompany); |
|
158 | } catch (EcuadorIdentificationException $e) { |
|
159 | $this->setError($e->getMessage()); |
|
160 | return null; |
|
161 | } |
|
162 | ||
163 | return $this->billingCode['ruc']; |
|
164 | } |
|
165 | ||
166 | /** |
|
167 | * Validates the Ecuadorian RUC of Public Companies |
|
@@ 172-188 (lines=17) @@ | ||
169 | * @param string $number Number of RUC Public Companies |
|
170 | * @return string|null |
|
171 | */ |
|
172 | public function validatePublicCompanyRuc($number) |
|
173 | { |
|
174 | $this->setError(''); |
|
175 | ||
176 | try { |
|
177 | $this->initValidation($number, $this->lenght['ruc']); |
|
178 | $this->provinceCodeValidation(substr($number, 0, 2)); |
|
179 | $this->thirdDigitValidation($number[2], self::PublicCompany); |
|
180 | $this->theLastDigitsValidation(substr($number, 9, 4), self::PublicCompany); |
|
181 | $this->moduleEleven($number, self::PublicCompany); |
|
182 | } catch (EcuadorIdentificationException $e) { |
|
183 | $this->setError($e->getMessage()); |
|
184 | return null; |
|
185 | } |
|
186 | ||
187 | return $this->billingCode['ruc']; |
|
188 | } |
|
189 | ||
190 | /** |
|
191 | * Validates the Ecuadorian Final Consumer |