From c887722886d576b8a0c53421f3c0a72ab4502ee5 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Mon, 19 Jun 2023 13:45:44 +0200 Subject: [PATCH] Rename transferblocks to transfer-transactions Signed-off-by: Niels Thykier --- README.md | 7 ------- .../endorsementchain/controller/ImportController.java | 2 +- .../org/dcsa/endorsementchain/service/ExportService.java | 2 +- .../endorsementchain/controller/ImportControllerTest.java | 8 ++++---- postman_collection.json | 6 +++--- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fe9f75e..54a46dd 100644 --- a/README.md +++ b/README.md @@ -95,13 +95,6 @@ While the eBLPlatformIdentifier and legal name are required, it is optional but This additional information can be used by the receiving platform to perform additional verification. For providing this additional information the DCSA Transaction Party object is used. The DCSA Transaction Party object allows of the provision of LEI and DID among other as documented in the [DCSA Transaction Party object](https://app.swaggerhub.com/apis/dcsaorg/DCSA_EEC/0.12-alpha#/transactionParty). -### Service discovery -The platform domain part of the eBLPlatformIdentifier being a resolvable domain name can be used for DNS based service discovery. -With this an additional TXT record can be created linking to the API endpoint providing the PUT `/v1/transferblock` operation. - -Example: -dcsaeblplatform.org can link to a TXT record containing the full API endpoint -> `api.dcsaeblplatform.org/v1/transferblocks` - ## Security considerations ### Transport level security diff --git a/ec-service/src/main/java/org/dcsa/endorsementchain/controller/ImportController.java b/ec-service/src/main/java/org/dcsa/endorsementchain/controller/ImportController.java index f61f922..5136c83 100644 --- a/ec-service/src/main/java/org/dcsa/endorsementchain/controller/ImportController.java +++ b/ec-service/src/main/java/org/dcsa/endorsementchain/controller/ImportController.java @@ -17,7 +17,7 @@ public class ImportController { private final ImportService importService; - @PutMapping(value = "/transferblocks", // TODO: Rename when we are ready to change the API + @PutMapping(value = "/transfer-transactions", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity importEBLEnvelope(@RequestBody @Valid EBLEnvelopeTO eblEnvelopeTO) { diff --git a/ec-service/src/main/java/org/dcsa/endorsementchain/service/ExportService.java b/ec-service/src/main/java/org/dcsa/endorsementchain/service/ExportService.java index fc546cf..8f90fc6 100644 --- a/ec-service/src/main/java/org/dcsa/endorsementchain/service/ExportService.java +++ b/ec-service/src/main/java/org/dcsa/endorsementchain/service/ExportService.java @@ -99,7 +99,7 @@ private URI transfereeToPlatformHost(String transferee) { String host = transferee.substring(transferee.indexOf("@") + 1); return UriComponentsBuilder.fromHttpUrl("https://" + host) .scheme("https") - .path("/v1/transferblocks") + .path("/v1/transfer-transactions") .build() .toUri(); } diff --git a/ec-service/src/test/java/org/dcsa/endorsementchain/controller/ImportControllerTest.java b/ec-service/src/test/java/org/dcsa/endorsementchain/controller/ImportControllerTest.java index f5f67fc..b230fdc 100644 --- a/ec-service/src/test/java/org/dcsa/endorsementchain/controller/ImportControllerTest.java +++ b/ec-service/src/test/java/org/dcsa/endorsementchain/controller/ImportControllerTest.java @@ -43,7 +43,7 @@ void testImportController() throws Exception { when(service.importEbl(isNotNull())).thenReturn(Optional.of("Dummy signature")); - String response = mockMvc.perform(put("/transferblocks").contentType(MediaType.APPLICATION_JSON).content(rawEBLEnvelope)) + String response = mockMvc.perform(put("/transfer-transactions").contentType(MediaType.APPLICATION_JSON).content(rawEBLEnvelope)) .andDo(print()) .andExpect(status().isOk()) .andReturn() @@ -60,7 +60,7 @@ void testImportControllerError() throws Exception { when(service.importEbl(isNotNull())).thenReturn(Optional.empty()); - mockMvc.perform(put("/transferblocks").contentType(MediaType.APPLICATION_JSON).content(rawEBLEnvelope)) + mockMvc.perform(put("/transfer-transactions").contentType(MediaType.APPLICATION_JSON).content(rawEBLEnvelope)) .andDo(print()) .andExpect(status().isBadRequest()); @@ -68,11 +68,11 @@ void testImportControllerError() throws Exception { @Test void testImportControllerInvalidInput() throws Exception { - mockMvc.perform(put("/transferblocks").contentType(MediaType.APPLICATION_JSON).content("invalid request")) + mockMvc.perform(put("/transfer-transactions").contentType(MediaType.APPLICATION_JSON).content("invalid request")) .andDo(print()) .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.httpMethod").value("PUT")) - .andExpect(jsonPath("$.requestUri").value("/transferblocks")) + .andExpect(jsonPath("$.requestUri").value("/transfer-transactions")) .andExpect(jsonPath("$.errors[0].reason").value("invalidInput")) .andExpect( jsonPath("$.errors[0].message") diff --git a/postman_collection.json b/postman_collection.json index 3fafbde..3d7b1d1 100644 --- a/postman_collection.json +++ b/postman_collection.json @@ -381,7 +381,7 @@ ], "path": [ "v1", - "transferblocks" + "transfer-transactions" ] } }, @@ -538,14 +538,14 @@ } }, "url": { - "raw": "https://{{BASE_URL}}/{{MAJOR_VERSION}}/transferblocks", + "raw": "https://{{BASE_URL}}/{{MAJOR_VERSION}}/transfer-transactions", "protocol": "https", "host": [ "{{BASE_URL}}" ], "path": [ "{{MAJOR_VERSION}}", - "transferblocks" + "transfer-transactions" ] } },