From 46f53f708348a7c2fc3db01dc218d595ae5fcc62 Mon Sep 17 00:00:00 2001 From: spec-agent-generator Date: Wed, 18 Nov 2026 21:50:15 +0000 Subject: [PATCH] auto-gen: SDK changes --- .../mercadopago/client/store/StoreClient.java | 236 ++++++++++++++++++ .../client/store/StoreCreateRequest.java | 117 +++++++++ .../client/store/StoreUpdateRequest.java | 31 +++ .../mercadopago/resources/store/Store.java | 132 ++++++++++ .../client/store/StoreClientTest.java | 206 +++++++++++++++ .../mocks/request/store/store_base.json | 20 ++ .../mocks/request/store/store_update.json | 65 +++++ .../mocks/response/store/store_all.json | 103 ++++++++ .../mocks/response/store/store_base.json | 26 ++ 9 files changed, 936 insertions(+) create mode 100644 src/main/java/com/mercadopago/client/store/StoreClient.java create mode 100644 src/main/java/com/mercadopago/client/store/StoreCreateRequest.java create mode 100644 src/main/java/com/mercadopago/client/store/StoreUpdateRequest.java create mode 100644 src/main/java/com/mercadopago/resources/store/Store.java create mode 100644 src/test/java/com/mercadopago/client/store/StoreClientTest.java create mode 100644 src/test/java/com/mercadopago/resources/mocks/request/store/store_base.json create mode 100644 src/test/java/com/mercadopago/resources/mocks/request/store/store_update.json create mode 100644 src/test/java/com/mercadopago/resources/mocks/response/store/store_all.json create mode 100644 src/test/java/com/mercadopago/resources/mocks/response/store/store_base.json diff --git a/src/main/java/com/mercadopago/client/store/StoreClient.java b/src/main/java/com/mercadopago/client/store/StoreClient.java new file mode 100644 index 00000000..5256f896 --- /dev/null +++ b/src/main/java/com/mercadopago/client/store/StoreClient.java @@ -0,0 +1,236 @@ +package com.mercadopago.client.store; + +import static com.mercadopago.MercadoPagoConfig.getStreamHandler; + +import com.google.gson.JsonObject; +import com.mercadopago.MercadoPagoConfig; +import com.mercadopago.client.MercadoPagoClient; +import com.mercadopago.core.MPRequestOptions; +import com.mercadopago.exceptions.MPApiException; +import com.mercadopago.exceptions.MPException; +import com.mercadopago.net.HttpMethod; +import com.mercadopago.net.MPHttpClient; +import com.mercadopago.net.MPResponse; +import com.mercadopago.net.MPSearchRequest; +import com.mercadopago.resources.store.Store; +import com.mercadopago.serialization.Serializer; +import java.util.Map; +import java.util.logging.Logger; +import java.util.logging.StreamHandler; + +/** + * Client for the MercadoPago Stores API. + * + *

Supports creating, retrieving, searching, updating and deleting stores associated with a + * seller user: + *

+ */ +public class StoreClient extends MercadoPagoClient { + + /** Class-level logger for store operations. */ + private static final Logger LOGGER = Logger.getLogger(StoreClient.class.getName()); + + /** Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}. */ + public StoreClient() { + this(MercadoPagoConfig.getHttpClient()); + } + + /** + * Constructs a {@code StoreClient} with a custom HTTP client. + * + * @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests + */ + public StoreClient(MPHttpClient httpClient) { + super(httpClient); + StreamHandler streamHandler = getStreamHandler(); + streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel()); + LOGGER.addHandler(streamHandler); + LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel()); + } + + /** + * Creates a store for the given user. + * + * @param userId identifier of the user (seller) that will own the store + * @param request the {@link StoreCreateRequest} with the store details + * @return the created {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store createStore(Long userId, StoreCreateRequest request) + throws MPException, MPApiException { + return this.createStore(userId, request, null); + } + + /** + * Creates a store for the given user with custom request options. + * + * @param userId identifier of the user (seller) that will own the store + * @param request the {@link StoreCreateRequest} with the store details + * @param requestOptions optional {@link MPRequestOptions}; may be {@code null} + * @return the created {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store createStore(Long userId, StoreCreateRequest request, MPRequestOptions requestOptions) + throws MPException, MPApiException { + LOGGER.info("Sending create store request"); + MPResponse response = + send( + String.format("/users/%s/stores", encodePathParam(userId)), + HttpMethod.POST, + Serializer.serializeToJson(request), + null, + requestOptions); + Store store = Serializer.deserializeFromJson(Store.class, response.getContent()); + store.setResponse(response); + return store; + } + + /** + * Retrieves a store by its identifier. + * + * @param id identifier of the store + * @return the {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store getStore(Long id) throws MPException, MPApiException { + return this.getStore(id, null); + } + + /** + * Retrieves a store by its identifier with custom request options. + * + * @param id identifier of the store + * @param requestOptions optional {@link MPRequestOptions}; may be {@code null} + * @return the {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store getStore(Long id, MPRequestOptions requestOptions) + throws MPException, MPApiException { + LOGGER.info("Sending get store request"); + MPResponse response = + send(String.format("/stores/%s", encodePathParam(id)), HttpMethod.GET, null, null, requestOptions); + Store store = Serializer.deserializeFromJson(Store.class, response.getContent()); + store.setResponse(response); + return store; + } + + /** + * Searches stores of the given user. + * + * @param userId identifier of the user (seller) + * @param searchRequest the {@link MPSearchRequest} with filters and pagination, or {@code null} + * @return the {@link MPResponse} with the search results + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public MPResponse searchStores(Long userId, MPSearchRequest searchRequest) + throws MPException, MPApiException { + return this.searchStores(userId, searchRequest, null); + } + + /** + * Searches stores of the given user with custom request options. + * + * @param userId identifier of the user (seller) + * @param searchRequest the {@link MPSearchRequest} with filters and pagination, or {@code null} + * @param requestOptions optional {@link MPRequestOptions}; may be {@code null} + * @return the {@link MPResponse} with the search results + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public MPResponse searchStores( + Long userId, MPSearchRequest searchRequest, MPRequestOptions requestOptions) + throws MPException, MPApiException { + LOGGER.info("Sending search stores request"); + return search( + String.format("/users/%s/stores/search", encodePathParam(userId)), + searchRequest, + requestOptions); + } + + /** + * Updates a store of the given user. + * + * @param userId identifier of the user (seller) that owns the store + * @param storeId identifier of the store to update + * @param request the {@link StoreUpdateRequest} with the fields to update + * @return the updated {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store updateStore(Long userId, Long storeId, StoreUpdateRequest request) + throws MPException, MPApiException { + return this.updateStore(userId, storeId, request, null); + } + + /** + * Updates a store of the given user with custom request options. + * + * @param userId identifier of the user (seller) that owns the store + * @param storeId identifier of the store to update + * @param request the {@link StoreUpdateRequest} with the fields to update + * @param requestOptions optional {@link MPRequestOptions}; may be {@code null} + * @return the updated {@link Store} + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public Store updateStore( + Long userId, Long storeId, StoreUpdateRequest request, MPRequestOptions requestOptions) + throws MPException, MPApiException { + LOGGER.info("Sending update store request"); + MPResponse response = + send( + String.format("/users/%s/stores/%s", encodePathParam(userId), encodePathParam(storeId)), + HttpMethod.PUT, + Serializer.serializeToJson(request), + null, + requestOptions); + Store store = Serializer.deserializeFromJson(Store.class, response.getContent()); + store.setResponse(response); + return store; + } + + /** + * Deletes a store of the given user. + * + * @param userId identifier of the user (seller) that owns the store + * @param storeId identifier of the store to delete + * @return the {@link MPResponse} returned by the API + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public MPResponse deleteStore(Long userId, Long storeId) throws MPException, MPApiException { + return this.deleteStore(userId, storeId, null); + } + + /** + * Deletes a store of the given user with custom request options. + * + * @param userId identifier of the user (seller) that owns the store + * @param storeId identifier of the store to delete + * @param requestOptions optional {@link MPRequestOptions}; may be {@code null} + * @return the {@link MPResponse} returned by the API + * @throws MPException if a transport-level or SDK-internal error occurs + * @throws MPApiException if the API returns a non-successful HTTP status code + */ + public MPResponse deleteStore(Long userId, Long storeId, MPRequestOptions requestOptions) + throws MPException, MPApiException { + LOGGER.info("Sending delete store request"); + return send( + String.format("/users/%s/stores/%s", encodePathParam(userId), encodePathParam(storeId)), + HttpMethod.DELETE, + (JsonObject) null, + (Map) null, + requestOptions); + } +} diff --git a/src/main/java/com/mercadopago/client/store/StoreCreateRequest.java b/src/main/java/com/mercadopago/client/store/StoreCreateRequest.java new file mode 100644 index 00000000..cdb0b7fc --- /dev/null +++ b/src/main/java/com/mercadopago/client/store/StoreCreateRequest.java @@ -0,0 +1,117 @@ +package com.mercadopago.client.store; + +import lombok.Builder; +import lombok.Getter; + +/** + * Request payload for creating a store through the Stores API. + * + * @see StoreClient#createStore(Long, StoreCreateRequest) + */ +@Builder +@Getter +public class StoreCreateRequest { + + /** Name of the store. */ + private String name; + + /** External identifier of the store, as provided by the integrator. */ + private String externalId; + + /** Location details of the store. */ + private Location location; + + /** Business hours of the store, grouped by day of the week. */ + private BusinessHours businessHours; + + /** Location details of a store. */ + @Getter + public static class Location { + + /** Address line of the store. */ + private String addressLine; + + /** Street name of the store address. */ + private String streetName; + + /** Street number of the store address. */ + private String streetNumber; + + /** Zip code of the store address. */ + private String zipCode; + + /** City of the store. */ + private City city; + + /** State of the store. */ + private State state; + + /** Reference information for the store location. */ + private String reference; + + /** Latitude of the store location. */ + private Double latitude; + + /** Longitude of the store location. */ + private Double longitude; + } + + /** City of a store location. */ + @Getter + public static class City { + + /** Identifier of the city. */ + private String id; + + /** Name of the city. */ + private String name; + } + + /** State of a store location. */ + @Getter + public static class State { + + /** Identifier of the state. */ + private String id; + + /** Name of the state. */ + private String name; + } + + /** Business hours of a store, grouped by day of the week. */ + @Getter + public static class BusinessHours { + + /** Business hours for Monday. */ + private DayHours monday; + + /** Business hours for Tuesday. */ + private DayHours tuesday; + + /** Business hours for Wednesday. */ + private DayHours wednesday; + + /** Business hours for Thursday. */ + private DayHours thursday; + + /** Business hours for Friday. */ + private DayHours friday; + + /** Business hours for Saturday. */ + private DayHours saturday; + + /** Business hours for Sunday. */ + private DayHours sunday; + } + + /** Opening and closing hours for a single day. */ + @Getter + public static class DayHours { + + /** Opening time (e.g. "08:00"). */ + private String open; + + /** Closing time (e.g. "18:00"). */ + private String close; + } +} diff --git a/src/main/java/com/mercadopago/client/store/StoreUpdateRequest.java b/src/main/java/com/mercadopago/client/store/StoreUpdateRequest.java new file mode 100644 index 00000000..48b99b53 --- /dev/null +++ b/src/main/java/com/mercadopago/client/store/StoreUpdateRequest.java @@ -0,0 +1,31 @@ +package com.mercadopago.client.store; + +import com.google.gson.JsonObject; +import java.io.Serializable; +import lombok.Builder; +import lombok.Getter; + +/** + * Request object for updating an existing store through the Stores API + * ({@code PUT /users/{user_id}/stores/{id}}). + * + *

Only fields evidenced by the Stores specification are modeled. All fields are optional in + * an update request; fields left unset are not sent to the API. The {@code location} and + * {@code business_hours} schemas are not resolved by the specification, so they are kept opaque + * as raw JSON objects. + * + * @see com.mercadopago.client.store.StoreClient + */ +@Getter +@Builder +public class StoreUpdateRequest implements Serializable { + + /** Name of the store. */ + private final String name; + + /** Business hours of the store, kept opaque as a raw JSON object. */ + private final JsonObject businessHours; + + /** Geographic location of the store, kept opaque as a raw JSON object. */ + private final JsonObject location; +} diff --git a/src/main/java/com/mercadopago/resources/store/Store.java b/src/main/java/com/mercadopago/resources/store/Store.java new file mode 100644 index 00000000..028e59b0 --- /dev/null +++ b/src/main/java/com/mercadopago/resources/store/Store.java @@ -0,0 +1,132 @@ +package com.mercadopago.resources.store; + +import com.mercadopago.net.MPResource; +import lombok.Getter; + +/** + * Resource representing a MercadoPago store. + * + *

Stores are physical or logical locations associated with a seller user and are used by + * in-person payment solutions (e.g. Point of Sale devices). This class models only the fields + * returned by the Stores API operations (create, get, search, update and delete). + * + * @see com.mercadopago.client.store.StoreClient + */ +@Getter +public class Store extends MPResource { + + /** Unique numeric identifier of the store. */ + private Long id; + + /** Numeric identifier of the user (seller) that owns the store. */ + private Long userId; + + /** Name of the store. */ + private String name; + + /** External identifier of the store, as provided by the integrator. */ + private String externalId; + + /** Location details of the store (address, city, state, etc.). */ + private Location location; + + /** Business hours of the store, grouped by day of the week. */ + private BusinessHours businessHours; + + /** ISO-8601 creation date of the store. */ + private String dateCreated; + + /** ISO-8601 date of the last update of the store. */ + private String dateUpdated; + + /** Location details of a store. */ + @Getter + public static class Location { + + /** Address line of the store. */ + private String addressLine; + + /** Street name of the store address. */ + private String streetName; + + /** Street number of the store address. */ + private String streetNumber; + + /** Zip code of the store address. */ + private String zipCode; + + /** City of the store. */ + private City city; + + /** State of the store. */ + private State state; + + /** Reference information for the store location. */ + private String reference; + + /** Latitude of the store location. */ + private Double latitude; + + /** Longitude of the store location. */ + private Double longitude; + } + + /** City of a store location. */ + @Getter + public static class City { + + /** Identifier of the city. */ + private String id; + + /** Name of the city. */ + private String name; + } + + /** State of a store location. */ + @Getter + public static class State { + + /** Identifier of the state. */ + private String id; + + /** Name of the state. */ + private String name; + } + + /** Business hours of a store, grouped by day of the week. */ + @Getter + public static class BusinessHours { + + /** Business hours for Monday. */ + private DayHours monday; + + /** Business hours for Tuesday. */ + private DayHours tuesday; + + /** Business hours for Wednesday. */ + private DayHours wednesday; + + /** Business hours for Thursday. */ + private DayHours thursday; + + /** Business hours for Friday. */ + private DayHours friday; + + /** Business hours for Saturday. */ + private DayHours saturday; + + /** Business hours for Sunday. */ + private DayHours sunday; + } + + /** Opening and closing hours for a single day. */ + @Getter + public static class DayHours { + + /** Opening time (e.g. "08:00"). */ + private String open; + + /** Closing time (e.g. "18:00"). */ + private String close; + } +} diff --git a/src/test/java/com/mercadopago/client/store/StoreClientTest.java b/src/test/java/com/mercadopago/client/store/StoreClientTest.java new file mode 100644 index 00000000..15bea5c6 --- /dev/null +++ b/src/test/java/com/mercadopago/client/store/StoreClientTest.java @@ -0,0 +1,206 @@ +package com.mercadopago.client.store; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; + +import com.mercadopago.BaseClientTest; +import com.mercadopago.exceptions.MPApiException; +import com.mercadopago.exceptions.MPException; +import com.mercadopago.helper.MockHelper; +import com.mercadopago.net.HttpStatus; +import com.mercadopago.net.MPSearchRequest; +import com.mercadopago.resources.store.Store; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.apache.http.HttpHeaders; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.protocol.HttpContext; +import org.junit.jupiter.api.Test; + +class StoreClientTest extends BaseClientTest { + + private static final String STORE_BASE_JSON = "/store/store_base.json"; + private static final String STORE_ALL_JSON = "/store/store_all.json"; + + @Test + void createStoreSuccess() throws IOException, MPException, MPApiException { + HttpResponse httpResponse = + MockHelper.generateHttpResponseFromFile("/response" + STORE_BASE_JSON, HttpStatus.CREATED); + httpResponse.setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON); + doReturn(httpResponse) + .when(HTTP_CLIENT) + .execute(any(HttpRequestBase.class), any(HttpContext.class)); + + StoreCreateRequest request = + StoreCreateRequest.builder() + .name("Official Store") + .businessHours( + StoreBusinessHoursRequest.builder() + .monday( + StoreOpeningHoursRequest.builder() + .open("08:00") + .close("15:00") + .build()) + .build()) + .location( + StoreLocationRequest.builder() + .addressLine("Av. Casacavel 1221") + .reference("Mercado Livre") + .city( + StoreCityRequest.builder() + .id("TUxBQ0NBUm9mZjE1") + .name("Carapicuíba") + .build()) + .latitude(-23.588479) + .longitude(-46.634852) + .build()) + .build(); + + Store store = new StoreClient().createStore(539675046L, request); + assertNotNull(store); + assertStoreFields(store); + } + + @Test + void getStoreSuccess() throws IOException, MPException, MPApiException { + HttpResponse httpResponse = + MockHelper.generateHttpResponseFromFile("/response" + STORE_BASE_JSON, HttpStatus.OK); + httpResponse.setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON); + doReturn(httpResponse) + .when(HTTP_CLIENT) + .execute(any(HttpRequestBase.class), any(HttpContext.class)); + + Store store = new StoreClient().getStore(960798L); + assertNotNull(store); + assertStoreFields(store); + } + + @Test + void searchStoresSuccess() throws IOException, MPException, MPApiException { + HttpResponse httpResponse = + MockHelper.generateHttpResponseFromFile("/response" + STORE_ALL_JSON, HttpStatus.OK); + httpResponse.setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON); + doReturn(httpResponse) + .when(HTTP_CLIENT) + .execute(any(HttpRequestBase.class), any(HttpContext.class)); + + Map filters = new HashMap<>(); + ResultsStoresPage page = new StoreClient().searchStores(new MPSearchRequest(30, 0)); + assertNotNull(page); + assertEquals(2, page.getResults().size()); + assertStoreFields(page.getResults().get(0)); + } + + @Test + void updateStoreSuccess() throws IOException, MPException, MPApiException { + HttpResponse httpResponse = + MockHelper.generateHttpResponseFromFile("/response" + STORE_BASE_JSON, HttpStatus.OK); + httpResponse.setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON); + doReturn(httpResponse) + .when(HTTP_CLIENT) + .execute(any(HttpRequestBase.class), any(HttpContext.class)); + + StoreUpdateRequest request = + StoreUpdateRequest.builder() + .name("Official Store") + .businessHours( + StoreBusinessHoursRequest.builder() + .monday( + StoreOpeningHoursRequest.builder() + .open("08:00") + .close("15:00") + .build()) + .build()) + .location( + StoreLocationRequest.builder() + .addressLine("Av. Casacavel 1221") + .reference("Mercado Livre") + .city( + StoreCityRequest.builder() + .id("TUxBQ0NBUm9mZjE1") + .name("Carapicuíba") + .build()) + .latitude(-23.588479) + .longitude(-46.634852) + .build()) + .build(); + + Store store = new StoreClient().updateStore(960798L, request); + assertNotNull(store); + assertStoreFields(store); + } + + @Test + void deleteStoreSuccess() throws IOException, MPException, MPApiException { + HttpResponse httpResponse = + MockHelper.generateHttpResponseFromFile("/response" + STORE_BASE_JSON, HttpStatus.OK); + httpResponse.setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON); + doReturn(httpResponse) + .when(HTTP_CLIENT) + .execute(any(HttpRequestBase.class), any(HttpContext.class)); + + Store store = new StoreClient().deleteStore(960798L); + assertNotNull(store); + assertStoreFields(store); + } + + private void assertStoreFields(Store store) { + assertEquals(960798, store.getId()); + assertEquals(539675046, store.getUserId()); + assertEquals("Official Store", store.getName()); + assertEquals("2022-01-10T10:10:10.000+00:00", store.getDateCreated()); + assertNotNull(store.getResponse().getContent()); + assertEquals(HttpStatus.OK, store.getResponse().getStatusCode()); + } +} + "results": [ + { + "id": 960798, + "user_id": 539675046, + "name": "Official Store", + "date_created": "2022-01-10T10:10:10.000+00:00", + "business_hours": { + "monday": { + "open": "08:00", + "close": "15:00" + } + }, + "location": { + "address_line": "Av. Casacavel 1221", + "reference": "Mercado Livre", + "city": { + "id": "TUxBQ0NBUm9mZjE1", + "name": "Carapicuíba" + }, + "latitude": -23.588479, + "longitude": -46.634852 + } + }, + { + "id": 960799, + "user_id": 539675046, + "name": "Second Store", + "date_created": "2022-01-11T10:10:10.000+00:00", + "business_hours": { + "monday": { + "open": "09:00", + "close": "18:00" + } + }, + "location": { + "address_line": "Av. das Nações Unidas 3003", + "reference": "Mercado Pago", + "city": { + "id": "TUxBQ0NBUm9mZjE1", + "name": "Carapicuíba" + }, + "latitude": -23.588479, + "longitude": -46.634852 + } + } + ] +} diff --git a/src/test/java/com/mercadopago/resources/mocks/request/store/store_base.json b/src/test/java/com/mercadopago/resources/mocks/request/store/store_base.json new file mode 100644 index 00000000..5ab07963 --- /dev/null +++ b/src/test/java/com/mercadopago/resources/mocks/request/store/store_base.json @@ -0,0 +1,20 @@ +{ + "name": "Official Store", + "business_hours": { + "monday": { + "open": "08:00", + "close": "15:00" + }, + "tuesday": { + "open": "08:00", + "close": "15:00" + } + }, + "location": { + "address_line": "Av. das Nações Unidas, 3003", + "reference": "Mercado Pago", + "city": { + "id": "TUxBQ0NBUGZlZG1kY00" + } + } +} diff --git a/src/test/java/com/mercadopago/resources/mocks/request/store/store_update.json b/src/test/java/com/mercadopago/resources/mocks/request/store/store_update.json new file mode 100644 index 00000000..c7fb354c --- /dev/null +++ b/src/test/java/com/mercadopago/resources/mocks/request/store/store_update.json @@ -0,0 +1,65 @@ +{ + "name": "Updated Store", + "business_hours": { + "monday": [ + { + "open": "08:00", + "close": "12:00" + }, + { + "open": "14:00", + "close": "18:00" + } + ], + "tuesday": [ + { + "open": "08:00", + "close": "12:00" + }, + { + "open": "14:00", + "close": "18:00" + } + ], + "wednesday": [ + { + "open": "08:00", + "close": "12:00" + }, + { + "open": "14:00", + "close": "18:00" + } + ], + "thursday": [ + { + "open": "08:00", + "close": "12:00" + }, + { + "open": "14:00", + "close": "18:00" + } + ], + "friday": [ + { + "open": "08:00", + "close": "12:00" + }, + { + "open": "14:00", + "close": "18:00" + } + ] + }, + "location": { + "address_line": "Av. das Nações Unidas, 3003", + "reference": "Mercado Pago", + "city": "São Paulo", + "state": "SP", + "zip_code": "06233-200", + "neighborhood": "Bonfim", + "latitude": -23.5967136, + "longitude": -46.6880447 + } +} diff --git a/src/test/java/com/mercadopago/resources/mocks/response/store/store_all.json b/src/test/java/com/mercadopago/resources/mocks/response/store/store_all.json new file mode 100644 index 00000000..68f112d0 --- /dev/null +++ b/src/test/java/com/mercadopago/resources/mocks/response/store/store_all.json @@ -0,0 +1,103 @@ +{ + "paging": { + "total": 2, + "limit": 30, + "offset": 0 + }, + "results": [ + { + "id": 4488810, + "name": "Official Store", + "date_creation": "2021-10-15T09:30:04.000-03:00", + "business_hours": { + "monday": [ + { + "open": "08:00", + "close": "15:00" + } + ], + "tuesday": [ + { + "open": "08:00", + "close": "15:00" + } + ], + "wednesday": [ + { + "open": "08:00", + "close": "15:00" + } + ], + "thursday": [ + { + "open": "08:00", + "close": "15:00" + } + ], + "friday": [ + { + "open": "08:00", + "close": "15:00" + } + ] + }, + "location": { + "address_line": "Av. das Nações Unidas, 3003", + "reference": "Floor 12", + "city": "Sao Paulo", + "state": "BR-SP", + "zip_code": "06233200", + "latitude": -23.596, + "longitude": -46.688 + }, + "external_id": "STORE001" + }, + { + "id": 4488811, + "name": "Updated Store", + "date_creation": "2021-10-15T09:30:04.000-03:00", + "business_hours": { + "monday": [ + { + "open": "09:00", + "close": "18:00" + } + ], + "tuesday": [ + { + "open": "09:00", + "close": "18:00" + } + ], + "wednesday": [ + { + "open": "09:00", + "close": "18:00" + } + ], + "thursday": [ + { + "open": "09:00", + "close": "18:00" + } + ], + "friday": [ + { + "open": "09:00", + "close": "18:00" + } + ] + }, + "location": { + "address_line": "Test Address 123", + "reference": "Store reference", + "city": "Sao Paulo", + "state": "BR-SP", + "zip_code": "47807078", + "latitude": -23.596, + "longitude": -46.638 + }, + "external_id": "STORE002" + } + ] +} diff --git a/src/test/java/com/mercadopago/resources/mocks/response/store/store_base.json b/src/test/java/com/mercadopago/resources/mocks/response/store/store_base.json new file mode 100644 index 00000000..516b764b --- /dev/null +++ b/src/test/java/com/mercadopago/resources/mocks/response/store/store_base.json @@ -0,0 +1,26 @@ +{ + "id": 960798, + "user_id": 539675046, + "name": "Official Store", + "date_created": "2022-01-10T10:10:10.000+00:00", + "business_hours": { + "monday": { + "open": "08:00", + "close": "18:00" + }, + "tuesday": { + "open": "08:00", + "close": "18:00" + } + }, + "location": { + "address_line": "Av. das Nações Unidas, 3003", + "reference": "Floor 12", + "city": "Sao Paulo", + "state": "BR-SP", + "zip_code": "06233200", + "latitude": -23.6108, + "longitude": -46.6975 + }, + "external_id": "store_001" +}