Skip to content

Commit

Permalink
Refactored hashmap notations to make java 7 compatible. (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed Jul 10, 2018
1 parent 3e6540c commit d664edc
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/main/java/com/bunq/sdk/http/BunqBasicHeader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.bunq.sdk.http;

public class BunqBasicHeader {
public class BunqBasicHeader implements Comparable<BunqBasicHeader> {
private String name;
private String value;

Expand All @@ -23,4 +23,9 @@ public String getValue() {
return value;
}

@Override
public int compareTo(BunqBasicHeader o) {
return getName().compareTo(o.getName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static BunqResponse<Integer> create(ApiContext apiContext, String descrip
requestMap.put(FIELD_SECRET, secret);
requestMap.put(FIELD_PERMITTED_IPS, permittedIps);
byte[] requestBytes = gson.toJson(requestMap).getBytes();
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_CREATE, requestBytes, new HashMap<>());
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_CREATE, requestBytes, new HashMap<String, String>());

return processForId(responseRaw);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bunq/sdk/model/core/Installation.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static BunqResponse<Installation> create(ApiContext apiContext,
String publicKeyClientString) {
ApiClient apiClient = new ApiClient(apiContext);
byte[] requestBytes = generateRequestBodyBytes(publicKeyClientString);
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_POST, requestBytes, new HashMap<>());
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_POST, requestBytes, new HashMap<String, String>());

return fromJsonArrayNested(Installation.class, responseRaw);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bunq/sdk/model/core/SessionServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public SessionServer(Id id, SessionToken sessionToken, UserPerson userPerson) {
public static BunqResponse<SessionServer> create(ApiContext apiContext) {
ApiClient apiClient = new ApiClient(apiContext);
byte[] requestBytes = generateRequestBodyBytes(apiContext.getApiKey());
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_POST, requestBytes, new HashMap<>());
BunqResponseRaw responseRaw = apiClient.post(ENDPOINT_URL_POST, requestBytes, new HashMap<String, String>());

return fromJsonArrayNested(SessionServer.class, responseRaw);
}
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/bunq/sdk/security/SecurityUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* Static lib containing methods for handling encryption.
Expand Down Expand Up @@ -505,8 +504,7 @@ public static void validateResponseSignature(
HEADER_SERVER_SIGNATURE,
response.header(HEADER_SERVER_SIGNATURE)
);
byte[] serverSignatureBase64Bytes = headerServerSignature.getValue().getBytes();
byte[] serverSignatureDecoded = DatatypeConverter.printBase64Binary(serverSignatureBase64Bytes).getBytes();
byte[] serverSignatureDecoded = DatatypeConverter.parseBase64Binary(headerServerSignature.getValue());
verifyDataSigned(signature, keyPublicServer, responseBytes, serverSignatureDecoded);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class DraftShareInviteBankQrCodeContentTest extends BunqSdkTestBase {
/**
* The id of the created DraftShareInvite
*/
private static Integer draftId;
private static int draftId;

@BeforeClass
public static void setUpBeforeClass() {
Expand All @@ -51,11 +51,6 @@ public static void setUpBeforeClass() {
draftId = DraftShareInviteBank.create(expiryDate.getTime().toString(), draftShareInviteBankEntry).getValue();
}

@AfterClass
public static void tearDown() {
DraftShareInviteBank.update(draftId, DRAFT_SHARE_INVITE_BANK_STATUS_CANCELLED);
}

/**
* Tests the creation of a connect and retrieves the QR code bound to this connect
*
Expand Down

0 comments on commit d664edc

Please sign in to comment.