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

« Previous Version 3 Current »

Descrizione

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

Utilizzo

I parametri richiesti da questa funzione sono:

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

 Il metodo non ha nessun valore di ritorno.

Gestione errori

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

  • ERROR_INVALID_TAX_RATE_ID: Id dell'aliquota d'imposta non valido.
  • 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.

 

PHP
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']);
	$taxRates = $ezPrintSDK->backOffice->bGetTaxRates(false);
 
	$ezPrintSDK->backOffice->bEditTaxRate($taxRates[0]["taxRateId"], "New Tax Name", 20, "P", $geographicalZones[0]['geoZoneId'], false, [$customerGroups[0]['customerGroupId']]);
} 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 geographicalZones = ezPrintSDK.backOffice.bGetGeographicalZones();
	var availableLanguages = ezPrintSDK.backOffice.bGetAvailableLanguages();
    var customerGroups = ezPrintSDK.backOffice.bGetCustomerGroups(false, availableLanguages[0].languageId);
	var taxRates = ezPrintSDK.backOffice.bGetTaxRates(false);
 
	ezPrintSDK.backOffice.bEditTaxRate(taxRates[0].taxRateId, "New Tax Name", 20, "P", geographicalZones[0].geoZoneId, false, [customerGroups[0].customerGroupId]);
} 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.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);
	List<ezPrintSDKWrapper.Structures.taxRateItem> taxRates = ezPrintSDK.BackOffice.bGetTaxRates(false);
 
	ezPrintSDK.backOffice.bEditTaxRate(taxRates[0].taxRateId, "New Tax Name", 20, ezPrintSDKWrapper.Structures.taxRateType.typePercentage, geographicalZones[0].geoZoneId, false, new int[] {customerGroups[0].customerGroupId});
} catch (ezPrintException ex) {
	string ErrorMessage = ex.Message;
}
  • No labels