Fixes for tests
This commit is contained in:
parent
bd4dddda0c
commit
99875d2f98
|
|
@ -4,45 +4,34 @@ namespace App\Services\EDocument\Standards\Verifactu\Types;
|
||||||
|
|
||||||
class Encadenamiento
|
class Encadenamiento
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var IDFacturaAR */
|
||||||
protected $NumSerieFacturaAnterior;
|
protected $RegistroAnterior;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $FechaExpedicionFacturaAnterior;
|
protected $HuellaRegistroAnterior;
|
||||||
|
|
||||||
public function getNumSerieFacturaAnterior(): string
|
public function getRegistroAnterior(): IDFacturaAR
|
||||||
{
|
{
|
||||||
return $this->NumSerieFacturaAnterior;
|
return $this->RegistroAnterior;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNumSerieFacturaAnterior(string $numSerieFacturaAnterior): self
|
public function setRegistroAnterior(IDFacturaAR $registroAnterior): self
|
||||||
{
|
{
|
||||||
if (strlen($numSerieFacturaAnterior) > 60) {
|
$this->RegistroAnterior = $registroAnterior;
|
||||||
throw new \InvalidArgumentException('NumSerieFacturaAnterior must not exceed 60 characters');
|
|
||||||
}
|
|
||||||
$this->NumSerieFacturaAnterior = $numSerieFacturaAnterior;
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFechaExpedicionFacturaAnterior(): string
|
public function getHuellaRegistroAnterior(): string
|
||||||
{
|
{
|
||||||
return $this->FechaExpedicionFacturaAnterior;
|
return $this->HuellaRegistroAnterior;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFechaExpedicionFacturaAnterior(string $fechaExpedicionFacturaAnterior): self
|
public function setHuellaRegistroAnterior(string $huellaRegistroAnterior): self
|
||||||
{
|
{
|
||||||
// Validate date format DD-MM-YYYY
|
if (strlen($huellaRegistroAnterior) > 64) {
|
||||||
if (!preg_match('/^\d{2}-\d{2}-\d{4}$/', $fechaExpedicionFacturaAnterior)) {
|
throw new \InvalidArgumentException('HuellaRegistroAnterior must not exceed 64 characters');
|
||||||
throw new \InvalidArgumentException('FechaExpedicionFacturaAnterior must be in DD-MM-YYYY format');
|
|
||||||
}
|
}
|
||||||
|
$this->HuellaRegistroAnterior = $huellaRegistroAnterior;
|
||||||
// Validate date components
|
|
||||||
list($day, $month, $year) = explode('-', $fechaExpedicionFacturaAnterior);
|
|
||||||
if (!checkdate((int)$month, (int)$day, (int)$year)) {
|
|
||||||
throw new \InvalidArgumentException('Invalid date');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->FechaExpedicionFacturaAnterior = $fechaExpedicionFacturaAnterior;
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue