Skip to content

Commit

Permalink
feat: Add toPublish (#56)
Browse files Browse the repository at this point in the history
* add-toPublish-and-fix-apim

* fix: Add param toPublish API create debt positions

---------

Co-authored-by: svariant <samuele.varianti@nttdata.com>
  • Loading branch information
pasqualespica and svariant authored Dec 17, 2024
1 parent 378d085 commit c117ad6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion infra/04_apim_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ locals {

display_name = "pagopa-spontaneous-payments"
description = "App for handling the spontaneous payments"
path = "gps/spontaneous-payments-service/v1"
path = "spontaneous-payments-service"

host = "api.${var.apim_dns_zone_prefix}.${var.external_domain}"
hostname = var.hostname
Expand Down
2 changes: 1 addition & 1 deletion infra/policy/_base_policy.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<policies>
<inbound>
<base />
<set-backend-service base-url="https://${hostname}/gps/spontaneous-payments-service/v1" />
<set-backend-service base-url="https://${hostname}/pagopa-spontaneous-payments-service" />
</inbound>
<outbound>
<base />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private PaymentPositionModel createDebtPosition(String organizationFiscalCode,
pp.setSwitchToExpired(enrollment.isSwitchToExpired());
pp.addPaymentOptions(po);

PaymentPositionModel gpdResponse = gpdClient.createDebtPosition(organizationFiscalCode, pp);
PaymentPositionModel gpdResponse = gpdClient.createDebtPosition(organizationFiscalCode, pp, true);
// Forced set fiscal code -> https://editor.swagger.io/?url=https://raw.githubusercontent.com/pagopa/pagopa-debt-position/main/openapi/openapi_internal.json
gpdResponse.getPaymentOption().get(0).setOrganizationFiscalCode(organizationFiscalCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import feign.FeignException;
import it.gov.pagopa.spontaneouspayment.config.FeignConfig;
import it.gov.pagopa.spontaneouspayment.model.response.PaymentPositionModel;
import org.springframework.web.bind.annotation.RequestParam;


@FeignClient(value = "gpd", url = "${service.gpd.host}", configuration = FeignConfig.class)
Expand All @@ -19,6 +20,7 @@ public interface GpdClient {
backoff = @Backoff(delayExpression = "${retry.gpd.maxDelay}"))
@PostMapping(value = "/organizations/{organizationfiscalcode}/debtpositions")
PaymentPositionModel createDebtPosition(@PathVariable("organizationfiscalcode") String organizationFiscalCode,
@RequestBody PaymentPositionModel paymentPositionModel);
@RequestBody PaymentPositionModel paymentPositionModel,
@RequestParam Boolean toPublish);

}
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void createSpontaneousPayment() throws IOException {
when(iuvGeneratorClient.generateIUV(anyString(), any(IuvGenerationModel.class)))
.thenReturn(IuvGenerationModelResponse.builder().iuv("12345678901234567").build());

when(gpdClient.createDebtPosition(anyString(), any(PaymentPositionModel.class))).thenReturn(paymentModel);
when(gpdClient.createDebtPosition(anyString(), any(PaymentPositionModel.class), any(Boolean.class))).thenReturn(paymentModel);

ArrayList<PaymentOptionModel> paymentOption = new ArrayList<>();
paymentOption.add(getMockPaymentOptionModel());
Expand Down

0 comments on commit c117ad6

Please sign in to comment.