diff --git a/openapi/openapi.json b/openapi/openapi.json
index f996b382..cd9cb5e1 100644
--- a/openapi/openapi.json
+++ b/openapi/openapi.json
@@ -1,248 +1,216 @@
{
- "openapi": "3.0.1",
- "info": {
- "description": "A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, converting them in NMU payments.\n\n# OPERATIVE INFO\n\n\n## EVENT MAPPING IN RE\n\nDetails\nFIELD | SCOPE | DESCRIPTION\n- | - | -\n**requestId** | BOTH | The identifier, set by X-Request-ID, from which the events can be grouped.\n**operationId** | BOTH | The identifier associated to a request identifier\n**clientOperationId** | BOTH | The identifier that associate a client to an operation identifier.\n**component** | BOTH | The applicative component from which the event is generated. In NDP it is mapped with field 'componente'. Values: _WISP_SOAP_CONVERTER_ _WISP_CONVERTER_\n**insertedTimestamp** | BOTH | The time on which the event is inserted in RE storage\n**eventCategory** | BOTH | The category on which the event can be grouped. In NDP it is mapped with field 'categoriaEvento'. Values: _INTERFACE_ _INTERNAL_\n**eventSubcategory** | BOTH | The subcategory related to the specific nature of the event. In NDP it is mapped with field 'sottoTipoEvento'. Values: _REQ_ _RESP_ _INTERN_\n**callType** | INTERFACE | The type of role that the application has in the communication with the remote endpoint. Values: _SERVER_ _CLIENT_\n**consumer** | INTERFACE | The service that is consumer in the step execution. In NDP it is mapped with field 'fruitore'.\n**provider** | INTERFACE | The service that provide to the step execution. In NDP it is mapped with field 'erogatore'.\n**outcome** | INTERFACE | The outcome of the operation described by the event. In NDP it is mapped with field 'esito'. Values: _SEND_: Correctly sent request to HTTP endpoint. In NDP it is mapped with value 'INVIATA'. _SEND_FAILURE_: Failed to send request to HTTP endpoint. In NDP it is mapped with value 'INVIATA_KO' _RECEIVED_: Received an OK response from HTTP endpoint. In NDP it is mapped with value 'RICEVUTA_KO' _RECEIVED_FAILURE_: Received a failure response from endpoint. In NDP it is mapped with value 'RICEVUTA_KO' _NEVER_RECEIVED_: Failed to receive response at all from endpoint. In NDP it is mapped with value 'NO_RICEVUTA' _EXECUTED_INTERNAL_STEP_: Executed internal step on execution. In NDP it is mapped with value 'CAMBIO_STATO'\n**httpMethod** | INTERFACE | The HTTP method of the endpoint related to the event. This field is set only if the events that describe an HTTP communication with an external service.\n**httpUri** | INTERFACE | The URI related to the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**httpHeaders** | INTERFACE | The list of HTTP headers extracted from the request/response analyzed by the event. This field is set only if the events that describe an HTTP communication with an external service.\n**httpCallRemoteAddress** | INTERFACE | The remote IP address extracted from the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**httpStatusCode** | INTERFACE | The status code extracted from the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**executionTimeMs** | INTERFACE | The duration time of the invocation of the endpoint related to the event. This field is set only if the events that describe an HTTP communication with an external service.\n**compressedPayload** | INTERFACE | The payload of the request/response analyzed by the event. This value is zipped using GZip compression algorithm.\n**compressedPayloadLength** | INTERFACE | The length (in number of characters) of the compressed payload.\n**businessProcess** | INTERFACE | The descriptive label associated to the endpoint called by user and related to the whole process.\n**operationStatus** | INTERFACE | The final status of the whole operation. This is set only in the events that describe the response in output to user.\n**operationErrorTitle** | INTERFACE | The error title extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**operationErrorDetail** | INTERFACE | The error detail message extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**operationErrorCode** | INTERFACE | The error code extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**primitive** | INTERNAL | The typology of primitive analyzed and tracked by the event. In NDP it is mapped with field 'eventType'.\n**sessionId** | INTERNAL | The session identifier generated by WISP SOAP Converter and used in the request.\n**cartId** | INTERNAL | The cart identifier used in the request.\n**iuv** | INTERNAL | The 'identificativo univoco pagamento' used in the request.\n**noticeNumber** | INTERNAL | The notice number (aka NAV code) used in the request.\n**domainId** | INTERNAL | The creditor institution identifier used in the request.\n**ccp** | INTERNAL | The 'codice contesto pagamento' used in the request.\n**psp** | INTERNAL | The payment service provider used in the request.\n**station** | INTERNAL | The station used in the request.\n**channel** | INTERNAL | The channel used in the request.\n**status** | INTERNAL | The state of the internal step executed. Values: _FOUND_RPT_IN_STORAGE_ _EXTRACTED_DATA_FROM_RPT_ _CREATED_NEW_PAYMENT_POSITION_IN_GPD_ _UPDATED_EXISTING_PAYMENT_POSITION_IN_GPD_ _FOUND_INVALID_PAYMENT_POSITION_IN_GPD_ _GENERATED_CACHE_FOR_DECOUPLER_ABOUT_RPT_ _RECEIVED_REDIRECT_URL_FROM_CHECKOUT_ _GENERATED_NEW_RT_ _NEGATIVE_RT_NOT_GENERABLE_ _NEGATIVE_RT_GENERATION_SKIPPED_ _RT_SEND_SUCCESS_ _RT_SEND_FAILURE_\n**info** | INTERNAL | The other information that can be inserted for the tracing.\n**paymentToken** | INTERNAL | The payment token.\n\n\n\n\n## OPERATIONAL ERROR CODES\n\nDetails\nNAME | CODE | DESCRIPTION\n- | - | -\n**WIC-500** | *ERROR* | A not documented generic error occurred while execution. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1000** | *GENERIC_ERROR* | A generic error occurred while executing conversion flow. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1001** | *PARSING_GENERIC_ERROR* | A generic error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1002** | *PARSING_INVALID_HEADER* | An error occurred while parsing of the content header, associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT.\n**WIC-1003** | *PARSING_INVALID_BODY* | An error occurred while parsing of the content payload, associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT.\n**WIC-1004** | *PARSING_INVALID_XML_NODES* | An error occurred while parsing of the of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The XML content extracted, either from payload or from header, is invalid because it is not possible to extract tag nodes from document. So, the document is probably empty.\n**WIC-1005** | *PARSING_INVALID_ZIPPED_PAYLOAD* | An error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The SOAP request analyzed and stored in dedicated storage is not usable for convert the debt positions in GPD system. This is probably due to an invalid conversion of the SOAP request via GZip algorithm executed before the same is stored in its storage.\n**WIC-1006** | *PARSING_RPT_PRIMITIVE_NOT_VALID* | An error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The primitive (the content related to header 'soapaction') cannot be handled by WISP Converter application in redirect process: only one of nodoInviaRPT and nodoInviaCarrelloRPT can be accepted.\n**WIC-1100** | *VALIDATION_INVALID_MULTIBENEFICIARY_CART* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, the request is arrived as nodoInviaCarrelloRPT as multi-beneficiary cart, but the number of RPTs in the request is lower than two, so it cannot be correctly handled as multi-beneficiary.\n**WIC-1101** | *VALIDATION_INVALID_IBANS* | An error occurred while analyzing the RPTs extracted from SOAP request. An IBAN must always be set in RPT transfers if they aren't related to digital stamps (which don't require an IBAN, because they will be reported to specific subject). In this case, in one or more RPT transfers not related to digital stamp, the IBAN is not correctly set.\n**WIC-1102** | *VALIDATION_INVALID_DEBTOR* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, in a cart there are different debtor subjects and this is not permitted for this flow. So, the whole cart is discarded.\n**WIC-1103** | *VALIDATION_INVALID_CREDITOR_INSTITUTION* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, in a cart there are different RPT that refers to different payees, but this is not permitted when the cart is not for multi-beneficiary. So, the whole cart is discarded.\n**WIC-1200** | *CONFIGURATION_INVALID_CACHE* | An error occurred while trying to access data from cached configuration. It is possible that the cache is not retrieved yet by this service or a corrupted configuration was returned from APIConfig Cache internal service. If this problem still occurs, please check the connectivity with APIConfig Cache.\n**WIC-1201** | *CONFIGURATION_INVALID_STATION* | An error occurred while retrieving data from local cached configuration. In particular, it is not possible to retrieve the configuration about the station because it does not exists in cache, and maybe also in general configuration. So, a change in whole configuration and/or a refresh on cache is required.\n**WIC-1202** | *CONFIGURATION_INVALID_CREDITOR_INSTITUTION_STATION* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the required station does not exists in cached configuration. So, a change in whole configuration and/or a refresh on cache is required.\n**WIC-1203** | *CONFIGURATION_INVALID_STATION_REDIRECT_URL* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration about redirection in error cases is not correctly set to points towards some creditor institution's endpoint. So, a change in configuration is required.\n**WIC-1204** | *CONFIGURATION_INVALID_STATION_SERVICE_URL* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration is not correctly set to points towards GPD service endpoint for RT generator. So, a change in configuration is required.\n**WIC-1205** | *CONFIGURATION_INVALID_GPD_STATION* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration is correctly set to points towards GPD service endpoint but uses the 'v1' primitive version (and it must use the 'v2' version). So, a change in configuration is required.\n**WIC-1300** | *PAYMENT_POSITION_NOT_IN_PAYABLE_STATE* | An error occurred while checking an existing payment position. One or more RPTs extracted from the request refers to existing payment positions in GPD that have a state from which it is impossible to execute a payment flow. If the execution of this flow is related to a RPT cart, all the payments that can be retrieved or generated ex novo from those RPTs are declared as atomically invalid (if one RPT in cart is bad, all RPTs in cart are bad) and not payable with this flow.\n**WIC-1301** | *PAYMENT_POSITION_IN_INCONSISTENT_STATE* | An error occurred while checking an existing payment position in GPD system. The retrieved payment position, previously inserted in GPD by this same flow or by other procedures, is in an invalid state, not mappable to an existing value. This can be related to a wrong setting in GPD or a corruption of the retrieved data.\n**WIC-1302** | *PAYMENT_POSITION_NOT_VALID* | An error occurred while generating a payment position. In particular, something during the generation of a new payment position or the analysis of an existing payment position went wrong and the operation cannot be completed. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1303** | *PAYMENT_OPTION_NOT_EXTRACTABLE* | An error occurred while extracting a payment option from a payment position. This can be caused by a malformed payment position that does not have a payment option. Remember that a payment position in this flow must have one and only one payment option.\n**WIC-1400** | *RECEIPT_KO_NOT_GENERATED* | An error occurred while generating a negative RT (aka a KO receipt). So, no receipt can be sent lately to creditor institution and probably the process must be executed manually. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-2000** | *PERSISTENCE_SAVING_RE_ERROR* | An error occurred wile trying to store a new event in the Registro Eventi storage. The error is somewhat related to a persistence problem of the used storage and in the majority of the cases is temporary (maybe a 429 HTTP code). This error currently blocks the entire flow because that can lead to untraceable requests. For better understanding the cause, please execute a search in the log provider (Application Insights, Kibana, etc).\n**WIC-2001** | *PERSISTENCE_RPT_NOT_FOUND* | An error occurred while trying to retrieve the RPT content saved in storage by WISP SOAP Converter. This can be related either with the use of a wrong sessionId or a missed persistence from WISP SOAP Converter, so it is better to analyze the entire flow using Technical Support's APIs. This block totally the conversion of the RPTs in GPD's payment positions, so the whole process is discarded.\n**WIC-2002** | *PERSISTENCE_REQUESTID_CACHING_ERROR* | An error occurred while trying to retrieve data from internal cache. Specifically, the cached key, defined in format wisp_nav2iuv__\n",
- "termsOfService": "https://www.pagopa.gov.it/",
- "title": "WISP Converter",
- "version": "0.0.22"
+ "openapi" : "3.0.1",
+ "info" : {
+ "description" : "A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, converting them in NMU payments.\n\n# OPERATIVE INFO\n\n\n## EVENT MAPPING IN RE\n\nDetails\nFIELD | SCOPE | DESCRIPTION\n- | - | -\n**requestId** | BOTH | The identifier, set by X-Request-ID, from which the events can be grouped.\n**operationId** | BOTH | The identifier associated to a request identifier\n**clientOperationId** | BOTH | The identifier that associate a client to an operation identifier.\n**component** | BOTH | The applicative component from which the event is generated. In NDP it is mapped with field 'componente'. Values: _WISP_SOAP_CONVERTER_ _WISP_CONVERTER_\n**insertedTimestamp** | BOTH | The time on which the event is inserted in RE storage\n**eventCategory** | BOTH | The category on which the event can be grouped. In NDP it is mapped with field 'categoriaEvento'. Values: _INTERFACE_ _INTERNAL_\n**eventSubcategory** | BOTH | The subcategory related to the specific nature of the event. In NDP it is mapped with field 'sottoTipoEvento'. Values: _REQ_ _RESP_ _INTERN_\n**callType** | INTERFACE | The type of role that the application has in the communication with the remote endpoint. Values: _SERVER_ _CLIENT_\n**consumer** | INTERFACE | The service that is consumer in the step execution. In NDP it is mapped with field 'fruitore'.\n**provider** | INTERFACE | The service that provide to the step execution. In NDP it is mapped with field 'erogatore'.\n**outcome** | INTERFACE | The outcome of the operation described by the event. In NDP it is mapped with field 'esito'. Values: _SEND_: Correctly sent request to HTTP endpoint. In NDP it is mapped with value 'INVIATA'. _SEND_FAILURE_: Failed to send request to HTTP endpoint. In NDP it is mapped with value 'INVIATA_KO' _RECEIVED_: Received an OK response from HTTP endpoint. In NDP it is mapped with value 'RICEVUTA_KO' _RECEIVED_FAILURE_: Received a failure response from endpoint. In NDP it is mapped with value 'RICEVUTA_KO' _NEVER_RECEIVED_: Failed to receive response at all from endpoint. In NDP it is mapped with value 'NO_RICEVUTA' _EXECUTED_INTERNAL_STEP_: Executed internal step on execution. In NDP it is mapped with value 'CAMBIO_STATO'\n**httpMethod** | INTERFACE | The HTTP method of the endpoint related to the event. This field is set only if the events that describe an HTTP communication with an external service.\n**httpUri** | INTERFACE | The URI related to the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**httpHeaders** | INTERFACE | The list of HTTP headers extracted from the request/response analyzed by the event. This field is set only if the events that describe an HTTP communication with an external service.\n**httpCallRemoteAddress** | INTERFACE | The remote IP address extracted from the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**httpStatusCode** | INTERFACE | The status code extracted from the called endpoint. This field is set only if the events that describe an HTTP communication with an external service.\n**executionTimeMs** | INTERFACE | The duration time of the invocation of the endpoint related to the event. This field is set only if the events that describe an HTTP communication with an external service.\n**compressedPayload** | INTERFACE | The payload of the request/response analyzed by the event. This value is zipped using GZip compression algorithm.\n**compressedPayloadLength** | INTERFACE | The length (in number of characters) of the compressed payload.\n**businessProcess** | INTERFACE | The descriptive label associated to the endpoint called by user and related to the whole process.\n**operationStatus** | INTERFACE | The final status of the whole operation. This is set only in the events that describe the response in output to user.\n**operationErrorTitle** | INTERFACE | The error title extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**operationErrorDetail** | INTERFACE | The error detail message extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**operationErrorCode** | INTERFACE | The error code extracted from the computation that refers to the error occurred during computation. This is set only in the events that describe the response in output to user if there is an error.\n**primitive** | INTERNAL | The typology of primitive analyzed and tracked by the event. In NDP it is mapped with field 'eventType'.\n**sessionId** | INTERNAL | The session identifier generated by WISP SOAP Converter and used in the request.\n**cartId** | INTERNAL | The cart identifier used in the request.\n**iuv** | INTERNAL | The 'identificativo univoco pagamento' used in the request.\n**noticeNumber** | INTERNAL | The notice number (aka NAV code) used in the request.\n**domainId** | INTERNAL | The creditor institution identifier used in the request.\n**ccp** | INTERNAL | The 'codice contesto pagamento' used in the request.\n**psp** | INTERNAL | The payment service provider used in the request.\n**station** | INTERNAL | The station used in the request.\n**channel** | INTERNAL | The channel used in the request.\n**status** | INTERNAL | The state of the internal step executed. Values: _FOUND_RPT_IN_STORAGE_ _EXTRACTED_DATA_FROM_RPT_ _CREATED_NEW_PAYMENT_POSITION_IN_GPD_ _GENERATED_NAV_FOR_NEW_PAYMENT_POSITION_ _UPDATED_EXISTING_PAYMENT_POSITION_IN_GPD_ _FOUND_INVALID_PAYMENT_POSITION_IN_GPD_ _GENERATED_CACHE_ABOUT_RPT_FOR_DECOUPLER_ _GENERATED_CACHE_ABOUT_RPT_FOR_RT_GENERATION_ _SAVED_RPT_IN_CART_RECEIVED_REDIRECT_URL_FROM_CHECKOUT_ _GENERATED_NEW_RT_ _NEGATIVE_RT_NOT_GENERABLE_ _NEGATIVE_RT_GENERATION_SKIPPED_ _NEGATIVE_RT_GENERATION_SUCCESS_ _RT_SEND_SUCCESS_ _RT_SEND_FAILURE_\n**info** | INTERNAL | The other information that can be inserted for the tracing.\n**paymentToken** | INTERNAL | The payment token.\n\n\n\n\n## OPERATIONAL ERROR CODES\n\nDetails\nNAME | CODE | DESCRIPTION\n- | - | -\n**WIC-500** | *ERROR* | A not documented generic error occurred while execution. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1000** | *GENERIC_ERROR* | A generic error occurred while executing conversion flow. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1001** | *PARSING_GENERIC_ERROR* | A generic error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1002** | *PARSING_INVALID_HEADER* | An error occurred while parsing of the content header, associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT.\n**WIC-1003** | *PARSING_INVALID_BODY* | An error occurred while parsing of the content payload, associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT.\n**WIC-1004** | *PARSING_INVALID_XML_NODES* | An error occurred while parsing of the of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The XML content extracted, either from payload or from header, is invalid because it is not possible to extract tag nodes from document. So, the document is probably empty.\n**WIC-1005** | *PARSING_INVALID_ZIPPED_PAYLOAD* | An error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The SOAP request analyzed and stored in dedicated storage is not usable for convert the debt positions in GPD system. This is probably due to an invalid conversion of the SOAP request via GZip algorithm executed before the same is stored in its storage.\n**WIC-1006** | *PARSING_RPT_PRIMITIVE_NOT_VALID* | An error occurred while parsing of the content associated to the SOAP request related to nodoInviaRPT or nodoInviaCarrelloRPT. The primitive (the content related to header 'soapaction') cannot be handled by WISP Converter application in redirect process: only one of nodoInviaRPT and nodoInviaCarrelloRPT can be accepted.\n**WIC-1100** | *VALIDATION_INVALID_MULTIBENEFICIARY_CART* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, the request is arrived as nodoInviaCarrelloRPT as multi-beneficiary cart, but the number of RPTs in the request is lower than two, so it cannot be correctly handled as multi-beneficiary.\n**WIC-1101** | *VALIDATION_INVALID_IBANS* | An error occurred while analyzing the RPTs extracted from SOAP request. An IBAN must always be set in RPT transfers if they aren't related to digital stamps (which don't require an IBAN, because they will be reported to specific subject). In this case, in one or more RPT transfers not related to digital stamp, the IBAN is not correctly set.\n**WIC-1102** | *VALIDATION_INVALID_DEBTOR* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, in a cart there are different debtor subjects and this is not permitted for this flow. So, the whole cart is discarded.\n**WIC-1103** | *VALIDATION_INVALID_CREDITOR_INSTITUTION* | An error occurred while analyzing the RPTs extracted from SOAP request. In particular, in a cart there are different RPT that refers to different payees, but this is not permitted when the cart is not for multi-beneficiary. So, the whole cart is discarded.\n**WIC-1200** | *CONFIGURATION_INVALID_CACHE* | An error occurred while trying to access data from cached configuration. It is possible that the cache is not retrieved yet by this service or a corrupted configuration was returned from APIConfig Cache internal service. If this problem still occurs, please check the connectivity with APIConfig Cache.\n**WIC-1201** | *CONFIGURATION_INVALID_STATION* | An error occurred while retrieving data from local cached configuration. In particular, it is not possible to retrieve the configuration about the station because it does not exists in cache, and maybe also in general configuration. So, a change in whole configuration and/or a refresh on cache is required.\n**WIC-1202** | *CONFIGURATION_INVALID_CREDITOR_INSTITUTION_STATION* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the required station does not exists in cached configuration. So, a change in whole configuration and/or a refresh on cache is required.\n**WIC-1203** | *CONFIGURATION_INVALID_STATION_REDIRECT_URL* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration about redirection in error cases is not correctly set to points towards some creditor institution's endpoint. So, a change in configuration is required.\n**WIC-1204** | *CONFIGURATION_INVALID_STATION_SERVICE_URL* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration is not correctly set to points towards GPD service endpoint for RT generator. So, a change in configuration is required.\n**WIC-1205** | *CONFIGURATION_INVALID_GPD_STATION* | An error occurred while checking the station that will be used for the payment process. In particular, analyzing the station that is related to the segregation code extracted from a payment option's notice number, it turns out that the configuration is correctly set to points towards GPD service endpoint but uses the 'v1' primitive version (and it must use the 'v2' version). So, a change in configuration is required.\n**WIC-1300** | *PAYMENT_POSITION_NOT_IN_PAYABLE_STATE* | An error occurred while checking an existing payment position. One or more RPTs extracted from the request refers to existing payment positions in GPD that have a state from which it is impossible to execute a payment flow. If the execution of this flow is related to a RPT cart, all the payments that can be retrieved or generated ex novo from those RPTs are declared as atomically invalid (if one RPT in cart is bad, all RPTs in cart are bad) and not payable with this flow.\n**WIC-1301** | *PAYMENT_POSITION_IN_INCONSISTENT_STATE* | An error occurred while checking an existing payment position in GPD system. The retrieved payment position, previously inserted in GPD by this same flow or by other procedures, is in an invalid state, not mappable to an existing value. This can be related to a wrong setting in GPD or a corruption of the retrieved data.\n**WIC-1302** | *PAYMENT_POSITION_NOT_VALID* | An error occurred while generating a payment position. In particular, something during the generation of a new payment position or the analysis of an existing payment position went wrong and the operation cannot be completed. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-1303** | *PAYMENT_OPTION_NOT_EXTRACTABLE* | An error occurred while extracting a payment option from a payment position. This can be caused by a malformed payment position that does not have a payment option. Remember that a payment position in this flow must have one and only one payment option.\n**WIC-1400** | *RECEIPT_KO_NOT_GENERATED* | An error occurred while generating a negative RT (aka a KO receipt). So, no receipt can be sent lately to creditor institution and probably the process must be executed manually. For better understanding the cause, please use the Technical Support's APIs.\n**WIC-2000** | *PERSISTENCE_SAVING_RE_ERROR* | An error occurred wile trying to store a new event in the Registro Eventi storage. The error is somewhat related to a persistence problem of the used storage and in the majority of the cases is temporary (maybe a 429 HTTP code). This error currently blocks the entire flow because that can lead to untraceable requests. For better understanding the cause, please execute a search in the log provider (Application Insights, Kibana, etc).\n**WIC-2001** | *PERSISTENCE_RPT_NOT_FOUND* | An error occurred while trying to retrieve the RPT content saved in storage by WISP SOAP Converter. This can be related either with the use of a wrong sessionId or a missed persistence from WISP SOAP Converter, so it is better to analyze the entire flow using Technical Support's APIs. This block totally the conversion of the RPTs in GPD's payment positions, so the whole process is discarded.\n**WIC-2002** | *PERSISTENCE_REQUESTID_CACHING_ERROR* | An error occurred while trying to retrieve data from internal cache. Specifically, the cached key, defined in format wisp_nav2iuv__ needed for RT generation, was not found. This missing read invalidates the entire process of the RT generation.\n**WIC-2003** | *PERSISTENCE_MAPPING_NAV_TO_IUV_ERROR* | An error occurred while trying to retrieve data from internal cache. Specifically, the cached key, defined in format wisp_nav2iuv__ needed for RT generation is corrupted in some way, because it is not possible to extract 'domainId' or 'nav' correctly. This wrong read invalidates the entire process of the RT generation.\n**WIC-3000** | *CLIENT_APICONFIGCACHE* | An error occurred while communicating with APIConfig Cache backend internal service in order to retrieve the last generated cache. It can be related to any client problem, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n**WIC-3001** | *CLIENT_GPD* | An error occurred while communicating with GPD backend services in order to execute a specific operation on payment position. It can be related to any client problem and to any particular operation, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n**WIC-3002** | *CLIENT_IUVGENERATOR* | An error occurred while communicating with IUV Generator backend internal service in order to retrieve a newly generated NAV code to be used to the new payment position to send in GPD system. It can be related to any client problem, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n**WIC-3003** | *CLIENT_DECOUPLER_CACHING* | An error occurred while communicating with an internal service endpoint dedicated to storing internal cache for route requests in Decoupler. It can be related to any client problem, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n**WIC-3004** | *CLIENT_CHECKOUT* | An error occurred while communicating with Checkout backend internal service in order to send a request about the cart creation. It can be related to any client problem, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n**WIC-3005** | *CLIENT_PAAINVIART* | An error occurred while communicating with the creditor institution's station (external service) in order to sending of a paaInviaRT request. It can be related to any client problem, so the best way to handle this is to use the Technical Support's APIs in order to find the cause.\n\n\n",
+ "termsOfService" : "https://www.pagopa.gov.it/",
+ "title" : "WISP Converter",
+ "version" : "0.0.22"
},
- "servers": [
- {
- "url": "http://localhost",
- "description": "Generated server url"
- }
- ],
- "tags": [
- {
- "description": "Application info APIs",
- "name": "Home"
- },
- {
- "description": "Convert sendPaymentResultV2, closePaymentV2 or paSendRTV2 into paaInviaRT to EC",
- "name": "Receipt"
- },
- {
- "description": "Conversion and redirection APIs",
- "name": "Redirect"
- }
- ],
- "paths": {
- "/info": {
- "get": {
- "operationId": "healthCheck",
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/AppInfoResponse"
+ "servers" : [ {
+ "url" : "http://localhost",
+ "description" : "Generated server url"
+ } ],
+ "tags" : [ {
+ "description" : "Application info APIs",
+ "name" : "Home"
+ }, {
+ "description" : "Convert sendPaymentResultV2, closePaymentV2 or paSendRTV2 into paaInviaRT to EC",
+ "name" : "Receipt"
+ }, {
+ "description" : "Conversion and redirection APIs",
+ "name" : "Redirect"
+ } ],
+ "paths" : {
+ "/info" : {
+ "get" : {
+ "operationId" : "healthCheck",
+ "responses" : {
+ "200" : {
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/AppInfoResponse"
}
}
},
- "description": "OK.",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
+ "description" : "OK.",
+ "headers" : {
+ "X-Request-Id" : {
+ "description" : "This header identifies the call",
+ "schema" : {
+ "type" : "string"
}
}
}
}
},
- "security": [
- {
- "ApiKey": []
- }
- ],
- "summary": "Return OK if application is started",
- "tags": [
- "Home"
- ]
+ "security" : [ {
+ "ApiKey" : [ ]
+ } ],
+ "summary" : "Return OK if application is started",
+ "tags" : [ "Home" ]
},
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
+ "parameters" : [ {
+ "description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "in" : "header",
+ "name" : "X-Request-Id",
+ "schema" : {
+ "type" : "string"
}
- ]
+ } ]
},
- "/payments": {
- "get": {
- "operationId": "redirect",
- "parameters": [
- {
- "example": "identificativoIntermediarioPA_sessionId",
- "in": "query",
- "name": "sessionId",
- "required": true,
- "schema": {
- "type": "string"
- }
+ "/payments" : {
+ "get" : {
+ "operationId" : "redirect",
+ "parameters" : [ {
+ "example" : "identificativoIntermediarioPA_sessionId",
+ "in" : "query",
+ "name" : "sessionId",
+ "required" : true,
+ "schema" : {
+ "type" : "string"
}
- ],
- "responses": {
- "302": {
- "description": "Redirect to Checkout service.",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
+ } ],
+ "responses" : {
+ "302" : {
+ "description" : "Redirect to Checkout service.",
+ "headers" : {
+ "X-Request-Id" : {
+ "description" : "This header identifies the call",
+ "schema" : {
+ "type" : "string"
}
}
}
}
},
- "security": [
- {
- "ApiKey": []
- }
- ],
- "tags": [
- "Redirect"
- ]
+ "security" : [ {
+ "ApiKey" : [ ]
+ } ],
+ "tags" : [ "Redirect" ]
},
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
+ "parameters" : [ {
+ "description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "in" : "header",
+ "name" : "X-Request-Id",
+ "schema" : {
+ "type" : "string"
}
- ]
+ } ]
},
- "/receipt/ko": {
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
+ "/receipt/ko" : {
+ "parameters" : [ {
+ "description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "in" : "header",
+ "name" : "X-Request-Id",
+ "schema" : {
+ "type" : "string"
}
- ],
- "post": {
- "operationId": "receiptKo",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ReceiptRequest"
+ } ],
+ "post" : {
+ "operationId" : "receiptKo",
+ "requestBody" : {
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/ReceiptRequest"
}
}
},
- "required": true
+ "required" : true
},
- "responses": {
- "200": {
- "description": "Successfully forwarded paaInviaRT- to EC",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
+ "responses" : {
+ "200" : {
+ "description" : "Successfully forwarded paaInviaRT- to EC",
+ "headers" : {
+ "X-Request-Id" : {
+ "description" : "This header identifies the call",
+ "schema" : {
+ "type" : "string"
}
}
}
}
},
- "security": [
- {
- "ApiKey": []
- }
- ],
- "tags": [
- "Receipt"
- ]
+ "security" : [ {
+ "ApiKey" : [ ]
+ } ],
+ "tags" : [ "Receipt" ]
}
},
- "/receipt/ok": {
- "parameters": [
- {
- "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
- "in": "header",
- "name": "X-Request-Id",
- "schema": {
- "type": "string"
- }
+ "/receipt/ok" : {
+ "parameters" : [ {
+ "description" : "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.",
+ "in" : "header",
+ "name" : "X-Request-Id",
+ "schema" : {
+ "type" : "string"
}
- ],
- "post": {
- "operationId": "receiptOk",
- "requestBody": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ReceiptRequest"
+ } ],
+ "post" : {
+ "operationId" : "receiptOk",
+ "requestBody" : {
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/ReceiptRequest"
}
}
},
- "required": true
+ "required" : true
},
- "responses": {
- "200": {
- "description": "Successfully forwarded paaInviaRT+ to EC",
- "headers": {
- "X-Request-Id": {
- "description": "This header identifies the call",
- "schema": {
- "type": "string"
+ "responses" : {
+ "200" : {
+ "description" : "Successfully forwarded paaInviaRT+ to EC",
+ "headers" : {
+ "X-Request-Id" : {
+ "description" : "This header identifies the call",
+ "schema" : {
+ "type" : "string"
}
}
}
}
},
- "security": [
- {
- "ApiKey": []
- }
- ],
- "tags": [
- "Receipt"
- ]
+ "security" : [ {
+ "ApiKey" : [ ]
+ } ],
+ "tags" : [ "Receipt" ]
}
}
},
- "components": {
- "schemas": {
- "AppInfoResponse": {
- "type": "object",
- "properties": {
- "environment": {
- "type": "string"
+ "components" : {
+ "schemas" : {
+ "AppInfoResponse" : {
+ "type" : "object",
+ "properties" : {
+ "environment" : {
+ "type" : "string"
},
- "name": {
- "type": "string"
+ "name" : {
+ "type" : "string"
},
- "version": {
- "type": "string"
+ "version" : {
+ "type" : "string"
}
}
},
- "ReceiptRequest": {
- "type": "object",
- "properties": {
- "content": {
- "type": "string"
+ "ReceiptRequest" : {
+ "type" : "object",
+ "properties" : {
+ "content" : {
+ "type" : "string"
}
}
}
},
- "securitySchemes": {
- "ApiKey": {
- "description": "The API key to access this function app.",
- "in": "header",
- "name": "Ocp-Apim-Subscription-Key",
- "type": "apiKey"
+ "securitySchemes" : {
+ "ApiKey" : {
+ "description" : "The API key to access this function app.",
+ "in" : "header",
+ "name" : "Ocp-Apim-Subscription-Key",
+ "type" : "apiKey"
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/it/gov/pagopa/wispconverter/service/DebtPositionService.java b/src/main/java/it/gov/pagopa/wispconverter/service/DebtPositionService.java
index dd240c76..4375ea2a 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/service/DebtPositionService.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/service/DebtPositionService.java
@@ -3,7 +3,12 @@
import it.gov.pagopa.gen.wispconverter.client.cache.model.ServiceDto;
import it.gov.pagopa.gen.wispconverter.client.cache.model.StationDto;
import it.gov.pagopa.gen.wispconverter.client.gpd.api.DebtPositionsApiApi;
-import it.gov.pagopa.gen.wispconverter.client.gpd.model.*;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.MultiplePaymentPositionModelDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.PaymentOptionModelDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.PaymentPositionModelBaseResponseDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.PaymentPositionModelDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.TransferMetadataModelDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.TransferModelDto;
import it.gov.pagopa.gen.wispconverter.client.iuvgenerator.api.GenerationApi;
import it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto;
import it.gov.pagopa.wispconverter.exception.AppErrorCodeMessageEnum;
@@ -64,6 +69,8 @@ public class DebtPositionService {
private final Pattern taxonomyPattern = Pattern.compile("([^/]++/[^/]++)/?");
+ private static final String REST_CLIENT_LOG_STRING = "RestClientException ERROR [%s] - %s";
+
@Value("${wisp-converter.poste-italiane.abi-code}")
private String posteItalianeABICode;
@@ -439,7 +446,7 @@ private void handleValidPaymentPosition(DebtPositionsApiApi gpdClientInstance, S
generateREForUpdatedPaymentPosition(sessionData, iuv);
} catch (RestClientException e) {
- throw new AppException(AppErrorCodeMessageEnum.CLIENT_GPD, String.format("RestClientException ERROR [%s] - %s", e.getCause().getClass().getCanonicalName(), e.getMessage()));
+ throw new AppException(AppErrorCodeMessageEnum.CLIENT_GPD, String.format(REST_CLIENT_LOG_STRING, e.getCause().getClass().getCanonicalName(), e.getMessage()));
}
}
@@ -534,7 +541,7 @@ private String generateNavCodeFromIuvGenerator(String creditorInstitutionId) {
} catch (RestClientException e) {
throw new AppException(AppErrorCodeMessageEnum.CLIENT_IUVGENERATOR,
- String.format("RestClientException ERROR [%s] - %s", e.getCause().getClass().getCanonicalName(), e.getMessage()));
+ String.format(REST_CLIENT_LOG_STRING, e.getCause().getClass().getCanonicalName(), e.getMessage()));
}
return navCode;
}
@@ -559,7 +566,7 @@ private void handlePaymentPositionInsertion(DebtPositionsApiApi gpdClientInstanc
generateREForBulkInsert(extractedPaymentPositions);
} catch (RestClientException e) {
- throw new AppException(AppErrorCodeMessageEnum.CLIENT_GPD, String.format("RestClientException ERROR [%s] - %s", e.getCause().getClass().getCanonicalName(), e.getMessage()));
+ throw new AppException(AppErrorCodeMessageEnum.CLIENT_GPD, String.format(REST_CLIENT_LOG_STRING, e.getCause().getClass().getCanonicalName(), e.getMessage()));
}
}
}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/service/ReceiptService.java b/src/main/java/it/gov/pagopa/wispconverter/service/ReceiptService.java
index 8d42b738..8da0c66e 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/service/ReceiptService.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/service/ReceiptService.java
@@ -153,7 +153,6 @@ public void paaInviaRTOk(String payload) {
gov.telematici.pagamenti.ws.papernodo.ObjectFactory objectFactory = new gov.telematici.pagamenti.ws.papernodo.ObjectFactory();
sessionData.getAllRPTs().forEach(rpt -> {
- Instant now = Instant.now();
PaymentServiceProviderDto psp = psps.get(rpt.getRpt().getPayeeInstitution().getSubjectUniqueIdentifier().getCode());
IntestazionePPT intestazionePPT = generateIntestazionePPT(
diff --git a/src/main/java/it/gov/pagopa/wispconverter/servicebus/RTConsumer.java b/src/main/java/it/gov/pagopa/wispconverter/servicebus/RTConsumer.java
index 4528a1cb..04dedc2c 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/servicebus/RTConsumer.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/servicebus/RTConsumer.java
@@ -59,8 +59,8 @@ public void post(){
.connectionString(connectionString)
.processor()
.queueName(queueName)
- .processMessage(context -> processMessage(context))
- .processError(context -> processError(context))
+ .processMessage(this::processMessage)
+ .processError(this::processError)
.buildProcessorClient();
}
@@ -99,7 +99,7 @@ public void processMessage(ServiceBusReceivedMessageContext context) {
null
);
- Boolean ok = false;
+ boolean ok = false;
try{
log.debug("[{}]Sending receipt",receiptId);
paaInviaRTService.send(url,receipt.getPayload());
@@ -157,4 +157,4 @@ public void processError(ServiceBusErrorContext context) {
reason, context.getException().toString());
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/it/gov/pagopa/wispconverter/util/client/AbstractAppClientLoggingInterceptor.java b/src/main/java/it/gov/pagopa/wispconverter/util/client/AbstractAppClientLoggingInterceptor.java
index bd3c30de..5ab67591 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/util/client/AbstractAppClientLoggingInterceptor.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/util/client/AbstractAppClientLoggingInterceptor.java
@@ -52,7 +52,7 @@ public abstract class AbstractAppClientLoggingInterceptor implements ClientHttpR
private boolean responsePretty;
private boolean mustPersistEventOnRE;
- public AbstractAppClientLoggingInterceptor(RequestResponseLoggingProperties clientLoggingProperties, ReService reService, ClientServiceEnum clientServiceEnum) {
+ protected AbstractAppClientLoggingInterceptor(RequestResponseLoggingProperties clientLoggingProperties, ReService reService, ClientServiceEnum clientServiceEnum) {
this.reService = reService;
this.clientServiceEnum = clientServiceEnum;
this.mustPersistEventOnRE = true;
diff --git a/src/main/java/it/gov/pagopa/wispconverter/util/interceptor/AbstractAppServerLoggingInterceptor.java b/src/main/java/it/gov/pagopa/wispconverter/util/interceptor/AbstractAppServerLoggingInterceptor.java
index eb1c01ce..affc648c 100644
--- a/src/main/java/it/gov/pagopa/wispconverter/util/interceptor/AbstractAppServerLoggingInterceptor.java
+++ b/src/main/java/it/gov/pagopa/wispconverter/util/interceptor/AbstractAppServerLoggingInterceptor.java
@@ -367,10 +367,12 @@ private void handleMDCSessionContent(HttpServletRequest request, Trace trace) {
String queryString = request.getQueryString();
- // include sessionID in MDC
- Matcher sessionIdMatcher = this.sessionIdPattern.matcher(queryString);
- if (sessionIdMatcher.find()) {
- MDC.put(Constants.MDC_SESSION_ID, sessionIdMatcher.group(1));
+ if(queryString != null) {
+ // include sessionID in MDC
+ Matcher sessionIdMatcher = this.sessionIdPattern.matcher(queryString);
+ if (sessionIdMatcher.find()) {
+ MDC.put(Constants.MDC_SESSION_ID, sessionIdMatcher.group(1));
+ }
}
}
}
diff --git a/src/test/java/it/gov/pagopa/wispconverter/HomeTest.java b/src/test/java/it/gov/pagopa/wispconverter/HomeTest.java
index 41a8db09..9798b749 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/HomeTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/HomeTest.java
@@ -21,8 +21,6 @@
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
-import static org.junit.jupiter.api.Assertions.*;
-
@ActiveProfiles(profiles = "test")
@SpringBootTest(classes = Application.class)
@AutoConfigureMockMvc
@@ -61,7 +59,7 @@ void slash() throws Exception {
void info() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/info").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful()).andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
final String content = result.getResponse().getContentAsString();
diff --git a/src/test/java/it/gov/pagopa/wispconverter/OpenApiGenerationTest.java b/src/test/java/it/gov/pagopa/wispconverter/OpenApiGenerationTest.java
index d66832f4..ba5e4b44 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/OpenApiGenerationTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/OpenApiGenerationTest.java
@@ -59,7 +59,7 @@ void swaggerSpringPlugin() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/v3/api-docs").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
final String content = result.getResponse().getContentAsString();
diff --git a/src/test/java/it/gov/pagopa/wispconverter/ConsumerTest.java b/src/test/java/it/gov/pagopa/wispconverter/consumer/ConsumerTest.java
similarity index 95%
rename from src/test/java/it/gov/pagopa/wispconverter/ConsumerTest.java
rename to src/test/java/it/gov/pagopa/wispconverter/consumer/ConsumerTest.java
index ae8cd4bd..b97567ee 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/ConsumerTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/consumer/ConsumerTest.java
@@ -1,4 +1,4 @@
-package it.gov.pagopa.wispconverter;
+package it.gov.pagopa.wispconverter.consumer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -25,7 +25,7 @@
class ConsumerTest {
@Test
- void ok() throws Exception {
+ void ok() {
ServiceBusReceivedMessageContext messageContext = mock(ServiceBusReceivedMessageContext.class);
ServiceBusReceivedMessage message = mock(ServiceBusReceivedMessage.class);
@@ -54,7 +54,7 @@ void ok() throws Exception {
}
@Test
- void moreThanMax() throws Exception {
+ void moreThanMax() {
ServiceBusReceivedMessageContext messageContext = mock(ServiceBusReceivedMessageContext.class);
ServiceBusReceivedMessage message = mock(ServiceBusReceivedMessage.class);
@@ -84,7 +84,7 @@ void moreThanMax() throws Exception {
}
@Test
- void koSendToPa() throws Exception {
+ void koSendToPa() {
ServiceBusSenderClient serviceBusSenderClient = mock(ServiceBusSenderClient.class);
@@ -114,13 +114,13 @@ void koSendToPa() throws Exception {
rtConsumer.processMessage(messageContext);
- assertEquals(receipt.getRetry(),1);
+ assertEquals(1,receipt.getRetry());
verify(rtRequestRepository,times(1)).save(receipt);
verify(serviceBusSenderClient,times(1)).sendMessage(any());
}
@Test
- public void testprocesserror(){
+ void testprocesserror(){
ServiceBusErrorContext serviceBusErrorContext = mock(ServiceBusErrorContext.class);
when(serviceBusErrorContext.getException())
.thenReturn(new ServiceBusException(new RuntimeException(),ServiceBusErrorSource.UNKNOWN));
@@ -129,7 +129,7 @@ public void testprocesserror(){
assertTrue(true);
}
@Test
- public void testprocesserror2(){
+ void testprocesserror2(){
ServiceBusErrorContext serviceBusErrorContext = mock(ServiceBusErrorContext.class);
when(serviceBusErrorContext.getException())
.thenReturn(new ServiceBusException(new AmqpException(true, AmqpErrorCondition.MESSAGE_LOCK_LOST,"",null),ServiceBusErrorSource.UNKNOWN));
@@ -138,7 +138,7 @@ public void testprocesserror2(){
assertTrue(true);
}
@Test
- public void testprocesserror3(){
+ void testprocesserror3(){
ServiceBusErrorContext serviceBusErrorContext = mock(ServiceBusErrorContext.class);
when(serviceBusErrorContext.getException())
.thenReturn(new ServiceBusException(new AmqpException(true, AmqpErrorCondition.UNAUTHORIZED_ACCESS,"",null),ServiceBusErrorSource.UNKNOWN));
@@ -147,7 +147,7 @@ public void testprocesserror3(){
assertTrue(true);
}
@Test
- public void testprocesserror4(){
+ void testprocesserror4(){
ServiceBusErrorContext serviceBusErrorContext = mock(ServiceBusErrorContext.class);
when(serviceBusErrorContext.getException())
.thenReturn(new ServiceBusException(new AmqpException(true, AmqpErrorCondition.SERVER_BUSY_ERROR,"",null),ServiceBusErrorSource.UNKNOWN));
@@ -156,7 +156,7 @@ public void testprocesserror4(){
assertTrue(true);
}
@Test
- public void testprocesserror5(){
+ void testprocesserror5(){
ServiceBusErrorContext serviceBusErrorContext = mock(ServiceBusErrorContext.class);
when(serviceBusErrorContext.getException())
.thenReturn(
diff --git a/src/test/java/it/gov/pagopa/wispconverter/CarrelloTest.java b/src/test/java/it/gov/pagopa/wispconverter/endpoint/CarrelloTest.java
similarity index 68%
rename from src/test/java/it/gov/pagopa/wispconverter/CarrelloTest.java
rename to src/test/java/it/gov/pagopa/wispconverter/endpoint/CarrelloTest.java
index 4f122c49..686cf2b9 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/CarrelloTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/endpoint/CarrelloTest.java
@@ -1,7 +1,7 @@
-package it.gov.pagopa.wispconverter;
+package it.gov.pagopa.wispconverter.endpoint;
-import static it.gov.pagopa.wispconverter.ConstantsTestHelper.REDIRECT_PATH;
-import static it.gov.pagopa.wispconverter.exception.AppErrorCodeMessageEnum.VALIDATION_INVALID_MULTIBENEFICIARY_CART;
+import static it.gov.pagopa.wispconverter.utils.ConstantsTestHelper.REDIRECT_PATH;
+import static it.gov.pagopa.wispconverter.utils.TestUtils.getPaymentPositionModelDto;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -10,13 +10,18 @@
import com.azure.messaging.servicebus.ServiceBusSenderClient;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto;
+import it.gov.pagopa.wispconverter.Application;
import it.gov.pagopa.wispconverter.repository.RPTRequestRepository;
import it.gov.pagopa.wispconverter.repository.RTRequestRepository;
import it.gov.pagopa.wispconverter.repository.ReEventRepository;
import it.gov.pagopa.wispconverter.repository.model.RPTRequestEntity;
import it.gov.pagopa.wispconverter.service.ConfigCacheService;
import it.gov.pagopa.wispconverter.utils.TestUtils;
+
+import java.net.URI;
import java.util.*;
+
+import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -68,12 +73,14 @@ void success() throws Exception {
org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
HttpHeaders headers = new HttpHeaders();
headers.add("location","locationheader");
- TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).build());
-
+ it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto cartResponseDto = new it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto();
+ cartResponseDto.setCheckoutRedirectUrl(URI.create("http://www.google.com"));
+ TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).body(cartResponseDto));
it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto iuvGenerationModelResponseDto = new IUVGenerationResponseDto();
iuvGenerationModelResponseDto.setIuv("00000000");
TestUtils.setMock(iuveneratorClient,ResponseEntity.ok().body(iuvGenerationModelResponseDto));
- TestUtils.setMock(gpdClient,ResponseEntity.ok().build());
+ TestUtils.setMockGetExceptionNotFound(gpdClient);
+ TestUtils.setMockPost(gpdClient,ResponseEntity.ok().body(getPaymentPositionModelDto()));
TestUtils.setMock(decouplerCachingClient,ResponseEntity.ok().build());
when(rptRequestRepository.findById(any())).thenReturn(
Optional.of(
@@ -90,73 +97,34 @@ void success() throws Exception {
mvc.perform(MockMvcRequestBuilders.get(REDIRECT_PATH + "?sessionId=aaaaaaaaaaaa").accept(MediaType.APPLICATION_JSON))
- .andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
+ .andExpect(MockMvcResultMatchers.status().is(HttpStatus.FOUND.value()))
.andDo(
- (result) -> {
- assertNotNull(result);
- assertNotNull(result.getResponse());
+ result -> {
+ Assert.assertNotNull(result);
+ Assert.assertNotNull(result.getResponse());
});
verify(checkoutClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
verify(iuveneratorClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(gpdClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(decouplerCachingClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- }
-
- @Test
- void success_multibeneficiario() throws Exception {
- String station = "mystation";
- org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
- HttpHeaders headers = new HttpHeaders();
- headers.add("location","locationheader");
- TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).build());
-
- IUVGenerationResponseDto iuvGenerationModelResponseDto = new IUVGenerationResponseDto();
- iuvGenerationModelResponseDto.setIuv("00000000");
- TestUtils.setMock(iuveneratorClient,ResponseEntity.ok().body(iuvGenerationModelResponseDto));
- TestUtils.setMock(gpdClient,ResponseEntity.ok().build());
- TestUtils.setMock(decouplerCachingClient,ResponseEntity.ok().build());
- when(rptRequestRepository.findById(any())).thenReturn(
- Optional.of(
- RPTRequestEntity.builder().primitive("nodoInviaCarrelloRPT")
- .payload(
- TestUtils.zipAndEncode(TestUtils.getCarrelloPayload(2,station,
- "100.00",true
- ))
- ).build()
- )
- );
- when(redisSimpleTemplate.opsForValue()).thenReturn(mock(ValueOperations.class));
-
-
-
- mvc.perform(MockMvcRequestBuilders.get(REDIRECT_PATH + "?sessionId=aaaaaaaaaaaa").accept(MediaType.APPLICATION_JSON))
- .andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
- .andDo(
- (result) -> {
- assertNotNull(result);
- assertNotNull(result.getResponse());
- });
-
- verify(checkoutClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(iuveneratorClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(gpdClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
+ verify(gpdClient,times(2)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
verify(decouplerCachingClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
}
@Test
void fail_multibeneficiario_less_rpts() throws Exception {
String station = "mystation";
- TestUtils.setMock(cacheClient,ResponseEntity.ok().body(TestUtils.configData(station)));
- org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configCacheClient",cacheClient);
+
+ org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
HttpHeaders headers = new HttpHeaders();
headers.add("location","locationheader");
- TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).build());
-
- IUVGenerationResponseDto iuvGenerationModelResponseDto = new IUVGenerationResponseDto();
+ it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto cartResponseDto = new it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto();
+ cartResponseDto.setCheckoutRedirectUrl(URI.create("http://www.google.com"));
+ TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).body(cartResponseDto));
+ it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto iuvGenerationModelResponseDto = new IUVGenerationResponseDto();
iuvGenerationModelResponseDto.setIuv("00000000");
TestUtils.setMock(iuveneratorClient,ResponseEntity.ok().body(iuvGenerationModelResponseDto));
- TestUtils.setMock(gpdClient,ResponseEntity.ok().build());
+ TestUtils.setMockGetExceptionNotFound(gpdClient);
+ TestUtils.setMockPost(gpdClient,ResponseEntity.ok().body(getPaymentPositionModelDto()));
TestUtils.setMock(decouplerCachingClient,ResponseEntity.ok().build());
when(rptRequestRepository.findById(any())).thenReturn(
Optional.of(
@@ -176,7 +144,7 @@ void fail_multibeneficiario_less_rpts() throws Exception {
mvc.perform(MockMvcRequestBuilders.get(REDIRECT_PATH + "?sessionId=aaaaaaaaaaaa").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
assertTrue(result.getResponse().getContentAsString().contains("Riprova, oppure contatta l'assistenza"));
diff --git a/src/test/java/it/gov/pagopa/wispconverter/ReceiptTest.java b/src/test/java/it/gov/pagopa/wispconverter/endpoint/ReceiptTest.java
similarity index 81%
rename from src/test/java/it/gov/pagopa/wispconverter/ReceiptTest.java
rename to src/test/java/it/gov/pagopa/wispconverter/endpoint/ReceiptTest.java
index 77de6e55..30636ab1 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/ReceiptTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/endpoint/ReceiptTest.java
@@ -1,14 +1,13 @@
-package it.gov.pagopa.wispconverter;
+package it.gov.pagopa.wispconverter.endpoint;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import com.azure.cosmos.CosmosClientBuilder;
import com.azure.messaging.servicebus.ServiceBusSenderClient;
import com.fasterxml.jackson.databind.ObjectMapper;
-import gov.telematici.pagamenti.ws.papernodo.PaaInviaRTRisposta;
+import it.gov.pagopa.wispconverter.Application;
import it.gov.pagopa.wispconverter.controller.model.ReceiptRequest;
import it.gov.pagopa.wispconverter.exception.PaaInviaRTException;
import it.gov.pagopa.wispconverter.repository.CacheRepository;
@@ -21,13 +20,9 @@
import it.gov.pagopa.wispconverter.service.PaaInviaRTServiceBusService;
import it.gov.pagopa.wispconverter.service.model.ReceiptDto;
import it.gov.pagopa.wispconverter.utils.TestUtils;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
import java.util.Optional;
import java.util.UUID;
-import java.util.zip.GZIPOutputStream;
import org.junit.jupiter.api.Test;
-import org.mockito.Mock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@@ -84,29 +79,21 @@ private String getPaSendRTPayload(){
return pasendrtv2;
}
- private byte[] zip(byte[] uncompressed) throws IOException {
- ByteArrayOutputStream bais = new ByteArrayOutputStream();
- GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bais);
- gzipOutputStream.write(uncompressed);
- gzipOutputStream.close();
- bais.close();
- return bais.toByteArray();
- }
-
@Test
void success_positive() throws Exception {
String station = "mystation";
org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
- when(rptRequestRepository.findById(any())).thenReturn(
+
+ when(rptRequestRepository.findById(anyString())).thenReturn(
Optional.of(
- RPTRequestEntity.builder().primitive("nodoInviaRPT")
- .payload(
- TestUtils.zipAndEncode(TestUtils.getRptPayload(false,station,"100.00","datispec"))
- ).build()
+ RPTRequestEntity.builder()
+ .primitive("nodoInviaRPT")
+ .payload(TestUtils.zipAndEncode(TestUtils.getRptPayload(false,station,"100.00","datispec")))
+ .build()
)
);
- when(cacheRepository.read(any(),any())).thenReturn("asdsad");
+ when(cacheRepository.read(anyString(),any())).thenReturn("wisp_nav2iuv_dominio");
mvc.perform(MockMvcRequestBuilders.post("/receipt/ok")
.accept(MediaType.APPLICATION_JSON)
@@ -114,13 +101,11 @@ void success_positive() throws Exception {
.content(objectMapper.writeValueAsString(new ReceiptRequest(getPaSendRTPayload()))))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
});
-
- verify(reEventRepository,times(5)).save(any());
}
@Test
@@ -128,12 +113,13 @@ void success_negative() throws Exception {
String station = "mystation";
org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
- when(rptRequestRepository.findById(any())).thenReturn(Optional.of(RPTRequestEntity
- .builder()
+ when(rptRequestRepository.findById(any()))
+ .thenReturn(Optional.of(RPTRequestEntity.builder()
.id(UUID.randomUUID().toString())
.primitive("nodoInviaRPT")
.payload(TestUtils.zipAndEncode(TestUtils.getRptPayload(false,"mystation","10.00","dati")))
- .build()));
+ .build()
+ ));
when(cacheRepository.read(any(),any())).thenReturn("wisp_nav2iuv_dominio");
ReceiptDto[] receiptDtos = {
@@ -145,12 +131,10 @@ void success_negative() throws Exception {
.content(objectMapper.writeValueAsString(new ReceiptRequest(objectMapper.writeValueAsString(receiptDtos)))))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
});
-
- verify(reEventRepository,times(5)).save(any());
}
@Test
@@ -166,8 +150,8 @@ void error_send_rt() throws Exception {
).build()
)
);
- when(cacheRepository.read(any(),any())).thenReturn("asdsad");
- doThrow(new PaaInviaRTException("PAA_ERRORE_RESPONSE","PAA_ERRORE_RESPONSE","Errore PA")).doNothing().when(paaInviaRTService).send(anyString(), anyString());
+ when(cacheRepository.read(any(),any())).thenReturn("wisp_nav2iuv_dominio");
+ doThrow(new PaaInviaRTException("PAA_ERRORE_RESPONSE","PAA_ERRORE_RESPONSE","Errore PA")).when(paaInviaRTService).send(anyString(), anyString());
mvc.perform(MockMvcRequestBuilders.post("/receipt/ok")
.accept(MediaType.APPLICATION_JSON)
@@ -175,13 +159,12 @@ void error_send_rt() throws Exception {
.content(objectMapper.writeValueAsString(new ReceiptRequest(getPaSendRTPayload()))))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
});
verify(paaInviaRTService, times(1)).send(anyString(), anyString());
- verify(reEventRepository,times(6)).save(any());
}
@Test
@@ -197,23 +180,20 @@ void error_send_rt2() throws Exception {
).build()
)
);
- when(cacheRepository.read(any(),any())).thenReturn("asdsad");
- doAnswer((i) -> {
- return new ResponseEntity<>(HttpStatusCode.valueOf(200));
- }).when(paaInviaRTService).send(anyString(), anyString());
+ when(cacheRepository.read(any(),any())).thenReturn("wisp_nav2iuv_dominio");
+ doAnswer(i -> new ResponseEntity<>(HttpStatusCode.valueOf(200))).when(paaInviaRTService).send(anyString(), anyString());
mvc.perform(MockMvcRequestBuilders.post("/receipt/ok")
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
.content(objectMapper.writeValueAsString(new ReceiptRequest(getPaSendRTPayload()))))
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful())
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
});
verify(paaInviaRTService, times(1)).send(anyString(), anyString());
- verify(reEventRepository,times(5)).save(any());
}
}
diff --git a/src/test/java/it/gov/pagopa/wispconverter/RptTest.java b/src/test/java/it/gov/pagopa/wispconverter/endpoint/RptTest.java
similarity index 57%
rename from src/test/java/it/gov/pagopa/wispconverter/RptTest.java
rename to src/test/java/it/gov/pagopa/wispconverter/endpoint/RptTest.java
index c00324af..54b7b6cb 100644
--- a/src/test/java/it/gov/pagopa/wispconverter/RptTest.java
+++ b/src/test/java/it/gov/pagopa/wispconverter/endpoint/RptTest.java
@@ -1,13 +1,18 @@
-package it.gov.pagopa.wispconverter;
+package it.gov.pagopa.wispconverter.endpoint;
-import static it.gov.pagopa.wispconverter.ConstantsTestHelper.REDIRECT_PATH;
+import static it.gov.pagopa.wispconverter.utils.ConstantsTestHelper.REDIRECT_PATH;
+import static it.gov.pagopa.wispconverter.utils.TestUtils.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import com.azure.messaging.servicebus.ServiceBusSenderClient;
import com.fasterxml.jackson.databind.ObjectMapper;
+import it.gov.pagopa.gen.wispconverter.client.cache.model.StationCreditorInstitutionDto;
import it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto;
import it.gov.pagopa.gen.wispconverter.client.gpd.model.MultiplePaymentPositionModelDto;
+import it.gov.pagopa.gen.wispconverter.client.gpd.model.PaymentPositionModelDto;
+import it.gov.pagopa.wispconverter.Application;
+import it.gov.pagopa.wispconverter.repository.CacheRepository;
import it.gov.pagopa.wispconverter.repository.RPTRequestRepository;
import it.gov.pagopa.wispconverter.repository.RTRequestRepository;
import it.gov.pagopa.wispconverter.repository.ReEventRepository;
@@ -54,7 +59,7 @@ class RptTest {
@MockBean
private RTRequestRepository rtRequestRepository;
- @MockBean private it.gov.pagopa.gen.wispconverter.client.iuvgenerator.invoker.ApiClient iuveneratorClient;
+ @MockBean private it.gov.pagopa.gen.wispconverter.client.iuvgenerator.invoker.ApiClient iuvGeneratorClient;
@MockBean private it.gov.pagopa.gen.wispconverter.client.gpd.invoker.ApiClient gpdClient;
@MockBean private it.gov.pagopa.gen.wispconverter.client.checkout.invoker.ApiClient checkoutClient;
@MockBean private it.gov.pagopa.gen.wispconverter.client.cache.invoker.ApiClient cacheClient;
@@ -65,21 +70,24 @@ class RptTest {
private ReEventRepository reEventRepository;
@MockBean
private ServiceBusSenderClient serviceBusSenderClient;
+ @MockBean
+ private CacheRepository cacheRepository;
@Test
- void success() throws Exception {
+ void success_debtPositionUpdateValid() throws Exception {
String station = "mystation";
- org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configData(station));
+ StationCreditorInstitutionDto stationCreditorInstitutionDto = new StationCreditorInstitutionDto();
+ stationCreditorInstitutionDto.setCreditorInstitutionCode("{pa}");
+ stationCreditorInstitutionDto.setSegregationCode(12L);
+ stationCreditorInstitutionDto.setStationCode(station);
+ org.springframework.test.util.ReflectionTestUtils.setField(configCacheService, "configData",TestUtils.configDataCreditorInstitutionStations(stationCreditorInstitutionDto));
HttpHeaders headers = new HttpHeaders();
headers.add("location","locationheader");
it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto cartResponseDto = new it.gov.pagopa.gen.wispconverter.client.checkout.model.CartResponseDto();
cartResponseDto.setCheckoutRedirectUrl(URI.create("http://www.google.com"));
TestUtils.setMock(checkoutClient, ResponseEntity.status(HttpStatus.FOUND).headers(headers).body(cartResponseDto));
-
- it.gov.pagopa.gen.wispconverter.client.iuvgenerator.model.IUVGenerationResponseDto iuvGenerationModelResponseDto = new IUVGenerationResponseDto();
- iuvGenerationModelResponseDto.setIuv("00000000");
- TestUtils.setMock(iuveneratorClient,ResponseEntity.ok().body(iuvGenerationModelResponseDto));
- TestUtils.setMock(gpdClient,ResponseEntity.ok().build());
+ TestUtils.setMockGet(gpdClient,ResponseEntity.ok().body(getValidPaymentPositionModelBaseResponseDto()));
+ TestUtils.setMockPut(gpdClient,ResponseEntity.ok().body(getPaymentPositionModelDto()));
TestUtils.setMock(decouplerCachingClient,ResponseEntity.ok().build());
when(rptRequestRepository.findById(any())).thenReturn(
Optional.of(
@@ -94,39 +102,84 @@ void success() throws Exception {
mvc.perform(MockMvcRequestBuilders.get(REDIRECT_PATH + "?sessionId=aaaaaaaaaaaa").accept(MediaType.APPLICATION_JSON))
.andExpect(MockMvcResultMatchers.status().is(HttpStatus.FOUND.value()))
.andDo(
- (result) -> {
+ result -> {
assertNotNull(result);
assertNotNull(result.getResponse());
});
verify(checkoutClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(iuveneratorClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
- verify(gpdClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
+ verify(gpdClient,times(2)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
verify(decouplerCachingClient,times(1)).invokeAPI(any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any(),any());
ArgumentCaptor