From 53950c0c6962a412978fd6a20204cac756981579 Mon Sep 17 00:00:00 2001 From: gioelemella <128155546+gioelemella@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:08:23 +0200 Subject: [PATCH 1/4] Next release 2.23.0 (#488) Co-authored-by: Jacopo Carlini Co-authored-by: pagopa-github-bot Co-authored-by: Samuele Varianti <128470180+svariant@users.noreply.github.com> Co-authored-by: Alessio Cialini <63233981+alessio-cialini@users.noreply.github.com> Co-authored-by: svariant Co-authored-by: Alessio Cialini Co-authored-by: renovate-pagopa[bot] <164534245+renovate-pagopa[bot]@users.noreply.github.com> Co-authored-by: giomella --- helm/Chart.yaml | 4 +- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 212 +++++++++++++++- pom.xml | 2 +- .../pagopa/backoffice/client/GecClient.java | 10 + .../CommissionBundleController.java | 89 ++++++- ...issionBundleMailNotificationScheduler.java | 46 ++-- .../scheduler/function/BundleAllPages.java | 54 +++- .../service/AsyncNotificationService.java | 19 +- .../service/CommissionBundleService.java | 61 ++++- .../backoffice/service/ExportService.java | 103 +++++++- .../backoffice/util/MailTextConstants.java | 6 +- .../templates/expiringBundleEmail.html | 5 +- .../CommissionBundleControllerTest.java | 233 ++++++------------ .../function/BundleAllPagesTest.java | 64 ++++- .../service/AsyncNotificationServiceTest.java | 19 +- .../service/CommissionBundleServiceTest.java | 32 ++- .../backoffice/service/ExportServiceTest.java | 49 +++- 20 files changed, 751 insertions(+), 263 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 922a84cca..3656f9f7a 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-selfcare-ms-backoffice description: Microservice that manage api keys for pagopa product from selfcare type: application -version: 0.387.0 -appVersion: "2.22.0" +version: 0.390.0 +appVersion: "2.20.0-8-next" dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 1623045be..92f25cf32 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.22.0" + tag: "2.20.0-8-next" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 51b9b0c9c..d333fa9c4 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.22.0" #improve + tag: "2.20.0-8-next" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index dc3722579..b0f8d56e4 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.22.0" #improve + tag: "2.20.0-8-next" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index e5cca02cc..64c98f201 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "description": "Microservice to manage PagoPA Backoffice", "termsOfService": "https://www.pagopa.gov.it/", "title": "SelfCare Backoffice", - "version": "2.22.0" + "version": "2.20.0-8-next" }, "servers": [ { @@ -2876,6 +2876,84 @@ "schema": { "type": "string" } + }, + { + "description": "Order bundles by maxPaymentAmount", + "example": "ASC", + "in": "query", + "name": "maxPaymentAmountOrder", + "required": false, + "schema": { + "type": "string", + "enum": [ + "ASC", + "DESC" + ] + } + }, + { + "description": "Filter bundles with paymentAmount less than", + "in": "query", + "name": "paymentAmountMinRange", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "description": "Filter bundles with paymentAmount more than", + "in": "query", + "name": "paymentAmountMaxRange", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "description": "Validity date of bundles, used to retrieve all bundles valid before the specified date (yyyy-MM-dd)", + "example": "2024-05-10", + "in": "query", + "name": "validBefore", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "description": "Validity date of bundles, used to retrieve all bundles valid after the specified date (yyyy-MM-dd)", + "example": "2024-05-10", + "in": "query", + "name": "validAfter", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "description": "Validity date of bundles, used to retrieve all bundles that expire before the specified date (yyyy-MM-dd)", + "example": "2024-05-10", + "in": "query", + "name": "expireBefore", + "required": false, + "schema": { + "type": "string", + "format": "date" + } + }, + { + "description": "Validity date of bundles, used to retrieve all bundles that expire after the specified date (yyyy-MM-dd)", + "example": "2024-05-10", + "in": "query", + "name": "expireAfter", + "required": false, + "schema": { + "type": "string", + "format": "date" + } } ], "responses": { @@ -3049,6 +3127,138 @@ ] } }, + "/bundles/payment-service-providers/{psp-tax-code}/export": { + "get": { + "description": "Internal | External | Synchronous | Authorization | Authentication | TPS | Idempotency | Stateless | Read/Write Intense | Cacheable\n-|-|-|-|-|-|-|-|-|-\nY | N | Y | JWT | JWT | 1.0/sec | Y | Y | Read | Y\n", + "operationId": "exportPSPBundleList", + "parameters": [ + { + "description": "Tax code of the payment service provider", + "in": "path", + "name": "psp-tax-code", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "Commission bundle's type", + "in": "query", + "name": "bundleTypeList", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "GLOBAL", + "PUBLIC", + "PRIVATE" + ] + } + } + } + ], + "responses": { + "200": { + "content": { + "text/csv": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "description": "OK", + "headers": { + "X-Request-Id": { + "description": "This header identifies the call", + "schema": { + "type": "string" + } + } + } + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemJson" + } + } + }, + "description": "Bad Request", + "headers": { + "X-Request-Id": { + "description": "This header identifies the call", + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Unauthorized", + "headers": { + "X-Request-Id": { + "description": "This header identifies the call", + "schema": { + "type": "string" + } + } + } + }, + "429": { + "description": "Too many requests", + "headers": { + "X-Request-Id": { + "description": "This header identifies the call", + "schema": { + "type": "string" + } + } + } + }, + "500": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemJson" + } + } + }, + "description": "Service unavailable", + "headers": { + "X-Request-Id": { + "description": "This header identifies the call", + "schema": { + "type": "string" + } + } + } + } + }, + "security": [ + { + "JWT": [] + } + ], + "summary": "Export all commission bundle related to a PSP", + "tags": [ + "Commission bundles" + ] + }, + "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" + } + } + ] + }, "/bundles/payment-service-providers/{psp-tax-code}/requests/{bundle-request-id}/accept": { "parameters": [ { diff --git a/pom.xml b/pom.xml index 444e1e8a2..a4a606c7d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 2.5.14 pagopa-selfcare-ms-backoffice - 2.22.0 + 2.20.0-8-next SelfCare Backoffice Microservice to manage PagoPA Backoffice diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/client/GecClient.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/client/GecClient.java index 925fb1d1e..a99be255b 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/client/GecClient.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/client/GecClient.java @@ -22,6 +22,8 @@ import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.PublicBundleRequests; import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.TouchpointsDTO; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.data.domain.Sort; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.MediaType; import org.springframework.retry.annotation.Backoff; import org.springframework.retry.annotation.Retryable; @@ -36,6 +38,7 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; +import java.time.LocalDate; import java.util.List; @FeignClient(name = "gec", url = "${rest-client.gec.base-url}", configuration = GecFeignConfig.class) @@ -67,6 +70,13 @@ Bundles getBundlesByPSP( @PathVariable("psp-code") String pspCode, @RequestParam(required = false) List types, @RequestParam(required = false) String name, + @RequestParam(required = false) Sort.Direction maxPaymentAmountOrder, + @RequestParam(required = false) Long paymentAmountMinRange, + @RequestParam(required = false) Long paymentAmountMaxRange, + @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate validBefore, + @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate validAfter, + @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate expireBefore, + @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate expireAfter, @RequestParam(required = false) Integer limit, @RequestParam(required = false) Integer page ); diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/CommissionBundleController.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/CommissionBundleController.java index 3f3516103..900e4b2da 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/CommissionBundleController.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/controller/CommissionBundleController.java @@ -9,18 +9,49 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import it.pagopa.selfcare.pagopa.backoffice.model.ProblemJson; -import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.*; -import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.*; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.BundlePaymentTypes; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.BundleSubscriptionStatus; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.CIBundleAttributeResource; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.CIBundleSubscriptionsDetail; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.CIBundleSubscriptionsResource; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.CIBundlesResource; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.PSPBundleResource; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.PSPBundlesResource; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.Touchpoints; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleCreateResponse; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleRequest; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleType; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.CIBundleId; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.CiTaxCodeList; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.PublicBundleRequest; import it.pagopa.selfcare.pagopa.backoffice.service.CommissionBundleService; import it.pagopa.selfcare.pagopa.backoffice.util.OpenApiTableMetadata; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ByteArrayResource; +import org.springframework.core.io.Resource; +import org.springframework.data.domain.Sort; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; @Slf4j @@ -98,9 +129,16 @@ public PSPBundlesResource getBundlesByPSP( @Parameter(description = "Commission bundle's type") @RequestParam(name = "bundle-type", required = false) List bundleType, @Parameter(description = "Page number. Page value starts from 0") @RequestParam(required = false, defaultValue = "0") Integer page, @Parameter(description = "Tax code of the payment service provider") @PathVariable("psp-tax-code") String pspTaxCode, - @Parameter(description = "Commission bundle's name") @RequestParam(required = false) String name + @Parameter(description = "Commission bundle's name") @RequestParam(required = false) String name, + @Parameter(description = "Order bundles by maxPaymentAmount", example = "ASC") @RequestParam(required = false) Sort.Direction maxPaymentAmountOrder, + @Parameter(description = "Filter bundles with paymentAmount less than") @RequestParam(required = false) Long paymentAmountMinRange, + @Parameter(description = "Filter bundles with paymentAmount more than") @RequestParam(required = false) Long paymentAmountMaxRange, + @Parameter(description = "Validity date of bundles, used to retrieve all bundles valid before the specified date (yyyy-MM-dd)", example = "2024-05-10") @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate validBefore, + @Parameter(description = "Validity date of bundles, used to retrieve all bundles valid after the specified date (yyyy-MM-dd)", example = "2024-05-10") @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate validAfter, + @Parameter(description = "Validity date of bundles, used to retrieve all bundles that expire before the specified date (yyyy-MM-dd)", example = "2024-05-10") @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate expireBefore, + @Parameter(description = "Validity date of bundles, used to retrieve all bundles that expire after the specified date (yyyy-MM-dd)", example = "2024-05-10") @RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate expireAfter ) { - return this.commissionBundleService.getBundlesByPSP(pspTaxCode, bundleType, name, limit, page); + return this.commissionBundleService.getBundlesByPSP(pspTaxCode, bundleType, name, maxPaymentAmountOrder, paymentAmountMinRange, paymentAmountMaxRange, validBefore, validAfter, expireBefore, expireAfter, limit, page); } @PostMapping(value = "/payment-service-providers/{psp-tax-code}", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) @@ -494,4 +532,45 @@ public void rejectPrivateBundleOffer( this.commissionBundleService.rejectPrivateBundleOffer(ciTaxCode, idBundleOffer, pspTaxCode, bundleName); } + @GetMapping(value = "/payment-service-providers/{psp-tax-code}/export", produces = "text/csv") + @ResponseStatus(HttpStatus.OK) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "text/csv", schema = @Schema(type = "string", format = "binary"))), + @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema())), + @ApiResponse(responseCode = "429", description = "Too many requests", content = @Content(schema = @Schema())), + @ApiResponse(responseCode = "500", description = "Service unavailable", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, schema = @Schema(implementation = ProblemJson.class))) + }) + @Operation(summary = "Export all commission bundle related to a PSP", security = {@SecurityRequirement(name = "JWT")}) + @OpenApiTableMetadata(readWriteIntense = OpenApiTableMetadata.ReadWrite.READ, cacheable = true) + public ResponseEntity exportPSPBundleList( + @Parameter(description = "Tax code of the payment service provider") @PathVariable("psp-tax-code") String pspTaxCode, + @Parameter(description = "Commission bundle's type") @RequestParam List bundleTypeList + ) { + byte[] file = this.commissionBundleService.exportPSPBundleList(pspTaxCode, bundleTypeList); + + String fileNameHeader = String.format("attachment; filename=%s_%s_%s_bundle-export.csv", + pspTaxCode, mapBundleType(bundleTypeList), LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); + + return ResponseEntity.ok() + .header(HttpHeaders.CONTENT_DISPOSITION, fileNameHeader) + .contentType(MediaType.parseMediaType("text/csv")) + .body(new ByteArrayResource(file)); + } + + private String mapBundleType(List bundleTypeList) { + if (bundleTypeList.size() == 3) { + return "tutti"; + } + if (BundleType.GLOBAL.equals(bundleTypeList.get(0))) { + return "per-tutti"; + } + if (BundleType.PUBLIC.equals(bundleTypeList.get(0))) { + return "su-richiesta"; + } + if (BundleType.PRIVATE.equals(bundleTypeList.get(0))) { + return "su-invito"; + } + return ""; + } } diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/CommissionBundleMailNotificationScheduler.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/CommissionBundleMailNotificationScheduler.java index c9fb7065f..51a4d39e3 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/CommissionBundleMailNotificationScheduler.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/CommissionBundleMailNotificationScheduler.java @@ -89,36 +89,31 @@ private void notify(LocalDate date) { expireAt ); - // notify CI - log.info("[Mail-Notification] CI mail notification starting"); + log.info("[Mail-Notification] Mail notification starting"); expiringBundles.parallelStream() - .forEach(bundle -> - this.bundleAllPages - .getAllCITaxCodesAssociatedToABundle(bundle.getId(), bundle.getType(), bundle.getIdPsp()).parallelStream() - .forEach(ciTaxCode -> sendMail(expireAt, bundle, ciTaxCode)) - ); - - // notify PSP - log.info("[Mail-Notification] CI mail notification completed, PSP notification starting"); - expiringBundles.parallelStream().forEach( - bundle -> { + .forEach(bundle -> { String pspTaxCode = getPspTaxCode(bundle); + // notify CI + this.bundleAllPages + .getAllCITaxCodesAssociatedToABundle(bundle.getId(), bundle.getType(), bundle.getIdPsp()).parallelStream() + .forEach(ciTaxCode -> sendMail(expireAt, bundle, ciTaxCode, pspTaxCode)); + + // notify PSP if (pspTaxCode != null) { - sendMail(expireAt, bundle, pspTaxCode); + sendMail(expireAt, bundle, pspTaxCode, pspTaxCode); } - } - ); - log.info("[Mail-Notification] PSP mail notification completed, Email notification completed for expiring bundle in {} days", + }); + log.info("[Mail-Notification] Mail notification completed for expiring bundle in {} days", expireAt); } - private void sendMail(String expireAt, Bundle bundle, String taxCode) { + private void sendMail(String expireAt, Bundle bundle, String notifyTaxCode, String pspTaxCode) { EmailMessageDetail messageDetail = EmailMessageDetail.builder() - .institutionTaxCode(taxCode) + .institutionTaxCode(notifyTaxCode) .subject(BUNDLE_EXPIRE_SUBJECT) - .textBody(String.format(BUNDLE_EXPIRE_BODY, bundle.getName(), expireAt)) - .htmlBodyFileName("deleteBundleEmail.html") - .htmlBodyContext(buildEmailHtmlBodyContext(bundle.getName(), expireAt)) + .textBody(String.format(BUNDLE_EXPIRE_BODY, bundle.getName(), bundle.getPspBusinessName(), pspTaxCode, expireAt)) + .htmlBodyFileName("expiringBundleEmail.html") + .htmlBodyContext(buildEmailHtmlBodyContext(bundle.getName(), bundle.getPspBusinessName(), pspTaxCode, expireAt)) .destinationUserType(SelfcareProductUser.ADMIN) .build(); this.awsSesClient.sendEmail(messageDetail, true); @@ -134,13 +129,20 @@ private String getPspTaxCode(Bundle bundle) { } } - private Context buildEmailHtmlBodyContext(String bundleName, String expireAt) { + private Context buildEmailHtmlBodyContext( + String bundleName, + String pspBusinessName, + String pspTaxCode, + String expireAt + ) { // Thymeleaf Context Context context = new Context(); // Properties to show up in Template after stored in Context Map properties = new HashMap<>(); properties.put("bundleName", bundleName); + properties.put("pspName", pspBusinessName); + properties.put("pspTaxCode", pspTaxCode); properties.put("expireAt", expireAt); context.setVariables(properties); diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPages.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPages.java index 62ac08a98..57f35b6c5 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPages.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPages.java @@ -101,7 +101,7 @@ public Set getBundleSubscriptionByPSP(String pspCode, String idBundle) { @Cacheable(value = "getPublicBundleSubscriptionRequestByPSP") public Set getPublicBundleSubscriptionRequestByPSP(String pspCode, String idBundle) { Map mdcContextMap = MDC.getCopyOfContextMap(); - PublicBundleRequests bundles = this.gecClient.getPublicBundleSubscriptionRequestByPSP(pspCode, idBundle, null, 1, 0); + PublicBundleRequests bundles = this.gecClient.getPublicBundleSubscriptionRequestByPSP(pspCode, null, idBundle, 1, 0); int numberOfPages = (int) Math.floor((double) bundles.getPageInfo().getTotalItems() / getAllBundlesPageLimit); List>> futures = new LinkedList<>(); @@ -113,7 +113,7 @@ public Set getPublicBundleSubscriptionRequestByPSP(String pspCode, Strin } return IntStream.rangeClosed(0, numberOfPages) .parallel() - .mapToObj(page -> this.gecClient.getPublicBundleSubscriptionRequestByPSP(pspCode, idBundle, null, getAllBundlesPageLimit, page)) + .mapToObj(page -> this.gecClient.getPublicBundleSubscriptionRequestByPSP(pspCode, null, idBundle, getAllBundlesPageLimit, page)) .flatMap(response -> response.getRequestsList().stream()) .map(PublicBundleRequest::getCiFiscalCode) .collect(Collectors.toSet()); @@ -127,7 +127,7 @@ public Set getPublicBundleSubscriptionRequestByPSP(String pspCode, Strin @Cacheable(value = "getPrivateBundleOffersByPSP") public Set getPrivateBundleOffersByPSP(String pspCode, String idBundle) { Map mdcContextMap = MDC.getCopyOfContextMap(); - BundleOffers bundles = this.gecClient.getPrivateBundleOffersByPSP(pspCode, idBundle, null, 1, 0); + BundleOffers bundles = this.gecClient.getPrivateBundleOffersByPSP(pspCode, null, idBundle, 1, 0); int numberOfPages = (int) Math.floor((double) bundles.getPageInfo().getTotalItems() / getAllBundlesPageLimit); List>> futures = new LinkedList<>(); @@ -139,7 +139,7 @@ public Set getPrivateBundleOffersByPSP(String pspCode, String idBundle) } return IntStream.rangeClosed(0, numberOfPages) .parallel() - .mapToObj(page -> this.gecClient.getPrivateBundleOffersByPSP(pspCode, idBundle, null, getAllBundlesPageLimit, page)) + .mapToObj(page -> this.gecClient.getPrivateBundleOffersByPSP(pspCode, null, idBundle, getAllBundlesPageLimit, page)) .flatMap(response -> response.getOffers().stream()) .map(PspBundleOffer::getCiFiscalCode) .collect(Collectors.toSet()); @@ -150,6 +150,36 @@ public Set getPrivateBundleOffersByPSP(String pspCode, String idBundle) return joinFutures(futures); } + @Cacheable(value = "getAllPSPBundles") + public Set getAllPSPBundles(String pspCode, List bundleTypeList) { + Map mdcContextMap = MDC.getCopyOfContextMap(); + Bundles bundles = getAllPSPBundles(pspCode, bundleTypeList, 1, 0); + int numberOfPages = (int) Math.floor((double) bundles.getPageInfo().getTotalItems() / getAllBundlesPageLimit); + + List>> futures = new LinkedList<>(); + + // create parallel calls + CompletableFuture> future = CompletableFuture.supplyAsync(() -> { + if (mdcContextMap != null) { + MDC.setContextMap(mdcContextMap); + } + return IntStream.rangeClosed(0, numberOfPages) + .parallel() + .mapToObj(page -> getAllPSPBundles(pspCode, bundleTypeList, getAllBundlesPageLimit, page)) + .flatMap(response -> response.getBundleList().stream()) + .collect(Collectors.toSet()); + }); + futures.add(future); + + // join parallel calls + return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .thenApply(e -> futures.stream() + .map(CompletableFuture::join) + .flatMap(Collection::stream) + .collect(Collectors.toSet())) + .join(); + } + /** * Retrieve a list of creditor institution tax codes that have an active subscription or a request/offer to the * specified bundle @@ -183,6 +213,22 @@ private Bundles getAllExpiringBundles(String expireAt, Integer getAllBundlesWith page); } + private Bundles getAllPSPBundles(String pspCode, List bundleTypeList, Integer getAllBundlesWithExpireDatePageLimit, int page) { + return this.gecClient.getBundlesByPSP( + pspCode, + bundleTypeList, + null, + null, + null, + null, + null, + null, + null, + null, + getAllBundlesWithExpireDatePageLimit, + page); + } + private Set joinFutures(List>> futures) { return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) .thenApply(e -> futures.stream() diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationService.java index 53b40f246..5009c2b51 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationService.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationService.java @@ -1,10 +1,8 @@ package it.pagopa.selfcare.pagopa.backoffice.service; import it.pagopa.selfcare.pagopa.backoffice.client.AwsSesClient; -import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleType; import it.pagopa.selfcare.pagopa.backoffice.model.email.EmailMessageDetail; import it.pagopa.selfcare.pagopa.backoffice.model.institutions.SelfcareProductUser; -import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; @@ -19,12 +17,9 @@ @Service public class AsyncNotificationService { - private final BundleAllPages bundleAllPages; - private final AwsSesClient awsSesClient; - public AsyncNotificationService(BundleAllPages bundleAllPages, AwsSesClient awsSesClient) { - this.bundleAllPages = bundleAllPages; + public AsyncNotificationService(AwsSesClient awsSesClient) { this.awsSesClient = awsSesClient; } @@ -32,22 +27,16 @@ public AsyncNotificationService(BundleAllPages bundleAllPages, AwsSesClient awsS * Notify all creditor institutions that have an active subscription or a request/offer to the * specified bundle * - * @param pspCode payment service provider code - * @param idBundle bundle identifier + * @param ciTaxCodes set of tax codes to be notified * @param bundleName bundle name * @param pspName payment service provider name - * @param bundleType bundle type */ @Async public void notifyDeletePSPBundleAsync( - String pspCode, - String idBundle, + Set ciTaxCodes, String bundleName, - String pspName, - BundleType bundleType + String pspName ) { - Set ciTaxCodes = this.bundleAllPages.getAllCITaxCodesAssociatedToABundle(idBundle, bundleType, pspCode); - Context bodyContext = buildEmailHtmlBodyContext(bundleName, pspName); ciTaxCodes.parallelStream().forEach( ciTaxCode -> { diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleService.java index b6a3a31cb..8b4452537 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleService.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleService.java @@ -14,11 +14,13 @@ import it.pagopa.selfcare.pagopa.backoffice.model.email.EmailMessageDetail; import it.pagopa.selfcare.pagopa.backoffice.model.institutions.SelfcareProductUser; import it.pagopa.selfcare.pagopa.backoffice.model.taxonomies.Taxonomy; +import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; import it.pagopa.selfcare.pagopa.backoffice.util.LegacyPspCodeUtil; import lombok.extern.slf4j.Slf4j; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; @@ -56,6 +58,10 @@ public class CommissionBundleService { private final JiraServiceManagerClient jiraServiceManagerClient; + private final ExportService exportService; + + private final BundleAllPages bundleAllPages; + @Autowired public CommissionBundleService( GecClient gecClient, @@ -65,7 +71,10 @@ public CommissionBundleService( ApiConfigSelfcareIntegrationClient apiConfigSelfcareIntegrationClient, AwsSesClient awsSesClient, AsyncNotificationService asyncNotificationService, - JiraServiceManagerClient jiraServiceManagerClient) { + JiraServiceManagerClient jiraServiceManagerClient, + ExportService exportService, + BundleAllPages bundleAllPages + ) { this.gecClient = gecClient; this.modelMapper = modelMapper; this.taxonomyService = taxonomyService; @@ -74,6 +83,8 @@ public CommissionBundleService( this.awsSesClient = awsSesClient; this.asyncNotificationService = asyncNotificationService; this.jiraServiceManagerClient = jiraServiceManagerClient; + this.exportService = exportService; + this.bundleAllPages = bundleAllPages; } public BundlePaymentTypes getBundlesPaymentTypes(Integer limit, Integer page) { @@ -86,14 +97,38 @@ public Touchpoints getTouchpoints(Integer limit, Integer page) { return modelMapper.map(dto, Touchpoints.class); } + /** + * Retrieve bundles' list by PSP tax code + * @param pspTaxCode PSP's tax code + * @param name bundle name + * @param bundleType list of bundle types + * @param maxPaymentAmountOrder direction to order the list based on the bundle's maxPaymentAmount + * @param paymentAmountMinRange filters bundles with paymentAmount more than paymentAmountMinRange + * @param paymentAmountMaxRange filters bundles with paymentAmount less than paymentAmountMaxRange + * @param validBefore filters bundles with validityDateFrom before the value of validBefore + * @param validAfter filters bundles with validityDateFrom after the value of validAfter + * @param expireBefore filters bundles with validityDateTo before the value of expireBefore + * @param expireAfter filters bundles with validityDateTo after the value of expireAfter + * @param page page's number for pagination + * @param limit maximum number of elements for page + * @return list of bundles ordered and filtered + */ public PSPBundlesResource getBundlesByPSP( String pspTaxCode, List bundleType, - String name, Integer limit, + String name, + Sort.Direction maxPaymentAmountOrder, + Long paymentAmountMinRange, + Long paymentAmountMaxRange, + LocalDate validBefore, + LocalDate validAfter, + LocalDate expireBefore, + LocalDate expireAfter, + Integer limit, Integer page ) { String pspCode = this.legacyPspCodeUtil.retrievePspCode(pspTaxCode, true); - Bundles bundles = this.gecClient.getBundlesByPSP(pspCode, bundleType, name, limit, page); + Bundles bundles = this.gecClient.getBundlesByPSP(pspCode, bundleType, name, maxPaymentAmountOrder, paymentAmountMinRange, paymentAmountMaxRange, validBefore, validAfter, expireBefore, expireAfter, limit, page); List bundlesResource = new ArrayList<>(); if (bundles.getBundleList() != null) { bundlesResource = getPSPBundlesResource(bundles); @@ -109,7 +144,7 @@ public BundleCreateResponse createPSPBundle(String pspTaxCode, BundleRequest bun jiraServiceManagerClient.createTicket( String.format(SUBJECT_NEW_BUNDLE_GEC, bundle.getPspBusinessName()), String.format(DETAIL_NEW_BUNDLE_GEC, - bundle.getName(), bundle.getPspBusinessName(), pspTaxCode, deNull(bundle.getValidityDateFrom()), url,result.getIdBundle()) + bundle.getName(), bundle.getPspBusinessName(), pspTaxCode, deNull(bundle.getValidityDateFrom()), url, result.getIdBundle()) ); return result; } @@ -144,7 +179,8 @@ public void deletePSPBundle( BundleType bundleType ) { String pspCode = this.legacyPspCodeUtil.retrievePspCode(pspTaxCode, true); - this.asyncNotificationService.notifyDeletePSPBundleAsync(pspCode, idBundle, bundleName, pspName, bundleType); + Set ciTaxCodes = this.bundleAllPages.getAllCITaxCodesAssociatedToABundle(idBundle, bundleType, pspCode); + this.asyncNotificationService.notifyDeletePSPBundleAsync(ciTaxCodes, bundleName, pspName); this.gecClient.deletePSPBundle(pspCode, idBundle); } @@ -590,6 +626,21 @@ public void rejectPrivateBundleOffer(String ciTaxCode, String idBundleOffer, Str this.awsSesClient.sendEmail(messageDetail); } + /** + * Export all bundles of the specified PSP and bundle types. + *

+ * Retrieves all bundles with the provided filters and return the list in CSV format + * + * @param pspTaxCode PSP's tax code + * @param bundleTypeList the types of bundle to be retrieved + * @return the bundles in CSV format + */ + public byte[] exportPSPBundleList(String pspTaxCode, List bundleTypeList) { + String pspCode = this.legacyPspCodeUtil.retrievePspCode(pspTaxCode, true); + + return this.exportService.exportPSPBundlesToCsv(pspCode, bundleTypeList); + } + private Context buildEmailHtmlBodyContext(String bundleName, String pspName) { // Thymeleaf Context Context context = new Context(); diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportService.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportService.java index a63af8a46..2783e9677 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportService.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportService.java @@ -3,18 +3,25 @@ import it.pagopa.selfcare.pagopa.backoffice.entity.*; import it.pagopa.selfcare.pagopa.backoffice.exception.AppError; import it.pagopa.selfcare.pagopa.backoffice.exception.AppException; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.Bundle; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleType; import it.pagopa.selfcare.pagopa.backoffice.model.export.BrokerECExportStatus; import it.pagopa.selfcare.pagopa.backoffice.repository.BrokerIbansRepository; import it.pagopa.selfcare.pagopa.backoffice.repository.BrokerInstitutionsRepository; +import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; import it.pagopa.selfcare.pagopa.backoffice.util.Utility; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.text.NumberFormat; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Optional; +import java.util.Set; import static it.pagopa.selfcare.pagopa.backoffice.util.Utility.deNull; @@ -22,14 +29,23 @@ @Service public class ExportService { + private static final List BUNDLE_EXPORT_HEADERS = Arrays.asList("Id", "Nome", "Descrizione", "Tipologia", "Commissione", "Importo pagamento minimo", "Importo pagamento massimo", "Tipo di pagamento", "Touchpoint", "Valido da", "Valido a", "Ultima Modifica", "Id canale", "Nome PSP", "Codice fiscale PSP", "Gestione carrello di pagamenti", "Pagamento con marca da bollo", "Pagamento solo con marca da bollo"); + private final BrokerIbansRepository brokerIbansRepository; private final BrokerInstitutionsRepository brokerInstitutionsRepository; + private final BundleAllPages bundleAllPages; + @Autowired - public ExportService(BrokerIbansRepository brokerIbansRepository, BrokerInstitutionsRepository brokerInstitutionsRepository) { + public ExportService( + BrokerIbansRepository brokerIbansRepository, + BrokerInstitutionsRepository brokerInstitutionsRepository, + BundleAllPages bundleAllPages + ) { this.brokerIbansRepository = brokerIbansRepository; this.brokerInstitutionsRepository = brokerInstitutionsRepository; + this.bundleAllPages = bundleAllPages; } /** @@ -69,7 +85,7 @@ public byte[] exportCreditorInstitutionToCsv(String brokerCode) { } public BrokerECExportStatus getBrokerExportStatus(@NotNull String brokerCode) { - if(brokerCode == null) { + if (brokerCode == null) { throw new AppException(AppError.BAD_REQUEST, "No valid broker code is passed."); } Optional brokerIbansCreatedAt = Optional.empty(); @@ -86,6 +102,81 @@ public BrokerECExportStatus getBrokerExportStatus(@NotNull String brokerCode) { .build(); } + /** + * This method is used for exporting all bundle of the specified PSP and of the specified types. + * Retrieve all the bundles and then format the list in a CSV row structure. + * + * @param pspCode the PSP code used to retrieve the bundles + * @param bundleTypeList the list of bundle type to be retrieved + * @return The byte array representation of the generated CSV file. + */ + public byte[] exportPSPBundlesToCsv(String pspCode, List bundleTypeList) { + Set pspBundles = this.bundleAllPages.getAllPSPBundles(pspCode, bundleTypeList); + + return Utility.createCsv(BUNDLE_EXPORT_HEADERS, mapBundlesToStringList(pspBundles)); + } + + private List> mapBundlesToStringList(Set pspBundles) { + return pspBundles.parallelStream() + .map(bundle -> Arrays.asList( + deNull(bundle.getId()), + deNull(bundle.getName()), + deNull(bundle.getDescription()), + mapBundleType(bundle.getType()), + formatCurrency(bundle.getPaymentAmount()), + formatCurrency(bundle.getMinPaymentAmount()), + formatCurrency(bundle.getMaxPaymentAmount()), + mapTouchpointAndPaymentType(bundle.getPaymentType()), + mapTouchpointAndPaymentType(bundle.getTouchpoint()), + deNull(bundle.getValidityDateFrom()), + deNull(bundle.getValidityDateTo()), + deNull(bundle.getLastUpdatedDate()), + deNull(bundle.getIdChannel()), + deNull(bundle.getPspBusinessName()), + deNull(bundle.getIdBrokerPsp()), + parseBoolean(bundle.getCart()), + parseBoolean(bundle.getDigitalStamp()), + parseBoolean(bundle.getDigitalStampRestriction()) + )) + .toList(); + } + + private String mapTouchpointAndPaymentType(String value) { + value = deNull(value); + if (value.isBlank() || value.equals("ANY")) { + return "Tutti"; + } + return value; + } + + private String parseBoolean(Boolean booleanValue) { + return Boolean.TRUE.equals(deNull(booleanValue)) ? "true" : "false"; + } + + private String formatCurrency(Long value) { + if (value == null) { + return ""; + } + BigDecimal valueToFormat = BigDecimal.valueOf(value / 100.00); + NumberFormat numberFormat = NumberFormat.getInstance(Locale.ITALY); + numberFormat.setMaximumFractionDigits(2); + numberFormat.setMinimumFractionDigits(2); + return numberFormat.format(valueToFormat); + } + + private String mapBundleType(BundleType bundleType) { + if (BundleType.GLOBAL.equals(bundleType)) { + return "Per tutti"; + } + if (BundleType.PUBLIC.equals(bundleType)) { + return "Su richiesta"; + } + if (BundleType.PRIVATE.equals(bundleType)) { + return "Su invito"; + } + return ""; + } + /** * This method processes a list of IbanCsv objects, mapping them to a List of lists of String type. * @@ -116,7 +207,7 @@ private List> mapInstitutionToCsv(List ins .map(elem -> Arrays.asList( deNull(elem.getCompanyName()), deNull(elem.getTaxCode()), - Boolean.TRUE.equals(deNull(elem.getIntermediated())) ? "true" : "false", + parseBoolean(elem.getIntermediated()), deNull(elem.getBrokerCompanyName()), deNull(elem.getBrokerTaxCode()), deNull(elem.getModel()), @@ -128,13 +219,13 @@ private List> mapInstitutionToCsv(List ins deNull(elem.getStationState()), deNull(elem.getActivationDate()), deNull(elem.getVersion()), - Boolean.TRUE.equals(deNull(elem.getBroadcast())) ? "true" : "false", - Boolean.TRUE.equals(deNull(elem.getPspPayment())) ? "true" : "false", + parseBoolean(elem.getBroadcast()), + parseBoolean(elem.getPspPayment()), deNull(elem.getEndpointRT()), deNull(elem.getEndpointRedirect()), deNull(elem.getEndpointMU()), deNull(elem.getPrimitiveVersion()), - Boolean.TRUE.equals(deNull(elem.getCiStatus())) ? "true" : "false")) + parseBoolean(elem.getCiStatus()))) .toList(); } } diff --git a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/MailTextConstants.java b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/MailTextConstants.java index 658d1e6ed..717688fa4 100644 --- a/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/MailTextConstants.java +++ b/src/main/java/it/pagopa/selfcare/pagopa/backoffice/util/MailTextConstants.java @@ -8,14 +8,14 @@ public class MailTextConstants { public static final String BUNDLE_REJECT_OFFER_SUBJECT = "Offerta di adesione rifiutata"; public static final String BUNDLE_REJECT_OFFER_BODY = "Ciao %n%n%n la tua offerta di adesione al pacchetto %s è stata rifiutata.%n%n%n Se riscontri dei problemi, puoi richiedere maggiori dettagli utilizzando il canale di assistenza ( https://selfcare.pagopa.it/assistenza ).%n%n%nA presto,%n%nPagamenti pagoPa"; public static final String BUNDLE_CREATE_REQUEST_SUBJECT = "Nuova richiesta di attivazione pacchetto commissionale"; - public static final String BUNDLE_CREATE_REQUEST_BODY = "Ciao, %n%n%n ci sono nuove richieste di attivazione per il pacchetto commissionale %s.%n%n%n Puoi gestire i tuoi pacchetti qui https://selfcare.platform.pagopa.it/ui/comm-bundles ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; + public static final String BUNDLE_CREATE_REQUEST_BODY = "Ciao, %n%n%n ci sono nuove richieste di attivazione per il pacchetto commissionale %s.%n%n%n Puoi gestire i tuoi pacchetti qui ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; // CI notification public static final String BUNDLE_DELETE_SUBJECT = "Eliminazione pacchetto commissionale"; public static final String BUNDLE_DELETE_BODY = "Ciao, %n%n%n %s ha richiesto l'eliminazione del pacchetto %s che non sarà più visibile a partire dalla mezzanotte di domani. Se riscontri dei problemi, contatta l'ente.%n%n Puoi gestire i tuoi pacchetti qui ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; public static final String BUNDLE_CREATE_OFFER_SUBJECT = "Nuova offerta di attivazione pacchetto commissionale"; - public static final String BUNDLE_CREATE_OFFER_BODY = "Ciao, %n%n%n c'è una nuova offerta di attivazione per il pacchetto commissionale %s.%n%n%n Puoi gestire i tuoi pacchetti qui https://selfcare.platform.pagopa.it/ui/comm-bundles ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; + public static final String BUNDLE_CREATE_OFFER_BODY = "Ciao, %n%n%n c'è una nuova offerta di attivazione per il pacchetto commissionale %s.%n%n%n Puoi gestire i tuoi pacchetti qui ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; public static final String BUNDLE_ACCEPT_REQUEST_SUBJECT = "Richiesta di adesione confermata"; public static final String BUNDLE_ACCEPT_REQUEST_BODY = "Ciao %n%n%n la tua richiesta di adesione al pacchetto %s è stata accettata.%n%n%n Puoi vedere e gestire il pacchetto da qui ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; public static final String BUNDLE_REJECT_REQUEST_SUBJECT = "Richiesta di adesione rifiutata"; @@ -27,7 +27,7 @@ public class MailTextConstants { // cron-job notification public static final String BUNDLE_EXPIRE_SUBJECT = "Pacchetto commissionale in scadenza"; - public static final String BUNDLE_EXPIRE_BODY = "Ciao, %n%n%n il pacchetto %s scadrà in data %s.%n%n%n Puoi vedere i tuoi pacchetti qui https://selfcare.platform.pagopa.it/ui/comm-bundles ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; + public static final String BUNDLE_EXPIRE_BODY = "Ciao, %n%n%n il pacchetto %s del PSP %s (codice fiscale: %s) scadrà in data %s.%n%n%n Puoi vedere i tuoi pacchetti qui ( https://selfcare.platform.pagopa.it/ui/comm-bundles ).%n%n%nA presto,%n%nPagamenti pagoPa"; private MailTextConstants() {} diff --git a/src/main/resources/templates/expiringBundleEmail.html b/src/main/resources/templates/expiringBundleEmail.html index 3e136437f..d53b1776e 100644 --- a/src/main/resources/templates/expiringBundleEmail.html +++ b/src/main/resources/templates/expiringBundleEmail.html @@ -14,7 +14,10 @@

Pacchetto commissionale in scadenza


- il pacchetto scadrà in data . + il pacchetto + del PSP + (codice fiscale: ) + scadrà in data .

Puoi gestire i tuoi pacchetti qui ()) - .pageInfo(PageInfo.builder().build()) - .build() - ); - mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getBundlesPaymentTypes(50, 0)).thenReturn(BundlePaymentTypes.builder().paymentTypes(new ArrayList<>()).pageInfo(PageInfo.builder().build()).build()); + mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -82,28 +83,15 @@ void getBundlesPaymentTypesWithParamsOK() throws Exception { String url = "/bundles/payment-types"; int limit = 25; int page = 2; - when(service.getBundlesPaymentTypes(limit, page)).thenReturn( - BundlePaymentTypes.builder() - .paymentTypes(new ArrayList<>()) - .pageInfo(PageInfo.builder().build()) - .build() - ); - mvc.perform(get(url) - .param("limit", String.valueOf(limit)) - .param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getBundlesPaymentTypes(limit, page)).thenReturn(BundlePaymentTypes.builder().paymentTypes(new ArrayList<>()).pageInfo(PageInfo.builder().build()).build()); + mvc.perform(get(url).param("limit", String.valueOf(limit)).param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test void getTouchpointsWithDefaultParamsOK() throws Exception { String url = "/bundles/touchpoints"; - when(service.getTouchpoints(10, 0)).thenReturn( - new Touchpoints() - ); - mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getTouchpoints(10, 0)).thenReturn(new Touchpoints()); + mvc.perform(get(url).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -111,25 +99,15 @@ void getTouchpointsWithParamsOK() throws Exception { String url = "/bundles/touchpoints"; int limit = 25; int page = 2; - when(service.getTouchpoints(limit, page)).thenReturn( - new Touchpoints() - ); - mvc.perform(get(url) - .param("limit", String.valueOf(limit)) - .param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getTouchpoints(limit, page)).thenReturn(new Touchpoints()); + mvc.perform(get(url).param("limit", String.valueOf(limit)).param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test void getBundleByPSPWithDefaultParamsOK() throws Exception { String url = "/bundles/payment-service-providers/{psp-code}"; - when(service.getBundlesByPSP(PSP_TAX_CODE, null, null, 50, 0)).thenReturn( - new PSPBundlesResource() - ); - mvc.perform(get(url, PSP_TAX_CODE) - ).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getBundlesByPSP(PSP_TAX_CODE, null, null, null, null, null, null, null, null, null, 50, 0)).thenReturn(new PSPBundlesResource()); + mvc.perform(get(url, PSP_TAX_CODE)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -139,17 +117,22 @@ void getBundleByPSPWithParamsOK() throws Exception { List bundleTypeList = Collections.singletonList(BundleType.PRIVATE); Integer page = 2; String name = "pspName"; - when(service.getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, name, limit, page)).thenReturn( - new PSPBundlesResource() - ); + LocalDate date = LocalDate.now(); + when(service.getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, name, Sort.Direction.ASC, 0L, 0L, date, date, date, date, limit, page)).thenReturn(new PSPBundlesResource()); mvc.perform(get(url, PSP_TAX_CODE) - .param("limit", String.valueOf(limit)) - .param("page", String.valueOf(page)) - .param("name", name) - .param("bundle-type", BundleType.PRIVATE.name()) - ).andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); - verify(service).getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, name, limit, page); + .param("limit", String.valueOf(limit)) + .param("page", String.valueOf(page)) + .param("name", name) + .param("bundle-type", BundleType.PRIVATE.name()) + .param("maxPaymentAmountOrder", Sort.Direction.ASC.name()) + .param("paymentAmountMinRange", "0") + .param("paymentAmountMaxRange", "0") + .param("validBefore", date.toString()) + .param("validAfter", date.toString()) + .param("expireBefore", date.toString()) + .param("expireAfter", date.toString()) + ).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + verify(service).getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, name, Sort.Direction.ASC, 0L, 0L, date, date, date, date, limit, page); } @Test @@ -158,20 +141,14 @@ void createPSPBundleOK() throws Exception { BundleRequest bundleRequest = new BundleRequest(); when(service.createPSPBundle(PSP_TAX_CODE, bundleRequest)).thenReturn(new BundleCreateResponse()); - mvc.perform(post(url, PSP_TAX_CODE) - .contentType(MediaType.APPLICATION_JSON_VALUE) - .content(mapper.writeValueAsString(bundleRequest)) - ).andExpect(status().isCreated()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + mvc.perform(post(url, PSP_TAX_CODE).contentType(MediaType.APPLICATION_JSON_VALUE).content(mapper.writeValueAsString(bundleRequest))).andExpect(status().isCreated()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test void createPSPBundleNoBundleKO() throws Exception { String url = "/bundles/payment-service-providers/{psp-code}"; - mvc.perform(post(url, PSP_TAX_CODE) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().is4xxClientError()); + mvc.perform(post(url, PSP_TAX_CODE).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().is4xxClientError()); } @Test @@ -179,9 +156,7 @@ void getBundleDetailByPSPOK() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-code}"; when(service.getBundleDetailByPSP(PSP_TAX_CODE, BUNDLE_ID)).thenReturn(new PSPBundleResource()); - mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); verify(service).getBundleDetailByPSP(PSP_TAX_CODE, BUNDLE_ID); } @@ -189,11 +164,7 @@ void getBundleDetailByPSPOK() throws Exception { void updatePSPBundleOK() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-code}"; BundleRequest bundleRequest = new BundleRequest(); - mvc.perform(put(url, BUNDLE_ID, PSP_TAX_CODE) - .contentType(MediaType.APPLICATION_JSON) - .content(mapper.writeValueAsString(bundleRequest)) - ) - .andExpect(status().isOk()); + mvc.perform(put(url, BUNDLE_ID, PSP_TAX_CODE).contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(bundleRequest))).andExpect(status().isOk()); verify(service).updatePSPBundle(PSP_TAX_CODE, BUNDLE_ID, bundleRequest); } @@ -201,11 +172,7 @@ void updatePSPBundleOK() throws Exception { void deletePSPBundleOK() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-code}"; - mvc.perform(delete(url, BUNDLE_ID, PSP_TAX_CODE) - .param("bundleName", BUNDLE_NAME) - .param("pspName", PSP_NAME) - .param("bundleType", BundleType.GLOBAL.name())) - .andExpect(status().isOk()); + mvc.perform(delete(url, BUNDLE_ID, PSP_TAX_CODE).param("bundleName", BUNDLE_NAME).param("pspName", PSP_NAME).param("bundleType", BundleType.GLOBAL.name())).andExpect(status().isOk()); verify(service).deletePSPBundle(PSP_TAX_CODE, BUNDLE_ID, BUNDLE_NAME, PSP_NAME, BundleType.GLOBAL); } @@ -213,11 +180,7 @@ void deletePSPBundleOK() throws Exception { void acceptPublicBundleSubscriptionsOK() throws Exception { String url = "/bundles/payment-service-providers/{tax-code}/requests/{bundle-request-id}/accept"; - mvc.perform(post(url, PSP_TAX_CODE, ID_BUNDLE_REQUEST) - .param(CI_TAX_CODE, CI_TAX_CODE) - .param(BUNDLE_NAME, BUNDLE_NAME) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(post(url, PSP_TAX_CODE, ID_BUNDLE_REQUEST).param(CI_TAX_CODE, CI_TAX_CODE).param(BUNDLE_NAME, BUNDLE_NAME).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).acceptPublicBundleSubscriptionsByPSP(PSP_TAX_CODE, ID_BUNDLE_REQUEST, CI_TAX_CODE, BUNDLE_NAME); } @@ -226,17 +189,8 @@ void getCiBundlesWithTaxCodeOK() throws Exception { String url = "/bundles/creditor-institutions"; int limit = 25; int page = 2; - when(service.getCIBundles(BundleType.PRIVATE, BundleSubscriptionStatus.WAITING, CI_TAX_CODE, "name", limit, page)) - .thenReturn(new CIBundlesResource()); - mvc.perform(get(url) - .param("name", "name") - .param("bundleType", BundleType.PRIVATE.name()) - .param("status", BundleSubscriptionStatus.WAITING.name()) - .param("ciTaxCode", CI_TAX_CODE) - .param("limit", String.valueOf(limit)) - .param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getCIBundles(BundleType.PRIVATE, BundleSubscriptionStatus.WAITING, CI_TAX_CODE, "name", limit, page)).thenReturn(new CIBundlesResource()); + mvc.perform(get(url).param("name", "name").param("bundleType", BundleType.PRIVATE.name()).param("status", BundleSubscriptionStatus.WAITING.name()).param("ciTaxCode", CI_TAX_CODE).param("limit", String.valueOf(limit)).param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test @@ -244,38 +198,21 @@ void getCiBundlesWithoutTaxCodeOK() throws Exception { String url = "/bundles/creditor-institutions"; int limit = 25; int page = 2; - when(service.getCIBundles(BundleType.PUBLIC, null, null, null, limit, page)).thenReturn( - new CIBundlesResource() - ); - mvc.perform(get(url) - .param("bundleType", BundleType.PUBLIC.name()) - .param("limit", String.valueOf(limit)) - .param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + when(service.getCIBundles(BundleType.PUBLIC, null, null, null, limit, page)).thenReturn(new CIBundlesResource()); + mvc.perform(get(url).param("bundleType", BundleType.PUBLIC.name()).param("limit", String.valueOf(limit)).param("page", String.valueOf(page)).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); } @Test void rejectPublicBundleSubscriptionsOK() throws Exception { String url = "/bundles/payment-service-providers/{psp-tax-code}/requests/{bundle-request-id}/reject"; - mvc.perform(post(url, PSP_TAX_CODE, ID_BUNDLE_REQUEST) - .param(CI_TAX_CODE, CI_TAX_CODE) - .param(BUNDLE_NAME, BUNDLE_NAME) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(post(url, PSP_TAX_CODE, ID_BUNDLE_REQUEST).param(CI_TAX_CODE, CI_TAX_CODE).param(BUNDLE_NAME, BUNDLE_NAME).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).rejectPublicBundleSubscriptionByPSP(PSP_TAX_CODE, ID_BUNDLE_REQUEST, CI_TAX_CODE, BUNDLE_NAME); } @Test void getBundleCISubscriptionsWithAcceptedStatus() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/subscriptions"; - mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE) - .param("bundleType", BundleType.PUBLIC.name()) - .param("status", BundleSubscriptionStatus.ACCEPTED.name()) - .param("limit", "10") - .param("page", "0") - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE).param("bundleType", BundleType.PUBLIC.name()).param("status", BundleSubscriptionStatus.ACCEPTED.name()).param("limit", "10").param("page", "0").contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).getAcceptedBundleCISubscriptions(BUNDLE_ID, PSP_TAX_CODE, null, 10, 0); verify(service, never()).getWaitingBundleCISubscriptions(BUNDLE_ID, PSP_TAX_CODE, BundleType.PUBLIC, null, 10, 0); } @@ -283,13 +220,7 @@ void getBundleCISubscriptionsWithAcceptedStatus() throws Exception { @Test void getBundleCISubscriptionsWithWaitingStatus() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/subscriptions"; - mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE) - .param("bundleType", BundleType.PUBLIC.name()) - .param("status", BundleSubscriptionStatus.WAITING.name()) - .param("limit", "10") - .param("page", "0") - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE).param("bundleType", BundleType.PUBLIC.name()).param("status", BundleSubscriptionStatus.WAITING.name()).param("limit", "10").param("page", "0").contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service, never()).getAcceptedBundleCISubscriptions(BUNDLE_ID, PSP_TAX_CODE, null, 10, 0); verify(service).getWaitingBundleCISubscriptions(BUNDLE_ID, PSP_TAX_CODE, BundleType.PUBLIC, null, 10, 0); } @@ -297,11 +228,7 @@ void getBundleCISubscriptionsWithWaitingStatus() throws Exception { @Test void getBundleCISubscriptionsDetailWithAcceptedStatus() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/subscriptions/{ci-tax-code}"; - mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE) - .param("bundleType", BundleType.PUBLIC.name()) - .param("status", BundleSubscriptionStatus.ACCEPTED.name()) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE).param("bundleType", BundleType.PUBLIC.name()).param("status", BundleSubscriptionStatus.ACCEPTED.name()).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).getAcceptedBundleCISubscriptionsDetail(BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE); verify(service, never()).getWaitingBundleCISubscriptionsDetail(BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE, BundleType.PUBLIC); } @@ -309,11 +236,7 @@ void getBundleCISubscriptionsDetailWithAcceptedStatus() throws Exception { @Test void getBundleCISubscriptionsDetailWithWaitingStatus() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/subscriptions/{ci-tax-code}"; - mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE) - .param("bundleType", BundleType.PUBLIC.name()) - .param("status", BundleSubscriptionStatus.WAITING.name()) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(get(url, BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE).param("bundleType", BundleType.PUBLIC.name()).param("status", BundleSubscriptionStatus.WAITING.name()).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service, never()).getAcceptedBundleCISubscriptionsDetail(BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE); verify(service).getWaitingBundleCISubscriptionsDetail(BUNDLE_ID, PSP_TAX_CODE, CI_TAX_CODE, BundleType.PUBLIC); } @@ -321,19 +244,14 @@ void getBundleCISubscriptionsDetailWithWaitingStatus() throws Exception { @Test void deleteCIBundleSubscriptionOK() throws Exception { String url = "/bundles/{ci-bundle-id}/creditor-institutions/{ci-tax-code}"; - mvc.perform(delete(url, CI_BUNDLE_ID, CI_TAX_CODE) - .param(BUNDLE_NAME, BUNDLE_NAME) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(delete(url, CI_BUNDLE_ID, CI_TAX_CODE).param(BUNDLE_NAME, BUNDLE_NAME).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).deleteCIBundleSubscription(CI_BUNDLE_ID, CI_TAX_CODE, BUNDLE_NAME); } @Test void deleteCIBundleRequestOK() throws Exception { String url = "/bundles/creditor-institutions/{ci-tax-code}/requests/{bundle-request-id}"; - mvc.perform(delete(url, CI_TAX_CODE, ID_BUNDLE_REQUEST) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(delete(url, CI_TAX_CODE, ID_BUNDLE_REQUEST).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).deleteCIBundleRequest(ID_BUNDLE_REQUEST, CI_TAX_CODE); } @@ -342,22 +260,14 @@ void createCIBundleRequestOK() throws Exception { PublicBundleRequest bundleRequest = new PublicBundleRequest(); String url = "/bundles/creditor-institutions/{ci-tax-code}/requests"; - mvc.perform(post(url, CI_TAX_CODE) - .param(BUNDLE_NAME, BUNDLE_NAME) - .contentType(MediaType.APPLICATION_JSON_VALUE) - .content(mapper.writeValueAsString(bundleRequest)) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(post(url, CI_TAX_CODE).param(BUNDLE_NAME, BUNDLE_NAME).contentType(MediaType.APPLICATION_JSON_VALUE).content(mapper.writeValueAsString(bundleRequest)).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).createCIBundleRequest(CI_TAX_CODE, bundleRequest, BUNDLE_NAME); } @Test void deletePrivateBundleOfferOK() throws Exception { String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/offers/{bundle-offer-id}"; - mvc.perform(delete(url, BUNDLE_ID, PSP_TAX_CODE, ID_BUNDLE_OFFER) - .param("ciTaxCode", CI_TAX_CODE) - .param("bundleName", BUNDLE_NAME)) - .andExpect(status().isOk()); + mvc.perform(delete(url, BUNDLE_ID, PSP_TAX_CODE, ID_BUNDLE_OFFER).param("ciTaxCode", CI_TAX_CODE).param("bundleName", BUNDLE_NAME)).andExpect(status().isOk()); verify(service).deletePrivateBundleOffer(BUNDLE_ID, PSP_TAX_CODE, ID_BUNDLE_OFFER, CI_TAX_CODE, BUNDLE_NAME); } @@ -367,11 +277,7 @@ void createCIBundleOffersOK() throws Exception { CiTaxCodeList body = CiTaxCodeList.builder().ciTaxCodes(Collections.singletonList(CI_TAX_CODE)).build(); String url = "/bundles/{id-bundle}/payment-service-providers/{psp-tax-code}/offers"; - mvc.perform(post(url, BUNDLE_ID, PSP_TAX_CODE) - .param("bundleName", BUNDLE_NAME) - .contentType(MediaType.APPLICATION_JSON_VALUE) - .content(mapper.writeValueAsString(body))) - .andExpect(status().isOk()); + mvc.perform(post(url, BUNDLE_ID, PSP_TAX_CODE).param("bundleName", BUNDLE_NAME).contentType(MediaType.APPLICATION_JSON_VALUE).content(mapper.writeValueAsString(body))).andExpect(status().isOk()); verify(service).createCIBundleOffers(anyString(), anyString(), anyString(), any()); } @@ -380,12 +286,7 @@ void createCIBundleOffersOK() throws Exception { void acceptPrivateBundleOfferTest() throws Exception { String url = "/bundles/creditor-institutions/{ci-tax-code}/offers/{id-bundle-offer}/accept"; - mvc.perform(post(url, CI_TAX_CODE, ID_BUNDLE_OFFER) - .param("bundleName", BUNDLE_NAME) - .param("pspTaxCode", PSP_TAX_CODE) - .content(mapper.writeValueAsString(new CIBundleAttributeResource())) - .contentType(MediaType.APPLICATION_JSON_VALUE)) - .andExpect(status().isOk()); + mvc.perform(post(url, CI_TAX_CODE, ID_BUNDLE_OFFER).param("bundleName", BUNDLE_NAME).param("pspTaxCode", PSP_TAX_CODE).content(mapper.writeValueAsString(new CIBundleAttributeResource())).contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(status().isOk()); verify(service).acceptPrivateBundleOffer(eq(CI_TAX_CODE), eq(ID_BUNDLE_OFFER), eq(PSP_TAX_CODE), eq(BUNDLE_NAME), any()); } @@ -393,10 +294,28 @@ void acceptPrivateBundleOfferTest() throws Exception { void rejectPrivateBundleOfferTest() throws Exception { String url = "/bundles/creditor-institutions/{ci-tax-code}/offers/{id-bundle-offer}/reject"; - mvc.perform(post(url, CI_TAX_CODE, ID_BUNDLE_OFFER) - .param("bundleName", BUNDLE_NAME) - .param("pspTaxCode", PSP_TAX_CODE)) - .andExpect(status().isOk()); + mvc.perform(post(url, CI_TAX_CODE, ID_BUNDLE_OFFER).param("bundleName", BUNDLE_NAME).param("pspTaxCode", PSP_TAX_CODE)).andExpect(status().isOk()); verify(service).rejectPrivateBundleOffer(CI_TAX_CODE, ID_BUNDLE_OFFER, PSP_TAX_CODE, BUNDLE_NAME); } + + @ParameterizedTest + @MethodSource("generateExportPSPBundleListTestData") + void exportPSPBundleListTest(List bundleTypeList) throws Exception { + when(service.exportPSPBundleList(anyString(), anyList())).thenReturn("test file".getBytes()); + String url = "/bundles/payment-service-providers/{psp-tax-code}/export"; + + mvc.perform(get(url, PSP_TAX_CODE) + .param("bundleTypeList", bundleTypeList.stream().map(Object::toString) + .collect(Collectors.joining(", ")))) + .andExpect(status().isOk()); + } + + private static Stream generateExportPSPBundleListTestData() { + return Stream.of( + Arguments.of(Collections.singletonList(BundleType.GLOBAL)), + Arguments.of(Collections.singletonList(BundleType.PUBLIC)), + Arguments.of(Collections.singletonList(BundleType.PRIVATE)), + Arguments.of(List.of(BundleType.GLOBAL, BundleType.PUBLIC, BundleType.PRIVATE)) + ); + } } diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPagesTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPagesTest.java index 92867ac91..d0e3030e0 100644 --- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPagesTest.java +++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/scheduler/function/BundleAllPagesTest.java @@ -111,9 +111,9 @@ void getPublicBundleSubscriptionRequestByPSPSuccess() { .pageInfo(PageInfo.builder().totalItems(numOfBundles).build()) .build(); - when(gecClient.getPublicBundleSubscriptionRequestByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)) + when(gecClient.getPublicBundleSubscriptionRequestByPSP(PSP_CODE, null, ID_BUNDLE, 1, 0)) .thenReturn(resource); - when(gecClient.getPublicBundleSubscriptionRequestByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())) + when(gecClient.getPublicBundleSubscriptionRequestByPSP(eq(PSP_CODE), eq(null), eq(ID_BUNDLE), eq(limit), anyInt())) .thenReturn(resource); Set result = assertDoesNotThrow(() -> sut.getPublicBundleSubscriptionRequestByPSP(PSP_CODE, ID_BUNDLE)); @@ -133,8 +133,8 @@ void getPrivateBundleOffersByPSPSuccess() { .pageInfo(PageInfo.builder().totalItems(numOfBundles).build()) .build(); - when(gecClient.getPrivateBundleOffersByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)).thenReturn(resource); - when(gecClient.getPrivateBundleOffersByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())).thenReturn(resource); + when(gecClient.getPrivateBundleOffersByPSP(PSP_CODE, null, ID_BUNDLE, 1, 0)).thenReturn(resource); + when(gecClient.getPrivateBundleOffersByPSP(eq(PSP_CODE), eq(null), eq(ID_BUNDLE), eq(limit), anyInt())).thenReturn(resource); Set result = assertDoesNotThrow(() -> sut.getPrivateBundleOffersByPSP(PSP_CODE, ID_BUNDLE)); @@ -186,9 +186,9 @@ void getAllCITaxCodesAssociatedToABundleSuccessPublic() { when(gecClient.getBundleSubscriptionByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)).thenReturn(resource); when(gecClient.getBundleSubscriptionByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())).thenReturn(resource); - when(gecClient.getPublicBundleSubscriptionRequestByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)) + when(gecClient.getPublicBundleSubscriptionRequestByPSP(PSP_CODE, null, ID_BUNDLE, 1, 0)) .thenReturn(publicResource); - when(gecClient.getPublicBundleSubscriptionRequestByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())) + when(gecClient.getPublicBundleSubscriptionRequestByPSP(eq(PSP_CODE), eq(null), eq(ID_BUNDLE), eq(limit), anyInt())) .thenReturn(publicResource); Set result = assertDoesNotThrow( @@ -220,8 +220,8 @@ void getAllCITaxCodesAssociatedToABundleSuccessPrivate() { when(gecClient.getBundleSubscriptionByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)).thenReturn(resource); when(gecClient.getBundleSubscriptionByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())).thenReturn(resource); - when(gecClient.getPrivateBundleOffersByPSP(PSP_CODE, ID_BUNDLE, null, 1, 0)).thenReturn(privateResource); - when(gecClient.getPrivateBundleOffersByPSP(eq(PSP_CODE), eq(ID_BUNDLE), eq(null), eq(limit), anyInt())).thenReturn(privateResource); + when(gecClient.getPrivateBundleOffersByPSP(PSP_CODE, null, ID_BUNDLE, 1, 0)).thenReturn(privateResource); + when(gecClient.getPrivateBundleOffersByPSP(eq(PSP_CODE), eq(null), eq(ID_BUNDLE), eq(limit), anyInt())).thenReturn(privateResource); Set result = assertDoesNotThrow( () -> sut.getAllCITaxCodesAssociatedToABundle(ID_BUNDLE, BundleType.PRIVATE, PSP_CODE) @@ -232,4 +232,52 @@ void getAllCITaxCodesAssociatedToABundleSuccessPrivate() { verify(gecClient, never()).getPublicBundleSubscriptionRequestByPSP(PSP_CODE, null, ID_BUNDLE, 1000, 0); } + + @Test + void getAllPSPBundlesSuccess() { + int limit = 2; + ReflectionTestUtils.setField(sut, "getAllBundlesPageLimit", limit); + + String expireAt = LocalDate.now().toString(); + long numOfBundles = 1L; + Bundles bundles = Bundles.builder() + .bundleList(Collections.singletonList(new Bundle())) + .pageInfo(PageInfo.builder().totalItems(numOfBundles).build()) + .build(); + List bundleTypeList = List.of(BundleType.GLOBAL, BundleType.PUBLIC, BundleType.PRIVATE); + + when(gecClient.getBundlesByPSP( + PSP_CODE, + bundleTypeList, + null, + null, + null, + null, + null, + null, + null, + null, + 1, + 0 + )).thenReturn(bundles); + when(gecClient.getBundlesByPSP( + eq(PSP_CODE), + eq(bundleTypeList), + eq(null), + eq(null), + eq(null), + eq(null), + eq(null), + eq(null), + eq(null), + eq(null), + eq(limit), + anyInt() + )).thenReturn(bundles); + + Set result = assertDoesNotThrow(() -> sut.getAllPSPBundles(PSP_CODE, bundleTypeList)); + + assertNotNull(result); + assertEquals(numOfBundles, result.size()); + } } \ No newline at end of file diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationServiceTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationServiceTest.java index 5614b4cb2..4adc268b4 100644 --- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationServiceTest.java +++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/AsyncNotificationServiceTest.java @@ -1,10 +1,8 @@ package it.pagopa.selfcare.pagopa.backoffice.service; import it.pagopa.selfcare.pagopa.backoffice.client.AwsSesClient; -import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleType; import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; @@ -15,7 +13,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; @SpringBootTest(classes = AsyncNotificationService.class) class AsyncNotificationServiceTest { @@ -36,18 +33,10 @@ class AsyncNotificationServiceTest { @Autowired private AsyncNotificationService sut; - @ParameterizedTest - @CsvSource({ - "GLOBAL", - "PRIVATE", - "PUBLIC", - }) - void notifyDeletePSPBundleAsyncSuccess(String bundleType) { - when(bundleAllPages.getAllCITaxCodesAssociatedToABundle(ID_BUNDLE, BundleType.valueOf(bundleType), PSP_CODE)) - .thenReturn(Set.of(CI_TAX_CODE, CI_TAX_CODE_2)); - + @Test + void notifyDeletePSPBundleAsyncSuccess() { assertDoesNotThrow(() -> - sut.notifyDeletePSPBundleAsync(PSP_CODE, ID_BUNDLE, BUNDLE_NAME, PSP_NAME, BundleType.valueOf(bundleType))); + sut.notifyDeletePSPBundleAsync(Set.of(CI_TAX_CODE, CI_TAX_CODE_2), BUNDLE_NAME, PSP_NAME)); verify(awsSesClient, times(2)).sendEmail(any()); } diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleServiceTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleServiceTest.java index 10f2f0153..0013211b9 100644 --- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleServiceTest.java +++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/CommissionBundleServiceTest.java @@ -12,16 +12,19 @@ import it.pagopa.selfcare.pagopa.backoffice.model.connector.PageInfo; import it.pagopa.selfcare.pagopa.backoffice.model.creditorinstituions.client.CreditorInstitutionInfo; import it.pagopa.selfcare.pagopa.backoffice.model.taxonomies.Taxonomy; +import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; import it.pagopa.selfcare.pagopa.backoffice.util.LegacyPspCodeUtil; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.data.domain.Sort; import org.springframework.http.HttpStatus; import java.time.LocalDate; import java.util.Collections; import java.util.List; +import java.util.Set; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.*; @@ -35,6 +38,7 @@ class CommissionBundleServiceTest { private static final String PSP_CODE = "pspCode"; private static final String PSP_TAX_CODE = "pspTaxCode"; private static final String CI_TAX_CODE = "ciTaxCode"; + private static final String CI_TAX_CODE_2 = "ciTaxCode2"; private static final String PSP_NAME = "pspName"; private static final int LIMIT = 50; private static final int PAGE = 0; @@ -70,6 +74,12 @@ class CommissionBundleServiceTest { @MockBean private AsyncNotificationService asyncNotificationService; + @MockBean + private ExportService exportService; + + @MockBean + private BundleAllPages bundleAllPages; + @Test void getBundlesPaymentTypes() { when(gecClient.getPaymenttypes(LIMIT, PAGE)).thenReturn( @@ -93,7 +103,7 @@ void getTouchpoints() { @Test void getBundlesByPSP() { when(legacyPspCodeUtilMock.retrievePspCode(PSP_TAX_CODE, true)).thenReturn(PSP_CODE); - when(gecClient.getBundlesByPSP(any(), any(), any(), any(), any())).thenReturn( + when(gecClient.getBundlesByPSP(any(), any(), any(), any(), any(),any(), any(), any(), any(), any(), any(), any())).thenReturn( Bundles.builder().bundleList(Collections.singletonList( Bundle.builder().transferCategoryList(Collections.singletonList("test")).build())).build() ); @@ -101,9 +111,9 @@ void getBundlesByPSP() { Collections.singletonList(Taxonomy.builder().ecTypeCode("ecTypeCode").ecType("ecType").build())); List bundleTypeList = Collections.singletonList(BundleType.GLOBAL); assertDoesNotThrow( - () -> sut.getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, PSP_NAME, LIMIT, PAGE) + () -> sut.getBundlesByPSP(PSP_TAX_CODE, bundleTypeList, PSP_NAME, Sort.Direction.ASC, 0L, 0L, LocalDate.now(), LocalDate.now(), LocalDate.now(), LocalDate.now(), LIMIT, PAGE) ); - verify(gecClient).getBundlesByPSP(PSP_CODE, bundleTypeList, PSP_NAME, LIMIT, PAGE); + verify(gecClient).getBundlesByPSP(PSP_CODE, bundleTypeList, PSP_NAME, Sort.Direction.ASC, 0L, 0L, LocalDate.now(), LocalDate.now(), LocalDate.now(), LocalDate.now(), LIMIT, PAGE); } @Test @@ -147,13 +157,17 @@ void updatePSPBundle() { @Test void deletePSPBundleSuccess() { + Set ciTaxCodes = Set.of(CI_TAX_CODE, CI_TAX_CODE_2); + when(legacyPspCodeUtilMock.retrievePspCode(PSP_TAX_CODE, true)).thenReturn(PSP_CODE); + when(bundleAllPages.getAllCITaxCodesAssociatedToABundle(ID_BUNDLE, BundleType.GLOBAL, PSP_CODE)) + .thenReturn(ciTaxCodes); assertDoesNotThrow( () -> sut.deletePSPBundle(PSP_TAX_CODE, ID_BUNDLE, BUNDLE_NAME, PSP_NAME, BundleType.GLOBAL) ); - verify(asyncNotificationService).notifyDeletePSPBundleAsync(PSP_CODE, ID_BUNDLE, BUNDLE_NAME, PSP_NAME, BundleType.GLOBAL); + verify(asyncNotificationService).notifyDeletePSPBundleAsync(ciTaxCodes, BUNDLE_NAME, PSP_NAME); verify(gecClient).deletePSPBundle(PSP_CODE, ID_BUNDLE); } @@ -1019,6 +1033,16 @@ void rejectPrivateBundleOfferSuccess() { verify(awsSesClient).sendEmail(any()); } + @Test + void exportPSPBundleListSuccess() { + when(legacyPspCodeUtilMock.retrievePspCode(PSP_TAX_CODE, true)).thenReturn(PSP_CODE); + + List bundleTypeList = Collections.singletonList(BundleType.GLOBAL); + assertDoesNotThrow(() -> sut.exportPSPBundleList(PSP_TAX_CODE, bundleTypeList)); + + verify(exportService).exportPSPBundlesToCsv(PSP_CODE, bundleTypeList); + } + private PublicBundleRequests buildPspRequests() { return PublicBundleRequests.builder() diff --git a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportServiceTest.java b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportServiceTest.java index 69752c6ca..ea3de664f 100644 --- a/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportServiceTest.java +++ b/src/test/java/it/pagopa/selfcare/pagopa/backoffice/service/ExportServiceTest.java @@ -4,34 +4,35 @@ import it.pagopa.selfcare.pagopa.backoffice.TestUtil; import it.pagopa.selfcare.pagopa.backoffice.entity.BrokerIbansEntity; import it.pagopa.selfcare.pagopa.backoffice.entity.BrokerInstitutionsEntity; -import it.pagopa.selfcare.pagopa.backoffice.entity.ProjectCreatedAt; import it.pagopa.selfcare.pagopa.backoffice.exception.AppException; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.Bundle; +import it.pagopa.selfcare.pagopa.backoffice.model.commissionbundle.client.BundleType; import it.pagopa.selfcare.pagopa.backoffice.model.export.BrokerECExportStatus; import it.pagopa.selfcare.pagopa.backoffice.repository.BrokerIbansRepository; import it.pagopa.selfcare.pagopa.backoffice.repository.BrokerInstitutionsRepository; +import it.pagopa.selfcare.pagopa.backoffice.scheduler.function.BundleAllPages; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; -import org.mockito.InjectMocks; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.security.test.context.support.WithMockUser; import java.io.IOException; -import java.time.Instant; +import java.time.LocalDate; import java.util.Calendar; +import java.util.Collections; import java.util.Optional; +import java.util.Set; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; -@SpringBootTest -@AutoConfigureMockMvc -@WithMockUser(username = "user1", password = "pwd", roles = "USER") +@SpringBootTest(classes = {ExportService.class}) class ExportServiceTest { @MockBean @@ -40,8 +41,10 @@ class ExportServiceTest { @MockBean private BrokerInstitutionsRepository brokerInstitutionsRepository; + @MockBean + private BundleAllPages bundleAllPages; + @Autowired - @InjectMocks private ExportService exportService; @Test @@ -164,4 +167,28 @@ void getBrokerExportStatus_error(String passedBrokerCode, String errorOnBrokerIb assertNull(result.getBrokerInstitutionsLastUpdate()); } } + + @Test + void exportPSPBundleToCSV() throws IOException { + when(bundleAllPages.getAllPSPBundles("pspCode", Collections.singletonList(BundleType.GLOBAL))) + .thenReturn(Set.of(buildBundle("id_bundle1"), buildBundle("id_bundle2"))); + + byte[] result = assertDoesNotThrow(() -> + exportService.exportPSPBundlesToCsv("pspCode", Collections.singletonList(BundleType.GLOBAL))); + + assertNotNull(result); + } + + private Bundle buildBundle(String idBundle) { + return Bundle.builder() + .id(idBundle) + .name("bundle_name") + .description("description") + .paymentAmount(5L) + .minPaymentAmount(0L) + .maxPaymentAmount(100L) + .type(BundleType.GLOBAL) + .validityDateTo(LocalDate.now()) + .build(); + } } From 9ed5b56ed3e24f373fd2c10c7f7c521876680e74 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 2 Sep 2024 10:09:30 +0000 Subject: [PATCH 2/4] Bump to version 2.21.0 [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 3656f9f7a..c8c346d89 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-selfcare-ms-backoffice description: Microservice that manage api keys for pagopa product from selfcare type: application -version: 0.390.0 -appVersion: "2.20.0-8-next" +version: 0.391.0 +appVersion: "2.21.0" dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 92f25cf32..659ed8611 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" + tag: "2.21.0" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index d333fa9c4..dd95b3d76 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" #improve + tag: "2.21.0" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index b0f8d56e4..bcb4f6c56 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" #improve + tag: "2.21.0" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 64c98f201..a4fa498ee 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "description": "Microservice to manage PagoPA Backoffice", "termsOfService": "https://www.pagopa.gov.it/", "title": "SelfCare Backoffice", - "version": "2.20.0-8-next" + "version": "2.21.0" }, "servers": [ { diff --git a/pom.xml b/pom.xml index a4a606c7d..5615a81ea 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 2.5.14 pagopa-selfcare-ms-backoffice - 2.20.0-8-next + 2.21.0 SelfCare Backoffice Microservice to manage PagoPA Backoffice From 0864fe6b4625d1a3ecc52182a37edf63cc36258f Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Mon, 2 Sep 2024 10:15:23 +0000 Subject: [PATCH 3/4] Bump to version 2.22.0 [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index c8c346d89..68e776bef 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopa-selfcare-ms-backoffice description: Microservice that manage api keys for pagopa product from selfcare type: application -version: 0.391.0 -appVersion: "2.21.0" +version: 0.392.0 +appVersion: "2.22.0" dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 659ed8611..1623045be 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.21.0" + tag: "2.22.0" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index dd95b3d76..51b9b0c9c 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.21.0" #improve + tag: "2.22.0" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index bcb4f6c56..dc3722579 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.21.0" #improve + tag: "2.22.0" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index a4fa498ee..2c612572a 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "description": "Microservice to manage PagoPA Backoffice", "termsOfService": "https://www.pagopa.gov.it/", "title": "SelfCare Backoffice", - "version": "2.21.0" + "version": "2.22.0" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 5615a81ea..444e1e8a2 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 2.5.14 pagopa-selfcare-ms-backoffice - 2.21.0 + 2.22.0 SelfCare Backoffice Microservice to manage PagoPA Backoffice From 0ef4a9622be8e95677a82bb49a014b1cd4719d65 Mon Sep 17 00:00:00 2001 From: giomella Date: Mon, 2 Sep 2024 12:30:07 +0200 Subject: [PATCH 4/4] bump versions --- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 92f25cf32..4fa7cff5c 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" + tag: "2.22.0-next" pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index d333fa9c4..6958b0251 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" #improve + tag: "2.22.0-next" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index b0f8d56e4..5ef5c8fdc 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-selfcare-ms-backoffice-backend - tag: "2.20.0-8-next" #improve + tag: "2.22.0-next" #improve pullPolicy: Always livenessProbe: httpGet: diff --git a/openapi/openapi.json b/openapi/openapi.json index 64c98f201..bdb9c3e56 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -4,7 +4,7 @@ "description": "Microservice to manage PagoPA Backoffice", "termsOfService": "https://www.pagopa.gov.it/", "title": "SelfCare Backoffice", - "version": "2.20.0-8-next" + "version": "2.22.0-next" }, "servers": [ { diff --git a/pom.xml b/pom.xml index a4a606c7d..d20628f1b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 2.5.14 pagopa-selfcare-ms-backoffice - 2.20.0-8-next + 2.22.0-next SelfCare Backoffice Microservice to manage PagoPA Backoffice