@@ -20,6 +20,11 @@ public function __construct()
2020 $ this ->matchDetector = new MatchDetector ('http://www.sat.gob.mx/cfd/3 ' , 'cfdi:Comprobante ' , 'Version ' , '3.3 ' );
2121 }
2222
23+ public function uniqueName (): string
24+ {
25+ return 'CFDI33 ' ;
26+ }
27+
2328 public function matches (DOMDocument $ document ): bool
2429 {
2530 return $ this ->matchDetector ->matches ($ document );
@@ -35,20 +40,30 @@ public function extract(DOMDocument $document): string
3540 $ uuid = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Complemento ' , 'tfd:TimbreFiscalDigital ' , 'UUID ' );
3641 $ rfcEmisor = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Emisor ' , 'Rfc ' );
3742 $ rfcReceptor = $ helper ->getAttribute ('cfdi:Comprobante ' , 'cfdi:Receptor ' , 'Rfc ' );
38- $ totalComprobante = $ helper ->getAttribute ('cfdi:Comprobante ' , 'Total ' );
43+ $ total = $ helper ->getAttribute ('cfdi:Comprobante ' , 'Total ' );
3944 $ sello = substr ($ helper ->getAttribute ('cfdi:Comprobante ' , 'Sello ' ), -8 );
4045
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 ),
4952 ]);
5053 }
5154
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+
5267 public function formatTotal (string $ input ): string
5368 {
5469 $ total = rtrim (number_format (floatval ($ input ), 6 , '. ' , '' ), '0 ' );
0 commit comments