Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagopa 2004 gpd issue dynamic password #32

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/it/gov/pagopa/reporting/RetrieveFlows.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ public void run(
.orElseThrow(() -> new RuntimeException(String.format("No data present in api config database for PA %s", organization)));
String idStation = stationBroker.getStationCode();
String idBroker = stationBroker.getBrokerCode();
String stationPassword = stationBroker.getPassword();
logger.log(Level.INFO, () -> "[RetrieveFlows][NodoChiediElencoFlussiRendicontazione] idPa: " + organization + ", idIntermediario: " + idBroker + ", idStazione: " + idStation );
// call NODO dei pagamenti
nodeClient.nodoChiediElencoFlussiRendicontazione(organization, idBroker, idStation);
nodeClient.nodoChiediElencoFlussiRendicontazione(organization, idBroker, idStation, stationPassword);

// retrieve result
FaultBean faultBean = nodeClient.getNodoChiediElencoFlussiRendicontazioneFault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ public class Station {

@JsonProperty(value = "broker_code")
private String brokerCode;

@JsonProperty(value = "password")
private String password;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class NodoChiediElencoFlussi {
private PagamentiTelematiciRPT port;
private Holder<FaultBean> nodoChiediElencoFlussiRendicontazioneFault;
private Holder<TipoElencoFlussiRendicontazione> nodoChiediElencoFlussiRendicontazione;
private final String nodoChiediElencoFlussiRendicontazionePassword = System.getenv("PAA_PASSWORD");

public NodoChiediElencoFlussi(Logger logger) {

Expand Down Expand Up @@ -48,15 +47,16 @@ public TipoElencoFlussiRendicontazione getNodoChiediElencoFlussiRendicontazione(

public void nodoChiediElencoFlussiRendicontazione(String idPa,
String idIntermediarioPA,
String idStazioneIntermediarioPA) throws ClientTransportException {
String idStazioneIntermediarioPA,
String passwordStazione) throws ClientTransportException {

var nodoChiediElencoFlussiRendicontazioneFaultLocal = new Holder<FaultBean>();
var nodoChiediElencoFlussiRendicontazioneElencoFlussiRendicontazioneLocal = new Holder<TipoElencoFlussiRendicontazione>();

port.nodoChiediElencoFlussiRendicontazione(
idIntermediarioPA,
idStazioneIntermediarioPA,
nodoChiediElencoFlussiRendicontazionePassword, idPa, null,
passwordStazione, idPa, null,
nodoChiediElencoFlussiRendicontazioneFaultLocal,
nodoChiediElencoFlussiRendicontazioneElencoFlussiRendicontazioneLocal);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ void nodoChiediElencoFlussiTestSettersTest() throws Exception {
String idPa = "12345";
String idBroker = "123456";
String idStazione = "123456_00";
nodoChiediElencoFlussi.nodoChiediElencoFlussiRendicontazione(idPa, idBroker, idStazione);
String stazionePassword = "***";
nodoChiediElencoFlussi.nodoChiediElencoFlussiRendicontazione(idPa, idBroker, idStazione, stazionePassword);

assertTrue(Boolean.TRUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ void runOkTest() throws Exception {
doReturn(flowsService).when(function).getFlowsServiceInstance(logger);
doReturn(cacheClient).when(function).getCacheClientInstance();

doNothing().when(nodeClient).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString());
doNothing().when(nodeClient).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString(), anyString());
when(nodeClient.getNodoChiediElencoFlussiRendicontazioneFault()).thenReturn(null);
when(nodeClient.getNodoChiediElencoFlussiRendicontazione()).thenReturn(elencoFlussi);// test
String message = "{\"idPA\":[\"9000000001\",\"9000000002\",\"9000000003\"]}";
function.run(message, context);

// Asserts
verify(context, times(1)).getLogger();
verify(nodeClient, times(3)).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString());
verify(nodeClient, times(3)).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString(), anyString());
}

@Test
Expand All @@ -96,6 +96,7 @@ void runKoTest() throws Exception {
.stationCode("12345_00")
.brokerCode("12345")
.enabled(true)
.password("***")
.build());
List<CreditorInstitutionStation> creditorInstitutionStations = List.of(
CreditorInstitutionStation.builder()
Expand Down Expand Up @@ -129,7 +130,7 @@ void runKoTest() throws Exception {

// doNothing().when(nodeClient).setSslContext();

doNothing().when(nodeClient).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString());
doNothing().when(nodeClient).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString(), anyString());
when(nodeClient.getNodoChiediElencoFlussiRendicontazioneFault()).thenReturn(objectFactory.createFaultBean());
when(nodeClient.getNodoChiediElencoFlussiRendicontazione()).thenReturn(null);
when(cacheClient.getCache()).thenReturn(cacheResponse);
Expand All @@ -139,7 +140,7 @@ void runKoTest() throws Exception {

// Asserts
verify(context, times(1)).getLogger();
verify(nodeClient, times(3)).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString());
verify(nodeClient, times(3)).nodoChiediElencoFlussiRendicontazione(anyString(), anyString(), anyString(), anyString());
}

@Test
Expand Down
Loading