class TransactionResource {

    @ApiOperation(value = "Returns decrypted payload back to Quorum")
    @ApiResponses({@ApiResponse(code = 200, response = ReceiveResponse.class, message = "Receive Response object")})
    @GET
    @Path("/transaction/{hash}")
    @Produces(APPLICATION_JSON)
    public Response receive(
            @ApiParam("Encoded hash used to decrypt the payload") @NotNull @Valid @PathParam("hash") final String hash,
            @ApiParam("Encoded recipient key") @Valid @QueryParam("to") final String toStr) {

        Base64.Decoder base64Decoder = Base64.getDecoder();
        PublicKey recipient = Optional.ofNullable(toStr)
            .filter(Predicate.not(String::isEmpty))
            .map(base64Decoder::decode)
            .map(PublicKey::from).orElse(null);

        MessageHash transactionHash = Optional.of(hash)
            .map(base64Decoder::decode)
            .map(MessageHash::new).get();

        com.quorum.tessera.transaction.ReceiveRequest request = com.quorum.tessera.transaction.ReceiveRequest.Builder.create()
            .withRecipient(recipient)
            .withTransactionHash(transactionHash)
            .build();

        com.quorum.tessera.transaction.ReceiveResponse response = transactionManager.receive(request);

        ReceiveResponse receiveResponse = new ReceiveResponse();
        receiveResponse.setPayload(response.getUnencryptedTransactionData());

        return Response
                .status(Status.OK)
                .type(APPLICATION_JSON)
                .entity(receiveResponse)
                .build();
    }

    public  TransactionResource(TransactionManager transactionManager);

}