Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Descrizione

Questo metodo può essere utilizzato aggiungere un'aliquota d'imposta all'interno del sistema.

Utilizzo

I parametri richiesti da questa funzione sono:

  • 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.

In caso di successo ritorna un'intero che rappresenta l'id del'aliquota d'imposta.

Gestione errori

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

  • ERROR_INVALID_PARAMS: Uno dei parametri inviati 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.

 

Code Block
languagephp
titlePHP
linenumberstrue
require "vendor/autoload.php"
 
try {
    $ezPrintSDK = new ezPrintSDKWrapper('http://demo.ezprint.it');
	$apiToken = $ezPrintSDK->cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 
	$geographicalZones = $ezPrintSDK->backOffice->bGetGeographicalZones();
	$availableLanguages = $ezPrintSDK->backOffice->bGetAvailableLanguages();
    $customerGroups = $ezPrintSDK->backOffice->bGetCustomerGroups(false, $availableLanguages[0]['languageId']);
 
	$taxRateId = $ezPrintSDK->backOffice->bAddTaxRate("Test", 20, "P", $geographicalZones[0]['geoZoneId'], false, [$customerGroups[0]['customerGroupId']]);
} catch (Exception $e) {
    echo 'Error Code: ',  $e->getMessage();
}

Code Block
languagejs
titleNode.js
linenumberstrue
try {
	var util = require('util');
	var ezPrintSDK = require('ezprint-sdk-wrapper');
	ezPrintSDK.initializeWrapper('http://demo.ezprint.it');
 
    var apiToken = ezPrintSDK.cLoginAPI('1WHm0icsupAEm9fil9en','yCHZ0nKiyn1MU0DhpgmG');
 	
	var geographicalZones = ezPrintSDK.backOffice.bGetGeographicalZones();
	var availableLanguages = ezPrintSDK.backOffice.bGetAvailableLanguages();
    var customerGroups = ezPrintSDK.backOffice.bGetCustomerGroups(false, availableLanguages[0].languageId);
	var taxRateId = ezPrintSDK.backOffice.bAddTaxRate("Test", 20, "P", geographicalZones[0].geoZoneId, false, [customerGroups[0].customerGroupId]);
} catch (ex) {
	console.log(ex);
}
Code Block
languagec#
title.NET (C#)
linenumberstrue
try {
	ezPrintSDKWrapper.Client ezPrintSDK = new ezPrintSDKWrapper.Client("http://demo.ezprint.it");
	ezPrintSDK.cLoginAPI("1WHm0icsupAEm9fil9en","yCHZ0nKiyn1MU0DhpgmG");
	List<ezPrintSDKWrapper.Structures.geographicalZoneItem> geographicalZones = ezPrintSDK.BackOffice.bGetGeographicalZones();
	List<ezPrintSDKWrapper.Structures.languageItem> availableLanguages = ezPrintSDK.BackOffice.bGetAvailableLanguages();
    List<ezPrintSDKWrapper.Structures.customerGroupItem> customerGroups = ezPrintSDK.BackOffice.bGetCustomerGroups(false, availableLanguages[0].languageId);
 
	integer taxRateId = ezPrintSDK.backOffice.bAddTaxRate("Test", 20, "P", geographicalZones[0].geoZoneId, false, new int[] {customerGroups[0].customerGroupId]});
} catch (ezPrintException ex) {
	string ErrorMessage = ex.Message;
}