@@ 10-42 (lines=33) @@ | ||
7 | use Luilliarcec\LaravelEcuadorIdentification\Contracts\IdentificationContract; |
|
8 | use Luilliarcec\LaravelEcuadorIdentification\Exceptions\EcuadorIdentificationException; |
|
9 | ||
10 | class NaturalRuc extends EcuadorValidations implements IdentificationContract |
|
11 | { |
|
12 | /** |
|
13 | * NaturalRuc constructor. |
|
14 | */ |
|
15 | public function __construct() |
|
16 | { |
|
17 | parent::__construct(); |
|
18 | ||
19 | $this->lenght = config('laravel-ecuador-identification.type-identifications.ruc.length'); |
|
20 | $this->billingCode = config('laravel-ecuador-identification.type-identifications.ruc.billing-code'); |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * Validate this identification |
|
25 | * |
|
26 | * @param string $number |
|
27 | * @return \Illuminate\Config\Repository|mixed|string |
|
28 | * @throws EcuadorIdentificationException |
|
29 | */ |
|
30 | public function validate(string $number) |
|
31 | { |
|
32 | try { |
|
33 | $this->validateInitial($number, $this); |
|
34 | $this->validateLastDigits(substr($number, 10, 3), $this); |
|
35 | $this->moduleTen($number); |
|
36 | } catch (EcuadorIdentificationException $e) { |
|
37 | throw new EcuadorIdentificationException($e->getMessage()); |
|
38 | } |
|
39 | ||
40 | return $this->billingCode; |
|
41 | } |
|
42 | } |
|
43 |
@@ 10-42 (lines=33) @@ | ||
7 | use Luilliarcec\LaravelEcuadorIdentification\Contracts\IdentificationContract; |
|
8 | use Luilliarcec\LaravelEcuadorIdentification\Exceptions\EcuadorIdentificationException; |
|
9 | ||
10 | class PrivateRuc extends EcuadorValidations implements IdentificationContract |
|
11 | { |
|
12 | /** |
|
13 | * PrivateRuc constructor. |
|
14 | */ |
|
15 | public function __construct() |
|
16 | { |
|
17 | parent::__construct(); |
|
18 | ||
19 | $this->lenght = config('laravel-ecuador-identification.type-identifications.ruc.length'); |
|
20 | $this->billingCode = config('laravel-ecuador-identification.type-identifications.ruc.billing-code'); |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * Validate this identification |
|
25 | * |
|
26 | * @param string $number |
|
27 | * @return \Illuminate\Config\Repository|mixed|string |
|
28 | * @throws EcuadorIdentificationException |
|
29 | */ |
|
30 | public function validate(string $number) |
|
31 | { |
|
32 | try { |
|
33 | $this->validateInitial($number, $this); |
|
34 | $this->validateLastDigits(substr($number, 10, 3), $this); |
|
35 | $this->moduleEleven($number, $this); |
|
36 | } catch (EcuadorIdentificationException $e) { |
|
37 | throw new EcuadorIdentificationException($e->getMessage()); |
|
38 | } |
|
39 | ||
40 | return $this->billingCode; |
|
41 | } |
|
42 | } |
|
43 |
@@ 10-42 (lines=33) @@ | ||
7 | use Luilliarcec\LaravelEcuadorIdentification\Contracts\IdentificationContract; |
|
8 | use Luilliarcec\LaravelEcuadorIdentification\Exceptions\EcuadorIdentificationException; |
|
9 | ||
10 | class PublicRuc extends EcuadorValidations implements IdentificationContract |
|
11 | { |
|
12 | /** |
|
13 | * PublicRuc constructor. |
|
14 | */ |
|
15 | public function __construct() |
|
16 | { |
|
17 | parent::__construct(); |
|
18 | ||
19 | $this->lenght = config('laravel-ecuador-identification.type-identifications.ruc.length'); |
|
20 | $this->billingCode = config('laravel-ecuador-identification.type-identifications.ruc.billing-code'); |
|
21 | } |
|
22 | ||
23 | /** |
|
24 | * Validate this identification |
|
25 | * |
|
26 | * @param string $number |
|
27 | * @return \Illuminate\Config\Repository|mixed|string |
|
28 | * @throws EcuadorIdentificationException |
|
29 | */ |
|
30 | public function validate(string $number) |
|
31 | { |
|
32 | try { |
|
33 | $this->validateInitial($number, $this); |
|
34 | $this->validateLastDigits(substr($number, 9, 4), $this); |
|
35 | $this->moduleEleven($number, $this); |
|
36 | } catch (EcuadorIdentificationException $e) { |
|
37 | throw new EcuadorIdentificationException($e->getMessage()); |
|
38 | } |
|
39 | ||
40 | return $this->billingCode; |
|
41 | } |
|
42 | } |
|
43 |