10
10
11
11
class elogo_api{
12
12
13
- public $ login = null ;
14
- public $ service = null ;
15
- public $ session_id = null ;
16
- public $ my_company = null ;
13
+ public $ login = null ;
14
+ public $ service = null ;
15
+ public $ session_id = null ;
16
+ public $ my_company = null ;
17
17
public $ customer_company = null ;
18
- public $ invoice = null ;
19
- public $ efatura_xslt = (__DIR__ ).'/invoice_templates/CB9E5959-B6F9-4B28-99A8-A80006B3DE6B.xslt ' ;
20
- public $ earsiv_xslt = (__DIR__ ).'/invoice_templates/7141796B-2A35-4C87-9413-DC1867DDC8CC.xslt ' ;
21
- public $ xml_path = (__DIR__ ).'/ ' ;
22
- public $ zip_path = (__DIR__ ).'/ ' ;
23
- public $ invoce_prefix = 'HSN ' ;
18
+ public $ invoice = null ;
19
+ public $ efatura_xslt = (__DIR__ ).'/invoice_templates/CB9E5959-B6F9-4B28-99A8-A80006B3DE6B.xslt ' ;
20
+ public $ earsiv_xslt = (__DIR__ ).'/invoice_templates/7141796B-2A35-4C87-9413-DC1867DDC8CC.xslt ' ;
21
+ public $ xml_path = (__DIR__ ).'/ ' ;
22
+ public $ zip_path = (__DIR__ ).'/ ' ;
23
+ public $ invoce_prefix = 'HSN ' ;
24
24
25
25
public function __construct ($ username , $ password , $ test = false ){
26
26
@@ -115,14 +115,14 @@ public function get_documents($document_type = 'EINVOICE'){
115
115
116
116
}
117
117
118
- public function get_documents_data ($ document_type = 'EINVOICE ' , $ format = 'PDF ' , $ is_cancel = false ){
118
+ public function get_documents_data ($ invoice_number = null , $ document_type = 'EINVOICE ' , $ format = 'PDF ' , $ is_cancel = false ){
119
119
120
120
try {
121
121
$ result = $ this ->service ->GetDocumentData ([
122
122
'DOCUMENTTYPE= ' .$ document_type ,
123
123
'DATAFORMAT= ' .$ format ,
124
124
'ISCANCEL= ' .$ is_cancel ? '1 ' : '0 ' ,
125
- ], $ this -> session_id );
125
+ ], $ invoice_number );
126
126
return [
127
127
'status ' => 'success ' ,
128
128
'message ' => $ result ,
@@ -141,6 +141,25 @@ public function get_documents_data($document_type = 'EINVOICE', $format = 'PDF',
141
141
142
142
}
143
143
144
+ public function unzip ($ name = null , $ binary = null ){
145
+ if ($ binary != null ){
146
+ $ binary = base64_decode ($ binary );
147
+
148
+ $ file_full_name = tempnam (sys_get_temp_dir (), 'pdf ' );
149
+ $ file_temp_path = sys_get_temp_dir ();
150
+ file_put_contents ($ file_full_name , $ binary );
151
+
152
+ $ zip = new ZipArchive ;
153
+ if ($ zip ->open ($ file_full_name ) === TRUE ){
154
+ $ zip ->extractTo ($ file_temp_path );
155
+ $ zip ->close ();
156
+ return file_get_contents ($ file_temp_path .'/ ' .$ name .'.pdf ' );
157
+ }
158
+
159
+ }
160
+ return false ;
161
+ }
162
+
144
163
public function get_company_info ($ vkn_tcn = null ){
145
164
146
165
$ param = [];
0 commit comments