Skip to content

Commit

Permalink
Ret 4286 - Feature Flag Bundles (#609)
Browse files Browse the repository at this point in the history
* chore(deps): update all dependencies (#159)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* RET-2643 (#185)

* chore(deps): update all dependencies (#159)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* RET-2643

* RET-2643

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>

* caseTypeId removed from log as it is null (#186)

* Added pound symbol and line seperators (#188)

* RET-2792 (#192)

* RET-2792 - revert changes (#197)

* RET-2792 (#196)

* RET-2731: Mock out ACAS Service tests and improve logging in et-sya-api (#190)

* RET-2731: Mock AcasService tests

* RET-2731: Add logs to AcasService attemptWithRetriesToFetchAcasCertificates()

* RET-2731: change acas apie key to dummy

* RET-2731: Checkstyle fixes

* RET-2731: Remove disabled annotation

Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>

* Ret 2800 (#195)

* RET-2800: Supporting Document not present in documentCollection

* RET-2800: Fixed pmd

* moved method to CaseDocumentService

* Ret 2783 Welsh translation content - Generate Welsh pdf claim form (#191)

* RET-2783: Added welsh PDF case file generation if the user has selected to be contacted in welsh

* Fix broken unit tests

* added welsh tests

* fixed welsh tests to work with differant language generations

* minor review comments

* fixed breaking change, changing pdf document name

* fixed build issues

Co-authored-by: Jack Brogan <jack.brogan@hmcts.net>
Co-authored-by: paul.peasegood <paul.peasegood@version1.com>

* Ret 2800 2 (#198)

* RET-2800: Supporting Document not present in documentCollection

* RET-2800: Fixed pmd

* moved method to CaseDocumentService

* RET-2800: Added test coverage

* Ret 2792 new (#200)

* Ret 2792 new (#201)

* Ret 2846 (#202)

* Updates for PDF Creation

* Updates for PDF Creation

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Removed suppressed vulnerability and changed spring-cloud-starter-openfeign version from 3.1.2 to 3.1.5

* Removed suppressed vulnerability

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.13.4.1' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding   implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Ret 2864 postcode and test updates - javadoc Implementation (#205)

* Updates for PDF Creation

* Updates for PDF Creation

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Removed suppressed vulnerability and changed spring-cloud-starter-openfeign version from 3.1.2 to 3.1.5

* Removed suppressed vulnerability

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.13.4.1' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding   implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Updated tests added new postcode formatter to PdfMapperUtil

* Updated tests added new postcode formatter to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Changed convertFirstCharactersToCapitalCase method name to convertFirstCharactersOfWordsToCapitalCase

* Updates for country list of UK. (#206)

* Handling null values (#204)

* Fixed missing imports

* Refactored test

* Merge1.1.0.2 into welsh (#208)

* RET-2643 (#185)

* chore(deps): update all dependencies (#159)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* RET-2643

* RET-2643

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>

* caseTypeId removed from log as it is null (#186)

* Added pound symbol and line seperators (#188)

* RET-2792 (#192)

* RET-2792 - revert changes (#197)

* RET-2731: Mock out ACAS Service tests and improve logging in et-sya-api (#190)

* RET-2731: Mock AcasService tests

* RET-2731: Add logs to AcasService attemptWithRetriesToFetchAcasCertificates()

* RET-2731: change acas apie key to dummy

* RET-2731: Checkstyle fixes

* RET-2731: Remove disabled annotation

Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>

* Ret 2800 (#195)

* RET-2800: Supporting Document not present in documentCollection

* RET-2800: Fixed pmd

* moved method to CaseDocumentService

* Ret 2800 2 (#198)

* RET-2800: Supporting Document not present in documentCollection

* RET-2800: Fixed pmd

* moved method to CaseDocumentService

* RET-2800: Added test coverage

* Ret 2846 (#202)

* Updates for PDF Creation

* Updates for PDF Creation

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Removed suppressed vulnerability and changed spring-cloud-starter-openfeign version from 3.1.2 to 3.1.5

* Removed suppressed vulnerability

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.13.4.1' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding   implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Ret 2864 postcode and test updates - javadoc Implementation (#205)

* Updates for PDF Creation

* Updates for PDF Creation

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Suppressed jackson core - jackson databind@2.13.4
NOTE: this is a new vulnerability defined on 17/NOV/2022 details are defined in the url https://nvd.nist.gov/vuln/detail/CVE-2022-42003

* Removed suppressed vulnerability and changed spring-cloud-starter-openfeign version from 3.1.2 to 3.1.5

* Removed suppressed vulnerability

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.13.4.1' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Vulnerability CVE-2022-42003 is resolved by adding   implementation group: 'com.fasterxml.jackson.core', name:  'jackson-databind', version: '2.14.0' to the dependencies section of build.gradle at line 220. Besides upgraded depreciated main definition on line 326

* Updated tests added new postcode formatter to PdfMapperUtil

* Updated tests added new postcode formatter to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Added Javadocs to PdfMapperUtil

* Changed convertFirstCharactersToCapitalCase method name to convertFirstCharactersOfWordsToCapitalCase

* Updates for country list of UK. (#206)

* Update CaseService.java

Update CaseService.java

* Refactored test

* Checkstyle

Co-authored-by: GauravChawlaMOJ <58194626+GauravChawlaMOJ@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: ikirsanov <105438011+ikirsanov@users.noreply.github.com>
Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>
Co-authored-by: robin-ieong <101253854+robin-ieong@users.noreply.github.com>
Co-authored-by: Mehmet Tahir Dede <105645217+JustMehmet@users.noreply.github.com>

* Test fix

* Test fix

Test fix

* RET-2750: Add functional tests to controllers classes (#203)

* RET-2750: Add DocumentUpload functional test

* RET-2750: Chekstyle fix

* RET-2750: Chekstyle fix

* RET-2750: Add vulnerability issue fix

* RET-2750: Change multipart params

* RET-2750: CheckStyle

* RET-2750: multipart content type

* RET-2750: Add functional tests to DocumentUploadController

* RET-2750: Add functional tests for DocumentController

* RET-2750: Fix DocumentControllerFunctionalTest

* RET-2750: Add AcasControllerFunctionalTest

Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>

* RET-2574: Add manageOffice assignment before case submitted (#178)

* chore(deps): update all dependencies (#159)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* RET-2574: Add manageOffice assignment before case submitted

* RET-2574: Rename case assignment to local office service and move it to service package

* RET-2574: checkStyle test fixes

* RET-2574: checkStyle test fixes

* RET-2574: Fix assigning case to local office logic, remove unused imports

* RET-2574: Add suppressions for spring security and tomcat

* RET-2574: Set @disable to AcasService tests

* RET-2574: Add in convertCaseRequestToCaseDataWithTribunalOffice managingOffice assignment to caseRequest

* RET-2574: getManagingOffice returns Unassigned if invalidPostcodeException thrown

* RET-2574: checkstyle fix

* RET-2574: Remove suppressions

* RET-2574: AcasServiceTest fix

* RET-2574: AcasServiceTest fix

* RET-2574: Refactor condition in assingCaseToLocalOfficeService

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>

* Fix disability claim (#209)

* claimantInd null values (#214)

* Keeping sonar happy (#215)

* claimantInd null values

* sonar checks

* sonar checks

* RET-2877 - Null check for contact language (#212)

* Null check for contact language

* Refactor notification service

* Use Welsh language constant

* RET-2871 fix (#217)

* RET-2818. Update et-data-model version to add hearing language preference. (#211)

* cve (#220)

* cve

* cve suppressions

* cve suppressions

* cve suppressions

* RET-2848 (#219)

* Et data model update (#225)

* Ret 2864 add java docs to public/protected elements (#224)

* 2864: add javadocs to classes

* 2864: add jdocs

* 2864: add more jdocs

* 2864: add jdocs and fix issues

* 2864: fix merge and pmd

* Release 1.1.0.2 (#207) (#226)

All code merged for Release 1.1.0.2.

- Referral Enhancements
- Initial Consideration Enhancements
- Bug Fixes
- ECM fixes/enhancements

Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>
Co-authored-by: Marc Judge <marc.judge@version1.com>

* Add file extension (#227)

* Add file extension

* Fix checkstyle

* Bump spring boot

Co-authored-by: Marc Judge <marc.judge@version1.com>

* Acas cert logging removed (#232)

* welsh doc template updated (#233)

* Allow all test responses (#239)

Co-authored-by: Marc Judge <marc.judge@version1.com>

* RET-3045: Fix for respondent details being reset (#238)

* RET-3045: Fix for respondent details being reset

* Fix for CVEs

* Fix for CVEs

* Fix for checkstyle

* Refactered to not use var type

* 1.2 - Dependency bump (#240)

* Bump patch

* Add CVE

* New CVEs

* bump additional

* Remove CVE and bump tomcat

* Remove outdated suppressions

* Bump spring-security-crypto

* Remove outdated supressions

* Remove spring suppressions

Co-authored-by: Marc Judge <marc.judge@version1.com>

* RET-2616. Create submit-claimant-application endpoint. (#245)

* RET-2616. Create submit-claimant-application endpoint.

* Bump et-data-model

Co-authored-by: Marc Judge <marc.judge@version1.com>

* Bump data model (#257)

* Update Welsh email template to prod (#259)

* RET-2289: Et-common version bump to 1.0.11 (#260)

* RET-2289 (#261)

* RET-2289: Et-common version bump to 1.0.11

* RET-2289: et-common version bump to 1.0.13

* RET-2296 (#262)

* RET-2296

RET-2296

RET-2296

Update Chart.yaml

* Chart update

* Ret 2816 - Create PDF CYA page for 'Contact the Tribunal about something else' (#243)

* RET-2616/7. Interim commit - define caseEvent for submitting an application - need to actually create the endpoints for the frontend that triggers the event.

* 2816: add Tse SYA pdf create

* 2816: add test

* 2816: add tests

* 2816: refactor code to upload pdf to dm-store

* 2816: refactor code into function

* 2816: add tests for new changes

* 2816: create fixes for gradle build issues

* FRET-2816. Fix PMD

* FRET-2816. Move tse pdf generation to the tse endpoint

* FRET-2816. Fix tests.

* RET-2816. Fix imports.

* RET-2816. Clean with builder

* RET-2816. Fix checkstyle

* RET-2816. Try bumping chart up

* Add application form to document collection

* RET-2816. Fix tests

* RET-2816. Add logic deciding when to generate and upload the document

* RET-2816. Fix PMD issue

* Order imports

* Initialize empty document collection

* Change is_type_c to type_c

---------

Co-authored-by: Itay-Kirsh <Itayk747@gmail.com>
Co-authored-by: marcjudge <marc.judge@hmcts.net>

* RET-2758 (#270)

* Send acknowledgement email to claimant

* RET-2758: Add Changes to NotificationsHelper, ManageCaseControllerTest, CaseServiceTest and caseDetails.json files to fix the unit tests

* RET-2758: Remove spacings, uncomment the sendnotifications lines

* RET-2758: Format NotificationServiceTest

* RET-2758: Fix checkstyle

* RET-2758: Merge conflict solving

* RET-2758: Fix checkstyle

* RET-2758: Fix PMD rules

* Simplify notification service

---------

Co-authored-by: Marc Judge <marc.judge@version1.com>
Co-authored-by: marcjudge <marc.judge@hmcts.net>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>

* Fix caseId (#273)

* Ret 2816 fix uploading of documents

* RET-2816 upload the supporting document to the document list

* Fix checkstyles

* Fix type of document to be one of the set list.

* Make sure supporting document uploaded regardless of application overview pdf.

* Fix returning new case details when submitting application

* Fix build (#276)

* Add null check (#277)

* RET-2815 + RET-2814 (#278)

* Add emails to respondent and tribunal

* Add test coverage

* Add application service tests

* Fix code smells

* Add Notifications Helper tests

* Add hearing date tests

* Fix more smells

* Get CYA doc from doc collection

* Fix tribunal email

* Fix up issues

* Add logging and handling (#280)

* Suppress CVE (#282)

* CVEs

* CVEs

* Fix respondent email sending

* Chart

* Update app insights key (#284)

* Chart

* Bump packages (#286)

* Bump minor + checkstyle + pmd

* Add all plugin updated and new PMD rules

* Fix merge commit (#290)

* Fix merge issues (#288)

* Ret 2785 - Endpoint for saving claimant response to application from respondent (#289)

* Create Respond to Application endpoint

* Add unit tests and refactor

* Small fixes

* Add integration tests

* Use SUBMIT_CLAIAMNT_TSE event (#295)

* Update all dependencies (#296)

* Update all dependencies

* Remove breaking updates

* remove suppressions

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>
Co-authored-by: marcjudge <marc.judge@hmcts.net>

* Ret 2786 final (#299)

* Use SUBMIT_CLAIAMNT_TSE event

* Use CLAIMANT_TSE_RESPOND event

* Fix saving doc upload (#300)

* ACAS Claimant Request Docs

* Revert "ACAS Claimant Request Docs"

This reverts commit 703d25d.

* ACAS Claimant Request Docs

* Send response email to Tribunal (#302)

Co-authored-by: Marc Judge <marc.judge@version1.com>

* Update all dependencies (#301)

* Update all dependencies

* Update gradle-wrapper.properties

* Update build.gradle

* Update snake yaml cve

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>
Co-authored-by: Marc Judge <marc.judge@version1.com>

* RET-3356: Fix for View All Application page not displaying full app type (#304)

* RET-3356: Fix for View All Application page not displaying full app type

* Fixed checkstyle

* Fixed PMD

* RET-3055 (#313)

* RET-3055: Change retention period to 78 weeks from 52

* RET-3055: Fix dependencies versions

* RET-3055, add suppressions

* RET-3055, bump tomcat version

* RET-3055, add suppressions

* RET-3055, remove suppression

* RET 2827 - email to Claimant for Responding to an application (#315)

* add email acknowledgement

* test: add unit tests for added notification service method

* add missing java doc param

* bump spring framework version

* bump tomcat-embed versions to 9.0.73

* add claimant portal url to email

* Update all dependencies (#318)

* Update all dependencies

* Update gradle-wrapper.properties

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>

* Ret 2826 (#316)

* Create pdf of claimant response to application

* Fix checkstyle and pmd

* Add unit tests

* Add java docs

* RET-2927 (#319)

* RET-2729: Update sendNotification state to 'viewed'

* RET-2729: Fix tests imports

* RET-2729: Fix checkstyle

* RET-2729: Fix checkstyle

* RET-2729: PMD rules

* RET-2729: Code review changes on SendNotificationService logic-added startEventResponse before submitUpdate

* Ret 2829 Apps & Case Mgmt common – Generate email notification to Respondent when Claimant responds to an application (#321)

* RET-2829 added sendResponseEmailToRespondent

* RET-2829 added unit tests

* RET-2829 review comments

* RET-2829 fix PMD issues

* RET-2829 reivew comments

* RET-2829 update ruleset

* RET-2829 minor formating

---------

Co-authored-by: Paul.Peasegood@hmcts.net <paulp@LAPTOP4439.V1.com>

* Update values.yaml

* RET-3464 - Mergefix (#327)

* PET-1.1.1.2 ET-PET PI29 Sprint 3 (#297)

* Update for the service getAllUserCases to convert it to elastic search (#293)

* RET-2961 - wrong pdf template (#298)

* Update CaseServiceTest.java

* ret-3168 implementation reimported to new branch (#305)

* ret-3168 implementation reimported to new branch

* Bumping chart version/ fixing aliases

* template ids updated

Template ids are updated for case submission emails. Also, new id is added for doc upload error email.  All three email template ids are for prod environment.

* user selected language check logic corrected

* prod template ids restored

---------

Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>

* PET 1.1.1.2 fix (#308)

* PET 1.1.1.2 fix

* PET 1.1.1.2 fix (#309)

* PET 1.1.1.2 fix

* PET 1.1.1.2 fix

* RET-3168 (#314)

* Updates for the task RET-3168

* Updates for the task RET-3168

* Updates for the task RET-3168

* Updates for the task RET-3168

* Updates for the task RET-3168

* Updates for the task RET-3168

* Ret-3168 Update for Code Quality (#317)

* Updates for code quality.

* Updates for code quality.

* Updates for code quality.

* Updates for code quality.

* Updates for code quality.

* Updates for code quality.

* Updates for code quality.

* Code Smell Updates (#320)

* Code Smell Updates

* Updates for SUBMIT_CASE_EMAIL_TEMPLATE_ID, CY_SUBMIT_CASE_EMAIL_TEMPLATE_ID, SUBMIT_CASE_DOC_UPLOAD_ERROR_EMAIL_TEMPLATE_ID for sending emails with files.

---------

Co-authored-by: GauravChawlaMOJ <58194626+GauravChawlaMOJ@users.noreply.github.com>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>
Co-authored-by: btensay <tensay.bulcha@gmail.com>
Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>

* Fix Emails (#326)

* Fortify issue fix (#324)

* Fortify issue fix

* Fortify issue fix

* Fix notification service test

* Bumping chart version/ fixing aliases

* Remove duplicate

---------

Co-authored-by: Mehmet Tahir Dede <105645217+JustMehmet@users.noreply.github.com>
Co-authored-by: GauravChawlaMOJ <58194626+GauravChawlaMOJ@users.noreply.github.com>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>
Co-authored-by: btensay <tensay.bulcha@gmail.com>
Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>

* Fix branch

* Ret 3396: Update Templates with Dynamic Links (#322)

* RET-3396: Merge Claimant Response to Tribunal emails into one email

* RET-3396: Update Claimant Application to use dynamic link

* RET-3396: Update Claimant Application email to Respondent to use dynamic link

* RET-3396: Update Claimant Application email to Claimant to use dynamic link

* RET-3396: Some code tidy up

* RET-3396: Post merge tidy up

* Update et-model-data version number (#332)

* Ret 2829 Apps & Case Mgmt common – Generate email notification to Respondent when Claimant responds to an application (CitizenUI) (#328)

* RET-2829 added sendResponseEmailToRespondent

* RET-2829 added unit tests

* RET-2829 review comments

* RET-2829 fix PMD issues

* RET-2829 reivew comments

* RET-2829 update ruleset

* RET-2829 minor formating

* RET-2829 fix bug on sending responant email on a no response

* RET-2829 fix checkstyle issues

* RET-2829 reivew comment

---------

Co-authored-by: Paul.Peasegood@hmcts.net <paulp@LAPTOP4439.V1.com>

* RET-3480 - Retrieve all cases (#340)

* Retrieve all cases

* Add commons-fileupload 1.5

* Bump chart (#343)

* Ret 2929 Provide something Tribunal asked for - CYA page for response to order/request from Tribunal (CitizenUI) (#342)

* RET-2929 added add-response-send-notification

* RET-2929 added unit tests

* Bumping chart version/ fixing aliases

* RET-2929 added javaDocs

* RET-2929 fix java docs

* RET-2929: Add to response 'Claimant', 'Date', 'Reponse size' and change sendNotificationState

---------

Co-authored-by: Paul.Peasegood@hmcts.net <paulp@LAPTOP4439.V1.com>
Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>
Co-authored-by: ikirsanov <ivan.kirsanov@version1.com>

* Ret 2931/2932 - send email notifications for response to a notification (#347)

* RET-2929 added add-response-send-notification

* RET-2929 added unit tests

* Bumping chart version/ fixing aliases

* RET-2929 added javaDocs

* RET-2929 fix java docs

* RET-2929: Add to response 'Claimant', 'Date', 'Reponse size' and change sendNotificationState

* RET-2931 added sendResponseNotificationEmailToTribunal

* RET-2932 added sendResponseNotificationEmailToRespondent

* RET-2930 added sendResponseNotificationEmailToClaimant

* RET-2931 small fixes after testing

* ret-2931 fix checkstyle issues

* RET-2931 fix failing unit test

---------

Co-authored-by: Paul.Peasegood@hmcts.net <paulp@LAPTOP4439.V1.com>
Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>
Co-authored-by: marcjudge <98343606+marcjudge@users.noreply.github.com>
Co-authored-by: ikirsanov <ivan.kirsanov@version1.com>

* RET-2929_bug_fix (#350)

* RET-2929_bug_fix: change status of notification to VIEWED when respond added to notification

* RET-2929_bug_fix: removed unused import

* Ret 3513 (#355)

* RET-3513. Remove application.properties

* RET-3513. Use dev template ids

* RET-3549: Align with data-model 2 (#361)

* Ret 3233 - View an application/case judgment from CitizenUI hub page (#360)

* Create new doclist if it is null

* interim commit - not sure it works by now

* Adding admin decision state

* Adding admin decision notification state test

* Fixed failing test

* Bump model

* Reset data model

* Fix checkstyle

* checksyle fixes

---------

Co-authored-by: Itay-Kirsh <Itayk747@gmail.com>

* Ret 3502 (#356). Fix NPE Document collection.

* Create new doclist if it is null

* interim commit - not sure it works by now

---------

Co-authored-by: lvo700 <lorr05@qub.ac.uk>

* RET-3513. Fix submit claim emails (#362)

* RET-3513. Fix submit claim emails
- Missing Welsh template
- Both templates outdated - new pdf-template added locally.
- Welsh missing case id in citizen portal link
- Remove values.yaml values that are already in application.yaml

* Bumping chart version/ fixing aliases

---------

Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>

* Ret 3513. Update error email template (#363)

* Remove testing of spring properties - useless tests.

* Update template id for error email. Remove from Values.yaml

* Tested error email being sent to all parties, had to have actual email defaults for dev.

* Chart bump

* Update Chart.yaml

* Update Chart.yaml

* RET-3153. Clean application.yaml and charts (#367)

* Move properties around

* Remove Values.yaml properties that are in both values.yaml and application.yaml

* interim - bring back:
- locally overridden tse properties
- non-locally overridden pse properties

* Todo

* Start separating PSE and TSE

* Finish separating TSE and PSE and clean a little.

* nothing commit (#372)

Getting Release 2 PR setup

* fix length of line (#374)

* bump chart ver

* Remove duplicated requestCaseDataListEnglandAcas

* Fix checkstyle and sonarlint issues

* RET-3596: Rule 92 Screen displayed when other party is not a system user (#378)

* RET-3596: Rule 92 Screen displayed when other party is not a system user

* Bumping chart version/ fixing aliases

* Refactored for pmd

---------

Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>

* Ret-3697. Change status of applications when claimant responds to respondent (#379)

* When claimant responds to respondent's application, set status to waitingForTheTribunal

* Add test

* Update test to include more appropriate data

* Update application state request for a claimant viewing an application
Also added testing around finding an application by its id

* Add empty document list if doesn't exist

* Clean test code

* Clean imports

* Fix PMD

* RET-3626 Bug fix - claimant response to application without an upload (#381)

* allow response to application  with either text or upload file, upload not mandatory

* fix checkstyle, pmd

* change null check for uploading file

* remove unused import

* Updated springboot patch version and suppressed vuns that don't have newer versions (#387)

* Ret 3684. Status update for respondents applications. (#382)

* Transition "view an application" to "change application status"

* Upgrade data-model version so that I can keep track of whether claimant / respondent responded

* Upgrade data-model version again

* RET-3684 Claimant responding to tribunal request for information (#391)

* Scenario 4

* Update datamodel version with fix for booleans -> Booleans for default value to null

* Fix tests so that they run against claimantResponseRequired, not respondentResponseRequired

* ResponseRequired might be null, swap order of equals comparison, add another test

* PMD fix

* Suppress owasp vulnerability

* Parameterize the ApplicationServiceTest tests

* Suppress "UnusedPrivateMethod" as done in the callbacks

* RET 3796, 3797 Emails to tribunal, claimant on response to tribunal order within an application (#395)

* add 3796, 3797

* add unit tests

* change unit test to use ParameterizedTest

* RET-3796 v2 (#398)

* change Boolean to boolean

* update getter for isRespondingToRequestOrOrder

* Ret 3798. Email respondent when claimant replies to tribunal  (#394). Lots of generic cleaning as well

* Clean code

* Methods and class don't need to be public

* Class might need to be public (unless we move the exception to the same package)

* Send new email out to respondent if claimant replies and rule 92 is yes

* Clean and add tests. Also fix it just simply not working
(I changed status to not needing to respond and then checked it later when sending emails)

* Clean imports

* Fix PMD main

* Rearrange related RespondToApplication tests to be together in the nested class and fix PMD issues

* Clean code and remove duplication

* Clean code with CoreEmailDetails

* Align law of demeter properties with callbacks

* Fix PMD

* Fixed tests and add task to clean template ids

* Rename application.yaml properties to match a consistent pattern

* Use constant - pmd issue fix

* Reorder notification properties

* Early return to remove else

* Remove patterns for concatenating strings

* Use string join instead of simple concatenation

* clean code

* Resolve Conflicts after PET release (#396)

* conflicts

* Fix decision state update (#400)

* RET-3890. Add identical shortDescription for supporting document of claimant TSE apps (#402)

* RET-3798. Fix url parameter to include link directly to case page (#406)

* RET-3792 - Add endpoint for setting admin response as viewed (#408)

* Add endpoint for setting admin response as viewed

* Add java docs

* Update src/main/java/uk/gov/hmcts/reform/et/syaapi/service/ApplicationService.java

Co-authored-by: JackReevies <43950645+JackReevies@users.noreply.github.com>

---------

Co-authored-by: JackReevies <43950645+JackReevies@users.noreply.github.com>

* Add short description to supporting material response doc (#410)

* Add short description to supporting material response doc

* Update tests

* Add functional test artifacts  (#407)

* Test functional

* Removed unneeded artifacts

* Added functional tests for ManageCaseController

* Fix PMD

* Added sad path test

* Fix PMD

* Update application.properties

* Fixed test

* Fixed test

* Add timeout

* Fix checkstyle

* added role for functional test account

* Fix checkstyle

* Added response validations and sad paths to FTs

* Fix pmd

* Make tests run against preview and staging pods

* Set tests to point to demo as aat is not set for release 1.2

---------

Co-authored-by: dharmendra kumar <dharmendra.kumar@hmcts.net>

* Change the url to point to aat

* RET 3092 Claimant Bundles CYA (#579)

* move across code

* submit claimant bundles

* Feature flag bundles

* Remove suppression

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: GauravChawlaMOJ <58194626+GauravChawlaMOJ@users.noreply.github.com>
Co-authored-by: Harpreet Jhita <harpreet.jhita@justice.gov.uk>
Co-authored-by: ikirsanov <105438011+ikirsanov@users.noreply.github.com>
Co-authored-by: KirsanovI <ivan.kirsanov@hmcts.net>
Co-authored-by: robin-ieong <101253854+robin-ieong@users.noreply.github.com>
Co-authored-by: paul-peasegood <116294451+paul-peasegood@users.noreply.github.com>
Co-authored-by: Jack Brogan <jack.brogan@hmcts.net>
Co-authored-by: paul.peasegood <paul.peasegood@version1.com>
Co-authored-by: Mehmet Tahir Dede <105645217+JustMehmet@users.noreply.github.com>
Co-authored-by: Itay-Kirsh <Itayk747@gmail.com>
Co-authored-by: Daryl Boam <104851463+DarylBoam@users.noreply.github.com>
Co-authored-by: Marc Judge <marc.judge@version1.com>
Co-authored-by: lvo700 <lorr05@qub.ac.uk>
Co-authored-by: brendanmchugh <95289167+brendanmchugh@users.noreply.github.com>
Co-authored-by: Paul.Peasegood@hmcts.net <paulp@LAPTOP4439.V1.com>
Co-authored-by: btensay <tensay.bulcha@gmail.com>
Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com>
Co-authored-by: fergusoshea <114142469+fergusoshea@users.noreply.github.com>
Co-authored-by: ikirsanov <ivan.kirsanov@version1.com>
Co-authored-by: JackReevies <43950645+JackReevies@users.noreply.github.com>
Co-authored-by: Jack Reeve <jack@reevies.tech>
Co-authored-by: gauravchawla <gaurav-chawla@hotmail.com>
Co-authored-by: dharmendra kumar <dharmendra.kumar@hmcts.net>
Co-authored-by: Brendan McHugh <brendan.mchugh@hmcts.net>
  • Loading branch information
1 parent 88c1e32 commit 7edf148
Show file tree
Hide file tree
Showing 12 changed files with 485 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ext {
}

dependencies {
implementation group: 'com.github.hmcts', name: 'et-data-model', version: '2.8.1'
implementation group: 'com.github.hmcts', name: 'et-data-model', version: '3.0.3'
implementation('com.github.hmcts:et-common:1.2.8') { transitive = false }
implementation group: 'uk.gov.dwp.regex', name: 'postcode-validation', version: '1.1.0'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package uk.gov.hmcts.reform.et.syaapi.controllers;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
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.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import uk.gov.hmcts.reform.et.syaapi.models.ClaimantBundlesRequest;
import uk.gov.hmcts.reform.et.syaapi.service.BundlesService;
import uk.gov.hmcts.reform.et.syaapi.service.FeatureToggleService;
import uk.gov.hmcts.reform.et.syaapi.service.VerifyTokenService;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Objects;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static uk.gov.hmcts.reform.et.syaapi.constants.EtSyaConstants.SCOTLAND_CASE_TYPE;

@AutoConfigureMockMvc(addFilters = false)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
class BundlesControllerIntegrationTest {
private static final String CASE_DETAILS_JSON = "responses/caseDetails.json";

private CaseDetails caseDetailsResponse;

private static final String AUTH_TOKEN = "testToken";

@Autowired
private MockMvc mockMvc;
@MockBean
private VerifyTokenService verifyTokenService;
@MockBean
private AuthTokenGenerator authTokenGenerator;
@MockBean
private BundlesService bundlesService;
@MockBean
private FeatureToggleService featureToggleService;

@Autowired
private ResourceLoader resourceLoader;


@BeforeAll
void setUp() throws IOException {
caseDetailsResponse = resourceLoader.fromString(
CASE_DETAILS_JSON,
CaseDetails.class
);
}


@DisplayName("Should create bundle and return case details")
@Test
void submitBundles() throws Exception {
when(verifyTokenService.verifyTokenSignature(any())).thenReturn(true);
when(authTokenGenerator.generate()).thenReturn("token");
when(bundlesService.submitBundles(any(), any())).thenReturn(caseDetailsResponse);
when(featureToggleService.isBundlesEnabled()).thenReturn(true);
ClaimantBundlesRequest caseRequest = ClaimantBundlesRequest.builder()
.caseTypeId(SCOTLAND_CASE_TYPE)
.caseId("12")
.build();

mockMvc.perform(
put("/bundles/submit-bundles")
.header(HttpHeaders.AUTHORIZATION, AUTH_TOKEN)
.contentType(MediaType.APPLICATION_JSON)
.content(resourceLoader.toJson(caseRequest)))
.andExpect(status().isOk())
.andExpect(content().json(getSerialisedMessage(CASE_DETAILS_JSON)));
}

private String getSerialisedMessage(String fileName) {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
File file = new File(Objects.requireNonNull(classLoader.getResource(fileName)).getFile());
return new String(Files.readAllBytes(file.toPath()));

} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import uk.gov.hmcts.reform.et.syaapi.models.RespondToApplicationRequest;
import uk.gov.hmcts.reform.et.syaapi.models.TribunalResponseViewedRequest;
import uk.gov.hmcts.reform.et.syaapi.service.ApplicationService;
import uk.gov.hmcts.reform.et.syaapi.service.BundlesService;
import uk.gov.hmcts.reform.et.syaapi.service.VerifyTokenService;
import uk.gov.hmcts.reform.idam.client.IdamClient;
import uk.gov.hmcts.reform.idam.client.models.UserInfo;
Expand Down Expand Up @@ -68,6 +69,8 @@ class ManageCaseControllerIntegrationTest {
private CoreCaseDataApi ccdApiClient;
@MockBean
private ApplicationService applicationService;
@MockBean
private BundlesService bundlesService;

@Autowired
private ResourceLoader resourceLoader;
Expand All @@ -92,6 +95,7 @@ void setUpBeforeEach() throws NotificationClientException {
when(applicationService.submitApplication(any(), any())).thenReturn(caseDetailsResponse);
when(applicationService.respondToApplication(any(), any())).thenReturn(caseDetailsResponse);
when(applicationService.updateTribunalResponseAsViewed(any(),any())).thenReturn(caseDetailsResponse);
when(bundlesService.submitBundles(any(),any())).thenReturn(caseDetailsResponse);
}

@DisplayName("Should get single case details")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package uk.gov.hmcts.reform.et.syaapi.controllers;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import uk.gov.hmcts.reform.et.syaapi.annotation.ApiResponseGroup;
import uk.gov.hmcts.reform.et.syaapi.models.ClaimantBundlesRequest;
import uk.gov.hmcts.reform.et.syaapi.service.BundlesService;
import uk.gov.hmcts.reform.et.syaapi.service.FeatureToggleService;

import javax.validation.constraints.NotNull;

import static org.springframework.http.ResponseEntity.ok;
import static uk.gov.hmcts.reform.et.syaapi.constants.EtSyaConstants.AUTHORIZATION;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/bundles")
public class BundlesController {
private final BundlesService bundlesService;
private final FeatureToggleService featureToggleService;


/**
* Submits claimant hearing document pdf and related information.
*
* @param authorization jwt of the user
* @param request the request object which contains the claimant application passed from sya-frontend
* @return the new updated case wrapped in a {@link CaseDetails
* }
*/
@PutMapping("/submit-bundles")
@Operation(summary = "Submit bundles hearing document and related data")
@ApiResponseGroup
public ResponseEntity<CaseDetails> submitBundles(
@RequestHeader(AUTHORIZATION) String authorization,
@NotNull @RequestBody ClaimantBundlesRequest request
) {
boolean bundlesToggle = featureToggleService.isBundlesEnabled();
if (bundlesToggle) {
log.info("Received submit bundles request - caseTypeId: {} caseId: {}",
request.getCaseTypeId(), request.getCaseId()
);
CaseDetails finalCaseDetails = bundlesService.submitBundles(authorization, request);
return ok(finalCaseDetails);
}
throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE, "Bundles feature is not available");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public enum CaseEvent {
UPDATE_NOTIFICATION_STATE,
UPDATE_NOTIFICATION_RESPONSE,
UPDATE_ADMIN_DECISION_STATE,
UPDATE_HUBLINK_STATUS
UPDATE_HUBLINK_STATUS,
SUBMIT_CLAIMANT_BUNDLES,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uk.gov.hmcts.reform.et.syaapi.models;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;
import lombok.Data;
import lombok.extern.jackson.Jacksonized;
import uk.gov.hmcts.et.common.model.ccd.types.HearingBundleType;

@Data
@Builder
@Jacksonized
public class ClaimantBundlesRequest {

@JsonProperty("case_id")
private String caseId;
@JsonProperty("case_type_id")
private String caseTypeId;
@JsonProperty("claimant_bundles")
private HearingBundleType claimantBundles;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package uk.gov.hmcts.reform.et.syaapi.service;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.et.common.model.ccd.CaseData;
import uk.gov.hmcts.et.common.model.ccd.items.GenericTypeItem;
import uk.gov.hmcts.et.common.model.ccd.types.HearingBundleType;
import uk.gov.hmcts.reform.ccd.client.model.CaseDataContent;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse;
import uk.gov.hmcts.reform.et.syaapi.enums.CaseEvent;
import uk.gov.hmcts.reform.et.syaapi.helper.CaseDetailsConverter;
import uk.gov.hmcts.reform.et.syaapi.helper.EmployeeObjectMapper;
import uk.gov.hmcts.reform.et.syaapi.models.ClaimantBundlesRequest;

import java.util.ArrayList;

import static java.util.UUID.randomUUID;

@RequiredArgsConstructor
@Service
@Slf4j
public class BundlesService {

private final CaseService caseService;
private final CaseDetailsConverter caseDetailsConverter;

/**
* Submit Claimant Bundles.
*
* @param authorization - authorization
* @param request - bundles request from the claimant
* @return the associated {@link CaseDetails} for the ID provided in request
*/
public CaseDetails submitBundles(String authorization, ClaimantBundlesRequest request) {

HearingBundleType claimantBundles = request.getClaimantBundles();

StartEventResponse startEventResponse = caseService.startUpdate(
authorization,
request.getCaseId(),
request.getCaseTypeId(),
CaseEvent.SUBMIT_CLAIMANT_BUNDLES
);

// todo: may need to upload bundles cya information / pdf for viewing on ExUi

CaseData caseData = EmployeeObjectMapper
.mapRequestCaseDataToCaseData(startEventResponse.getCaseDetails().getData());

if (CollectionUtils.isEmpty(caseData.getBundlesClaimantCollection())) {
caseData.setBundlesClaimantCollection(new ArrayList<>());
}

GenericTypeItem<HearingBundleType> genericTypeItem = new GenericTypeItem<>();
genericTypeItem.setId(String.valueOf(randomUUID()));
genericTypeItem.setValue(claimantBundles);

caseData.getBundlesClaimantCollection().add(genericTypeItem);

CaseDataContent content = caseDetailsConverter.caseDataContent(startEventResponse, caseData);

return caseService.submitUpdate(
authorization,
request.getCaseId(),
content,
request.getCaseTypeId()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ public boolean isFeatureEnabled(String feature) {
public boolean isCaseFlagsEnabled() {
return this.featureToggleApi.isFeatureEnabled("case-flags-linking-enabled");
}

public boolean isBundlesEnabled() {
return this.featureToggleApi.isFeatureEnabled("bundles");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package uk.gov.hmcts.reform.et.syaapi.controllers;

import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import uk.gov.hmcts.et.common.model.ccd.types.HearingBundleType;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import uk.gov.hmcts.reform.et.syaapi.models.ClaimantBundlesRequest;
import uk.gov.hmcts.reform.et.syaapi.service.BundlesService;
import uk.gov.hmcts.reform.et.syaapi.service.FeatureToggleService;
import uk.gov.hmcts.reform.et.syaapi.service.VerifyTokenService;
import uk.gov.hmcts.reform.et.syaapi.service.utils.ResourceLoader;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static uk.gov.hmcts.reform.et.syaapi.service.utils.TestConstants.TEST_SERVICE_AUTH_TOKEN;

@WebMvcTest(
controllers = {BundlesController.class}
)
@Import(BundlesController.class)
class BundlesControllerTest {
private static final String CASE_ID = "1646225213651590";
private static final String CASE_TYPE = "ET_Scotland";

private final CaseDetails expectedDetails;

@Autowired
private MockMvc mockMvc;

@MockBean
private VerifyTokenService verifyTokenService;

@MockBean
private BundlesService bundlesService;

@MockBean
private FeatureToggleService featureToggleService;

BundlesControllerTest() {
// Default constructor
expectedDetails = ResourceLoader.fromString(
"responses/caseDetails.json",
CaseDetails.class
);
}

@SneakyThrows
@Test
void shouldSubmitClaimantBundles() {
HearingBundleType bundle = new HearingBundleType();
ClaimantBundlesRequest bundleRequest = ClaimantBundlesRequest.builder()
.caseId(CASE_ID)
.caseTypeId(CASE_TYPE)
.claimantBundles(bundle)
.build();

when(verifyTokenService.verifyTokenSignature(any())).thenReturn(true);
when(featureToggleService.isBundlesEnabled()).thenReturn(true);

when(bundlesService.submitBundles(any(), any())).thenReturn(expectedDetails);
mockMvc.perform(
put("/bundles/submit-bundles", CASE_ID)
.header(HttpHeaders.AUTHORIZATION, TEST_SERVICE_AUTH_TOKEN)
.contentType(MediaType.APPLICATION_JSON)
.content(ResourceLoader.toJson(bundleRequest))
).andExpect(status().isOk());

verify(bundlesService, times(1)).submitBundles(
TEST_SERVICE_AUTH_TOKEN,
bundleRequest
);
}
}
Loading

0 comments on commit 7edf148

Please sign in to comment.