use of com.salesmanager.shop.model.system.PersistableOptin in project shopizer by shopizer-ecommerce.
the class OptinFacadeImpl method create.
@Override
public ReadableOptin create(PersistableOptin persistableOptin, MerchantStore merchantStore, Language language) {
Optin optinEntity = persistableOptinConverter.convert(persistableOptin, merchantStore, language);
Optin savedOptinEntity = createOptin(optinEntity);
return readableOptinConverter.convert(savedOptinEntity, merchantStore, language);
}
use of com.salesmanager.shop.model.system.PersistableOptin in project shopizer by shopizer-ecommerce.
the class PersistableOptinMapper method convert.
@Override
public Optin convert(PersistableOptin source, MerchantStore store, Language language) {
Optin optinEntity = new Optin();
optinEntity.setCode(source.getCode());
optinEntity.setDescription(source.getDescription());
optinEntity.setOptinType(OptinType.valueOf(source.getOptinType()));
optinEntity.setMerchant(store);
return optinEntity;
}
use of com.salesmanager.shop.model.system.PersistableOptin in project shopizer by shopizer-ecommerce.
the class OptinApiIntegrationTest method createOptin.
@Test
public void createOptin() throws Exception {
PersistableOptin optin = new PersistableOptin();
optin.setCode(OptinType.PROMOTIONS.name());
optin.setOptinType(OptinType.PROMOTIONS.name());
final ObjectWriter writer = new ObjectMapper().writer().withDefaultPrettyPrinter();
final String json = writer.writeValueAsString(optin);
final HttpEntity<String> entity = new HttpEntity<>(json, getHeader());
final ResponseEntity<PersistableOptin> response = testRestTemplate.postForEntity("/api/v1/private/optin", entity, PersistableOptin.class);
if (response.getStatusCode() != HttpStatus.OK) {
throw new Exception(response.toString());
} else {
assertTrue(true);
}
}
Aggregations