1 | <?php |
||
19 | class CFDI |
||
20 | { |
||
21 | /** |
||
22 | * SAT XSL endpoint. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | const XSL_ENDPOINT = 'http://www.sat.gob.mx/sitio_internet/cfd/3/cadenaoriginal_3_3/cadenaoriginal_3_3.xslt'; |
||
27 | |||
28 | /** |
||
29 | * CFDI version. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $version = '3.3'; |
||
34 | |||
35 | /** |
||
36 | * CSD key. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $key; |
||
41 | |||
42 | /** |
||
43 | * CSD cer. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $cer; |
||
48 | |||
49 | /** |
||
50 | * Comprobante instance. |
||
51 | * |
||
52 | * @var \Kinedu\CfdiXML\Node\Comprobante |
||
53 | */ |
||
54 | protected $comprobante; |
||
55 | |||
56 | /** |
||
57 | * Create a new cfdi instance. |
||
58 | * |
||
59 | * @param array $data |
||
60 | * @param string $key |
||
61 | * @param string $cer |
||
62 | */ |
||
63 | public function __construct(array $data, string $key, string $cer) |
||
70 | |||
71 | /** |
||
72 | * Add new node to comprobante instance. |
||
73 | * |
||
74 | * @param \Kinedu\CfdiXML\Common\Node $node |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function add(Node $node) |
||
82 | |||
83 | /** |
||
84 | * Gets the original string. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | public function getCadenaOriginal() : string |
||
101 | |||
102 | /** |
||
103 | * Get sello. |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | public function getSello() : string |
||
114 | |||
115 | /** |
||
116 | * Put sello. |
||
117 | * |
||
118 | * @return void |
||
119 | */ |
||
120 | protected function putSello() |
||
129 | |||
130 | /** |
||
131 | * Get certificado. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getCertificado() : string |
||
141 | |||
142 | /** |
||
143 | * Put certificado. |
||
144 | * |
||
145 | * @return void |
||
146 | */ |
||
147 | protected function putCertificado() |
||
156 | |||
157 | /** |
||
158 | * Returns the xml with the stamp and certificate attributes. |
||
159 | * |
||
160 | * @return DOMDocument |
||
161 | */ |
||
162 | protected function xml() : DOMDocument |
||
168 | |||
169 | /** |
||
170 | * Get the xml. |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | public function getXML() : string |
||
178 | |||
179 | /** |
||
180 | * @param string $filename |
||
181 | */ |
||
182 | public function save(string $filename) |
||
186 | |||
187 | /** |
||
188 | * @return string |
||
189 | */ |
||
190 | public function getXSL() |
||
200 | } |
||
201 |
If you suppress an error, we recommend checking for the error condition explicitly: