Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Descrizione

Questo metodo può essere utilizzato per ottenere la lista delle aliquote d'imposta presenti all'interno del sistema.

Utilizzo

I parametri richiesti da questa funzione sono:

  • taxRateId: Id dell'aliquota di imposta di cui si vogliono ottenere informazioni, se impostato a false verranno ritornati tutte le aliquote d'imposta presenti.

 In caso di successo ritorna un'array di oggetti così strutturati:

  • taxRateId: Id dell'aliquota d'imposta.
  • taxRateName: Nome dell'aliquota d'imposta.
  • taxRateValue: Valore dell'aliquota d'imposta.
  • taxRateType: Tipologia del valore d'imposta (= valore percentuale, F = valore fisso).
  • geographicalZoneId: Id dell'area geografica a cui è associata aliquota d'imposta.
  • isDefault: true se questa è l'aliquota d'imposta di default, false se non lo è.
  • customerGroups: Array di interi che rappresenta la lista dei gruppi utenti a cui è associata l'aliquota d'imposta.
  • dateCreated: Stringa contenente la data in cui è stato creato il task nel formato YYYY-MM-DD HH:MM:SS.
  • dateUpdated: Stringa contenente la data in cui è stato modificato il task nel formato YYYY-MM-DD HH:MM:SS.

 

Gestione errori

In caso di errore il metodo genererà un'eccezione che riporterà uno dei seguenti codici di errore:

  • ERROR_INVALID_TAX_RATE_ID: L'id fornito non è valido.
  • ERROR_INVALID_TOKEN: Non è stato effettuato nessun login in precedenza o la sessione è scaduta per inutilizzo.
  • ERROR_INVALID_IP: L'indirizzo ip del server che sta effettuando la chiamata non valido perchè non inserito nella whitelist associata alle credenziali.
  • ERROR_SERVER_UNAVAILABLE: Il server non è disponibile o si è verificato un errore di comunicazione generico.

 

PHP
require "vendor/autoload.php"
 
try {
    $ezPrintSDK = new ezPrintSDKWrapper('http://demo.ezprint.it');
	$apiToken = $ezPrintSDK->cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 
	$taxRates = $ezPrintSDK->backOffice->bGetTaxRates(false);
	
	foreach($taxRates as $taxRate) {
        echo $taxRate['taxRateId'], ' ', $taxRate['taxRateName'];
    }
} catch (Exception $e) {
    echo 'Error Code: ',  $e->getMessage();
}

Node.js
try {
	var util = require('util');
	var ezPrintSDK = require('ezprint-sdk-wrapper');
	ezPrintSDK.initializeWrapper('http://demo.ezprint.it');
 
    var apiToken = ezPrintSDK.cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 
	var taxRates = ezPrintSDK.backOffice.bGetTaxRates(false);
 
	taxRates.forEach(function(taxRate) {
        console.log(taxRate.taxRateId);
        console.log(taxRate.taxRateName);
    });
} catch (ex) {
	console.log(ex);
}
.NET (C#)
try {
	ezPrintSDKWrapper.Client ezPrintSDK = new ezPrintSDKWrapper.Client("http://demo.ezprint.it");
	ezPrintSDK.cLoginAPI("1WHm0icsupAEm9fil9en","yCHZ0nKiyn1MU0DhpgmG");
	List<ezPrintSDKWrapper.Structures.taxRateItem> taxRates = ezPrintSDK.BackOffice.bGetTaxRates(false);
 
	System.Console.WriteLine("Tax Rate {0}: {1}", taxRates[0].taxRateId, taxRates[0].taxRateName);
} catch (ezPrintException ex) {
	string ErrorMessage = ex.Message;
}
  • No labels