Search in sources :

Example 6 with PersistableMerchantStore

use of com.salesmanager.shop.model.store.PersistableMerchantStore in project shopizer by shopizer-ecommerce.

the class MerchantStoreApiIntegrationTest method testCreateStore.

/**
 * Create a new store then delete it
 * @throws Exception
 */
@Test
public void testCreateStore() throws Exception {
    PersistableAddress address = new PersistableAddress();
    address.setAddress("121212 simple address");
    address.setPostalCode("12345");
    address.setCountry("US");
    address.setCity("FT LD");
    address.setStateProvince("FL");
    PersistableMerchantStore createdStore = new PersistableMerchantStore();
    createdStore.setCode(TEST_STORE_CODE);
    createdStore.setCurrency(CURRENCY);
    createdStore.setDefaultLanguage(DEFAULT_LANGUAGE);
    createdStore.setEmail("test@test.com");
    createdStore.setName(TEST_STORE_CODE);
    createdStore.setPhone("444-555-6666");
    createdStore.setSupportedLanguages(Arrays.asList(DEFAULT_LANGUAGE));
    createdStore.setAddress(address);
    final HttpEntity<PersistableMerchantStore> httpEntity = new HttpEntity<PersistableMerchantStore>(createdStore, getHeader());
    ResponseEntity<Void> response = testRestTemplate.exchange(String.format("/api/v1/private/store/"), HttpMethod.POST, httpEntity, Void.class);
    assertThat(response.getStatusCode(), is(HttpStatus.OK));
}
Also used : HttpEntity(org.springframework.http.HttpEntity) PersistableAddress(com.salesmanager.shop.model.references.PersistableAddress) PersistableMerchantStore(com.salesmanager.shop.model.store.PersistableMerchantStore) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

PersistableMerchantStore (com.salesmanager.shop.model.store.PersistableMerchantStore)6 MerchantStore (com.salesmanager.core.model.merchant.MerchantStore)5 ReadableMerchantStore (com.salesmanager.shop.model.store.ReadableMerchantStore)4 ConversionException (com.salesmanager.core.business.exception.ConversionException)3 PersistableAddress (com.salesmanager.shop.model.references.PersistableAddress)2 ConversionRuntimeException (com.salesmanager.shop.store.api.exception.ConversionRuntimeException)2 ServiceException (com.salesmanager.core.business.exception.ServiceException)1 Country (com.salesmanager.core.model.reference.country.Country)1 Currency (com.salesmanager.core.model.reference.currency.Currency)1 Language (com.salesmanager.core.model.reference.language.Language)1 Zone (com.salesmanager.core.model.reference.zone.Zone)1 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)1 Date (java.util.Date)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 HttpEntity (org.springframework.http.HttpEntity)1