Skip to content

Commit e8435c6

Browse files
authored
Merge pull request #49 from offline-agency/feat-add-product-entity
feat: add Acquisti, Corrispettivi, Magazzino
2 parents a95c375 + 31cb76b commit e8435c6

File tree

6 files changed

+312
-2
lines changed

6 files changed

+312
-2
lines changed

src/Entities/Acquisti.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Entities;
4+
5+
use Exception;
6+
use OfflineAgency\FattureInCloud\FattureInCloud;
7+
use OfflineAgency\FattureInCloud\Requests\Acquisti as Request;
8+
9+
class Acquisti extends FattureInCloud
10+
{
11+
/**
12+
* @param array $data
13+
* @return mixed|string
14+
*
15+
* @throws Exception
16+
*/
17+
public function lista($data = [])
18+
{
19+
Request::lista($data);
20+
21+
return $this->auth->post('acquisti/lista', $data);
22+
}
23+
24+
/**
25+
* @param array $data
26+
* @return mixed|string
27+
*
28+
* @throws Exception
29+
*/
30+
public function dettagli($data = [])
31+
{
32+
Request::dettagli($data);
33+
34+
return $this->auth->post('acquisti/dettagli', $data);
35+
}
36+
37+
/**
38+
* @param array $data
39+
* @return mixed|string
40+
*
41+
* @throws Exception
42+
*/
43+
public function nuovo($data = [])
44+
{
45+
Request::nuovo($data);
46+
47+
return $this->auth->post('acquisti/nuovo', $data);
48+
}
49+
50+
/**
51+
* @param array $data
52+
* @return mixed|string
53+
*
54+
* @throws Exception
55+
*/
56+
public function modifica($data = [])
57+
{
58+
Request::modifica($data);
59+
60+
return $this->auth->post('acquisti/modifica', $data);
61+
}
62+
63+
/**
64+
* @param array $data
65+
* @return mixed|string
66+
*
67+
* @throws Exception
68+
*/
69+
public function elimina($data = [])
70+
{
71+
Request::elimina($data);
72+
73+
return $this->auth->post('acquisti/elimina', $data);
74+
}
75+
76+
/**
77+
* @param array $data
78+
* @return mixed|string
79+
*
80+
* @throws Exception
81+
*/
82+
public function info($data = [])
83+
{
84+
Request::info($data);
85+
86+
return $this->auth->post('acquisti/info', $data);
87+
}
88+
}

src/Entities/Corrispettivi.php

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Entities;
4+
5+
use OfflineAgency\FattureInCloud\FattureInCloud;
6+
use OfflineAgency\FattureInCloud\Requests\Corrispettivi as Request;
7+
8+
class Corrispettivi extends FattureInCloud
9+
{
10+
/**
11+
* @param array $data
12+
* @return mixed|string
13+
*
14+
* @throws Exception
15+
*/
16+
public function lista($data = [])
17+
{
18+
Request::lista($data);
19+
20+
return $this->auth->post('corrispettivi/lista', $data);
21+
}
22+
23+
/**
24+
* @param array $data
25+
* @return mixed|string
26+
*
27+
* @throws Exception
28+
*/
29+
public function dettagli($data = [])
30+
{
31+
Request::dettagli($data);
32+
33+
return $this->auth->post('corrispettivi/dettagli', $data);
34+
}
35+
36+
/**
37+
* @param array $data
38+
* @return mixed|string
39+
*
40+
* @throws Exception
41+
*/
42+
public function nuovo($data = [])
43+
{
44+
Request::nuovo($data);
45+
46+
return $this->auth->post('corrispettivi/nuovo', $data);
47+
}
48+
49+
/**
50+
* @param array $data
51+
* @return mixed|string
52+
*
53+
* @throws Exception
54+
*/
55+
public function modifica($data = [])
56+
{
57+
Request::modifica($data);
58+
59+
return $this->auth->post('corrispettivi/modifica', $data);
60+
}
61+
62+
/**
63+
* @param array $data
64+
* @return mixed|string
65+
*
66+
* @throws Exception
67+
*/
68+
public function elimina($data = [])
69+
{
70+
Request::elimina($data);
71+
72+
return $this->auth->post('corrispettivi/elimina', $data);
73+
}
74+
75+
/**
76+
* @param array $data
77+
* @return mixed|string
78+
*
79+
* @throws Exception
80+
*/
81+
public function info($data = [])
82+
{
83+
Request::info($data);
84+
85+
return $this->auth->post('corrispettivi/info', $data);
86+
}
87+
}

src/Entities/Magazzino.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Entities;
4+
5+
use Exception;
6+
use OfflineAgency\FattureInCloud\FattureInCloud;
7+
use OfflineAgency\FattureInCloud\Requests\Magazzino as Request;
8+
9+
class Magazzino extends FattureInCloud
10+
{
11+
/**
12+
* @param array $data
13+
* @return mixed|string
14+
*
15+
* @throws Exception
16+
*/
17+
public function lista($data = [])
18+
{
19+
Request::lista($data);
20+
21+
return $this->auth->post('arrivimerce/lista', $data);
22+
}
23+
24+
/**
25+
* @param array $data
26+
* @return mixed|string
27+
*
28+
* @throws Exception
29+
*/
30+
public function dettagli($data = [])
31+
{
32+
Request::dettagli($data);
33+
34+
return $this->auth->post('arrivimerce/dettaglio', $data);
35+
}
36+
}

src/Requests/Corrispettivi.php

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Requests;
4+
5+
use Exception;
6+
7+
class Corrispettivi
8+
{
9+
/**
10+
* @param array $data
11+
* @return array
12+
*
13+
* @throws Exception
14+
*/
15+
public static function lista(array $data)
16+
{
17+
$allowed = ['anno', 'tipo', 'data_inizio', 'data_fine', 'id'];
18+
19+
$required = ['anno'];
20+
21+
return Common::parseData($data, $allowed, $required);
22+
}
23+
24+
/**
25+
* @param array $data
26+
* @return array
27+
*
28+
* @throws Exception
29+
*/
30+
public static function nuovo(array $data)
31+
{
32+
$allowed = ['tipo', 'data', 'protocollo_auto', 'protocollo', 'protocollo', 'desc', 'centro_ricavo', 'metodo', 'importi_ivati', 'lista_righe'];
33+
34+
$required = ['tipo'];
35+
36+
return Common::parseData($data, $allowed, $required);
37+
}
38+
39+
/**
40+
* @param array $data
41+
* @return array
42+
*
43+
* @throws Exception
44+
*/
45+
public static function modifica(array $data)
46+
{
47+
$allowed = ['id', 'tipo', 'data', 'protocollo_auto', 'protocollo', 'protocollo', 'desc', 'centro_ricavo', 'metodo', 'importi_ivati', 'lista_righe'];
48+
49+
$required = ['id', 'tipo'];
50+
51+
return Common::parseData($data, $allowed, $required);
52+
}
53+
54+
/**
55+
* @param array $data
56+
* @return array
57+
*
58+
* @throws Exception
59+
*/
60+
public static function elimina(array $data)
61+
{
62+
$allowed = ['id'];
63+
64+
$required = ['id'];
65+
66+
return Common::parseData($data, $allowed, $required);
67+
}
68+
}

src/Requests/Documenti.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ class Documenti
1414
*/
1515
public static function lista($data = [])
1616
{
17-
$allowed = ['anno', 'data_inizio', 'data_fine', 'cliente', 'fornitore', 'id_fornitore', 'id_cliente', 'saldato', 'oggetto', 'ogni_ddt',
18-
'PA_tipo_cliente', 'PA', 'pagina', ];
17+
$allowed = ['anno', 'data_inizio', 'data_fine', 'cliente', 'fornitore', 'id_fornitore', 'id_cliente', 'saldato', 'oggetto', 'ogni_ddt', 'PA_tipo_cliente', 'PA', 'pagina'];
1918

2019
$required = ['anno'];
2120

src/Requests/Magazzino.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace OfflineAgency\FattureInCloud\Requests;
4+
5+
use Exception;
6+
7+
class Magazzino
8+
{
9+
public static function lista(array $data)
10+
{
11+
$allowed = ['anno', 'data_inizio', 'data_fine', 'fornitore', 'id_fornitore', 'mostra_link_allegato'];
12+
13+
$required = ['anno'];
14+
15+
return Common::parseData($data, $allowed, $required);
16+
}
17+
18+
/**
19+
* @param array $data
20+
* @return array
21+
*
22+
* @throws Exception
23+
*/
24+
public static function dettagli(array $data)
25+
{
26+
$allowed = ['id'];
27+
28+
$required = ['id'];
29+
30+
return Common::parseData($data, $allowed, $required);
31+
}
32+
}

0 commit comments

Comments
 (0)