You are viewing an old version of this content. View the current version.
Compare with Current
View Version History
« Previous
Version 5
Next »
Wrapper for the '/sales' API. Please note that the Sales service might not be present in all servers.
List of all options:
Initialize service
TrivoreID sdk = TrivoreID.mgmtApiClient();
SalesServiceImpl salesService = new SalesServiceImpl(sdk.salesService());
|
Catalog management
// get page with first five catalogs with the ownerId '1234'
Filter filter = Filter.equal("ownedId", "1234");
Page<Catalog> page = salesService.getAllCatalogs(new Criteria(filter, 0, 5));
// create new catalog
Catalog catalog = new Catalog();
catalog.setOwnerId("1234");
catalog.setName("Example Catalog");
// the function returns catalog object with the generated id
catalog = salesService.createCatalog(catalog);
// update catalog
catalog.getCustomFields().put("key1", "value");
catalog.getCustomFields().put("key2", 2);
catalog = salesService.updateCatalog(catalog);
// get catalog
catalog = salesService.getCatalog(catalog.getId());
// delete catalog
salesService.deleteCatalog(catalog.getId());
|
Pricing plan management
// get page with first five pricing plans that are enabled
Filter filter = Filter.equal("enabled", true);
Page<PricingPlan> page = salesService.getAllPricingPlans(new Criteria(filter, 0, 5));
// create new pricing plan
PricingPlan pricingPlan = new PricingPlan();
pricingPlan.setOwnerId("1234");
pricingPlan.setTitle("Example Title");
// the function returns pricing plan object with the generated id
pricingPlan = salesService.createPricingPlan(pricingPlan);
// update pricing plan
pricingPlan.getCustomFields().put("key1", "value");
pricingPlan.getCustomFields().put("key2", 2);
pricingPlan = salesService.updatePricingPlan(pricingPlan);
// get pricing plan
pricingPlan = salesService.getPricingPlan(pricingPlan.getId());
// delete pricing plan
salesService.deletePricingPlan(pricingPlan.getId());
|
Product management
// get page with first five products with the ownerId '1234'
Filter filter = Filter.equal("enabled", true);
Page<Product> page = salesService.getAllProducts(new Criteria(filter, 0, 5));
// create new product
Product product = new Product();
product.setOwnerId("1234");
product.setSku("C12");
// the function returns product object with the generated id
product = salesService.createProduct(product);
// update product
product.getCustomFields().put("key1", "value");
product.getCustomFields().put("key2", 2);
product = salesService.updateProduct(product);
// get product
product = salesService.getProduct(product.getId());
// delete product
salesService.deleteProduct(product.getId());
|
Service models
Catalog
CatalogItem
LocalisedDescription
PricingPlan
Pricing
CodeDiscount
CustomerSegementDiscount
PaymentMethodDiscount
VariableDiscount
VolumeDiscount
Product
Validity