Skip to content

Commit 6fd89a3

Browse files
authored
Merge pull request #159 from denizy97/develop
use long data type for model id
2 parents 48ca105 + 6c74f90 commit 6fd89a3

File tree

202 files changed

+3774
-3037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+3774
-3037
lines changed

src/main/java/com/bunq/sdk/context/SessionContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class SessionContext implements java.io.Serializable {
4444

4545
@Expose
4646
@SerializedName("user_id")
47-
private final Integer userId;
47+
private final Long userId;
4848

4949
@Expose
5050
@SerializedName("user_person")
@@ -129,7 +129,7 @@ Date getExpiryTime() {
129129
return expiryTime;
130130
}
131131

132-
public Integer getUserId() {
132+
public Long getUserId() {
133133
return userId;
134134
}
135135

src/main/java/com/bunq/sdk/context/UserContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void refreshContext() {
5252
this.initMainMonetaryAccount(helper);
5353
}
5454

55-
public Integer getUserId() {
55+
public Long getUserId() {
5656
return this.apiContext.getSessionContext().getUserId();
5757
}
5858

@@ -72,7 +72,7 @@ public boolean areAllUserSet() {
7272
return this.userPerson != null && this.userCompany != null && this.userApiKey != null;
7373
}
7474

75-
public Integer getMainMonetaryAccountId() {
75+
public Long getMainMonetaryAccountId() {
7676
if (this.primaryMonetaryAccountBank == null) {
7777
throw new BunqException(ERROR_PRIMARY_MONETARY_ACCOUNT_IS_NOT_SET);
7878
} else {

src/main/java/com/bunq/sdk/http/Pagination.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public class Pagination {
2323
public static final String PARAM_FUTURE_ID = "future_id";
2424
public static final String PARAM_COUNT = "count";
2525

26-
private Integer olderId;
27-
private Integer newerId;
28-
private Integer futureId;
29-
private Integer count;
26+
private Long olderId;
27+
private Long newerId;
28+
private Long futureId;
29+
private Long count;
3030

3131
/**
3232
* Get the URL params required to request the next page of the listing.
@@ -35,7 +35,7 @@ public Map<String, String> getUrlParamsNextPage() {
3535
assertHasNextPage();
3636

3737
Map<String, String> params = new HashMap<>();
38-
params.put(PARAM_NEWER_ID, Integer.toString(getNextId()));
38+
params.put(PARAM_NEWER_ID, Long.toString(getNextId()));
3939
addCountToParamsIfNeeded(params);
4040

4141
return params;
@@ -47,7 +47,7 @@ private void assertHasNextPage() {
4747
}
4848
}
4949

50-
private Integer getNextId() {
50+
private Long getNextId() {
5151
if (hasNextPageAssured()) {
5252
return newerId;
5353
} else {
@@ -61,7 +61,7 @@ public boolean hasNextPageAssured() {
6161

6262
private void addCountToParamsIfNeeded(Map<String, String> params) {
6363
if (count != null) {
64-
params.put(PARAM_COUNT, Integer.toString(count));
64+
params.put(PARAM_COUNT, Long.toString(count));
6565
}
6666
}
6767

@@ -72,7 +72,7 @@ public Map<String, String> getUrlParamsPreviousPage() {
7272
assertHasPreviousPage();
7373

7474
Map<String, String> params = new HashMap<>();
75-
params.put(PARAM_OLDER_ID, Integer.toString(olderId));
75+
params.put(PARAM_OLDER_ID, Long.toString(olderId));
7676
addCountToParamsIfNeeded(params);
7777

7878
return params;
@@ -98,35 +98,35 @@ public Map<String, String> getUrlParamsCountOnly() {
9898
return params;
9999
}
100100

101-
public Integer getOlderId() {
101+
public Long getOlderId() {
102102
return olderId;
103103
}
104104

105-
public void setOlderId(Integer olderId) {
105+
public void setOlderId(Long olderId) {
106106
this.olderId = olderId;
107107
}
108108

109-
public Integer getNewerId() {
109+
public Long getNewerId() {
110110
return newerId;
111111
}
112112

113-
public void setNewerId(Integer newerId) {
113+
public void setNewerId(Long newerId) {
114114
this.newerId = newerId;
115115
}
116116

117-
public Integer getFutureId() {
117+
public Long getFutureId() {
118118
return futureId;
119119
}
120120

121-
public void setFutureId(Integer futureId) {
121+
public void setFutureId(Long futureId) {
122122
this.futureId = futureId;
123123
}
124124

125-
public Integer getCount() {
125+
public Long getCount() {
126126
return count;
127127
}
128128

129-
public void setCount(Integer count) {
129+
public void setCount(Long count) {
130130
this.count = count;
131131
}
132132
}

src/main/java/com/bunq/sdk/json/PaginationAdapter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ public Pagination deserialize(JsonElement json, Type typeOfT,
2929
JsonDeserializationContext context) throws JsonParseException {
3030
try {
3131
JsonObject responseJson = json.getAsJsonObject();
32-
Map<String, Integer> paginationBody = parsePaginationBody(responseJson);
32+
Map<String, Long> paginationBody = parsePaginationBody(responseJson);
3333

3434
return createPagination(paginationBody);
3535
} catch (URISyntaxException exception) {
3636
throw new JsonParseException(exception);
3737
}
3838
}
3939

40-
private Map<String, Integer> parsePaginationBody(JsonObject responseJson)
40+
private Map<String, Long> parsePaginationBody(JsonObject responseJson)
4141
throws URISyntaxException {
42-
Map<String, Integer> paginationBody = new HashMap<>();
42+
Map<String, Long> paginationBody = new HashMap<>();
4343
updatePaginationBodyFromResponseField(
4444
paginationBody,
4545
Pagination.PARAM_OLDER_ID,
@@ -65,7 +65,7 @@ private Map<String, Integer> parsePaginationBody(JsonObject responseJson)
6565
return paginationBody;
6666
}
6767

68-
private Pagination createPagination(Map<String, Integer> paginationBody) {
68+
private Pagination createPagination(Map<String, Long> paginationBody) {
6969
Pagination pagination = new Pagination();
7070
pagination.setOlderId(paginationBody.get(Pagination.PARAM_OLDER_ID));
7171
pagination.setNewerId(paginationBody.get(Pagination.PARAM_NEWER_ID));
@@ -76,7 +76,7 @@ private Pagination createPagination(Map<String, Integer> paginationBody) {
7676
}
7777

7878
private void updatePaginationBodyFromResponseField(
79-
Map<String, Integer> paginationBody,
79+
Map<String, Long> paginationBody,
8080
String idField,
8181
JsonObject responseJson,
8282
String responseField,
@@ -89,10 +89,10 @@ private void updatePaginationBodyFromResponseField(
8989

9090
for (String parameterName : Objects.requireNonNull(url).queryParameterNames()) {
9191
if (responseParam.equals(parameterName)) {
92-
paginationBody.put(idField, Integer.parseInt(Objects.requireNonNull(url.queryParameter(parameterName))));
92+
paginationBody.put(idField, Long.parseLong(Objects.requireNonNull(url.queryParameter(parameterName))));
9393
} else if (Pagination.PARAM_COUNT.equals(parameterName) &&
9494
paginationBody.get(Pagination.PARAM_COUNT) == null) {
95-
paginationBody.put(Pagination.PARAM_COUNT, Integer.parseInt(Objects.requireNonNull(url.queryParameter(parameterName))));
95+
paginationBody.put(Pagination.PARAM_COUNT, Long.parseLong(Objects.requireNonNull(url.queryParameter(parameterName))));
9696
}
9797
}
9898
}

src/main/java/com/bunq/sdk/model/core/BunqModel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ static <T> BunqResponse<T> fromJsonArrayNested(Class<T> classOfObject,
7575
/**
7676
* De-serializes an ID object and returns its integer value.
7777
*/
78-
protected static BunqResponse<Integer> processForId(BunqResponseRaw responseRaw) {
78+
protected static BunqResponse<Long> processForId(BunqResponseRaw responseRaw) {
7979
JsonObject responseItemObject = getResponseItemObject(responseRaw);
8080
JsonObject responseItemObjectUnwrapped = getWrappedContent(responseItemObject, FIELD_ID);
81-
Integer responseValue = gson.fromJson(responseItemObjectUnwrapped, Id.class).getId();
81+
Long responseValue = gson.fromJson(responseItemObjectUnwrapped, Id.class).getId();
8282

8383
return new BunqResponse<>(responseValue, responseRaw.getHeaders());
8484
}
@@ -195,11 +195,11 @@ protected static ApiContext getApiContext() {
195195
return BunqContext.getApiContext();
196196
}
197197

198-
protected static Integer determineUserId() {
198+
protected static Long determineUserId() {
199199
return BunqContext.getUserContext().getUserId();
200200
}
201201

202-
protected static Integer determineMonetaryAccountId(Integer id) {
202+
protected static Long determineMonetaryAccountId(Long id) {
203203
if (id == null) {
204204
return BunqContext.getUserContext().getPrimaryMonetaryAccountBank().getId();
205205
} else {

src/main/java/com/bunq/sdk/model/core/DeviceServerInternal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.List;
1111

1212
public class DeviceServerInternal extends DeviceServerApiObject {
13-
public static BunqResponse<Integer> create(
13+
public static BunqResponse<Long> create(
1414
ApiContext apiContext,
1515
String description,
1616
String secret,

src/main/java/com/bunq/sdk/model/core/Id.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
public class Id {
44

5-
private Integer id;
5+
private Long id;
66

77
public Id() {
88
}
99

10-
public Integer getId() {
10+
public Long getId() {
1111
return id;
1212
}
1313
}

src/main/java/com/bunq/sdk/model/core/Installation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static byte[] generateRequestBodyBytes(String publicKeyClientString) {
5959
return gson.toJson(installationRequestBody).getBytes();
6060
}
6161

62-
public Integer getId() {
62+
public Long getId() {
6363
return id.getId();
6464
}
6565

src/main/java/com/bunq/sdk/model/core/NotificationFilterUrlMonetaryAccountInternal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResp
2828
* Create notification filters with list response type.
2929
*/
3030
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
31-
Integer monetaryAccountId,
31+
Long monetaryAccountId,
3232
List<NotificationFilterUrlObject> allNotificationFilter
3333
) {
3434
return createWithListResponse(monetaryAccountId, allNotificationFilter, null);
@@ -38,7 +38,7 @@ public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResp
3838
* Create notification filters with list response type.
3939
*/
4040
public static BunqResponse<List<NotificationFilterUrlObject>> createWithListResponse(
41-
Integer monetaryAccountId,
41+
Long monetaryAccountId,
4242
List<NotificationFilterUrlObject> allNotificationFilter,
4343
Map<String, String> customHeaders
4444
) {

src/main/java/com/bunq/sdk/model/core/UserContextHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public UserApiObject getFirstUser() {
5656
return response.getValue().get(INDEX_FIRST);
5757
}
5858

59-
public MonetaryAccountBankApiObject getFirstActiveMonetaryAccountBankByUserId(Integer userId) {
59+
public MonetaryAccountBankApiObject getFirstActiveMonetaryAccountBankByUserId(Long userId) {
6060
BunqResponseRaw responseRaw = getRawResponse(
6161
String.format(ENDPOINT_MONETARY_ACCOUNT_BANK, userId)
6262
);

0 commit comments

Comments
 (0)