Skip to content

Commit

Permalink
Added method to BunqContext to udpate ApiContext. (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
OGKevin committed May 29, 2018
1 parent d0f4384 commit ec3671c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/com/bunq/sdk/context/BunqContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,26 @@ public static void loadApiContext(ApiContext apiContext) {
}

public static ApiContext getApiContext() {
if (apiContext == null) {
if (BunqContext.apiContext == null) {
throw new BunqException(ERROR_API_CONTEXT_HAS_NOT_BEEN_SET);
}

return apiContext;
return BunqContext.apiContext;
}

public static UserContext getUserContext() {
if (userContext == null) {
if (BunqContext.userContext == null) {
throw new BunqException(ERROR_USER_CONTEXT_HAS_NOT_BEEN_SET);
}

return userContext;
return BunqContext.userContext;
}

public static void updateApiContext(ApiContext apiContext) {
if (BunqContext.apiContext == null) {
throw new BunqException(ERROR_API_CONTEXT_HAS_NOT_BEEN_SET);
}

BunqContext.apiContext = apiContext;
}
}

0 comments on commit ec3671c

Please sign in to comment.