insideapp-python-sdk 1.30.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
insideapp/client.py ADDED
@@ -0,0 +1,1040 @@
1
+ """
2
+ Client principal InsideApp Python SDK.
3
+
4
+ Această clasă implementează toate metodele API ale InsideApp pentru:
5
+ - Gestiune facturi (proformă, fiscale, chitanțe)
6
+ - Integrare SPV/eFactura cu ANAF
7
+ - Management clienți, produse, servicii, conturi bancare
8
+ - API Reseller pentru mai multe firme
9
+ - Utilitare (validare CIF, cursuri valutar, etc.)
10
+ """
11
+
12
+ import json
13
+ import base64
14
+ from typing import Dict, Any, List, Optional, Union
15
+ from urllib.parse import urljoin
16
+
17
+ import requests
18
+ from requests.auth import HTTPBasicAuth
19
+ from requests.exceptions import RequestException, Timeout, ConnectionError
20
+
21
+ from .exceptions import (
22
+ InsideAppError,
23
+ InsideAppAPIError,
24
+ InsideAppAuthError,
25
+ InsideAppValidationError,
26
+ InsideAppTimeoutError,
27
+ InsideAppConnectionError,
28
+ )
29
+
30
+
31
+ class InsideAppClient:
32
+ """
33
+ Client principal pentru interacțiunea cu API-ul InsideApp.
34
+
35
+ SDK oficial Python pentru InsideApp - gestiune facturi și integrare completă cu SPV.
36
+ Tot ce ai nevoie pentru facturarea în România: emite facturi, integrează automat cu
37
+ ANAF eFactura și gestionează tot procesul pentru mai multe firme.
38
+
39
+ Attributes:
40
+ base_url (str): URL-ul de bază al API-ului InsideApp
41
+ timeout (int): Timeout pentru requesturi în secunde
42
+
43
+ Example:
44
+ >>> from insideapp import InsideAppClient
45
+ >>> client = InsideAppClient("username", "password")
46
+ >>> judete = client.info_judete()
47
+ >>> print(len(judete)) # 42 județe
48
+ """
49
+
50
+ def __init__(self, username: str, password: str, timeout: int = 300):
51
+ """
52
+ Inițializează clientul InsideApp.
53
+
54
+ Args:
55
+ username (str): Numele de utilizator (email/username API)
56
+ password (str): Parola API
57
+ timeout (int, optional): Timeout pentru requesturi în secunde. Default: 300
58
+
59
+ Raises:
60
+ InsideAppValidationError: Dacă credențialele sunt goale
61
+ """
62
+ if not username:
63
+ raise InsideAppValidationError("Username-ul nu poate fi gol")
64
+ if not password:
65
+ raise InsideAppValidationError("Parola nu poate fi golă")
66
+
67
+ self.username = username
68
+ self.password = password
69
+ self.base_url = "https://api.my.iapp.ro/"
70
+ self.timeout = timeout
71
+
72
+ # Setup sesiune HTTP cu autentificare
73
+ self.session = requests.Session()
74
+ self.session.auth = HTTPBasicAuth(username, password)
75
+ self.session.timeout = timeout
76
+
77
+ # Headers default
78
+ self.session.headers.update({
79
+ 'User-Agent': 'InsideApp-Python-SDK/1.30.2',
80
+ 'Accept': 'application/json',
81
+ 'Content-Type': 'application/json',
82
+ })
83
+
84
+ def get_version(self) -> str:
85
+ """
86
+ Returnează versiunea SDK-ului.
87
+
88
+ Returns:
89
+ str: Versiunea curentă a SDK-ului
90
+ """
91
+ return "1.30.2"
92
+
93
+ def set_timeout(self, timeout: int) -> 'InsideAppClient':
94
+ """
95
+ Setează timeout-ul pentru requesturi.
96
+
97
+ Args:
98
+ timeout (int): Timeout în secunde
99
+
100
+ Returns:
101
+ InsideAppClient: Instanța clientului pentru method chaining
102
+ """
103
+ self.timeout = timeout
104
+ self.session.timeout = timeout
105
+ return self
106
+
107
+ def _make_request(
108
+ self,
109
+ method: str,
110
+ endpoint: str,
111
+ data: Optional[Dict[str, Any]] = None,
112
+ params: Optional[Dict[str, Any]] = None,
113
+ download: bool = False
114
+ ) -> Union[Dict[str, Any], List[Any], bytes]:
115
+ """
116
+ Execută un request HTTP către API-ul InsideApp.
117
+
118
+ Args:
119
+ method (str): Metoda HTTP (GET, POST, etc.)
120
+ endpoint (str): Endpoint-ul API (ex: "emite/factura")
121
+ data (dict, optional): Datele de trimis în request body
122
+ params (dict, optional): Parametrii URL pentru GET requests
123
+ download (bool): Dacă să returneze conținutul pentru download
124
+
125
+ Returns:
126
+ Union[Dict, List, bytes]: Răspunsul decodat JSON sau bytes pentru download
127
+
128
+ Raises:
129
+ InsideAppAuthError: Pentru erori de autentificare
130
+ InsideAppAPIError: Pentru erori returnate de API
131
+ InsideAppTimeoutError: Pentru timeout-uri
132
+ InsideAppConnectionError: Pentru erori de conexiune
133
+ """
134
+ url = urljoin(self.base_url, endpoint.lstrip('/'))
135
+
136
+ try:
137
+ if method.upper() == 'GET':
138
+ response = self.session.get(url, params=params)
139
+ else:
140
+ response = self.session.post(url, json=data)
141
+
142
+ # Verifică status code
143
+ if response.status_code == 401:
144
+ raise InsideAppAuthError("Credențiale invalide sau expirate")
145
+ elif response.status_code == 403:
146
+ raise InsideAppAuthError("Acces interzis - verifică permisiunile")
147
+ elif response.status_code >= 500:
148
+ raise InsideAppAPIError(
149
+ f"Eroare server: {response.status_code}",
150
+ status_code=response.status_code
151
+ )
152
+ elif response.status_code >= 400:
153
+ try:
154
+ error_data = response.json()
155
+ error_msg = error_data.get('message', f'Eroare API: {response.status_code}')
156
+ except ValueError:
157
+ error_msg = f'Eroare API: {response.status_code}'
158
+
159
+ raise InsideAppAPIError(
160
+ error_msg,
161
+ status_code=response.status_code,
162
+ response_data=error_data if 'error_data' in locals() else {}
163
+ )
164
+
165
+ # Pentru download
166
+ if download:
167
+ return response.content
168
+
169
+ # Încearcă să decodeze JSON
170
+ try:
171
+ return response.json()
172
+ except ValueError as e:
173
+ raise InsideAppAPIError(f"Răspuns invalid JSON: {e}")
174
+
175
+ except Timeout as e:
176
+ raise InsideAppTimeoutError(f"Request timeout după {self.timeout} secunde: {e}")
177
+ except ConnectionError as e:
178
+ raise InsideAppConnectionError(f"Eroare de conexiune: {e}")
179
+ except RequestException as e:
180
+ raise InsideAppError(f"Eroare request: {e}")
181
+
182
+ # =========================================================================
183
+ # FACTURI PROFORMA
184
+ # =========================================================================
185
+
186
+ def emite_proforma(self, data: Dict[str, Any]) -> Dict[str, Any]:
187
+ """
188
+ Emite o factură proforma.
189
+
190
+ Args:
191
+ data (dict): Datele pentru factura proforma
192
+
193
+ Returns:
194
+ dict: Răspunsul API cu detaliile proformei emise
195
+ """
196
+ return self._make_request("POST", "emite/proforma", data)
197
+
198
+ def emite_proforma_v2(self, data: Dict[str, Any]) -> Dict[str, Any]:
199
+ """
200
+ Emite o factură proforma (versiunea 2 a API-ului).
201
+
202
+ Args:
203
+ data (dict): Datele pentru factura proforma
204
+
205
+ Returns:
206
+ dict: Răspunsul API cu detaliile proformei emise
207
+ """
208
+ return self._make_request("POST", "emite/proforma_v2", data)
209
+
210
+ def view_proforma(self, data: Dict[str, Any]) -> Dict[str, Any]:
211
+ """
212
+ Vizualizează detaliile unei facturi proforma.
213
+
214
+ Args:
215
+ data (dict): Datele cu ID-ul proformei
216
+
217
+ Returns:
218
+ dict: Datele complete ale proformei
219
+ """
220
+ return self._make_request("POST", "view/proforma", data)
221
+
222
+ def view_proforme(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
223
+ """
224
+ Listează toate facturile proforma.
225
+
226
+ Args:
227
+ data (dict, optional): Filtere pentru listă
228
+
229
+ Returns:
230
+ list: Lista facturilor proforma
231
+ """
232
+ return self._make_request("POST", "view/proforme", data or {})
233
+
234
+ def cancel_proforma(self, data: Dict[str, Any]) -> Dict[str, Any]:
235
+ """
236
+ Anulează o factură proforma.
237
+
238
+ Args:
239
+ data (dict): Datele cu ID-ul proformei de anulat
240
+
241
+ Returns:
242
+ dict: Confirmarea anulării
243
+ """
244
+ return self._make_request("POST", "cancel/proforma", data)
245
+
246
+ def factureaza_proforma(self, data: Dict[str, Any]) -> Dict[str, Any]:
247
+ """
248
+ Transformă o proforma în factură fiscală.
249
+
250
+ Args:
251
+ data (dict): Datele proformei de transformat
252
+
253
+ Returns:
254
+ dict: Datele facturii fiscale create
255
+ """
256
+ return self._make_request("POST", "factureaza/proforma", data)
257
+
258
+ # =========================================================================
259
+ # FACTURI FISCALE
260
+ # =========================================================================
261
+
262
+ def emite_factura(self, data: Dict[str, Any]) -> Dict[str, Any]:
263
+ """
264
+ Emite o factură fiscală.
265
+
266
+ Args:
267
+ data (dict): Datele pentru factura fiscală
268
+
269
+ Returns:
270
+ dict: Răspunsul API cu detaliile facturii emise
271
+ """
272
+ return self._make_request("POST", "emite/factura", data)
273
+
274
+ def emite_factura_v2(self, data: Dict[str, Any]) -> Dict[str, Any]:
275
+ """
276
+ Emite o factură fiscală (versiunea 2 a API-ului).
277
+
278
+ Args:
279
+ data (dict): Datele pentru factura fiscală
280
+
281
+ Returns:
282
+ dict: Răspunsul API cu detaliile facturii emise
283
+ """
284
+ return self._make_request("POST", "emite/factura_v2", data)
285
+
286
+ def view_factura(self, data: Dict[str, Any]) -> Dict[str, Any]:
287
+ """
288
+ Vizualizează detaliile unei facturi fiscale.
289
+
290
+ Args:
291
+ data (dict): Datele cu ID-ul facturii
292
+
293
+ Returns:
294
+ dict: Datele complete ale facturii
295
+ """
296
+ return self._make_request("POST", "view/factura", data)
297
+
298
+ def view_facturi(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
299
+ """
300
+ Listează toate facturile fiscale.
301
+
302
+ Args:
303
+ data (dict, optional): Filtere pentru listă
304
+
305
+ Returns:
306
+ list: Lista facturilor fiscale
307
+ """
308
+ return self._make_request("POST", "view/facturi", data or {})
309
+
310
+ def cancel_factura(self, data: Dict[str, Any]) -> Dict[str, Any]:
311
+ """
312
+ Anulează o factură fiscală.
313
+
314
+ Args:
315
+ data (dict): Datele cu ID-ul facturii de anulat
316
+
317
+ Returns:
318
+ dict: Confirmarea anulării
319
+ """
320
+ return self._make_request("POST", "cancel/factura", data)
321
+
322
+ def incaseaza_factura(self, data: Dict[str, Any]) -> Dict[str, Any]:
323
+ """
324
+ Marchează o factură ca fiind încasată.
325
+
326
+ Args:
327
+ data (dict): Datele cu ID-ul facturii și detaliile încasării
328
+
329
+ Returns:
330
+ dict: Confirmarea încasării
331
+ """
332
+ return self._make_request("POST", "incaseaza/factura", data)
333
+
334
+ def storneaza_factura(self, data: Dict[str, Any]) -> Dict[str, Any]:
335
+ """
336
+ Stornează o factură fiscală.
337
+
338
+ Args:
339
+ data (dict): Datele pentru stornare
340
+
341
+ Returns:
342
+ dict: Datele facturii de stornare
343
+ """
344
+ return self._make_request("POST", "storneaza/factura", data)
345
+
346
+ # =========================================================================
347
+ # CHITANȚE
348
+ # =========================================================================
349
+
350
+ def emite_chitanta(self, data: Dict[str, Any]) -> Dict[str, Any]:
351
+ """
352
+ Emite o chitanță.
353
+
354
+ Args:
355
+ data (dict): Datele pentru chitanță
356
+
357
+ Returns:
358
+ dict: Răspunsul API cu detaliile chitanței emise
359
+ """
360
+ return self._make_request("POST", "emite/chitanta", data)
361
+
362
+ def view_chitanta(self, data: Dict[str, Any]) -> Dict[str, Any]:
363
+ """
364
+ Vizualizează detaliile unei chitanțe.
365
+
366
+ Args:
367
+ data (dict): Datele cu ID-ul chitanței
368
+
369
+ Returns:
370
+ dict: Datele complete ale chitanței
371
+ """
372
+ return self._make_request("POST", "view/chitanta", data)
373
+
374
+ def view_chitante(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
375
+ """
376
+ Listează toate chitanțele.
377
+
378
+ Args:
379
+ data (dict, optional): Filtere pentru listă
380
+
381
+ Returns:
382
+ list: Lista chitanțelor
383
+ """
384
+ return self._make_request("POST", "view/chitante", data or {})
385
+
386
+ def anuleaza_chitanta(self, data: Dict[str, Any]) -> Dict[str, Any]:
387
+ """
388
+ Anulează o chitanță.
389
+
390
+ Args:
391
+ data (dict): Datele cu ID-ul chitanței de anulat
392
+
393
+ Returns:
394
+ dict: Confirmarea anulării
395
+ """
396
+ return self._make_request("POST", "anuleaza/chitanta", data)
397
+
398
+ def sterge_chitanta(self, data: Dict[str, Any]) -> Dict[str, Any]:
399
+ """
400
+ Șterge o chitanță.
401
+
402
+ Args:
403
+ data (dict): Datele cu ID-ul chitanței de șters
404
+
405
+ Returns:
406
+ dict: Confirmarea ștergerii
407
+ """
408
+ return self._make_request("POST", "sterge/chitanta", data)
409
+
410
+ # =========================================================================
411
+ # ÎNCASĂRI
412
+ # =========================================================================
413
+
414
+ def view_incasari(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
415
+ """
416
+ Listează toate încasările.
417
+
418
+ Args:
419
+ data (dict, optional): Filtere pentru listă
420
+
421
+ Returns:
422
+ list: Lista încasărilor
423
+ """
424
+ return self._make_request("POST", "view/incasari", data or {})
425
+
426
+ def view_incasare(self, data: Dict[str, Any]) -> Dict[str, Any]:
427
+ """
428
+ Vizualizează detaliile unei încasări.
429
+
430
+ Args:
431
+ data (dict): Datele cu ID-ul încasării
432
+
433
+ Returns:
434
+ dict: Datele complete ale încasării
435
+ """
436
+ return self._make_request("POST", "view/incasare", data)
437
+
438
+ def sterge_incasare(self, data: Dict[str, Any]) -> Dict[str, Any]:
439
+ """
440
+ Șterge o încasare.
441
+
442
+ Args:
443
+ data (dict): Datele cu ID-ul încasării de șters
444
+
445
+ Returns:
446
+ dict: Confirmarea ștergerii
447
+ """
448
+ return self._make_request("POST", "sterge/incasare", data)
449
+
450
+ # =========================================================================
451
+ # NOMENCLATOR CLIENȚI
452
+ # =========================================================================
453
+
454
+ def clienti_lista(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
455
+ """
456
+ Listează toți clienții.
457
+
458
+ Args:
459
+ data (dict, optional): Filtere pentru listă
460
+
461
+ Returns:
462
+ list: Lista clienților
463
+ """
464
+ return self._make_request("POST", "clienti/lista", data or {})
465
+
466
+ def clienti_vizualizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
467
+ """
468
+ Vizualizează detaliile unui client.
469
+
470
+ Args:
471
+ data (dict): Datele cu ID-ul clientului
472
+
473
+ Returns:
474
+ dict: Datele complete ale clientului
475
+ """
476
+ return self._make_request("POST", "clienti/vizualizare", data)
477
+
478
+ def clienti_adauga(self, data: Dict[str, Any]) -> Dict[str, Any]:
479
+ """
480
+ Adaugă un client nou.
481
+
482
+ Args:
483
+ data (dict): Datele clientului nou
484
+
485
+ Returns:
486
+ dict: Datele clientului creat
487
+ """
488
+ return self._make_request("POST", "clienti/adauga", data)
489
+
490
+ def clienti_modifica(self, data: Dict[str, Any]) -> Dict[str, Any]:
491
+ """
492
+ Modifică datele unui client.
493
+
494
+ Args:
495
+ data (dict): Datele actualizate ale clientului
496
+
497
+ Returns:
498
+ dict: Datele clientului modificat
499
+ """
500
+ return self._make_request("POST", "clienti/modifica", data)
501
+
502
+ def clienti_sterge(self, data: Dict[str, Any]) -> Dict[str, Any]:
503
+ """
504
+ Șterge un client.
505
+
506
+ Args:
507
+ data (dict): Datele cu ID-ul clientului de șters
508
+
509
+ Returns:
510
+ dict: Confirmarea ștergerii
511
+ """
512
+ return self._make_request("POST", "clienti/sterge", data)
513
+
514
+ # =========================================================================
515
+ # NOMENCLATOR PRODUSE/SERVICII
516
+ # =========================================================================
517
+
518
+ def produse_lista(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
519
+ """
520
+ Listează toate produsele și serviciile.
521
+
522
+ Args:
523
+ data (dict, optional): Filtere pentru listă
524
+
525
+ Returns:
526
+ list: Lista produselor/serviciilor
527
+ """
528
+ return self._make_request("POST", "produse/lista", data or {})
529
+
530
+ def produse_vizualizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
531
+ """
532
+ Vizualizează detaliile unui produs/serviciu.
533
+
534
+ Args:
535
+ data (dict): Datele cu ID-ul produsului
536
+
537
+ Returns:
538
+ dict: Datele complete ale produsului
539
+ """
540
+ return self._make_request("POST", "produse/vizualizare", data)
541
+
542
+ def produse_adauga(self, data: Dict[str, Any]) -> Dict[str, Any]:
543
+ """
544
+ Adaugă un produs/serviciu nou.
545
+
546
+ Args:
547
+ data (dict): Datele produsului nou
548
+
549
+ Returns:
550
+ dict: Datele produsului creat
551
+ """
552
+ return self._make_request("POST", "produse/adauga", data)
553
+
554
+ def produse_modifica(self, data: Dict[str, Any]) -> Dict[str, Any]:
555
+ """
556
+ Modifică datele unui produs/serviciu.
557
+
558
+ Args:
559
+ data (dict): Datele actualizate ale produsului
560
+
561
+ Returns:
562
+ dict: Datele produsului modificat
563
+ """
564
+ return self._make_request("POST", "produse/modifica", data)
565
+
566
+ def produse_sterge(self, data: Dict[str, Any]) -> Dict[str, Any]:
567
+ """
568
+ Șterge un produs/serviciu.
569
+
570
+ Args:
571
+ data (dict): Datele cu ID-ul produsului de șters
572
+
573
+ Returns:
574
+ dict: Confirmarea ștergerii
575
+ """
576
+ return self._make_request("POST", "produse/sterge", data)
577
+
578
+ # =========================================================================
579
+ # CONFIGURARE SERII
580
+ # =========================================================================
581
+
582
+ def serie_lista(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
583
+ """
584
+ Listează toate seriile de facturi.
585
+
586
+ Args:
587
+ data (dict, optional): Filtere pentru listă
588
+
589
+ Returns:
590
+ list: Lista seriilor
591
+ """
592
+ return self._make_request("POST", "serie/lista", data or {})
593
+
594
+ def serie_vizualizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
595
+ """
596
+ Vizualizează detaliile unei serii.
597
+
598
+ Args:
599
+ data (dict): Datele cu ID-ul seriei
600
+
601
+ Returns:
602
+ dict: Datele complete ale seriei
603
+ """
604
+ return self._make_request("POST", "serie/vizualizare", data)
605
+
606
+ def serie_design(self, data: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
607
+ """
608
+ Obține setările de design ale facturilor.
609
+
610
+ Args:
611
+ data (dict, optional): Parametrii pentru design
612
+
613
+ Returns:
614
+ dict: Setările de design
615
+ """
616
+ return self._make_request("POST", "serie/design", data or {})
617
+
618
+ def serie_adauga(self, data: Dict[str, Any]) -> Dict[str, Any]:
619
+ """
620
+ Adaugă o serie nouă.
621
+
622
+ Args:
623
+ data (dict): Datele seriei noi
624
+
625
+ Returns:
626
+ dict: Datele seriei create
627
+ """
628
+ return self._make_request("POST", "serie/adauga", data)
629
+
630
+ def serie_modifica(self, data: Dict[str, Any]) -> Dict[str, Any]:
631
+ """
632
+ Modifică o serie existentă.
633
+
634
+ Args:
635
+ data (dict): Datele actualizate ale seriei
636
+
637
+ Returns:
638
+ dict: Datele seriei modificate
639
+ """
640
+ return self._make_request("POST", "serie/modifica", data)
641
+
642
+ def serie_sterge(self, data: Dict[str, Any]) -> Dict[str, Any]:
643
+ """
644
+ Șterge o serie.
645
+
646
+ Args:
647
+ data (dict): Datele cu ID-ul seriei de șters
648
+
649
+ Returns:
650
+ dict: Confirmarea ștergerii
651
+ """
652
+ return self._make_request("POST", "serie/sterge", data)
653
+
654
+ def serie_sterge_logo(self, data: Dict[str, Any]) -> Dict[str, Any]:
655
+ """
656
+ Șterge logo-ul unei serii.
657
+
658
+ Args:
659
+ data (dict): Datele cu ID-ul seriei
660
+
661
+ Returns:
662
+ dict: Confirmarea ștergerii logo-ului
663
+ """
664
+ return self._make_request("POST", "serie/sterge_logo", data)
665
+
666
+ # =========================================================================
667
+ # CONTURI BANCARE
668
+ # =========================================================================
669
+
670
+ def conturi_bancare_lista(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
671
+ """
672
+ Listează toate conturile bancare.
673
+
674
+ Args:
675
+ data (dict, optional): Filtere pentru listă
676
+
677
+ Returns:
678
+ list: Lista conturilor bancare
679
+ """
680
+ return self._make_request("POST", "conturi_bancare/lista", data or {})
681
+
682
+ def conturi_bancare_vizualizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
683
+ """
684
+ Vizualizează detaliile unui cont bancar.
685
+
686
+ Args:
687
+ data (dict): Datele cu ID-ul contului
688
+
689
+ Returns:
690
+ dict: Datele complete ale contului bancar
691
+ """
692
+ return self._make_request("POST", "conturi_bancare/vizualizare", data)
693
+
694
+ def conturi_bancare_adauga(self, data: Dict[str, Any]) -> Dict[str, Any]:
695
+ """
696
+ Adaugă un cont bancar nou.
697
+
698
+ Args:
699
+ data (dict): Datele contului bancar nou
700
+
701
+ Returns:
702
+ dict: Datele contului creat
703
+ """
704
+ return self._make_request("POST", "conturi_bancare/adauga", data)
705
+
706
+ def conturi_bancare_modifica(self, data: Dict[str, Any]) -> Dict[str, Any]:
707
+ """
708
+ Modifică datele unui cont bancar.
709
+
710
+ Args:
711
+ data (dict): Datele actualizate ale contului
712
+
713
+ Returns:
714
+ dict: Datele contului modificat
715
+ """
716
+ return self._make_request("POST", "conturi_bancare/modifica", data)
717
+
718
+ def conturi_bancare_sterge(self, data: Dict[str, Any]) -> Dict[str, Any]:
719
+ """
720
+ Șterge un cont bancar.
721
+
722
+ Args:
723
+ data (dict): Datele cu ID-ul contului de șters
724
+
725
+ Returns:
726
+ dict: Confirmarea ștergerii
727
+ """
728
+ return self._make_request("POST", "conturi_bancare/sterge", data)
729
+
730
+ # =========================================================================
731
+ # UTILITARE
732
+ # =========================================================================
733
+
734
+ def curs_valutar(self, data: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
735
+ """
736
+ Obține cursul valutar curent.
737
+
738
+ Args:
739
+ data (dict, optional): Parametrii pentru curs valutar
740
+
741
+ Returns:
742
+ dict: Cursurile valutare actuale
743
+ """
744
+ return self._make_request("POST", "curs_valutar", data or {})
745
+
746
+ def info_cif(self, data: Dict[str, Any]) -> Dict[str, Any]:
747
+ """
748
+ Validează și obține informații despre un CIF.
749
+
750
+ Args:
751
+ data (dict): Datele cu CIF-ul de verificat
752
+
753
+ Returns:
754
+ dict: Informațiile despre CIF
755
+ """
756
+ return self._make_request("POST", "info/cif", data)
757
+
758
+ def info_judete(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
759
+ """
760
+ Obține lista județelor din România.
761
+
762
+ Args:
763
+ data (dict, optional): Parametrii suplimentari
764
+
765
+ Returns:
766
+ list: Lista celor 42 de județe din România
767
+ """
768
+ return self._make_request("POST", "info/judete", data or {})
769
+
770
+ def info_localitati(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
771
+ """
772
+ Obține localitățile dintr-un județ specificat.
773
+
774
+ Args:
775
+ data (dict, optional): Datele cu codul județului
776
+
777
+ Returns:
778
+ list: Lista localităților din județ
779
+ """
780
+ return self._make_request("POST", "info/localitati", data or {})
781
+
782
+ # =========================================================================
783
+ # SPV / eFactura
784
+ # =========================================================================
785
+
786
+ def e_factura_emise(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
787
+ """
788
+ Listează facturile emise în SPV.
789
+
790
+ Args:
791
+ data (dict, optional): Filtere pentru listă
792
+
793
+ Returns:
794
+ list: Lista facturilor emise în SPV
795
+ """
796
+ return self._make_request("POST", "eFactura/emise", data or {})
797
+
798
+ def e_factura_view_emise(self, data: Dict[str, Any]) -> Dict[str, Any]:
799
+ """
800
+ Vizualizează o factură emisă în SPV.
801
+
802
+ Args:
803
+ data (dict): Datele cu ID-ul facturii
804
+
805
+ Returns:
806
+ dict: Detaliile facturii emise
807
+ """
808
+ return self._make_request("POST", "eFactura/view_emise", data)
809
+
810
+ def e_factura_descarca_emise(self, data: Dict[str, Any]) -> bytes:
811
+ """
812
+ Descarcă PDF-ul unei facturi emise.
813
+
814
+ Args:
815
+ data (dict): Datele cu ID-ul facturii
816
+
817
+ Returns:
818
+ bytes: Conținutul PDF al facturii
819
+ """
820
+ return self._make_request("POST", "eFactura/descarca_emise", data, download=True)
821
+
822
+ def e_factura_furnizori(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
823
+ """
824
+ Listează facturile primite de la furnizori în SPV.
825
+
826
+ Args:
827
+ data (dict, optional): Filtere pentru listă
828
+
829
+ Returns:
830
+ list: Lista facturilor de la furnizori
831
+ """
832
+ return self._make_request("POST", "eFactura/furnizori", data or {})
833
+
834
+ def e_factura_view_furnizori(self, data: Dict[str, Any]) -> Dict[str, Any]:
835
+ """
836
+ Vizualizează o factură de la furnizor din SPV.
837
+
838
+ Args:
839
+ data (dict): Datele cu ID-ul facturii
840
+
841
+ Returns:
842
+ dict: Detaliile facturii de la furnizor
843
+ """
844
+ return self._make_request("POST", "eFactura/view_furnizori", data)
845
+
846
+ def e_factura_descarca_furnizori(self, data: Dict[str, Any]) -> bytes:
847
+ """
848
+ Descarcă PDF-ul unei facturi de la furnizor.
849
+
850
+ Args:
851
+ data (dict): Datele cu ID-ul facturii
852
+
853
+ Returns:
854
+ bytes: Conținutul PDF al facturii
855
+ """
856
+ return self._make_request("POST", "eFactura/descarca_furnizori", data, download=True)
857
+
858
+ def e_factura_upload_xml(self, data: Dict[str, Any]) -> Dict[str, Any]:
859
+ """
860
+ Încarcă o factură XML în SPV.
861
+
862
+ Args:
863
+ data (dict): Datele cu conținutul XML
864
+
865
+ Returns:
866
+ dict: Confirmarea încărcării
867
+ """
868
+ return self._make_request("POST", "eFactura/upload_xml", data)
869
+
870
+ def e_factura_upload_status(self, data: Dict[str, Any]) -> Dict[str, Any]:
871
+ """
872
+ Verifică status-ul trimiterii unei facturi în SPV.
873
+
874
+ Args:
875
+ data (dict): Datele cu ID-ul facturii
876
+
877
+ Returns:
878
+ dict: Status-ul trimiterii la ANAF
879
+ """
880
+ return self._make_request("POST", "eFactura/upload_status", data)
881
+
882
+ # =========================================================================
883
+ # API RESELLER
884
+ # =========================================================================
885
+
886
+ def firma_lista(self, data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
887
+ """
888
+ Listează toate firmele din cont (API Reseller).
889
+
890
+ Args:
891
+ data (dict, optional): Filtere pentru listă
892
+
893
+ Returns:
894
+ list: Lista firmelor
895
+ """
896
+ return self._make_request("POST", "firma/lista", data or {})
897
+
898
+ def firma_vizualizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
899
+ """
900
+ Vizualizează detaliile unei firme.
901
+
902
+ Args:
903
+ data (dict): Datele cu ID-ul firmei
904
+
905
+ Returns:
906
+ dict: Datele complete ale firmei
907
+ """
908
+ return self._make_request("POST", "firma/vizualizare", data)
909
+
910
+ def firma_api(self, data: Dict[str, Any]) -> Dict[str, Any]:
911
+ """
912
+ Obține credențialele API ale unei firme.
913
+
914
+ Args:
915
+ data (dict): Datele cu ID-ul firmei
916
+
917
+ Returns:
918
+ dict: Credențialele API ale firmei
919
+ """
920
+ return self._make_request("POST", "firma/api", data)
921
+
922
+ def firma_api_reset(self, data: Dict[str, Any]) -> Dict[str, Any]:
923
+ """
924
+ Resetează credențialele API ale unei firme.
925
+
926
+ Args:
927
+ data (dict): Datele cu ID-ul firmei
928
+
929
+ Returns:
930
+ dict: Noile credențiale API
931
+ """
932
+ return self._make_request("POST", "firma/api_reset", data)
933
+
934
+ def firma_adauga(self, data: Dict[str, Any]) -> Dict[str, Any]:
935
+ """
936
+ Adaugă o firmă nouă în cont.
937
+
938
+ Args:
939
+ data (dict): Datele firmei noi
940
+
941
+ Returns:
942
+ dict: Datele firmei create
943
+ """
944
+ return self._make_request("POST", "firma/adauga", data)
945
+
946
+ def firma_modifica(self, data: Dict[str, Any]) -> Dict[str, Any]:
947
+ """
948
+ Modifică datele unei firme.
949
+
950
+ Args:
951
+ data (dict): Datele actualizate ale firmei
952
+
953
+ Returns:
954
+ dict: Datele firmei modificate
955
+ """
956
+ return self._make_request("POST", "firma/modifica", data)
957
+
958
+ def firma_activeaza(self, data: Dict[str, Any]) -> Dict[str, Any]:
959
+ """
960
+ Activează o firmă.
961
+
962
+ Args:
963
+ data (dict): Datele cu ID-ul firmei
964
+
965
+ Returns:
966
+ dict: Confirmarea activării
967
+ """
968
+ return self._make_request("POST", "firma/activeaza", data)
969
+
970
+ def firma_dezactiveaza(self, data: Dict[str, Any]) -> Dict[str, Any]:
971
+ """
972
+ Dezactivează o firmă.
973
+
974
+ Args:
975
+ data (dict): Datele cu ID-ul firmei
976
+
977
+ Returns:
978
+ dict: Confirmarea dezactivării
979
+ """
980
+ return self._make_request("POST", "firma/dezactiveaza", data)
981
+
982
+ def e_factura_autorizare(self, data: Dict[str, Any]) -> Dict[str, Any]:
983
+ """
984
+ Creează o autorizare nouă pentru eFactura.
985
+
986
+ Args:
987
+ data (dict): Datele pentru autorizare
988
+
989
+ Returns:
990
+ dict: Detaliile autorizării
991
+ """
992
+ return self._make_request("POST", "eFactura/autorizare", data)
993
+
994
+ def trimite_factura_spv_manual(self, data: Dict[str, Any]) -> Dict[str, Any]:
995
+ """
996
+ Trimite manual o factură în SPV.
997
+
998
+ Args:
999
+ data (dict): Datele facturii de trimis
1000
+
1001
+ Returns:
1002
+ dict: Confirmarea trimiterii
1003
+ """
1004
+ return self._make_request("POST", "trimite/factura_spv_manual", data)
1005
+
1006
+ def e_factura_autorizari_lista(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
1007
+ """
1008
+ Listează autorizările pentru eFactura.
1009
+
1010
+ Args:
1011
+ data (dict): Parametrii pentru listă
1012
+
1013
+ Returns:
1014
+ list: Lista autorizărilor
1015
+ """
1016
+ return self._make_request("POST", "eFactura/autorizari_lista", data)
1017
+
1018
+ def e_factura_vizualizare_setari(self, data: Dict[str, Any]) -> Dict[str, Any]:
1019
+ """
1020
+ Vizualizează setările eFactura pentru o firmă.
1021
+
1022
+ Args:
1023
+ data (dict): Datele cu ID-ul firmei
1024
+
1025
+ Returns:
1026
+ dict: Setările eFactura
1027
+ """
1028
+ return self._make_request("POST", "eFactura/vizualizare_setari", data)
1029
+
1030
+ def e_factura_modifica_setarile(self, data: Dict[str, Any]) -> Dict[str, Any]:
1031
+ """
1032
+ Modifică setările eFactura pentru o firmă.
1033
+
1034
+ Args:
1035
+ data (dict): Noile setări eFactura
1036
+
1037
+ Returns:
1038
+ dict: Confirmarea modificării setărilor
1039
+ """
1040
+ return self._make_request("POST", "eFactura/modifica_setarile", data)