use of com.salesmanager.shop.model.entity.Entity in project shopizer by shopizer-ecommerce.
the class ProductApiV2 method createV2.
/**
* ------------ V2
*
* --- product definition
*/
@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = { "/private/product/definition" })
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
@ResponseBody
public Entity createV2(@Valid @RequestBody PersistableProductDefinition product, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) {
// make sure product id is null
product.setId(null);
Long id = productDefinitionFacade.saveProductDefinition(merchantStore, product, language);
Entity returnEntity = new Entity();
returnEntity.setId(id);
return returnEntity;
}
use of com.salesmanager.shop.model.entity.Entity in project shopizer by shopizer-ecommerce.
the class TaxRateIntegrationTest method manageTaxClass.
@Test
public void manageTaxClass() throws Exception {
// create tax class
PersistableTaxClass taxClass = new PersistableTaxClass();
taxClass.setCode("TESTTX");
taxClass.setName("Test tax class");
final HttpEntity<PersistableTaxClass> taxClassEntity = new HttpEntity<>(taxClass, getHeader());
final ResponseEntity<Entity> response = testRestTemplate.postForEntity(String.format("/api/v1/private/tax/class/"), taxClassEntity, Entity.class);
Entity e = response.getBody();
assertNotNull(e.getId());
assertTrue(e.getId() > 0);
final HttpEntity<String> httpEntity = new HttpEntity<>(getHeader());
// tax class exists
final ResponseEntity<EntityExists> exists = testRestTemplate.exchange(String.format("/api/v1/private/tax/class/unique?code=" + taxClass.getCode()), HttpMethod.GET, httpEntity, EntityExists.class);
assertTrue(exists.getBody().isExists());
/**
* //list 1 taxClass
* @SuppressWarnings("rawtypes")
* final ResponseEntity<ReadableEntityList> listOfTaxClasses = testRestTemplate.exchange(String.format("/private/tax/class"), HttpMethod.GET,
* httpEntity, ReadableEntityList.class);
*
* assertTrue(listOfTaxClasses.getBody().getRecordsTotal() == 1);
*/
}
use of com.salesmanager.shop.model.entity.Entity in project shopizer by shopizer-ecommerce.
the class ContentApi method createPage.
/**
* Create content page
* @param page
* @param merchantStore
* @param language
*/
@PostMapping(value = "/private/content/page")
@ResponseStatus(HttpStatus.CREATED)
@ApiOperation(httpMethod = "POST", value = "Create content page", notes = "", response = Entity.class)
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
public Entity createPage(@RequestBody @Valid PersistableContentPage page, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) {
Long id = contentFacade.saveContentPage(page, merchantStore, language);
Entity entity = new Entity();
entity.setId(id);
return entity;
}
use of com.salesmanager.shop.model.entity.Entity in project shopizer by shopizer-ecommerce.
the class ContentApi method createBox.
/**
* Create content box
*
* @param page
* @param merchantStore
* @param language
* @param pageCode
*/
@PostMapping(value = "/private/content/box")
@ResponseStatus(HttpStatus.CREATED)
@ApiOperation(httpMethod = "POST", value = "Create content box", notes = "", response = Entity.class)
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
public Entity createBox(@RequestBody @Valid PersistableContentBox box, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) {
Long id = contentFacade.saveContentBox(box, merchantStore, language);
Entity entity = new Entity();
entity.setId(id);
return entity;
}
use of com.salesmanager.shop.model.entity.Entity in project shopizer by shopizer-ecommerce.
the class ProductApi method createV2.
/**
* ------------ V2
*
* --- product definition
*/
@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = { "/v2/private/product/definition" })
@ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })
@ResponseBody
public Entity createV2(@Valid @RequestBody PersistableProductDefinition product, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) {
// make sure product id is null
product.setId(null);
Long id = productDefinitionFacade.saveProductDefinition(merchantStore, product, language);
Entity returnEntity = new Entity();
returnEntity.setId(id);
return returnEntity;
}
Aggregations