@@ -39,6 +39,14 @@ const scopes = [
3939// expect(typeof token === 'string').toBeTruthy()
4040// })
4141
42+ test ( 'initWithString' , async function ( ) {
43+
44+ let client = await OpenApi . init ( 'production' , process . env . OPENAPI_USERNAME , process . env . API_KEY ) ;
45+ const token = await client . generateToken ( 'imprese.altravia.com' ) ;
46+ expect ( typeof token === 'string' ) . toBeTruthy ( )
47+ console . log ( client . scopes ) ;
48+ } )
49+
4250// test('initWithToken', async function() {
4351// let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
4452// expect(client.comuni).toBeDefined();
@@ -71,109 +79,109 @@ const scopes = [
7179// expect(codice[0].regione).toBeDefined();
7280// })
7381
74- test ( 'testComuni' , async function ( ) {
75- const token = process . env . TOKEN ;
76- expect ( typeof token === 'string' ) . toBe ( true ) ;
82+ // test('testComuni', async function() {
83+ // const token = process.env.TOKEN;
84+ // expect(typeof token === 'string').toBe(true);
7785
78- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , token ) ;
86+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, token);
7987
8088
81- const cap = await client . comuni . getCitiesByCap ( '00121' )
82- expect ( cap [ 0 ] . regione ) . toBe ( 'Lazio' ) ;
89+ // const cap = await client.comuni.getCitiesByCap('00121')
90+ // expect(cap[0].regione).toBe('Lazio');
8391
84- const province = await client . comuni . listProvince ( ) ;
85- expect ( province . MI ) . toBeDefined ( ) ;
92+ // const province = await client.comuni.listProvince();
93+ // expect(province.MI).toBeDefined();
8694
87- const comuni = await client . comuni . listComuni ( 'MI' ) ;
88- expect ( comuni [ 0 ] ) . toBeDefined ( ) ;
95+ // const comuni = await client.comuni.listComuni('MI');
96+ // expect(comuni[0]).toBeDefined();
8997
90- const istat = await client . comuni . getFromIstatCode ( '055032' ) ;
91- expect ( istat ) . toBeDefined ( ) ;
98+ // const istat = await client.comuni.getFromIstatCode('055032');
99+ // expect(istat).toBeDefined();
92100
93- console . log ( cap , province , comuni ) ;
94- } )
101+ // console.log(cap, province, comuni);
102+ // })
95103
96- test ( 'testImprese' , async function ( ) {
97- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
104+ // test('testImprese', async function() {
105+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
98106
99- const piva = await client . imprese . getByPartitaIva ( '12485671007' )
100- expect ( piva ) . toBeDefined ( ) ;
101- console . log ( piva ) ;
107+ // const piva = await client.imprese.getByPartitaIva('12485671007')
108+ // expect(piva).toBeDefined();
109+ // console.log(piva);
102110
103- const pivaAvd = await client . imprese . getAdvancedByPartitaIva ( '12485671007' )
104- expect ( pivaAvd ) . toBeDefined ( ) ;
105- const pec = await client . imprese . getPec ( '12485671007' )
106- expect ( pec ) . toBeDefined ( ) ;
107- console . log ( pec ) ;
111+ // const pivaAvd = await client.imprese.getAdvancedByPartitaIva('12485671007')
112+ // expect(pivaAvd).toBeDefined();
113+ // const pec = await client.imprese.getPec('12485671007')
114+ // expect(pec).toBeDefined();
115+ // console.log(pec);
108116
109- const imprese = await client . imprese . search ( { provincia : 'RM' } )
117+ // const imprese = await client.imprese.search({ provincia: 'RM' })
110118
111- expect ( imprese ) . toBeDefined ( ) ;
112- console . log ( imprese ) ;
113- } )
119+ // expect(imprese).toBeDefined();
120+ // console.log(imprese);
121+ // })
114122
115- test ( 'testPa' , async function ( ) {
116- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
117- client . generateToken ( scopes )
118- const piva = await client . pa . findPa ( '00559720982' )
119- expect ( piva ) . toBeDefined ( ) ;
120- } )
121- test ( 'testFD' , async function ( ) {
122- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
123- const prodotti = await client . firmaDigitale . getProducts ( ) ;
124- expect ( prodotti ) . toBeDefined ( ) ;
123+ // test('testPa', async function() {
124+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
125+ // client.generateToken(scopes)
126+ // const piva = await client.pa.findPa('00559720982')
127+ // expect(piva).toBeDefined();
128+ // })
129+ // test('testFD', async function() {
130+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
131+ // const prodotti = await client.firmaDigitale.getProducts();
132+ // expect(prodotti).toBeDefined();
125133
126- const richiesta = await client . firmaDigitale . requestProduct ( 'RINFIR' , { } )
127- expect ( richiesta . id ) . toBeDefined ( )
134+ // const richiesta = await client.firmaDigitale.requestProduct('RINFIR', {})
135+ // expect(richiesta.id).toBeDefined()
128136
129- const infoRichiesta = await client . firmaDigitale . getRequest ( richiesta . id )
130- expect ( infoRichiesta ) . toBeDefined ( )
131- console . log ( infoRichiesta ) ;
132- } )
137+ // const infoRichiesta = await client.firmaDigitale.getRequest(richiesta.id)
138+ // expect(infoRichiesta).toBeDefined()
139+ // console.log(infoRichiesta);
140+ // })
133141
134- test ( 'testMT' , async function ( ) {
135- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
136- const lotto = await client . marcheTemporali . checkLotto ( 'FAKETSA.altravia16' , 'FAKE9R155S9VF' ) ;
137- expect ( lotto . used ) . toBeDefined ( )
138- } )
142+ // test('testMT', async function() {
143+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
144+ // const lotto = await client.marcheTemporali.checkLotto('FAKETSA.altravia16', 'FAKE9R155S9VF');
145+ // expect(lotto.used).toBeDefined()
146+ // })
139147
140- test ( 'testValutometro' , async function ( ) {
141- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
142- const p = await client . valutometro . listPropertyTypes ( )
143- expect ( p [ 0 ] ) . toBeDefined ( )
148+ // test('testValutometro', async function() {
149+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
150+ // const p = await client.valutometro.listPropertyTypes()
151+ // expect(p[0]).toBeDefined()
144152
145- const c = await client . valutometro . listContractTypes ( )
146- expect ( c [ 0 ] ) . toBeDefined ( )
153+ // const c = await client.valutometro.listContractTypes()
154+ // expect(c[0]).toBeDefined()
147155
148- const q = await client . valutometro . quote ( 'via del rivo 10 Terni' , '20' , 'sale' )
149- expect ( q ) . toBeDefined ( )
150- console . log ( q ) ;
151- } )
156+ // const q = await client.valutometro.quote('via del rivo 10 Terni', '20', 'sale')
157+ // expect(q).toBeDefined()
158+ // console.log(q);
159+ // })
152160
153- test ( 'testVisengine' , async function ( ) {
154- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
155- const s = await client . visengine . listServices ( )
156- expect ( s [ 0 ] ) . toBeDefined ( )
157-
158- const visuraDescription = await client . visengine . getServiceDescription ( s [ 0 ] . hash_visura )
159- console . log ( JSON . stringify ( visuraDescription , null , 2 ) ) ;
160-
161- const json_visura = { '$0' : 'test' , '$1' : 'lorem ipsum' }
162- const callback = {
163- url : 'enpoint.example.com' ,
164- method : 'POST' ,
165- field : 'data' ,
166- }
167- const visura = await client . visengine . createRequest ( s [ 0 ] . hash_visura , json_visura , { } , callback , null , 'close' , true ) ;
168- console . log ( visura ) ;
169- } )
161+ // test('testVisengine', async function() {
162+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
163+ // const s = await client.visengine.listServices()
164+ // expect(s[0]).toBeDefined()
165+
166+ // const visuraDescription = await client.visengine.getServiceDescription(s[0].hash_visura)
167+ // console.log(JSON.stringify(visuraDescription, null, 2));
168+
169+ // const json_visura = {'$0': 'test', '$1': 'lorem ipsum'}
170+ // const callback = {
171+ // url: 'enpoint.example.com',
172+ // method: 'POST',
173+ // field: 'data',
174+ // }
175+ // const visura = await client.visengine.createRequest(s[0].hash_visura, json_visura, {}, callback,null, 'close', true);
176+ // console.log(visura);
177+ // })
170178
171179
172- test ( 'testsms' , async function ( ) {
173- let client = await OpenApi . init ( 'test' , process . env . OPENAPI_USERNAME , process . env . API_KEY , process . env . TOKEN ) ;
174- // const list = await client.sms.getMessages()
175- // console.log(list);
176- const sms = await client . sms . send ( 'test' , 'Test sms' , [ '+39-3939989741' ] , 0 , { } , true )
177- expect ( sms ) . toBeDefined ( )
178- console . log ( JSON . stringify ( sms , null , 2 ) ) ;
179- } )
180+ // test('testsms', async function() {
181+ // let client = await OpenApi.init('test', process.env.OPENAPI_USERNAME, process.env.API_KEY, process.env.TOKEN);
182+ // // const list = await client.sms.getMessages()
183+ // // console.log(list);
184+ // const sms = await client.sms.send('test', 'Test sms', ['+39-3939989741'], 0, {}, true)
185+ // expect(sms).toBeDefined()
186+ // console.log(JSON.stringify(sms, null, 2));
187+ // })
0 commit comments