@@ 8-31 (lines=24) @@ | ||
5 | use Luilliarcec\LaravelEcuadorIdentification\Exceptions\IdentificationException; |
|
6 | use Luilliarcec\LaravelEcuadorIdentification\Support\BaseIdentification; |
|
7 | ||
8 | class NaturalRuc extends BaseIdentification |
|
9 | { |
|
10 | /** |
|
11 | * NaturalRuc constructor. |
|
12 | */ |
|
13 | public function __construct() |
|
14 | { |
|
15 | $this->lenght = 13; |
|
16 | $this->billingCode = '04'; |
|
17 | $this->coefficients = [2, 1, 2, 1, 2, 1, 2, 1, 2]; |
|
18 | $this->checkDigitPosition = 10; |
|
19 | $this->thirdDigit = 5; |
|
20 | $this->lastDigits = '001'; |
|
21 | } |
|
22 | ||
23 | protected function thirdDigitValidation(string $identification_number): void |
|
24 | { |
|
25 | $third_digit = $this->getThirdDigitValue($identification_number); |
|
26 | ||
27 | if ($third_digit > $this->thirdDigit) { |
|
28 | throw new IdentificationException("Field must have the third digit less than or equal to {$this->thirdDigit}."); |
|
29 | } |
|
30 | } |
|
31 | } |
|
32 |
@@ 8-30 (lines=23) @@ | ||
5 | use Luilliarcec\LaravelEcuadorIdentification\Exceptions\IdentificationException; |
|
6 | use Luilliarcec\LaravelEcuadorIdentification\Support\BaseIdentification; |
|
7 | ||
8 | class PersonalIdentification extends BaseIdentification |
|
9 | { |
|
10 | /** |
|
11 | * PersonalIdentification constructor. |
|
12 | */ |
|
13 | public function __construct() |
|
14 | { |
|
15 | $this->lenght = 10; |
|
16 | $this->billingCode = '05'; |
|
17 | $this->coefficients = [2, 1, 2, 1, 2, 1, 2, 1, 2]; |
|
18 | $this->checkDigitPosition = 10; |
|
19 | $this->thirdDigit = 5; |
|
20 | } |
|
21 | ||
22 | protected function thirdDigitValidation(string $identification_number): void |
|
23 | { |
|
24 | $third_digit = $this->getThirdDigitValue($identification_number); |
|
25 | ||
26 | if ($third_digit > $this->thirdDigit) { |
|
27 | throw new IdentificationException("Field must have the third digit less than or equal to {$this->thirdDigit}."); |
|
28 | } |
|
29 | } |
|
30 | } |
|
31 |