diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..18c5d82 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# 1. Base com Java 21 (Necessário para rodar o Gradle >+ 8.4 < or equal 8.14) +FROM eclipse-temurin:21-jdk-jammy + +LABEL maintainer="silvano.junior@equifax.com" + +# 2. Define a versão exata do Gradle +ENV GRADLE_VERSION=8.5 +ENV GRADLE_HOME=/opt/gradle +ENV PATH=${PATH}:${GRADLE_HOME}/bin +ENV GRADLE_USER_HOME=/project/.gradle_cache + +# 3. Instalação de ferramentas básicas e do Java 21 (para seu código legado) +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + gnupg \ + curl \ + wget \ + unzip \ + zip \ + && rm -rf /var/lib/apt/lists/* + +# 4. Instalação SDKman e Gradle 8.5 +RUN curl -s "https://get.sdkman.io" | bash +SHELL ["/bin/bash", "-c"] +RUN source "/root/.sdkman/bin/sdkman-init.sh" \ + && sdk install gradle 8.5-bin + +# 5. Configuração do Diretório +WORKDIR /project +RUN mkdir -p $GRADLE_USER_HOME + +# 6. Verifica as versões instaladas +RUN java -version && \ + javac -version && \ + ./gradle -v && \ + gpg --version + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/build.gradle b/build.gradle index 606593e..4f11c96 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ version = props["version"] // Configuração da Toolchain Java java { toolchain { - languageVersion = JavaLanguageVersion.of(11) + languageVersion = JavaLanguageVersion.of(21) } withJavadocJar() } @@ -53,6 +53,11 @@ dependencies { testImplementation 'com.github.tomakehurst:wiremock-jre8:3.0.1' } +// Configuração do compilador Java para mostrar avisos de depreciação +tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:deprecation" +} + // Tarefa para criar o JAR de código fonte tasks.register('sourcesJar', Jar) { from sourceSets.main.allJava @@ -119,6 +124,7 @@ tasks.named('javadoc', Javadoc) { if (JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) } + options.addStringOption('Xdoclint:none', '-quiet') } afterEvaluate { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..3315742 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +ossrhUsername=dummy +ossrhPassword=dummy \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 05679dc..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 6e5d9ef..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,127 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi -exec "$JAVACMD" "$@" \ No newline at end of file +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..6689b85 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/com/konduto/sdk/DateFormat.java b/src/main/java/com/konduto/sdk/DateFormat.java index 98c9f37..30c17ef 100644 --- a/src/main/java/com/konduto/sdk/DateFormat.java +++ b/src/main/java/com/konduto/sdk/DateFormat.java @@ -1,18 +1,31 @@ package com.konduto.sdk; +/** + * Enumeration of supported date formats for Konduto API. + * Each format provides a regex pattern for validation. + */ public enum DateFormat { + /** + * ISO 8601 datetime format with seconds: yyyy-MM-ddTHH:mm:ssZ + */ ISO_DATETIME("yyyy-MM-dd'T'HH:mm:ss'Z'") { @Override public String getRegex() { return "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z"; } }, + /** + * ISO 8601 datetime format without seconds: yyyy-MM-ddTHH:mmZ + */ ISO_DATETIME_NO_SECONDS("yyyy-MM-dd'T'HH:mm'Z'") { @Override public String getRegex() { return "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}Z"; } }, + /** + * Simple date format: yyyy-MM-dd + */ DATE("yyyy-MM-dd") { @Override public String getRegex() { @@ -26,9 +39,19 @@ public String getRegex() { this.format = format; } + /** + * Gets the date format pattern. + * + * @return the format pattern string + */ public String getFormat() { return format; } + /** + * Gets the regex pattern for validating dates in this format. + * + * @return the regex pattern string + */ public abstract String getRegex(); } \ No newline at end of file diff --git a/src/main/java/com/konduto/sdk/Konduto.java b/src/main/java/com/konduto/sdk/Konduto.java index e9e8bb4..08e9816 100644 --- a/src/main/java/com/konduto/sdk/Konduto.java +++ b/src/main/java/com/konduto/sdk/Konduto.java @@ -27,6 +27,10 @@ import java.util.List; import java.util.Properties; +/** + * Main client class for interacting with the Konduto fraud prevention API. + * Provides methods for analyzing orders, retrieving order information, and updating order status. + */ public final class Konduto { private static final Properties PROPERTIES = new Properties(); private static final ClassLoader contextClassLoader = Konduto.class.getClassLoader(); @@ -53,6 +57,12 @@ public final class Konduto { private URI endpoint = URI.create("https://api.konduto.com/v1"); private HttpClient httpClient; + /** + * Creates a new Konduto client instance with the specified API key. + * + * @param apiKey the 21-character API key provided by Konduto + * @throws IllegalArgumentException if the API key is null or not 21 characters long + */ public Konduto(String apiKey) { setApiKey(apiKey); rebuildHttpClient(null, null); @@ -70,10 +80,21 @@ private void rebuildHttpClient(ProxySelector proxySelector, Authenticator proxyA this.httpClient = builder.build(); } + /** + * Sets the proxy host and port. + * @param proxyHost the proxy host + * @param proxyPort the proxy port + */ public void setProxyHost(String proxyHost, int proxyPort) { rebuildHttpClient(ProxySelector.of(new InetSocketAddress(proxyHost, proxyPort)), null); } + /** + * Sets the proxy credentials for HTTP proxy authentication. + * + * @param username the proxy username + * @param password the proxy password + */ public void setProxyCredentials(String username, String password) { Authenticator authenticator = new Authenticator() { @Override @@ -84,10 +105,21 @@ protected PasswordAuthentication getPasswordAuthentication() { rebuildHttpClient(null, authenticator); } + /** + * Sets a custom API endpoint URL. Useful for testing or using different environments. + * + * @param endpoint the URI of the Konduto API endpoint + */ public void setEndpoint(URI endpoint) { this.endpoint = endpoint; } + /** + * Sets the API key for authentication with Konduto services. + * + * @param apiKey the 21-character API key provided by Konduto + * @throws IllegalArgumentException if the API key is null or not 21 characters long + */ public void setApiKey(String apiKey) { if (apiKey == null || apiKey.length() != 21) { throw new IllegalArgumentException("Illegal API Key: " + apiKey); @@ -95,6 +127,12 @@ public void setApiKey(String apiKey) { this.apiKey = apiKey; } + /** + * Returns debug information about the current request/response state. + * Useful for troubleshooting API interactions. + * + * @return a string containing debug information including API key, endpoint, and request/response bodies + */ public String debug() { StringBuilder sb = new StringBuilder(); sb.append(String.format("API Key: %s\n", this.apiKey)); @@ -108,14 +146,31 @@ public String debug() { return sb.toString(); } + /** + * Builds the URI for retrieving a specific order by ID. + * + * @param orderId the order identifier + * @return the URI for the GET order request + */ protected URI kondutoGetOrderUrl(String orderId) { return URI.create(endpoint.toString().concat("/orders/" + orderId)); } + /** + * Builds the URI for posting a new order analysis request. + * + * @return the URI for the POST order request + */ protected URI kondutoPostOrderUrl() { return URI.create(endpoint.toString().concat("/orders")); } + /** + * Builds the URI for updating an existing order. + * + * @param orderId the order identifier + * @return the URI for the PUT order request + */ protected URI kondutoPutOrderUrl(String orderId) { return URI.create(endpoint.toString().concat("/orders/" + orderId)); } @@ -145,6 +200,12 @@ private HttpRequest.Builder newRequestBuilder(URI uri) { .header("Content-Type", "application/json"); } + /** + * Retrieves an order by its ID. + * @param orderId the order ID + * @return the KondutoOrder instance + * @throws KondutoUnexpectedAPIResponseException if the API response is unexpected + */ public KondutoOrder getOrder(String orderId) throws KondutoUnexpectedAPIResponseException { HttpRequest request = newRequestBuilder(kondutoGetOrderUrl(orderId)).GET().build(); JsonObject responseBody = sendRequest(request, null); @@ -162,6 +223,14 @@ public KondutoOrder getOrder(String orderId) throws KondutoUnexpectedAPIResponse return order; } + /** + * Analyzes an order for fraud risk using Konduto's fraud prevention service. + * The order must be valid before analysis. + * + * @param order the KondutoOrder object to analyze + * @throws KondutoInvalidEntityException if the order is not valid + * @throws KondutoUnexpectedAPIResponseException if there's an unexpected API response + */ public void analyze(KondutoOrder order) throws KondutoInvalidEntityException, KondutoUnexpectedAPIResponseException { if (!order.isValid()) { throw new KondutoInvalidEntityException(order); @@ -189,6 +258,17 @@ public void analyze(KondutoOrder order) throws KondutoInvalidEntityException, Ko } } + /** + * Updates the status of an existing order in Konduto. + * Only certain status transitions are allowed: APPROVED, DECLINED, FRAUD, NOT_AUTHORIZED, CANCELED. + * + * @param order the KondutoOrder object to update + * @param newStatus the new status to set for the order + * @param comments mandatory comments explaining the status change + * @throws KondutoUnexpectedAPIResponseException if there's an unexpected API response + * @throws IllegalArgumentException if the new status is not allowed + * @throws NullPointerException if comments is null + */ public void updateOrderStatus(KondutoOrder order, KondutoOrderStatus newStatus, String comments) throws KondutoUnexpectedAPIResponseException { List allowed = Arrays.asList(KondutoOrderStatus.APPROVED, KondutoOrderStatus.DECLINED, KondutoOrderStatus.FRAUD, KondutoOrderStatus.NOT_AUTHORIZED, KondutoOrderStatus.CANCELED); if (!allowed.contains(newStatus)) { diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoBankAdapter.java b/src/main/java/com/konduto/sdk/adapters/KondutoBankAdapter.java index 82e46e7..f3ceae2 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoBankAdapter.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoBankAdapter.java @@ -5,20 +5,36 @@ import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.konduto.sdk.models.KondutoBank; -import com.konduto.sdk.models.KondutoBankDestinationAccount; import com.konduto.sdk.models.KondutoBankOriginAccount; import java.lang.reflect.Type; /** - * Created by igor.rodrigues (nickname: igor.francesco) 09/06/2022. - * KondutoBanKAdapter to deserialize KondutoBank objects. + * KondutoBankAdapter to serialize KondutoBank objects to JSON. */ public class KondutoBankAdapter implements JsonSerializer { + /** + * Default constructor. + */ + public KondutoBankAdapter() { + } + + /** + * Serializes a KondutoBank object into a JSON element. + * This method converts the properties of the KondutoBank instance into a JsonObject, + * handling null values appropriately. If the bank is an instance of KondutoBankOriginAccount, + * it delegates to KondutoBankOriginAccountAdapter for additional serialization. + * + * @param bank the KondutoBank object to serialize + * @param typeOfSrc the type of the source object + * @param context the serialization context + * @return the serialized JsonElement + */ @Override public JsonElement serialize(KondutoBank bank, Type typeOfSrc, JsonSerializationContext context) { JsonObject json = new JsonObject(); + // Add bank properties to JSON object if they are not null if (bank.getId() != null) { json.addProperty("id", bank.getId()); } @@ -46,6 +62,7 @@ public JsonElement serialize(KondutoBank bank, Type typeOfSrc, JsonSerialization if (bank.getBankAccount() != null) { json.addProperty("bank_account", bank.getBankAccount()); } + // If the bank is a KondutoBankOriginAccount, delegate to the specific adapter for additional fields if(bank.getClass().equals(KondutoBankOriginAccount.class)){ KondutoBankOriginAccountAdapter originAccountAdapter = new KondutoBankOriginAccountAdapter(); return originAccountAdapter.completeSerialization(json, (KondutoBankOriginAccount) bank); diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoBankDestinationAccountAdapter.java b/src/main/java/com/konduto/sdk/adapters/KondutoBankDestinationAccountAdapter.java index b347e01..533082a 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoBankDestinationAccountAdapter.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoBankDestinationAccountAdapter.java @@ -18,10 +18,16 @@ import java.util.Collection; /** - * Created by igor.rodrigues (nickname: igor.francesco) 10/06/2022. + * Adapter for serializing and deserializing collections of KondutoBankDestinationAccount objects. */ public class KondutoBankDestinationAccountAdapter implements JsonSerializer>, JsonDeserializer> { + /** + * Default constructor. + */ + public KondutoBankDestinationAccountAdapter() { + } + /** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. @@ -33,7 +39,7 @@ public class KondutoBankDestinationAccountAdapter implements JsonSerializer deserialize(JsonElement je, Typ return destinationAccounts; } + /** + * Helper method to deserialize a single KondutoBankDestinationAccount from JSON. + * + * @param je the JSON object to deserialize + * @param context the deserialization context + * @return the deserialized KondutoBankDestinationAccount + */ public KondutoBankDestinationAccount setDeserialize(JsonObject je, JsonDeserializationContext context) { return context.deserialize(je, KondutoBankDestinationAccount.class); diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoBankOriginAccountAdapter.java b/src/main/java/com/konduto/sdk/adapters/KondutoBankOriginAccountAdapter.java index a37c504..6c08e48 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoBankOriginAccountAdapter.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoBankOriginAccountAdapter.java @@ -11,10 +11,16 @@ import java.lang.reflect.Type; /** - * Created by igor.rodrigues (nickname: igor.francesco) 09/06/2022. + * Adapter for deserializing KondutoBankOriginAccount objects. */ public class KondutoBankOriginAccountAdapter extends KondutoBankAdapter implements JsonDeserializer { + /** + * Default constructor. + */ + public KondutoBankOriginAccountAdapter() { + } + /** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. @@ -26,7 +32,7 @@ public class KondutoBankOriginAccountAdapter extends KondutoBankAdapter implemen * * @param je The Json data being deserialized * @param typeOfT The type of the Object to deserialize to - * @param context + * @param context The context for deserialization * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} * @throws JsonParseException if json is not in the expected format of {@code typeofT} */ @@ -71,6 +77,13 @@ public KondutoBankOriginAccount deserialize(JsonElement je, Type typeOfT, JsonDe } + /** + * Completes the JSON serialization by adding origin account specific fields. + * + * @param json the JSON object being built + * @param originAccount the origin account to serialize + * @return the updated JSON element + */ public JsonElement completeSerialization(JsonObject json, KondutoBankOriginAccount originAccount){ if (originAccount.getBalance() != null) { diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoBoletoPaymentSerializer.java b/src/main/java/com/konduto/sdk/adapters/KondutoBoletoPaymentSerializer.java index f733cb7..84aa800 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoBoletoPaymentSerializer.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoBoletoPaymentSerializer.java @@ -7,12 +7,25 @@ import java.util.Date; /** - * Created by rsampaio on 9/8/16. - * +/** * Serializes a boleto payment. * Note the expiration date formatting. */ public class KondutoBoletoPaymentSerializer extends KondutoPaymentSerializer { + + /** + * Default constructor. + */ + public KondutoBoletoPaymentSerializer() { + } + + /** + * Completes the JSON serialization by adding boleto-specific fields including formatted expiration date. + * + * @param paymentAsJson the JSON object being built + * @param boletoPayment the boleto payment to serialize + * @return the updated JSON object + */ public JsonObject completeSerialization(JsonObject paymentAsJson, KondutoBoletoPayment boletoPayment) { Date expirationDate = boletoPayment.getExpirationDate(); if(expirationDate == null) { return paymentAsJson; } diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoBusTravelLegAdapter.java b/src/main/java/com/konduto/sdk/adapters/KondutoBusTravelLegAdapter.java index e73cbf0..d5b7ec5 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoBusTravelLegAdapter.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoBusTravelLegAdapter.java @@ -13,10 +13,18 @@ import java.lang.reflect.Type; /** - * Created by rsampaio on 7/12/16. + * Adapter for serializing and deserializing KondutoBusTravelLeg objects. * + * @see Konduto API Spec */ public class KondutoBusTravelLegAdapter extends KondutoTravelLegAdapter implements JsonSerializer, JsonDeserializer { + + /** + * Default constructor. + */ + public KondutoBusTravelLegAdapter() { + } + /** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. @@ -28,7 +36,7 @@ public class KondutoBusTravelLegAdapter extends KondutoTravelLegAdapter implemen * * @param je The Json data being deserialized * @param typeOfT The type of the Object to deserialize to - * @param context + * @param context The context for deserialization * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} * @throws JsonParseException if json is not in the expected format of {@code typeofT} */ @@ -74,7 +82,7 @@ public KondutoBusTravelLeg deserialize(JsonElement je, Type typeOfT, JsonDeseria * * @param travelLeg the object that needs to be converted to Json. * @param typeOfSrc the actual type (fully genericized version) of the source object. - * @param context + * @param context The context for serialization * @return a JsonElement corresponding to the specified object. */ @Override diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializer.java b/src/main/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializer.java index 904e4ec..66b50e3 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializer.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializer.java @@ -7,9 +7,17 @@ /** * Created by rsampaio on 9/8/16. * +/** * Serializes a credit card payment. */ public class KondutoCreditCardPaymentSerializer extends KondutoPaymentSerializer { + + /** + * Default constructor. + */ + public KondutoCreditCardPaymentSerializer() { + } + JsonElement completeSerialization(JsonObject paymentAsJson, KondutoCreditCardPayment creditCardPayment) { paymentAsJson.addProperty("sha1", creditCardPayment.getSha1()); paymentAsJson.addProperty("status", creditCardPayment.getStatusAsString()); diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoDebitPaymentSerializer.java b/src/main/java/com/konduto/sdk/adapters/KondutoDebitPaymentSerializer.java index bc93dfe..2242f5e 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoDebitPaymentSerializer.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoDebitPaymentSerializer.java @@ -4,8 +4,17 @@ import com.google.gson.JsonObject; import com.konduto.sdk.models.KondutoDebitPayment; +/** + * Serializes a debit payment. + */ public class KondutoDebitPaymentSerializer extends KondutoPaymentSerializer { + /** + * Default constructor. + */ + public KondutoDebitPaymentSerializer() { + } + JsonElement completeSerialization(JsonObject paymentAsJson, KondutoDebitPayment debitPayment) { paymentAsJson.addProperty("sha1", debitPayment.getSha1()); paymentAsJson.addProperty("status", debitPayment.getStatusAsString()); diff --git a/src/main/java/com/konduto/sdk/adapters/KondutoFlightTravelLegAdapter.java b/src/main/java/com/konduto/sdk/adapters/KondutoFlightTravelLegAdapter.java index 30744bf..e5015c1 100644 --- a/src/main/java/com/konduto/sdk/adapters/KondutoFlightTravelLegAdapter.java +++ b/src/main/java/com/konduto/sdk/adapters/KondutoFlightTravelLegAdapter.java @@ -13,11 +13,18 @@ import java.lang.reflect.Type; /** - * Created by rsampaio on 7/12/16. + * Adapter for serializing and deserializing KondutoFlightTravelLeg objects. * + * @see Konduto API Spec */ public class KondutoFlightTravelLegAdapter extends KondutoTravelLegAdapter implements JsonSerializer, JsonDeserializer { + /** + * Default constructor. + */ + public KondutoFlightTravelLegAdapter() { + } + /** * Gson invokes this call-back method during deserialization when it encounters a field of the * specified type. @@ -29,7 +36,7 @@ public class KondutoFlightTravelLegAdapter extends KondutoTravelLegAdapter imple * * @param je The Json data being deserialized * @param typeOfT The type of the Object to deserialize to - * @param context + * @param context The context for deserialization * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T} * @throws JsonParseException if json is not in the expected format of {@code typeofT} */ @@ -81,7 +88,7 @@ public KondutoFlightTravelLeg deserialize(JsonElement je, Type typeOfT, JsonDese * * @param travelLeg the object that needs to be converted to Json. * @param typeOfSrc the actual type (fully genericized version) of the source object. - * @param context + * @param context The context for serialization * @return a JsonElement corresponding to the specified object. */ @Override diff --git a/src/main/java/com/konduto/sdk/exceptions/KondutoException.java b/src/main/java/com/konduto/sdk/exceptions/KondutoException.java index 700c36a..de1b6f3 100644 --- a/src/main/java/com/konduto/sdk/exceptions/KondutoException.java +++ b/src/main/java/com/konduto/sdk/exceptions/KondutoException.java @@ -12,10 +12,17 @@ public class KondutoException extends Exception { private static final long serialVersionUID = 1920403867720844824L; + /** + * Default constructor. + */ public KondutoException() { super(); } + /** + * Constructor with message. + * @param message the exception message + */ public KondutoException(String message) { super(message); } diff --git a/src/main/java/com/konduto/sdk/exceptions/KondutoHTTPException.java b/src/main/java/com/konduto/sdk/exceptions/KondutoHTTPException.java index 0f15a14..cf53dfb 100644 --- a/src/main/java/com/konduto/sdk/exceptions/KondutoHTTPException.java +++ b/src/main/java/com/konduto/sdk/exceptions/KondutoHTTPException.java @@ -2,11 +2,20 @@ import com.google.gson.JsonObject; +/** + * Exception thrown when an HTTP error occurs during API communication. + */ public class KondutoHTTPException extends KondutoException { private static final long serialVersionUID = -1L; private final int statusCode; private final JsonObject responseBody; + /** + * Constructs a new KondutoHTTPException with the specified status code, message, and response body. + * @param statusCode the HTTP status code + * @param message the error message + * @param responseBody the response body as a JsonObject + */ public KondutoHTTPException(int statusCode, String message, JsonObject responseBody) { super(message); this.statusCode = statusCode; @@ -15,15 +24,25 @@ public KondutoHTTPException(int statusCode, String message, JsonObject responseB /** * Construtor para compatibilidade com testes que não fornecem um status code. + * @param message the error message + * @param responseBody the response body as a JsonObject */ public KondutoHTTPException(String message, JsonObject responseBody) { this(0, message, responseBody); // Define 0 como status code padrão } + /** + * Gets the HTTP status code. + * @return the HTTP status code + */ public int getStatusCode() { return statusCode; } + /** + * Gets the response body. + * @return the response body as a JsonObject + */ public JsonObject getResponseBody() { return responseBody; } diff --git a/src/main/java/com/konduto/sdk/exceptions/KondutoInvalidEntityException.java b/src/main/java/com/konduto/sdk/exceptions/KondutoInvalidEntityException.java index 45b36ec..047014c 100644 --- a/src/main/java/com/konduto/sdk/exceptions/KondutoInvalidEntityException.java +++ b/src/main/java/com/konduto/sdk/exceptions/KondutoInvalidEntityException.java @@ -11,6 +11,10 @@ public final class KondutoInvalidEntityException extends KondutoException { private static final long serialVersionUID = 4627487289664092129L; private KondutoModel entity; + /** + * Constructs a new KondutoInvalidEntityException with the specified invalid entity. + * @param entity the invalid KondutoModel instance + */ public KondutoInvalidEntityException(KondutoModel entity) { this.entity = entity; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoAddress.java b/src/main/java/com/konduto/sdk/models/KondutoAddress.java index 2cb844e..9dc9ee0 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoAddress.java +++ b/src/main/java/com/konduto/sdk/models/KondutoAddress.java @@ -1,8 +1,8 @@ package com.konduto.sdk.models; /** - * - * Address model. + * Represents an address in the Konduto system. + * This class extends KondutoModel and contains address-related attributes such as street, city, and postal code. * * @see Konduto API Spec */ @@ -20,6 +20,9 @@ public class KondutoAddress extends KondutoModel { /* Constructors */ + /** + * Default constructor for KondutoAddress. + */ public KondutoAddress() { } /** @@ -56,58 +59,128 @@ public boolean equals(Object o) { /* Getters and Setters */ + /** + * Gets the name associated with this address. + * + * @return the address name + */ public String getName() { return name; } + /** + * Sets the name associated with this address. + * + * @param name the address name + */ public void setName(String name) { this.name = name; } + /** + * Gets the first address line. + * + * @return the first address line + */ public String getAddress1() { return address1; } + /** + * Sets the first address line. + * + * @param address1 the first address line + */ public void setAddress1(String address1) { this.address1 = address1; } + /** + * Gets the second address line. + * + * @return the second address line + */ public String getAddress2() { return address2; } + /** + * Sets the second address line. + * + * @param address2 the second address line + */ public void setAddress2(String address2) { this.address2 = address2; } + /** + * Gets the postal code/ZIP code. + * + * @return the postal code + */ public String getZip() { return zip; } + /** + * Sets the postal code/ZIP code. + * + * @param zip the postal code + */ public void setZip(String zip) { this.zip = zip; } + /** + * Gets the city name. + * + * @return the city name + */ public String getCity() { return city; } + /** + * Sets the city name. + * + * @param city the city name + */ public void setCity(String city) { this.city = city; } + /** + * Gets the state/province name. + * + * @return the state name + */ public String getState() { return state; } + /** + * Sets the state/province name. + * + * @param state the state name + */ public void setState(String state) { this.state = state; } + /** + * Gets the country name. + * + * @return the country name + */ public String getCountry() { return country; } + /** + * Sets the country name. + * + * @param country the country name + */ public void setCountry(String country) { this.country = country; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoAgentSeller.java b/src/main/java/com/konduto/sdk/models/KondutoAgentSeller.java index 2482a71..5d5c1b7 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoAgentSeller.java +++ b/src/main/java/com/konduto/sdk/models/KondutoAgentSeller.java @@ -5,8 +5,8 @@ import java.util.Date; /** - * Created by igor.rodrigues (nickname: igor.francesco) 03/06/2022. - * Agent Seller model. + * Represents an agent seller in the Konduto system. + * This class extends KondutoModel and contains agent seller specific attributes. * * @see Konduto API Spec */ @@ -24,6 +24,9 @@ public final class KondutoAgentSeller extends KondutoModel { /* Constructors */ + /** + * Default constructor for KondutoAgentSeller. + */ public KondutoAgentSeller() { } /** @@ -66,51 +69,121 @@ public boolean equals(Object o) { /* Getters and Setters */ + /** + * Gets the agent seller's name. + * + * @return the agent seller name + */ public String getName() { return name; } + /** + * Sets the agent seller's name. + * + * @param name the agent seller name + */ public void setName(String name) { this.name = name; } + /** + * Gets the agent seller's unique identifier. + * + * @return the agent seller ID + */ public String getId() { return id; } + /** + * Sets the agent seller's unique identifier. + * + * @param id the agent seller ID + */ public void setId(String id) { this.id = id; } + /** + * Gets the agent seller's tax ID. + * + * @return the tax ID + */ public String getTaxId() { return taxId; } + /** + * Sets the agent seller's tax ID. + * + * @param taxId the tax ID + */ public void setTaxId(String taxId) { this.taxId = taxId; } + /** + * Gets the agent seller's category. + * + * @return the agent seller category + */ public String getCategory() { return category; } + /** + * Sets the agent seller's category. + * + * @param category the agent seller category + */ public void setCategory(String category) { this.category = category; } + /** + * Gets the agent seller's login username. + * + * @return the login username + */ public String getLogin() { return login; } + /** + * Sets the agent seller's login username. + * + * @param login the login username + */ public void setLogin(String login) { this.login = login; } + /** + * Gets the agent seller's creation date. + * + * @return the creation date + */ public Date getCreated_at() { return created_at; } + /** + * Sets the agent seller's creation date. + * + * @param created_at the creation date + */ public void setCreated_at(Date created_at) { this.created_at = created_at; } + /** + * Gets the agent seller's date of birth. + * + * @return the date of birth + */ public Date getDOB() { return dob; } + /** + * Sets the agent seller's date of birth. + * + * @param dob the date of birth + */ public void setDOB(Date dob) { this.dob = dob; } } diff --git a/src/main/java/com/konduto/sdk/models/KondutoBank.java b/src/main/java/com/konduto/sdk/models/KondutoBank.java index 6082e29..1a6ba99 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBank.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBank.java @@ -5,8 +5,8 @@ import java.util.Objects; /** - * Created by igor.rodrigues (nickname: igor.francesco) 08/06/2022. - * Bank Accounts model. + * Abstract base class for bank accounts in the Konduto system. + * This class extends KondutoModel and provides common bank account attributes. * * @see Konduto API Spec */ @@ -92,74 +92,164 @@ public int hashCode() { * Getters/setters */ + /** + * Gets the bank account unique identifier. + * + * @return the bank account ID + */ public String getId() { return id; } + /** + * Sets the bank account unique identifier. + * + * @param id the bank account ID + */ public void setId(String id) { this.id = id; } + /** + * Gets the type of document used as key for this bank account. + * + * @return the key type + */ public KondutoBankDocumentType getKeyType() { return keyType; } + /** + * Sets the type of document used as key for this bank account. + * + * @param keyType the key type + */ public void setKeyType(KondutoBankDocumentType keyType) { this.keyType = keyType; } + /** + * Gets the value of the document used as key for this bank account. + * + * @return the key value + */ public String getKeyValue() { return keyValue; } + /** + * Sets the value of the document used as key for this bank account. + * + * @param keyValue the key value + */ public void setKeyValue(String keyValue) { this.keyValue = keyValue; } + /** + * Gets the account holder's name. + * + * @return the holder name + */ public String getHolderName() { return holderName; } + /** + * Sets the account holder's name. + * + * @param holderName the holder name + */ public void setHolderName(String holderName) { this.holderName = holderName; } + /** + * Gets the account holder's tax ID. + * + * @return the holder tax ID + */ public String getHolderTaxId() { return holderTaxId; } + /** + * Sets the account holder's tax ID. + * + * @param holderTaxId the holder tax ID + */ public void setHolderTaxId(String holderTaxId) { this.holderTaxId = holderTaxId; } + /** + * Gets the bank code. + * + * @return the bank code + */ public String getBankCode() { return bankCode; } + /** + * Sets the bank code. + * + * @param bankCode the bank code + */ public void setBankCode(String bankCode) { this.bankCode = bankCode; } + /** + * Gets the bank name. + * + * @return the bank name + */ public String getBankName() { return bankName; } + /** + * Sets the bank name. + * + * @param bankName the bank name + */ public void setBankName(String bankName) { this.bankName = bankName; } + /** + * Gets the bank branch code. + * + * @return the bank branch + */ public String getBankBranch() { return bankBranch; } + /** + * Sets the bank branch code. + * + * @param bankBranch the bank branch + */ public void setBankBranch(String bankBranch) { this.bankBranch = bankBranch; } + /** + * Gets the bank account number. + * + * @return the bank account + */ public String getBankAccount() { return bankAccount; } + /** + * Sets the bank account number. + * + * @param bankAccount the bank account + */ public void setBankAccount(String bankAccount) { this.bankAccount = bankAccount; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoBankDestinationAccount.java b/src/main/java/com/konduto/sdk/models/KondutoBankDestinationAccount.java index 097bdb4..d3caa38 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBankDestinationAccount.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBankDestinationAccount.java @@ -5,8 +5,8 @@ import java.util.Objects; /** - * Created by igor.rodrigues (nickname: igor.francesco) 08/06/2022. - * Konduto Bank destination accounts model. + * Represents a bank destination account in the Konduto system. + * This class extends KondutoBank and contains destination account specific attributes. * * @see Konduto API Spec */ @@ -58,10 +58,20 @@ public int hashCode() { * Getters/setters */ + /** + * Gets the transfer amount for this destination account. + * + * @return the transfer amount + */ public Double getAmount() { return amount; } + /** + * Sets the transfer amount for this destination account. + * + * @param amount the transfer amount + */ public void setAmount(Double amount) { this.amount = amount; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoBankDocumentType.java b/src/main/java/com/konduto/sdk/models/KondutoBankDocumentType.java index 1e986c0..6cf6482 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBankDocumentType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBankDocumentType.java @@ -4,21 +4,43 @@ /** * Created by igor.rodrigues (nickname: igor.francesco) 08/06/2022. + * Enumeration of supported PIX key types for Brazilian bank accounts. */ public enum KondutoBankDocumentType { + /** + * PIX key using CPF (Individual Taxpayer ID) + */ @SerializedName("pix_cpf") PIX_CPF, + /** + * PIX key using CNPJ (Corporate Taxpayer ID) + */ @SerializedName("pix_cnpj") PIX_CNPJ, + /** + * PIX key using phone number + */ @SerializedName("pix_phone") PIX_PHONE, + /** + * PIX key using email address + */ @SerializedName("pix_email") PIX_EMAIL, + /** + * PIX key using EVP (End-to-End Identifier) + */ @SerializedName("pix_evp") PIX_EVP, + /** + * P2P (Person-to-Person) transfer + */ @SerializedName("p2p") P2P, + /** + * No specific key type + */ @SerializedName("none") NONE } \ No newline at end of file diff --git a/src/main/java/com/konduto/sdk/models/KondutoBankOriginAccount.java b/src/main/java/com/konduto/sdk/models/KondutoBankOriginAccount.java index 3935322..bb1fd64 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBankOriginAccount.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBankOriginAccount.java @@ -3,11 +3,10 @@ import com.google.gson.annotations.SerializedName; /** - * Created by igor.rodrigues (nickname: igor.francesco) 08/06/2022. - * Bank Origin Account model. + * Represents a bank origin account in the Konduto system. + * This class extends KondutoBank and contains origin account specific attributes. * * @see Konduto API Spec - * */ public class KondutoBankOriginAccount extends KondutoBank { @SerializedName(value = "balance") @@ -45,7 +44,18 @@ public boolean equals(Object o) { /** Getters/setters */ + /** + * Gets the current balance of the origin account. + * + * @return the account balance + */ public Double getBalance() {return balance;} + + /** + * Sets the current balance of the origin account. + * + * @param balance the account balance + */ public void setBalance(Double balance) {this.balance = balance;} } diff --git a/src/main/java/com/konduto/sdk/models/KondutoBoletoPayment.java b/src/main/java/com/konduto/sdk/models/KondutoBoletoPayment.java index 5dc00a0..8cc55b7 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBoletoPayment.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBoletoPayment.java @@ -6,7 +6,11 @@ /** * Created by rsampaio on 9/6/16. + * Boleto payment model for Brazilian bank slip payments. +/** + * Boleto payment model. * + * @see Konduto API Spec */ public class KondutoBoletoPayment extends KondutoPayment { @@ -15,6 +19,12 @@ public class KondutoBoletoPayment extends KondutoPayment { BOLETO_DATE_FORMAT.setLenient(false); } + /** + * Default constructor. + */ + public KondutoBoletoPayment() { + } + private Date expirationDate; @Override @@ -41,14 +51,30 @@ public int hashCode() { return result; } + /** + * Gets the boleto expiration date. + * + * @return the boleto expiration date + */ public Date getExpirationDate() { return expirationDate; } + /** + * Sets the boleto expiration date. + * + * @param expirationDate the expiration date + */ public void setExpirationDate(Date expirationDate) { this.expirationDate = expirationDate; } + /** + * Sets the boleto expiration date from a string in yyyy-MM-dd format. + * + * @param expirationDateAsStr the expiration date as string + * @throws RuntimeException if the date format is invalid + */ public void setExpirationDate(String expirationDateAsStr) { try { this.setExpirationDate(BOLETO_DATE_FORMAT.parse(expirationDateAsStr)); diff --git a/src/main/java/com/konduto/sdk/models/KondutoBureauQuery.java b/src/main/java/com/konduto/sdk/models/KondutoBureauQuery.java index 06feb1a..cf9cd79 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBureauQuery.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBureauQuery.java @@ -5,12 +5,23 @@ import java.util.HashMap; import java.util.Map; +/** + * Bureau query model for credit bureau information. + * + * @see Konduto API Spec + */ public class KondutoBureauQuery extends KondutoModel { @SerializedName("service") private String kondutoBureauService; @SerializedName("response") private Map kondutoBureauResponse; + /** + * Default constructor. + */ + public KondutoBureauQuery() { + } + @Override public boolean equals(Object obj) { if(!(obj instanceof KondutoBureauQuery)) { return false; } @@ -19,18 +30,38 @@ public boolean equals(Object obj) { this.kondutoBureauResponse.equals(that.kondutoBureauResponse); } + /** + * Gets the bureau service name. + * + * @return the bureau service name + */ public String getService() { return kondutoBureauService; } + /** + * Sets the bureau service name. + * + * @param kondutoBureauService the bureau service name + */ public void setService(String kondutoBureauService) { this.kondutoBureauService = kondutoBureauService; } + /** + * Gets the bureau response data. + * + * @return the bureau response map + */ public Map getResponse() { return kondutoBureauResponse; } + /** + * Sets the bureau response data. + * + * @param kondutoBureauResponse the bureau response map + */ public void setResponse(Map kondutoBureauResponse) { this.kondutoBureauResponse = kondutoBureauResponse; } @@ -47,6 +78,12 @@ public Object getAttribute(String field) { return this.kondutoBureauResponse.get(field); } + /** + * Sets an attribute in the bureau response. + * + * @param key the attribute key + * @param value the attribute value + */ public void setAttribute(String key, Object value) { if(this.kondutoBureauResponse == null) { this.kondutoBureauResponse = new HashMap(); diff --git a/src/main/java/com/konduto/sdk/models/KondutoBusTravelLeg.java b/src/main/java/com/konduto/sdk/models/KondutoBusTravelLeg.java index abdd6e2..fed091e 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoBusTravelLeg.java +++ b/src/main/java/com/konduto/sdk/models/KondutoBusTravelLeg.java @@ -12,6 +12,12 @@ public class KondutoBusTravelLeg extends KondutoTravelLeg { @Required private String destinationCity; + /** + * Default constructor. + */ + public KondutoBusTravelLeg() { + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -33,18 +39,37 @@ public int hashCode() { return result; } + /** + * Gets the origin city. + * @return the origin city + */ public String getOriginCity() { return originCity; } + /** + * Sets the origin city for the bus travel leg. + * + * @param originCity the origin city + */ public void setOriginCity(String originCity) { this.originCity = originCity; } + /** + * Gets the destination city for the bus travel leg. + * + * @return the destination city + */ public String getDestinationCity() { return destinationCity; } + /** + * Sets the destination city for the bus travel leg. + * + * @param destinationCity the destination city + */ public void setDestinationCity(String destinationCity) { this.destinationCity = destinationCity; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoCreditCardPayment.java b/src/main/java/com/konduto/sdk/models/KondutoCreditCardPayment.java index ec8c15c..4e63001 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoCreditCardPayment.java +++ b/src/main/java/com/konduto/sdk/models/KondutoCreditCardPayment.java @@ -3,14 +3,19 @@ import com.konduto.sdk.annotations.Required; /** - * - * Credit card model. + * Represents a credit card payment in the Konduto system. + * This class extends KondutoPayment and includes credit card specific attributes. * * @see Konduto API Spec - * */ public class KondutoCreditCardPayment extends KondutoPayment { + /** + * Default constructor. + */ + public KondutoCreditCardPayment() { + } + private String sha1; private String bin; @@ -29,79 +34,174 @@ public class KondutoCreditCardPayment extends KondutoPayment { @Required private KondutoPaymentStatus status; + /** + * Gets the SHA1 hash of the credit card number. + * + * @return the SHA1 hash of the credit card number + */ public String getSha1() { return sha1; } + /** + * Sets the SHA1 hash of the credit card number. + * + * @param sha1 the SHA1 hash of the credit card number + */ public void setSha1(String sha1) { this.sha1 = sha1; } + /** + * Gets the CVV verification result. + * + * @return the CVV verification result + */ public String getCvvResult() { return cvvResult; } + /** + * Sets the CVV verification result. + * + * @param cvvResult the CVV verification result + */ public void setCvvResult(String cvvResult) { this.cvvResult = cvvResult; } + /** + * Gets the AVS (Address Verification System) result. + * + * @return the AVS result + */ public String getAvsResult() { return avsResult; } + /** + * Sets the AVS (Address Verification System) result. + * + * @param avsResult the AVS result + */ public void setAvsResult(String avsResult) { this.avsResult = avsResult; } + /** + * Gets the number of payment retries. + * + * @return the number of payment retries + */ public Integer getNumberOfRetries() { return numberOfRetries; } + /** + * Sets the number of payment retries. + * + * @param numberOfRetries the number of payment retries + */ public void setNumberOfRetries(Integer numberOfRetries) { this.numberOfRetries = numberOfRetries; } + /** + * Gets the tax identification number associated with the credit card. + * + * @return the tax ID + */ public String getTaxId() { return taxId; } + /** + * Sets the tax identification number associated with the credit card. + * + * @param taxId the tax ID + */ public void setTaxId(String taxId) { this.taxId = taxId; } + /** + * Gets the payment status. + * + * @return the payment status + */ public KondutoPaymentStatus getStatus() { return status; } + /** + * Sets the payment status. + * + * @param status the payment status + */ public void setStatus(KondutoPaymentStatus status) { this.status = status; } + /** + * Gets the payment status as a lowercase string. + * + * @return the payment status as a string + */ public String getStatusAsString() { if(getStatus() == null) { throw new RuntimeException("Payment status cannot be null"); } return getStatus().toString().toLowerCase(); } + /** + * Gets the first 6 digits (BIN) of the credit card number. + * + * @return the BIN of the credit card + */ public String getBin() { return bin; } + /** + * Sets the first 6 digits (BIN) of the credit card number. + * + * @param bin the BIN of the credit card + */ public void setBin(String bin) { this.bin = bin; } + /** + * Gets the last 4 digits of the credit card number. + * + * @return the last 4 digits of the credit card + */ public String getLast4() { return last4; } + /** + * Sets the last 4 digits of the credit card number. + * + * @param last4 the last 4 digits of the credit card + */ public void setLast4(String last4) { this.last4 = last4; } + /** + * Gets the expiration date of the credit card. + * + * @return the expiration date + */ public String getExpirationDate() { return expirationDate; } + /** + * Sets the expiration date of the credit card. + * + * @param expirationDate the expiration date + */ public void setExpirationDate(String expirationDate) { this.expirationDate = expirationDate; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoCustomer.java b/src/main/java/com/konduto/sdk/models/KondutoCustomer.java index 7473c31..a3992f2 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoCustomer.java +++ b/src/main/java/com/konduto/sdk/models/KondutoCustomer.java @@ -34,6 +34,9 @@ public final class KondutoCustomer extends KondutoModel { /* Constructors */ + /** + * Default constructor. + */ public KondutoCustomer() { } /** @@ -77,130 +80,298 @@ public boolean equals(Object o) { /* Getters and Setters */ + /** + * Gets the customer's name. + * + * @return the customer's name + */ public String getName() { return name; } + /** + * Sets the customer's name. + * + * @param name the customer's name + */ public void setName(String name) { this.name = name; } + /** + * Gets the customer's unique identifier. + * + * @return the customer's ID + */ public String getId() { return id; } + /** + * Sets the customer's unique identifier. + * + * @param id the customer's ID + */ public void setId(String id) { this.id = id; } + /** + * Gets the customer's tax identification number. + * + * @return the customer's tax ID + */ public String getTaxId() { return taxId; } + /** + * Sets the customer's tax identification number. + * + * @param taxId the customer's tax ID + */ public void setTaxId(String taxId) { this.taxId = taxId; } + /** + * Gets the customer's primary phone number. + * + * @return the customer's primary phone number + */ public String getPhone1() { return phone1; } + /** + * Sets the customer's primary phone number. + * + * @param phone1 the customer's primary phone number + */ public void setPhone1(String phone1) { this.phone1 = phone1; } + /** + * Gets the customer's secondary phone number. + * + * @return the customer's secondary phone number + */ public String getPhone2() { return phone2; } + /** + * Sets the customer's secondary phone number. + * + * @param phone2 the customer's secondary phone number + */ public void setPhone2(String phone2) { this.phone2 = phone2; } + /** + * Gets the customer's email address. + * + * @return the customer's email address + */ public String getEmail() { return email; } + /** + * Sets the customer's email address. + * + * @param email the customer's email address + */ public void setEmail(String email) { this.email = email; } + /** + * Gets whether the customer is a VIP. + * @return true if the customer is a VIP, false otherwise + */ public Boolean getIsVip() { return isVip; } + /** + * Sets whether the customer is a VIP. + * + * @param isVip true if the customer is a VIP, false otherwise + */ public void setIsVip(Boolean isVip) { this.isVip = isVip; } + /** + * Gets whether the customer is new. + * + * @return true if the customer is new, false otherwise + */ public Boolean getIsNew() { return isNew; } + /** + * Sets whether the customer is new. + * + * @param isNew true if the customer is new, false otherwise + */ public void setIsNew(Boolean isNew) { this.isNew = isNew; } + /** + * Gets the customer's creation date. + * + * @return the customer's creation date + */ public Date getCreatedAt() { return createdAt; } + /** + * Sets the customer's creation date. + * + * @param createdAt the customer's creation date + */ public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + /** + * Gets the customer's date of birth. + * + * @return the customer's date of birth + */ public Date getDOB() { return dob; } + /** + * Sets the customer's date of birth. + * + * @param dob the customer's date of birth + */ public void setDOB(Date dob) { this.dob = dob; } + /** + * Gets whether the customer is new (alias for getIsNew). + * + * @return true if the customer is new, false otherwise + */ public Boolean getNew() { return isNew; } + /** + * Sets whether the customer is new (alias for setIsNew). + * + * @param aNew true if the customer is new, false otherwise + */ public void setNew(Boolean aNew) { isNew = aNew; } + /** + * Gets whether the customer is a VIP (alias for getIsVip). + * @return true if the customer is a VIP, false otherwise + */ public Boolean getVip() { return isVip; } + /** + * Sets whether the customer is a VIP (alias for setIsVip). + * + * @param vip true if the customer is a VIP, false otherwise + */ public void setVip(Boolean vip) { isVip = vip; } + /** + * Gets the customer's date of birth (alias for getDOB). + * + * @return the customer's date of birth + */ public Date getDob() { return dob; } + /** + * Sets the customer's date of birth (alias for setDOB). + * + * @param dob the customer's date of birth + */ public void setDob(Date dob) { this.dob = dob; } + /** + * Gets the customer's type. + * + * @return the customer's type + */ public String getType() { return type; } + /** + * Sets the customer's type. + * + * @param type the customer's type + */ public void setType(String type) { this.type = type; } + /** + * Gets the customer's risk level. + * + * @return the customer's risk level + */ public String getRiskLevel() { return riskLevel; } + /** + * Sets the customer's risk level. + * + * @param riskLevel the customer's risk level + */ public void setRiskLevel(String riskLevel) { this.riskLevel = riskLevel; } + /** + * Gets the customer's risk score. + * + * @return the customer's risk score + */ public Integer getRiskScore() { return riskScore; } + /** + * Sets the customer's risk score. + * + * @param riskScore the customer's risk score + */ public void setRiskScore(Integer riskScore) { this.riskScore = riskScore; } + /** + * Gets the customer's mother's name. + * + * @return the customer's mother's name + */ public String getMotherName() { return motherName; } + /** + * Sets the customer's mother's name. + * + * @param motherName the customer's mother's name + */ public void setMotherName(String motherName) { this.motherName = motherName; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoDebitPayment.java b/src/main/java/com/konduto/sdk/models/KondutoDebitPayment.java index e40423e..748cdc4 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDebitPayment.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDebitPayment.java @@ -1,10 +1,19 @@ package com.konduto.sdk.models; /** - * Created by rsampaio on 9/6/16. + * Represents a debit payment in the Konduto system. + * This class extends KondutoPayment and includes debit card specific attributes. + * + * @see Konduto API Spec */ public class KondutoDebitPayment extends KondutoPayment { + /** + * Default constructor. + */ + public KondutoDebitPayment() { + } + private String sha1; private String bin; @@ -23,78 +32,173 @@ public class KondutoDebitPayment extends KondutoPayment { private KondutoPaymentStatus status; + /** + * Gets the SHA1 hash of the debit card number. + * + * @return the SHA1 hash of the debit card number + */ public String getSha1() { return sha1; } + /** + * Sets the SHA1 hash of the debit card number. + * + * @param sha1 the SHA1 hash of the debit card number + */ public void setSha1(String sha1) { this.sha1 = sha1; } + /** + * Gets the first 6 digits (BIN) of the debit card number. + * + * @return the BIN of the debit card + */ public String getBin() { return bin; } + /** + * Sets the first 6 digits (BIN) of the debit card number. + * + * @param bin the BIN of the debit card + */ public void setBin(String bin) { this.bin = bin; } + /** + * Gets the last 4 digits of the debit card number. + * + * @return the last 4 digits of the debit card + */ public String getLast4() { return last4; } + /** + * Sets the last 4 digits of the debit card number. + * + * @param last4 the last 4 digits of the debit card + */ public void setLast4(String last4) { this.last4 = last4; } + /** + * Gets the expiration date of the debit card. + * + * @return the expiration date + */ public String getExpirationDate() { return expirationDate; } + /** + * Sets the expiration date of the debit card. + * + * @param expirationDate the expiration date + */ public void setExpirationDate(String expirationDate) { this.expirationDate = expirationDate; } + /** + * Gets the CVV verification result. + * + * @return the CVV verification result + */ public String getCvvResult() { return cvvResult; } + /** + * Sets the CVV verification result. + * + * @param cvvResult the CVV verification result + */ public void setCvvResult(String cvvResult) { this.cvvResult = cvvResult; } + /** + * Gets the AVS (Address Verification System) result. + * + * @return the AVS result + */ public String getAvsResult() { return avsResult; } + /** + * Sets the AVS (Address Verification System) result. + * + * @param avsResult the AVS result + */ public void setAvsResult(String avsResult) { this.avsResult = avsResult; } + /** + * Gets the number of payment retries. + * + * @return the number of payment retries + */ public Integer getNumberOfRetries() { return numberOfRetries; } + /** + * Sets the number of payment retries. + * + * @param numberOfRetries the number of payment retries + */ public void setNumberOfRetries(Integer numberOfRetries) { this.numberOfRetries = numberOfRetries; } + /** + * Gets the tax identification number associated with the debit card. + * + * @return the tax ID + */ public String getTaxId() { return taxId; } + /** + * Sets the tax identification number associated with the debit card. + * + * @param taxId the tax ID + */ public void setTaxId(String taxId) { this.taxId = taxId; } + /** + * Gets the payment status. + * + * @return the payment status + */ public KondutoPaymentStatus getStatus() { return status; } + /** + * Sets the payment status. + * + * @param status the payment status + */ public void setStatus(KondutoPaymentStatus status) { this.status = status; } + /** + * Gets the payment status as a lowercase string. + * + * @return the payment status as a string + */ public String getStatusAsString() { return getStatus() == null ? null : diff --git a/src/main/java/com/konduto/sdk/models/KondutoDecisionListTrigger.java b/src/main/java/com/konduto/sdk/models/KondutoDecisionListTrigger.java index 2ec9426..53f4b52 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDecisionListTrigger.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDecisionListTrigger.java @@ -2,43 +2,65 @@ import com.google.gson.annotations.SerializedName; +/** + * Enum representing the triggers for decision list entries. + */ public enum KondutoDecisionListTrigger { + /** Email address trigger */ @SerializedName("email") EMAIL, + /** Billing address trigger */ @SerializedName("billing") BILLING, + /** Shipping address trigger */ @SerializedName("shipping") SHIPPING, + /** Tax ID trigger */ @SerializedName("tax_id") TAX_ID, + /** Primary phone number trigger */ @SerializedName("phone_1") PHONE_1, + /** Secondary phone number trigger */ @SerializedName("phone_2") PHONE_2, + /** IP address trigger */ @SerializedName("ip") IP, + /** Shipping ZIP code trigger */ @SerializedName("shipping_zip") SHIPPING_ZIP, + /** Billing ZIP code trigger */ @SerializedName("billing_zip") BILLING_ZIP, + /** Hotel ZIP code trigger */ @SerializedName("hotel_zip") HOTEL_ZIP, + /** Customer name trigger */ @SerializedName("customer_name") CUSTOMER_NAME, + /** Shipping name trigger */ @SerializedName("shipping_name") SHIPPING_NAME, + /** Billing name trigger */ @SerializedName("billing_name") BILLING_NAME, + /** Last 4 digits of card BIN trigger */ @SerializedName("bin_last4") BIN_LAST4, + /** Passenger name trigger */ @SerializedName("passenger_name") PASSENGER_NAME, + /** Passenger document trigger */ @SerializedName("passenger_document") PASSENGER_DOCUMENT, + /** Guest name trigger */ @SerializedName("guest_name") GUEST_NAME, + /** Guest document trigger */ @SerializedName("guest_document") GUEST_DOCUMENT, + /** Device IP address trigger */ @SerializedName("device_ip") DEVICE_IP } \ No newline at end of file diff --git a/src/main/java/com/konduto/sdk/models/KondutoDecisionListType.java b/src/main/java/com/konduto/sdk/models/KondutoDecisionListType.java index 59cec6d..543dbb5 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDecisionListType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDecisionListType.java @@ -2,19 +2,29 @@ import com.google.gson.annotations.SerializedName; +/** + * Enum representing the types of decision list entries. + */ public enum KondutoDecisionListType { + /** Email address type */ @SerializedName("email") EMAIL, + /** Tax ID type */ @SerializedName("tax_id") TAX_ID, + /** Phone number type */ @SerializedName("phone") PHONE, + /** Last 4 digits of card BIN type */ @SerializedName("bin_last4") BIN_LAST4, + /** ZIP code type */ @SerializedName("zip") ZIP, + /** Name type */ @SerializedName("name") NAME, + /** IP address type */ @SerializedName("ip") IP } diff --git a/src/main/java/com/konduto/sdk/models/KondutoDelivery.java b/src/main/java/com/konduto/sdk/models/KondutoDelivery.java index a999b4b..c86fbb3 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDelivery.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDelivery.java @@ -1,40 +1,91 @@ package com.konduto.sdk.models; +/** + * Delivery model. + * + * @see Konduto API Spec + */ public class KondutoDelivery extends KondutoModel { + /** + * Default constructor. + */ + public KondutoDelivery() { + } + private String estimatedDeliveryDate; private String estimatedShippingDate; private String deliveryCompany; private String deliveryMethod; + /** + * Gets the estimated delivery date. + * + * @return the estimated delivery date + */ public String getEstimatedDeliveryDate() { return estimatedDeliveryDate; } + /** + * Sets the estimated delivery date. + * + * @param estimatedDeliveryDate the estimated delivery date + */ public void setEstimatedDeliveryDate(String estimatedDeliveryDate) { this.estimatedDeliveryDate = estimatedDeliveryDate; } + /** + * Gets the estimated shipping date. + * + * @return the estimated shipping date + */ public String getEstimatedShippingDate() { return estimatedShippingDate; } + /** + * Sets the estimated shipping date. + * + * @param estimatedShippingDate the estimated shipping date + */ public void setEstimatedShippingDate(String estimatedShippingDate) { this.estimatedShippingDate = estimatedShippingDate; } + /** + * Gets the delivery company. + * + * @return the delivery company + */ public String getDeliveryCompany() { return deliveryCompany; } + /** + * Sets the delivery company. + * + * @param deliveryCompany the delivery company + */ public void setDeliveryCompany(String deliveryCompany) { this.deliveryCompany = deliveryCompany; } + /** + * Gets the delivery method. + * + * @return the delivery method + */ public String getDeliveryMethod() { return deliveryMethod; } + /** + * Sets the delivery method. + * + * @param deliveryMethod the delivery method + */ public void setDeliveryMethod(String deliveryMethod) { this.deliveryMethod = deliveryMethod; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoDevice.java b/src/main/java/com/konduto/sdk/models/KondutoDevice.java index 212c612..5e777f5 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDevice.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDevice.java @@ -19,6 +19,9 @@ public class KondutoDevice extends KondutoModel { private boolean flash; private String ip; + /** + * Default constructor. + */ public KondutoDevice(){} /* Equals */ @@ -50,82 +53,183 @@ public int hashCode() { } /* Getters and Setters */ + + /** + * Gets the user ID associated with the device. + * + * @return the user ID + */ public String getUserId() { return userId; } + /** + * Sets the user ID associated with the device. + * + * @param userId the user ID + */ public void setUserId(String userId) { this.userId = userId; } + /** + * Gets the device fingerprint. + * + * @return the device fingerprint + */ public String getFingerprint() { return fingerprint; } + /** + * Sets the device fingerprint. + * + * @param fingerprint the device fingerprint + */ public void setFingerprint(String fingerprint) { this.fingerprint = fingerprint; } + /** + * Gets the device platform. + * + * @return the device platform + */ public String getPlatform() { return platform; } + /** + * Sets the device platform. + * + * @param platform the device platform + */ public void setPlatform(String platform) { this.platform = platform; } + /** + * Gets the device browser. + * + * @return the device browser + */ public String getBrowser() { return browser; } + /** + * Sets the device browser. + * + * @param browser the device browser + */ public void setBrowser(String browser) { this.browser = browser; } + /** + * Gets the device language. + * + * @return the device language + */ public String getLanguage() { return language; } + /** + * Sets the device language. + * + * @param language the device language + */ public void setLanguage(String language) { this.language = language; } + /** + * Gets the device timezone. + * + * @return the device timezone + */ public String getTimezone() { return timezone; } + /** + * Sets the device timezone. + * + * @param timezone the device timezone + */ public void setTimezone(String timezone) { this.timezone = timezone; } + /** + * Checks if cookies are enabled on the device. + * + * @return true if cookies are enabled, false otherwise + */ public boolean isCookieEnabled() { return cookie; } + /** + * Sets whether cookies are enabled on the device. + * + * @param cookie true if cookies are enabled, false otherwise + */ public void setCookie(boolean cookie) { this.cookie = cookie; } + /** + * Checks if JavaScript is enabled on the device. + * + * @return true if JavaScript is enabled, false otherwise + */ public boolean isJavascriptEnabled() { return javascript; } + /** + * Sets whether JavaScript is enabled on the device. + * + * @param javascript true if JavaScript is enabled, false otherwise + */ public void setJavascript(boolean javascript) { this.javascript = javascript; } + /** + * Checks if Flash is enabled on the device. + * + * @return true if Flash is enabled, false otherwise + */ public boolean isFlashEnabled() { return flash; } + /** + * Sets whether Flash is enabled on the device. + * + * @param flash true if Flash is enabled, false otherwise + */ public void setFlash(boolean flash) { this.flash = flash; } + /** + * Gets the device's IP address. + * + * @return the device's IP address + */ public String getIp() { return ip; } + /** + * Sets the device's IP address. + * + * @param ip the device's IP address + */ public void setIp(String ip) { this.ip = ip; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoDocumentType.java b/src/main/java/com/konduto/sdk/models/KondutoDocumentType.java index 98f8102..03723d3 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoDocumentType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoDocumentType.java @@ -3,11 +3,13 @@ import com.google.gson.annotations.SerializedName; /** - * Created by raphaelsampaio on 5/6/15. + * Enum representing document types. */ public enum KondutoDocumentType { + /** ID document type */ @SerializedName("id") ID, + /** Passport document type */ @SerializedName("passport") PASSPORT } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEvent.java b/src/main/java/com/konduto/sdk/models/KondutoEvent.java index 9c97f59..96c7a81 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEvent.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEvent.java @@ -7,11 +7,19 @@ /** * Model that represents an event. +/** + * Event model. * * @see Konduto API Spec */ public class KondutoEvent extends KondutoModel { + /** + * Default constructor. + */ + public KondutoEvent() { + } + @Required private String name; @@ -64,50 +72,110 @@ public boolean isValid() { return isValid && super.isValid(); } + /** + * Gets the event name. + * + * @return the event name + */ public String getName() { return name; } + /** + * Sets the event name. + * + * @param name the event name + */ public void setName(String name) { this.name = name; } + /** + * Gets the event date. + * + * @return the event date + */ public String getDate() { return date; } + /** + * Sets the event date. + * + * @param date the event date + */ public void setDate(String date) { this.date = date; } + /** + * Gets the event type. + * + * @return the event type + */ public KondutoEventType getType() { return type; } + /** + * Sets the event type. + * + * @param type the event type + */ public void setType(KondutoEventType type) { this.type = type; } + /** + * Gets the event subtype. + * + * @return the event subtype + */ public String getSubtype() { return subtype; } + /** + * Sets the event subtype. + * + * @param subtype the event subtype + */ public void setSubtype(String subtype) { this.subtype = subtype; } + /** + * Gets the event venue. + * + * @return the event venue + */ public KondutoEventVenue getVenue() { return venue; } + /** + * Sets the event venue. + * + * @param venue the event venue + */ public void setVenue(KondutoEventVenue venue) { this.venue = venue; } + /** + * Gets the list of event tickets. + * + * @return the list of event tickets + */ public List getTickets() { return tickets; } + /** + * Sets the list of event tickets. + * + * @param tickets the list of event tickets + */ public void setTickets(List tickets) { this.tickets = tickets; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventTicket.java b/src/main/java/com/konduto/sdk/models/KondutoEventTicket.java index d849824..c820199 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventTicket.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventTicket.java @@ -9,6 +9,12 @@ */ public class KondutoEventTicket extends KondutoModel { + /** + * Default constructor. + */ + public KondutoEventTicket() { + } + private String id; @Required @@ -49,42 +55,92 @@ public boolean isValid() { return super.isValid(); } + /** + * Gets the ticket ID. + * + * @return the ticket ID + */ public String getId() { return id; } + /** + * Sets the ticket ID. + * + * @param id the ticket ID + */ public void setId(String id) { this.id = id; } + /** + * Gets the ticket category. + * + * @return the ticket category + */ public KondutoEventTicketCategory getCategory() { return category; } + /** + * Sets the ticket category. + * + * @param category the ticket category + */ public void setCategory(KondutoEventTicketCategory category) { this.category = category; } + /** + * Gets the ticket section. + * + * @return the ticket section + */ public String getSection() { return section; } + /** + * Sets the ticket section. + * + * @param section the ticket section + */ public void setSection(String section) { this.section = section; } + /** + * Gets whether the ticket is premium. + * + * @return true if the ticket is premium, false otherwise + */ public Boolean getPremium() { return premium; } + /** + * Sets whether the ticket is premium. + * + * @param premium true if the ticket is premium, false otherwise + */ public void setPremium(Boolean premium) { this.premium = premium; } + /** + * Gets the ticket attendee information. + * + * @return the ticket attendee + */ public KondutoEventTicketAttendee getAttendee() { return attendee; } + /** + * Sets the ticket attendee information. + * + * @param attendee the ticket attendee + */ public void setAttendee(KondutoEventTicketAttendee attendee) { this.attendee = attendee; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendee.java b/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendee.java index 7e8280b..eb4a325 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendee.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendee.java @@ -5,13 +5,18 @@ import com.konduto.sdk.annotations.ValidateFormat; /** - * Model representing an attendee to an event. + * Model that represents an event ticket attendee. * * @see Konduto API Spec - * */ public class KondutoEventTicketAttendee extends KondutoModel { + /** + * Default constructor. + */ + public KondutoEventTicketAttendee() { + } + @Required private String document; @@ -41,34 +46,74 @@ public boolean equals(Object obj) { return this.document != null && this.document.equals(that.document); } + /** + * Gets the document type of the attendee. + * + * @return the document type + */ public KondutoEventTicketAttendeeDocumentType getDocumentType() { return documentType; } + /** + * Sets the document type of the attendee. + * + * @param documentType the document type + */ public void setDocumentType(KondutoEventTicketAttendeeDocumentType documentType) { this.documentType = documentType; } + /** + * Gets the date of birth of the attendee. + * + * @return the date of birth + */ public String getDateOfBirth() { return dateOfBirth; } + /** + * Sets the date of birth of the attendee. + * + * @param dateOfBirth the date of birth + */ public void setDateOfBirth(String dateOfBirth) { this.dateOfBirth = dateOfBirth; } + /** + * Gets the document number of the attendee. + * + * @return the document number + */ public String getDocument() { return document; } + /** + * Sets the document number of the attendee. + * + * @param document the document number + */ public void setDocument(String document) { this.document = document; } + /** + * Gets the name of the attendee. + * + * @return the attendee name + */ public String getName() { return name; } + /** + * Sets the name of the attendee. + * + * @param name the attendee name + */ public void setName(String name) { this.name = name; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendeeDocumentType.java b/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendeeDocumentType.java index 2713951..1deab45 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendeeDocumentType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventTicketAttendeeDocumentType.java @@ -8,14 +8,19 @@ * @see Konduto API Spec */ public enum KondutoEventTicketAttendeeDocumentType { + /** CPF (Brazilian individual taxpayer ID) */ @SerializedName("cpf") CPF, + /** CNPJ (Brazilian corporate taxpayer ID) */ @SerializedName("cnpj") CNPJ, + /** RG (Brazilian national ID card) */ @SerializedName("rg") RG, + /** Passport */ @SerializedName("passport") PASSPORT, + /** Other document type */ @SerializedName("other") OTHER } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventTicketCategory.java b/src/main/java/com/konduto/sdk/models/KondutoEventTicketCategory.java index a2786d8..f69f81f 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventTicketCategory.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventTicketCategory.java @@ -10,14 +10,19 @@ * @see Konduto API Spec */ public enum KondutoEventTicketCategory { + /** Student ticket category */ @SerializedName("student") STUDENT, + /** Senior citizen ticket category */ @SerializedName("senior") SENIOR, + /** Government employee ticket category */ @SerializedName("government") GOVERNMENT, + /** Social program ticket category */ @SerializedName("social") SOCIAL, + /** Regular ticket category */ @SerializedName("regular") REGULAR } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventType.java b/src/main/java/com/konduto/sdk/models/KondutoEventType.java index db5b010..1015fc1 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventType.java @@ -8,20 +8,28 @@ * @see Konduto API Spec */ public enum KondutoEventType { + /** Show event type */ @SerializedName("show") SHOW, + /** Theater event type */ @SerializedName("theater") THEATER, + /** Movies event type */ @SerializedName("movies") MOVIES, + /** Party event type */ @SerializedName("party") PARTY, + /** Festival event type */ @SerializedName("festival") FESTIVAL, + /** Course event type */ @SerializedName("course") COURSE, + /** Sports event type */ @SerializedName("sports") SPORTS, + /** Corporate event type */ @SerializedName("corporate") CORPORATE } diff --git a/src/main/java/com/konduto/sdk/models/KondutoEventVenue.java b/src/main/java/com/konduto/sdk/models/KondutoEventVenue.java index db71d29..4ec2a53 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoEventVenue.java +++ b/src/main/java/com/konduto/sdk/models/KondutoEventVenue.java @@ -9,6 +9,12 @@ */ public class KondutoEventVenue extends KondutoModel { + /** + * Default constructor. + */ + public KondutoEventVenue() { + } + private String name; private Integer capacity; @@ -47,50 +53,98 @@ public boolean equals(Object o) { country != null && country.equals(that.country); } + /** + * Gets the capacity. + * @return the capacity + */ public Integer getCapacity() { return capacity; } + /** + * Sets the capacity. + * @param capacity the capacity + */ public void setCapacity(Integer capacity) { this.capacity = capacity; } + /** + * Gets the name. + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * @param name the name + */ public void setName(String name) { this.name = name; } + /** + * Gets the address. + * @return the address + */ public String getAddress() { return address; } + /** + * Sets the address. + * @param address the address + */ public void setAddress(String address) { this.address = address; } + /** + * Gets the city. + * @return the city + */ public String getCity() { return city; } + /** + * Sets the city. + * @param city the city + */ public void setCity(String city) { this.city = city; } + /** + * Gets the state. + * @return the state + */ public String getState() { return state; } + /** + * Sets the state. + * @param state the state + */ public void setState(String state) { this.state = state; } + /** + * Gets the country. + * @return the country + */ public String getCountry() { return country; } + /** + * Sets the country. + * @param country the country + */ public void setCountry(String country) { this.country = country; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoExternalDevice.java b/src/main/java/com/konduto/sdk/models/KondutoExternalDevice.java index 39a4fdc..eba48f6 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoExternalDevice.java +++ b/src/main/java/com/konduto/sdk/models/KondutoExternalDevice.java @@ -18,6 +18,9 @@ public class KondutoExternalDevice extends KondutoModel { private String browser; private String language; + /** + * Default constructor. + */ public KondutoExternalDevice(){} /* Equals */ @@ -49,74 +52,146 @@ public int hashCode() { /* Getters and Setters */ + /** + * Gets the fingerprint. + * @return the fingerprint + */ public String getFingerprint() { return fingerprint; } + /** + * Sets the fingerprint. + * @param fingerprint the fingerprint + */ public void setFingerprint(String fingerprint) { this.fingerprint = fingerprint; } + /** + * Gets the platform. + * @return the platform + */ public String getPlatform() { return platform; } + /** + * Sets the platform. + * @param platform the platform + */ public void setPlatform(String platform) { this.platform = platform; } + /** + * Gets the browser. + * @return the browser + */ public String getBrowser() { return browser; } + /** + * Sets the browser. + * @param browser the browser + */ public void setBrowser(String browser) { this.browser = browser; } + /** + * Gets the language. + * @return the language + */ public String getLanguage() { return language; } + /** + * Sets the language. + * @param language the language + */ public void setLanguage(String language) { this.language = language; } + /** + * Gets the provider. + * @return the provider + */ public String getProvider() { return provider; } + /** + * Sets the provider. + * @param provider the provider + */ public void setProvider(String provider) { this.provider = provider; } + /** + * Gets the category. + * @return the category + */ public String getCategory() { return category; } + /** + * Sets the category. + * @param category the category + */ public void setCategory(String category) { this.category = category; } + /** + * Gets the model. + * @return the model + */ public String getModel() { return model; } + /** + * Sets the model. + * @param model the model + */ public void setModel(String model) { this.model = model; } + /** + * Gets the manufacturer. + * @return the manufacturer + */ public String getManufacturer() { return manufacturer; } + /** + * Sets the manufacturer. + * @param manufacturer the manufacturer + */ public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; } + /** + * Gets the OS. + * @return the OS + */ public String getOs() { return os; } + /** + * Sets the OS. + * @param os the OS + */ public void setOs(String os) { this.os = os; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoFlightTravelLeg.java b/src/main/java/com/konduto/sdk/models/KondutoFlightTravelLeg.java index 352afaf..5730097 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoFlightTravelLeg.java +++ b/src/main/java/com/konduto/sdk/models/KondutoFlightTravelLeg.java @@ -8,6 +8,13 @@ * @see Konduto API Spec */ public class KondutoFlightTravelLeg extends KondutoTravelLeg { + + /** + * Default constructor. + */ + public KondutoFlightTravelLeg() { + } + @ValidateFormat(format = "[A-Z]{3}") @Required private String originAirport; @@ -55,34 +62,66 @@ public int hashCode() { return result; } + /** + * Gets the origin airport. + * @return the origin airport + */ public String getOriginAirport() { return originAirport; } + /** + * Sets the origin airport. + * @param originAirport the origin airport + */ public void setOriginAirport(String originAirport) { this.originAirport = originAirport; } + /** + * Gets the destination airport. + * @return the destination airport + */ public String getDestinationAirport() { return destinationAirport; } + /** + * Sets the destination airport. + * @param destinationAirport the destination airport + */ public void setDestinationAirport(String destinationAirport) { this.destinationAirport = destinationAirport; } + /** + * Gets the origin city. + * @return the origin city + */ public String getOriginCity() { return originCity; } + /** + * Sets the origin city. + * @param originCity the origin city + */ public void setOriginCity(String originCity) { this.originCity = originCity; } + /** + * Gets the destination city. + * @return the destination city + */ public String getDestinationCity() { return destinationCity; } + /** + * Sets the destination city. + * @param destinationCity the destination city + */ public void setDestinationCity(String destinationCity) { this.destinationCity = destinationCity; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoGeolocation.java b/src/main/java/com/konduto/sdk/models/KondutoGeolocation.java index c3367e0..6d2b756 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoGeolocation.java +++ b/src/main/java/com/konduto/sdk/models/KondutoGeolocation.java @@ -1,8 +1,8 @@ package com.konduto.sdk.models; /** - * - * Geolocation model. + * Represents geolocation information in the Konduto system. + * This class extends KondutoModel and contains location attributes such as city, state, and country. * * @see Konduto API Spec */ @@ -14,6 +14,9 @@ public class KondutoGeolocation extends KondutoModel { String country; /* Constructors */ + /** + * Default constructor. + */ public KondutoGeolocation() { } /* Equals */ @@ -32,26 +35,50 @@ public boolean equals(Object o) { } /* Getters and Setters */ + /** + * Gets the country. + * @return the country + */ public String getCountry() { return country; } + /** + * Sets the country. + * @param country the country + */ public void setCountry(String country) { this.country = country; } + /** + * Gets the city. + * @return the city + */ public String getCity() { return city; } + /** + * Sets the city. + * @param city the city + */ public void setCity(String city) { this.city = city; } + /** + * Gets the state. + * @return the state + */ public String getState() { return state; } + /** + * Sets the state. + * @param state the state + */ public void setState(String state) { this.state = state; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoGuest.java b/src/main/java/com/konduto/sdk/models/KondutoGuest.java index 7ae202e..4904bd5 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoGuest.java +++ b/src/main/java/com/konduto/sdk/models/KondutoGuest.java @@ -43,47 +43,90 @@ public int hashCode() { private Date dob; private String nationality; + /** + * Default constructor. + */ public KondutoGuest(){} /* Equals */ /* Getters and Setters */ + /** + * Gets the name. + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * @param name the name + */ public void setName(String name) { this.name = name; } + /** + * Gets the document. + * @return the document + */ public String getDocument() { return document; } + /** + * Sets the document. + * @param document the document + */ public void setDocument(String document) { this.document = document; } + /** + * Gets the document type. + * @return the document type + */ public KondutoGuestDocumentType getDocumentType() { return documentType; } + /** + * Sets the document type. + * @param documentType the document type + */ public void setDocumentType(KondutoGuestDocumentType documentType) { this.documentType = documentType; } + /** + * Gets the date of birth. + * @return the date of birth + */ public Date getDob() { return dob; } + /** + * Sets the date of birth. + * @param dob the date of birth + */ public void setDob(Date dob) { this.dob = dob; } + /** + * Gets the nationality. + * @return the nationality + */ public String getNationality() { return nationality; } + /** + * Sets the nationality. + * @param nationality the nationality + */ public void setNationality(String nationality) { this.nationality = nationality; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoGuestDocumentType.java b/src/main/java/com/konduto/sdk/models/KondutoGuestDocumentType.java index f2ae963..7d50402 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoGuestDocumentType.java +++ b/src/main/java/com/konduto/sdk/models/KondutoGuestDocumentType.java @@ -3,17 +3,34 @@ import com.google.gson.annotations.SerializedName; /** - * Created by andrealves on 11/22/16. + * Enum representing different types of guest documents. + * + * @see Konduto API Spec */ public enum KondutoGuestDocumentType { + /** + * ID document. + */ @SerializedName("id") ID, + /** + * Passport document. + */ @SerializedName("passport") PASSPORT, + /** + * RG (Registro Geral) document. + */ @SerializedName("rg") RG, + /** + * CPF (Cadastro de Pessoas Físicas) document. + */ @SerializedName("cpf") CPF, + /** + * Other type of document. + */ @SerializedName("other") other } \ No newline at end of file diff --git a/src/main/java/com/konduto/sdk/models/KondutoHotel.java b/src/main/java/com/konduto/sdk/models/KondutoHotel.java index fad5ae1..d7fe474 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoHotel.java +++ b/src/main/java/com/konduto/sdk/models/KondutoHotel.java @@ -1,14 +1,12 @@ package com.konduto.sdk.models; -import com.google.gson.annotations.SerializedName; import java.util.Collection; /** - * - * Device model. + * Represents a hotel booking in the Konduto system. + * This class extends KondutoModel and contains hotel-specific attributes. * * @see Konduto API Spec - * */ public class KondutoHotel extends KondutoModel { @@ -23,6 +21,9 @@ public class KondutoHotel extends KondutoModel { private Collection rooms; + /** + * Default constructor. + */ public KondutoHotel(){} /* Equals */ @@ -60,74 +61,146 @@ public int hashCode() { } /* Getters and Setters */ + /** + * Gets the name. + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * @param name the name + */ public void setName(String name) { this.name = name; } + /** + * Gets the address1. + * @return the address1 + */ public String getAddress1() { return address1; } + /** + * Sets the address1. + * @param address1 the address1 + */ public void setAddress1(String address1) { this.address1 = address1; } + /** + * Gets the address2. + * @return the address2 + */ public String getAddress2() { return address2; } + /** + * Sets the address2. + * @param address2 the address2 + */ public void setAddress2(String address2) { this.address2 = address2; } + /** + * Gets the city. + * @return the city + */ public String getCity() { return city; } + /** + * Sets the city. + * @param city the city + */ public void setCity(String city) { this.city = city; } + /** + * Gets the state. + * @return the state + */ public String getState() { return state; } + /** + * Sets the state. + * @param state the state + */ public void setState(String state) { this.state = state; } + /** + * Gets the zip. + * @return the zip + */ public String getZip() { return zip; } + /** + * Sets the zip. + * @param zip the zip + */ public void setZip(String zip) { this.zip = zip; } + /** + * Gets the country. + * @return the country + */ public String getCountry() { return country; } + /** + * Sets the country. + * @param country the country + */ public void setCountry(String country) { this.country = country; } + /** + * Gets the category. + * @return the category + */ public String getCategory() { return category; } + /** + * Sets the category. + * @param category the category + */ public void setCategory(String category) { this.category = category; } + /** + * Gets the rooms. + * @return the rooms + */ public Collection getRooms() { return rooms; } + /** + * Sets the rooms. + * @param rooms the rooms + */ public void setRooms(Collection rooms) { this.rooms = rooms; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoHotelRoom.java b/src/main/java/com/konduto/sdk/models/KondutoHotelRoom.java index fa010a0..77000cd 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoHotelRoom.java +++ b/src/main/java/com/konduto/sdk/models/KondutoHotelRoom.java @@ -38,6 +38,9 @@ public class KondutoHotelRoom extends KondutoModel { private Collection guests; + /** + * Default constructor. + */ public KondutoHotelRoom(){} /* Equals */ @@ -90,66 +93,130 @@ String serializeDate(Date src) { } /* Getters and Setters */ + /** + * Gets the number. + * @return the number + */ public String getNumber() { return number; } + /** + * Sets the number. + * @param number the number + */ public void setNumber(String number) { this.number = number; } + /** + * Gets the code. + * @return the code + */ public String getCode() { return code; } + /** + * Sets the code. + * @param code the code + */ public void setCode(String code) { this.code = code; } + /** + * Gets the type. + * @return the type + */ public String getType() { return type; } + /** + * Sets the type. + * @param type the type + */ public void setType(String type) { this.type = type; } + /** + * Gets the checkin date. + * @return the checkin date + */ public Date getCheckinDate() { return deserializeDate(checkinDate); } + /** + * Sets the checkin date. + * @param checkinDate the checkin date + */ public void setCheckinDate(Date checkinDate) { this.checkinDate = serializeDate(checkinDate); } + /** + * Gets the checkout date. + * @return the checkout date + */ public Date getCheckoutDate() { return deserializeDate(checkoutDate); } + /** + * Sets the checkout date. + * @param checkoutDate the checkout date + */ public void setCheckoutDate(Date checkoutDate) { this.checkoutDate = serializeDate(checkoutDate); } + /** + * Gets the number of guests. + * @return the number of guests + */ public int getNumberOfGuests() { return numberOfGuests; } + /** + * Sets the number of guests. + * @param numberOfGuests the number of guests + */ public void setNumberOfGuests(int numberOfGuests) { this.numberOfGuests = numberOfGuests; } + /** + * Gets the board basis. + * @return the board basis + */ public String getBoardBasis() { return boardBasis; } + /** + * Sets the board basis. + * @param boardBasis the board basis + */ public void setBoardBasis(String boardBasis) { this.boardBasis = boardBasis; } + /** + * Gets the guests. + * @return the guests + */ public Collection getGuests() { return guests; } + /** + * Sets the guests. + * @param guests the guests + */ public void setGuests(Collection guests) { this.guests = guests; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoItem.java b/src/main/java/com/konduto/sdk/models/KondutoItem.java index 4b1094c..8acc66b 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoItem.java +++ b/src/main/java/com/konduto/sdk/models/KondutoItem.java @@ -20,6 +20,9 @@ public class KondutoItem extends KondutoModel { /* Constructors */ + /** + * Default constructor. + */ public KondutoItem(){} /** @@ -59,71 +62,147 @@ public boolean equals(Object o) { /* Getters and Setters */ + /** + * Gets the sku. + * @return the sku + */ public String getSku() { return sku; } + /** + * Sets the sku. + * @param sku the sku + */ public void setSku(String sku) { this.sku = sku; } + /** + * Gets the category. + * @return the category + */ public Integer getCategory() { return category; } + /** + * Sets the category. + * @param category the category + */ public void setCategory(Integer category) { this.category = category; } + /** + * Gets the name. + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * @param name the name + */ public void setName(String name) { this.name = name; } + /** + * Gets the description. + * @return the description + */ public String getDescription() { return description; } + /** + * Sets the description. + * @param description the description + */ public void setDescription(String description) { this.description = description; } + /** + * Gets the product code. + * @return the product code + */ public String getProductCode() { return productCode; } + /** + * Sets the product code. + * @param productCode the product code + */ public void setProductCode(String productCode) { this.productCode = productCode; } + /** + * Gets the unit cost. + * @return the unit cost + */ public Double getUnitCost() { return unitCost; } + /** + * Sets the unit cost. + * @param unitCost the unit cost + */ public void setUnitCost(Double unitCost) { this.unitCost = unitCost; } + /** + * Gets the quantity. + * @return the quantity + */ public Double getQuantity() { return quantity; } + /** + * Sets the quantity. + * @param quantity the quantity + */ + /** + * Sets the quantity. + * @param quantity the quantity + */ public void setQuantity(Double quantity) { this.quantity = quantity; } + /** + * Gets the discount. + * @return the discount + */ public Double getDiscount() { return discount; } + /** + * Sets the discount. + * @param discount the discount + */ public void setDiscount(Double discount) { this.discount = discount; } + /** + * Gets the created at. + * @return the created at + */ public Date getCreated_at() { return created_at; } + /** + * Sets the created at. + * @param created_at the created at + */ public void setCreated_at(Date created_at) { this.created_at = created_at; } } diff --git a/src/main/java/com/konduto/sdk/models/KondutoModel.java b/src/main/java/com/konduto/sdk/models/KondutoModel.java index c2f605e..6ef83b4 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoModel.java +++ b/src/main/java/com/konduto/sdk/models/KondutoModel.java @@ -41,6 +41,9 @@ * */ public abstract class KondutoModel { + /** + * Default constructor. + */ protected KondutoModel(){ } @Override @@ -56,6 +59,9 @@ protected KondutoModel(){ } private static Type bank = new TypeToken(){}.getType(); + /** + * The Gson instance used for JSON serialization and deserialization. + */ protected static Gson gson = new GsonBuilder() .registerTypeAdapter(paymentCollectionType, new KondutoPaymentCollectionDeserializer()) .registerTypeHierarchyAdapter(KondutoPayment.class, new KondutoPaymentSerializer()) @@ -69,6 +75,9 @@ protected KondutoModel(){ } .setDateFormat("yyyy-MM-dd") .create(); + /** + * The list of validation errors. + */ protected transient List errors = new ArrayList(); /* Serialization methods */ @@ -76,7 +85,7 @@ protected KondutoModel(){ } /** * Serializes a model instance to JSON. * @return a {@link com.google.gson.JsonObject} - * @throws KondutoInvalidEntityException + * @throws KondutoInvalidEntityException if the model instance is not valid */ public JsonObject toJSON() throws KondutoInvalidEntityException{ if(!this.isValid()) { throw new KondutoInvalidEntityException(this); } @@ -96,7 +105,8 @@ public static KondutoModel fromJSON(JsonObject json, Class klass){ /* Error printing methods */ /** - * @return {@link com.konduto.sdk.models.KondutoModel#errors errors} pretty printed. + * Gets the errors pretty printed. + * @return the errors pretty printed */ public String getErrors(){ StringBuilder errors = new StringBuilder(); @@ -141,6 +151,7 @@ private void addInvalidFormatError(Field field, Object value, String format) { } /** + * Adds an invalid error message to the errors list. * * @param errors a String containing a * {@link com.konduto.sdk.models.KondutoModel#errors KondutoModel instance errors} @@ -150,7 +161,8 @@ void addIsInvalidError(String errors) { } /** - * @return whether this KondutoModel instance is valid or not. + * Checks whether this KondutoModel instance is valid or not. + * @return whether this KondutoModel instance is valid or not */ /* Validation method */ public boolean isValid() { @@ -216,6 +228,12 @@ public static boolean equals(Object a, Object b) { return (a == b) || (a != null && a.equals(b)); } + /** + * Gets all fields from the class and its superclasses. + * @param fields the list to add fields to + * @param type the class type + * @return the list of fields + */ public static List getAllFields(List fields, Class type) { fields.addAll(Arrays.asList(type.getDeclaredFields())); @@ -231,18 +249,21 @@ public static List getAllFields(List fields, Class type) { * * @param attributes a {@link HashMap} containing attributes. For a field 'totalAmount' with type Long, we should * add the following entry to the map: 'totalAmount', 123L. + * @param klass the class type to instantiate + * @return an instance of KondutoModel (e.g a KondutoAddress if klass is {@code KondutoAddress.class}) */ public static KondutoModel fromMap(Map attributes, Class klass){ KondutoModel model; - try { - model = (KondutoModel) klass.newInstance(); + model = (KondutoModel) klass.getDeclaredConstructor().newInstance(); } catch (InstantiationException e) { e.printStackTrace(); throw new RuntimeException("could not instantiate an object of " + klass); } catch (IllegalAccessException e) { throw new RuntimeException("constructor is not accessible in " + klass); + } catch (Exception e) { + throw new RuntimeException("could not instantiate an object of " + klass, e); } @@ -333,6 +354,12 @@ public KondutoModel with(String attributeName, Object attributeValue){ return this; } + /** + * Checks if two dates are equal, handling null values. + * @param one the first date + * @param two the second date + * @return true if both are null or equal, false otherwise + */ protected boolean nullSafeAreDatesEqual(Date one, Date two){ return (one == null && two == null) || ((one != null && two != null) && one.compareTo(two) == 0); diff --git a/src/main/java/com/konduto/sdk/models/KondutoNavigationInfo.java b/src/main/java/com/konduto/sdk/models/KondutoNavigationInfo.java index 394ba7e..20d37e1 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoNavigationInfo.java +++ b/src/main/java/com/konduto/sdk/models/KondutoNavigationInfo.java @@ -3,11 +3,10 @@ import com.google.gson.annotations.SerializedName; /** - * - * Navigation info model. + * Represents navigation information in the Konduto system. + * This class extends KondutoModel and contains navigation-related attributes such as session times and page views. * * @see Konduto API Spec - * */ public class KondutoNavigationInfo extends KondutoModel { @@ -98,46 +97,90 @@ public boolean equals(Object o) { /* Getters and Setters */ + /** + * Gets the session time. + * @return the session time + */ public Double getSessionTime() { return sessionTime; } + /** + * Sets the session time. + * @param sessionTime the session time + */ public void setSessionTime(Double sessionTime) { this.sessionTime = sessionTime; } + /** + * Gets the referrer. + * @return the referrer + */ public String getReferrer() { return referrer; } + /** + * Sets the referrer. + * @param referrer the referrer + */ public void setReferrer(String referrer) { this.referrer = referrer; } + /** + * Gets the time on site today. + * @return the time on site today + */ public Double getTimeOnSiteToday() { return timeOnSiteToday; } + /** + * Sets the time on site today. + * @param timeOnSiteToday the time on site today + */ public void setTimeOnSiteToday(Double timeOnSiteToday) { this.timeOnSiteToday = timeOnSiteToday; } + /** + * Gets the accounts created today. + * @return the accounts created today + */ public Integer getAccountsCreatedToday() { return accountsCreatedToday; } + /** + * Sets the accounts created today. + * @param accountsCreatedToday the accounts created today + */ public void setAccountsCreatedToday(Integer accountsCreatedToday) { this.accountsCreatedToday = accountsCreatedToday; } + /** + * Gets the password resets today. + * @return the password resets today + */ public Integer getPasswordResetsToday() { return passwordResetsToday; } + /** + * Sets the password resets today. + * @param passwordResetsToday the password resets today + */ public void setPasswordResetsToday(Integer passwordResetsToday) { this.passwordResetsToday = passwordResetsToday; } + /** + * Gets the sales declined today. + * @return the sales declined today + */ public Integer getSalesDeclinedToday() { return salesDeclinedToday; } @@ -146,6 +189,10 @@ public void setSalesDeclinedToday(Integer salesDeclinedToday) { this.salesDeclinedToday = salesDeclinedToday; } + /** + * Gets the sessions today. + * @return the sessions today + */ public Integer getSessionsToday() { return sessionsToday; } @@ -154,6 +201,10 @@ public void setSessionsToday(Integer sessionsToday) { this.sessionsToday = sessionsToday; } + /** + * Gets the time on site since last week. + * @return the time on site since last week + */ public Double getTimeOnSiteSinceLastWeek() { return timeOnSiteSinceLastWeek; } @@ -162,6 +213,10 @@ public void setTimeOnSiteSinceLastWeek(Double timeOnSiteSinceLastWeek) { this.timeOnSiteSinceLastWeek = timeOnSiteSinceLastWeek; } + /** + * Gets the accounts created since last week. + * @return the accounts created since last week + */ public Integer getAccountsCreatedSinceLastWeek() { return accountsCreatedSinceLastWeek; } @@ -170,50 +225,98 @@ public void setAccountsCreatedSinceLastWeek(Integer accountsCreatedSinceLastWeek this.accountsCreatedSinceLastWeek = accountsCreatedSinceLastWeek; } + /** + * Gets the time per page since last week. + * @return the time per page since last week + */ public Double getTimePerPageSinceLastWeek() { return timePerPageSinceLastWeek; } + /** + * Sets the time per page since last week. + * @param timePerPageSinceLastWeek the time per page since last week + */ public void setTimePerPageSinceLastWeek(Double timePerPageSinceLastWeek) { this.timePerPageSinceLastWeek = timePerPageSinceLastWeek; } + /** + * Gets the password resets since last week. + * @return the password resets since last week + */ public Integer getPasswordResetsSinceLastWeek() { return passwordResetsSinceLastWeek; } + /** + * Sets the password resets since last week. + * @param passwordResetsSinceLastWeek the password resets since last week + */ public void setPasswordResetsSinceLastWeek(Integer passwordResetsSinceLastWeek) { this.passwordResetsSinceLastWeek = passwordResetsSinceLastWeek; } + /** + * Gets the checkout page views since last week. + * @return the checkout page views since last week + */ public Integer getCheckoutPageViewsSinceLastWeek() { return checkoutPageViewsSinceLastWeek; } + /** + * Sets the checkout page views since last week. + * @param checkoutPageViewsSinceLastWeek the checkout page views since last week + */ public void setCheckoutPageViewsSinceLastWeek(Integer checkoutPageViewsSinceLastWeek) { this.checkoutPageViewsSinceLastWeek = checkoutPageViewsSinceLastWeek; } + /** + * Gets the sales declined since last week. + * @return the sales declined since last week + */ public Integer getSalesDeclinedSinceLastWeek() { return salesDeclinedSinceLastWeek; } + /** + * Sets the sales declined since last week. + * @param salesDeclinedSinceLastWeek the sales declined since last week + */ public void setSalesDeclinedSinceLastWeek(Integer salesDeclinedSinceLastWeek) { this.salesDeclinedSinceLastWeek = salesDeclinedSinceLastWeek; } + /** + * Gets the sessions since last week. + * @return the sessions since last week + */ public Integer getSessionsSinceLastWeek() { return sessionsSinceLastWeek; } + /** + * Sets the sessions since last week. + * @param sessionsSinceLastWeek the sessions since last week + */ public void setSessionsSinceLastWeek(Integer sessionsSinceLastWeek) { this.sessionsSinceLastWeek = sessionsSinceLastWeek; } + /** + * Gets the time since last sale. + * @return the time since last sale + */ public Double getTimeSinceLastSale() { return timeSinceLastSale; } + /** + * Sets the time since last sale. + * @param timeSinceLastSale the time since last sale + */ public void setTimeSinceLastSale(Double timeSinceLastSale) { this.timeSinceLastSale = timeSinceLastSale; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoOption.java b/src/main/java/com/konduto/sdk/models/KondutoOption.java index 14689bf..ea6c385 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoOption.java +++ b/src/main/java/com/konduto/sdk/models/KondutoOption.java @@ -3,11 +3,10 @@ import com.google.gson.annotations.SerializedName; /** - * - * Device model. + * Represents an option in the Konduto system. + * This class extends KondutoModel and contains option-specific attributes. * * @see Konduto API Spec - * */ public class KondutoOption extends KondutoModel { @@ -17,6 +16,9 @@ public class KondutoOption extends KondutoModel { @SerializedName("sales_channel") private KondutoSalesChannel salesChannel; + /** + * Default constructor. + */ public KondutoOption(){} /* Equals */ @@ -40,18 +42,34 @@ public int hashCode() { } /* Getters and Setters */ + /** + * Gets the real time flag. + * @return the real time flag + */ public boolean getRealTime() { return realTime; } + /** + * Sets the real time flag. + * @param realTime the real time flag + */ public void setRealTime(boolean realTime) { this.realTime = realTime; } + /** + * Gets the sales channel. + * @return the sales channel + */ public KondutoSalesChannel getSalesChannel() { return salesChannel; } + /** + * Sets the sales channel. + * @param salesChannel the sales channel + */ public void setSalesChannel(KondutoSalesChannel salesChannel) { this.salesChannel = salesChannel; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoOrder.java b/src/main/java/com/konduto/sdk/models/KondutoOrder.java index 13d0421..88d91cf 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoOrder.java +++ b/src/main/java/com/konduto/sdk/models/KondutoOrder.java @@ -8,11 +8,10 @@ import java.util.List; /** - * - * Order model. + * Represents an order in the Konduto system. + * This class extends KondutoModel and contains all order-related attributes including customer, payments, and items. * * @see Konduto API Spec - * */ public final class KondutoOrder extends KondutoModel { /* Attributes */ @@ -112,6 +111,9 @@ public final class KondutoOrder extends KondutoModel { private KondutoTenant tenant; /* Constructors */ + /** + * Default constructor. + */ public KondutoOrder() {} /** @@ -206,72 +208,156 @@ public boolean equals(Object o) { } /** getters and setters **/ + /** + * Gets the navigation info. + * @return the navigation info + */ public KondutoNavigationInfo getNavigationInfo() { return navigationInfo; } public void setNavigationInfo(KondutoNavigationInfo navigationInfo) { this.navigationInfo = navigationInfo; } + /** + * Gets the device. + * @return the device + */ public KondutoDevice getDevice() { return device; } + /** + * Sets the device. + * @param device the device + */ public void setDevice(KondutoDevice device) { this.device = device; } + /** + * Gets the external device. + * @return the external device + */ public KondutoExternalDevice getExternalDevice() { return externalDevice; } + /** + * Sets the external device. + * @param externalDevice the external device + */ public void setExternalDevice(KondutoExternalDevice externalDevice) { this.externalDevice = externalDevice; } + /** + * Gets the shopping cart. + * @return the shopping cart + */ public Collection getShoppingCart() { return shoppingCart; } + /** + * Sets the shopping cart. + * @param shoppingCart the shopping cart + */ public void setShoppingCart(Collection shoppingCart) { this.shoppingCart = shoppingCart; } + /** + * Gets the payments. + * @return the payments + */ public Collection getPayments() { return payments; } + /** + * Sets the payments. + * @param payments the payments + */ public void setPayments(Collection payments) { this.payments = payments; } + /** + * Gets the status. + * @return the status + */ public KondutoOrderStatus getStatus() { return status; } + /** + * Sets the status. + * @param status the status + */ public void setStatus(KondutoOrderStatus status) { this.status = status; } + /** + * Gets the geolocation. + * @return the geolocation + */ public KondutoGeolocation getGeolocation() { return geolocation; } + /** + * Sets the geolocation. + * @param geolocation the geolocation + */ public void setGeolocation(KondutoGeolocation geolocation) { this.geolocation = geolocation; } + /** + * Gets the shipping address. + * @return the shipping address + */ public KondutoAddress getShippingAddress() { return shippingAddress; } + /** + * Sets the shipping address. + * @param shippingAddress the shipping address + */ public void setShippingAddress(KondutoAddress shippingAddress) { this.shippingAddress = shippingAddress; } + /** + * Gets the billing address. + * @return the billing address + */ public KondutoAddress getBillingAddress() { return billingAddress; } + /** + * Sets the billing address. + * @param billingAddress the billing address + */ public void setBillingAddress(KondutoAddress billingAddress) { this.billingAddress = billingAddress; } + /** + * Gets the recommendation. + * @return the recommendation + */ public KondutoRecommendation getRecommendation() { return recommendation; } + /** + * Gets the score. + * @return the score + */ public Double getScore() { return score; } + /** + * Gets the id. + * @return the id + */ public String getId() { return id; } + /** + * Sets the id. + * @param id the id + */ public void setId(String id) { this.id = id; } @@ -418,6 +504,10 @@ public KondutoPointOfSale getPointOfSale() { public void setPointOfSale(KondutoPointOfSale pointOfSale){ this.pointOfSale = pointOfSale; } + /** + * Gets the agent. + * @return the agent + */ public KondutoAgentSeller getAgent() { return agent; } diff --git a/src/main/java/com/konduto/sdk/models/KondutoPayment.java b/src/main/java/com/konduto/sdk/models/KondutoPayment.java index 0dbdfc0..33e61d8 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoPayment.java +++ b/src/main/java/com/konduto/sdk/models/KondutoPayment.java @@ -1,11 +1,10 @@ package com.konduto.sdk.models; /** - * - * Payment model. + * Abstract base class for all payment types in the Konduto system. + * This class extends KondutoModel and provides common payment attributes such as description and amount. * * @see Konduto API Spec - * */ public abstract class KondutoPayment extends KondutoModel { @@ -23,6 +22,11 @@ public KondutoPayment with(String attributeName, Object attributeValue) { return (KondutoPayment) super.with(attributeName, attributeValue); } + /** + * Gets the payment type for this payment method. + * + * @return the payment type + */ abstract public KondutoPaymentType getType(); @Override diff --git a/src/main/java/com/konduto/sdk/models/KondutoPointOfSale.java b/src/main/java/com/konduto/sdk/models/KondutoPointOfSale.java index bae3a76..4f11c73 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoPointOfSale.java +++ b/src/main/java/com/konduto/sdk/models/KondutoPointOfSale.java @@ -4,8 +4,8 @@ import com.konduto.sdk.annotations.Required; /** - * Created by igor.rodrigues (nickname: igor.francesco) 02/06/2022. - * Point of Sale model. + * Represents a point of sale in the Konduto system. + * This class extends KondutoModel and contains point of sale specific attributes. * * @see Konduto API Spec */ diff --git a/src/main/java/com/konduto/sdk/models/KondutoSeller.java b/src/main/java/com/konduto/sdk/models/KondutoSeller.java index 17494c4..f64c5cb 100644 --- a/src/main/java/com/konduto/sdk/models/KondutoSeller.java +++ b/src/main/java/com/konduto/sdk/models/KondutoSeller.java @@ -6,8 +6,8 @@ import java.util.Date; /** - * - * Seller model. + * Represents a seller in the Konduto system. + * This class extends KondutoModel and contains seller-specific attributes. * * @see Konduto API Spec */ diff --git a/src/test/java/com/konduto/sdk/KondutoTest.java b/src/test/java/com/konduto/sdk/KondutoTest.java index 6f23d9c..2f485c1 100644 --- a/src/test/java/com/konduto/sdk/KondutoTest.java +++ b/src/test/java/com/konduto/sdk/KondutoTest.java @@ -13,8 +13,6 @@ import org.junit.Test; import java.net.URI; -import java.util.Arrays; -import java.util.List; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.junit.Assert.*; diff --git a/src/test/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializerTest.java b/src/test/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializerTest.java index 1e522db..f4d9ca8 100644 --- a/src/test/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializerTest.java +++ b/src/test/java/com/konduto/sdk/adapters/KondutoCreditCardPaymentSerializerTest.java @@ -5,7 +5,7 @@ import com.konduto.sdk.models.KondutoCreditCardPayment; import org.junit.Test; -import java.math.BigDecimal; +import java.math.RoundingMode; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -28,7 +28,7 @@ public void testSerialize() throws Exception { assertEquals(paymentAsJSON.get("description").getAsString(), creditCardPayment.getDescription()); assertEquals(paymentAsJSON.get("amount").getAsBigDecimal().setScale(2 - , BigDecimal.ROUND_HALF_UP).doubleValue(), + , RoundingMode.HALF_UP).doubleValue(), creditCardPayment.getAmount() , 0.00001); } diff --git a/src/test/java/com/konduto/sdk/factories/KondutoBankDestinationAccountFactory.java b/src/test/java/com/konduto/sdk/factories/KondutoBankDestinationAccountFactory.java index 0abab26..1e6c326 100644 --- a/src/test/java/com/konduto/sdk/factories/KondutoBankDestinationAccountFactory.java +++ b/src/test/java/com/konduto/sdk/factories/KondutoBankDestinationAccountFactory.java @@ -4,7 +4,6 @@ import com.konduto.sdk.models.KondutoBankDocumentType; import java.util.ArrayList; -import java.util.Collection; import java.util.List; /** diff --git a/src/test/java/com/konduto/sdk/factories/KondutoHotelFactory.java b/src/test/java/com/konduto/sdk/factories/KondutoHotelFactory.java index 4861989..a997152 100644 --- a/src/test/java/com/konduto/sdk/factories/KondutoHotelFactory.java +++ b/src/test/java/com/konduto/sdk/factories/KondutoHotelFactory.java @@ -8,7 +8,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Collection; import java.util.Date; /** diff --git a/src/test/java/com/konduto/sdk/factories/KondutoTenantFactory.java b/src/test/java/com/konduto/sdk/factories/KondutoTenantFactory.java index 9ca15f3..0d1af1c 100644 --- a/src/test/java/com/konduto/sdk/factories/KondutoTenantFactory.java +++ b/src/test/java/com/konduto/sdk/factories/KondutoTenantFactory.java @@ -3,8 +3,6 @@ import com.konduto.sdk.DateFormat; import com.konduto.sdk.models.KondutoTenant; -import java.util.Date; - import static com.konduto.sdk.utils.TestUtils.getDateFrom; public class KondutoTenantFactory { diff --git a/src/test/java/com/konduto/sdk/models/KondutoBankDestinationAccountTest.java b/src/test/java/com/konduto/sdk/models/KondutoBankDestinationAccountTest.java index 2e7a6a0..d26aced 100644 --- a/src/test/java/com/konduto/sdk/models/KondutoBankDestinationAccountTest.java +++ b/src/test/java/com/konduto/sdk/models/KondutoBankDestinationAccountTest.java @@ -5,7 +5,6 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.reflect.TypeToken; -import com.konduto.sdk.adapters.KondutoBankAdapter; import com.konduto.sdk.adapters.KondutoBankDestinationAccountAdapter; import com.konduto.sdk.factories.KondutoBankDestinationAccountFactory; import com.konduto.sdk.utils.TestUtils; diff --git a/src/test/java/com/konduto/sdk/models/KondutoBureauQueryTest.java b/src/test/java/com/konduto/sdk/models/KondutoBureauQueryTest.java index 7d30377..9167565 100644 --- a/src/test/java/com/konduto/sdk/models/KondutoBureauQueryTest.java +++ b/src/test/java/com/konduto/sdk/models/KondutoBureauQueryTest.java @@ -7,7 +7,6 @@ import static org.junit.Assert.*; public class KondutoBureauQueryTest { - private JsonParser jsonParser = new JsonParser(); private static final String BUREAU_QUERY_AS_JSON_STRING = "{" + "\"service\": \"emailage\"," + @@ -17,7 +16,7 @@ public class KondutoBureauQueryTest { "}" + "}"; private JsonObject bureauQueryAsJsonObject = - (JsonObject) jsonParser.parse(BUREAU_QUERY_AS_JSON_STRING); + (JsonObject) JsonParser.parseString(BUREAU_QUERY_AS_JSON_STRING); @Test public void testBureauQueryDeserialization() { diff --git a/src/test/java/com/konduto/sdk/models/KondutoHotelTest.java b/src/test/java/com/konduto/sdk/models/KondutoHotelTest.java index fdeec64..9a22d3a 100644 --- a/src/test/java/com/konduto/sdk/models/KondutoHotelTest.java +++ b/src/test/java/com/konduto/sdk/models/KondutoHotelTest.java @@ -8,7 +8,6 @@ import java.text.ParseException; -import static org.junit.Assert.fail; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; diff --git a/src/test/java/com/konduto/sdk/models/KondutoModelTest.java b/src/test/java/com/konduto/sdk/models/KondutoModelTest.java index d82d13c..e12f53a 100644 --- a/src/test/java/com/konduto/sdk/models/KondutoModelTest.java +++ b/src/test/java/com/konduto/sdk/models/KondutoModelTest.java @@ -76,11 +76,15 @@ public void hashMapFactoryTest() { map.put("email", "raphael@konduto.com"); map.put("id", "1234"); - KondutoCustomer c = (KondutoCustomer) KondutoModel.fromMap(map, KondutoCustomer.class); + try { + KondutoCustomer c = (KondutoCustomer) KondutoModel.fromMap(map, KondutoCustomer.class); - assertEquals("map constructor did not work", "Raphael", c.getName()); - assertEquals("map constructor did not work", "raphael@konduto.com", c.getEmail()); - assertEquals("map constructor did not work", "1234", c.getId()); + assertEquals("map constructor did not work", "Raphael", c.getName()); + assertEquals("map constructor did not work", "raphael@konduto.com", c.getEmail()); + assertEquals("map constructor did not work", "1234", c.getId()); + } catch (Exception e) { + fail("fromMap should not throw exception for valid data"); + } } @Test diff --git a/src/test/java/com/konduto/sdk/utils/TestUtils.java b/src/test/java/com/konduto/sdk/utils/TestUtils.java index b893bbd..1488603 100644 --- a/src/test/java/com/konduto/sdk/utils/TestUtils.java +++ b/src/test/java/com/konduto/sdk/utils/TestUtils.java @@ -24,8 +24,7 @@ public static JsonElement readJSONFromFile(String resourceName) { URI uri = resource.toURI(); byte[] bytes = readAllBytes(uri); String jsonString = new String(bytes, "UTF-8"); - JsonParser parser = new JsonParser(); - return parser.parse(jsonString); + return JsonParser.parseString(jsonString); } else { throw new IllegalArgumentException(resourceName + " is an invalid resource name"); }