You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by my...@apache.org on 2018/01/22 15:47:39 UTC
[fineract-cn-customer] 38/46: Added missing completed check to
change document.
This is an automated email from the ASF dual-hosted git repository.
myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-customer.git
commit 647cbf1927a30f9a57212c5acebbf842ab5b01a0
Author: Myrle Krantz <my...@apache.org>
AuthorDate: Fri Oct 20 11:45:43 2017 +0200
Added missing completed check to change document.
---
.../io/mifos/customer/api/v1/client/CustomerDocumentsManager.java | 1 +
component-test/src/main/java/io/mifos/customer/TestDocuments.java | 5 +++++
.../customer/service/rest/controller/DocumentsRestController.java | 2 ++
3 files changed, 8 insertions(+)
diff --git a/api/src/main/java/io/mifos/customer/api/v1/client/CustomerDocumentsManager.java b/api/src/main/java/io/mifos/customer/api/v1/client/CustomerDocumentsManager.java
index 96fdf02..56ba88a 100644
--- a/api/src/main/java/io/mifos/customer/api/v1/client/CustomerDocumentsManager.java
+++ b/api/src/main/java/io/mifos/customer/api/v1/client/CustomerDocumentsManager.java
@@ -78,6 +78,7 @@ public interface CustomerDocumentsManager {
consumes = MediaType.APPLICATION_JSON_VALUE
)
@ThrowsExceptions({
+ @ThrowsException(status = HttpStatus.CONFLICT, exception = CompletedDocumentCannotBeChangedException.class),
@ThrowsException(status = HttpStatus.BAD_REQUEST, exception = DocumentValidationException.class)
})
void changeDocument(
diff --git a/component-test/src/main/java/io/mifos/customer/TestDocuments.java b/component-test/src/main/java/io/mifos/customer/TestDocuments.java
index 071f247..8b8e6d1 100644
--- a/component-test/src/main/java/io/mifos/customer/TestDocuments.java
+++ b/component-test/src/main/java/io/mifos/customer/TestDocuments.java
@@ -139,6 +139,11 @@ public class TestDocuments extends AbstractCustomerTest {
Assert.fail("Deleting a page after the document is completed shouldn't be possible.");
}
catch (final CompletedDocumentCannotBeChangedException ignored) {}
+ try {
+ customerDocumentsManager.changeDocument(customer.getIdentifier(), customerDocument.getIdentifier(), customerDocument);
+ Assert.fail("Changing a document after it is completed shouldn't be possible.");
+ }
+ catch (final CompletedDocumentCannotBeChangedException ignored) {}
logger.info("Check that document can't be uncompleted");
diff --git a/service/src/main/java/io/mifos/customer/service/rest/controller/DocumentsRestController.java b/service/src/main/java/io/mifos/customer/service/rest/controller/DocumentsRestController.java
index 79c6aae..c0db7c8 100644
--- a/service/src/main/java/io/mifos/customer/service/rest/controller/DocumentsRestController.java
+++ b/service/src/main/java/io/mifos/customer/service/rest/controller/DocumentsRestController.java
@@ -125,6 +125,8 @@ public class DocumentsRestController {
throwIfCustomerNotExists(customerIdentifier);
throwIfCustomerDocumentNotExists(customerIdentifier, documentIdentifier);
+ throwIfDocumentCompleted(customerIdentifier, documentIdentifier);
+
if (!instance.getIdentifier().equals(documentIdentifier))
throw ServiceException.badRequest("Document identifier in request body must match document identifier in request path.");
--
To stop receiving notification emails like this one, please contact
myrle@apache.org.