@@ -20,6 +20,11 @@ public function __construct()
20
20
$ this ->matchDetector = new MatchDetector ('http://www.sat.gob.mx/cfd/3 ' , 'cfdi:Comprobante ' , 'Version ' , '3.3 ' );
21
21
}
22
22
23
+ public function uniqueName (): string
24
+ {
25
+ return 'CFDI33 ' ;
26
+ }
27
+
23
28
public function matches (DOMDocument $ document ): bool
24
29
{
25
30
return $ this ->matchDetector ->matches ($ document );
@@ -35,20 +40,30 @@ public function extract(DOMDocument $document): string
35
40
$ uuid = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Complemento ' , 'tfd:TimbreFiscalDigital ' , 'UUID ' );
36
41
$ rfcEmisor = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Emisor ' , 'Rfc ' );
37
42
$ rfcReceptor = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Receptor ' , 'Rfc ' );
38
- $ totalComprobante = $ helper ->getAttribute ('cfdi:Comprobante ' , 'Total ' );
43
+ $ total = $ helper ->getAttribute ('cfdi:Comprobante ' , 'Total ' );
39
44
$ sello = substr ($ helper ->getAttribute ('cfdi:Comprobante ' , 'Sello ' ), -8 );
40
45
41
- $ total = $ this ->formatTotal ($ totalComprobante );
42
-
43
- return 'https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx? ' . implode ('& ' , [
44
- 'id= ' . $ uuid ,
45
- 're= ' . $ rfcEmisor ,
46
- 'rr= ' . $ rfcReceptor ,
47
- 'tt= ' . $ total ,
48
- 'fe= ' . substr ($ sello , -8 ),
46
+ return $ this ->format ([
47
+ 'id ' => $ uuid ,
48
+ 're ' => $ rfcEmisor ,
49
+ 'rr ' => $ rfcReceptor ,
50
+ 'tt ' => $ total ,
51
+ 'fe ' => substr ($ sello , -8 ),
49
52
]);
50
53
}
51
54
55
+ public function format (array $ values ): string
56
+ {
57
+ return 'https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx? '
58
+ . implode ('& ' , [
59
+ 'id= ' . ($ values ['id ' ] ?? '' ),
60
+ 're= ' . ($ values ['re ' ] ?? '' ),
61
+ 'rr= ' . ($ values ['rr ' ] ?? '' ),
62
+ 'tt= ' . $ this ->formatTotal ($ values ['tt ' ] ?? '' ),
63
+ 'fe= ' . ($ values ['fe ' ] ?? '' ),
64
+ ]);
65
+ }
66
+
52
67
public function formatTotal (string $ input ): string
53
68
{
54
69
$ total = rtrim (number_format (floatval ($ input ), 6 , '. ' , '' ), '0 ' );
0 commit comments