22
33use OpenApi \classes \utility \UfficioPostale \Objects \Recipient ;
44use OpenApi \classes \utility \UfficioPostale \Objects \Sender ;
5+ use OpenApi \classes \utility \VisEngine \VisRequest ;
56use OpenApi \OpenApi ;
67use PHPUnit \Framework \TestCase ;
78use Symfony \Component \Dotenv \Dotenv ;
@@ -26,20 +27,25 @@ public function __construct() {
2627
2728 // Dichiaro gli scopes necessari
2829 $ this ->scopes = [
29- "GET:ws.ufficiopostale.com/telegrammi " ,
30+ "GET:ws.ufficiopostale.com/raccomandate " ,
3031 "GET:imprese.altravia.com/autocomplete " ,
31- "GET:imprese.openapi.it /base " ,
32- "GET:imprese.openapi.it /advance " ,
33- "GET:imprese.openapi.it /pec " ,
34- "GET:imprese.openapi.it /autocomplete " ,
35- "GET:imprese.openapi.it /closed " ,
36- "GET:imprese.openapi.it /gruppoiva " ,
32+ "GET:imprese.altravia.com /base " ,
33+ "GET:imprese.altravia.com /advance " ,
34+ "GET:imprese.altravia.com /pec " ,
35+ "GET:imprese.altravia.com /autocomplete " ,
36+ "GET:imprese.altravia.com /closed " ,
37+ "GET:imprese.altravia.com /gruppoiva " ,
3738 "GET:comuni.openapi.it/cap " ,
3839 "GET:comuni.openapi.it/istat " ,
3940 "GET:comuni.openapi.it/regioni " ,
4041 "GET:comuni.openapi.it/province " ,
4142 "GET:ws.ufficiopostale.com/tracking " ,
42- "POST:geocoding.realgest.it/geocode "
43+ "POST:geocoding.realgest.it/geocode " ,
44+ "POST:ws.messaggisms.com/messages " ,
45+ "GET:ws.messaggisms.com/messages " ,
46+ "PUT:ws.messaggisms.com/messages " ,
47+ "GET:ws.firmadigitale.com/richiesta " ,
48+ "POST:ws.firmadigitale.com/richiesta " ,
4349 ];
4450
4551 $ this ->openapi = new OpenApi ($ this ->scopes , $ this ->username , $ this ->api_key , 'test ' );
@@ -56,36 +62,63 @@ public function testComuni() {
5662 $ this ->assertIsArray ($ cap );
5763 }
5864
65+ // public function testImprese() {
66+ // $impresa = $this->openapi->imprese->getByPartitaIva('00966950230');
67+ // $autocomplete = $this->openapi->imprese->getBySearch('*multiservizi*', 'RM');
68+ // $this->assertEquals($impresa->provincia, 'RM');
69+ // $this->assertIsArray($autocomplete);
70+ // }
71+
5972 // public function testGeocoding() {
6073 // // Prendi informazioni sul cap 00132
6174 // $cap = $this->openapi->geocoding->geocode('Via Cristoforo Colombo, Roma RM');
6275 // $this->assertIsArray($cap);
6376 // }
6477
65- public function testUfficioPostale () {
66- $ track = $ this ->openapi ->ufficiopostale ->track ($ _ENV ['TRACK_TEST ' ]);
67- $ this ->assertEquals (true , $ track ->success );
68- var_dump ($ track );
69-
70- $ raccomandata = $ this ->openapi ->ufficiopostale ->createRaccomandata ();
71- var_dump ($ raccomandata );
72-
73- $ data = new stdClass ();
74- $ sender = new Sender ([
75- 'firstName ' => 'John ' ,
76- 'secondName ' => 'Doe ' ,
77- 'companyName ' => 'example-spa ' ,
78- ]);
79-
80- $ recipient = new Recipient ([
81- 'firstName ' => 'John ' ,
82- 'secondName ' => 'Doe ' ,
83- 'companyName ' => 'example-spa ' ,
84- ]);
85-
86- $ data ->sender = $ sender ;
87- $ data ->recipient = $ recipient ;
78+ // public function testUfficioPostale() {
79+ // $track = $this->openapi->ufficiopostale->track($_ENV['TRACK_TEST']);
80+ // $this->assertEquals(true, $track->success);
81+ // var_dump($track);
82+
83+ // $raccomandata = $this->openapi->ufficiopostale->createRaccomandata();
84+ // var_dump($raccomandata);
85+
86+ // $data = new stdClass();
87+ // $sender = new Sender([
88+ // 'firstName' => 'John',
89+ // 'secondName' => 'Doe',
90+ // 'companyName' => 'example-spa',
91+ // ]);
92+
93+ // $recipient = new Recipient([
94+ // 'firstName' => 'John',
95+ // 'secondName' => 'Doe',
96+ // 'companyName' => 'example-spa',
97+ // ]);
98+
99+ // $data->sender = $sender;
100+ // $data->recipient = $recipient;
88101
89- $ raccomandata ->creaRaccomandataByData ();
102+ // $raccomandata->creaRaccomandataByData($data);
103+ // }
104+
105+ // public function testSms() {
106+ // $singleSms = $this->openapi->SMS->sendOne('prova', '3939989741', 'messaggio di prova', null, 1, null, true);
107+ // $this->assertIsArray($singleSms);
108+ // var_dump($singleSms);
109+ // }
110+
111+ // public function testVisura() {
112+ // // $visura = new VisRequest('eccbc87e4b5ce2fe28308fd9f2a7baf3');
113+ // $response = $this->openapi->visengine->getRequestByIdVisura('eccbc87e4b5ce2fe28308fd9f2a7baf3');
114+ // $this->assertNotEmpty($response);
115+ // var_dump($response);
116+ // }
117+
118+ public function testFirmaDigitale () {
119+ $ data = json_decode (file_get_contents (__DIR__ .'/esempio_firma.json ' ), true );
120+ $ data ['codice_prodotto ' ] = 'FIR ' ;
121+ $ response = $ this ->openapi ->firmaDigitale ->requestProduct ($ data );
122+ $ this ->assertNotEmpty ($ response );
90123 }
91124}
0 commit comments