diff --git a/.gitignore b/.gitignore
index eca468e..b98c397 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,5 +24,32 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
-
# End of https://www.gitignore.io/api/java
+
+
+# Created by https://www.gitignore.io/api/gradle
+
+### Gradle ###
+.gradle
+**/build/
+
+# Ignore Gradle GUI config
+gradle-app.setting
+
+# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
+!gradle-wrapper.jar
+
+# Cache of project
+.gradletasknamecache
+
+# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
+# gradle/wrapper/gradle-wrapper.properties
+
+# End of https://www.gitignore.io/api/gradle
+
+
+# JetBrains IDE config directory
+.idea
+
+# bunq configuration files
+*.conf
diff --git a/.gradle/4.0/fileChanges/last-build.bin b/.gradle/4.0/fileChanges/last-build.bin
deleted file mode 100644
index f76dd23..0000000
Binary files a/.gradle/4.0/fileChanges/last-build.bin and /dev/null differ
diff --git a/.gradle/4.0/fileHashes/fileHashes.bin b/.gradle/4.0/fileHashes/fileHashes.bin
deleted file mode 100644
index ae5f8a4..0000000
Binary files a/.gradle/4.0/fileHashes/fileHashes.bin and /dev/null differ
diff --git a/.gradle/4.0/fileHashes/fileHashes.lock b/.gradle/4.0/fileHashes/fileHashes.lock
deleted file mode 100644
index a4757cf..0000000
Binary files a/.gradle/4.0/fileHashes/fileHashes.lock and /dev/null differ
diff --git a/.gradle/buildOutputCleanup/built.bin b/.gradle/buildOutputCleanup/built.bin
deleted file mode 100644
index e69de29..0000000
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
deleted file mode 100644
index 20c03e3..0000000
--- a/.gradle/buildOutputCleanup/cache.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-#Tue Mar 20 22:44:33 CET 2018
-gradle.version=4.0
diff --git a/.gradle/buildOutputCleanup/cache.properties.lock b/.gradle/buildOutputCleanup/cache.properties.lock
deleted file mode 100644
index 40fdece..0000000
--- a/.gradle/buildOutputCleanup/cache.properties.lock
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_github_bunq_sdk_java_0_12_4.xml b/.idea/libraries/Gradle__com_github_bunq_sdk_java_0_12_4.xml
deleted file mode 100644
index e8b1ba2..0000000
--- a/.idea/libraries/Gradle__com_github_bunq_sdk_java_0_12_4.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_1.xml b/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_1.xml
deleted file mode 100644
index 623ed41..0000000
--- a/.idea/libraries/Gradle__com_google_code_gson_gson_2_8_1.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0.xml b/.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0.xml
deleted file mode 100644
index 3e30c86..0000000
--- a/.idea/libraries/Gradle__com_squareup_okio_okio_1_13_0.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml b/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml
deleted file mode 100644
index 76842c5..0000000
--- a/.idea/libraries/Gradle__commons_cli_commons_cli_1_2.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_codec_commons_codec_1_9.xml b/.idea/libraries/Gradle__commons_codec_commons_codec_1_9.xml
deleted file mode 100644
index c3c3ec6..0000000
--- a/.idea/libraries/Gradle__commons_codec_commons_codec_1_9.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_io_commons_io_1_3_2.xml b/.idea/libraries/Gradle__commons_io_commons_io_1_3_2.xml
deleted file mode 100644
index ae0f5ed..0000000
--- a/.idea/libraries/Gradle__commons_io_commons_io_1_3_2.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__commons_logging_commons_logging_1_2.xml b/.idea/libraries/Gradle__commons_logging_commons_logging_1_2.xml
deleted file mode 100644
index d26e061..0000000
--- a/.idea/libraries/Gradle__commons_logging_commons_logging_1_2.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__junit_junit_4_12.xml b/.idea/libraries/Gradle__junit_junit_4_12.xml
deleted file mode 100644
index 04c10dd..0000000
--- a/.idea/libraries/Gradle__junit_junit_4_12.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_commons_commons_io_1_3_2.xml b/.idea/libraries/Gradle__org_apache_commons_commons_io_1_3_2.xml
deleted file mode 100644
index bb50d1c..0000000
--- a/.idea/libraries/Gradle__org_apache_commons_commons_io_1_3_2.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_5_3.xml b/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_5_3.xml
deleted file mode 100644
index de63f02..0000000
--- a/.idea/libraries/Gradle__org_apache_httpcomponents_httpclient_4_5_3.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_4_6.xml b/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_4_6.xml
deleted file mode 100644
index e3ca788..0000000
--- a/.idea/libraries/Gradle__org_apache_httpcomponents_httpcore_4_4_6.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
deleted file mode 100644
index 8262f72..0000000
--- a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 5f64fa6..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules/tinker.iml b/.idea/modules/tinker.iml
deleted file mode 100644
index 15bf25b..0000000
--- a/.idea/modules/tinker.iml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules/tinker_main.iml b/.idea/modules/tinker_main.iml
deleted file mode 100644
index dcd19a8..0000000
--- a/.idea/modules/tinker_main.iml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules/tinker_test.iml b/.idea/modules/tinker_test.iml
deleted file mode 100644
index b5a25d4..0000000
--- a/.idea/modules/tinker_test.iml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 3fc436e..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,2137 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1521475811398
-
-
- 1521475811398
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SandboxUser.fromJsonReader(new JsonReader(new StringReader(jsonObject.getAsJsonArray("Response").get(0).getAsJsonObject().get("ApiKey").getAsJsonObject()))
- JAVA
- CODE_FRAGMENT
-
-
- SandboxUser.fromJsonReader(new JsonReader(new StringReader(jsonObject.getAsJsonArray("Response").get(0).getAsJsonObject().get("ApiKey").getAsJsonObject().getAsString())))
- JAVA
- CODE_FRAGMENT
-
-
- SandboxUser.fromJsonReader(new JsonReader(new StringReader(jsonObject.getAsJsonArray("Response").get(0).getAsJsonObject().get("ApiKey").getAsString())))
- JAVA
- CODE_FRAGMENT
-
-
-
-
- SandboxUser.fromJsonReader(new JsonReader(new StringReader(apiKEy.toString())))
- JAVA
- EXPRESSION
-
-
- apiKEy.toString()
- JAVA
- EXPRESSION
-
-
- jsonObject.getAsJsonArray("Response").get(0).getAsJsonObject().get("ApiKey")
- JAVA
- EXPRESSION
-
-
- response.body.string()
- JAVA
- EXPRESSION
-
-
- response.body
- JAVA
- EXPRESSION
-
-
- response.body.
- JAVA
- EXPRESSION
-
-
- response.body.string().toString()
- JAVA
- EXPRESSION
-
-
- response.body()
- JAVA
- okhttp3.internal.http.RealResponseBody
- EXPRESSION
-
-
- response.body().string()
- JAVA
- okhttp3.internal.http.RealResponseBody
- EXPRESSION
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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-cli:1.4
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..b371b55
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,20 @@
+Copyright (c) 2018 bunq b.v.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/build.gradle b/build.gradle
index 8d11ecb..658d587 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,7 +14,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
// https://mvnrepository.com/artifact/commons-cli/commons-cli
compile group: 'commons-cli', name: 'commons-cli', version: '1.2'
- compile 'com.github.bunq:sdk_java:0.13.+'
+ compile 'com.github.bunq:sdk_java:1.10.+'
}
jar {
diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF
deleted file mode 100644
index 58630c0..0000000
--- a/build/tmp/jar/MANIFEST.MF
+++ /dev/null
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index cf92ff3..0000000
--- a/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Fri Mar 16 12:30:08 CET 2018
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
diff --git a/src/main/java/com/bunq/tinker/AddCallbackUrl.java b/src/main/java/com/bunq/tinker/AddCallbackUrl.java
index a3ef20a..a269bb5 100644
--- a/src/main/java/com/bunq/tinker/AddCallbackUrl.java
+++ b/src/main/java/com/bunq/tinker/AddCallbackUrl.java
@@ -99,9 +99,7 @@ public void run(String[] args) throws ParseException {
null, /* subStatus */
null, /* legalGuardianAlias */
null, /* sessionTimeout */
- null, /* CardIds */
- null, /* cardLimits */
- null, /* dailyLimitWithoutConfirmationLogin */
+ null, /* DailyLimitWithoutConfirmationLogin */
allNotificationFilterUpdated
);
} else if (bunq.getUser().getReferencedObject() instanceof UserCompany) {
@@ -116,6 +114,7 @@ public void run(String[] args) throws ParseException {
null, /* country */
null, /* ubo */
null, /* chamberOfCommerce */
+ null, /* legalForm */
null, /* status */
null, /* subStatus */
null, /* sessionTimeout */
diff --git a/src/main/java/com/bunq/tinker/LinkCard.java b/src/main/java/com/bunq/tinker/LinkCard.java
index adf7de4..7f9bf31 100644
--- a/src/main/java/com/bunq/tinker/LinkCard.java
+++ b/src/main/java/com/bunq/tinker/LinkCard.java
@@ -2,14 +2,21 @@
import com.bunq.sdk.context.ApiEnvironmentType;
import com.bunq.sdk.model.generated.endpoint.Card;
+import com.bunq.sdk.model.generated.object.CardPinAssignment;
import com.bunq.tinker.libs.BunqLib;
import com.bunq.tinker.libs.SharedLib;
import com.bunq.tinker.utils.ITinker;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
+import java.util.ArrayList;
public class LinkCard implements ITinker {
+ /**
+ * Input constants.
+ */
+ private static final String CARD_PIN_ASSIGNMENT_TYPE_PRIMARY = "PRIMARY";
+
/**
* @param args
*
@@ -18,6 +25,7 @@ public class LinkCard implements ITinker {
public void run(String[] args) throws ParseException {
CommandLine allOption = SharedLib.parseAllOption(args);
ApiEnvironmentType environmentType = SharedLib.determineEnvironmentType(allOption);
+ ArrayList allCardPinAssignment = new ArrayList<>();
SharedLib.printHeader();
@@ -26,6 +34,12 @@ public void run(String[] args) throws ParseException {
String cardId = SharedLib.determineCardIdFromAllOptionOrStdIn(allOption);
String accountId = SharedLib.determineAccountIdFromAllOptionOrStdIn(allOption);
+ allCardPinAssignment.add(new CardPinAssignment(
+ CARD_PIN_ASSIGNMENT_TYPE_PRIMARY,
+ null, /* pinCode */
+ Integer.parseInt(accountId))
+ );
+
System.out.println();
System.out.println(" | Link Card: " + cardId);
System.out.println(" | To Account: " + accountId);
@@ -38,10 +52,11 @@ public void run(String[] args) throws ParseException {
null, /* pinCode */
null, /* activationCode */
null, /* status */
- null, /* limit */
+ null, /* cardLimit */
+ null, /* cardLimitAtm */
null, /* magStripePermissions */
null, /* countryPermission */
- Integer.parseInt(accountId)
+ allCardPinAssignment
);
System.out.println();
diff --git a/src/main/java/com/bunq/tinker/UserOverview.java b/src/main/java/com/bunq/tinker/UserOverview.java
index 2667023..84f4859 100644
--- a/src/main/java/com/bunq/tinker/UserOverview.java
+++ b/src/main/java/com/bunq/tinker/UserOverview.java
@@ -46,7 +46,7 @@ public void run(String[] args) throws ParseException {
System.out.println("");
System.out.println("");
System.out.println(" Want to see more monetary accounts, payments, requests or even cards?");
- System.out.println(" Adjust this file.");
+ System.out.println(" Adjust src/main/java/com/bunq/tinker/UserOverview.java accordingly.");
System.out.println("");
System.out.println("");
System.out.println("");
diff --git a/src/main/java/com/bunq/tinker/libs/BunqLib.java b/src/main/java/com/bunq/tinker/libs/BunqLib.java
index 5d550bc..7815b0e 100644
--- a/src/main/java/com/bunq/tinker/libs/BunqLib.java
+++ b/src/main/java/com/bunq/tinker/libs/BunqLib.java
@@ -4,6 +4,7 @@
import com.bunq.sdk.context.ApiEnvironmentType;
import com.bunq.sdk.context.BunqContext;
import com.bunq.sdk.exception.BunqException;
+import com.bunq.sdk.exception.ForbiddenException;
import com.bunq.sdk.http.Pagination;
import com.bunq.sdk.model.generated.endpoint.Card;
import com.bunq.sdk.model.generated.endpoint.MonetaryAccountBank;
@@ -13,6 +14,7 @@
import com.bunq.sdk.model.generated.endpoint.User;
import com.bunq.sdk.model.generated.endpoint.UserCompany;
import com.bunq.sdk.model.generated.endpoint.UserPerson;
+import com.bunq.sdk.model.generated.object.Amount;
import com.bunq.sdk.model.generated.object.LabelMonetaryAccount;
import com.bunq.sdk.model.generated.object.Pointer;
import com.google.gson.Gson;
@@ -26,237 +28,314 @@
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class BunqLib {
- private static final int DEFAULT_FETCH_COUNT = 10;
-
- /**
- * Error constants.
- */
- private static final String ERROR_COULD_NOT_FIND_ALIAS_TYPE_IBAN = "Could not find alias with type IBAN for monetary account \"%s\"";
- private static final String ERROR_COULD_NOT_GENERATE_NEW_API_KEY = "Encountered error while retrieving new sandbox ApiKey.\nError message %s";
- private static final String ERROR_COULD_NOT_FIND_CONFIG_FILE = "Could not find a bunq configuration to load.";
-
- /**
- * FileName constatns.
- */
- private static final String FILE_NAME_BUNQ_CONF_PRODUCTION = "bunq-production.conf";
- private static final String FILE_NAME_BUNQ_CONF_SANDBOX = "bunq-sandbox.conf";
-
- /**
- * Field constatns.
- */
- private static final String FIELD_RESPONSE = "Response";
- private static final String FIELD_API_KEY = "ApiKey";
-
- /**
- */
- private static final String POINTER_TYPE_IBAN = "IBAN";
- private static final String MONETARY_ACCOUNT_STATUS_ACTIVE = "ACTIVE";
- private static final String DEVICE_SERVER_DESCRIPTION = "bunq Tinker java";
-
- /**
- * The index of the fist item in an array.
- */
- private static final int INDEX_FIRST = 0;
-
- /**
- * Http constatns.
- */
- private static final int HTTP_STATUS_OK = 200;
- public static final String ERROR_COULD_NOT_DETERMINE_USER_TYPE = "Could not determine user type";
-
- private ApiEnvironmentType environmentType;
-
- private User user;
-
- public BunqLib(ApiEnvironmentType environmentType) {
- this.environmentType = environmentType;
-
- this.setupContext();
- this.setupCurrentUser();
+ private static final int DEFAULT_FETCH_COUNT = 10;
+
+ /**
+ * Error constants.
+ */
+ private static final String ERROR_COULD_NOT_FIND_ALIAS_TYPE_IBAN = "Could not find alias with type IBAN for monetary account \"%s\"";
+ private static final String ERROR_COULD_NOT_GENERATE_NEW_API_KEY = "Encountered error while retrieving new sandbox ApiKey.\nError message %s";
+ private static final String ERROR_COULD_NOT_FIND_CONFIG_FILE = "Could not find a bunq configuration to load.";
+
+ /**
+ * FileName constatns.
+ */
+ private static final String FILE_NAME_BUNQ_CONF_PRODUCTION = "bunq-production.conf";
+ private static final String FILE_NAME_BUNQ_CONF_SANDBOX = "bunq-sandbox.conf";
+
+ /**
+ * Field constatns.
+ */
+ private static final String FIELD_RESPONSE = "Response";
+ private static final String FIELD_API_KEY = "ApiKey";
+
+ /**
+ */
+ private static final String POINTER_TYPE_IBAN = "IBAN";
+ private static final String POINTER_TYPE_EMAIL = "EMAIL";
+ private static final String CURRENCY_EUR = "EUR";
+ private static final String MONETARY_ACCOUNT_STATUS_ACTIVE = "ACTIVE";
+ private static final String DEVICE_SERVER_DESCRIPTION = "bunq Tinker java";
+
+ /**
+ * The index of the fist item in an array.
+ */
+ private static final int INDEX_FIRST = 0;
+
+ /**
+ * Http constants.
+ */
+ private static final int HTTP_STATUS_OK = 200;
+ private static final String ERROR_COULD_NOT_DETERMINE_USER_TYPE = "Could not determine user type";
+
+ /**
+ * Request spending money constants.
+ */
+ private static final String REQUEST_SPENDING_MONEY_AMOUNT = "500.0";
+ private static final String REQUEST_SPENDING_MONEY_RECIPIENT = "sugardaddy@bunq.com";
+ private static final String REQUEST_SPENDING_MONEY_DESCRIPTION = "Requesting some spending money.";
+ private static final int REQUEST_SPENDING_MONEY_WAIT_TIME_MILLISECONDS = 1000;
+
+ /**
+ * Balance constant.
+ */
+ private static final double BALANCE_ZERO = 0.0;
+
+ private ApiEnvironmentType environmentType;
+
+ private User user;
+
+ public BunqLib(ApiEnvironmentType environmentType) {
+ this.environmentType = environmentType;
+
+ this.setupContext();
+ this.setupCurrentUser();
+ this.requestSpendingMoneyIfNeeded();
+ }
+
+ /**
+ */
+ private void setupContext() {
+ this.setupContext(true);
+ }
+
+ /**
+ */
+ private void setupContext(boolean resetConfigIfNeeded) {
+ if (new File(this.determineBunqConfigFileName()).exists()) {
+ // Config is already present.
+ } else if (ApiEnvironmentType.SANDBOX.equals(this.environmentType)) {
+ SandboxUser sandboxUser = generateNewSandboxUser();
+ ApiContext.create(ApiEnvironmentType.SANDBOX, sandboxUser.getApiKey(), DEVICE_SERVER_DESCRIPTION).save(this.determineBunqConfigFileName());
+ } else {
+ throw new BunqException(ERROR_COULD_NOT_FIND_CONFIG_FILE);
}
- /**
- *
- */
- private void setupContext() {
- if (new File(this.determineBunqConfigFileName()).exists()) {
- // Config is already present.
- } else if (ApiEnvironmentType.SANDBOX.equals(this.environmentType)) {
- SandboxUser sandboxUser = generateNewSandboxUser();
- ApiContext.create(ApiEnvironmentType.SANDBOX, sandboxUser.getApiKey(), DEVICE_SERVER_DESCRIPTION).save(this.determineBunqConfigFileName());
- } else {
- throw new BunqException(ERROR_COULD_NOT_FIND_CONFIG_FILE);
- }
-
- ApiContext apiContext = ApiContext.restore(this.determineBunqConfigFileName());
-
- apiContext.ensureSessionActive();
- apiContext.save(this.determineBunqConfigFileName());
-
- BunqContext.loadApiContext(apiContext);
- }
-
- public void updateContext() {
- BunqContext.getApiContext().save(this.determineBunqConfigFileName());
- }
+ try {
+ ApiContext apiContext = ApiContext.restore(this.determineBunqConfigFileName());
- /**
- *
- * @return String
- */
- private String determineBunqConfigFileName() {
- if (ApiEnvironmentType.PRODUCTION.equals(this.environmentType)) {
- return FILE_NAME_BUNQ_CONF_PRODUCTION;
- } else {
- return FILE_NAME_BUNQ_CONF_SANDBOX;
- }
- }
+ apiContext.ensureSessionActive();
+ apiContext.save(this.determineBunqConfigFileName());
- /**
- *
- */
- private void setupCurrentUser() {
- this.user = User.get().getValue();
+ BunqContext.loadApiContext(apiContext);
+ } catch (ForbiddenException forbiddenException) {
+ if (resetConfigIfNeeded) {
+ this.handleForbiddenException(forbiddenException);
+ } else {
+ throw forbiddenException;
+ }
}
-
- public User getUser() {
- return this.user;
+ }
+
+ public void updateContext() {
+ BunqContext.getApiContext().save(this.determineBunqConfigFileName());
+ }
+
+ /**
+ * @return String
+ */
+ private String determineBunqConfigFileName() {
+ if (ApiEnvironmentType.PRODUCTION.equals(this.environmentType)) {
+ return FILE_NAME_BUNQ_CONF_PRODUCTION;
+ } else {
+ return FILE_NAME_BUNQ_CONF_SANDBOX;
}
-
- public List getAllMonetaryAccountBankActive() {
- return getAllMonetaryAccountBankActive(DEFAULT_FETCH_COUNT);
+ }
+
+ /**
+ */
+ private void handleForbiddenException(ForbiddenException forbiddenException) {
+ if (ApiEnvironmentType.SANDBOX.equals(this.environmentType)) {
+ this.deleteOldConfig();
+ this.setupContext(false);
+ } else {
+ throw forbiddenException;
}
-
- public List getAllMonetaryAccountBankActive(int count) {
- Pagination pagination = new Pagination();
- pagination.setCount(count);
-
- List allAccount = MonetaryAccountBank.list(pagination.getUrlParamsCountOnly()).getValue();
- List allAccountActive = new ArrayList<>();
-
- for (MonetaryAccountBank account : allAccount) {
- if (account.getStatus().equals(MONETARY_ACCOUNT_STATUS_ACTIVE)) {
- allAccountActive.add(account);
- } else {
- // Account is not active.
- }
- }
-
- return allAccountActive;
+ }
+
+ /**
+ */
+ private void deleteOldConfig() {
+ try {
+ Files.delete(Paths.get((this.determineBunqConfigFileName())));
+ } catch (IOException e) {
+ throw new BunqException(e.getMessage());
}
-
- public List getAllPayment(MonetaryAccountBank monetaryAccountBank) {
- return getAllPayment(monetaryAccountBank, DEFAULT_FETCH_COUNT);
+ }
+
+ /**
+ */
+ private void setupCurrentUser() {
+ this.user = User.get().getValue();
+ }
+
+ public User getUser() {
+ return this.user;
+ }
+
+ public List getAllMonetaryAccountBankActive() {
+ return getAllMonetaryAccountBankActive(DEFAULT_FETCH_COUNT);
+ }
+
+ public List getAllMonetaryAccountBankActive(int count) {
+ Pagination pagination = new Pagination();
+ pagination.setCount(count);
+
+ List allAccount = MonetaryAccountBank.list(pagination.getUrlParamsCountOnly()).getValue();
+ List allAccountActive = new ArrayList<>();
+
+ for (MonetaryAccountBank account : allAccount) {
+ if (account.getStatus().equals(MONETARY_ACCOUNT_STATUS_ACTIVE)) {
+ allAccountActive.add(account);
+ } else {
+ // Account is not active.
+ }
}
- public List getAllPayment(MonetaryAccountBank monetaryAccountBank, int count) {
- Pagination pagination = new Pagination();
- pagination.setCount(count);
-
- return Payment.list(
- monetaryAccountBank.getId(),
- pagination.getUrlParamsCountOnly()
- ).getValue();
+ return allAccountActive;
+ }
+
+ public List getAllPayment(MonetaryAccountBank monetaryAccountBank) {
+ return getAllPayment(monetaryAccountBank, DEFAULT_FETCH_COUNT);
+ }
+
+ public List getAllPayment(MonetaryAccountBank monetaryAccountBank, int count) {
+ Pagination pagination = new Pagination();
+ pagination.setCount(count);
+
+ return Payment.list(
+ monetaryAccountBank.getId(),
+ pagination.getUrlParamsCountOnly()
+ ).getValue();
+ }
+
+ public List getAllRequest(MonetaryAccountBank monetaryAccountBank) {
+ return getAllRequest(monetaryAccountBank, DEFAULT_FETCH_COUNT);
+ }
+
+ public List getAllRequest(MonetaryAccountBank monetaryAccountBank, int count) {
+ Pagination pagination = new Pagination();
+ pagination.setCount(count);
+
+ return RequestInquiry.list(
+ monetaryAccountBank.getId(),
+ pagination.getUrlParamsCountOnly()
+ ).getValue();
+ }
+
+ public List getAllCard() {
+ return getAllCard(DEFAULT_FETCH_COUNT);
+ }
+
+ public List getAllCard(int count) {
+ Pagination pagination = new Pagination();
+ pagination.setCount(count);
+
+ return Card.list(
+ pagination.getUrlParamsCountOnly()
+ ).getValue();
+ }
+
+ public static Pointer getPointerIbanForMonetaryAccountBank(MonetaryAccountBank monetaryAccountBank) {
+ for (Pointer pointer : monetaryAccountBank.getAlias()) {
+ if (pointer.getType().equals(POINTER_TYPE_IBAN)) {
+ return pointer;
+ }
}
- public List getAllRequest(MonetaryAccountBank monetaryAccountBank) {
- return getAllRequest(monetaryAccountBank, DEFAULT_FETCH_COUNT);
+ throw new BunqException(
+ String.format(
+ ERROR_COULD_NOT_FIND_ALIAS_TYPE_IBAN,
+ monetaryAccountBank.getDescription()
+ )
+ );
+ }
+
+ public static MonetaryAccountBank getMonetaryAccountBankFromLabel(
+ LabelMonetaryAccount label,
+ List allMonetaryAccountBank
+ ) {
+ String labelIban = label.getIban();
+
+ for (MonetaryAccountBank monetaryAccountBank : allMonetaryAccountBank) {
+ String monetaryAccountBankIban = getPointerIbanForMonetaryAccountBank(monetaryAccountBank).getValue();
+
+ if (labelIban.equals(monetaryAccountBankIban)) {
+ return monetaryAccountBank;
+ } else {
+ // Have not found the matching MonetaryAccountBank yet.
+ }
}
- public List getAllRequest(MonetaryAccountBank monetaryAccountBank, int count) {
- Pagination pagination = new Pagination();
- pagination.setCount(count);
+ return null;
+ }
- return RequestInquiry.list(
- monetaryAccountBank.getId(),
- pagination.getUrlParamsCountOnly()
- ).getValue();
+ public List getAllUserAlias() {
+ if (this.getUser().getReferencedObject() instanceof UserPerson) {
+ return ((UserPerson) this.getUser().getReferencedObject()).getAlias();
+ } else if (this.getUser().getReferencedObject() instanceof UserCompany) {
+ return ((UserCompany) this.getUser().getReferencedObject()).getAlias();
+ } else {
+ throw new BunqException(ERROR_COULD_NOT_DETERMINE_USER_TYPE);
}
-
- private SandboxUser generateNewSandboxUser() {
- OkHttpClient client = new OkHttpClient();
-
- Request request = new Request.Builder()
- .url("https://public-api.sandbox.bunq.com/v1/sandbox-user")
- .post(RequestBody.create(null, new byte[0]))
- .addHeader("x-bunq-client-request-id", "1234")
- .addHeader("cache-control", "no-cache")
- .addHeader("x-bunq-geolocation", "0 0 0 0 NL")
- .addHeader("x-bunq-language", "en_US")
- .addHeader("x-bunq-region", "en_US")
- .build();
-
- try {
- Response response = client.newCall(request).execute();
- if (response.code() == HTTP_STATUS_OK) {
- String responseString = response.body().string();
- JsonObject jsonObject = new Gson().fromJson(responseString, JsonObject.class);
- JsonObject apiKEy = jsonObject.getAsJsonArray(FIELD_RESPONSE).get(INDEX_FIRST).getAsJsonObject().get(FIELD_API_KEY).getAsJsonObject();
-
- return SandboxUser.fromJsonReader(new JsonReader(new StringReader(apiKEy.toString())));
- } else {
- throw new BunqException(String.format(ERROR_COULD_NOT_GENERATE_NEW_API_KEY, response.body().string()));
- }
- } catch (IOException e) {
- throw new BunqException(e.getMessage());
- }
- }
-
- public List getAllCard(int count) {
- Pagination pagination = new Pagination();
- pagination.setCount(count);
-
- return Card.list(
- pagination.getUrlParamsCountOnly()
- ).getValue();
+ }
+
+ private SandboxUser generateNewSandboxUser() {
+ OkHttpClient client = new OkHttpClient();
+
+ Request request = new Request.Builder()
+ .url("https://public-api.sandbox.bunq.com/v1/sandbox-user")
+ .post(RequestBody.create(null, new byte[0]))
+ .addHeader("x-bunq-client-request-id", "1234")
+ .addHeader("cache-control", "no-cache")
+ .addHeader("x-bunq-geolocation", "0 0 0 0 NL")
+ .addHeader("x-bunq-language", "en_US")
+ .addHeader("x-bunq-region", "en_US")
+ .build();
+
+ try {
+ Response response = client.newCall(request).execute();
+ if (response.code() == HTTP_STATUS_OK) {
+ String responseString = response.body().string();
+ JsonObject jsonObject = new Gson().fromJson(responseString, JsonObject.class);
+ JsonObject apiKEy = jsonObject.getAsJsonArray(FIELD_RESPONSE).get(INDEX_FIRST).getAsJsonObject().get(FIELD_API_KEY).getAsJsonObject();
+
+ return SandboxUser.fromJsonReader(new JsonReader(new StringReader(apiKEy.toString())));
+ } else {
+ throw new BunqException(String.format(ERROR_COULD_NOT_GENERATE_NEW_API_KEY, response.body().string()));
+ }
+ } catch (IOException e) {
+ throw new BunqException(e.getMessage());
}
-
- public static Pointer getPointerIbanForMonetaryAccountBank(MonetaryAccountBank monetaryAccountBank) {
- for (Pointer pointer : monetaryAccountBank.getAlias()) {
- if (pointer.getType().equals(POINTER_TYPE_IBAN)) {
- return pointer;
- }
- }
-
- throw new BunqException(
- String.format(
- ERROR_COULD_NOT_FIND_ALIAS_TYPE_IBAN,
- monetaryAccountBank.getDescription()
- )
- );
+ }
+
+ private void requestSpendingMoneyIfNeeded() {
+ if (shouldRequestSpendingMoney()) {
+ RequestInquiry.create(
+ new Amount(REQUEST_SPENDING_MONEY_AMOUNT, CURRENCY_EUR),
+ new Pointer(POINTER_TYPE_EMAIL, REQUEST_SPENDING_MONEY_RECIPIENT),
+ REQUEST_SPENDING_MONEY_DESCRIPTION,
+ false
+ );
+
+ try {
+ Thread.sleep(REQUEST_SPENDING_MONEY_WAIT_TIME_MILLISECONDS);
+ } catch (InterruptedException exception) {
+ System.out.println(exception.getMessage());
+ }
}
+ }
- public static MonetaryAccountBank getMonetaryAccountBankFromLabel(
- LabelMonetaryAccount label,
- List allMonetaryAccountBank
- ) {
- String labelIban = label.getIban();
-
- for (MonetaryAccountBank monetaryAccountBank : allMonetaryAccountBank) {
- String monetaryAccountBankIban = getPointerIbanForMonetaryAccountBank(monetaryAccountBank).getValue();
-
- if (labelIban.equals(monetaryAccountBankIban)) {
- return monetaryAccountBank;
- } else {
- // Have not found the matching MonetaryAccountBank yet.
- }
- }
-
- return null;
- }
-
- public List getAllUserAlias() {
- if (this.getUser().getReferencedObject() instanceof UserPerson) {
- return ((UserPerson) this.getUser().getReferencedObject()).getAlias();
- } else if (this.getUser().getReferencedObject() instanceof UserCompany) {
- return ((UserCompany) this.getUser().getReferencedObject()).getAlias();
- } else {
- throw new BunqException(ERROR_COULD_NOT_DETERMINE_USER_TYPE);
- }
- }
+ private boolean shouldRequestSpendingMoney() {
+ return ApiEnvironmentType.SANDBOX.equals(environmentType)
+ && (Double.parseDouble(BunqContext.getUserContext().getPrimaryMonetaryAccountBank().getBalance().getValue())
+ <= BALANCE_ZERO);
+ }
}
diff --git a/src/main/java/com/bunq/tinker/libs/SharedLib.java b/src/main/java/com/bunq/tinker/libs/SharedLib.java
index 6fdfb77..eee7ef3 100644
--- a/src/main/java/com/bunq/tinker/libs/SharedLib.java
+++ b/src/main/java/com/bunq/tinker/libs/SharedLib.java
@@ -41,6 +41,8 @@ public class SharedLib {
private static final String ECHO_ACCOUNT_ID = " Account (ID): ";
private static final String ECHO_CALLBACK_URL = EOL + " Callback URL: ";
+ private static final String POINTER_TYPE_PHONE = "PHONE_NUMBER";
+
private static ApiEnvironmentType environmentType;
public static CommandLine parseAllOption(String[] args) throws ParseException {
@@ -180,11 +182,11 @@ public static void printUser(User user) {
}
System.out.println(ECHO_USER);
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ ID │ " + userId);
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Username │ " + userName);
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ ID │ " + userId);
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Username │ " + userName);
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
public static void printAllMonetaryAccountBank(List allMonetaryAccountBank) {
@@ -199,23 +201,23 @@ public static void printAllMonetaryAccountBank(List allMone
public static void printMonetaryAccountBank(MonetaryAccountBank monetaryAccountBank) {
Pointer pointerIban = BunqLib.getPointerIbanForMonetaryAccountBank(monetaryAccountBank);
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ ID │ " + monetaryAccountBank.getId());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Description │ " + monetaryAccountBank.getDescription());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ IBAN │ " + pointerIban.getValue());
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ ID │ " + monetaryAccountBank.getId());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Description │ " + monetaryAccountBank.getDescription());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ IBAN │ " + pointerIban.getValue());
if (monetaryAccountBank.getBalance() == null) {
// We don't have access to the balance of this account.
} else {
String currency = monetaryAccountBank.getBalance().getCurrency();
String value = monetaryAccountBank.getBalance().getValue();
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Balance │ " + currency + " " + value);
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Balance │ " + currency + " " + value);
}
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
public static void printAllPayment(List allPayment) {
@@ -230,17 +232,17 @@ public static void printAllPayment(List allPayment) {
public static void printPayment(Payment payment) {
String currency = payment.getAmount().getCurrency();
String value = payment.getAmount().getValue();
- String counterpartyDisplayName = payment.getCounterpartyAlias().getLabelMonetaryAccount().getDisplayName();
-
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ ID │ " + payment.getId());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Description │ " + payment.getDescription());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Amount │ " + currency + " " + value);
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Recipient │ " + counterpartyDisplayName);
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ String counterpartyDisplayName = payment.getCounterpartyAlias().getLabelUser().getDisplayName();
+
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ ID │ " + payment.getId());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Description │ " + payment.getDescription());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Amount │ " + currency + " " + value);
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Recipient │ " + counterpartyDisplayName);
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
public static void printAllRequest(List allRequest) {
@@ -255,19 +257,19 @@ public static void printAllRequest(List allRequest) {
public static void printRequest(RequestInquiry request) {
String currency = request.getAmountInquired().getCurrency();
String value = request.getAmountInquired().getValue();
- String counterpartyDisplayName = request.getCounterpartyAlias().getLabelMonetaryAccount().getDisplayName();
-
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ ID │ " + request.getId());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Description │ " + request.getDescription());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Status │ " + request.getStatus());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Amount │ " + currency + " " + value);
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Recipient │ " + counterpartyDisplayName);
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ String counterpartyDisplayName = request.getCounterpartyAlias().getLabelUser().getDisplayName();
+
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ ID │ " + request.getId());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Description │ " + request.getDescription());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Status │ " + request.getStatus());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Amount │ " + currency + " " + value);
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Recipient │ " + counterpartyDisplayName);
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
public static void printAllCard(List allCard, List allMonetaryAccountBank) {
@@ -281,38 +283,42 @@ public static void printAllCard(List allCard, List al
public static void printCard(Card card, List allMonetaryAccountBank) {
MonetaryAccountBank monetaryAccountBank = BunqLib.getMonetaryAccountBankFromLabel(
- card.getLabelMonetaryAccountCurrent().getLabelMonetaryAccount(),
+ card.getLabelMonetaryAccountCurrent(),
allMonetaryAccountBank
);
- String iban = card.getLabelMonetaryAccountCurrent().getPointer().getValue();
+ String iban = card.getLabelMonetaryAccountCurrent().getIban();
String cardDescription = card.getSecondLine() == null ? "bunq card" : card.getSecondLine();
String monetaryAccountDescription =
monetaryAccountBank == null ? "account description" : monetaryAccountBank.getDescription();
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ ID │ " + card.getId());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Type │ " + card.getType());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Name on Card │ " + card.getNameOnCard());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Description │ " + cardDescription);
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Linked Account │ " + monetaryAccountDescription + " " + iban);
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ ID │ " + card.getId());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Type │ " + card.getType());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Name on Card │ " + card.getNameOnCard());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Description │ " + cardDescription);
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Linked Account │ " + monetaryAccountDescription + " " + iban);
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
public static void printAllUserAlias(List allUserAlias) {
System.out.println(" You can use these login credentials to login in to the bunq sandbox app.");
for (Pointer alias : allUserAlias) {
- System.out.println(" ┌────────────────┬───────────────────────────────────────────────────────");
- System.out.println(" │ Value │ " + alias.getValue());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Type │ " + alias.getType());
- System.out.println(" ├────────────────┼───────────────────────────────────────────────────────");
- System.out.println(" │ Login Code │ 000000");
- System.out.println(" └────────────────┴───────────────────────────────────────────────────────");
+ System.out.println(" ┌───────────────────┬────────────────────────────────────────────────────");
+ System.out.println(" │ Value │ " + alias.getValue());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ System.out.println(" │ Type │ " + alias.getType());
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ if (alias.getType().equals(POINTER_TYPE_PHONE)) {
+ System.out.println(" │ Confirmation Code │ 123456");
+ System.out.println(" ├───────────────────┼────────────────────────────────────────────────────");
+ }
+ System.out.println(" │ Login Code │ 000000");
+ System.out.println(" └───────────────────┴────────────────────────────────────────────────────");
}
}
}