Skip to content

Commit dd10bcc

Browse files
authored
Merge pull request #88 from EmmanuelJCS/Pagos20
Add helper classes for *Complemento de Pagos 2.0*
2 parents 752fc68 + c27d228 commit dd10bcc

File tree

17 files changed

+578
-1
lines changed

17 files changed

+578
-1
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"php-namespace": "CfdiUtils\\Elements\\Pagos20",
3+
"prefix": "pago20",
4+
"xml-namespace": "http://www.sat.gob.mx/Pagos20",
5+
"xml-schemalocation": "http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos20.xsd",
6+
"version-attribute": "Version",
7+
"version-value": "2.0",
8+
"root-element": "Pagos",
9+
"structure": {
10+
"Totales": {},
11+
"Pago": {
12+
"multiple": true,
13+
"DoctoRelacionado": {
14+
"multiple": true,
15+
"ImpuestosDR": {
16+
"RetencionesDR": {
17+
"RetencionDR": {
18+
"multiple": true
19+
}
20+
},
21+
"TrasladosDR": {
22+
"TrasladoDR": {
23+
"multiple": true
24+
}
25+
}
26+
}
27+
},
28+
"ImpuestosP": {
29+
"RetencionesP": {
30+
"RetencionP": {
31+
"multiple": true
32+
}
33+
},
34+
"TrasladosP": {
35+
"TrasladoP": {
36+
"multiple": true
37+
}
38+
}
39+
}
40+
}
41+
}
42+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"devDependencies": {
3-
"markdownlint-cli": "^0.27.1"
3+
"markdownlint-cli": "^0.31.1"
44
}
55
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class DoctoRelacionado extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:DoctoRelacionado';
12+
}
13+
14+
public function getImpuestosDR(): ImpuestosDR
15+
{
16+
return $this->helperGetOrAdd(new ImpuestosDR());
17+
}
18+
19+
public function addImpuestosDR(array $attributes = []): ImpuestosDR
20+
{
21+
$subject = $this->getImpuestosDR();
22+
$subject->addAttributes($attributes);
23+
return $subject;
24+
}
25+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class ImpuestosDR extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:ImpuestosDR';
12+
}
13+
14+
public function getChildrenOrder(): array
15+
{
16+
return [
17+
'pago20:RetencionesDR',
18+
'pago20:TrasladosDR',
19+
];
20+
}
21+
22+
public function getRetencionesDR(): RetencionesDR
23+
{
24+
return $this->helperGetOrAdd(new RetencionesDR());
25+
}
26+
27+
public function addRetencionesDR(array $attributes = []): RetencionesDR
28+
{
29+
$subject = $this->getRetencionesDR();
30+
$subject->addAttributes($attributes);
31+
return $subject;
32+
}
33+
34+
public function getTrasladosDR(): TrasladosDR
35+
{
36+
return $this->helperGetOrAdd(new TrasladosDR());
37+
}
38+
39+
public function addTrasladosDR(array $attributes = []): TrasladosDR
40+
{
41+
$subject = $this->getTrasladosDR();
42+
$subject->addAttributes($attributes);
43+
return $subject;
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class ImpuestosP extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:ImpuestosP';
12+
}
13+
14+
public function getChildrenOrder(): array
15+
{
16+
return [
17+
'pago20:RetencionesP',
18+
'pago20:TrasladosP',
19+
];
20+
}
21+
22+
public function getRetencionesP(): RetencionesP
23+
{
24+
return $this->helperGetOrAdd(new RetencionesP());
25+
}
26+
27+
public function addRetencionesP(array $attributes = []): RetencionesP
28+
{
29+
$subject = $this->getRetencionesP();
30+
$subject->addAttributes($attributes);
31+
return $subject;
32+
}
33+
34+
public function getTrasladosP(): TrasladosP
35+
{
36+
return $this->helperGetOrAdd(new TrasladosP());
37+
}
38+
39+
public function addTrasladosP(array $attributes = []): TrasladosP
40+
{
41+
$subject = $this->getTrasladosP();
42+
$subject->addAttributes($attributes);
43+
return $subject;
44+
}
45+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class Pago extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:Pago';
12+
}
13+
14+
public function getChildrenOrder(): array
15+
{
16+
return [
17+
'pago20:DoctoRelacionado',
18+
'pago20:ImpuestosP',
19+
];
20+
}
21+
22+
public function addDoctoRelacionado(array $attributes = []): DoctoRelacionado
23+
{
24+
$subject = new DoctoRelacionado($attributes);
25+
$this->addChild($subject);
26+
return $subject;
27+
}
28+
29+
public function multiDoctoRelacionado(array ...$elementAttributes): self
30+
{
31+
foreach ($elementAttributes as $attributes) {
32+
$this->addDoctoRelacionado($attributes);
33+
}
34+
return $this;
35+
}
36+
37+
public function getImpuestosP(): ImpuestosP
38+
{
39+
return $this->helperGetOrAdd(new ImpuestosP());
40+
}
41+
42+
public function addImpuestosP(array $attributes = []): ImpuestosP
43+
{
44+
$subject = $this->getImpuestosP();
45+
$subject->addAttributes($attributes);
46+
return $subject;
47+
}
48+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class Pagos extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:Pagos';
12+
}
13+
14+
public function getChildrenOrder(): array
15+
{
16+
return [
17+
'pago20:Totales',
18+
'pago20:Pago',
19+
];
20+
}
21+
22+
public function getFixedAttributes(): array
23+
{
24+
return [
25+
'xmlns:pago20' => 'http://www.sat.gob.mx/Pagos20',
26+
'xsi:schemaLocation' => 'http://www.sat.gob.mx/Pagos20'
27+
. ' http://www.sat.gob.mx/sitio_internet/cfd/Pagos/Pagos20.xsd',
28+
'Version' => '2.0',
29+
];
30+
}
31+
32+
public function getTotales(): Totales
33+
{
34+
return $this->helperGetOrAdd(new Totales());
35+
}
36+
37+
public function addTotales(array $attributes = []): Totales
38+
{
39+
$subject = $this->getTotales();
40+
$subject->addAttributes($attributes);
41+
return $subject;
42+
}
43+
44+
public function addPago(array $attributes = []): Pago
45+
{
46+
$subject = new Pago($attributes);
47+
$this->addChild($subject);
48+
return $subject;
49+
}
50+
51+
public function multiPago(array ...$elementAttributes): self
52+
{
53+
foreach ($elementAttributes as $attributes) {
54+
$this->addPago($attributes);
55+
}
56+
return $this;
57+
}
58+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class RetencionDR extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:RetencionDR';
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class RetencionP extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:RetencionP';
12+
}
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class RetencionesDR extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:RetencionesDR';
12+
}
13+
14+
public function addRetencionDR(array $attributes = []): RetencionDR
15+
{
16+
$subject = new RetencionDR($attributes);
17+
$this->addChild($subject);
18+
return $subject;
19+
}
20+
21+
public function multiRetencionDR(array ...$elementAttributes): self
22+
{
23+
foreach ($elementAttributes as $attributes) {
24+
$this->addRetencionDR($attributes);
25+
}
26+
return $this;
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class RetencionesP extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:RetencionesP';
12+
}
13+
14+
public function addRetencionP(array $attributes = []): RetencionP
15+
{
16+
$subject = new RetencionP($attributes);
17+
$this->addChild($subject);
18+
return $subject;
19+
}
20+
21+
public function multiRetencionP(array ...$elementAttributes): self
22+
{
23+
foreach ($elementAttributes as $attributes) {
24+
$this->addRetencionP($attributes);
25+
}
26+
return $this;
27+
}
28+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class Totales extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:Totales';
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace CfdiUtils\Elements\Pagos20;
4+
5+
use CfdiUtils\Elements\Common\AbstractElement;
6+
7+
class TrasladoDR extends AbstractElement
8+
{
9+
public function getElementName(): string
10+
{
11+
return 'pago20:TrasladoDR';
12+
}
13+
}

0 commit comments

Comments
 (0)