Skip to content

Hdpi 5499 service call back implementation#1618

Draft
tvr-hmcts wants to merge 5 commits intomasterfrom
HDPI-5499-Service-call-back-implementation
Draft

Hdpi 5499 service call back implementation#1618
tvr-hmcts wants to merge 5 commits intomasterfrom
HDPI-5499-Service-call-back-implementation

Conversation

@tvr-hmcts
Copy link
Copy Markdown
Contributor

@tvr-hmcts tvr-hmcts commented Apr 2, 2026

HDPI-5499 - ### Jira link

Change description

This PR implements the payment callback flow for the Fees & Pay service, enabling the application to receive and persist payment status updates from the payments service.

Adds a Flyway migration (V075__fee_payment.sql) creating a fee_payment table to persist payment records, linked to claim and party via foreign keys.

FeePaymentEntity — JPA entity mapped to the new fee_payment table, storing payment amount, status, request reference, and associations to ClaimEntity and PartyEntity.

FeePaymentRepository — Spring Data JPA repository with a findByRequestReference lookup method.

PaymentCallBackController — POST /service-request-update endpoint that receives service request update callbacks from the payments service and delegates to PaymentService.

ServiceRequestUpdate — Deserialisation model for the incoming payment callback payload.

Payment — Nested payment details model within ServiceRequestUpdate.

PaymentStatus enum — PAID, NOT_PAID, PARTIALLY_PAID with case-insensitive string lookup. (NOTE THIS IS NOT DIRECTLY USED YET)

createServiceRequest now saves a new FeePaymentEntity after a successful service request is created.

New processPaymentResponse method looks up an existing FeePaymentEntity by request reference and updates its payment status.

New WireMock stub (payment-success.json) simulates a successful payment service request and fires a webhook callback back to the application.

Testing done

Local round trip testing using a Docker based Wiremock implementation of the payment callback

- Create `PaymentStatus` enum
- Add `FeePaymentEntity` and `FeePaymentRepository`
- Add migration `V075__fee_payment.sql`
- Extend `PaymentService` to save new fee payments and update status on callback
- Implement `PaymentCallBackController` for payment updates
- Add `ServiceRequestUpdate` DTO
- Update tests for new functionality
…equest creation and simplify method signatures. Remove duplicate callback handler and add helper for party lookup. Ensure new logic persists fee payments using claim data.
…lBackController, and update logging and test names.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

CCD diff summary

👉 Full report: https://github.com/hmcts/pcs-api/actions/runs/23904078347?check_suite_focus=true

No change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants