Skip to content

Commit

Permalink
feat: [PAGOPA-2360] service type wisp (#180)
Browse files Browse the repository at this point in the history
Co-authored-by: aacitelli <[email protected]>
Co-authored-by: Andrea De Rinaldis <[email protected]>
Co-authored-by: FedericoRuzzier <[email protected]>
  • Loading branch information
4 people authored Nov 26, 2024
1 parent 257c02e commit 798faca
Show file tree
Hide file tree
Showing 9 changed files with 372 additions and 343 deletions.
685 changes: 356 additions & 329 deletions openapi-client/gpd/openapi.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.lang.Nullable;

@Configuration
@EnableCosmosRepositories("it.gov.pagopa.wispconverter.repository")
@EnableCosmosRepositories(
basePackages = "it.gov.pagopa.wispconverter.repository",
excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = "it\\.gov\\.pagopa\\.wispconverter\\.repository\\.secondary\\..*"))
@EnableConfigurationProperties
@EnableCosmosAuditing
@ConditionalOnExpression("'${info.properties.environment}'!='test'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;

@Configuration
@EnableCosmosRepositories(basePackages = "it.gov.pagopa.wispconverter.secondary")
@EnableCosmosRepositories(basePackages = "it.gov.pagopa.wispconverter.repository.secondary")
@EnableConfigurationProperties
@ConditionalOnExpression("'${info.properties.environment}'!='test'")
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import it.gov.pagopa.wispconverter.util.CommonUtility;
import it.gov.pagopa.wispconverter.util.Constants;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.util.Pair;
Expand All @@ -32,7 +31,6 @@
import java.util.stream.Collectors;

@Service
@Slf4j
@RequiredArgsConstructor
public class DebtPositionService {

Expand All @@ -44,10 +42,6 @@ public class DebtPositionService {

private final ReService reService;

private final ReceiptService receiptService;

private final DecouplerService decouplerService;

private final ConfigCacheService configCacheService;

private final DebtPositionMapper mapper;
Expand Down Expand Up @@ -524,8 +518,8 @@ private void handlePaymentPositionInsertion(DebtPositionsApiApi gpdClientInstanc
it.gov.pagopa.gen.wispconverter.client.gpd.model.MultiplePaymentPositionModelDto multiplePaymentPositions = new MultiplePaymentPositionModelDto();
multiplePaymentPositions.setPaymentPositions(paymentPositionsToCreateForCreditorInstitution);

// communicating with GPD service in order to update the existing payment position
gpdClientInstance.createMultiplePositions(creditorInstitutionId, multiplePaymentPositions, MDC.get(Constants.MDC_REQUEST_ID), true);
// communicating with GPD service in order to update the existing payment position (serviceType WISP)
gpdClientInstance.createMultiplePositions(creditorInstitutionId, multiplePaymentPositions, MDC.get(Constants.MDC_REQUEST_ID), true, "WISP");
}

} catch (RestClientException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public class ReceiptService {
private final ServiceBusService serviceBusService;

private final ReceiptDeadLetterRepository receiptDeadLetterRepository;

private final it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient;


@Autowired
private final it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClientWithRetry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public interface DebtPositionMapper {
@Mapping(target = "validityDate", expression = "java(null)")
@Mapping(target = "switchToExpired", constant = "false")
@Mapping(target = "payStandIn", constant = "false")
@Mapping(target = "pull", constant = "false")
it.gov.pagopa.gen.wispconverter.client.gpd.model.PaymentPositionModelDto toPaymentPosition(RPTContentDTO rptContentDTO);

@Mapping(source = "commonFields.payerType", target = "type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class CarrelloTest {
@MockBean
private it.gov.pagopa.gen.wispconverter.client.cache.invoker.ApiClient cacheClient;
@MockBean
@Qualifier("decouplerCachingClient")
private it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient;
@Qualifier("redisSimpleTemplate")
@MockBean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
import it.gov.pagopa.wispconverter.repository.ReceiptDeadLetterRepository;
import it.gov.pagopa.wispconverter.repository.model.RPTRequestEntity;
import it.gov.pagopa.wispconverter.service.*;
import it.gov.pagopa.wispconverter.service.mapper.RTMapper;
import it.gov.pagopa.wispconverter.service.model.ReceiptDto;
import it.gov.pagopa.wispconverter.utils.TestUtils;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
Expand Down Expand Up @@ -65,8 +67,11 @@ class ReceiptTest {
private NavToIuvMappingRepository navToIuvMappingRepository;
@MockBean
private ReService reService;
@MockBean
private RTMapper rtMapper;

@MockBean
@Qualifier("decouplerCachingClient")
private it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient;

private String getPaSendRTPayload() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class RptTest {
@MockBean
private it.gov.pagopa.gen.wispconverter.client.cache.invoker.ApiClient cacheClient;
@MockBean
@Qualifier("decouplerCachingClient")
private it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient;
@Qualifier("redisSimpleTemplate")
@MockBean
Expand Down

0 comments on commit 798faca

Please sign in to comment.