You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* First pass at transaction post endpoint, includes service unit tests
* First pass of transaction post controller tests
* Wrote nomis gateway tests for new post transaction functionality
* Fixing transaction post unit tests
* Updated transaction controller integration tests with transaction post tests, updated prism mock schema, tidying
* Refine retry http code conditions
* Added retry exausted handling to post transactions
* Commit changes made by code formatters
* WIP accounting for 409 response from nomis, gateway tests
* Recifying nomis gateway test to account for 409
* Remove wildcard imports
* Linter corrections in exceptionHandler
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tom Watkins <tom.watkins@justice.gov.uk>
Copy file name to clipboardexpand all lines: src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/config/HmppsIntegrationApiExceptionHandler.kt
summary ="Returns all transactions for a prisoner associated with an account code that they have at a prison.",
@@ -98,7 +105,7 @@ class TransactionsController(
98
105
}
99
106
100
107
if (response.hasError(UpstreamApiError.Type.BAD_REQUEST)) {
101
-
throwValidationException("Either invalid HMPPS ID: $hmppsIdat or incorrect prison: $prisonId")
108
+
throwValidationException("Either invalid HMPPS ID: $hmppsId or incorrect prison: $prisonId")
102
109
}
103
110
104
111
auditService.createEvent("GET_TRANSACTIONS_FOR_PERSON", mapOf("hmppsId" to hmppsId, "prisonId" to prisonId, "fromDate" to fromDate, "toDate" to toDate))
@@ -157,10 +164,87 @@ class TransactionsController(
157
164
}
158
165
159
166
if (response.hasError(UpstreamApiError.Type.BAD_REQUEST)) {
160
-
throwValidationException("Either invalid HMPPS ID: $hmppsIdat or incorrect prison: $prisonId")
167
+
throwValidationException("Either invalid HMPPS ID: $hmppsId or incorrect prison: $prisonId")
161
168
}
162
169
163
170
auditService.createEvent("GET_TRANSACTION_FOR_PERSON", mapOf("hmppsId" to hmppsId, "prisonId" to prisonId, "clientUniqueRef" to clientUniqueRef))
if (response.hasError(UpstreamApiError.Type.CONFLICT)) {
244
+
throwConflictFoundException("The transaction ${transactionRequest.clientTransactionId} has not been recorded as it is a duplicate.")
245
+
}
246
+
247
+
auditService.createEvent("CREATE_TRANSACTION", mapOf("hmppsId" to hmppsId, "prisonId" to prisonId, "transactionRequest" to transactionRequest.toApiConformingMap().toString()))
.onRetryExhaustedThrow { _, retrySignal ->throwResponseException("External Service failed to process after max retries", HttpStatus.SERVICE_UNAVAILABLE.value()) },
0 commit comments