diff --git a/src/main/java/com/bunq/sdk/http/BunqHeader.java b/src/main/java/com/bunq/sdk/http/BunqHeader.java index e7025429..5ab93ecc 100644 --- a/src/main/java/com/bunq/sdk/http/BunqHeader.java +++ b/src/main/java/com/bunq/sdk/http/BunqHeader.java @@ -13,12 +13,12 @@ public enum BunqHeader { clientEncryptionKey("X-Bunq-Client-Encryption-Key"), clientRequestId("X-Bunq-Client-Request-Id"), clientSignature("X-Bunq-Client-Signature"), - clientResponseId("X-Bunq-Client-Response-Id","Could not determine response id."), - geolocation("X-Bunq-Geolocation","0 0 0 0 000"), - language("X-Bunq-Language","en_US"), - region("X-Bunq-Region","nl_NL"), + clientResponseId("X-Bunq-Client-Response-Id", "Could not determine response id."), + geolocation("X-Bunq-Geolocation", "0 0 0 0 000"), + language("X-Bunq-Language", "en_US"), + region("X-Bunq-Region", "nl_NL"), serverSignature("X-Bunq-Server-Signature"), - userAgent("User-Agent","bunq-sdk-java/0.13.1"); + userAgent("User-Agent", "bunq-sdk-java/0.13.1"); private static final String PREFIX = "X-Bunq-"; @@ -77,8 +77,8 @@ public boolean isBunq() { } private String findKey(Collection keys) { - for(String key:keys) { - if(this.equals(key)) { + for (String key:keys) { + if (this.equals(key)) { return key; } } diff --git a/src/main/java/com/bunq/sdk/http/BunqRequestBuilder.java b/src/main/java/com/bunq/sdk/http/BunqRequestBuilder.java index 915023d7..d89ed3cb 100644 --- a/src/main/java/com/bunq/sdk/http/BunqRequestBuilder.java +++ b/src/main/java/com/bunq/sdk/http/BunqRequestBuilder.java @@ -88,7 +88,7 @@ private void addToAllHeader(String name,String value) { */ @Override public BunqRequestBuilder header(String name, String value) { - addToAllHeader(name,value); + addToAllHeader(name, value); return (BunqRequestBuilder) super.header(name, value); } @@ -98,7 +98,7 @@ public BunqRequestBuilder header(String name, String value) { */ @Override public BunqRequestBuilder addHeader(String name, String value) { - addToAllHeader(name,value); + addToAllHeader(name, value); return (BunqRequestBuilder) super.addHeader(name, value); } diff --git a/src/main/java/com/bunq/sdk/security/SecurityUtils.java b/src/main/java/com/bunq/sdk/security/SecurityUtils.java index e5831f65..1e7f08d0 100644 --- a/src/main/java/com/bunq/sdk/security/SecurityUtils.java +++ b/src/main/java/com/bunq/sdk/security/SecurityUtils.java @@ -459,9 +459,9 @@ public static void validateResponseSignature( response.headers() ); Signature signature = getSignatureInstance(); - BunqBasicHeader headerServerSignature = BunqBasicHeader.get(BunqHeader.serverSignature,response); + BunqBasicHeader serverSignature = BunqBasicHeader.get(BunqHeader.serverSignature,response); - byte[] serverSignatureBase64Bytes = headerServerSignature.getValue().getBytes(); + byte[] serverSignatureBase64Bytes = serverSignature.getValue().getBytes(); byte[] serverSignatureDecoded = Base64.getDecoder().decode(serverSignatureBase64Bytes); verifyDataSigned(signature, keyPublicServer, responseBytes, serverSignatureDecoded); } diff --git a/src/test/java/com/bunq/sdk/http/BunqHeaderTest.java b/src/test/java/com/bunq/sdk/http/BunqHeaderTest.java index bed67ba3..e1e054d8 100644 --- a/src/test/java/com/bunq/sdk/http/BunqHeaderTest.java +++ b/src/test/java/com/bunq/sdk/http/BunqHeaderTest.java @@ -3,8 +3,6 @@ import org.junit.Test; import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.junit.Assert.*; diff --git a/src/test/java/com/bunq/sdk/model/generated/endpoint/AttachmentPublicTest.java b/src/test/java/com/bunq/sdk/model/generated/endpoint/AttachmentPublicTest.java index 48eca29f..866d34d2 100644 --- a/src/test/java/com/bunq/sdk/model/generated/endpoint/AttachmentPublicTest.java +++ b/src/test/java/com/bunq/sdk/model/generated/endpoint/AttachmentPublicTest.java @@ -10,6 +10,7 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; +import java.util.Map; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -37,11 +38,12 @@ private static byte[] getRequestBytes() { } private static String uploadFileAndGetUuid() { - HashMap customHeaders = new HashMap<>(); - BunqHeader.contentType.addTo(customHeaders,CONTENT_TYPE); - BunqHeader.attachmentDescription.addTo(customHeaders,ATTACHMENT_DESCRIPTION); - byte[] RequestBytes = getRequestBytes(); - return AttachmentPublic.create(customHeaders, RequestBytes).getValue(); + Map customHeaders = new HashMap<>(); + + BunqHeader.contentType.addTo(customHeaders, CONTENT_TYPE); + BunqHeader.attachmentDescription.addTo(customHeaders, ATTACHMENT_DESCRIPTION); + + return AttachmentPublic.create(customHeaders, getRequestBytes()).getValue(); } /**