From 5230a18b7f800c915b4fc69e4a9eb28ced2a35ee Mon Sep 17 00:00:00 2001 From: alexanderkurash Date: Wed, 21 Feb 2024 15:13:05 +0200 Subject: [PATCH] MODTLR-19 Change schema, response type --- src/main/java/org/folio/client/feign/DcbClient.java | 2 +- .../resources/swagger.api/schemas/dcbTransaction.yaml | 4 ---- src/test/java/org/folio/client/DcbClientTest.java | 11 ++++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/folio/client/feign/DcbClient.java b/src/main/java/org/folio/client/feign/DcbClient.java index 4c6da8e9..c8289fb0 100644 --- a/src/main/java/org/folio/client/feign/DcbClient.java +++ b/src/main/java/org/folio/client/feign/DcbClient.java @@ -15,7 +15,7 @@ public interface DcbClient { @PostMapping("/ecs-tlr-transactions") - DcbTransaction createDcbTransaction(DcbTransaction dcbTransaction); + TransactionStatusResponse createDcbTransaction(DcbTransaction dcbTransaction); @GetMapping("/transactions/{dcbTransactionId}/status") TransactionStatusResponse getDcbTransactionStatus(@PathVariable String dcbTransactionId); diff --git a/src/main/resources/swagger.api/schemas/dcbTransaction.yaml b/src/main/resources/swagger.api/schemas/dcbTransaction.yaml index 63ccfb38..a026aea4 100644 --- a/src/main/resources/swagger.api/schemas/dcbTransaction.yaml +++ b/src/main/resources/swagger.api/schemas/dcbTransaction.yaml @@ -3,10 +3,6 @@ DcbTransaction: properties: item: $ref: 'dcbItem.yaml#/DcbItem' - patron: - $ref: 'dcbPatron.yaml#/DcbPatron' - pickup: - $ref: 'dcbPickup.yaml#/DcbPickup' role: type: string enum: diff --git a/src/test/java/org/folio/client/DcbClientTest.java b/src/test/java/org/folio/client/DcbClientTest.java index 3a148d15..e6636831 100644 --- a/src/test/java/org/folio/client/DcbClientTest.java +++ b/src/test/java/org/folio/client/DcbClientTest.java @@ -26,7 +26,12 @@ void canCreateDcbTransaction() { DcbTransaction dcbTransaction = new DcbTransaction() .role(DcbTransaction.RoleEnum.BORROWER) .requestId(requestId); - when(dcbClient.createDcbTransaction(dcbTransaction)).thenReturn(dcbTransaction); + TransactionStatusResponse transactionStatusResponse = new TransactionStatusResponse() + .status(TransactionStatusResponse.StatusEnum.CANCELLED) + .message("test message") + .item(dcbTransaction.getItem()) + .requestId(requestId); + when(dcbClient.createDcbTransaction(dcbTransaction)).thenReturn(transactionStatusResponse); var response = dcbClient.createDcbTransaction(dcbTransaction); assertNotNull(response); assertEquals(DcbTransaction.RoleEnum.BORROWER, response.getRole()); @@ -44,8 +49,6 @@ void canGetDcbTransactionStatus() { .status(TransactionStatusResponse.StatusEnum.CANCELLED) .message("test message") .item(dcbTransaction.getItem()) - .patron(dcbTransaction.getPatron()) - .pickup(dcbTransaction.getPickup()) .requestId(requestId); when(dcbClient.getDcbTransactionStatus(transactionId)).thenReturn(transactionStatusResponse); var response = dcbClient.getDcbTransactionStatus(transactionId); @@ -67,8 +70,6 @@ void canChangeDcbTransactionStatus() { .status(TransactionStatusResponse.StatusEnum.CANCELLED) .message("test message") .item(dcbTransaction.getItem()) - .patron(dcbTransaction.getPatron()) - .pickup(dcbTransaction.getPickup()) .requestId(requestId); when(dcbClient.changeDcbTransactionStatus(transactionId, targetStatus)) .thenReturn(transactionStatusResponse);