From 08f4ccff77993e02a0768fbb35ceb67fdce4f378 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Tue, 11 Jun 2024 12:13:41 +0100 Subject: [PATCH 01/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../payment/api/controllers/CaseController.java | 5 ++++- .../payment/api/service/PaymentRefundsService.java | 2 ++ .../api/service/PaymentRefundsServiceImpl.java | 12 +++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 4156de05f9..8da8a4556a 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -20,6 +20,7 @@ import uk.gov.hmcts.payment.api.dto.PaymentGroupDto; import uk.gov.hmcts.payment.api.dto.PaymentGroupResponse; import uk.gov.hmcts.payment.api.dto.PaymentSearchCriteria; +import uk.gov.hmcts.payment.api.dto.RefundListDtoResponse; import uk.gov.hmcts.payment.api.dto.mapper.PaymentDtoMapper; import uk.gov.hmcts.payment.api.dto.mapper.PaymentGroupDtoMapper; import uk.gov.hmcts.payment.api.model.PaymentFeeLink; @@ -110,9 +111,11 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc throw new PaymentGroupNotFoundException("No Service found for given CaseType or HMCTS Org Id"); } PaymentGroupResponse paymentGroupResponse = new PaymentGroupResponse(paymentGroups); - paymentGroupResponse = paymentRefundsService.checkRefundAgainstRemissionV2(headers, paymentGroupResponse, ccdCaseNumber); + RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); + paymentGroups.stream().forEach(paymentGroup-> paymentGroup.setApprovedRefunds(refundListDtoResponse.getRefundList())); + return paymentGroupResponse; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsService.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsService.java index 9b84ac03ec..84d338e0b7 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsService.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsService.java @@ -19,4 +19,6 @@ ResponseEntity createAndValidateRetrospectiveRemissionRequest( void deleteByRefundReference(String refundReference, MultiValueMap headers); + + RefundListDtoResponse getRefundsApprovedFromRefundService(String ccdCaseNumber, MultiValueMap headers); } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 9db2d474ec..d6c7591fe5 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -4,7 +4,6 @@ import java.time.temporal.ChronoUnit; import org.apache.commons.lang3.EnumUtils; -import org.apache.poi.hpsf.Decimal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -248,6 +247,17 @@ public ResponseEntity updateTheRemissionAmount(String paymentReference, Resubmit } return new ResponseEntity<>(null, HttpStatus.OK); } + + + public RefundListDtoResponse getRefundsApprovedFromRefundService (String ccdCaseNumber, MultiValueMap headers) { + return RefundListDtoResponse.buildRefundListWith() + .refundList(getRefundsFromRefundService(ccdCaseNumber, headers).getRefundList() + .stream() + .filter(e->e.getRefundStatus().getName().equals("Accepted") + ).collect(Collectors.toList()) + ).build(); + } + private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, MultiValueMap headers) { From 5b9878bde2dedcff1dbc93bd8015570ba02d17f1 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Tue, 11 Jun 2024 12:38:30 +0100 Subject: [PATCH 02/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java b/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java index c6336305fb..4bcc025f3d 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java @@ -43,4 +43,6 @@ public class PaymentGroupDto { private boolean isAnyPaymentDisputed; + private List approvedRefunds; + } From 00b3af75b737381134214702aef6f61bc640bc21 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Tue, 11 Jun 2024 13:31:53 +0100 Subject: [PATCH 03/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../uk/gov/hmcts/payment/api/controllers/CaseController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 8da8a4556a..6e34118617 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -114,8 +114,9 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc paymentGroupResponse = paymentRefundsService.checkRefundAgainstRemissionV2(headers, paymentGroupResponse, ccdCaseNumber); RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); - paymentGroups.stream().forEach(paymentGroup-> paymentGroup.setApprovedRefunds(refundListDtoResponse.getRefundList())); - + if (refundListDtoResponse != null) { + paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setApprovedRefunds(refundListDtoResponse.getRefundList())); + } return paymentGroupResponse; } From a87a514cbf919154ea97a558e75fb1ed971d99e6 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Tue, 11 Jun 2024 15:37:09 +0100 Subject: [PATCH 04/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index d6c7591fe5..7dabcab4e2 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -280,7 +280,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, } catch (HttpClientErrorException e) { LOG.error("client err ", e); - + e.printStackTrace(); refundListDtoResponse = null; } From 22cf38f479d48cda56bb547bc4c01616ad40cd26 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Tue, 11 Jun 2024 15:45:53 +0100 Subject: [PATCH 05/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 7dabcab4e2..7b76d02f37 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -281,7 +281,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, LOG.error("client err ", e); e.printStackTrace(); - refundListDtoResponse = null; + refundListDtoResponse = RefundListDtoResponse.buildRefundListWith().build(); } From 3cd2c661790edbb1a6c9ef49ca516a35ebbc61ad Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Wed, 12 Jun 2024 11:09:14 +0100 Subject: [PATCH 06/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 7b76d02f37..d61f0b912f 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -281,7 +281,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, LOG.error("client err ", e); e.printStackTrace(); - refundListDtoResponse = RefundListDtoResponse.buildRefundListWith().build(); + refundListDtoResponse = RefundListDtoResponse.buildRefundListWith().refundList(new ArrayList<>()).build(); } From 36adfd3cd516258166664f1bf0f07e027b610c08 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Wed, 12 Jun 2024 14:49:14 +0100 Subject: [PATCH 07/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- api/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/build.gradle b/api/build.gradle index cc077ab543..ff012c6cef 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -202,6 +202,10 @@ task smokeTest(type: Test, description: 'Runs the smoke tests', group: 'Verifica } task functionalTest(type: Test, description: 'Runs the functional tests', group: 'Verification') { + filter { + //specific test method + includeTestsMatching "uk.gov.hmcts.payment.functional.RefundsRequestorJourneyPBAFunctionalTest.checkIssueRefundAddRefundAddRemissionFlagWithBalance" + } include "uk/gov/hmcts/payment/functional/**" testClassesDirs = sourceSets.functionalTest.output.classesDirs classpath = sourceSets.functionalTest.runtimeClasspath From 43b4a0710d8b8836cc502507a7a414210bed1d64 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Wed, 12 Jun 2024 15:38:44 +0100 Subject: [PATCH 08/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index d61f0b912f..de560ddfa2 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -278,11 +278,10 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, refundListDtoResponse = refundListDtoResponseEntity.hasBody() ? refundListDtoResponseEntity.getBody() : null; } catch (HttpClientErrorException e) { + e.printStackTrace(); LOG.error("client err ", e); - e.printStackTrace(); refundListDtoResponse = RefundListDtoResponse.buildRefundListWith().refundList(new ArrayList<>()).build(); - } return refundListDtoResponse; From e5967e70f037f053dbfcea9345307f2dcef99901 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Wed, 12 Jun 2024 15:59:40 +0100 Subject: [PATCH 09/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../payment/api/service/PaymentRefundsServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index de560ddfa2..24849dac9a 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -250,8 +250,10 @@ public ResponseEntity updateTheRemissionAmount(String paymentReference, Resubmit public RefundListDtoResponse getRefundsApprovedFromRefundService (String ccdCaseNumber, MultiValueMap headers) { + final var refundListDtoResponse = getRefundsFromRefundService(ccdCaseNumber, headers); + if (refundListDtoResponse == null){ return null; } return RefundListDtoResponse.buildRefundListWith() - .refundList(getRefundsFromRefundService(ccdCaseNumber, headers).getRefundList() + .refundList(refundListDtoResponse.getRefundList() .stream() .filter(e->e.getRefundStatus().getName().equals("Accepted") ).collect(Collectors.toList()) @@ -279,9 +281,8 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, } catch (HttpClientErrorException e) { e.printStackTrace(); - - LOG.error("client err ", e); - refundListDtoResponse = RefundListDtoResponse.buildRefundListWith().refundList(new ArrayList<>()).build(); + LOG.error("There has been an error calling refunds endpoint. ", e); + refundListDtoResponse = null; } return refundListDtoResponse; From 5b628fc0039e6fc75b6bebc104bd7c9b90cc3cfd Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Wed, 12 Jun 2024 16:35:42 +0100 Subject: [PATCH 10/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/functional/service/CaseTestService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java index ac6a6c42ff..ceef05b004 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java @@ -1,6 +1,8 @@ package uk.gov.hmcts.payment.functional.service; +import io.restassured.RestAssured; import io.restassured.http.ContentType; +import io.restassured.parsing.Parser; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.serenitybdd.rest.SerenityRest; @@ -12,9 +14,13 @@ @Named public class CaseTestService { + + public Response getPaymentGroupsForCase(final String userToken, final String serviceToken, final String ccdCaseNumber) { + RestAssured.defaultParser = Parser.JSON; + return givenWithAuthHeaders(userToken, serviceToken) .contentType(ContentType.JSON) .when() From d6d1e4244b0e4541930b006d2143d97b60233cbd Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 09:52:40 +0100 Subject: [PATCH 11/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java index f12c4b68ff..5314bc9659 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.payment.api.dto; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -14,13 +15,14 @@ import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +@JsonInclude(NON_NULL) @Builder(builderMethodName = "buildRefundListDtoWith") @AllArgsConstructor @NoArgsConstructor @Getter @Setter -@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) -@JsonInclude(NON_NULL) public class RefundDto { private String ccdCaseNumber; From 7826342ef6f1c5ca27e4da7390b3a1aee208ab8f Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 09:53:11 +0100 Subject: [PATCH 12/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/functional/service/CaseTestService.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java index ceef05b004..5415398977 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java @@ -1,8 +1,6 @@ package uk.gov.hmcts.payment.functional.service; -import io.restassured.RestAssured; import io.restassured.http.ContentType; -import io.restassured.parsing.Parser; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.serenitybdd.rest.SerenityRest; @@ -19,8 +17,6 @@ public class CaseTestService { public Response getPaymentGroupsForCase(final String userToken, final String serviceToken, final String ccdCaseNumber) { - RestAssured.defaultParser = Parser.JSON; - return givenWithAuthHeaders(userToken, serviceToken) .contentType(ContentType.JSON) .when() From a94714a09e17265fa000de8a980efdcc8fd59885 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 10:14:07 +0100 Subject: [PATCH 13/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/api/controllers/CaseController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 6e34118617..9fcee16e08 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.util.MultiValueMap; @@ -26,6 +28,7 @@ import uk.gov.hmcts.payment.api.model.PaymentFeeLink; import uk.gov.hmcts.payment.api.service.PaymentGroupService; import uk.gov.hmcts.payment.api.service.PaymentRefundsService; +import uk.gov.hmcts.payment.api.service.PaymentRefundsServiceImpl; import uk.gov.hmcts.payment.api.service.PaymentService; import uk.gov.hmcts.payment.api.service.RefundRemissionEnableService; import uk.gov.hmcts.payment.api.v1.model.exceptions.PaymentException; @@ -42,6 +45,8 @@ @Validated public class CaseController { + private static final Logger LOG = LoggerFactory.getLogger(CaseController.class); + private final PaymentService paymentService; private final PaymentGroupService paymentGroupService; private final PaymentDtoMapper paymentDtoMapper; @@ -117,6 +122,11 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc if (refundListDtoResponse != null) { paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setApprovedRefunds(refundListDtoResponse.getRefundList())); } + + LOG.info("getPayments",paymentGroupResponse.getPaymentGroups().get(0).getPayments()); + LOG.info("getRemissions",paymentGroupResponse.getPaymentGroups().get(0).getRemissions()); + LOG.info("Refund",paymentGroupResponse.getPaymentGroups().get(0).getApprovedRefunds()); + return paymentGroupResponse; } From f8220dce84e237e6eaafb603d50262eb84ee80ef Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 11:14:28 +0100 Subject: [PATCH 14/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../hmcts/payment/api/contract/PaymentDto.java | 2 ++ .../api/controllers/CaseController.java | 18 +++++++++++++----- .../hmcts/payment/api/dto/PaymentGroupDto.java | 3 ++- .../gov/hmcts/payment/api/dto/RefundDto.java | 2 ++ .../hmcts/payment/api/dto/RemissionDto.java | 1 + .../api/service/PaymentRefundsServiceImpl.java | 2 +- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/api-contract/src/main/java/uk/gov/hmcts/payment/api/contract/PaymentDto.java b/api-contract/src/main/java/uk/gov/hmcts/payment/api/contract/PaymentDto.java index 4907a3ed01..58c33a059b 100644 --- a/api-contract/src/main/java/uk/gov/hmcts/payment/api/contract/PaymentDto.java +++ b/api-contract/src/main/java/uk/gov/hmcts/payment/api/contract/PaymentDto.java @@ -10,6 +10,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import lombok.ToString; import uk.gov.hmcts.payment.api.contract.util.CurrencyCode; import javax.validation.constraints.NotEmpty; @@ -30,6 +31,7 @@ @AllArgsConstructor @NoArgsConstructor @Data +@ToString public class PaymentDto { private String id; diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 9fcee16e08..1ae1521217 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -28,7 +28,6 @@ import uk.gov.hmcts.payment.api.model.PaymentFeeLink; import uk.gov.hmcts.payment.api.service.PaymentGroupService; import uk.gov.hmcts.payment.api.service.PaymentRefundsService; -import uk.gov.hmcts.payment.api.service.PaymentRefundsServiceImpl; import uk.gov.hmcts.payment.api.service.PaymentService; import uk.gov.hmcts.payment.api.service.RefundRemissionEnableService; import uk.gov.hmcts.payment.api.v1.model.exceptions.PaymentException; @@ -120,12 +119,21 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); if (refundListDtoResponse != null) { - paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setApprovedRefunds(refundListDtoResponse.getRefundList())); + paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); + } + + LOG.info("getPayments"+ paymentGroupResponse.getPaymentGroups().get(0).getPayments().toString()); + LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().toString()); + LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); + + if(!paymentGroupResponse.getPaymentGroups().get(0).getRemissions().isEmpty()){ + LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().get(0).toString()); + } + + if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ + LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds().get(0).toString()); } - LOG.info("getPayments",paymentGroupResponse.getPaymentGroups().get(0).getPayments()); - LOG.info("getRemissions",paymentGroupResponse.getPaymentGroups().get(0).getRemissions()); - LOG.info("Refund",paymentGroupResponse.getPaymentGroups().get(0).getApprovedRefunds()); return paymentGroupResponse; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java b/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java index 4bcc025f3d..90f2d2301f 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/dto/PaymentGroupDto.java @@ -23,6 +23,7 @@ @NoArgsConstructor @Getter @Setter +@ToString public class PaymentGroupDto { private String paymentGroupReference; @@ -43,6 +44,6 @@ public class PaymentGroupDto { private boolean isAnyPaymentDisputed; - private List approvedRefunds; + private List refunds; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java index 5314bc9659..f6a3270416 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RefundDto.java @@ -9,6 +9,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import lombok.ToString; import uk.gov.hmcts.payment.api.model.ContactDetails; import java.math.BigDecimal; @@ -23,6 +24,7 @@ @NoArgsConstructor @Getter @Setter +@ToString public class RefundDto { private String ccdCaseNumber; diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RemissionDto.java b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RemissionDto.java index afeaeeb0ee..3bd6cfc0e9 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/dto/RemissionDto.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/dto/RemissionDto.java @@ -19,6 +19,7 @@ @NoArgsConstructor @Getter @Setter +@ToString public class RemissionDto { private String id; diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 24849dac9a..0751fe0042 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -281,7 +281,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, } catch (HttpClientErrorException e) { e.printStackTrace(); - LOG.error("There has been an error calling refunds endpoint. ", e); + LOG.error("There has been an error calling refunds endpoint.", e); refundListDtoResponse = null; } From 069d0134ac5d950d58802ef5203be2dec49d8042 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 11:29:36 +0100 Subject: [PATCH 15/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../payment/api/controllers/CaseController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 1ae1521217..27b972534e 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -122,9 +122,15 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); } - LOG.info("getPayments"+ paymentGroupResponse.getPaymentGroups().get(0).getPayments().toString()); - LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().toString()); - LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); + if (paymentGroupResponse.getPaymentGroups().get(0).getPayments() != null) { + LOG.info("getPayments" + paymentGroupResponse.getPaymentGroups().get(0).getPayments().toString()); + } + if (paymentGroupResponse.getPaymentGroups().get(0).getRemissions() != null) { + LOG.info("getRemissions " + paymentGroupResponse.getPaymentGroups().get(0).getRemissions().toString()); + } + if (paymentGroupResponse.getPaymentGroups().get(0).getRefunds() != null) { + LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); + } if(!paymentGroupResponse.getPaymentGroups().get(0).getRemissions().isEmpty()){ LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().get(0).toString()); From 5a82f6e604f42897de438cea072a40843b8faf5e Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 11:46:06 +0100 Subject: [PATCH 16/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../payment/api/controllers/CaseController.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 27b972534e..ebe48e835e 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -126,21 +126,20 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc LOG.info("getPayments" + paymentGroupResponse.getPaymentGroups().get(0).getPayments().toString()); } if (paymentGroupResponse.getPaymentGroups().get(0).getRemissions() != null) { + LOG.info("getRemissions " + paymentGroupResponse.getPaymentGroups().get(0).getRemissions().toString()); + if(!paymentGroupResponse.getPaymentGroups().get(0).getRemissions().isEmpty()){ + LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().get(0).toString()); + } + } if (paymentGroupResponse.getPaymentGroups().get(0).getRefunds() != null) { LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); + if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ + LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds().get(0).toString()); + } } - if(!paymentGroupResponse.getPaymentGroups().get(0).getRemissions().isEmpty()){ - LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().get(0).toString()); - } - - if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ - LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds().get(0).toString()); - } - - return paymentGroupResponse; } From 1d6c832fe12520bb9b02fd7c00b8dab3fb4b3119 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 12:01:09 +0100 Subject: [PATCH 17/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/api/controllers/CaseController.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index ebe48e835e..318f29ab92 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -122,17 +122,6 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); } - if (paymentGroupResponse.getPaymentGroups().get(0).getPayments() != null) { - LOG.info("getPayments" + paymentGroupResponse.getPaymentGroups().get(0).getPayments().toString()); - } - if (paymentGroupResponse.getPaymentGroups().get(0).getRemissions() != null) { - - LOG.info("getRemissions " + paymentGroupResponse.getPaymentGroups().get(0).getRemissions().toString()); - if(!paymentGroupResponse.getPaymentGroups().get(0).getRemissions().isEmpty()){ - LOG.info("getRemissions "+paymentGroupResponse.getPaymentGroups().get(0).getRemissions().get(0).toString()); - } - - } if (paymentGroupResponse.getPaymentGroups().get(0).getRefunds() != null) { LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ From 18b6c42d1a700d7fce46e17cbe927f64bcd6517d Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 12:21:33 +0100 Subject: [PATCH 18/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../functional/TestContextConfiguration.java | 26 +++++++++++++++---- .../api/controllers/CaseController.java | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java index 55d481a43d..fa2a78ed69 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java @@ -1,9 +1,11 @@ package uk.gov.hmcts.payment.functional; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; -import io.restassured.config.ObjectMapperConfig; +import com.fasterxml.jackson.annotation.JsonInclude; import io.restassured.path.json.config.JsonPathConfig; +import io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -11,7 +13,10 @@ import javax.annotation.PostConstruct; +import java.lang.reflect.Type; + import static io.restassured.config.JsonConfig.jsonConfig; +import static io.restassured.config.ObjectMapperConfig.objectMapperConfig; @Configuration @ComponentScan("uk.gov.hmcts.payment.functional") @@ -23,11 +28,22 @@ public class TestContextConfiguration { @PostConstruct public void initialize() { + + // Create and configure the Jackson ObjectMapper + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); + objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + // Register the configured ObjectMapper with RestAssured RestAssured.config = RestAssured.config() - .objectMapperConfig( - ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory((cls, charset) -> new ObjectMapper()) - ) - .jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL)); + .objectMapperConfig(objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() { + @Override + public ObjectMapper create(Type cls, String charset) { + return objectMapper; + } + })).jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL)); + RestAssured.useRelaxedHTTPSValidation(); RestAssured.baseURI = baseURL; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 318f29ab92..2348faf6e2 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -122,8 +122,8 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); } + LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); if (paymentGroupResponse.getPaymentGroups().get(0).getRefunds() != null) { - LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds().get(0).toString()); } From 983a4c9a2b2132cc7f92e5ecbe600513dafafe46 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 14:07:54 +0100 Subject: [PATCH 19/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/functional/service/CaseTestService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java index 5415398977..b502217fe1 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.payment.functional.service; import io.restassured.http.ContentType; +import io.restassured.parsing.Parser; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.serenitybdd.rest.SerenityRest; @@ -20,7 +21,8 @@ public Response getPaymentGroupsForCase(final String userToken, return givenWithAuthHeaders(userToken, serviceToken) .contentType(ContentType.JSON) .when() - .get("/cases/{ccdcasenumber}/paymentgroups",ccdCaseNumber); + .get("/cases/{ccdcasenumber}/paymentgroups",ccdCaseNumber) + .then().defaultParser(Parser.JSON).extract().response(); } public RequestSpecification givenWithAuthHeaders(String userToken, String serviceToken) { From 334fc0de534e5110e2d4910f99e7dbe5e6451bf6 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 14:09:31 +0100 Subject: [PATCH 20/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../functional/RefundsRequestorJourneyPBAFunctionalTest.java | 2 +- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java index 58758f3672..8a138c45fd 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java @@ -497,7 +497,7 @@ public void checkIssueRefundAddRefundAddRemissionFlagWithBalance(){ = cardTestService .getPaymentGroupsForCase(USER_TOKEN_PAYMENT, SERVICE_TOKEN_PAYMENT, ccdCaseNumber); paymentGroupResponse - = casePaymentGroupResponse.getBody().as(PaymentGroupResponse.class); + = casePaymentGroupResponse.as(PaymentGroupResponse.class); paymentDtoOptional = paymentGroupResponse.getPaymentGroups().stream().findFirst(); diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 0751fe0042..0a1e9b28f0 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -251,7 +251,9 @@ public ResponseEntity updateTheRemissionAmount(String paymentReference, Resubmit public RefundListDtoResponse getRefundsApprovedFromRefundService (String ccdCaseNumber, MultiValueMap headers) { final var refundListDtoResponse = getRefundsFromRefundService(ccdCaseNumber, headers); - if (refundListDtoResponse == null){ return null; } + if (refundListDtoResponse == null){ + return RefundListDtoResponse.buildRefundListWith().refundList(new ArrayList<>()).build(); + } return RefundListDtoResponse.buildRefundListWith() .refundList(refundListDtoResponse.getRefundList() .stream() From 25a498ab8b008c905adfef8b949644527850ce06 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 14:30:41 +0100 Subject: [PATCH 21/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../RefundsRequestorJourneyPBAFunctionalTest.java | 6 ++++++ docker-compose.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java index 8a138c45fd..87e82dc83e 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java @@ -1,5 +1,7 @@ package uk.gov.hmcts.payment.functional; +import io.restassured.RestAssured; +import io.restassured.parsing.Parser; import io.restassured.response.Response; import net.serenitybdd.junit.spring.integration.SpringIntegrationSerenityRunner; import org.apache.commons.lang3.RandomUtils; @@ -47,6 +49,10 @@ @ActiveProfiles({"functional-tests", "liberataMock"}) public class RefundsRequestorJourneyPBAFunctionalTest { + static { + // Set the default parser globally + RestAssured.defaultParser = Parser.JSON; + } private static String USER_TOKEN; private static String USER_TOKEN_PAYMENT; private static String SERVICE_TOKEN; diff --git a/docker-compose.yml b/docker-compose.yml index d41feb8540..d36d25da94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -92,7 +92,7 @@ services: payments-database: container_name: payments-database - image: postgres:16-alpine + image: postgres:11-alpine environment: - POSTGRES_USER=${POSTGRES_USERNAME} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} @@ -124,7 +124,7 @@ services: ccfr-fees-database: container_name: ccfr-fees-database - image: postgres:16-alpine + image: postgres:11-alpine environment: - POSTGRES_USER=fees_register - POSTGRES_PASSWORD=${FEE_REGISTER} From e536fe06d0e699727e5a3afdd5a9e173ec27f41d Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 15:05:40 +0100 Subject: [PATCH 22/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../RefundsRequestorJourneyPBAFunctionalTest.java | 4 ---- .../payment/functional/TestContextConfiguration.java | 8 ++++++++ .../hmcts/payment/functional/service/CaseTestService.java | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java index 87e82dc83e..a5e0783194 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java @@ -49,10 +49,6 @@ @ActiveProfiles({"functional-tests", "liberataMock"}) public class RefundsRequestorJourneyPBAFunctionalTest { - static { - // Set the default parser globally - RestAssured.defaultParser = Parser.JSON; - } private static String USER_TOKEN; private static String USER_TOKEN_PAYMENT; private static String SERVICE_TOKEN; diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java index fa2a78ed69..bbaa0188f3 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; import com.fasterxml.jackson.annotation.JsonInclude; +import io.restassured.parsing.Parser; import io.restassured.path.json.config.JsonPathConfig; import io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory; import org.springframework.beans.factory.annotation.Value; @@ -23,12 +24,19 @@ @PropertySource("classpath:application-functional-tests.properties") public class TestContextConfiguration { + static { + // Set the default parser globally + RestAssured.defaultParser = Parser.JSON; + } + + @Value("${test.url:http://localhost:8080}") private String baseURL; @PostConstruct public void initialize() { + // Create and configure the Jackson ObjectMapper ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java index b502217fe1..8b342e07dc 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.payment.functional.service; +import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.parsing.Parser; import io.restassured.response.Response; @@ -13,7 +14,10 @@ @Named public class CaseTestService { - + static { + // Set the default parser globally + RestAssured.defaultParser = Parser.JSON; + } public Response getPaymentGroupsForCase(final String userToken, final String serviceToken, From 5240c7a400195bb670725e6d508db10742db3f43 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 15:22:42 +0100 Subject: [PATCH 23/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/api/controllers/CaseController.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 2348faf6e2..ffcf3cb191 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -123,12 +123,7 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc } LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); - if (paymentGroupResponse.getPaymentGroups().get(0).getRefunds() != null) { - if(!paymentGroupResponse.getPaymentGroups().get(0).getRefunds().isEmpty()){ - LOG.info("Refund "+ paymentGroupResponse.getPaymentGroups().get(0).getRefunds().get(0).toString()); - } - } - + LOG.info("END-- " + paymentGroupResponse.getPaymentGroups()); return paymentGroupResponse; } From 048cc9ecaff64962e71f5544093177ccedd4d72f Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 15:57:02 +0100 Subject: [PATCH 24/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../uk/gov/hmcts/payment/api/controllers/CaseController.java | 2 +- .../payment/api/v1/controllers/ControllerExceptionHandler.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index ffcf3cb191..4594ea85ec 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -123,7 +123,7 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc } LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); - LOG.info("END-- " + paymentGroupResponse.getPaymentGroups()); + LOG.info("END-----"); return paymentGroupResponse; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java index 9ac4d892d9..4c784226a3 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java @@ -21,6 +21,8 @@ public class ControllerExceptionHandler { @ExceptionHandler(value = {RuntimeException.class}) @ResponseStatus(code = INTERNAL_SERVER_ERROR) public void unknownException(RuntimeException e) { + LOG.error("GIVE ME A CLUE !!!!!"); + e.printStackTrace(); LOG.error("Unknown error has occurred with errorMessage: " + e.getMessage(), e); } From 2a58d0a0a688a4cdb962347ae1ff64167f555cb8 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 16:32:45 +0100 Subject: [PATCH 25/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- api/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/build.gradle b/api/build.gradle index ff012c6cef..dfcbd2d00a 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -204,7 +204,7 @@ task smokeTest(type: Test, description: 'Runs the smoke tests', group: 'Verifica task functionalTest(type: Test, description: 'Runs the functional tests', group: 'Verification') { filter { //specific test method - includeTestsMatching "uk.gov.hmcts.payment.functional.RefundsRequestorJourneyPBAFunctionalTest.checkIssueRefundAddRefundAddRemissionFlagWithBalance" + includeTestsMatching "uk.gov.hmcts.payment.functional.RefundsRequestorJourneyPBAFunctionalTest" } include "uk/gov/hmcts/payment/functional/**" testClassesDirs = sourceSets.functionalTest.output.classesDirs From 5ad3f3c5f917fd37e5330afc2762c8f40bb3b160 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Thu, 13 Jun 2024 16:35:48 +0100 Subject: [PATCH 26/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 1 + .../payment/api/v1/controllers/ControllerExceptionHandler.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 0a1e9b28f0..6acae60827 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -282,6 +282,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, refundListDtoResponse = refundListDtoResponseEntity.hasBody() ? refundListDtoResponseEntity.getBody() : null; } catch (HttpClientErrorException e) { + LOG.error("Catch the refund error", e.getMessage()); e.printStackTrace(); LOG.error("There has been an error calling refunds endpoint.", e); refundListDtoResponse = null; diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java index 4c784226a3..dd44bc7347 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java @@ -23,6 +23,8 @@ public class ControllerExceptionHandler { public void unknownException(RuntimeException e) { LOG.error("GIVE ME A CLUE !!!!!"); e.printStackTrace(); + + e.getCause().printStackTrace(); LOG.error("Unknown error has occurred with errorMessage: " + e.getMessage(), e); } From 8e65b0595ba489e9551fc8511ea65a495aa83369 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 09:07:25 +0100 Subject: [PATCH 27/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 6acae60827..95c16ef710 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -283,7 +283,6 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, } catch (HttpClientErrorException e) { LOG.error("Catch the refund error", e.getMessage()); - e.printStackTrace(); LOG.error("There has been an error calling refunds endpoint.", e); refundListDtoResponse = null; } From f0852e4e1038e23c86bfa8cd650d574ebfb75b6a Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 09:29:19 +0100 Subject: [PATCH 28/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../functional/RefundsRequestorJourneyPBAFunctionalTest.java | 4 +--- .../api/v1/controllers/ControllerExceptionHandler.java | 2 -- docker-compose.yml | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java index a5e0783194..58758f3672 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/RefundsRequestorJourneyPBAFunctionalTest.java @@ -1,7 +1,5 @@ package uk.gov.hmcts.payment.functional; -import io.restassured.RestAssured; -import io.restassured.parsing.Parser; import io.restassured.response.Response; import net.serenitybdd.junit.spring.integration.SpringIntegrationSerenityRunner; import org.apache.commons.lang3.RandomUtils; @@ -499,7 +497,7 @@ public void checkIssueRefundAddRefundAddRemissionFlagWithBalance(){ = cardTestService .getPaymentGroupsForCase(USER_TOKEN_PAYMENT, SERVICE_TOKEN_PAYMENT, ccdCaseNumber); paymentGroupResponse - = casePaymentGroupResponse.as(PaymentGroupResponse.class); + = casePaymentGroupResponse.getBody().as(PaymentGroupResponse.class); paymentDtoOptional = paymentGroupResponse.getPaymentGroups().stream().findFirst(); diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java index dd44bc7347..4c784226a3 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java @@ -23,8 +23,6 @@ public class ControllerExceptionHandler { public void unknownException(RuntimeException e) { LOG.error("GIVE ME A CLUE !!!!!"); e.printStackTrace(); - - e.getCause().printStackTrace(); LOG.error("Unknown error has occurred with errorMessage: " + e.getMessage(), e); } diff --git a/docker-compose.yml b/docker-compose.yml index d36d25da94..d41feb8540 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -92,7 +92,7 @@ services: payments-database: container_name: payments-database - image: postgres:11-alpine + image: postgres:16-alpine environment: - POSTGRES_USER=${POSTGRES_USERNAME} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} @@ -124,7 +124,7 @@ services: ccfr-fees-database: container_name: ccfr-fees-database - image: postgres:11-alpine + image: postgres:16-alpine environment: - POSTGRES_USER=fees_register - POSTGRES_PASSWORD=${FEE_REGISTER} From d5b55d7ca565e2b4ac729dc9c10e262a53dcbcfe Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 09:53:20 +0100 Subject: [PATCH 29/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- api/build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index dfcbd2d00a..cc077ab543 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -202,10 +202,6 @@ task smokeTest(type: Test, description: 'Runs the smoke tests', group: 'Verifica } task functionalTest(type: Test, description: 'Runs the functional tests', group: 'Verification') { - filter { - //specific test method - includeTestsMatching "uk.gov.hmcts.payment.functional.RefundsRequestorJourneyPBAFunctionalTest" - } include "uk/gov/hmcts/payment/functional/**" testClassesDirs = sourceSets.functionalTest.output.classesDirs classpath = sourceSets.functionalTest.runtimeClasspath From e37dedc6d1bd0224426f99a89833f2bd9d7a5980 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 10:38:11 +0100 Subject: [PATCH 30/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/functional/TestContextConfiguration.java | 6 ------ .../api/v1/controllers/ControllerExceptionHandler.java | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java index bbaa0188f3..d6453205aa 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java @@ -24,12 +24,6 @@ @PropertySource("classpath:application-functional-tests.properties") public class TestContextConfiguration { - static { - // Set the default parser globally - RestAssured.defaultParser = Parser.JSON; - } - - @Value("${test.url:http://localhost:8080}") private String baseURL; diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java index 4c784226a3..33e4e20a50 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java @@ -23,6 +23,10 @@ public class ControllerExceptionHandler { public void unknownException(RuntimeException e) { LOG.error("GIVE ME A CLUE !!!!!"); e.printStackTrace(); + if(e.getCause()!=null){ + e.getCause().printStackTrace(); + LOG.error("Unknown error has occurred with errorMessage: " + e.getCause().getMessage(), e); + } LOG.error("Unknown error has occurred with errorMessage: " + e.getMessage(), e); } From 500733f8e838e5e29d8f2bb4e8be0f49e1f10de4 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 11:15:18 +0100 Subject: [PATCH 31/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../RefundRemissionEnableServiceImpl.java | 38 +++++++++---------- .../ControllerExceptionHandler.java | 4 -- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java index a34341e342..cf585395f2 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java @@ -128,25 +128,25 @@ public void setUserRoles(MultiValueMap headers) { private boolean validateRefundRoleWithServiceName(String serviceName) { boolean isRefundRoleForService = true; - LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); - LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); - String serviceNameRefundRole = AUTHORISED_REFUNDS_ROLE + "-" + serviceName.replace(" ","-") - .toLowerCase(); - String serviceNameRefundApprovalRole = AUTHORISED_REFUNDS_APPROVER_ROLE + "-" + serviceName.replace(" ","-") - .toLowerCase(); - LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); - LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); - List refundServiceRoles = roles.stream().filter(role -> - role.toLowerCase().contains(serviceNameRefundRole.toLowerCase()) - || role.toLowerCase().contains(serviceNameRefundApprovalRole.toLowerCase())) - .collect(Collectors.toList()); - - LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); - LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); - LOG.info("Validate Refund Role With Service Name ---> refundServiceRoles {}", refundServiceRoles.toString()); - if (refundServiceRoles == null || refundServiceRoles.isEmpty()) { - isRefundRoleForService = false; - } +// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); +// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); +// String serviceNameRefundRole = AUTHORISED_REFUNDS_ROLE + "-" + serviceName.replace(" ","-") +// .toLowerCase(); +// String serviceNameRefundApprovalRole = AUTHORISED_REFUNDS_APPROVER_ROLE + "-" + serviceName.replace(" ","-") +// .toLowerCase(); +// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); +// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); +// List refundServiceRoles = roles.stream().filter(role -> +// role.toLowerCase().contains(serviceNameRefundRole.toLowerCase()) +// || role.toLowerCase().contains(serviceNameRefundApprovalRole.toLowerCase())) +// .collect(Collectors.toList()); +// +// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); +// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); +// LOG.info("Validate Refund Role With Service Name ---> refundServiceRoles {}", refundServiceRoles.toString()); +// if (refundServiceRoles == null || refundServiceRoles.isEmpty()) { +// isRefundRoleForService = false; +// } return isRefundRoleForService; } } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java index 33e4e20a50..4c784226a3 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/v1/controllers/ControllerExceptionHandler.java @@ -23,10 +23,6 @@ public class ControllerExceptionHandler { public void unknownException(RuntimeException e) { LOG.error("GIVE ME A CLUE !!!!!"); e.printStackTrace(); - if(e.getCause()!=null){ - e.getCause().printStackTrace(); - LOG.error("Unknown error has occurred with errorMessage: " + e.getCause().getMessage(), e); - } LOG.error("Unknown error has occurred with errorMessage: " + e.getMessage(), e); } From b20ac1117e9df6d169e4024cf71cf12f8435a304 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 11:32:35 +0100 Subject: [PATCH 32/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../RefundRemissionEnableServiceImpl.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java index cf585395f2..a34341e342 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/RefundRemissionEnableServiceImpl.java @@ -128,25 +128,25 @@ public void setUserRoles(MultiValueMap headers) { private boolean validateRefundRoleWithServiceName(String serviceName) { boolean isRefundRoleForService = true; -// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); -// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); -// String serviceNameRefundRole = AUTHORISED_REFUNDS_ROLE + "-" + serviceName.replace(" ","-") -// .toLowerCase(); -// String serviceNameRefundApprovalRole = AUTHORISED_REFUNDS_APPROVER_ROLE + "-" + serviceName.replace(" ","-") -// .toLowerCase(); -// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); -// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); -// List refundServiceRoles = roles.stream().filter(role -> -// role.toLowerCase().contains(serviceNameRefundRole.toLowerCase()) -// || role.toLowerCase().contains(serviceNameRefundApprovalRole.toLowerCase())) -// .collect(Collectors.toList()); -// -// LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); -// LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); -// LOG.info("Validate Refund Role With Service Name ---> refundServiceRoles {}", refundServiceRoles.toString()); -// if (refundServiceRoles == null || refundServiceRoles.isEmpty()) { -// isRefundRoleForService = false; -// } + LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); + LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); + String serviceNameRefundRole = AUTHORISED_REFUNDS_ROLE + "-" + serviceName.replace(" ","-") + .toLowerCase(); + String serviceNameRefundApprovalRole = AUTHORISED_REFUNDS_APPROVER_ROLE + "-" + serviceName.replace(" ","-") + .toLowerCase(); + LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); + LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); + List refundServiceRoles = roles.stream().filter(role -> + role.toLowerCase().contains(serviceNameRefundRole.toLowerCase()) + || role.toLowerCase().contains(serviceNameRefundApprovalRole.toLowerCase())) + .collect(Collectors.toList()); + + LOG.info("Validate Refund Role With Service Name ---> roles {}", roles.toString()); + LOG.info("Validate Refund Role With Service Name ---> serviceName {}", serviceName); + LOG.info("Validate Refund Role With Service Name ---> refundServiceRoles {}", refundServiceRoles.toString()); + if (refundServiceRoles == null || refundServiceRoles.isEmpty()) { + isRefundRoleForService = false; + } return isRefundRoleForService; } } From 84c340270656e077257c3b67c7419ca594a328f2 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 12:01:35 +0100 Subject: [PATCH 33/37] PAY-7103: Calculate the AMOUNT DUE and OVERPAYMENTS for ( Issue refund and Remission-Refunds) [PAY-7103] (https://tools.hmcts.net/jira/browse/PAY-7103). --- .../functional/TestContextConfiguration.java | 28 ++++--------------- .../functional/service/CaseTestService.java | 10 +------ .../api/controllers/CaseController.java | 2 +- .../service/PaymentRefundsServiceImpl.java | 1 + 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java index d6453205aa..55d481a43d 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/TestContextConfiguration.java @@ -1,12 +1,9 @@ package uk.gov.hmcts.payment.functional; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import io.restassured.RestAssured; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.restassured.parsing.Parser; +import io.restassured.config.ObjectMapperConfig; import io.restassured.path.json.config.JsonPathConfig; -import io.restassured.path.json.mapper.factory.Jackson2ObjectMapperFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -14,10 +11,7 @@ import javax.annotation.PostConstruct; -import java.lang.reflect.Type; - import static io.restassured.config.JsonConfig.jsonConfig; -import static io.restassured.config.ObjectMapperConfig.objectMapperConfig; @Configuration @ComponentScan("uk.gov.hmcts.payment.functional") @@ -29,23 +23,11 @@ public class TestContextConfiguration { @PostConstruct public void initialize() { - - - // Create and configure the Jackson ObjectMapper - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true); - objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - - // Register the configured ObjectMapper with RestAssured RestAssured.config = RestAssured.config() - .objectMapperConfig(objectMapperConfig().jackson2ObjectMapperFactory(new Jackson2ObjectMapperFactory() { - @Override - public ObjectMapper create(Type cls, String charset) { - return objectMapper; - } - })).jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL)); - + .objectMapperConfig( + ObjectMapperConfig.objectMapperConfig().jackson2ObjectMapperFactory((cls, charset) -> new ObjectMapper()) + ) + .jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL)); RestAssured.useRelaxedHTTPSValidation(); RestAssured.baseURI = baseURL; } diff --git a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java index 8b342e07dc..ac6a6c42ff 100644 --- a/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java +++ b/api/src/functionalTest/java/uk/gov/hmcts/payment/functional/service/CaseTestService.java @@ -1,8 +1,6 @@ package uk.gov.hmcts.payment.functional.service; -import io.restassured.RestAssured; import io.restassured.http.ContentType; -import io.restassured.parsing.Parser; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.serenitybdd.rest.SerenityRest; @@ -14,19 +12,13 @@ @Named public class CaseTestService { - static { - // Set the default parser globally - RestAssured.defaultParser = Parser.JSON; - } - public Response getPaymentGroupsForCase(final String userToken, final String serviceToken, final String ccdCaseNumber) { return givenWithAuthHeaders(userToken, serviceToken) .contentType(ContentType.JSON) .when() - .get("/cases/{ccdcasenumber}/paymentgroups",ccdCaseNumber) - .then().defaultParser(Parser.JSON).extract().response(); + .get("/cases/{ccdcasenumber}/paymentgroups",ccdCaseNumber); } public RequestSpecification givenWithAuthHeaders(String userToken, String serviceToken) { diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 4594ea85ec..49b0aa47ce 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -123,7 +123,7 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc } LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); - LOG.info("END-----"); + LOG.info("END case number:-----"+ ccdCaseNumber); return paymentGroupResponse; } diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 95c16ef710..a1cc84c120 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -282,6 +282,7 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, refundListDtoResponse = refundListDtoResponseEntity.hasBody() ? refundListDtoResponseEntity.getBody() : null; } catch (HttpClientErrorException e) { + LOG.error("Catch the refund error for this case number: ", ccdCaseNumber); LOG.error("Catch the refund error", e.getMessage()); LOG.error("There has been an error calling refunds endpoint.", e); refundListDtoResponse = null; From d780a1a17bee37fc4c2836ac84b632a8167a7257 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 12:28:20 +0100 Subject: [PATCH 34/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../payment/api/service/PaymentRefundsServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index a1cc84c120..620e061508 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -282,9 +282,10 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, refundListDtoResponse = refundListDtoResponseEntity.hasBody() ? refundListDtoResponseEntity.getBody() : null; } catch (HttpClientErrorException e) { - LOG.error("Catch the refund error for this case number: ", ccdCaseNumber); - LOG.error("Catch the refund error", e.getMessage()); - LOG.error("There has been an error calling refunds endpoint.", e); + LOG.info("Catch the refund error for this case number: "+ ccdCaseNumber); + LOG.info("Catch the refund error", e.getMessage()); + LOG.info("There has been an error calling refunds endpoint.", e); + e.printStackTrace(); refundListDtoResponse = null; } From 11ec4b3b0b0b3cf09245819814e521b75bf7e6b4 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 12:59:19 +0100 Subject: [PATCH 35/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../hmcts/payment/api/service/PaymentRefundsServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java index 620e061508..63ca890592 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java @@ -281,11 +281,13 @@ private RefundListDtoResponse getRefundsFromRefundService(String ccdCaseNumber, refundListDtoResponse = refundListDtoResponseEntity.hasBody() ? refundListDtoResponseEntity.getBody() : null; - } catch (HttpClientErrorException e) { + } catch (Exception e) { LOG.info("Catch the refund error for this case number: "+ ccdCaseNumber); LOG.info("Catch the refund error", e.getMessage()); LOG.info("There has been an error calling refunds endpoint.", e); e.printStackTrace(); + LOG.info("Get cause: ", e.getCause()); + refundListDtoResponse = null; } From 98993a5b881021c1a131be39b81873f3bed0e2e5 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 14:00:27 +0100 Subject: [PATCH 36/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/api/controllers/CaseController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index 49b0aa47ce..b6b0055066 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -117,10 +117,10 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc PaymentGroupResponse paymentGroupResponse = new PaymentGroupResponse(paymentGroups); paymentGroupResponse = paymentRefundsService.checkRefundAgainstRemissionV2(headers, paymentGroupResponse, ccdCaseNumber); - RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); - if (refundListDtoResponse != null) { - paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); - } +// RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); +// if (refundListDtoResponse != null) { +// paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); +// } LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); LOG.info("END case number:-----"+ ccdCaseNumber); From 89388439ff7659e87b3d750a295f313d7f2c4b22 Mon Sep 17 00:00:00 2001 From: "it.consulting@tutanota.com" Date: Fri, 14 Jun 2024 14:15:34 +0100 Subject: [PATCH 37/37] Merge branch 'master' of github.com:hmcts/ccpay-payment-app into PAY-7000 # Conflicts: # api/src/main/java/uk/gov/hmcts/payment/api/service/PaymentRefundsServiceImpl.java --- .../gov/hmcts/payment/api/controllers/CaseController.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java index b6b0055066..bd9c42cb35 100644 --- a/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java +++ b/api/src/main/java/uk/gov/hmcts/payment/api/controllers/CaseController.java @@ -22,7 +22,6 @@ import uk.gov.hmcts.payment.api.dto.PaymentGroupDto; import uk.gov.hmcts.payment.api.dto.PaymentGroupResponse; import uk.gov.hmcts.payment.api.dto.PaymentSearchCriteria; -import uk.gov.hmcts.payment.api.dto.RefundListDtoResponse; import uk.gov.hmcts.payment.api.dto.mapper.PaymentDtoMapper; import uk.gov.hmcts.payment.api.dto.mapper.PaymentGroupDtoMapper; import uk.gov.hmcts.payment.api.model.PaymentFeeLink; @@ -117,11 +116,6 @@ public PaymentGroupResponse retrieveCasePaymentGroups(@PathVariable(name = "ccdc PaymentGroupResponse paymentGroupResponse = new PaymentGroupResponse(paymentGroups); paymentGroupResponse = paymentRefundsService.checkRefundAgainstRemissionV2(headers, paymentGroupResponse, ccdCaseNumber); -// RefundListDtoResponse refundListDtoResponse = paymentRefundsService.getRefundsApprovedFromRefundService(ccdCaseNumber,headers); -// if (refundListDtoResponse != null) { -// paymentGroups.stream().forEach(paymentGroup -> paymentGroup.setRefunds(refundListDtoResponse.getRefundList())); -// } - LOG.info("Refund " + paymentGroupResponse.getPaymentGroups().get(0).getRefunds()); LOG.info("END case number:-----"+ ccdCaseNumber); return paymentGroupResponse;