Class AbstractInternalEndpointClient

java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.api.AbstractEndpointClient
es.kukenan.smartfi.microservice.smartficore.service.api.AbstractInternalEndpointClient
Direct Known Subclasses:
ApcEndpoints, BacAuthEndpoint, BackofficeEndpoints, BacTcdEndpoint, EFacturaPtyEndpoint, UltraFaceEndpoint

public class AbstractInternalEndpointClient extends AbstractEndpointClient
Base class with core funcionality for any endpoint implementation.
  • Field Details

    • HEADER_USERPROFILEID

      public static final String HEADER_USERPROFILEID
      User profile identifier header.
      See Also:
    • USER_IP_HEADER

      public static final String USER_IP_HEADER
      user ip internal header attribute.
      See Also:
    • endpointBasePath

      protected final String endpointBasePath
      API base path.
    • restTemplate

      Rest template.
    • properties

      @Autowired private es.kukenan.smartfi.common.context.config.ContextPropagationProperties properties
      Context propagation properties.
    • contextManager

      @Autowired private es.kukenan.smartfi.common.context.RequestContextManager contextManager
      Request context manager.
  • Constructor Details

    • AbstractInternalEndpointClient

      public AbstractInternalEndpointClient(String endpointBasePath)
      Base constructor.
      Parameters:
      endpointBasePath - the base path of this endpoint.
  • Method Details

    • extractResponseData

      protected <T> T extractResponseData(org.springframework.http.ResponseEntity<T> responseEntity)
      Extract the response data from the given ResponseEntity.
      Type Parameters:
      T - MinsaitResponse type.
      Parameters:
      responseEntity - ResponseEntity.
      Returns:
      minsait response data.
    • addAuthorization

      private void addAuthorization(org.springframework.http.HttpHeaders httpHeaders)
      Add authorization parameters to the given http headers.
      Parameters:
      httpHeaders - http headers to update with the correct credentials to invoke Core API.
    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userId)
      Create the default request HTTP headers used in any Core API method.
      Parameters:
      contentType - request body content type. Can be null.
      userId - user identifier, mandatory.
      Returns:
      the default request HTTP headers used in any Core API method.
    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userId, String userIp)
    • extractResponseBody

      protected <T extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<?>> T extractResponseBody(org.springframework.http.ResponseEntity<T> responseEntity)
      Extract the response data from the given ResponseEntity.
      Type Parameters:
      T - CoreResponse type.
      Parameters:
      responseEntity - ResponseEntity.
      Returns:
      core response data.