diff --git a/MiA-SDK/build.gradle b/MiA-SDK/build.gradle new file mode 100644 index 0000000..9b33651 --- /dev/null +++ b/MiA-SDK/build.gradle @@ -0,0 +1,27 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + ext.kotlin_version = '1.3.11' + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/MiA-SDK/gradle.properties b/MiA-SDK/gradle.properties new file mode 100644 index 0000000..743d692 --- /dev/null +++ b/MiA-SDK/gradle.properties @@ -0,0 +1,13 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/MiA-SDK/gradle/wrapper/gradle-wrapper.jar b/MiA-SDK/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..7a3265e Binary files /dev/null and b/MiA-SDK/gradle/wrapper/gradle-wrapper.jar differ diff --git a/MiA-SDK/gradle/wrapper/gradle-wrapper.properties b/MiA-SDK/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..bdd834a --- /dev/null +++ b/MiA-SDK/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 17 16:47:20 EET 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/MiA-SDK/gradlew b/MiA-SDK/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/MiA-SDK/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# 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 +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="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; +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" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +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. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +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 +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 + +# 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\"" + fi + i=$((i+1)) + 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")" +fi + +exec "$JAVACMD" "$@" diff --git a/MiA-SDK/gradlew.bat b/MiA-SDK/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/MiA-SDK/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/MiA-SDK/mia/build.gradle b/MiA-SDK/mia/build.gradle new file mode 100644 index 0000000..c0f3b0c --- /dev/null +++ b/MiA-SDK/mia/build.gradle @@ -0,0 +1,79 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + //plugin for POM file + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' + //plugin for kotlin documentation + classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17" + //plugin for test coverage report + classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' + //plant uml diagrams generator + classpath 'be.jlr-home.gradle:plantumlPlugin:0.1.+' + //bintray plugin + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + } +} +apply plugin: 'com.android.library' + +apply plugin: 'kotlin-android' + +apply plugin: 'kotlin-android-extensions' + +apply plugin: 'org.jetbrains.dokka-android' + +apply plugin: 'com.github.dcendents.android-maven' + + + +//helper gradle tasks +apply from: 'coverage_report.gradle' + +apply from: 'util_closures.gradle' +apply from: 'build_tasks.gradle' +apply from: 'dokka_kotlin.gradle' + + +android { + compileSdkVersion 28 + defaultConfig { + minSdkVersion 21 + targetSdkVersion 28 + versionCode Integer.parseInt(VERSION_CODE) + versionName VERSION_NAME + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + buildConfigField "String", "TECHNICAL_VERSION_INFO_HASH", "\"b2934af\"" + buildConfigField "String", "TECHNICAL_VERSION_INFO_ID", "\"423\"" + buildConfigField "String", "TECHNICAL_VERSION_INFO_BRANCH", "\"master\"" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + testOptions { + //in order to not mock the Log class from android + unitTests.returnDefaultValues = true + } +} + +tasks.withType(Test) { + jacoco.includeNoLocationClasses = true +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + testImplementation 'org.mockito:mockito-core:2.6.2' +} \ No newline at end of file diff --git a/MiA-SDK/mia/build_tasks.gradle b/MiA-SDK/mia/build_tasks.gradle new file mode 100644 index 0000000..9542184 --- /dev/null +++ b/MiA-SDK/mia/build_tasks.gradle @@ -0,0 +1,68 @@ +/** + * Customize output aar filename + */ +task updateBuildOutputFileName { + android.libraryVariants.all { variant -> + variant.outputs.all { + outputFileName = "${getOutputFileName(variant.buildType.name)}" + } + } +} + +/** + * Filter build variants that are not needed + */ +task filterBuildVariant { + def buildTypeArray = getBuildType() + + android.variantFilter { variant -> + if (!buildTypeArray.contains(variant.buildType.name)) { + variant.setIgnore(true) + } + } +} + +/** + * Task that filters the build types, + * runs the clean task, runs the tests, build the SDK aar file, + * creates the pom file for both release and debug. + * + * The task does not create the documentation. + * + * Example on how to call the task : + * - to build both release and debug build + * gradlew buildSDK + * - to specify the build type + * gradlew buildSDK -PbuildType="debug" + * gradlew buildSDK -PbuildType="release" + * - to specify the repo type ("snapshot", "release"). Default value is "snapshot" + * gradlew buildSDK -PrepoType="snapshot" + * + * The .aar files can be find at {pathToTheProject}\\mia\\build\\outputs\\aar + * The test results can find at {pathToTheProject}\\mia\\build\\reports + * The pom files can find at {pathToTheProject}\\mia\\build\\poms + * + */ +task buildSDK { + dependsOn 'clean' + dependsOn 'updateBuildOutputFileName' + dependsOn 'filterBuildVariant' + dependsOn 'check' + dependsOn 'assemble' + + tasks.findByName('updateBuildOutputFileName').mustRunAfter 'clean' + tasks.findByName('filterBuildVariant').mustRunAfter 'updateBuildOutputFileName' + tasks.findByName('check').mustRunAfter 'filterBuildVariant' + tasks.findByName('assemble').mustRunAfter 'check' + + doLast { + def buildTypeArray = getBuildType() + for (buildType in buildTypeArray) { + pom { + version = getSDKVersion() + groupId = GROUP_ID + artifactId = getArtifactId(buildType) + }.withXml {}.writeTo("$buildDir/poms/${getPomFileName(buildType)}") + } + } +} diff --git a/MiA-SDK/mia/coverage_report.gradle b/MiA-SDK/mia/coverage_report.gradle new file mode 100644 index 0000000..2be7e85 --- /dev/null +++ b/MiA-SDK/mia/coverage_report.gradle @@ -0,0 +1,53 @@ +apply plugin: 'jacoco-android' + +ext { + coverageSourceDirs = 'src/test/java' +} + +jacoco { + toolVersion = "0.7.5.201505241946" + reportsDir = file("$buildDir/reports") +} + +task jacocoCoverageReport(type: JacocoReport, dependsOn: "testDebugUnitTest") { + + group = "Reporting" + description = "Generate Jacoco coverage reports for Debug build" + + reports { + xml.enabled = true + html.enabled = true + } + + // what to exclude from coverage report + // UI, "noise", generated classes, platform classes, etc. + def excludes = ['**/R.class', + '**/R$*.class', + '**/BuildConfig.*', + '**/Manifest*.*', + '**/*Test*.*', + 'android/**/*.*', + '**/utils', + '**/BaseWebView.*', + '**/BaseWebViewActivity.*', + '**/BaseWebViewPresenter.*', + '**/MiAActivityView.*', + '**/MiAActivity.*', + '**/MiAActivityPresenter.*' + ] + // generated classes + classDirectories = fileTree( + dir: "$buildDir/intermediates/classes/debug", + excludes: excludes + ) + fileTree( + dir: "$buildDir/tmp/kotlin-classes/debug", + excludes: excludes + ) + + // sources + sourceDirectories = files([ + android.sourceSets.main.java.srcDirs, + "src/main/kotlin" + ]) + executionData = files("$buildDir/jacoco/testDebugUnitTest.exec") +} \ No newline at end of file diff --git a/MiA-SDK/mia/dokka_kotlin.gradle b/MiA-SDK/mia/dokka_kotlin.gradle new file mode 100644 index 0000000..6054dd3 --- /dev/null +++ b/MiA-SDK/mia/dokka_kotlin.gradle @@ -0,0 +1,77 @@ +task generateDiagrams() { + doLast { + javaexec { + main = "-jar"; + args = [ + "../plantuml.jar", + "src/main/documentation/img" + ] + } + } +} + +dokka { + outputFormat = 'html' + outputDirectory = "$buildDir/javadoc" + + skipEmptyPackages = true + + if (!shouldIncludeSDKSourceCode()) { + //if SDK source code is not included in the release, don't generate documentation for internal code + for (def pkg : ["eu.nets.mia.utils", "eu.nets.mia.webview"]) { + packageOptions { + prefix = pkg + reportUndocumented = false + suppress = true + } + } + } +} + +task clearDocumentationFolder(type: Delete) { + delete "build/javadoc" +} + +task copyOverviewFiles(type: Copy) { + from("src/main/documentation") { + exclude '**/*.txt' + exclude '**/*.md' + exclude 'readme-files' + } + into "build/javadoc/mia" +} + +task modifyOverviewDocumentationSDKVersion{ + def standaloneOverviewFilePath = DOCUMENTATION_OVERVIEW + def standaloneOverviewFile = file(standaloneOverviewFilePath) + def standaloneOverviewLines = standaloneOverviewFile.readLines() + def newStandaloneOverviewLines = new ArrayList() + standaloneOverviewLines.each { line -> + if (line.contains("implementation(")) { + newStandaloneOverviewLines.add("\timplementation('$GROUP_ID:$ARTIFACT:$VERSION_NAME') { transitive = true;}") + } else { + newStandaloneOverviewLines.add(line) + } + } + PrintWriter standaloneOverviewWriter = new PrintWriter(standaloneOverviewFile) + newStandaloneOverviewLines.each { line -> + standaloneOverviewWriter.println(line) + } + + standaloneOverviewWriter.close() +} + +task generateDocumentation() { + dependsOn 'clearDocumentationFolder' + dependsOn 'modifyOverviewDocumentationSDKVersion' + dependsOn 'generateDiagrams' + dependsOn 'dokka' + dependsOn 'copyOverviewFiles' + dependsOn 'jacocoCoverageReport' + + tasks.findByName('modifyOverviewDocumentationSDKVersion').mustRunAfter('clearDocumentationFolder') + tasks.findByName('generateDiagrams').mustRunAfter('modifyOverviewDocumentationSDKVersion') + tasks.findByName('dokka').mustRunAfter('generateDiagrams') + tasks.findByName('copyOverviewFiles').mustRunAfter('dokka') + tasks.findByName('jacocoCoverageReport').mustRunAfter 'copyOverviewFiles' +} \ No newline at end of file diff --git a/MiA-SDK/mia/gradle.properties b/MiA-SDK/mia/gradle.properties new file mode 100644 index 0000000..6899fb5 --- /dev/null +++ b/MiA-SDK/mia/gradle.properties @@ -0,0 +1,31 @@ +#Tue Feb 02 16:00:02 EET 2021 +LICENSE_URL=https\://github.com/Nets-mobile-acceptance/Easy-Android-SDK/MiA-SDK-License.md +GROUP_ID=eu.nets.mia +BINTRAY_ORG=nets-mobile-acceptance +DEFAULT_REPO_TYPE_RELEASE=snapshot +DEVELOPER_EMAIL=mobile-acceptance@nets.eu +JAVADOC_DESTINATION=build/javadoc +BUILD_TYPE_PARAMETER=buildType +SNAPSHOT_POSTFIX=-SNAPSHOT +BUILD_TYPE_DEBUG=debug +BUILD_TYPE_RELEASE=release +BINTRAY_REPO=Easy-Android-SDK +INCLUDE_SDK_SOURCE_CODE_PARAMETER=includeSDKSourceCode +ARTIFACT=mia-sdk +INCLUDE_SDK_SOURCE_CODE_NO=no +SCM_CONNECTION=https\://github.com/Nets-mobile-acceptance/Easy-Android-SDK.git +DOCUMENTATION_OVERVIEW=src/main/documentation/Start - Overview of MiA Android SDK.html +LICENSE_NAME=MIT +REPO_TYPE_RELEASE=release +VERSION_NAME=1.3.0 +DEVELOPER_ID=BuildManager-Nets +SDK_PROJECT_URL=https\://github.com/Nets-mobile-acceptance/Easy-Android-SDK/ +VERSION_CODE=29 +BINTRAY_NAME=MiA-SDK-Android +SDK_PROJECT_DESCRIPTION=MiA - Android SDK is a library which facilitates the Embedded NETS Easy Checkout integration in your Android application. +DEVELOPER_NAME=Nets Denmark A/S +INCLUDE_SDK_SOURCE_CODE_YES=yes +REPO_TYPE_PARAMETER=repoType +LIBRARY_NAME=MiA-SDK-Android +REPO_TYPE_SNAPSHOT=snapshot +PROJECT_URL=https\://github.com/Nets-mobile-acceptance/Easy-Android-SDK diff --git a/MiA-SDK/mia/proguard-rules.pro b/MiA-SDK/mia/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/MiA-SDK/mia/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/MiA-SDK/mia/src/androidTest/java/eu/nets/mia/ExampleInstrumentedTest.kt b/MiA-SDK/mia/src/androidTest/java/eu/nets/mia/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..2218696 --- /dev/null +++ b/MiA-SDK/mia/src/androidTest/java/eu/nets/mia/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package eu.nets.mia + +import android.support.test.InstrumentationRegistry +import android.support.test.runner.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getTargetContext() + assertEquals("eu.nets.mia.test", appContext.packageName) + } +} diff --git a/MiA-SDK/mia/src/main/AndroidManifest.xml b/MiA-SDK/mia/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7607bec --- /dev/null +++ b/MiA-SDK/mia/src/main/AndroidManifest.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/MiASDK.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/MiASDK.kt new file mode 100644 index 0000000..af04d46 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/MiASDK.kt @@ -0,0 +1,148 @@ +package eu.nets.mia + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.support.v4.app.Fragment +import eu.nets.mia.data.MiAPaymentInfo +import eu.nets.mia.webview.MiAActivity + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +open class MiASDK { + + companion object { + /** + * Request code used when starting the SDK as #startActivityForResult(). Check for this code on your *onActivityResult() + */ + const val EASY_SDK_REQUEST_CODE = 1001 + /** + * Parcelable Extra - [eu.nets.mia.data.MiAResult] will be found in the Intent Data under this key. + * + */ + const val BUNDLE_COMPLETE_RESULT: String = "BUNDLE_COMPLETE_RESULT" + + private val instance: MiASDK = MiASDK() + + /** + * Returns Singleton instance if MiaSDK class + */ + @JvmStatic + fun getInstance(): MiASDK { + return instance + } + } + + /** + * Starts the SDK from an Activity, with startActivityForResult() with the requestCode = EASY_SDK_REQUEST_CODE + * + * @param activity The activity from where the SDK is started + * @param miAPaymentInfo The payment information (paymentId and checkoutUrl) provided by merchant application + */ + fun startSDK(activity: Activity, miAPaymentInfo: MiAPaymentInfo) { + validateFields(miAPaymentInfo) + + val intent = Intent(activity, MiAActivity::class.java) + intent.putExtras(createBundle(miAPaymentInfo)) + + activity.startActivityForResult(intent, EASY_SDK_REQUEST_CODE) + } + + /** + * Starts the SDK from an Fragment, with startActivityForResult() with the requestCode = EASY_SDK_REQUEST_CODE + * + * @param fragment The fragment from where the SDK is started + * @param miAPaymentInfo The payment information (paymentId and checkoutUrl) provided by merchant application + */ + fun startSDK(fragment: Fragment, miAPaymentInfo: MiAPaymentInfo) { + validateFields(miAPaymentInfo) + + val intent = Intent(fragment.activity, MiAActivity::class.java) + intent.putExtras(createBundle(miAPaymentInfo)) + + fragment.startActivityForResult(intent, EASY_SDK_REQUEST_CODE) + } + + /** + * It will validate the parameters received form merchant application + * Will throw IllegalArgumentException if the conditions are not met + */ + private fun validateFields(miAPaymentInfo: MiAPaymentInfo?) { + //check made for java code for nullable values + if (miAPaymentInfo == null) throw IllegalArgumentException("MiAPaymentInfo must not be null.") + //check for localhost url + if (!miAPaymentInfo.checkoutUrl.contains("http://") && !miAPaymentInfo.checkoutUrl.contains("https://")) { + throw IllegalArgumentException("Checkout URL is not valid.") + } + } + + /** + * Helper function to create the bundle to be sent in the target activity + */ + private fun createBundle(miAPaymentInfo: MiAPaymentInfo): Bundle { + val bundle = Bundle() + bundle.putParcelable(MiAActivity.BUNDLE_PAYMENT_INFO, miAPaymentInfo) + + return bundle + } + + /** + * Formats the technical version of the SDK in a String. It is composed of: + * - the branch name from where the build was made + * - branch revision id + * - branch hash key + * + * @return Technical version String + */ + fun getTechnicalVersion(): String { + return "${BuildConfig.TECHNICAL_VERSION_INFO_BRANCH}.${BuildConfig.TECHNICAL_VERSION_INFO_HASH}.${BuildConfig.TECHNICAL_VERSION_INFO_ID}" + } + + /** + * Get the version name of the SDK + * + * @return SDK version name + */ + fun getVersionName(): String { + return BuildConfig.VERSION_NAME + } + + /** + * Get the version code of the SDK + * + * @return SDK version code + */ + fun getVersionCode(): String { + return BuildConfig.VERSION_CODE.toString() + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAPaymentInfo.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAPaymentInfo.kt new file mode 100644 index 0000000..f8a6924 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAPaymentInfo.kt @@ -0,0 +1,91 @@ +package eu.nets.mia.data + +import android.os.Parcel +import android.os.Parcelable + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * MiaPaymentInfo object containing the payment information required by the SDK + * + * First two parameters define the Merchant Hosted Payment Page integration type + * @param paymentId The id of the payment generated by merchant app + * @param checkoutUrl The URL of the checkout page containing the Easy iFrame script + * + * Along the two parameters sent above, mentioning the following parameter will specify the SDK that + * the Integration type is: Easy Host Payment Page + */ +class MiAPaymentInfo(var paymentId: String, var checkoutUrl: String) : Parcelable { + + var returnUrl: String? = null + var cancelUrl: String? = null + + constructor(parcel: Parcel) : this( + parcel.readString(), + parcel.readString(), + parcel.readString(), + parcel.readString()) + + @Deprecated("Use the new method MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?, cancelUrl: String?) method", level = DeprecationLevel.WARNING) + constructor(paymentId: String, checkoutUrl: String, returnUrl: String?) : this(paymentId, checkoutUrl) { + this.returnUrl = returnUrl + } + + constructor(paymentId: String, checkoutUrl: String, returnUrl: String?, cancelUrl: String?) : this(paymentId, checkoutUrl) { + this.returnUrl = returnUrl + this.cancelUrl = cancelUrl + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + parcel.writeString(paymentId) + parcel.writeString(checkoutUrl) + parcel.writeString(returnUrl) + parcel.writeString(cancelUrl) + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): MiAPaymentInfo { + return MiAPaymentInfo(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } + +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAResult.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAResult.kt new file mode 100644 index 0000000..d250bb1 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/data/MiAResult.kt @@ -0,0 +1,143 @@ +package eu.nets.mia.data + +import android.os.Parcel +import android.os.Parcelable + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * MiaResult class used to deliver the payment result back to merchant app + * + * @param success flag used to specify if the payment was successful or not + */ +class MiAResult( + /** + * Boolean flag which specifies the the payment process is successful or not + */ + val miaResultCode: MiAResultCode +) : Parcelable { + + /** + * error enum item; check Overview documentation on how to Handle error codes + */ + var miaError: MiAError? = null + + /** + * Constructor called by restoring state from parcel + * + * @param parcel the Parcel containing success val and/or miaError object + */ + constructor(parcel: Parcel) : this(MiAResultCode.findByInt(parcel.readInt())) { + miaError = try { + //if before writing to parcel the miaError was null, it needs to be null after createFromParcel + parcel.readSerializable() as MiAError + } catch (e: Exception) { + null + } + } + + /** + * Secondary constructor; this is called only for error cases; it will set result code to RESULT_PAYMENT_FAILED by default + * + * @param miaError the error enum item (containing a code and a explanation message) + */ + constructor(miaError: MiAError) : this(MiAResultCode.RESULT_PAYMENT_FAILED) { + this.miaError = miaError + } + + override fun writeToParcel(parcel: Parcel, flags: Int) { + parcel.writeInt(miaResultCode.result) + parcel.writeSerializable(miaError) + } + + override fun describeContents(): Int { + return 0 + } + + companion object CREATOR : Parcelable.Creator { + override fun createFromParcel(parcel: Parcel): MiAResult { + return MiAResult(parcel) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } + +} + +enum class MiAError(val errorCode: Int) { + /** + * Error code 101; This occurs inside the SDK when something went wrong (e.g. references to + * paymentId and/or checkoutUrl are cleared from RAM, and the payment cannot continue) + */ + MiASDKError(101);//SDK Internal error; Something wen't wrong and payment cannot continue + + /** + * Function to return a brief description of the error + * + * @return Explanation message for each error + */ + fun getErrorMessage(): String { + return "Something went wrong. Please try again." + } +} + +enum class MiAResultCode(val result: Int) { + /** + * The payment process has completed by the user + */ + RESULT_PAYMENT_COMPLETED(0), + /** + * The payment process was canceled by the user + */ + RESULT_PAYMENT_CANCELLED(1), + /** + * The payment process has encountered and error and cannot continue + */ + RESULT_PAYMENT_FAILED(2); + + companion object { + /** + * Find the enum value of a specific int code + */ + fun findByInt(resultCodeInt: Int): MiAResultCode { + for (code in values()) { + if (code.result == resultCodeInt) { + return code + } + } + return RESULT_PAYMENT_FAILED + } + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/HTMLInterceptor.java b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/HTMLInterceptor.java new file mode 100644 index 0000000..1ea6507 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/HTMLInterceptor.java @@ -0,0 +1,54 @@ +package eu.nets.mia.utils; + +import android.util.Log; +import android.webkit.JavascriptInterface; + +import eu.nets.mia.BuildConfig; +import eu.nets.mia.webview.base.BaseWebViewPresenterImpl; + +/** + * ****Copyright (c) 2020 Nets Denmark A/S***** + *

+ * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + *

+ * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + *

+ * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + *

+ * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + *

+ * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +public class HTMLInterceptor { + /** + * Java method used inside the WebView to log the requests and pages + * + * @param html The page content + */ + @JavascriptInterface + public void showHTML(String html) { + if (BuildConfig.DEBUG) { + Log.e(BaseWebViewPresenterImpl.Companion.getTAG(), "---- show html ----"); + Log.e(BaseWebViewPresenterImpl.Companion.getTAG(), html); + Log.e(BaseWebViewPresenterImpl.Companion.getTAG(), "---- show html end----"); + } + } +} diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSCallbackInterceptor.java b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSCallbackInterceptor.java new file mode 100644 index 0000000..87e2b00 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSCallbackInterceptor.java @@ -0,0 +1,58 @@ +package eu.nets.mia.utils; + +import android.webkit.JavascriptInterface; + +/** + * ****Copyright (c) 2020 Nets Denmark A/S***** + *

+ * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + *

+ * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + *

+ * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + *

+ * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + *

+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + *

+ * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + *

+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +public class JSCallbackInterceptor { + + private JSPaymentCallback mCallback; + + /** + * Constructor to prepare the JavaScript callback to be send in the SDK internal code + * + * @param callback JSPaymentCallback interface + */ + public JSCallbackInterceptor(JSPaymentCallback callback) { + this.mCallback = callback; + } + + /** + * Method to be called from HTML merchant page, when the 'payment-completed' event has been triggered + */ + @JavascriptInterface + public void notifyPaymentCompleted() { + if (mCallback != null) { + mCallback.onPaymentCompleted(); + } + } +} diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSPaymentCallback.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSPaymentCallback.kt new file mode 100644 index 0000000..d893a87 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/utils/JSPaymentCallback.kt @@ -0,0 +1,41 @@ +package eu.nets.mia.utils + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +interface JSPaymentCallback { + + /** + * Callback method to notify the SDK that the payment is completed and successful + */ + fun onPaymentCompleted() +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivity.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivity.kt new file mode 100644 index 0000000..b999068 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivity.kt @@ -0,0 +1,257 @@ +package eu.nets.mia.webview + +import android.app.Activity +import android.content.ActivityNotFoundException +import android.content.DialogInterface +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.os.PersistableBundle +import android.support.v7.app.AlertDialog +import eu.nets.mia.MiASDK +import eu.nets.mia.R +import eu.nets.mia.data.MiAError +import eu.nets.mia.data.MiAPaymentInfo +import eu.nets.mia.data.MiAResult +import eu.nets.mia.data.MiAResultCode +import eu.nets.mia.webview.base.BaseWebViewActivity + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class MiAActivity : BaseWebViewActivity(), MiAActivityView { + + //bundle keys + companion object { + const val BUNDLE_PAYMENT_INFO = "BUNDLE_PAYMENT_INFO" + } + //end + + private lateinit var mPresenter: MiAActivityPresenter + private var miAPaymentInfo: MiAPaymentInfo? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + mPresenter = MiAActivityPresenterImpl(this) + mPresenter.init(intent?.extras ?: savedInstanceState) + } + + //activity lifecycle + /** + * Activity onResume() + * Call presenter onResume to store new state of view + */ + override fun onResume() { + super.onResume() + mPresenter.onResume(this) + } + + /** + * Activity onStop() + * Call presenter onStop to clear the state of view + */ + override fun onStop() { + super.onStop() + mPresenter.onStop() + } + + /** + * Store the variables in activity state so it can be retrieved later + */ + override fun onSaveInstanceState(outState: Bundle?, outPersistentState: PersistableBundle?) { + outState?.putParcelable(BUNDLE_PAYMENT_INFO, miAPaymentInfo) + super.onSaveInstanceState(outState, outPersistentState) + } + //end + + //easy activity view interface + /** + * Initialize the data received from the merchant app + * @param bundle Can be the Intent bundle data (from the merchant app directly), or + * savedInstanceState bundle data (SDK stored in case the app goes to background) + */ + override fun initData(bundle: Bundle?) { + miAPaymentInfo = bundle?.getParcelable(BUNDLE_PAYMENT_INFO) + } + + /** + * Validates again the paymentId and checkoutUrl + * - if are valid, it will notify the BaseActivity to load the specific URL + * - if not valid, cancel the process with error - something went wrong + * + * @param paymentId the ID of the payment provided by merchant app + * @param checkoutUrl the checkout url provided by merchant app + */ + override fun loadWebViewData(paymentId: String?, checkoutUrl: String?) { + if (paymentId == null || checkoutUrl == null) { + //cannot continue if one of these are null -- SDK Internal error + setResult(Activity.RESULT_OK, getResultIntent(MiAResult(MiAError.MiASDKError))) + finish() + return + } + loadUrl(checkoutUrl, paymentId) + } + + /** + * Hide/show the ProgressView based on the flag + * @param show Boolean flag + */ + override fun showLoader(show: Boolean) { + showProgressView(show) + } + + /** + * Returns the checkout URL received from the merchant app + * @return URL String + */ + override fun getCheckoutUrl(): String? { + return miAPaymentInfo?.checkoutUrl + } + + /** + * Returns the paymentId received from the merchant app + * @return paymentId String + */ + override fun getPaymentId(): String? { + return miAPaymentInfo?.paymentId + } + //base activity abstract methods + + /** + * Returns the return URL received from the merchant app + * @return returnUrl String + */ + override fun getReturnUrl(): String? { + return miAPaymentInfo?.returnUrl + } + + /** + * Returns the cancel URL received from the merchant app + * @return cancelUrl String + */ + override fun getCancelUrl(): String? { + return miAPaymentInfo?.cancelUrl + } + + /** + * BaseWebViewActivity callback + * Notifies this activity that the payment has finished with success + * Handle here the way the result gets delivered to the application + */ + override fun onProcessFinishedSuccess() { + setResult(Activity.RESULT_OK, getResultIntent(MiAResult(MiAResultCode.RESULT_PAYMENT_COMPLETED))) + finish() + } + + /** + * BaseWebViewActivity callback + * Notifies this activity that the payment was canceled + * Handle here the way the result gets delivered to the application + */ + override fun onProcessCanceled() { + setResult(Activity.RESULT_OK, getResultIntent(MiAResult(MiAResultCode.RESULT_PAYMENT_CANCELLED))) + finish() + } + //end + + //helpers + /** + * Helper method to build the result intent with data + */ + private fun getResultIntent(miaResult: MiAResult): Intent { + val intent = Intent() + intent.putExtra(MiASDK.BUNDLE_COMPLETE_RESULT, miaResult) + return intent + } + // + + override fun openBankIdApp(deepLink: String?) { + var intent = packageManager.getLaunchIntentForPackage("com.bankid.bus") + if (intent != null) { + // BankId app is found -- launch it + + if (deepLink == null) { + //is nordea visa case -- launch app directly using launcher intent + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + startActivity(intent) + } else { + //is mastercard ID check -- launch app using deeplink + val bankIdIntent = Intent(Intent.ACTION_VIEW) + bankIdIntent.setPackage("com.bankid.bus") + bankIdIntent.data = Uri.parse(deepLink) + startActivity(bankIdIntent) + } + } else { + // BankId app is not found on user's device -- open Market to download it + intent = Intent(Intent.ACTION_VIEW) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + intent.data = Uri.parse("market://details?id=" + "com.bankid.bus") + try { + startActivity(intent) + } catch (e: ActivityNotFoundException) { + //cannot open market -- show error toast + showBankIdErrorAlert() + } + + } + } + + private fun showBankIdErrorAlert() { + + try { + val builder = AlertDialog.Builder(this) + builder.setTitle(getString(R.string.mia_error_title)) + builder.setMessage(getString(R.string.mia_bank_id_error_open)) + builder.setCancelable(false) + + builder.setPositiveButton( + getString(R.string.mia_alert_ok_action), + DialogInterface.OnClickListener { dialog, id -> + dialog.cancel() + }) + + val dialog = builder.create() + dialog.show() + //apply font to dialog after the dialog.show() has been called to avoid NullPointerException + } catch (e: Exception) { + //in case activity is not attached to window -- catch exception here and do nothing + } + + } + + interface AlertCallback { + fun onPositiveAction() + + fun onNegativeAction() + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenter.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenter.kt new file mode 100644 index 0000000..473127c --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenter.kt @@ -0,0 +1,62 @@ +package eu.nets.mia.webview + +import android.os.Bundle + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +interface MiAActivityPresenter { + + /** + * Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView + * @param bundle Can be the Intent bundle data (from the merchant app directly), or + * savedInstanceState bundle data (SDK stored in case the app goes to background) + */ + fun init(bundle: Bundle?) + + /** + * Notify the view to load the checkoutUrl page + */ + fun loadCheckoutPage() + + /** + * Update locally the recreated view instance + * @param miaActivityView recreated instance of the view + */ + fun onResume(miaActivityView: MiAActivityView?) + + /** + * Remove the cached instance of the view + */ + fun onStop() + +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenterImpl.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenterImpl.kt new file mode 100644 index 0000000..97970db --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityPresenterImpl.kt @@ -0,0 +1,74 @@ +package eu.nets.mia.webview + +import android.os.Bundle + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +open class MiAActivityPresenterImpl(var miaActivityView: MiAActivityView?) : MiAActivityPresenter { + + //easy activity presenter interface + /** + * Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView + * @param bundle Can be the Intent bundle data (from the merchant app directly), or + * savedInstanceState bundle data (SDK stored in case the app goes to background) + */ + override fun init(bundle: Bundle?) { + //init the data from bundle in the activity + miaActivityView?.initData(bundle) + + loadCheckoutPage() + } + + /** + * Notify the view to load the checkoutUrl page + */ + override fun loadCheckoutPage() { + miaActivityView?.loadWebViewData(miaActivityView?.getPaymentId(), miaActivityView?.getCheckoutUrl()) + } + + /** + * Update locally the recreated view instance + * @param miaActivityView recreated instance of the view + */ + override fun onResume(miaActivityView: MiAActivityView?) { + this.miaActivityView = miaActivityView + } + + /** + * Remove the cached instance of the view + */ + override fun onStop() { + this.miaActivityView = null + } + //end +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityView.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityView.kt new file mode 100644 index 0000000..5fb73ea --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/MiAActivityView.kt @@ -0,0 +1,74 @@ +package eu.nets.mia.webview + +import android.os.Bundle +import eu.nets.mia.data.MiAResult + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +interface MiAActivityView { + + /** + * Initialize the data received from the merchant app + * @param bundle Can be the Intent bundle data (from the merchant app directly), or + * savedInstanceState bundle data (SDK stored in case the app goes to background) + */ + fun initData(bundle: Bundle?) + + /** + * Validates again the paymentId and checkoutUrl + * - if are valid, it will notify the BaseActivity to load the specific URL + * - if not valid, cancel the process with error - something went wrong + * + * @param paymentId the ID of the payment provided by merchant app + * @param checkoutUrl the checkout url provided by merchant app + */ + fun loadWebViewData(paymentId: String?, checkoutUrl: String?) + + /** + * Hide/show the ProgressView based on the flag + * @param show Boolean flag + */ + fun showLoader(show: Boolean) + + /** + * Returns the checkout URL received from the merchant app + * @return URL String + */ + fun getCheckoutUrl(): String? + + /** + * Returns the paymentId received from the merchant app + * @return paymentId String + */ + fun getPaymentId(): String? +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebView.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebView.kt new file mode 100644 index 0000000..ff70cfe --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebView.kt @@ -0,0 +1,126 @@ +package eu.nets.mia.webview.base + +import android.os.Bundle +import android.widget.FrameLayout + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +interface BaseWebView { + + /** + * Initialize the UI listeners and setup the WebView configuration + */ + fun init(bundle: Bundle?) + + /** + * Close the current activity and deliver success result to application + */ + fun sendOKResult() + + /** + * Close the current activity and deliver canceled result to application + */ + fun sendCancelResult() + + /** + * Get the root view of the WebView to load multiple WebViews as child pop-ups + */ + fun getRootFrame(): FrameLayout + + /** + * Enable/disable the forward button navigation + * + * @param enable flag to specify is button is enabled or disabled + */ + fun enableForwardNavigation(enable: Boolean) + + /** + * Enable/disable the back button navigation + * + * @param enable flag to specify is button is enabled or disabled + */ + fun enableBackNavigation(enable: Boolean) + + /** + * Load the received URL in the parent WebView + * + * @param url the checkout URL provided by the merchant + * @param paymentId the paymentId provided by the merchant + */ + fun loadUrl(url: String, paymentId: String) + + /** + * Update the icon on the action button in the navigation bar (For parent WebView it will be Close, + * and for child WebView it will be Dismiss) + * + * @param resId the resource id of the Drawable + */ + fun handleNavBarActionText(resId: Int) + + /** + * Returns the checkout URL provided by merchant app + * @return URL String + */ + fun getCheckoutPage(): String + + /** + * Returns the payment identifier provided by merchant app + * @return paymentId String + */ + fun getPaymentIdentifier(): String + + /** + * Show/hide the loader based on WebView callbacks + */ + fun showProgressView(show: Boolean) + + /** + * Returns the return URL received from the merchant app + * @return returnUrl String + */ + fun getRedirectUrl(): String? + + /** + * Returns the cancel URL received from the merchant app + * @return cancelUrl String + */ + fun getCancelURL(): String? + + /** + * Case when customer's credit card supports BankId + * + * @param deepLink bankId deeplink URL for app switch; + * (if it's null, will launch the app using launcher intent; of not, will launch it using scheme url) + */ + fun openBankIdApp(deepLink: String?) +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewActivity.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewActivity.kt new file mode 100644 index 0000000..f6ee43a --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewActivity.kt @@ -0,0 +1,235 @@ +package eu.nets.mia.webview.base + +import android.graphics.PorterDuff +import android.graphics.drawable.Drawable +import android.os.Bundle +import android.support.v4.content.ContextCompat +import android.support.v7.app.AppCompatActivity +import android.view.View +import android.view.WindowManager +import android.widget.FrameLayout +import eu.nets.mia.BuildConfig +import eu.nets.mia.R +import kotlinx.android.synthetic.main.activity_base_webview.* + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +abstract class BaseWebViewActivity : AppCompatActivity(), BaseWebView { + + abstract fun onProcessFinishedSuccess() + abstract fun onProcessCanceled() + abstract fun getReturnUrl(): String? + abstract fun getCancelUrl(): String? + + private lateinit var mPresenter: BaseWebViewPresenter + private lateinit var checkoutPage: String + private lateinit var paymentId: String + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + //disable screenshot + if (BuildConfig.DEBUG) { + window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) + } else { + window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE) + } + + setContentView(R.layout.activity_base_webview) + + mPresenter = BaseWebViewPresenterImpl(this) + mPresenter.onCreate(savedInstanceState) + } + + //activity lifecycle + /** + * Activity onResume() + * Call presenter onResume to store new state of view and to resume the WebView timers + */ + override fun onResume() { + super.onResume() + mPresenter.onResume(this) + } + + /** + * Activity onStop() + * Call presenter onStop to clear the state of view + */ + override fun onStop() { + super.onStop() + mPresenter.onStop() + } + + /** + * Activity onPause() + * Call presenter onPause to pause the WebView timers + */ + override fun onPause() { + super.onPause() + mPresenter.onPause() + } + + /** + * Activity onBackPressed() + * Check if there are opened WebView pop-ups to be closed. If not, navigate back + */ + override fun onBackPressed() { + if (mPresenter.getLatestWebView() != null) { + mPresenter.onBackPressed() + } else { + super.onBackPressed() + } + } + //end + + //base web view interface + /** + * Initialize the UI listeners and setup the WebView configuration + */ + override fun init(bundle: Bundle?) { + //set listeners + actionBack.setOnClickListener { mPresenter.onNavigateBack() } + actionForward.setOnClickListener { mPresenter.onNavigateForward() } + actionClose.setOnClickListener { + if (mPresenter.getLatestWebView() != null) mPresenter.onBackPressed() else sendCancelResult() + } + + mPresenter.configureWebView(parentWebView) + } + + /** + * Close the current activity and deliver success result to application + */ + override fun sendOKResult() { + onProcessFinishedSuccess() + } + + /** + * Close the current activity and deliver canceled result to application + */ + override fun sendCancelResult() { + onProcessCanceled() + } + + /** + * Get the root view of the WebView to load multiple WebViews as child pop-ups + */ + override fun getRootFrame(): FrameLayout { + return baseFrameLayout + } + + /** + * Enable/disable the forward button navigation + * + * @param enable flag to specify is button is enabled or disabled + */ + override fun enableForwardNavigation(enable: Boolean) { + actionForward.isEnabled = enable + actionForward.alpha = if (enable) 1f else 0.3f + } + + /** + * Enable/disable the back button navigation + * + * @param enable flag to specify is button is enabled or disabled + */ + override fun enableBackNavigation(enable: Boolean) { + actionBack.isEnabled = enable + actionBack.alpha = if (enable) 1f else 0.3f + } + + /** + * Load the received URL in the parent WebView + * + * @param url the checkout URL provided by the merchant + * @param paymentId the paymentId provided by the merchant + */ + override fun loadUrl(url: String, paymentId: String) { + this.checkoutPage = url + this.paymentId = paymentId + parentWebView.loadUrl(url) + } + + /** + * Update the icon on the action button in the navigation bar (For parent WebView it will be Close, + * and for child WebView it will be Dismiss) + * + * @param resId the resource id of the Drawable + */ + override fun handleNavBarActionText(resId: Int) { + val actionDrawable: Drawable? = ContextCompat.getDrawable(this, resId) + actionDrawable?.setColorFilter(ContextCompat.getColor(this, R.color.miaColorPrimary), PorterDuff.Mode.SRC_IN) + actionClose.setImageDrawable(actionDrawable) + } + + /** + * Returns the checkout URL provided by merchant app + * @return URL String + */ + override fun getCheckoutPage(): String { + return checkoutPage + } + + /** + * Returns the payment identifier provided by merchant app + * @return paymentId String + */ + override fun getPaymentIdentifier(): String { + return paymentId + } + + /** + * Show/hide the loader based on WebView callbacks + */ + override fun showProgressView(show: Boolean) { + progressView.visibility = if (show) View.VISIBLE else View.GONE + parentWebView.setOnTouchListener { _, _ -> show } + } + + /** + * Returns the return URL received from the merchant app + * @return returnUrl String + */ + override fun getRedirectUrl(): String? { + return getReturnUrl() + } + + /** + * Returns the cancel URL received from the merchant app + * @return cancelUrl String + */ + override fun getCancelURL(): String? { + return getCancelUrl() + } + + //end +} diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenter.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenter.kt new file mode 100644 index 0000000..8cb42a8 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenter.kt @@ -0,0 +1,160 @@ +package eu.nets.mia.webview.base + +import android.os.Bundle +import android.webkit.WebView + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +interface BaseWebViewPresenter { + + /** + * Initialize the view and make startup configurations + */ + fun onCreate(savedInstanceState: Bundle?) + + /** + * Configure the useful settings for the WebView + * + * @param webView the WebView to be configured + */ + fun configureWebView(webView: WebView?) + + /** + * In case of Easy Host Payment window integration type, do the following: + * - check if the redirect happens to the url provided by the application + * - check if the redirect url contains the actual payment id + * - if so, stop the SDK process and deliver payment result OK + * + * In case of other integration types, do nothing! + */ + fun handleShouldOverrideUrlLoading(url: String?) : Boolean + + /** + * Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) + * It will have same functionalities as the parent, except the detection of the payment status. + * Usually, this child will only show pages like: Help, Terms&Conditions, etc. + * + * @return WebView popup + */ + fun createChildWebView(): WebView? + + /** + * Apply required settings to the given WebView + * + * @param webView The WebView which will be modified to have required settings + * @return WebView with specific settings + */ + fun applyWebViewSettings(webView: WebView?): WebView? + + /** + * Handles hardware back button interactions + */ + fun onBackPressed() + + /** + * Navigate to previous loaded page in the visible WebView + */ + fun onNavigateBack() + + /** + * Navigate to next loaded page in the visible WebView + */ + fun onNavigateForward() + + /** + * Mark Forward button as enabled or disabled + * @param enable Boolean flag + */ + fun enableForwardNavigation(enable: Boolean) + + /** + * Mark Back button as enabled or disabled + * @param enable Boolean flag + */ + fun enableBackNavigation(enable: Boolean) + + /** + * Returns the latest loaded WebView (the visible one) + * @return WebView child or parent + */ + fun getLatestWebView(): WebView? + + /** + * Pauses the JavaScript functions in WebView that are running periodically + */ + fun pauseTimers() + + /** + * Resumes the JavaScript functions in WebView that are running periodically + */ + fun resumeTimers() + + /** + * Send callbacks to activity to enable/disable both navigation arrows in the same time + */ + fun notifyNavigationEnabled() + + /** + * Removed the visible WebView from UI and from local stack + */ + fun removeLatestWebView() + + /** + * Handles the case of Canceled or Not Authenticated user cases + */ + fun handlePageFinished(url: String?) + + /** + * Update the icon on the action button in the navigation bar (For parent WebView it will be Close, + * and for child WebView it will be Dismiss) + * + * @param resId the resource id of the Drawable + */ + fun handleNavBarActionIcon(resId: Int) + + /** + * Update locally the recreated view instance and resume the WebView JavaScript functions + * @param baseWebView recreated instance of the view + */ + fun onResume(baseWebView: BaseWebView?) + + /** + * Remove the cached instance of the view + */ + fun onStop() + + /** + * Stop the JavaScript functions + */ + fun onPause() +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenterImpl.kt b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenterImpl.kt new file mode 100644 index 0000000..12e8540 --- /dev/null +++ b/MiA-SDK/mia/src/main/java/eu/nets/mia/webview/base/BaseWebViewPresenterImpl.kt @@ -0,0 +1,394 @@ +package eu.nets.mia.webview.base + +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.Bitmap +import android.os.Bundle +import android.os.Message +import android.webkit.WebChromeClient +import android.webkit.WebResourceRequest +import android.webkit.WebView +import android.webkit.WebViewClient +import eu.nets.mia.R +import eu.nets.mia.utils.HTMLInterceptor +import eu.nets.mia.utils.JSCallbackInterceptor +import eu.nets.mia.utils.JSPaymentCallback + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +open class BaseWebViewPresenterImpl(var mView: BaseWebView?) : BaseWebViewPresenter, JSPaymentCallback { + + companion object { + val TAG: String = BaseWebViewPresenterImpl::class.java.simpleName + } + + protected var parentWebView: WebView? = null + protected var childWebViewList: ArrayList = ArrayList() + private var transactionCanceled: Boolean = false + protected val pdfViewerUrl: String = "https://drive.google.com/viewerng/viewer?embedded=true&url=" + + protected var parentWebViewClient = object : WebViewClient() { + + //NOTE: This method will be called for API 24 and above + override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean { + return handleShouldOverrideUrlLoading(request?.url?.toString()) + } + + //NOTE: This method will be called for API 23 and below. THis was deprecated in API 24 + override fun shouldOverrideUrlLoading(view: WebView?, url: String): Boolean { + return handleShouldOverrideUrlLoading(url) + } + + override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { + mView?.showProgressView(true) + enableBackNavigation(false) + super.onPageStarted(view, url, favicon) + } + + override fun onPageFinished(view: WebView?, url: String?) { + mView?.showProgressView(false) + view?.loadUrl("javascript:window.HTMLInterceptor.showHTML" + + "(''+document.getElementsByTagName('html')[0].innerHTML+'');") + notifyNavigationEnabled() + handlePageFinished(url) + } + } + + protected var childWebViewClient = object : WebViewClient() { + var urlToUpload: String? = null + var urlToUploadFlag: Boolean? = false + + override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) { + super.onPageStarted(view, url, favicon) + mView?.showProgressView(true) + enableBackNavigation(false) + if (!url!!.contains(pdfViewerUrl) && url.endsWith(".pdf")) { + urlToUpload = url + urlToUploadFlag = true + } + + if (urlToUpload != null && urlToUploadFlag ?: true) { + val completeUrl = pdfViewerUrl + urlToUpload + view?.loadUrl(completeUrl) + } + + if (url == "about:blank") { + urlToUploadFlag = false + } + } + + override fun onPageFinished(view: WebView?, url: String?) { + super.onPageFinished(view, url) + mView?.showProgressView(false) + view?.loadUrl("javascript:window.HTMLInterceptor.showHTML" + + "(''+document.getElementsByTagName('html')[0].innerHTML+'');") + view?.clearCache(true) + view?.clearHistory() + notifyNavigationEnabled() + } + } + + /** + * Initialize the view and make startup configurations + */ + override + fun onCreate(savedInstanceState: Bundle?) { + mView?.init(savedInstanceState) + + enableBackNavigation(false) + enableForwardNavigation(false) + } + + /** + * Configure the useful settings for the WebView + * + * @param webView the WebView to be configured + */ + override fun configureWebView(webView: WebView?) { + + parentWebView = applyWebViewSettings(webView) + + webView?.webChromeClient = object : WebChromeClient() { + override fun onCreateWindow(view: WebView?, isDialog: Boolean, isUserGesture: Boolean, resultMsg: Message?): Boolean { + val childWebView = createChildWebView() ?: return false + (resultMsg?.obj as WebView.WebViewTransport).webView = childWebView + resultMsg.sendToTarget() + return true + } + } + + webView?.webViewClient = parentWebViewClient + + //on parent WebView show cancel icon + handleNavBarActionIcon(R.drawable.mia_ic_close) + } + + /** + * In case of Easy Host Payment window integration type, do the following: + * - check if the redirect happens to the url provided by the application + * - check if the redirect url contains the actual payment id + * - if so, stop the SDK process and deliver payment result OK + * + * In case of other integration types, do nothing! + */ + override fun handleShouldOverrideUrlLoading(url: String?): Boolean { + if (url == null) return false //don't interfere with the redirect + + val redirectUrl = mView?.getRedirectUrl() + val cancelUrl = mView?.getCancelURL() + if (redirectUrl != null && url.contains(redirectUrl) + && url.endsWith(mView?.getPaymentIdentifier() ?: "")) { + //is Easy Host Payment window integration type + mView?.sendOKResult() + return true + } else if (cancelUrl != null && url.contains(cancelUrl)) { + mView?.sendCancelResult() + return true + } else if (url.toLowerCase().contains("com.bankid.bus")) run { + //check if user chose BankId option and open app + mView?.openBankIdApp(null) //deeplink is null -- open the app using launcher intent + return true + } else if (url.toLowerCase().startsWith("bankid://")) run { + mView?.openBankIdApp(url) //deeplink is valid -- use app switch with scheme url + return true + } + + return false //don't interfere with the redirect + } + + /** + * Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) + * It will have same functionalities as the parent, except the detection of the payment status. + * Usually, this child will only show pages like: Help, Terms&Conditions, etc. + * + * @return WebView popup + */ + override fun createChildWebView(): WebView? { + if (mView?.getRootFrame() == null) return null + + val childWebView = applyWebViewSettings(WebView(mView as Context)) + + childWebViewList.add(childWebView!!) + mView?.getRootFrame()?.addView(childWebView) + + handleNavBarActionIcon(R.drawable.mia_ic_dismiss) + + childWebView.webChromeClient = object : WebChromeClient() { + + override fun onCreateWindow(view: WebView?, isDialog: Boolean, isUserGesture: Boolean, resultMsg: Message?): Boolean { + val child: WebView = createChildWebView() ?: return false + (resultMsg?.obj as WebView.WebViewTransport).webView = child + resultMsg.sendToTarget() + return true + } + + override fun onCloseWindow(window: WebView?) { + super.onCloseWindow(window) + removeLatestWebView() + } + } + + childWebView.webViewClient = childWebViewClient + + notifyNavigationEnabled() + + return childWebView + } + + /** + * Apply required settings to the given WebView + * + * @param webView The WebView which will be modified to have required settings + * @return WebView with specific settings + */ + @SuppressLint("SetJavaScriptEnabled") + override fun applyWebViewSettings(webView: WebView?): WebView? { + webView?.settings?.builtInZoomControls = true + webView?.settings?.domStorageEnabled = true + webView?.settings?.javaScriptEnabled = true + webView?.settings?.javaScriptCanOpenWindowsAutomatically = true + webView?.settings?.setSupportMultipleWindows(true) + webView?.settings?.useWideViewPort = true + webView?.settings?.loadWithOverviewMode = true + + webView?.addJavascriptInterface(HTMLInterceptor(), "HTMLInterceptor") + webView?.addJavascriptInterface(JSCallbackInterceptor(this), "JSCallbackInterceptor") + + return webView + } + + /** + * Handles hardware back button interactions + */ + override fun onBackPressed() { + removeLatestWebView() + } + + /** + * Navigate to previous loaded page in the visible WebView + */ + override fun onNavigateBack() { + if (getLatestWebView() != null) { + if (getLatestWebView()?.canGoBack() == true) getLatestWebView()?.goBack() + } else { + if (parentWebView?.canGoBack() == true) parentWebView?.goBack() + } + } + + /** + * Navigate to next loaded page in the visible WebView + */ + override fun onNavigateForward() { + if (getLatestWebView() != null) { + if (getLatestWebView()?.canGoForward() == true) getLatestWebView()?.goForward() + } else { + if (parentWebView?.canGoForward() == true) parentWebView?.goForward() + } + } + + /** + * Mark Forward button as enabled or disabled + * @param enable Boolean flag + */ + override fun enableForwardNavigation(enable: Boolean) { + mView?.enableForwardNavigation(enable) + } + + /** + * Mark Back button as enabled or disabled + * @param enable Boolean flag + */ + override fun enableBackNavigation(enable: Boolean) { + mView?.enableBackNavigation(enable) + } + + /** + * Returns the latest loaded WebView (the visible one) + * @return WebView child or parent + */ + override fun getLatestWebView(): WebView? { + return childWebViewList.lastOrNull() + } + + /** + * Pauses the JavaScript functions in WebView that are running periodically + */ + override fun pauseTimers() { + parentWebView?.pauseTimers() + } + + /** + * Resumes the JavaScript functions in WebView that are running periodically + */ + override fun resumeTimers() { + parentWebView?.resumeTimers() + } + + /** + * Send callbacks to activity to enable/disable both navigation arrows in the same time + */ + override fun notifyNavigationEnabled() { + enableBackNavigation(getLatestWebView()?.canGoBack() == true) + enableForwardNavigation(getLatestWebView()?.canGoForward() == true) + } + + /** + * Removed the visible WebView from UI and from local stack + */ + override fun removeLatestWebView() { + val child = childWebViewList.lastOrNull() + mView?.showProgressView(false) + + if (child != null) { + mView?.getRootFrame()?.removeView(child) + child.destroy() + childWebViewList.remove(child) + } + + if (childWebViewList.size == 0) handleNavBarActionIcon(R.drawable.mia_ic_close) + notifyNavigationEnabled() + } + + /** + * Handles the case of Canceled or Not Authenticated user cases + */ + override fun handlePageFinished(url: String?) { + if (transactionCanceled) { + mView?.sendCancelResult() + } + if (url?.contains("authenticated=false") == true) { + transactionCanceled = true + } + } + + /** + * Update the icon on the action button in the navigation bar (For parent WebView it will be Close, + * and for child WebView it will be Dismiss) + * + * @param resId the resource id of the Drawable + */ + override fun handleNavBarActionIcon(resId: Int) { + mView?.handleNavBarActionText(resId) + } + + /** + * Update locally the recreated view instance and resume the WebView JavaScript functions + * @param baseWebView recreated instance of the view + */ + override fun onResume(baseWebView: BaseWebView?) { + this.mView = baseWebView + resumeTimers() + } + + /** + * Remove the cached instance of the view + */ + override fun onStop() { + mView = null + } + + /** + * Stop the JavaScript functions + */ + override fun onPause() { + pauseTimers() + } + + /** + * Callback method to notify the SDK that the payment is completed and successful + */ + override fun onPaymentCompleted() { + mView?.sendOKResult() + } + +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_close.png b/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_close.png new file mode 100644 index 0000000..12449e5 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_close.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_dismiss.png b/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_dismiss.png new file mode 100644 index 0000000..ff1e433 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-hdpi/mia_ic_dismiss.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_close.png b/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_close.png new file mode 100644 index 0000000..af70e73 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_close.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_dismiss.png b/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_dismiss.png new file mode 100644 index 0000000..04655c9 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-mdpi/mia_ic_dismiss.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_close.png b/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_close.png new file mode 100644 index 0000000..9224f68 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_close.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_dismiss.png b/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_dismiss.png new file mode 100644 index 0000000..8b6744d Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xhdpi/mia_ic_dismiss.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_close.png b/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_close.png new file mode 100644 index 0000000..8869de6 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_close.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_dismiss.png b/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_dismiss.png new file mode 100644 index 0000000..baf0fe8 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xxhdpi/mia_ic_dismiss.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_close.png b/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_close.png new file mode 100644 index 0000000..92e5c90 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_close.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_dismiss.png b/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_dismiss.png new file mode 100644 index 0000000..e111894 Binary files /dev/null and b/MiA-SDK/mia/src/main/res/drawable-xxxhdpi/mia_ic_dismiss.png differ diff --git a/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_left_black_24dp.xml b/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_left_black_24dp.xml new file mode 100644 index 0000000..9049f6a --- /dev/null +++ b/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_left_black_24dp.xml @@ -0,0 +1,7 @@ + + + diff --git a/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_right_black_24dp.xml b/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_right_black_24dp.xml new file mode 100644 index 0000000..2a6b727 --- /dev/null +++ b/MiA-SDK/mia/src/main/res/drawable/mia_ic_chevron_right_black_24dp.xml @@ -0,0 +1,7 @@ + + + diff --git a/MiA-SDK/mia/src/main/res/layout/activity_base_webview.xml b/MiA-SDK/mia/src/main/res/layout/activity_base_webview.xml new file mode 100644 index 0000000..eaa1073 --- /dev/null +++ b/MiA-SDK/mia/src/main/res/layout/activity_base_webview.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MiA-SDK/mia/src/main/res/values/colors.xml b/MiA-SDK/mia/src/main/res/values/colors.xml new file mode 100644 index 0000000..83849f1 --- /dev/null +++ b/MiA-SDK/mia/src/main/res/values/colors.xml @@ -0,0 +1,8 @@ + + + #2a86c3 + #2372a6 + #2a86c3 + + #b9e2e1e1 + diff --git a/MiA-SDK/mia/src/main/res/values/strings.xml b/MiA-SDK/mia/src/main/res/values/strings.xml new file mode 100644 index 0000000..0c8c3e9 --- /dev/null +++ b/MiA-SDK/mia/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + Error + Cannot switch or find BankID application. Please open and authenticate with BankID application manually. + OK + + diff --git a/MiA-SDK/mia/src/main/res/values/styles.xml b/MiA-SDK/mia/src/main/res/values/styles.xml new file mode 100644 index 0000000..3689637 --- /dev/null +++ b/MiA-SDK/mia/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/MiaSDKTest.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/MiaSDKTest.kt new file mode 100644 index 0000000..4d72091 --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/MiaSDKTest.kt @@ -0,0 +1,111 @@ +package eu.nets.mia + +import android.app.Activity +import android.content.Intent +import android.support.v4.app.Fragment +import eu.nets.mia.data.MiAPaymentInfo +import junit.framework.TestCase.assertEquals +import junit.framework.TestCase.assertNotNull +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentMatchers +import org.mockito.Mockito.* +import kotlin.IllegalArgumentException + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class MiaSDKTest { + + private lateinit var miASDK: MiASDK + + @Before + fun before() { + miASDK = mock(MiASDK::class.java) + } + + @Test + fun testCompanion() { + assertEquals(1001, MiASDK.EASY_SDK_REQUEST_CODE) + assertEquals("BUNDLE_COMPLETE_RESULT", MiASDK.BUNDLE_COMPLETE_RESULT) + assertNotNull(MiASDK.getInstance()) + } + + @Test + fun test_StartSDK_FromActivity(){ + val activity = mock(Activity::class.java) + val paymentId = "paymentId" + val checkoutUrl = "http://checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + miASDK.startSDK(activity,paymentInfo) + + verify(activity).startActivityForResult(any(Intent::class.java), ArgumentMatchers.anyInt()) + } + + @Test(expected = IllegalArgumentException::class) + fun test_StartSDK_FromActivity_InvalidCheckoutUrl(){ + val activity = mock(Activity::class.java) + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + miASDK.startSDK(activity,paymentInfo) + + verify(activity).startActivityForResult(any(Intent::class.java), ArgumentMatchers.anyInt()) + } + + @Test + fun test_StartSDK_FromFragment(){ + val fragment = mock(Fragment::class.java) + val paymentId = "paymentId" + val checkoutUrl = "https://checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + miASDK.startSDK(fragment,paymentInfo) + + verify(fragment).startActivityForResult(any(Intent::class.java), ArgumentMatchers.anyInt()) + } + + @Test(expected = IllegalArgumentException::class) + fun test_StartSDK_FFragment_InvalidCheckoutUrl(){ + val fragment = mock(Fragment::class.java) + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + miASDK.startSDK(fragment,paymentInfo) + + verify(fragment).startActivityForResult(any(Intent::class.java), ArgumentMatchers.anyInt()) + } + +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiAPaymentInfoTest.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiAPaymentInfoTest.kt new file mode 100644 index 0000000..d859a4c --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiAPaymentInfoTest.kt @@ -0,0 +1,110 @@ +package eu.nets.mia.data + +import android.os.Parcel +import junit.framework.TestCase.assertEquals +import junit.framework.TestCase.assertNotSame +import org.junit.Test +import org.mockito.Mockito.* + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class MiAPaymentInfoTest { + + @Test + fun testPrimaryConstructor() { + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + assertEquals(paymentId, paymentInfo.paymentId) + assertEquals(checkoutUrl, paymentInfo.checkoutUrl) + } + + @Test + fun testSecondaryConstructor() { + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + val returnUrl = "returnUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl, returnUrl) + + assertEquals(paymentId, paymentInfo.paymentId) + assertEquals(checkoutUrl, paymentInfo.checkoutUrl) + assertEquals(returnUrl, paymentInfo.returnUrl) + } + + @Test + fun testParcelable() { + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + val parcel: Parcel = mock(Parcel::class.java) + + paymentInfo.writeToParcel(parcel, paymentInfo.describeContents()) + parcel.setDataPosition(0) + + verify(parcel).writeString(paymentId) + verify(parcel).writeString(checkoutUrl) + + `when`(parcel.readString()).thenReturn(paymentId) + + val paymentInfoFromParcel = MiAPaymentInfo.createFromParcel(parcel) + + assertEquals(paymentId, paymentInfoFromParcel.paymentId) + } + + @Test + fun testParcelable_NewArray() { + val expected = 2 + val newArray = MiAPaymentInfo.newArray(expected) + + assertEquals(expected, newArray.size) + } + + @Test + fun testMiaErrorSetter() { + val paymentId = "paymentId" + val checkoutUrl = "checkoutUrl" + + val paymentInfo = MiAPaymentInfo(paymentId, checkoutUrl) + + val paymentIdNew = "paymentIdNew" + val checkoutUrlNew = "checkoutUrlNew" + paymentInfo.paymentId = paymentIdNew + paymentInfo.checkoutUrl = checkoutUrlNew + + assertEquals(paymentIdNew, paymentInfo.paymentId) + assertEquals(checkoutUrlNew, paymentInfo.checkoutUrl) + + assertNotSame(paymentId, paymentInfo.paymentId) + assertNotSame(checkoutUrl, paymentInfo.checkoutUrl) + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiaResultTest.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiaResultTest.kt new file mode 100644 index 0000000..abbc843 --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/data/MiaResultTest.kt @@ -0,0 +1,172 @@ +package eu.nets.mia.data + +import android.os.Parcel +import junit.framework.TestCase.* +import org.junit.Test +import org.mockito.Mockito.`when` +import org.mockito.Mockito.mock +import java.lang.IllegalArgumentException + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class MiAResultTest { + + @Test + fun testConstructor_Primary_Success() { + val miaResult = MiAResult(MiAResultCode.RESULT_PAYMENT_COMPLETED) + + assertEquals(MiAResultCode.RESULT_PAYMENT_COMPLETED, miaResult.miaResultCode) + assertNull(miaResult.miaError) + } + + @Test + fun testConstructor_Primary_Error() { + val miaResult = MiAResult(MiAResultCode.RESULT_PAYMENT_FAILED) + + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResult.miaResultCode) + assertNull(miaResult.miaError) + } + + @Test + fun testConstructor_Primary_Canceled() { + val miaResult = MiAResult(MiAResultCode.RESULT_PAYMENT_CANCELLED) + + assertEquals(MiAResultCode.RESULT_PAYMENT_CANCELLED, miaResult.miaResultCode) + assertNull(miaResult.miaError) + } + + @Test + fun testConstructorSecondary() { + val miaResultErrorSDK = MiAResult(MiAError.MiASDKError) + + assertEquals(MiAError.MiASDKError, miaResultErrorSDK.miaError) + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResultErrorSDK.miaResultCode) + } + + @Test + fun testParcelableImplementation_Success_NoErrorCode() { + val miaResult = MiAResult(MiAResultCode.RESULT_PAYMENT_COMPLETED) + val parcel: Parcel = mock(Parcel::class.java) + `when`(parcel.readInt()).thenReturn(MiAResultCode.RESULT_PAYMENT_COMPLETED.result) + miaResult.writeToParcel(parcel, miaResult.describeContents()) + parcel.setDataPosition(0) + + val miaResultFromParcel = MiAResult.createFromParcel(parcel) + + assertEquals(MiAResultCode.RESULT_PAYMENT_COMPLETED, miaResultFromParcel.miaResultCode) + assertNull(miaResult.miaError) + } + + + @Test + fun testParcelableImplementation_Error_NoErrorCode() { + val miaResult = MiAResult(MiAResultCode.RESULT_PAYMENT_FAILED) + val parcel: Parcel = mock(Parcel::class.java) + `when`(parcel.readInt()).thenReturn(MiAResultCode.RESULT_PAYMENT_FAILED.result) + miaResult.writeToParcel(parcel, miaResult.describeContents()) + parcel.setDataPosition(0) + + val miaResultFromParcel = MiAResult.createFromParcel(parcel) + + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResultFromParcel.miaResultCode) + assertNull(miaResult.miaError) + } + + @Test + fun testParcelableImplementation_Error_WithErrorCode() { + val miaResult = MiAResult(MiAError.MiASDKError) + val parcel: Parcel = mock(Parcel::class.java) + `when`(parcel.readInt()).thenReturn(MiAResultCode.RESULT_PAYMENT_FAILED.result) + `when`(parcel.readSerializable()).thenReturn(MiAError.MiASDKError) + miaResult.writeToParcel(parcel, miaResult.describeContents()) + parcel.setDataPosition(0) + + val miaResultFromParcel = MiAResult.createFromParcel(parcel) + + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResultFromParcel.miaResultCode) + assertEquals(miaResultFromParcel.miaError, MiAError.MiASDKError) + } + + + @Test + fun testParcelableImplementation_Error_WithNullErrorCode() { + val miaResult = MiAResult(MiAError.MiASDKError) + val parcel: Parcel = mock(Parcel::class.java) + `when`(parcel.readInt()).thenReturn(MiAResultCode.RESULT_PAYMENT_FAILED.result) + `when`(parcel.readSerializable()).thenReturn(null) + miaResult.writeToParcel(parcel, miaResult.describeContents()) + parcel.setDataPosition(0) + + val miaResultFromParcel = MiAResult.createFromParcel(parcel) + + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResultFromParcel.miaResultCode) + assertNull(miaResultFromParcel.miaError) + } + + @Test + fun testParcelableImplementation_Error_WithInvalidErrorCode() { + val miaResult = MiAResult(MiAError.MiASDKError) + val parcel: Parcel = mock(Parcel::class.java) + `when`(parcel.readInt()).thenReturn(MiAResultCode.RESULT_PAYMENT_FAILED.result) + `when`(parcel.readSerializable()).thenReturn(1)//test integer in bundle instead of MiAError + miaResult.writeToParcel(parcel, miaResult.describeContents()) + parcel.setDataPosition(0) + + val miaResultFromParcel = MiAResult.createFromParcel(parcel) + + assertEquals(MiAResultCode.RESULT_PAYMENT_FAILED, miaResultFromParcel.miaResultCode) + assertNull(miaResultFromParcel.miaError) + } + + @Test + fun testParcelableImplementation_Array() { + val arrayOfNulls = MiAResult.newArray(3) + + assertEquals(3, arrayOfNulls.size) + } + + @Test + fun testMiaError_getErrorMessage() { + assertEquals(MiAError.MiASDKError.getErrorMessage(), "Something went wrong. Please try again.") + } + + @Test + fun testMiaError_InheritedFunction() { + assertEquals(MiAError.MiASDKError, MiAError.values()[0]) + assertEquals(MiAError.MiASDKError, MiAError.valueOf("MiASDKError")) + } + + @Test(expected = IllegalArgumentException::class) + fun testMiaError_ValueOf() { + MiAError.valueOf("someError") + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterImplWrapper.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterImplWrapper.kt new file mode 100644 index 0000000..fde885c --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterImplWrapper.kt @@ -0,0 +1,42 @@ +package eu.nets.mia.webview + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +open class MiAActivityPresenterImplWrapper(mView: MiAActivityView?) : MiAActivityPresenterImpl(mView) { + + var baseView: MiAActivityView? + get() = miaActivityView + set(value) { + miaActivityView = value + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterTest.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterTest.kt new file mode 100644 index 0000000..a8cd01a --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/MiaActivityPresenterTest.kt @@ -0,0 +1,105 @@ +package eu.nets.mia.webview + +import android.os.Bundle +import junit.framework.TestCase.assertEquals +import junit.framework.TestCase.assertNull +import org.junit.Before +import org.junit.Test +import org.mockito.Mockito.* + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class MiAActivityPresenterTest { + + private lateinit var mView: MiAActivityView + private lateinit var mPresenter: MiAActivityPresenterImplWrapper + + @Before + fun before() { + mView = mock(MiAActivityView::class.java) + mPresenter = spy(MiAActivityPresenterImplWrapper(mView)) + } + + @Test + fun testInit() { + val bundle = mock(Bundle::class.java) + + val checkoutUrl = "checkoutUrl" + val paymentId = "paymentId" + + `when`(mView.getPaymentId()).thenReturn(paymentId) + `when`(mView.getCheckoutUrl()).thenReturn(checkoutUrl) + mPresenter.baseView = mView + + mPresenter.init(bundle) + + verify(mView).initData(bundle) + verify(mPresenter).loadCheckoutPage() + + verify(mView).loadWebViewData(paymentId, checkoutUrl) + } + + @Test + fun testInit_NullView() { + val nullView: MiAActivityView? = null + + val bundle = mock(Bundle::class.java) + mPresenter.baseView = nullView + + mPresenter.init(bundle) + + //if view is null, null value is returned; otherwise Unit is returned + assertNull(nullView?.initData(bundle)) + assertNull(nullView?.getPaymentId()) + assertNull(nullView?.getCheckoutUrl()) + verify(mPresenter).loadCheckoutPage() + assertNull(nullView?.loadWebViewData(null, null)) + } + + @Test + fun testOnResume() { + val newView = mock(MiAActivityView::class.java) + mPresenter.baseView = mView + mPresenter.onResume(newView) + + assertEquals(newView, mPresenter.baseView) + } + + @Test + fun testOnStop() { + mPresenter.baseView = mView + mPresenter.onStop() + + assertNull(mPresenter.baseView) + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterImplWrapper.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterImplWrapper.kt new file mode 100644 index 0000000..54da6a5 --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterImplWrapper.kt @@ -0,0 +1,69 @@ +package eu.nets.mia.webview.base + +import android.webkit.WebView +import android.webkit.WebViewClient + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +open class BaseWebViewPresenterImplWrapper(mView: BaseWebView?) : BaseWebViewPresenterImpl(mView) { + + var baseView: BaseWebView? + get() = mView + set(value) { + mView = value + } + + var mParentWebview: WebView? + get() = parentWebView + set(value) { + parentWebView = value + } + var childList: ArrayList + get() = childWebViewList + set(value) { + childWebViewList = value + } + + var parentWebClient: WebViewClient + get() = parentWebViewClient + set(value) { + parentWebViewClient = value + } + + var childWebClient: WebViewClient + get() = childWebViewClient + set(value) { + childWebViewClient = value + } + val onlinePDFView = pdfViewerUrl +} \ No newline at end of file diff --git a/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterTest.kt b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterTest.kt new file mode 100644 index 0000000..4916204 --- /dev/null +++ b/MiA-SDK/mia/src/test/java/eu/nets/mia/webview/base/BaseWebViewPresenterTest.kt @@ -0,0 +1,966 @@ +package eu.nets.mia.webview.base + +import android.graphics.Bitmap +import android.net.Uri +import android.os.Bundle +import android.webkit.WebResourceRequest +import android.webkit.WebView +import android.widget.FrameLayout +import junit.framework.TestCase.* +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentMatchers +import org.mockito.Mockito.* + + +/** + *****Copyright (c) 2020 Nets Denmark A/S***** + * + * NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, + * IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED + * IN THIS LICENSE AGREEMENT. + * BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. + * IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, + * YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, + * OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED. + * + * Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. + * Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software. + * + * No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement. + * + * Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * Software may only be used for commercial or production purpose together with + * Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +class BaseWebViewPresenterTest { + + private lateinit var mView: BaseWebView + private lateinit var mPresenter: BaseWebViewPresenterImplWrapper + + @Before + fun before() { + mView = mock(BaseWebView::class.java) + mPresenter = spy(BaseWebViewPresenterImplWrapper(mView)) + } + + @Test + fun testOnCreate() { + val expected = false + + val bundle = mock(Bundle::class.java) + + mPresenter.baseView = mView + + mPresenter.onCreate(bundle) + + verify(mView).init(bundle) + verify(mPresenter).enableBackNavigation(expected) + verify(mPresenter).enableForwardNavigation(expected) + } + + @Test + fun testOnCreate_NullView() { + val expected = false + + val bundle = mock(Bundle::class.java) + val nullView: BaseWebView? = null + + mPresenter.baseView = nullView + + mPresenter.onCreate(bundle) + + //if view is null, null value is returned; otherwise Unit is returned + assertNull(nullView?.init(bundle)) + verify(mPresenter).enableBackNavigation(expected) + verify(mPresenter).enableForwardNavigation(expected) + } + + @Test + fun testConfigureWebView() { + mPresenter.baseView = mView + + val parentWebView = mock(WebView::class.java) + + mPresenter.configureWebView(parentWebView) + + verify(mPresenter).applyWebViewSettings(parentWebView) + } + + @Test + fun testParentWebViewClient() { + mPresenter.baseView = mView + + val childList = spy(ArrayList()) + + mPresenter.childList = childList + + val url = "someUrl" + val popup = mock(WebView::class.java) + val request = mock(WebResourceRequest::class.java) + val uri = mock(Uri::class.java) + `when`(request.url).thenReturn(uri) + `when`(uri.toString()).thenReturn(url) + + mPresenter.parentWebClient.shouldOverrideUrlLoading(popup, request) + + assertEquals(url, request?.url.toString()) + + mPresenter.parentWebClient.onPageStarted(popup, url, mock(Bitmap::class.java)) + + verify(mView).showProgressView(true) + + mPresenter.parentWebClient.onPageFinished(popup, url) + verify(mView).showProgressView(false) + verify(popup).loadUrl(any(String::class.java)) + + } + + @Test + fun testParentWebViewClient_EasyHostedPage_PaymentSuccess() { + mPresenter.baseView = mView + + val returnUrl = "http://returnUrl.com/success.php" + val paymentId = "somePaymentIdString" + + val url = "$returnUrl?paymentId=$paymentId" + + + `when`(mView.getRedirectUrl()).thenReturn(returnUrl) + `when`(mView.getPaymentIdentifier()).thenReturn(paymentId) + + val shouldOverride = mPresenter.handleShouldOverrideUrlLoading(url) + + assertTrue(shouldOverride) + verify(mView).sendOKResult() + } + + @Test + fun testParentWebViewClient_EasyHostedPage_NullRedirectUrl() { + mPresenter.baseView = mView + + val returnUrl = "http://returnUrl.com/success.php" + val paymentId = "somePaymentIdString" + + val url = "$returnUrl?paymentId=$paymentId" + + + `when`(mView.getRedirectUrl()).thenReturn(null) + `when`(mView.getPaymentIdentifier()).thenReturn(paymentId) + + val shouldOverride = mPresenter.handleShouldOverrideUrlLoading(url) + + assertFalse(shouldOverride) + verify(mView, times(0)).sendOKResult() + } + + @Test + fun testParentWebViewClient_EasyHostedPage_NullUrl() { + mPresenter.baseView = mView + + val shouldOverride = mPresenter.handleShouldOverrideUrlLoading(null) + + assertFalse(shouldOverride) + verify(mView, times(0)).sendOKResult() + } + + @Test + fun testParentWebViewClient_EasyHostedPage_RedirectToOtherPage() { + mPresenter.baseView = mView + + val returnUrl = "http://returnUrl.com/success.php" + val paymentId = "somePaymentIdString" + + val url = "http://someUrlThatLoadsAutomatically.com" + + + `when`(mView.getRedirectUrl()).thenReturn(returnUrl) + `when`(mView.getPaymentIdentifier()).thenReturn(paymentId) + + val shouldOverride = mPresenter.handleShouldOverrideUrlLoading(url) + + assertFalse(shouldOverride) + verify(mView, times(0)).sendOKResult() + } + + + @Test + fun testParentWebViewClient_NullValues() { + val nullView: BaseWebView? = null + mPresenter.baseView = nullView + + val childList = spy(ArrayList()) + + mPresenter.childList = childList + + val url = "someUrl" + val popup: WebView? = null + val request: WebResourceRequest? = null + + mPresenter.parentWebClient.shouldOverrideUrlLoading(popup, request) + + assertEquals("null", request?.url.toString()) + + mPresenter.parentWebClient.onPageStarted(popup, url, mock(Bitmap::class.java)) + + assertNull(nullView?.showProgressView(true)) + + mPresenter.parentWebClient.onPageFinished(popup, url) + + assertNull(nullView?.showProgressView(false)) + assertNull(popup?.loadUrl(any(String::class.java))) + } + + @Test + fun testChildWebViewClient_ShouldOverrideUrl_Valid_RandomPage() { + mPresenter.baseView = mView + + val url = "someUrl" + val popup = mock(WebView::class.java) + val request = mock(WebResourceRequest::class.java) + val uri = mock(Uri::class.java) + `when`(request.url).thenReturn(uri) + `when`(uri.toString()).thenReturn(url) + + assertFalse(mPresenter.childWebClient.shouldOverrideUrlLoading(popup, request)) + assertEquals(url, request?.url.toString()) + } +// Commenting out the below test cases since we are not using shouldOverrideUrlLoading() + /* @Test + fun testChildWebViewClient_ShouldOverrideUrl_Valid_PDF() { + mPresenter.baseView = mView + + val url = "someUrl.pdf" + val popup = mock(WebView::class.java) + val request = mock(WebResourceRequest::class.java) + val uri = mock(Uri::class.java) + `when`(request.url).thenReturn(uri) + `when`(uri.toString()).thenReturn(url) + + assertTrue(mPresenter.childWebClient.shouldOverrideUrlLoading(popup, request)) + verify(popup).loadUrl("${mPresenter.onlinePDFView}${request?.url?.toString()}") + } + + @Test + fun testChildWebViewClient_ShouldOverrideUrl_Invalid() { + mPresenter.baseView = mView + + val url: String? = null + val popup = mock(WebView::class.java) + val request = mock(WebResourceRequest::class.java) + val uri = mock(Uri::class.java) + `when`(request.url).thenReturn(uri) + `when`(uri.toString()).thenReturn(url) + + assertFalse(mPresenter.childWebClient.shouldOverrideUrlLoading(popup, request)) + } + + @Test + fun testChildWebViewClient_ShouldOverrideUrl_NullValues_PDF() { + mPresenter.baseView = mView + + val popup: WebView? = null + val request: WebResourceRequest? = null + + assertFalse(mPresenter.childWebClient.shouldOverrideUrlLoading(popup, request)) + } + + @Test + fun testChildWebViewClient_ShouldOverrideUrl_NullWebView_PDF() { + mPresenter.baseView = mView + + val url = "someUrl.pdf" + val popup: WebView? = null + val request = mock(WebResourceRequest::class.java) + val uri = mock(Uri::class.java) + `when`(request.url).thenReturn(uri) + `when`(uri.toString()).thenReturn(url) + + assertTrue(mPresenter.childWebClient.shouldOverrideUrlLoading(popup, request)) + assertNull(popup?.loadUrl("${mPresenter.onlinePDFView}${request?.url?.toString()}")) + } +*/ + @Test + fun testChildWebViewClient_OnPageStarted() { + mPresenter.baseView = mView + + val url = "someUrl" + val popup = mock(WebView::class.java) + + mPresenter.childWebClient.onPageStarted(popup, url, mock(Bitmap::class.java)) + + verify(mView).showProgressView(true) + } + + @Test + fun testChildWebViewClient_OnPageStarted_NullWebView() { + val nullView: BaseWebView? = null + mPresenter.baseView = nullView + + val url = "someUrl" + val popup = mock(WebView::class.java) + + mPresenter.childWebClient.onPageStarted(popup, url, mock(Bitmap::class.java)) + + assertNull(nullView?.showProgressView(true)) + } + + @Test + fun testChildWebViewClient_OnPageFinished() { + mPresenter.baseView = mView + + val url = "someUrl" + val popup = mock(WebView::class.java) + + mPresenter.childWebClient.onPageFinished(popup, url) + + verify(mView).showProgressView(false) + verify(popup).loadUrl(any(String::class.java)) + } + + + @Test + fun testChildWebViewClient_OnPageFinished_NullWebView() { + mPresenter.baseView = mView + + val url = "someUrl" + val popup: WebView? = null + + mPresenter.childWebClient.onPageFinished(popup, url) + + assertNull(popup?.loadUrl(any(String::class.java))) + } + + @Test + fun testChildWebViewClient_OnPageFinished_NullView() { + val nullView: BaseWebView? = null + mPresenter.baseView = nullView + + val url = "someUrl" + val popup = mock(WebView::class.java) + + mPresenter.childWebClient.onPageFinished(popup, url) + + assertNull(nullView?.showProgressView(false)) + } + + @Test + fun testConfigureWebView_NullWebView() { + mPresenter.baseView = mView + + mPresenter.configureWebView(null) + + verify(mPresenter).applyWebViewSettings(null) + } + + @Test + fun testCreateChildWebView_NullRoot() { + `when`(mView.getRootFrame()).thenReturn(null) + mPresenter.mView = mView + + assertNull(mPresenter.createChildWebView()) + } + + @Test + fun testCreateChildWebView_NullView() { + val nullView: BaseWebView? = null + mPresenter.mView = null + + `when`(mPresenter.applyWebViewSettings(null)).thenReturn(mock(WebView::class.java)) + assertNull(mPresenter.createChildWebView()) + assertNull(nullView?.getRootFrame()) + } + + @Test + fun testOnBackPressed_ParentWebView() { + mPresenter.mView = mView + + val parentWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + + mPresenter.childList = childList + mPresenter.mParentWebview = parentWebView + + mPresenter.onBackPressed() + + verify(mPresenter).removeLatestWebView() + verify(mView).showProgressView(false) + verify(mPresenter).handleNavBarActionIcon(ArgumentMatchers.any(Int::class.java)) + verify(mPresenter).notifyNavigationEnabled() + } + + @Test + fun testOnBackPressed_ParentWebView_NullView() { + val nullView: BaseWebView? = null + mPresenter.mView = nullView + + val parentWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + + mPresenter.childList = childList + mPresenter.mParentWebview = parentWebView + + mPresenter.onBackPressed() + + verify(mPresenter).removeLatestWebView() + //if view is null, null value is returned; otherwise Unit is returned + assertNull(nullView?.showProgressView(false)) + verify(mPresenter).handleNavBarActionIcon(ArgumentMatchers.any(Int::class.java)) + verify(mPresenter).notifyNavigationEnabled() + } + + @Test + fun testOnBackPressed_ChildWebView() { + mPresenter.mView = mView + + val parentWebView = mock(WebView::class.java) + val childWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + childList.add(childWebView) + + val rootFrame = mock(FrameLayout::class.java) + `when`(mView.getRootFrame()).thenReturn(rootFrame) + + mPresenter.childList = childList + mPresenter.mParentWebview = parentWebView + + mPresenter.onBackPressed() + + verify(mPresenter).removeLatestWebView() + verify(mView).showProgressView(false) + verify(rootFrame).removeView(childWebView) + verify(childWebView).destroy() + verify(childList).remove(childWebView) + verify(mPresenter).handleNavBarActionIcon(ArgumentMatchers.any(Int::class.java)) + verify(mPresenter).notifyNavigationEnabled() + } + + @Test + fun testOnBackPressed_ChildWebView_NullView() { + val nullView: BaseWebView? = null + mPresenter.mView = nullView + + val parentWebView = mock(WebView::class.java) + val childWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + childList.add(childWebView) + + + mPresenter.childList = childList + mPresenter.mParentWebview = parentWebView + + mPresenter.onBackPressed() + + verify(mPresenter).removeLatestWebView() + //if view is null, null value is returned; otherwise Unit is returned + assertNull(nullView?.showProgressView(false)) + assertNull(nullView?.getRootFrame()?.removeView(childWebView)) + verify(childWebView).destroy() + verify(childList).remove(childWebView) + verify(mPresenter).handleNavBarActionIcon(ArgumentMatchers.any(Int::class.java)) + verify(mPresenter).notifyNavigationEnabled() + } + + @Test + fun testOnNavigateBack_ParentWebView_CanNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val parentWebView = mock(WebView::class.java) + + `when`(parentWebView.canGoBack()).thenReturn(true) + + mPresenter.mParentWebview = parentWebView + mPresenter.childList = childList + + mPresenter.onNavigateBack() + + verify(parentWebView).goBack() + } + + @Test + fun testOnNavigateBack_ParentWebView_CannotNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val parentWebView = mock(WebView::class.java) + + `when`(parentWebView.canGoBack()).thenReturn(false) + + mPresenter.mParentWebview = parentWebView + mPresenter.childList = childList + + mPresenter.onNavigateBack() + + verify(parentWebView, times(0)).goBack() + } + + @Test + fun testOnNavigateBack_ChildWebView_CanNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val childWebView = mock(WebView::class.java) + + `when`(childWebView.canGoBack()).thenReturn(true) + + childList.add(childWebView) + mPresenter.childList = childList + + mPresenter.onNavigateBack() + + verify(childWebView).goBack() + } + + @Test + fun testOnNavigateBack_ChildWebView_CannotNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val childWebView = mock(WebView::class.java) + + `when`(childWebView.canGoBack()).thenReturn(false) + + childList.add(childWebView) + mPresenter.childList = childList + + mPresenter.onNavigateBack() + + verify(childWebView, times(0)).goBack() + } + + @Test + fun testOnNavigateForward_ParentWebView_CanNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val parentWebView = mock(WebView::class.java) + + `when`(parentWebView.canGoForward()).thenReturn(true) + + mPresenter.mParentWebview = parentWebView + mPresenter.childList = childList + + mPresenter.onNavigateForward() + + verify(parentWebView).goForward() + } + + @Test + fun testOnNavigateForward_ParentWebView_CannotNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val parentWebView = mock(WebView::class.java) + + `when`(parentWebView.canGoForward()).thenReturn(false) + + mPresenter.mParentWebview = parentWebView + mPresenter.childList = childList + + mPresenter.onNavigateForward() + + verify(parentWebView, times(0)).goForward() + } + + @Test + fun testOnNavigateForward_NullParentWebView() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val parentWebView: WebView? = null + + mPresenter.mParentWebview = parentWebView + mPresenter.childList = childList + + mPresenter.onNavigateForward() + + assertFalse(parentWebView?.canGoForward() == true) + } + + @Test + fun testOnNavigateForward_ChildWebView_CanNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val childWebView = mock(WebView::class.java) + + `when`(childWebView.canGoForward()).thenReturn(true) + + childList.add(childWebView) + mPresenter.childList = childList + + mPresenter.onNavigateForward() + + verify(childWebView).goForward() + } + + @Test + fun testOnNavigateForward_ChildWebView_CannotNavigate() { + mPresenter.mView = mView + + val childList = spy(ArrayList()) + val childWebView = mock(WebView::class.java) + + `when`(childWebView.canGoForward()).thenReturn(false) + + childList.add(childWebView) + mPresenter.childList = childList + + mPresenter.onNavigateForward() + + verify(childWebView, times(0)).goForward() + } + + @Test + fun testEnableBackNavigation_Enable() { + val expected = true + + mPresenter.mView = mView + + mPresenter.enableBackNavigation(expected) + + verify(mView).enableBackNavigation(expected) + } + + @Test + fun testEnableBackNavigation_Enable_NullView() { + val expected = false + + val baseView: BaseWebView? = null + mPresenter.mView = baseView + + mPresenter.enableBackNavigation(expected) + + verify(mView, times(0)).enableBackNavigation(expected) + } + + @Test + fun testEnableBackNavigation_Disable() { + val expected = false + + mPresenter.mView = mView + + mPresenter.enableBackNavigation(expected) + + verify(mView).enableBackNavigation(expected) + } + + @Test + fun testEnableBackNavigation_Disable_NullView() { + val expected = false + + val baseView: BaseWebView? = null + mPresenter.mView = baseView + + mPresenter.enableBackNavigation(expected) + + verify(mView, times(0)).enableBackNavigation(expected) + } + + @Test + fun testEnableForwardNavigation_Enable() { + val expected = true + + mPresenter.mView = mView + + mPresenter.enableForwardNavigation(expected) + + verify(mView).enableForwardNavigation(expected) + } + + @Test + fun testEnableForwardNavigation_Enable_NullView() { + val expected = true + + val baseView: BaseWebView? = null + mPresenter.mView = baseView + + mPresenter.enableForwardNavigation(expected) + + verify(mView, times(0)).enableForwardNavigation(expected) + } + + @Test + fun testEnableForwardNavigation_Disable() { + val expected = false + + mPresenter.mView = mView + + mPresenter.enableForwardNavigation(expected) + + verify(mView).enableForwardNavigation(expected) + } + + @Test + fun testEnableForwardNavigation_Disable_NullView() { + val expected = false + + val baseView: BaseWebView? = null + mPresenter.mView = baseView + + mPresenter.enableForwardNavigation(expected) + + verify(mView, times(0)).enableForwardNavigation(expected) + } + + @Test + fun testGetLatestWebView_NullChild() { + val childList = spy(ArrayList()) + mPresenter.childList = childList + + assertNull(mPresenter.getLatestWebView()) + } + + @Test + fun testGetLatestWebView_ValidChild() { + val childList = spy(ArrayList()) + val childWebView = mock(WebView::class.java) + childList.add(childWebView) + mPresenter.childList = childList + + assertEquals(childWebView, mPresenter.getLatestWebView()) + } + + @Test + fun testPauseTimers() { + val parentWebView = mock(WebView::class.java) + mPresenter.mParentWebview = parentWebView + + mPresenter.pauseTimers() + + verify(parentWebView).pauseTimers() + } + + @Test + fun testPauseTimers_NullParent() { + val parentWebView = mock(WebView::class.java) + mPresenter.mParentWebview = null + + mPresenter.pauseTimers() + + verify(parentWebView, times(0)).pauseTimers() + } + + @Test + fun testResumeTimers() { + val parentWebView = mock(WebView::class.java) + mPresenter.mParentWebview = parentWebView + + mPresenter.resumeTimers() + + verify(parentWebView).resumeTimers() + } + + @Test + fun testResumeTimers_NullParent() { + val parentWebView = mock(WebView::class.java) + mPresenter.mParentWebview = null + + mPresenter.resumeTimers() + + verify(parentWebView, times(0)).resumeTimers() + } + + + @Test + fun testNotifyNavigationEnabled_ChildWebView_CanNavigate() { + + val expected = true + + mPresenter.baseView = mView + + val childWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + childList.add(childWebView) + `when`(childWebView.canGoForward()).thenReturn(expected) + `when`(childWebView.canGoBack()).thenReturn(expected) + mPresenter.childList = childList + + mPresenter.notifyNavigationEnabled() + + verify(mPresenter).enableBackNavigation(expected) + verify(mPresenter).enableForwardNavigation(expected) + } + + @Test + fun testNotifyNavigationEnabled_ChildWebView_CannotNavigate() { + + val expected = false + + mPresenter.baseView = mView + + val childWebView = mock(WebView::class.java) + val childList = spy(ArrayList()) + childList.add(childWebView) + `when`(childWebView.canGoForward()).thenReturn(expected) + `when`(childWebView.canGoBack()).thenReturn(expected) + mPresenter.childList = childList + + mPresenter.notifyNavigationEnabled() + + verify(mPresenter).enableBackNavigation(expected) + verify(mPresenter).enableForwardNavigation(expected) + } + + @Test + fun testNotifyNavigationEnabled_ParentWebView() { + + val expected = false + + mPresenter.baseView = mView + + val childList = spy(ArrayList()) + mPresenter.childList = childList + + mPresenter.notifyNavigationEnabled() + + verify(mPresenter).enableBackNavigation(expected) + verify(mPresenter).enableForwardNavigation(expected) + } + + @Test + fun testRemoveLatestWebView_MultipleChilds() { + `when`(mView.getRootFrame()).thenReturn(null) + mPresenter.baseView = mView + + val child1 = mock(WebView::class.java) + val child2 = mock(WebView::class.java) + val childList = spy(ArrayList()) + childList.add(child1) + childList.add(child2) + mPresenter.childList = childList + + mPresenter.removeLatestWebView() + + assertNull(mView.getRootFrame()?.removeView(child2)) + verify(mPresenter, times(0)).handleNavBarActionIcon(any(Int::class.java)) + } + + @Test + fun testOnPageFinished_NoError() { + mPresenter.baseView = mView + + val urlLoaded = "http://someUrl.com" + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView, times(0)).sendCancelResult() + } + + @Test + fun testOnPageFinished_UserNotAuthenticated() { + mPresenter.baseView = mView + + val urlLoaded = "http://someUrl.com?authenticated=false" + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView, times(0)).sendCancelResult() + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView).sendCancelResult() + } + + @Test + fun testOnPageFinished_NullView() { + val nullView: BaseWebView? = null + mPresenter.baseView = nullView + + val urlLoaded = "http://someUrl.com?authenticated=false" + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView, times(0)).sendCancelResult() + + mPresenter.handlePageFinished(urlLoaded) + + assertNull(nullView?.sendCancelResult()) + } + + @Test + fun testOnPageFinished_NullUrl() { + mPresenter.baseView = mView + + var urlLoaded: String? = null + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView, times(0)).sendCancelResult() + + urlLoaded = "http://someUrl.com?authenticated=false" + + mPresenter.handlePageFinished(urlLoaded) + + verify(mView, times(0)).sendCancelResult() + } + + @Test + fun testHandleNavBarActionText() { + mPresenter.baseView = mView + val resId = 100 + mPresenter.handleNavBarActionIcon(resId) + + verify(mView).handleNavBarActionText(resId) + } + + @Test + fun testOnResume() { + mPresenter.baseView = mView + + val newView = mock(BaseWebView::class.java) + + mPresenter.onResume(newView) + assertEquals(newView, mPresenter.baseView) + verify(mPresenter).resumeTimers() + } + + @Test + fun testOnStop() { + mPresenter.baseView = mView + + mPresenter.onStop() + + assertNull(mPresenter.baseView) + } + + @Test + fun testOnPause() { + mPresenter.baseView = mView + + mPresenter.onPause() + + verify(mPresenter).pauseTimers() + } + + @Test + fun testOnPaymentCompleted() { + mPresenter.baseView = mView + + mPresenter.onPaymentCompleted() + + verify(mView).sendOKResult() + } + + @Test + fun testOnPaymentCompleted_NullView() { + val view: BaseWebView? = null + mPresenter.baseView = view + + mPresenter.onPaymentCompleted() + + assertNull(view?.sendOKResult()) + } +} \ No newline at end of file diff --git a/MiA-SDK/mia/util_closures.gradle b/MiA-SDK/mia/util_closures.gradle new file mode 100644 index 0000000..83af76b --- /dev/null +++ b/MiA-SDK/mia/util_closures.gradle @@ -0,0 +1,44 @@ +ext.getRepoType = { + project.hasProperty(REPO_TYPE_PARAMETER) ? project.property(REPO_TYPE_PARAMETER) : DEFAULT_REPO_TYPE_RELEASE +} + +ext.getBuildType = { + def repoType = getRepoType() + def buildTypeArray + if (project.hasProperty(BUILD_TYPE_PARAMETER)) { + buildTypeArray = new String[1] + buildTypeArray[0] = project.property(BUILD_TYPE_PARAMETER) + } else { + if (repoType == REPO_TYPE_SNAPSHOT) { + buildTypeArray = [BUILD_TYPE_DEBUG, BUILD_TYPE_RELEASE] + } else { + buildTypeArray = [BUILD_TYPE_RELEASE] + } + } + buildTypeArray +} + +ext.getSDKVersion = { + def repoType = getRepoType() + VERSION_NAME + (repoType == REPO_TYPE_SNAPSHOT ? SNAPSHOT_POSTFIX : "") +} + +ext.getArtifactId = { buildType -> + buildType == BUILD_TYPE_RELEASE ? ARTIFACT : "$ARTIFACT-$buildType" +} + +ext.getOutputFileName = { buildType -> + "${getArtifactId(buildType)}-${getSDKVersion()}.aar" +} + +ext.getPomFileName = { buildType -> + "pom-${buildType}.xml" +} + +/** + * Returns if the SDK Source code should be included into release package. + */ +ext.shouldIncludeSDKSourceCode = { + def includeSDKSourceCode = project.hasProperty(INCLUDE_SDK_SOURCE_CODE_PARAMETER) ? project.property(INCLUDE_SDK_SOURCE_CODE_PARAMETER) : INCLUDE_SDK_SOURCE_CODE_NO + includeSDKSourceCode == INCLUDE_SDK_SOURCE_CODE_YES +} \ No newline at end of file diff --git a/MiA-SDK/mia/util_tasks.gradle b/MiA-SDK/mia/util_tasks.gradle new file mode 100644 index 0000000..5abadff --- /dev/null +++ b/MiA-SDK/mia/util_tasks.gradle @@ -0,0 +1,25 @@ +def PROPERTY_FILE_PATH_PARAMETER = "propFilePath" +def PROPERTY_FILE_NAME_PARAMETER = "propFileName" + +task addVersionNameToFile { + doLast { + if (project.hasProperty(PROPERTY_FILE_PATH_PARAMETER) && project.hasProperty(PROPERTY_FILE_NAME_PARAMETER)) { + def path = project.property(PROPERTY_FILE_PATH_PARAMETER) + def filename = project.property(PROPERTY_FILE_NAME_PARAMETER) + + File rootFolder = new File(path) + if (!rootFolder.exists()) { + rootFolder.mkdirs() + } + + Properties props = new Properties() + File propsFile = new File(rootFolder, filename) + if (!propsFile.exists()) { + propsFile.createNewFile() + } + props.load(propsFile.newDataInputStream()) + props.setProperty('sdkVersionName', VERSION_NAME) + props.store(propsFile.newWriter(), null) + } + } +} \ No newline at end of file diff --git a/MiA-SDK/plantuml.jar b/MiA-SDK/plantuml.jar new file mode 100644 index 0000000..630b011 Binary files /dev/null and b/MiA-SDK/plantuml.jar differ diff --git a/MiA-SDK/settings.gradle b/MiA-SDK/settings.gradle new file mode 100644 index 0000000..2d23a18 --- /dev/null +++ b/MiA-SDK/settings.gradle @@ -0,0 +1 @@ +include ':mia' diff --git a/MiaSample/app/build.gradle b/MiaSample/app/build.gradle index a72f056..443522e 100644 --- a/MiaSample/app/build.gradle +++ b/MiaSample/app/build.gradle @@ -60,7 +60,7 @@ dependencies { implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'org.nanohttpd:nanohttpd:2.3.1' - implementation('eu.nets.mia:mia-sdk:1.2.1@aar') { transitive = true; changing=true; } + implementation('eu.nets.mia:mia-sdk:1.3.0@aar') { transitive = true; changing=true; } } apply plugin: 'com.google.gms.google-services' diff --git a/MiaSample/app/gradle.properties b/MiaSample/app/gradle.properties index 9c131db..95b4201 100644 --- a/MiaSample/app/gradle.properties +++ b/MiaSample/app/gradle.properties @@ -1,11 +1,11 @@ -#Tue Jun 02 08:47:08 EEST 2020 +#Tue Feb 02 16:00:02 EET 2021 PROD_BASE_URL="https\://api.dibspayment.eu/" -VERSION_NAME=1.2.1 +VERSION_NAME=1.3.0 TEST_CHECKOUT_JS="https\://test.checkout.dibspayment.eu/v1/checkout.js?v\=1" -VERSION_CODE=26 +VERSION_CODE=29 PROD_CHECKOUT_KEY = "YOUR PROD CHECKOUT KEY HERE" TEST_CHECKOUT_KEY ="YOUR TEST CHECKOUT KEY HERE" PROD_CHECKOUT_JS="https\://checkout.dibspayment.eu/v1/checkout.js?v\=1" TEST_SECRET_KEY = "YOUR TEST SECRET KEY HERE" -TEST_BASE_URL="https\://test.api.dibspayment.eu/" PROD_SECRET_KEY = "YOUR PROD SECRET KEY HERE" +TEST_BASE_URL="https\://test.api.dibspayment.eu/" diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivity.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivity.kt index 9865aae..4823fde 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivity.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivity.kt @@ -72,6 +72,14 @@ class MainActivity : AppCompatActivity(), MainActivityView { //end //easy hosted payment window helper constants const val RETURN_URL = "http://localhost/redirect.php" + + // Cancellation URL passed to EASY and the SDK to indentify + // user cancellation by using the "Go back" link rendered + // in the checkout webview. + // Note: Pass the same `cancelURL` for + // payment registration with Easy API and + // when presenting Mia SDK following payment registration. + const val CANCEL_URL = "https://cancellation-identifier-url" const val INTEGRATION_TYPE_PARAM = "HostedPaymentPage" const val CONSUMER_DATA_NONE = "None" @@ -342,13 +350,14 @@ class MainActivity : AppCompatActivity(), MainActivityView { * @param paymentId the paymentId received in registerPayment API call * @param checkoutUrl the checkout page url sent in the register payment API call * @param returnUrl the return url of success case when Integration Type is Easy Hosted Checkout + * @param cancelUrl the url that you would want to redirect to in case of cancel. */ - override fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?) { + override fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?, cancelUrl: String?) { if (paymentId == null || checkoutUrl == null) { showAlert(getString(R.string.error_title), getString(R.string.error_message)) return } else if (validateAmount()) { - MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl)) + MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl, cancelUrl)) } } diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityPresenterImpl.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityPresenterImpl.kt index 031dc44..923e180 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityPresenterImpl.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityPresenterImpl.kt @@ -5,18 +5,22 @@ import android.util.Patterns import android.view.View import android.widget.TextView import eu.nets.miasample.R +import eu.nets.miasample.activity.MainActivity.Companion.CANCEL_URL import eu.nets.miasample.activity.MainActivity.Companion.CONSUMER_DATA_MERCHANT_INJECTED import eu.nets.miasample.activity.MainActivity.Companion.CONSUMER_DATA_NONE import eu.nets.miasample.activity.MainActivity.Companion.CONSUMER_DATA_NO_SHIPPING_ADDR import eu.nets.miasample.network.APIManager import eu.nets.miasample.network.callback.HttpResponse import eu.nets.miasample.network.request.* +import eu.nets.miasample.network.response.ChargePaymentResponse +import eu.nets.miasample.network.response.HttpError +import eu.nets.miasample.network.response.PaymentResponse +import eu.nets.miasample.network.response.RegisterPaymentResponse import eu.nets.miasample.utils.SampleHtmlProvider import eu.nets.miasample.utils.SampleLocalHost import eu.nets.miasample.utils.SharedPrefs import java.util.* import kotlin.collections.ArrayList -import eu.nets.miasample.network.response.* /** @@ -89,11 +93,11 @@ class MainActivityPresenterImpl(private var mView: MainActivityView?) : MainActi when (SharedPrefs.getInstance().integrationType) { MainActivity.MERCHANT_HOSTED_PAYMENT_WINDOW -> { //is merchant hosted payment window - do not send return url - mView?.launchEasySDK(mPaymentId, mCheckoutUrl, null) + mView?.launchEasySDK(mPaymentId, mCheckoutUrl, null, MainActivity.CANCEL_URL) } MainActivity.EASY_HOSTED_PAYMENT_WINDOW -> { //is easy hosted payment window - send the return url - mView?.launchEasySDK(mPaymentId, response?.hostedPaymentPageUrl, MainActivity.RETURN_URL) + mView?.launchEasySDK(mPaymentId, response?.hostedPaymentPageUrl, MainActivity.RETURN_URL, MainActivity.CANCEL_URL) } else -> { //to be continued on future integration types @@ -104,8 +108,10 @@ class MainActivityPresenterImpl(private var mView: MainActivityView?) : MainActi override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_title), error.parseErrors()) @@ -168,8 +174,10 @@ class MainActivityPresenterImpl(private var mView: MainActivityView?) : MainActi override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_message), error.parseErrors()) @@ -197,8 +205,10 @@ class MainActivityPresenterImpl(private var mView: MainActivityView?) : MainActi override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_message), error.parseErrors()) @@ -273,6 +283,7 @@ class MainActivityPresenterImpl(private var mView: MainActivityView?) : MainActi */ checkout.integrationType = MainActivity.INTEGRATION_TYPE_PARAM checkout.returnURL = MainActivity.RETURN_URL + checkout.cancelUrl = MainActivity.CANCEL_URL } else -> {//to be continued for future integration types } diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityView.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityView.kt index 1b8ea10..7c0ba88 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityView.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/MainActivityView.kt @@ -38,10 +38,10 @@ interface MainActivityView { * @param paymentId the paymentId received in registerPayment API call * @param checkoutUrl the checkout page url sent in the register payment API call * @param returnUrl the return url of success case when Integration Type is Easy Hosted Checkout - * @param isSubscription Checks if the call is for subscription + * @param cancelUrl the url that you would want to redirect to in case of cancel. */ - fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?) + fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?, cancelUrl: String?) /** * Show/hide progress view based on the boolean flag diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivity.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivity.kt index 707b689..4ef6ee2 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivity.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivity.kt @@ -3,8 +3,8 @@ package eu.nets.miasample.activity import android.app.Activity import android.app.AlertDialog import android.content.Intent -import android.support.v7.app.AppCompatActivity import android.os.Bundle +import android.support.v7.app.AppCompatActivity import android.support.v7.widget.LinearLayoutManager import android.view.View import com.google.gson.Gson @@ -19,7 +19,6 @@ import eu.nets.miasample.network.response.SubscriptionDetailsResponse import eu.nets.miasample.utils.SampleLocalHost import eu.nets.miasample.utils.SharedPrefs import kotlinx.android.synthetic.main.activity_subscription.* -import java.lang.Exception /** * *****Copyright (c) 2020 Nets Denmark A/S***** @@ -149,12 +148,12 @@ class SubscriptionActivity : AppCompatActivity(), SubscriptionActivityView { } } - override fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?) { + override fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?, cancelUrl: String?) { if (paymentId == null || checkoutUrl == null) { showAlert(getString(R.string.error_title), getString(R.string.error_message)) return } else { - MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl)) + MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl, cancelUrl)) } } diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityPresenterImpl.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityPresenterImpl.kt index 18bd4cf..2c1c837 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityPresenterImpl.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityPresenterImpl.kt @@ -64,11 +64,11 @@ class SubscriptionActivityPresenterImpl(private var mView: SubscriptionActivityV when (SharedPrefs.getInstance().integrationType) { MainActivity.MERCHANT_HOSTED_PAYMENT_WINDOW -> { //is merchant hosted payment window - do not send return url - mView?.launchEasySDK(mPaymentId, mCheckoutUrl, null) + mView?.launchEasySDK(mPaymentId, mCheckoutUrl, null, MainActivity.CANCEL_URL) } MainActivity.EASY_HOSTED_PAYMENT_WINDOW -> { //is easy hosted payment window - send the return url - mView?.launchEasySDK(mPaymentId, response?.hostedPaymentPageUrl, MainActivity.RETURN_URL) + mView?.launchEasySDK(mPaymentId, response?.hostedPaymentPageUrl, MainActivity.RETURN_URL, MainActivity.CANCEL_URL) } else -> { //to be continued on future integration types @@ -79,8 +79,10 @@ class SubscriptionActivityPresenterImpl(private var mView: SubscriptionActivityV override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_title), error.parseErrors()) @@ -131,8 +133,10 @@ class SubscriptionActivityPresenterImpl(private var mView: SubscriptionActivityV override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_message), error.parseErrors()) @@ -156,8 +160,10 @@ class SubscriptionActivityPresenterImpl(private var mView: SubscriptionActivityV override fun onError(code: Int, error: HttpError) { mView?.showLoader(false) if (error.errors == null) { - mView?.showAlert("${error.code ?: code}: ${error.source - ?: getContext().getString(R.string.error_title)}", + mView?.showAlert("${error.code ?: code}: ${ + error.source + ?: getContext().getString(R.string.error_title) + }", error.message ?: getContext().getString(R.string.error_message)) } else { mView?.showAlert(getContext().getString(R.string.error_message), error.parseErrors()) @@ -253,6 +259,7 @@ class SubscriptionActivityPresenterImpl(private var mView: SubscriptionActivityV */ checkout.integrationType = MainActivity.INTEGRATION_TYPE_PARAM checkout.returnURL = MainActivity.RETURN_URL + checkout.cancelUrl = MainActivity.CANCEL_URL } else -> {//to be continued for future integration types } diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityView.kt b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityView.kt index e42c616..9edd8c2 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityView.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/activity/SubscriptionActivityView.kt @@ -35,9 +35,10 @@ interface SubscriptionActivityView { * @param paymentId the paymentId received in registerPayment API call * @param checkoutUrl the checkout page url sent in the register payment API call * @param returnUrl the return url of success case when Integration Type is Easy Hosted Checkout + * @param cancelUrl the url that you would want to redirect to in case of cancel. */ - fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?) + fun launchEasySDK(paymentId: String?, checkoutUrl: String?, returnUrl: String?, cancelUrl: String?) /** * Show/hide progress view based on the boolean flag diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/network/request/RegisterPaymentRequest.kt b/MiaSample/app/src/main/java/eu/nets/miasample/network/request/RegisterPaymentRequest.kt index 86c19ba..2e2ef09 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/network/request/RegisterPaymentRequest.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/network/request/RegisterPaymentRequest.kt @@ -108,6 +108,9 @@ class Checkout { @SerializedName("returnURL") var returnURL: String? = null @Expose + @SerializedName("cancelUrl") + var cancelUrl: String? = null + @Expose @SerializedName("merchantHandlesConsumerData") var merchantHandlesConsumerData: Boolean = false @Expose diff --git a/MiaSample/app/src/main/java/eu/nets/miasample/utils/SampleLocalHost.kt b/MiaSample/app/src/main/java/eu/nets/miasample/utils/SampleLocalHost.kt index 5501617..8a9fd36 100644 --- a/MiaSample/app/src/main/java/eu/nets/miasample/utils/SampleLocalHost.kt +++ b/MiaSample/app/src/main/java/eu/nets/miasample/utils/SampleLocalHost.kt @@ -1,7 +1,6 @@ package eu.nets.miasample.utils import fi.iki.elonen.NanoHTTPD -import java.lang.Exception /** diff --git a/README.md b/README.md index 1178fb3..da397f9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Easy - Android SDK v1.2.1 +# Easy - Android SDK v1.3.0 ---- ![Logo](readme-files/NetsLogo.jpg) @@ -18,7 +18,7 @@ MiA Easy Android SDK is a library which facilitates the Embedded DIBS Easy Check ---- In your `build.gradle` application level file, add: ```gradle -implementation('eu.nets.mia:mia-sdk:1.2.1') { transitive = true;} +implementation('eu.nets.mia:mia-sdk:1.3.0') { transitive = true;} ``` **Note:** the library is available through both `jcenter()` and `mavenCentral()` repositories. diff --git a/ReactNative/MiaSample/yarn.lock b/ReactNative/MiaSample/yarn.lock index a5d70b4..313ba56 100644 --- a/ReactNative/MiaSample/yarn.lock +++ b/ReactNative/MiaSample/yarn.lock @@ -5491,7 +5491,7 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== react-native-rn-mia@./../react-native-rn-mia: - version "1.0.0" + version "1.2.0" react-native@0.62.2: version "0.62.2" @@ -6645,9 +6645,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= ua-parser-js@^0.7.18: - version "0.7.21" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777" - integrity sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ== + version "0.7.28" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" + integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== uglify-es@^3.1.9: version "3.3.9" diff --git a/ReactNative/react-native-rn-mia/android/build.gradle b/ReactNative/react-native-rn-mia/android/build.gradle index 7edfc7c..3429f21 100644 --- a/ReactNative/react-native-rn-mia/android/build.gradle +++ b/ReactNative/react-native-rn-mia/android/build.gradle @@ -75,7 +75,7 @@ dependencies { implementation 'com.facebook.react:react-native:+' // From node_modules // Mia SDK - implementation 'eu.nets.mia:mia-sdk:1.2.1' + implementation 'eu.nets.mia:mia-sdk:1.3.0' } def configureReactNativePom(def pom) { diff --git a/Xamarin/DLL Files/MiASDKBinding.dll b/Xamarin/DLL Files/MiASDKBinding.dll index d7a05f7..01ffbf4 100644 Binary files a/Xamarin/DLL Files/MiASDKBinding.dll and b/Xamarin/DLL Files/MiASDKBinding.dll differ diff --git a/Xamarin/MiASampleXamarin/MiASampleXamarin/MainActivity.cs b/Xamarin/MiASampleXamarin/MiASampleXamarin/MainActivity.cs index e1298a1..52424c0 100644 --- a/Xamarin/MiASampleXamarin/MiASampleXamarin/MainActivity.cs +++ b/Xamarin/MiASampleXamarin/MiASampleXamarin/MainActivity.cs @@ -111,7 +111,7 @@ private async void RegisterPayment(String payMode) _paymentId = response.paymentId; _hostedPaymentPageUrl = response.hostedPaymentPageUrl; //start SDK - MiASDK.Instance.StartSDK(this, new MiAPaymentInfo(response.paymentId, response.hostedPaymentPageUrl, APIService.returnURL)); + MiASDK.Instance.StartSDK(this, new MiAPaymentInfo(response.paymentId, response.hostedPaymentPageUrl, APIService.returnURL, APIService.cancelURL)); } else { @@ -122,68 +122,13 @@ private async void RegisterPayment(String payMode) private String GetRegisterPaymentBody() { - return "{" + - " \"checkout\": {" + - " \"charge\": false," + - " \"consumerType\": {" + - " \"default\": \"B2C\"," + - " \"supportedTypes\": [\"B2B\", \"B2C\"]" + - " }," + - " \"termsUrl\": \"http://localhost:6500\"," + - " \"returnURL\": \"http://localhost/redirect.php\"," + - " \"integrationType\": \"HostedPaymentPage\"" + - " }," + - " \"order\": {" + - " \"amount\": 1000," + - " \"currency\": \"SEK\"," + - " \"items\": [{" + - " \"grossTotalAmount\": 1000," + - " \"name\": \"Lightning Cable\"," + - " \"quantity\": 1," + - " \"reference\": \"MiASDK-Xamarin-Android\"," + - " \"taxAmount\": 0," + - " \"taxRate\": 0," + - " \"unit\": \"pcs\"" + - " }]," + - " \"reference\": \"MiASDK-Xamarin-Android\"" + - " }" + - "}"; + return "{\"checkout\":{\"cancelUrl\":\"" + APIService.cancelURL + "\",\"charge\":false,\"consumerType\":{\"default\":\"B2C\",\"supportedTypes\":[\"B2B\",\"B2C\"]},\"integrationType\":\"HostedPaymentPage\",\"merchantHandlesConsumerData\":false,\"returnURL\":\"http://localhost/redirect.php\",\"termsUrl\":\"http://localhost:6500\"},\"order\":{\"amount\":1000,\"currency\":\"SEK\",\"items\":[{\"grossTotalAmount\":1000,\"name\":\"Lightning Cable\",\"quantity\":1,\"reference\":\"MiASDK-Android\",\"taxAmount\":0,\"taxRate\":0,\"unit\":\"pcs\"}],\"reference\":\"MiASDK-Android\"}}"; } private String GetSubscriptionRequest() { - return "{\"checkout\":{" + - "\"charge\":true," + - "\"consumerType\":{" + - "\"default\":\"B2C\"," + - "\"supportedTypes\":[\"B2B\",\"B2C\"]" + - "}," + - "\"integrationType\":\"HostedPaymentPage\"," + - "\"merchantHandlesConsumerData\":false," + - "\"returnURL\":\"http://localhost/redirect.php\"," + - "\"termsUrl\":\"http://localhost:6500\"" + - "}," + - "\"order\":{" + - "\"amount\":1000," + - "\"currency\":\"SEK\"," + - "\"items\":[{" + - "\"grossTotalAmount\":1000," + - "\"name\":\"Lightning Cable\"," + - "\"quantity\":1," + - "\"reference\":\"MiASDK-Android\"," + - "\"taxAmount\":0," + - "\"taxRate\":0," + - "\"unit\":\"pcs\"" + - "}]," + - "\"reference\":\"MiASDK-Android\"" + - "}," + - "\"subscription\":{" + - "\"endDate\":\"" - + CreateSubscriptionEndDate() - + "\",\"interval\":0" + - "}" + - "}"; + return "{\"checkout\":{\"cancelUrl\":\"" + APIService.cancelURL + "\",\"charge\":true,\"consumerType\":{\"default\":\"B2C\",\"supportedTypes\":[\"B2B\",\"B2C\"]},\"integrationType\":\"HostedPaymentPage\",\"merchantHandlesConsumerData\":false,\"returnURL\":\"http://localhost/redirect.php\",\"termsUrl\":\"http://localhost:6500\"},\"order\":{\"amount\":1000,\"currency\":\"SEK\",\"items\":[{\"grossTotalAmount\":1000,\"name\":\"Lightning Cable\",\"quantity\":1,\"reference\":\"MiASDK-Android\",\"taxAmount\":0,\"taxRate\":0,\"unit\":\"pcs\"}],\"reference\":\"MiASDK-Android\"},\"subscription\":{\"endDate\":\"2024-04-01\",\"interval\":0}}"; } /** diff --git a/Xamarin/MiASampleXamarin/MiASampleXamarin/http/APIService.cs b/Xamarin/MiASampleXamarin/MiASampleXamarin/http/APIService.cs index 0c6a08d..3b3c96c 100644 --- a/Xamarin/MiASampleXamarin/MiASampleXamarin/http/APIService.cs +++ b/Xamarin/MiASampleXamarin/MiASampleXamarin/http/APIService.cs @@ -45,6 +45,14 @@ public class APIService public static String baseUrl = "YOUR_BASE_URL"; public static String endPoint = "YOUR_API_ENDPOINT"; public static String returnURL = "YOUR_RETURN_URL"; + + // Cancellation URL passed to EASY and the SDK to indentify + // user cancellation by using the "Go back" link rendered + // in the checkout webview. + // Note: Pass the same `cancelURL` for + // payment registration with Easy API and + // when presenting Mia SDK following payment registration. + public static String cancelURL = "YOUR_CANCEL_URL"; #external_code_section_end*/ //#internal_code_section_start @@ -53,6 +61,7 @@ public class APIService public static String baseUrl = "https://test.api.dibspayment.eu/"; public static String endPoint = "v1/payments"; public static String returnURL = "http://localhost/redirect.php"; + public static String cancelURL = "https://cancellation-identifier-url"; //#internal_code_section_end private APIService() diff --git a/apk/mia-sdk-android-release-sample-1.2.1.apk b/apk/mia-sdk-android-release-sample-1.3.0.apk similarity index 70% rename from apk/mia-sdk-android-release-sample-1.2.1.apk rename to apk/mia-sdk-android-release-sample-1.3.0.apk index aa38f09..82b3db1 100644 Binary files a/apk/mia-sdk-android-release-sample-1.2.1.apk and b/apk/mia-sdk-android-release-sample-1.3.0.apk differ diff --git a/documentation/Start - Overview of MiA Android SDK.html b/documentation/Start - Overview of MiA Android SDK.html index fb1cb79..e75b06b 100644 --- a/documentation/Start - Overview of MiA Android SDK.html +++ b/documentation/Start - Overview of MiA Android SDK.html @@ -76,7 +76,7 @@

Installation

  • Please add the following line in your application's build.gradle file.
  • dependencies {
    -	implementation('eu.nets.mia:mia-sdk:1.2.1') { transitive = true;}
    +	implementation('eu.nets.mia:mia-sdk:1.3.0') { transitive = true;}
     

    Getting started


    @@ -258,7 +258,7 @@

    Getting started

    Important: Make sure the returnUrl is the same one you are sending in the API call to retrieve the paymentId. Without this, the SDK cannot detect when the payment has completed in order to deliver a result back to your application.

    -
     MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl))
    +
     MiASDK.getInstance().startSDK(this, MiAPaymentInfo(paymentId, checkoutUrl, returnUrl, cancelUrl))
     
    1. EmbeddedCheckout (not recommended):
    2. @@ -527,11 +527,18 @@

      Release notes:

      v1.2.1 Released: 25-Jan-2021

      -

      Release notes:

      +

      Release notes:

      • Support of Android API version extended to API 21 and above.
      +

      v1.2.2 Released: 20-Apr-2021

      +

      Release notes:

      +
        +
      • Added support for cancel URL in SDK API, allowing users to close the Easy checkout (using the “Go back” button) and come back to the app or target URL. Just like returnURL, cancelURL it is a string to specify in the register payment API.
      • +
      • Added Xamarin and ReactNative wrappers for SDK integration
      • +
      +

      Note:

      • For any bug reports or question, please contact: mobile-acceptance@nets.eu
      • diff --git a/documentation/alltypes/index.html b/documentation/alltypes/index.html index d5858ce..99db430 100644 --- a/documentation/alltypes/index.html +++ b/documentation/alltypes/index.html @@ -10,6 +10,99 @@

        All Types

        +eu.nets.mia.webview.base.BaseWebView + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.base.BaseWebViewActivity + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.base.BaseWebViewPresenter + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.base.BaseWebViewPresenterImpl + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.utils.HTMLInterceptor + +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        + + + + +eu.nets.mia.utils.JSCallbackInterceptor + +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        + + + + +eu.nets.mia.utils.JSPaymentCallback + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.MiAActivity + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.MiAActivityPresenter + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.MiAActivityPresenterImpl + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + +eu.nets.mia.webview.MiAActivityView + +

        Copyright (c) 2020 Nets Denmark A/S*****

        + + + + eu.nets.mia.data.MiAError diff --git a/documentation/eu.nets.mia.data/-mi-a-payment-info/-init-.html b/documentation/eu.nets.mia.data/-mi-a-payment-info/-init-.html index e79e348..62ee831 100644 --- a/documentation/eu.nets.mia.data/-mi-a-payment-info/-init-.html +++ b/documentation/eu.nets.mia.data/-mi-a-payment-info/-init-.html @@ -11,7 +11,9 @@

        <init>

        MiAPaymentInfo(parcel: Parcel)
        -MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?) +MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?)
        + +MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?, cancelUrl: String?) MiAPaymentInfo(paymentId: String, checkoutUrl: String)

        MiaPaymentInfo object containing the payment information required by the SDK

        First two parameters define the Merchant Hosted Payment Page integration type

        diff --git a/documentation/eu.nets.mia.data/-mi-a-payment-info/cancel-url.html b/documentation/eu.nets.mia.data/-mi-a-payment-info/cancel-url.html new file mode 100644 index 0000000..92d20a7 --- /dev/null +++ b/documentation/eu.nets.mia.data/-mi-a-payment-info/cancel-url.html @@ -0,0 +1,14 @@ + + + +MiAPaymentInfo.cancelUrl - mia + + + +mia / eu.nets.mia.data / MiAPaymentInfo / cancelUrl
        +
        +

        cancelUrl

        + +var cancelUrl: String? + + diff --git a/documentation/eu.nets.mia.data/-mi-a-payment-info/index.html b/documentation/eu.nets.mia.data/-mi-a-payment-info/index.html index 6d85d46..873b80f 100644 --- a/documentation/eu.nets.mia.data/-mi-a-payment-info/index.html +++ b/documentation/eu.nets.mia.data/-mi-a-payment-info/index.html @@ -43,7 +43,8 @@

        Constructors

        MiAPaymentInfo(parcel: Parcel)
        -MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?)MiAPaymentInfo(paymentId: String, checkoutUrl: String) +MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?)
        +MiAPaymentInfo(paymentId: String, checkoutUrl: String, returnUrl: String?, cancelUrl: String?)MiAPaymentInfo(paymentId: String, checkoutUrl: String)

        MiaPaymentInfo object containing the payment information required by the SDK

        @@ -54,6 +55,13 @@

        Properties

        +

        cancelUrl

        + + +var cancelUrl: String? + + +

        checkoutUrl

        diff --git a/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/-init-.html b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/-init-.html new file mode 100644 index 0000000..60bfcda --- /dev/null +++ b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/-init-.html @@ -0,0 +1,23 @@ + + + +HTMLInterceptor.<init> - mia + + + +mia / eu.nets.mia.utils / HTMLInterceptor / <init>
        +
        +

        <init>

        + +HTMLInterceptor() +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        + + diff --git a/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/index.html b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/index.html new file mode 100644 index 0000000..968ef15 --- /dev/null +++ b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/index.html @@ -0,0 +1,58 @@ + + + +HTMLInterceptor - mia + + + +mia / eu.nets.mia.utils / HTMLInterceptor
        +
        +

        HTMLInterceptor

        +open class HTMLInterceptor +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +HTMLInterceptor() +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        +
        +

        Functions

        + + + + + + + +
        +

        showHTML

        +
        +open fun showHTML(html: String): Unit +

        Java method used inside the WebView to log the requests and pages

        +
        + + diff --git a/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/show-h-t-m-l.html b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/show-h-t-m-l.html new file mode 100644 index 0000000..aa6bbde --- /dev/null +++ b/documentation/eu.nets.mia.utils/-h-t-m-l-interceptor/show-h-t-m-l.html @@ -0,0 +1,18 @@ + + + +HTMLInterceptor.showHTML - mia + + + +mia / eu.nets.mia.utils / HTMLInterceptor / showHTML
        +
        +

        showHTML

        + +open fun showHTML(html: String): Unit +

        Java method used inside the WebView to log the requests and pages

        +

        Parameters

        +

        +html - The page content

        + + diff --git a/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/-init-.html b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/-init-.html new file mode 100644 index 0000000..af49dcb --- /dev/null +++ b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/-init-.html @@ -0,0 +1,18 @@ + + + +JSCallbackInterceptor.<init> - mia + + + +mia / eu.nets.mia.utils / JSCallbackInterceptor / <init>
        +
        +

        <init>

        + +JSCallbackInterceptor(callback: JSPaymentCallback) +

        Constructor to prepare the JavaScript callback to be send in the SDK internal code

        +

        Parameters

        +

        +callback - JSPaymentCallback interface

        + + diff --git a/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/index.html b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/index.html new file mode 100644 index 0000000..ed5103b --- /dev/null +++ b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/index.html @@ -0,0 +1,50 @@ + + + +JSCallbackInterceptor - mia + + + +mia / eu.nets.mia.utils / JSCallbackInterceptor
        +
        +

        JSCallbackInterceptor

        +open class JSCallbackInterceptor +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +JSCallbackInterceptor(callback: JSPaymentCallback) +

        Constructor to prepare the JavaScript callback to be send in the SDK internal code

        +
        +

        Functions

        + + + + + + + +
        +

        notifyPaymentCompleted

        +
        +open fun notifyPaymentCompleted(): Unit +

        Method to be called from HTML merchant page, when the 'payment-completed' event has been triggered

        +
        + + diff --git a/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/notify-payment-completed.html b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/notify-payment-completed.html new file mode 100644 index 0000000..88cdcba --- /dev/null +++ b/documentation/eu.nets.mia.utils/-j-s-callback-interceptor/notify-payment-completed.html @@ -0,0 +1,15 @@ + + + +JSCallbackInterceptor.notifyPaymentCompleted - mia + + + +mia / eu.nets.mia.utils / JSCallbackInterceptor / notifyPaymentCompleted
        +
        +

        notifyPaymentCompleted

        + +open fun notifyPaymentCompleted(): Unit +

        Method to be called from HTML merchant page, when the 'payment-completed' event has been triggered

        + + diff --git a/documentation/eu.nets.mia.utils/-j-s-payment-callback/index.html b/documentation/eu.nets.mia.utils/-j-s-payment-callback/index.html new file mode 100644 index 0000000..9c3bb47 --- /dev/null +++ b/documentation/eu.nets.mia.utils/-j-s-payment-callback/index.html @@ -0,0 +1,63 @@ + + + +JSPaymentCallback - mia + + + +mia / eu.nets.mia.utils / JSPaymentCallback
        +
        +

        JSPaymentCallback

        +interface JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Functions

        + + + + + + + +
        +

        onPaymentCompleted

        +
        +abstract fun onPaymentCompleted(): Unit +

        Callback method to notify the SDK that the payment is completed and successful

        +
        +

        Inheritors

        + + + + + + + +
        +

        BaseWebViewPresenterImpl

        +
        +open class BaseWebViewPresenterImpl : BaseWebViewPresenter, JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.utils/-j-s-payment-callback/on-payment-completed.html b/documentation/eu.nets.mia.utils/-j-s-payment-callback/on-payment-completed.html new file mode 100644 index 0000000..3c38d95 --- /dev/null +++ b/documentation/eu.nets.mia.utils/-j-s-payment-callback/on-payment-completed.html @@ -0,0 +1,15 @@ + + + +JSPaymentCallback.onPaymentCompleted - mia + + + +mia / eu.nets.mia.utils / JSPaymentCallback / onPaymentCompleted
        +
        +

        onPaymentCompleted

        + +abstract fun onPaymentCompleted(): Unit +

        Callback method to notify the SDK that the payment is completed and successful

        + + diff --git a/documentation/eu.nets.mia.utils/index.html b/documentation/eu.nets.mia.utils/index.html new file mode 100644 index 0000000..cf3384b --- /dev/null +++ b/documentation/eu.nets.mia.utils/index.html @@ -0,0 +1,60 @@ + + + +eu.nets.mia.utils - mia + + + +mia / eu.nets.mia.utils
        +
        +

        Package eu.nets.mia.utils

        +

        Types

        + + + + + + + + + + + + + + + +
        +

        HTMLInterceptor

        +
        +open class HTMLInterceptor +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        +
        +

        JSCallbackInterceptor

        +
        +open class JSCallbackInterceptor +

        ****Copyright (c) 2020 Nets Denmark A/S***** +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS LICENSE AGREEMENT. BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        +
        +

        JSPaymentCallback

        +
        +interface JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/-init-.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/-init-.html new file mode 100644 index 0000000..c981abf --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/-init-.html @@ -0,0 +1,36 @@ + + + +BaseWebViewActivity.<init> - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / <init>
        +
        +

        <init>

        + +BaseWebViewActivity() +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-back-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-back-navigation.html new file mode 100644 index 0000000..87907c6 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-back-navigation.html @@ -0,0 +1,19 @@ + + + +BaseWebViewActivity.enableBackNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / enableBackNavigation
        +
        +

        enableBackNavigation

        + +open fun enableBackNavigation(enable: Boolean): Unit +

        Overrides BaseWebView.enableBackNavigation

        +

        Enable/disable the back button navigation

        +

        Parameters

        +

        +enable - flag to specify is button is enabled or disabled

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-forward-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-forward-navigation.html new file mode 100644 index 0000000..9d843fa --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/enable-forward-navigation.html @@ -0,0 +1,19 @@ + + + +BaseWebViewActivity.enableForwardNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / enableForwardNavigation
        +
        +

        enableForwardNavigation

        + +open fun enableForwardNavigation(enable: Boolean): Unit +

        Overrides BaseWebView.enableForwardNavigation

        +

        Enable/disable the forward button navigation

        +

        Parameters

        +

        +enable - flag to specify is button is enabled or disabled

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-u-r-l.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-u-r-l.html new file mode 100644 index 0000000..bd7e361 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-u-r-l.html @@ -0,0 +1,18 @@ + + + +BaseWebViewActivity.getCancelURL - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getCancelURL
        +
        +

        getCancelURL

        + +open fun getCancelURL(): String? +

        Overrides BaseWebView.getCancelURL

        +

        Returns the cancel URL received from the merchant app

        +

        Return
        +cancelUrl String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-url.html new file mode 100644 index 0000000..4839f4c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-cancel-url.html @@ -0,0 +1,14 @@ + + + +BaseWebViewActivity.getCancelUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getCancelUrl
        +
        +

        getCancelUrl

        + +abstract fun getCancelUrl(): String? + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-checkout-page.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-checkout-page.html new file mode 100644 index 0000000..baa619b --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-checkout-page.html @@ -0,0 +1,18 @@ + + + +BaseWebViewActivity.getCheckoutPage - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getCheckoutPage
        +
        +

        getCheckoutPage

        + +open fun getCheckoutPage(): String +

        Overrides BaseWebView.getCheckoutPage

        +

        Returns the checkout URL provided by merchant app

        +

        Return
        +URL String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-payment-identifier.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-payment-identifier.html new file mode 100644 index 0000000..e140fde --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-payment-identifier.html @@ -0,0 +1,18 @@ + + + +BaseWebViewActivity.getPaymentIdentifier - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getPaymentIdentifier
        +
        +

        getPaymentIdentifier

        + +open fun getPaymentIdentifier(): String +

        Overrides BaseWebView.getPaymentIdentifier

        +

        Returns the payment identifier provided by merchant app

        +

        Return
        +paymentId String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-redirect-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-redirect-url.html new file mode 100644 index 0000000..c71ff86 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-redirect-url.html @@ -0,0 +1,18 @@ + + + +BaseWebViewActivity.getRedirectUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getRedirectUrl
        +
        +

        getRedirectUrl

        + +open fun getRedirectUrl(): String? +

        Overrides BaseWebView.getRedirectUrl

        +

        Returns the return URL received from the merchant app

        +

        Return
        +returnUrl String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-return-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-return-url.html new file mode 100644 index 0000000..002262c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-return-url.html @@ -0,0 +1,14 @@ + + + +BaseWebViewActivity.getReturnUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getReturnUrl
        +
        +

        getReturnUrl

        + +abstract fun getReturnUrl(): String? + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-root-frame.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-root-frame.html new file mode 100644 index 0000000..5984112 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/get-root-frame.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.getRootFrame - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / getRootFrame
        +
        +

        getRootFrame

        + +open fun getRootFrame(): FrameLayout +

        Overrides BaseWebView.getRootFrame

        +

        Get the root view of the WebView to load multiple WebViews as child pop-ups

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/handle-nav-bar-action-text.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/handle-nav-bar-action-text.html new file mode 100644 index 0000000..33f2385 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/handle-nav-bar-action-text.html @@ -0,0 +1,20 @@ + + + +BaseWebViewActivity.handleNavBarActionText - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / handleNavBarActionText
        +
        +

        handleNavBarActionText

        + +open fun handleNavBarActionText(resId: Int): Unit +

        Overrides BaseWebView.handleNavBarActionText

        +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +

        Parameters

        +

        +resId - the resource id of the Drawable

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/index.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/index.html new file mode 100644 index 0000000..df414bd --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/index.html @@ -0,0 +1,275 @@ + + + +BaseWebViewActivity - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity
        +
        +

        BaseWebViewActivity

        +abstract class BaseWebViewActivity : AppCompatActivity, BaseWebView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +BaseWebViewActivity() +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        enableBackNavigation

        +
        +open fun enableBackNavigation(enable: Boolean): Unit +

        Enable/disable the back button navigation

        +
        +

        enableForwardNavigation

        +
        +open fun enableForwardNavigation(enable: Boolean): Unit +

        Enable/disable the forward button navigation

        +
        +

        getCancelURL

        +
        +open fun getCancelURL(): String? +

        Returns the cancel URL received from the merchant app

        +
        +

        getCancelUrl

        +
        +abstract fun getCancelUrl(): String?
        +

        getCheckoutPage

        +
        +open fun getCheckoutPage(): String +

        Returns the checkout URL provided by merchant app

        +
        +

        getPaymentIdentifier

        +
        +open fun getPaymentIdentifier(): String +

        Returns the payment identifier provided by merchant app

        +
        +

        getRedirectUrl

        +
        +open fun getRedirectUrl(): String? +

        Returns the return URL received from the merchant app

        +
        +

        getReturnUrl

        +
        +abstract fun getReturnUrl(): String?
        +

        getRootFrame

        +
        +open fun getRootFrame(): FrameLayout +

        Get the root view of the WebView to load multiple WebViews as child pop-ups

        +
        +

        handleNavBarActionText

        +
        +open fun handleNavBarActionText(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +
        +

        init

        +
        +open fun init(bundle: Bundle?): Unit +

        Initialize the UI listeners and setup the WebView configuration

        +
        +

        loadUrl

        +
        +open fun loadUrl(url: String, paymentId: String): Unit +

        Load the received URL in the parent WebView

        +
        +

        onBackPressed

        +
        +open fun onBackPressed(): Unit +

        Activity onBackPressed() +Check if there are opened WebView pop-ups to be closed. If not, navigate back

        +
        +

        onCreate

        +
        +open fun onCreate(savedInstanceState: Bundle?): Unit
        +

        onPause

        +
        +open fun onPause(): Unit +

        Activity onPause() +Call presenter onPause to pause the WebView timers

        +
        +

        onProcessCanceled

        +
        +abstract fun onProcessCanceled(): Unit
        +

        onProcessFinishedSuccess

        +
        +abstract fun onProcessFinishedSuccess(): Unit
        +

        onResume

        +
        +open fun onResume(): Unit +

        Activity onResume() +Call presenter onResume to store new state of view and to resume the WebView timers

        +
        +

        onStop

        +
        +open fun onStop(): Unit +

        Activity onStop() +Call presenter onStop to clear the state of view

        +
        +

        sendCancelResult

        +
        +open fun sendCancelResult(): Unit +

        Close the current activity and deliver canceled result to application

        +
        +

        sendOKResult

        +
        +open fun sendOKResult(): Unit +

        Close the current activity and deliver success result to application

        +
        +

        showProgressView

        +
        +open fun showProgressView(show: Boolean): Unit +

        Show/hide the loader based on WebView callbacks

        +
        +

        Inherited Functions

        + + + + + + + +
        +

        openBankIdApp

        +
        +abstract fun openBankIdApp(deepLink: String?): Unit +

        Case when customer's credit card supports BankId

        +
        +

        Inheritors

        + + + + + + + +
        +

        MiAActivity

        +
        +class MiAActivity : BaseWebViewActivity, MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/init.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/init.html new file mode 100644 index 0000000..8d4eefa --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/init.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.init - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / init
        +
        +

        init

        + +open fun init(bundle: Bundle?): Unit +

        Overrides BaseWebView.init

        +

        Initialize the UI listeners and setup the WebView configuration

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/load-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/load-url.html new file mode 100644 index 0000000..bea5bf3 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/load-url.html @@ -0,0 +1,21 @@ + + + +BaseWebViewActivity.loadUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / loadUrl
        +
        +

        loadUrl

        + +open fun loadUrl(url: String, paymentId: String): Unit +

        Overrides BaseWebView.loadUrl

        +

        Load the received URL in the parent WebView

        +

        Parameters

        +

        +url - the checkout URL provided by the merchant

        +

        +paymentId - the paymentId provided by the merchant

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-back-pressed.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-back-pressed.html new file mode 100644 index 0000000..06dd57e --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-back-pressed.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.onBackPressed - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onBackPressed
        +
        +

        onBackPressed

        + +open fun onBackPressed(): Unit +

        Activity onBackPressed() +Check if there are opened WebView pop-ups to be closed. If not, navigate back

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-create.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-create.html new file mode 100644 index 0000000..27f5b0c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-create.html @@ -0,0 +1,14 @@ + + + +BaseWebViewActivity.onCreate - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onCreate
        +
        +

        onCreate

        + +protected open fun onCreate(savedInstanceState: Bundle?): Unit + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-pause.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-pause.html new file mode 100644 index 0000000..42ac10f --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-pause.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.onPause - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onPause
        +
        +

        onPause

        + +protected open fun onPause(): Unit +

        Activity onPause() +Call presenter onPause to pause the WebView timers

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-canceled.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-canceled.html new file mode 100644 index 0000000..18103f8 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-canceled.html @@ -0,0 +1,14 @@ + + + +BaseWebViewActivity.onProcessCanceled - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onProcessCanceled
        +
        +

        onProcessCanceled

        + +abstract fun onProcessCanceled(): Unit + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-finished-success.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-finished-success.html new file mode 100644 index 0000000..372e7f1 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-process-finished-success.html @@ -0,0 +1,14 @@ + + + +BaseWebViewActivity.onProcessFinishedSuccess - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onProcessFinishedSuccess
        +
        +

        onProcessFinishedSuccess

        + +abstract fun onProcessFinishedSuccess(): Unit + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-resume.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-resume.html new file mode 100644 index 0000000..7663bf4 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-resume.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.onResume - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onResume
        +
        +

        onResume

        + +protected open fun onResume(): Unit +

        Activity onResume() +Call presenter onResume to store new state of view and to resume the WebView timers

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-stop.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-stop.html new file mode 100644 index 0000000..3060ee4 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/on-stop.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.onStop - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / onStop
        +
        +

        onStop

        + +protected open fun onStop(): Unit +

        Activity onStop() +Call presenter onStop to clear the state of view

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-cancel-result.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-cancel-result.html new file mode 100644 index 0000000..7c4e175 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-cancel-result.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.sendCancelResult - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / sendCancelResult
        +
        +

        sendCancelResult

        + +open fun sendCancelResult(): Unit +

        Overrides BaseWebView.sendCancelResult

        +

        Close the current activity and deliver canceled result to application

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-o-k-result.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-o-k-result.html new file mode 100644 index 0000000..bd97a5c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/send-o-k-result.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.sendOKResult - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / sendOKResult
        +
        +

        sendOKResult

        + +open fun sendOKResult(): Unit +

        Overrides BaseWebView.sendOKResult

        +

        Close the current activity and deliver success result to application

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-activity/show-progress-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/show-progress-view.html new file mode 100644 index 0000000..3397fda --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-activity/show-progress-view.html @@ -0,0 +1,16 @@ + + + +BaseWebViewActivity.showProgressView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewActivity / showProgressView
        +
        +

        showProgressView

        + +open fun showProgressView(show: Boolean): Unit +

        Overrides BaseWebView.showProgressView

        +

        Show/hide the loader based on WebView callbacks

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-init-.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-init-.html new file mode 100644 index 0000000..80e5565 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-init-.html @@ -0,0 +1,36 @@ + + + +BaseWebViewPresenterImpl.<init> - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / <init>
        +
        +

        <init>

        + +BaseWebViewPresenterImpl(mView: BaseWebView?) +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-t-a-g.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-t-a-g.html new file mode 100644 index 0000000..592b134 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/-t-a-g.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.TAG - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / TAG
        +
        +

        TAG

        + +val TAG: String + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/apply-web-view-settings.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/apply-web-view-settings.html new file mode 100644 index 0000000..9113d8d --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/apply-web-view-settings.html @@ -0,0 +1,21 @@ + + + +BaseWebViewPresenterImpl.applyWebViewSettings - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / applyWebViewSettings
        +
        +

        applyWebViewSettings

        + +open fun applyWebViewSettings(webView: WebView?): WebView? +

        Overrides BaseWebViewPresenter.applyWebViewSettings

        +

        Apply required settings to the given WebView

        +

        Parameters

        +

        +webView - The WebView which will be modified to have required settings

        +

        Return
        +WebView with specific settings

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-client.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-client.html new file mode 100644 index 0000000..3fd4b87 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-client.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.childWebViewClient - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / childWebViewClient
        +
        +

        childWebViewClient

        + +protected var childWebViewClient: WebViewClient + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-list.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-list.html new file mode 100644 index 0000000..08df843 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/child-web-view-list.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.childWebViewList - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / childWebViewList
        +
        +

        childWebViewList

        + +protected var childWebViewList: ArrayList<WebView> + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/configure-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/configure-web-view.html new file mode 100644 index 0000000..7c28fe5 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/configure-web-view.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenterImpl.configureWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / configureWebView
        +
        +

        configureWebView

        + +open fun configureWebView(webView: WebView?): Unit +

        Overrides BaseWebViewPresenter.configureWebView

        +

        Configure the useful settings for the WebView

        +

        Parameters

        +

        +webView - the WebView to be configured

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/create-child-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/create-child-web-view.html new file mode 100644 index 0000000..9ccd4ca --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/create-child-web-view.html @@ -0,0 +1,20 @@ + + + +BaseWebViewPresenterImpl.createChildWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / createChildWebView
        +
        +

        createChildWebView

        + +open fun createChildWebView(): WebView? +

        Overrides BaseWebViewPresenter.createChildWebView

        +

        Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) +It will have same functionalities as the parent, except the detection of the payment status. +Usually, this child will only show pages like: Help, Terms&Conditions, etc.

        +

        Return
        +WebView popup

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-back-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-back-navigation.html new file mode 100644 index 0000000..01d783d --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-back-navigation.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenterImpl.enableBackNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / enableBackNavigation
        +
        +

        enableBackNavigation

        + +open fun enableBackNavigation(enable: Boolean): Unit +

        Overrides BaseWebViewPresenter.enableBackNavigation

        +

        Mark Back button as enabled or disabled

        +

        Parameters

        +

        +enable - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-forward-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-forward-navigation.html new file mode 100644 index 0000000..b7a95a8 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/enable-forward-navigation.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenterImpl.enableForwardNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / enableForwardNavigation
        +
        +

        enableForwardNavigation

        + +open fun enableForwardNavigation(enable: Boolean): Unit +

        Overrides BaseWebViewPresenter.enableForwardNavigation

        +

        Mark Forward button as enabled or disabled

        +

        Parameters

        +

        +enable - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/get-latest-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/get-latest-web-view.html new file mode 100644 index 0000000..3fddc55 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/get-latest-web-view.html @@ -0,0 +1,18 @@ + + + +BaseWebViewPresenterImpl.getLatestWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / getLatestWebView
        +
        +

        getLatestWebView

        + +open fun getLatestWebView(): WebView? +

        Overrides BaseWebViewPresenter.getLatestWebView

        +

        Returns the latest loaded WebView (the visible one)

        +

        Return
        +WebView child or parent

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-nav-bar-action-icon.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-nav-bar-action-icon.html new file mode 100644 index 0000000..144c724 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-nav-bar-action-icon.html @@ -0,0 +1,20 @@ + + + +BaseWebViewPresenterImpl.handleNavBarActionIcon - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / handleNavBarActionIcon
        +
        +

        handleNavBarActionIcon

        + +open fun handleNavBarActionIcon(resId: Int): Unit +

        Overrides BaseWebViewPresenter.handleNavBarActionIcon

        +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +

        Parameters

        +

        +resId - the resource id of the Drawable

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-page-finished.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-page-finished.html new file mode 100644 index 0000000..8b757f7 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-page-finished.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.handlePageFinished - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / handlePageFinished
        +
        +

        handlePageFinished

        + +open fun handlePageFinished(url: String?): Unit +

        Overrides BaseWebViewPresenter.handlePageFinished

        +

        Handles the case of Canceled or Not Authenticated user cases

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-should-override-url-loading.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-should-override-url-loading.html new file mode 100644 index 0000000..d1d36d2 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/handle-should-override-url-loading.html @@ -0,0 +1,21 @@ + + + +BaseWebViewPresenterImpl.handleShouldOverrideUrlLoading - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / handleShouldOverrideUrlLoading
        +
        +

        handleShouldOverrideUrlLoading

        + +open fun handleShouldOverrideUrlLoading(url: String?): Boolean +

        Overrides BaseWebViewPresenter.handleShouldOverrideUrlLoading

        +

        In case of Easy Host Payment window integration type, do the following:

        +
        • check if the redirect happens to the url provided by the application
        • +
        • check if the redirect url contains the actual payment id
        • +
        • if so, stop the SDK process and deliver payment result OK
        • +
        +

        In case of other integration types, do nothing!

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/index.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/index.html new file mode 100644 index 0000000..cff4fed --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/index.html @@ -0,0 +1,305 @@ + + + +BaseWebViewPresenterImpl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl
        +
        +

        BaseWebViewPresenterImpl

        +open class BaseWebViewPresenterImpl : BaseWebViewPresenter, JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +BaseWebViewPresenterImpl(mView: BaseWebView?) +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        Properties

        + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        childWebViewClient

        +
        +var childWebViewClient: WebViewClient
        +

        childWebViewList

        +
        +var childWebViewList: ArrayList<WebView>
        +

        mView

        +
        +var mView: BaseWebView?
        +

        parentWebView

        +
        +var parentWebView: WebView?
        +

        parentWebViewClient

        +
        +var parentWebViewClient: WebViewClient
        +

        pdfViewerUrl

        +
        +val pdfViewerUrl: String
        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        applyWebViewSettings

        +
        +open fun applyWebViewSettings(webView: WebView?): WebView? +

        Apply required settings to the given WebView

        +
        +

        configureWebView

        +
        +open fun configureWebView(webView: WebView?): Unit +

        Configure the useful settings for the WebView

        +
        +

        createChildWebView

        +
        +open fun createChildWebView(): WebView? +

        Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) +It will have same functionalities as the parent, except the detection of the payment status. +Usually, this child will only show pages like: Help, Terms&Conditions, etc.

        +
        +

        enableBackNavigation

        +
        +open fun enableBackNavigation(enable: Boolean): Unit +

        Mark Back button as enabled or disabled

        +
        +

        enableForwardNavigation

        +
        +open fun enableForwardNavigation(enable: Boolean): Unit +

        Mark Forward button as enabled or disabled

        +
        +

        getLatestWebView

        +
        +open fun getLatestWebView(): WebView? +

        Returns the latest loaded WebView (the visible one)

        +
        +

        handleNavBarActionIcon

        +
        +open fun handleNavBarActionIcon(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +
        +

        handlePageFinished

        +
        +open fun handlePageFinished(url: String?): Unit +

        Handles the case of Canceled or Not Authenticated user cases

        +
        +

        handleShouldOverrideUrlLoading

        +
        +open fun handleShouldOverrideUrlLoading(url: String?): Boolean +

        In case of Easy Host Payment window integration type, do the following:

        +
        +

        notifyNavigationEnabled

        +
        +open fun notifyNavigationEnabled(): Unit +

        Send callbacks to activity to enable/disable both navigation arrows in the same time

        +
        +

        onBackPressed

        +
        +open fun onBackPressed(): Unit +

        Handles hardware back button interactions

        +
        +

        onCreate

        +
        +open fun onCreate(savedInstanceState: Bundle?): Unit +

        Initialize the view and make startup configurations

        +
        +

        onNavigateBack

        +
        +open fun onNavigateBack(): Unit +

        Navigate to previous loaded page in the visible WebView

        +
        +

        onNavigateForward

        +
        +open fun onNavigateForward(): Unit +

        Navigate to next loaded page in the visible WebView

        +
        +

        onPause

        +
        +open fun onPause(): Unit +

        Stop the JavaScript functions

        +
        +

        onPaymentCompleted

        +
        +open fun onPaymentCompleted(): Unit +

        Callback method to notify the SDK that the payment is completed and successful

        +
        +

        onResume

        +
        +open fun onResume(baseWebView: BaseWebView?): Unit +

        Update locally the recreated view instance and resume the WebView JavaScript functions

        +
        +

        onStop

        +
        +open fun onStop(): Unit +

        Remove the cached instance of the view

        +
        +

        pauseTimers

        +
        +open fun pauseTimers(): Unit +

        Pauses the JavaScript functions in WebView that are running periodically

        +
        +

        removeLatestWebView

        +
        +open fun removeLatestWebView(): Unit +

        Removed the visible WebView from UI and from local stack

        +
        +

        resumeTimers

        +
        +open fun resumeTimers(): Unit +

        Resumes the JavaScript functions in WebView that are running periodically

        +
        +

        Companion Object Properties

        + + + + + + + +
        +

        TAG

        +
        +val TAG: String
        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/m-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/m-view.html new file mode 100644 index 0000000..7160c34 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/m-view.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.mView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / mView
        +
        +

        mView

        + +var mView: BaseWebView? + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/notify-navigation-enabled.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/notify-navigation-enabled.html new file mode 100644 index 0000000..4d4a5d4 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/notify-navigation-enabled.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.notifyNavigationEnabled - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / notifyNavigationEnabled
        +
        +

        notifyNavigationEnabled

        + +open fun notifyNavigationEnabled(): Unit +

        Overrides BaseWebViewPresenter.notifyNavigationEnabled

        +

        Send callbacks to activity to enable/disable both navigation arrows in the same time

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-back-pressed.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-back-pressed.html new file mode 100644 index 0000000..cd4ec96 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-back-pressed.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onBackPressed - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onBackPressed
        +
        +

        onBackPressed

        + +open fun onBackPressed(): Unit +

        Overrides BaseWebViewPresenter.onBackPressed

        +

        Handles hardware back button interactions

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-create.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-create.html new file mode 100644 index 0000000..8d4082b --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-create.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onCreate - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onCreate
        +
        +

        onCreate

        + +open fun onCreate(savedInstanceState: Bundle?): Unit +

        Overrides BaseWebViewPresenter.onCreate

        +

        Initialize the view and make startup configurations

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-back.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-back.html new file mode 100644 index 0000000..84474b9 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-back.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onNavigateBack - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onNavigateBack
        +
        +

        onNavigateBack

        + +open fun onNavigateBack(): Unit +

        Overrides BaseWebViewPresenter.onNavigateBack

        +

        Navigate to previous loaded page in the visible WebView

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-forward.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-forward.html new file mode 100644 index 0000000..aac0f54 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-navigate-forward.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onNavigateForward - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onNavigateForward
        +
        +

        onNavigateForward

        + +open fun onNavigateForward(): Unit +

        Overrides BaseWebViewPresenter.onNavigateForward

        +

        Navigate to next loaded page in the visible WebView

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-pause.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-pause.html new file mode 100644 index 0000000..07f5957 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-pause.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onPause - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onPause
        +
        +

        onPause

        + +open fun onPause(): Unit +

        Overrides BaseWebViewPresenter.onPause

        +

        Stop the JavaScript functions

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-payment-completed.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-payment-completed.html new file mode 100644 index 0000000..95e711b --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-payment-completed.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onPaymentCompleted - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onPaymentCompleted
        +
        +

        onPaymentCompleted

        + +open fun onPaymentCompleted(): Unit +

        Overrides JSPaymentCallback.onPaymentCompleted

        +

        Callback method to notify the SDK that the payment is completed and successful

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-resume.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-resume.html new file mode 100644 index 0000000..d451f74 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-resume.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenterImpl.onResume - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onResume
        +
        +

        onResume

        + +open fun onResume(baseWebView: BaseWebView?): Unit +

        Overrides BaseWebViewPresenter.onResume

        +

        Update locally the recreated view instance and resume the WebView JavaScript functions

        +

        Parameters

        +

        +baseWebView - recreated instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-stop.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-stop.html new file mode 100644 index 0000000..d7bae80 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/on-stop.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.onStop - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / onStop
        +
        +

        onStop

        + +open fun onStop(): Unit +

        Overrides BaseWebViewPresenter.onStop

        +

        Remove the cached instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view-client.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view-client.html new file mode 100644 index 0000000..a374abe --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view-client.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.parentWebViewClient - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / parentWebViewClient
        +
        +

        parentWebViewClient

        + +protected var parentWebViewClient: WebViewClient + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view.html new file mode 100644 index 0000000..b3a435d --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/parent-web-view.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.parentWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / parentWebView
        +
        +

        parentWebView

        + +protected var parentWebView: WebView? + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pause-timers.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pause-timers.html new file mode 100644 index 0000000..b9211a0 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pause-timers.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.pauseTimers - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / pauseTimers
        +
        +

        pauseTimers

        + +open fun pauseTimers(): Unit +

        Overrides BaseWebViewPresenter.pauseTimers

        +

        Pauses the JavaScript functions in WebView that are running periodically

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pdf-viewer-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pdf-viewer-url.html new file mode 100644 index 0000000..2c73231 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/pdf-viewer-url.html @@ -0,0 +1,14 @@ + + + +BaseWebViewPresenterImpl.pdfViewerUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / pdfViewerUrl
        +
        +

        pdfViewerUrl

        + +protected val pdfViewerUrl: String + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/remove-latest-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/remove-latest-web-view.html new file mode 100644 index 0000000..9a03baf --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/remove-latest-web-view.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.removeLatestWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / removeLatestWebView
        +
        +

        removeLatestWebView

        + +open fun removeLatestWebView(): Unit +

        Overrides BaseWebViewPresenter.removeLatestWebView

        +

        Removed the visible WebView from UI and from local stack

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/resume-timers.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/resume-timers.html new file mode 100644 index 0000000..4323507 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter-impl/resume-timers.html @@ -0,0 +1,16 @@ + + + +BaseWebViewPresenterImpl.resumeTimers - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenterImpl / resumeTimers
        +
        +

        resumeTimers

        + +open fun resumeTimers(): Unit +

        Overrides BaseWebViewPresenter.resumeTimers

        +

        Resumes the JavaScript functions in WebView that are running periodically

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/apply-web-view-settings.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/apply-web-view-settings.html new file mode 100644 index 0000000..43bf71a --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/apply-web-view-settings.html @@ -0,0 +1,20 @@ + + + +BaseWebViewPresenter.applyWebViewSettings - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / applyWebViewSettings
        +
        +

        applyWebViewSettings

        + +abstract fun applyWebViewSettings(webView: WebView?): WebView? +

        Apply required settings to the given WebView

        +

        Parameters

        +

        +webView - The WebView which will be modified to have required settings

        +

        Return
        +WebView with specific settings

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/configure-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/configure-web-view.html new file mode 100644 index 0000000..0d61961 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/configure-web-view.html @@ -0,0 +1,18 @@ + + + +BaseWebViewPresenter.configureWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / configureWebView
        +
        +

        configureWebView

        + +abstract fun configureWebView(webView: WebView?): Unit +

        Configure the useful settings for the WebView

        +

        Parameters

        +

        +webView - the WebView to be configured

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/create-child-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/create-child-web-view.html new file mode 100644 index 0000000..e34e7eb --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/create-child-web-view.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenter.createChildWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / createChildWebView
        +
        +

        createChildWebView

        + +abstract fun createChildWebView(): WebView? +

        Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) +It will have same functionalities as the parent, except the detection of the payment status. +Usually, this child will only show pages like: Help, Terms&Conditions, etc.

        +

        Return
        +WebView popup

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-back-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-back-navigation.html new file mode 100644 index 0000000..4b6cb72 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-back-navigation.html @@ -0,0 +1,18 @@ + + + +BaseWebViewPresenter.enableBackNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / enableBackNavigation
        +
        +

        enableBackNavigation

        + +abstract fun enableBackNavigation(enable: Boolean): Unit +

        Mark Back button as enabled or disabled

        +

        Parameters

        +

        +enable - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-forward-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-forward-navigation.html new file mode 100644 index 0000000..577586c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/enable-forward-navigation.html @@ -0,0 +1,18 @@ + + + +BaseWebViewPresenter.enableForwardNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / enableForwardNavigation
        +
        +

        enableForwardNavigation

        + +abstract fun enableForwardNavigation(enable: Boolean): Unit +

        Mark Forward button as enabled or disabled

        +

        Parameters

        +

        +enable - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/get-latest-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/get-latest-web-view.html new file mode 100644 index 0000000..57b4be2 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/get-latest-web-view.html @@ -0,0 +1,17 @@ + + + +BaseWebViewPresenter.getLatestWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / getLatestWebView
        +
        +

        getLatestWebView

        + +abstract fun getLatestWebView(): WebView? +

        Returns the latest loaded WebView (the visible one)

        +

        Return
        +WebView child or parent

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-nav-bar-action-icon.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-nav-bar-action-icon.html new file mode 100644 index 0000000..0dbcdc9 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-nav-bar-action-icon.html @@ -0,0 +1,19 @@ + + + +BaseWebViewPresenter.handleNavBarActionIcon - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / handleNavBarActionIcon
        +
        +

        handleNavBarActionIcon

        + +abstract fun handleNavBarActionIcon(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +

        Parameters

        +

        +resId - the resource id of the Drawable

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-page-finished.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-page-finished.html new file mode 100644 index 0000000..063a408 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-page-finished.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.handlePageFinished - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / handlePageFinished
        +
        +

        handlePageFinished

        + +abstract fun handlePageFinished(url: String?): Unit +

        Handles the case of Canceled or Not Authenticated user cases

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-should-override-url-loading.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-should-override-url-loading.html new file mode 100644 index 0000000..51d5a4d --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/handle-should-override-url-loading.html @@ -0,0 +1,20 @@ + + + +BaseWebViewPresenter.handleShouldOverrideUrlLoading - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / handleShouldOverrideUrlLoading
        +
        +

        handleShouldOverrideUrlLoading

        + +abstract fun handleShouldOverrideUrlLoading(url: String?): Boolean +

        In case of Easy Host Payment window integration type, do the following:

        +
        • check if the redirect happens to the url provided by the application
        • +
        • check if the redirect url contains the actual payment id
        • +
        • if so, stop the SDK process and deliver payment result OK
        • +
        +

        In case of other integration types, do nothing!

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/index.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/index.html new file mode 100644 index 0000000..5682adf --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/index.html @@ -0,0 +1,237 @@ + + + +BaseWebViewPresenter - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter
        +
        +

        BaseWebViewPresenter

        +interface BaseWebViewPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        applyWebViewSettings

        +
        +abstract fun applyWebViewSettings(webView: WebView?): WebView? +

        Apply required settings to the given WebView

        +
        +

        configureWebView

        +
        +abstract fun configureWebView(webView: WebView?): Unit +

        Configure the useful settings for the WebView

        +
        +

        createChildWebView

        +
        +abstract fun createChildWebView(): WebView? +

        Creates a new WebView called "Child" to be loaded on top of the parent (pop-up) +It will have same functionalities as the parent, except the detection of the payment status. +Usually, this child will only show pages like: Help, Terms&Conditions, etc.

        +
        +

        enableBackNavigation

        +
        +abstract fun enableBackNavigation(enable: Boolean): Unit +

        Mark Back button as enabled or disabled

        +
        +

        enableForwardNavigation

        +
        +abstract fun enableForwardNavigation(enable: Boolean): Unit +

        Mark Forward button as enabled or disabled

        +
        +

        getLatestWebView

        +
        +abstract fun getLatestWebView(): WebView? +

        Returns the latest loaded WebView (the visible one)

        +
        +

        handleNavBarActionIcon

        +
        +abstract fun handleNavBarActionIcon(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +
        +

        handlePageFinished

        +
        +abstract fun handlePageFinished(url: String?): Unit +

        Handles the case of Canceled or Not Authenticated user cases

        +
        +

        handleShouldOverrideUrlLoading

        +
        +abstract fun handleShouldOverrideUrlLoading(url: String?): Boolean +

        In case of Easy Host Payment window integration type, do the following:

        +
        +

        notifyNavigationEnabled

        +
        +abstract fun notifyNavigationEnabled(): Unit +

        Send callbacks to activity to enable/disable both navigation arrows in the same time

        +
        +

        onBackPressed

        +
        +abstract fun onBackPressed(): Unit +

        Handles hardware back button interactions

        +
        +

        onCreate

        +
        +abstract fun onCreate(savedInstanceState: Bundle?): Unit +

        Initialize the view and make startup configurations

        +
        +

        onNavigateBack

        +
        +abstract fun onNavigateBack(): Unit +

        Navigate to previous loaded page in the visible WebView

        +
        +

        onNavigateForward

        +
        +abstract fun onNavigateForward(): Unit +

        Navigate to next loaded page in the visible WebView

        +
        +

        onPause

        +
        +abstract fun onPause(): Unit +

        Stop the JavaScript functions

        +
        +

        onResume

        +
        +abstract fun onResume(baseWebView: BaseWebView?): Unit +

        Update locally the recreated view instance and resume the WebView JavaScript functions

        +
        +

        onStop

        +
        +abstract fun onStop(): Unit +

        Remove the cached instance of the view

        +
        +

        pauseTimers

        +
        +abstract fun pauseTimers(): Unit +

        Pauses the JavaScript functions in WebView that are running periodically

        +
        +

        removeLatestWebView

        +
        +abstract fun removeLatestWebView(): Unit +

        Removed the visible WebView from UI and from local stack

        +
        +

        resumeTimers

        +
        +abstract fun resumeTimers(): Unit +

        Resumes the JavaScript functions in WebView that are running periodically

        +
        +

        Inheritors

        + + + + + + + +
        +

        BaseWebViewPresenterImpl

        +
        +open class BaseWebViewPresenterImpl : BaseWebViewPresenter, JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/notify-navigation-enabled.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/notify-navigation-enabled.html new file mode 100644 index 0000000..f12b562 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/notify-navigation-enabled.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.notifyNavigationEnabled - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / notifyNavigationEnabled
        +
        +

        notifyNavigationEnabled

        + +abstract fun notifyNavigationEnabled(): Unit +

        Send callbacks to activity to enable/disable both navigation arrows in the same time

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-back-pressed.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-back-pressed.html new file mode 100644 index 0000000..4ebff60 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-back-pressed.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onBackPressed - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onBackPressed
        +
        +

        onBackPressed

        + +abstract fun onBackPressed(): Unit +

        Handles hardware back button interactions

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-create.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-create.html new file mode 100644 index 0000000..874cf95 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-create.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onCreate - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onCreate
        +
        +

        onCreate

        + +abstract fun onCreate(savedInstanceState: Bundle?): Unit +

        Initialize the view and make startup configurations

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-back.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-back.html new file mode 100644 index 0000000..c6a4f70 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-back.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onNavigateBack - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onNavigateBack
        +
        +

        onNavigateBack

        + +abstract fun onNavigateBack(): Unit +

        Navigate to previous loaded page in the visible WebView

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-forward.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-forward.html new file mode 100644 index 0000000..2e6dad1 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-navigate-forward.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onNavigateForward - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onNavigateForward
        +
        +

        onNavigateForward

        + +abstract fun onNavigateForward(): Unit +

        Navigate to next loaded page in the visible WebView

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-pause.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-pause.html new file mode 100644 index 0000000..51a7dc9 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-pause.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onPause - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onPause
        +
        +

        onPause

        + +abstract fun onPause(): Unit +

        Stop the JavaScript functions

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-resume.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-resume.html new file mode 100644 index 0000000..019b499 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-resume.html @@ -0,0 +1,18 @@ + + + +BaseWebViewPresenter.onResume - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onResume
        +
        +

        onResume

        + +abstract fun onResume(baseWebView: BaseWebView?): Unit +

        Update locally the recreated view instance and resume the WebView JavaScript functions

        +

        Parameters

        +

        +baseWebView - recreated instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-stop.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-stop.html new file mode 100644 index 0000000..30c150c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/on-stop.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.onStop - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / onStop
        +
        +

        onStop

        + +abstract fun onStop(): Unit +

        Remove the cached instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/pause-timers.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/pause-timers.html new file mode 100644 index 0000000..2d041af --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/pause-timers.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.pauseTimers - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / pauseTimers
        +
        +

        pauseTimers

        + +abstract fun pauseTimers(): Unit +

        Pauses the JavaScript functions in WebView that are running periodically

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/remove-latest-web-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/remove-latest-web-view.html new file mode 100644 index 0000000..01604a1 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/remove-latest-web-view.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.removeLatestWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / removeLatestWebView
        +
        +

        removeLatestWebView

        + +abstract fun removeLatestWebView(): Unit +

        Removed the visible WebView from UI and from local stack

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/resume-timers.html b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/resume-timers.html new file mode 100644 index 0000000..264f8c4 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view-presenter/resume-timers.html @@ -0,0 +1,15 @@ + + + +BaseWebViewPresenter.resumeTimers - mia + + + +mia / eu.nets.mia.webview.base / BaseWebViewPresenter / resumeTimers
        +
        +

        resumeTimers

        + +abstract fun resumeTimers(): Unit +

        Resumes the JavaScript functions in WebView that are running periodically

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/enable-back-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view/enable-back-navigation.html new file mode 100644 index 0000000..4741d87 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/enable-back-navigation.html @@ -0,0 +1,18 @@ + + + +BaseWebView.enableBackNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / enableBackNavigation
        +
        +

        enableBackNavigation

        + +abstract fun enableBackNavigation(enable: Boolean): Unit +

        Enable/disable the back button navigation

        +

        Parameters

        +

        +enable - flag to specify is button is enabled or disabled

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/enable-forward-navigation.html b/documentation/eu.nets.mia.webview.base/-base-web-view/enable-forward-navigation.html new file mode 100644 index 0000000..86448f2 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/enable-forward-navigation.html @@ -0,0 +1,18 @@ + + + +BaseWebView.enableForwardNavigation - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / enableForwardNavigation
        +
        +

        enableForwardNavigation

        + +abstract fun enableForwardNavigation(enable: Boolean): Unit +

        Enable/disable the forward button navigation

        +

        Parameters

        +

        +enable - flag to specify is button is enabled or disabled

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/get-cancel-u-r-l.html b/documentation/eu.nets.mia.webview.base/-base-web-view/get-cancel-u-r-l.html new file mode 100644 index 0000000..3c7a8c7 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/get-cancel-u-r-l.html @@ -0,0 +1,17 @@ + + + +BaseWebView.getCancelURL - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / getCancelURL
        +
        +

        getCancelURL

        + +abstract fun getCancelURL(): String? +

        Returns the cancel URL received from the merchant app

        +

        Return
        +cancelUrl String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/get-checkout-page.html b/documentation/eu.nets.mia.webview.base/-base-web-view/get-checkout-page.html new file mode 100644 index 0000000..a1b8a17 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/get-checkout-page.html @@ -0,0 +1,17 @@ + + + +BaseWebView.getCheckoutPage - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / getCheckoutPage
        +
        +

        getCheckoutPage

        + +abstract fun getCheckoutPage(): String +

        Returns the checkout URL provided by merchant app

        +

        Return
        +URL String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/get-payment-identifier.html b/documentation/eu.nets.mia.webview.base/-base-web-view/get-payment-identifier.html new file mode 100644 index 0000000..c40543d --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/get-payment-identifier.html @@ -0,0 +1,17 @@ + + + +BaseWebView.getPaymentIdentifier - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / getPaymentIdentifier
        +
        +

        getPaymentIdentifier

        + +abstract fun getPaymentIdentifier(): String +

        Returns the payment identifier provided by merchant app

        +

        Return
        +paymentId String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/get-redirect-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view/get-redirect-url.html new file mode 100644 index 0000000..b3a8d11 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/get-redirect-url.html @@ -0,0 +1,17 @@ + + + +BaseWebView.getRedirectUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / getRedirectUrl
        +
        +

        getRedirectUrl

        + +abstract fun getRedirectUrl(): String? +

        Returns the return URL received from the merchant app

        +

        Return
        +returnUrl String

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/get-root-frame.html b/documentation/eu.nets.mia.webview.base/-base-web-view/get-root-frame.html new file mode 100644 index 0000000..cf25873 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/get-root-frame.html @@ -0,0 +1,15 @@ + + + +BaseWebView.getRootFrame - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / getRootFrame
        +
        +

        getRootFrame

        + +abstract fun getRootFrame(): FrameLayout +

        Get the root view of the WebView to load multiple WebViews as child pop-ups

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/handle-nav-bar-action-text.html b/documentation/eu.nets.mia.webview.base/-base-web-view/handle-nav-bar-action-text.html new file mode 100644 index 0000000..d653bba --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/handle-nav-bar-action-text.html @@ -0,0 +1,19 @@ + + + +BaseWebView.handleNavBarActionText - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / handleNavBarActionText
        +
        +

        handleNavBarActionText

        + +abstract fun handleNavBarActionText(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +

        Parameters

        +

        +resId - the resource id of the Drawable

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/index.html b/documentation/eu.nets.mia.webview.base/-base-web-view/index.html new file mode 100644 index 0000000..0770eb7 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/index.html @@ -0,0 +1,181 @@ + + + +BaseWebView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView
        +
        +

        BaseWebView

        +interface BaseWebView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        enableBackNavigation

        +
        +abstract fun enableBackNavigation(enable: Boolean): Unit +

        Enable/disable the back button navigation

        +
        +

        enableForwardNavigation

        +
        +abstract fun enableForwardNavigation(enable: Boolean): Unit +

        Enable/disable the forward button navigation

        +
        +

        getCancelURL

        +
        +abstract fun getCancelURL(): String? +

        Returns the cancel URL received from the merchant app

        +
        +

        getCheckoutPage

        +
        +abstract fun getCheckoutPage(): String +

        Returns the checkout URL provided by merchant app

        +
        +

        getPaymentIdentifier

        +
        +abstract fun getPaymentIdentifier(): String +

        Returns the payment identifier provided by merchant app

        +
        +

        getRedirectUrl

        +
        +abstract fun getRedirectUrl(): String? +

        Returns the return URL received from the merchant app

        +
        +

        getRootFrame

        +
        +abstract fun getRootFrame(): FrameLayout +

        Get the root view of the WebView to load multiple WebViews as child pop-ups

        +
        +

        handleNavBarActionText

        +
        +abstract fun handleNavBarActionText(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +
        +

        init

        +
        +abstract fun init(bundle: Bundle?): Unit +

        Initialize the UI listeners and setup the WebView configuration

        +
        +

        loadUrl

        +
        +abstract fun loadUrl(url: String, paymentId: String): Unit +

        Load the received URL in the parent WebView

        +
        +

        openBankIdApp

        +
        +abstract fun openBankIdApp(deepLink: String?): Unit +

        Case when customer's credit card supports BankId

        +
        +

        sendCancelResult

        +
        +abstract fun sendCancelResult(): Unit +

        Close the current activity and deliver canceled result to application

        +
        +

        sendOKResult

        +
        +abstract fun sendOKResult(): Unit +

        Close the current activity and deliver success result to application

        +
        +

        showProgressView

        +
        +abstract fun showProgressView(show: Boolean): Unit +

        Show/hide the loader based on WebView callbacks

        +
        +

        Inheritors

        + + + + + + + +
        +

        BaseWebViewActivity

        +
        +abstract class BaseWebViewActivity : AppCompatActivity, BaseWebView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/init.html b/documentation/eu.nets.mia.webview.base/-base-web-view/init.html new file mode 100644 index 0000000..6bff1f0 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/init.html @@ -0,0 +1,15 @@ + + + +BaseWebView.init - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / init
        +
        +

        init

        + +abstract fun init(bundle: Bundle?): Unit +

        Initialize the UI listeners and setup the WebView configuration

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/load-url.html b/documentation/eu.nets.mia.webview.base/-base-web-view/load-url.html new file mode 100644 index 0000000..bd848b1 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/load-url.html @@ -0,0 +1,20 @@ + + + +BaseWebView.loadUrl - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / loadUrl
        +
        +

        loadUrl

        + +abstract fun loadUrl(url: String, paymentId: String): Unit +

        Load the received URL in the parent WebView

        +

        Parameters

        +

        +url - the checkout URL provided by the merchant

        +

        +paymentId - the paymentId provided by the merchant

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/open-bank-id-app.html b/documentation/eu.nets.mia.webview.base/-base-web-view/open-bank-id-app.html new file mode 100644 index 0000000..d1e52ec --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/open-bank-id-app.html @@ -0,0 +1,19 @@ + + + +BaseWebView.openBankIdApp - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / openBankIdApp
        +
        +

        openBankIdApp

        + +abstract fun openBankIdApp(deepLink: String?): Unit +

        Case when customer's credit card supports BankId

        +

        Parameters

        +

        +deepLink - bankId deeplink URL for app switch; +(if it's null, will launch the app using launcher intent; of not, will launch it using scheme url)

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/send-cancel-result.html b/documentation/eu.nets.mia.webview.base/-base-web-view/send-cancel-result.html new file mode 100644 index 0000000..013f19b --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/send-cancel-result.html @@ -0,0 +1,15 @@ + + + +BaseWebView.sendCancelResult - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / sendCancelResult
        +
        +

        sendCancelResult

        + +abstract fun sendCancelResult(): Unit +

        Close the current activity and deliver canceled result to application

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/send-o-k-result.html b/documentation/eu.nets.mia.webview.base/-base-web-view/send-o-k-result.html new file mode 100644 index 0000000..317a994 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/send-o-k-result.html @@ -0,0 +1,15 @@ + + + +BaseWebView.sendOKResult - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / sendOKResult
        +
        +

        sendOKResult

        + +abstract fun sendOKResult(): Unit +

        Close the current activity and deliver success result to application

        + + diff --git a/documentation/eu.nets.mia.webview.base/-base-web-view/show-progress-view.html b/documentation/eu.nets.mia.webview.base/-base-web-view/show-progress-view.html new file mode 100644 index 0000000..3fb92a0 --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/-base-web-view/show-progress-view.html @@ -0,0 +1,15 @@ + + + +BaseWebView.showProgressView - mia + + + +mia / eu.nets.mia.webview.base / BaseWebView / showProgressView
        +
        +

        showProgressView

        + +abstract fun showProgressView(show: Boolean): Unit +

        Show/hide the loader based on WebView callbacks

        + + diff --git a/documentation/eu.nets.mia.webview.base/index.html b/documentation/eu.nets.mia.webview.base/index.html new file mode 100644 index 0000000..50eb26c --- /dev/null +++ b/documentation/eu.nets.mia.webview.base/index.html @@ -0,0 +1,53 @@ + + + +eu.nets.mia.webview.base - mia + + + +mia / eu.nets.mia.webview.base
        +
        +

        Package eu.nets.mia.webview.base

        +

        Types

        + + + + + + + + + + + + + + + + + + + +
        +

        BaseWebView

        +
        +interface BaseWebView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        BaseWebViewActivity

        +
        +abstract class BaseWebViewActivity : AppCompatActivity, BaseWebView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        BaseWebViewPresenter

        +
        +interface BaseWebViewPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        BaseWebViewPresenterImpl

        +
        +open class BaseWebViewPresenterImpl : BaseWebViewPresenter, JSPaymentCallback +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/-init-.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/-init-.html new file mode 100644 index 0000000..919f981 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/-init-.html @@ -0,0 +1,36 @@ + + + +MiAActivityPresenterImpl.<init> - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / <init>
        +
        +

        <init>

        + +MiAActivityPresenterImpl(miaActivityView: MiAActivityView?) +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/index.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/index.html new file mode 100644 index 0000000..b509684 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/index.html @@ -0,0 +1,102 @@ + + + +MiAActivityPresenterImpl - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl
        +
        +

        MiAActivityPresenterImpl

        +open class MiAActivityPresenterImpl : MiAActivityPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +MiAActivityPresenterImpl(miaActivityView: MiAActivityView?) +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        Properties

        + + + + + + + +
        +

        miaActivityView

        +
        +var miaActivityView: MiAActivityView?
        +

        Functions

        + + + + + + + + + + + + + + + + + + + +
        +

        init

        +
        +open fun init(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView

        +
        +

        loadCheckoutPage

        +
        +open fun loadCheckoutPage(): Unit +

        Notify the view to load the checkoutUrl page

        +
        +

        onResume

        +
        +open fun onResume(miaActivityView: MiAActivityView?): Unit +

        Update locally the recreated view instance

        +
        +

        onStop

        +
        +open fun onStop(): Unit +

        Remove the cached instance of the view

        +
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/init.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/init.html new file mode 100644 index 0000000..d5bf9e6 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/init.html @@ -0,0 +1,20 @@ + + + +MiAActivityPresenterImpl.init - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / init
        +
        +

        init

        + +open fun init(bundle: Bundle?): Unit +

        Overrides MiAActivityPresenter.init

        +

        Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView

        +

        Parameters

        +

        +bundle - Can be the Intent bundle data (from the merchant app directly), or + savedInstanceState bundle data (SDK stored in case the app goes to background)

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/load-checkout-page.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/load-checkout-page.html new file mode 100644 index 0000000..05f5908 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/load-checkout-page.html @@ -0,0 +1,16 @@ + + + +MiAActivityPresenterImpl.loadCheckoutPage - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / loadCheckoutPage
        +
        +

        loadCheckoutPage

        + +open fun loadCheckoutPage(): Unit +

        Overrides MiAActivityPresenter.loadCheckoutPage

        +

        Notify the view to load the checkoutUrl page

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/mia-activity-view.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/mia-activity-view.html new file mode 100644 index 0000000..77247df --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/mia-activity-view.html @@ -0,0 +1,14 @@ + + + +MiAActivityPresenterImpl.miaActivityView - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / miaActivityView
        +
        +

        miaActivityView

        + +var miaActivityView: MiAActivityView? + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-resume.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-resume.html new file mode 100644 index 0000000..74583e2 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-resume.html @@ -0,0 +1,19 @@ + + + +MiAActivityPresenterImpl.onResume - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / onResume
        +
        +

        onResume

        + +open fun onResume(miaActivityView: MiAActivityView?): Unit +

        Overrides MiAActivityPresenter.onResume

        +

        Update locally the recreated view instance

        +

        Parameters

        +

        +miaActivityView - recreated instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-stop.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-stop.html new file mode 100644 index 0000000..aa376cb --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter-impl/on-stop.html @@ -0,0 +1,16 @@ + + + +MiAActivityPresenterImpl.onStop - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenterImpl / onStop
        +
        +

        onStop

        + +open fun onStop(): Unit +

        Overrides MiAActivityPresenter.onStop

        +

        Remove the cached instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/index.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/index.html new file mode 100644 index 0000000..3b71997 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/index.html @@ -0,0 +1,90 @@ + + + +MiAActivityPresenter - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenter
        +
        +

        MiAActivityPresenter

        +interface MiAActivityPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Functions

        + + + + + + + + + + + + + + + + + + + +
        +

        init

        +
        +abstract fun init(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView

        +
        +

        loadCheckoutPage

        +
        +abstract fun loadCheckoutPage(): Unit +

        Notify the view to load the checkoutUrl page

        +
        +

        onResume

        +
        +abstract fun onResume(miaActivityView: MiAActivityView?): Unit +

        Update locally the recreated view instance

        +
        +

        onStop

        +
        +abstract fun onStop(): Unit +

        Remove the cached instance of the view

        +
        +

        Inheritors

        + + + + + + + +
        +

        MiAActivityPresenterImpl

        +
        +open class MiAActivityPresenterImpl : MiAActivityPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/init.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/init.html new file mode 100644 index 0000000..f464e4a --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/init.html @@ -0,0 +1,19 @@ + + + +MiAActivityPresenter.init - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenter / init
        +
        +

        init

        + +abstract fun init(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app, and load the checkoutUrl receive from merchat app into the WebView

        +

        Parameters

        +

        +bundle - Can be the Intent bundle data (from the merchant app directly), or + savedInstanceState bundle data (SDK stored in case the app goes to background)

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/load-checkout-page.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/load-checkout-page.html new file mode 100644 index 0000000..94c8366 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/load-checkout-page.html @@ -0,0 +1,15 @@ + + + +MiAActivityPresenter.loadCheckoutPage - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenter / loadCheckoutPage
        +
        +

        loadCheckoutPage

        + +abstract fun loadCheckoutPage(): Unit +

        Notify the view to load the checkoutUrl page

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-resume.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-resume.html new file mode 100644 index 0000000..85ff147 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-resume.html @@ -0,0 +1,18 @@ + + + +MiAActivityPresenter.onResume - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenter / onResume
        +
        +

        onResume

        + +abstract fun onResume(miaActivityView: MiAActivityView?): Unit +

        Update locally the recreated view instance

        +

        Parameters

        +

        +miaActivityView - recreated instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-stop.html b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-stop.html new file mode 100644 index 0000000..7d5cd7b --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-presenter/on-stop.html @@ -0,0 +1,15 @@ + + + +MiAActivityPresenter.onStop - mia + + + +mia / eu.nets.mia.webview / MiAActivityPresenter / onStop
        +
        +

        onStop

        + +abstract fun onStop(): Unit +

        Remove the cached instance of the view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-checkout-url.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-checkout-url.html new file mode 100644 index 0000000..2bc4439 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-checkout-url.html @@ -0,0 +1,17 @@ + + + +MiAActivityView.getCheckoutUrl - mia + + + +mia / eu.nets.mia.webview / MiAActivityView / getCheckoutUrl
        +
        +

        getCheckoutUrl

        + +abstract fun getCheckoutUrl(): String? +

        Returns the checkout URL received from the merchant app

        +

        Return
        +URL String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-payment-id.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-payment-id.html new file mode 100644 index 0000000..47f6271 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/get-payment-id.html @@ -0,0 +1,17 @@ + + + +MiAActivityView.getPaymentId - mia + + + +mia / eu.nets.mia.webview / MiAActivityView / getPaymentId
        +
        +

        getPaymentId

        + +abstract fun getPaymentId(): String? +

        Returns the paymentId received from the merchant app

        +

        Return
        +paymentId String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/index.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/index.html new file mode 100644 index 0000000..7395614 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/index.html @@ -0,0 +1,99 @@ + + + +MiAActivityView - mia + + + +mia / eu.nets.mia.webview / MiAActivityView
        +
        +

        MiAActivityView

        +interface MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + +
        +

        getCheckoutUrl

        +
        +abstract fun getCheckoutUrl(): String? +

        Returns the checkout URL received from the merchant app

        +
        +

        getPaymentId

        +
        +abstract fun getPaymentId(): String? +

        Returns the paymentId received from the merchant app

        +
        +

        initData

        +
        +abstract fun initData(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app

        +
        +

        loadWebViewData

        +
        +abstract fun loadWebViewData(paymentId: String?, checkoutUrl: String?): Unit +

        Validates again the paymentId and checkoutUrl

        +
        +

        showLoader

        +
        +abstract fun showLoader(show: Boolean): Unit +

        Hide/show the ProgressView based on the flag

        +
        +

        Inheritors

        + + + + + + + +
        +

        MiAActivity

        +
        +class MiAActivity : BaseWebViewActivity, MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/init-data.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/init-data.html new file mode 100644 index 0000000..20706d1 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/init-data.html @@ -0,0 +1,19 @@ + + + +MiAActivityView.initData - mia + + + +mia / eu.nets.mia.webview / MiAActivityView / initData
        +
        +

        initData

        + +abstract fun initData(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app

        +

        Parameters

        +

        +bundle - Can be the Intent bundle data (from the merchant app directly), or + savedInstanceState bundle data (SDK stored in case the app goes to background)

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/load-web-view-data.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/load-web-view-data.html new file mode 100644 index 0000000..0d23cd5 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/load-web-view-data.html @@ -0,0 +1,23 @@ + + + +MiAActivityView.loadWebViewData - mia + + + +mia / eu.nets.mia.webview / MiAActivityView / loadWebViewData
        +
        +

        loadWebViewData

        + +abstract fun loadWebViewData(paymentId: String?, checkoutUrl: String?): Unit +

        Validates again the paymentId and checkoutUrl

        +
        • if are valid, it will notify the BaseActivity to load the specific URL
        • +
        • if not valid, cancel the process with error - something went wrong
        • +
        +

        Parameters

        +

        +paymentId - the ID of the payment provided by merchant app

        +

        +checkoutUrl - the checkout url provided by merchant app

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity-view/show-loader.html b/documentation/eu.nets.mia.webview/-mi-a-activity-view/show-loader.html new file mode 100644 index 0000000..e848680 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity-view/show-loader.html @@ -0,0 +1,18 @@ + + + +MiAActivityView.showLoader - mia + + + +mia / eu.nets.mia.webview / MiAActivityView / showLoader
        +
        +

        showLoader

        + +abstract fun showLoader(show: Boolean): Unit +

        Hide/show the ProgressView based on the flag

        +

        Parameters

        +

        +show - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/index.html b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/index.html new file mode 100644 index 0000000..dc1c9c0 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/index.html @@ -0,0 +1,32 @@ + + + +MiAActivity.AlertCallback - mia + + + +mia / eu.nets.mia.webview / MiAActivity / AlertCallback
        +
        +

        AlertCallback

        +interface AlertCallback +

        Functions

        + + + + + + + + + + + +
        +

        onNegativeAction

        +
        +abstract fun onNegativeAction(): Unit
        +

        onPositiveAction

        +
        +abstract fun onPositiveAction(): Unit
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-negative-action.html b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-negative-action.html new file mode 100644 index 0000000..cfa763b --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-negative-action.html @@ -0,0 +1,14 @@ + + + +MiAActivity.AlertCallback.onNegativeAction - mia + + + +mia / eu.nets.mia.webview / MiAActivity / AlertCallback / onNegativeAction
        +
        +

        onNegativeAction

        + +abstract fun onNegativeAction(): Unit + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-positive-action.html b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-positive-action.html new file mode 100644 index 0000000..35b411a --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/-alert-callback/on-positive-action.html @@ -0,0 +1,14 @@ + + + +MiAActivity.AlertCallback.onPositiveAction - mia + + + +mia / eu.nets.mia.webview / MiAActivity / AlertCallback / onPositiveAction
        +
        +

        onPositiveAction

        + +abstract fun onPositiveAction(): Unit + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/-b-u-n-d-l-e_-p-a-y-m-e-n-t_-i-n-f-o.html b/documentation/eu.nets.mia.webview/-mi-a-activity/-b-u-n-d-l-e_-p-a-y-m-e-n-t_-i-n-f-o.html new file mode 100644 index 0000000..67d9f97 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/-b-u-n-d-l-e_-p-a-y-m-e-n-t_-i-n-f-o.html @@ -0,0 +1,14 @@ + + + +MiAActivity.BUNDLE_PAYMENT_INFO - mia + + + +mia / eu.nets.mia.webview / MiAActivity / BUNDLE_PAYMENT_INFO
        +
        +

        BUNDLE_PAYMENT_INFO

        + +const val BUNDLE_PAYMENT_INFO: String + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/-init-.html b/documentation/eu.nets.mia.webview/-mi-a-activity/-init-.html new file mode 100644 index 0000000..f2c40e9 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/-init-.html @@ -0,0 +1,36 @@ + + + +MiAActivity.<init> - mia + + + +mia / eu.nets.mia.webview / MiAActivity / <init>
        +
        +

        <init>

        + +MiAActivity() +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/get-cancel-url.html b/documentation/eu.nets.mia.webview/-mi-a-activity/get-cancel-url.html new file mode 100644 index 0000000..9d7febb --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/get-cancel-url.html @@ -0,0 +1,18 @@ + + + +MiAActivity.getCancelUrl - mia + + + +mia / eu.nets.mia.webview / MiAActivity / getCancelUrl
        +
        +

        getCancelUrl

        + +fun getCancelUrl(): String? +

        Overrides BaseWebViewActivity.getCancelUrl

        +

        Returns the cancel URL received from the merchant app

        +

        Return
        +cancelUrl String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/get-checkout-url.html b/documentation/eu.nets.mia.webview/-mi-a-activity/get-checkout-url.html new file mode 100644 index 0000000..3eb5030 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/get-checkout-url.html @@ -0,0 +1,18 @@ + + + +MiAActivity.getCheckoutUrl - mia + + + +mia / eu.nets.mia.webview / MiAActivity / getCheckoutUrl
        +
        +

        getCheckoutUrl

        + +fun getCheckoutUrl(): String? +

        Overrides MiAActivityView.getCheckoutUrl

        +

        Returns the checkout URL received from the merchant app

        +

        Return
        +URL String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/get-payment-id.html b/documentation/eu.nets.mia.webview/-mi-a-activity/get-payment-id.html new file mode 100644 index 0000000..1297660 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/get-payment-id.html @@ -0,0 +1,18 @@ + + + +MiAActivity.getPaymentId - mia + + + +mia / eu.nets.mia.webview / MiAActivity / getPaymentId
        +
        +

        getPaymentId

        + +fun getPaymentId(): String? +

        Overrides MiAActivityView.getPaymentId

        +

        Returns the paymentId received from the merchant app

        +

        Return
        +paymentId String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/get-return-url.html b/documentation/eu.nets.mia.webview/-mi-a-activity/get-return-url.html new file mode 100644 index 0000000..a5a04ea --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/get-return-url.html @@ -0,0 +1,18 @@ + + + +MiAActivity.getReturnUrl - mia + + + +mia / eu.nets.mia.webview / MiAActivity / getReturnUrl
        +
        +

        getReturnUrl

        + +fun getReturnUrl(): String? +

        Overrides BaseWebViewActivity.getReturnUrl

        +

        Returns the return URL received from the merchant app

        +

        Return
        +returnUrl String

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/index.html b/documentation/eu.nets.mia.webview/-mi-a-activity/index.html new file mode 100644 index 0000000..5e04e12 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/index.html @@ -0,0 +1,351 @@ + + + +MiAActivity - mia + + + +mia / eu.nets.mia.webview / MiAActivity
        +
        +

        MiAActivity

        +class MiAActivity : BaseWebViewActivity, MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +

        NETS DENMARK A/S, ("NETS"), FOR AND ON BEHALF OF ITSELF AND ITS SUBSIDIARIES AND AFFILIATES UNDER COMMON CONTROL, +IS WILLING TO LICENSE THE SOFTWARE TO YOU ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CONTAINED +IN THIS LICENSE AGREEMENT. +BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM. +IF YOU ARE AGREEING TO THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, +YOU REPRESENT THAT YOU HAVE THE LEGAL AUTHORITY TO BIND THE LEGAL ENTITY TO THESE TERMS. IF YOU DO NOT HAVE SUCH AUTHORITY, +OR IF YOU DO NOT WISH TO BE BOUND BY THE TERMS, YOU MUST NOT USE THE SOFTWARE ON THIS SITE OR ANY OTHER MEDIA ON WHICH THE SOFTWARE IS CONTAINED.

        +

        Software is copyrighted. Title to Software and all associated intellectual property rights is retained by NETS and/or its licensors. +Unless enforcement is prohibited by applicable law, you may not modify, decompile, or reverse engineer Software.

        +

        No right, title or interest in or to any trademark, service mark, logo or trade name of NETS or its licensors is granted under this Agreement.

        +

        Permission is hereby granted, to any person obtaining a copy of this software and associated documentation files (the Software"), +to deal in the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        +

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        +

        Software may only be used for commercial or production purpose together with +Easy services (as per https://tech.dibspayment.com/easy) provided from NETS, its subsidiaries or affiliates under common control.

        +

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

        +

        Types

        + + + + + + + +
        +

        AlertCallback

        +
        +interface AlertCallback
        +

        Constructors

        + + + + + + + +
        +

        <init>

        +
        +MiAActivity() +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        getCancelUrl

        +
        +fun getCancelUrl(): String? +

        Returns the cancel URL received from the merchant app

        +
        +

        getCheckoutUrl

        +
        +fun getCheckoutUrl(): String? +

        Returns the checkout URL received from the merchant app

        +
        +

        getPaymentId

        +
        +fun getPaymentId(): String? +

        Returns the paymentId received from the merchant app

        +
        +

        getReturnUrl

        +
        +fun getReturnUrl(): String? +

        Returns the return URL received from the merchant app

        +
        +

        initData

        +
        +fun initData(bundle: Bundle?): Unit +

        Initialize the data received from the merchant app

        +
        +

        loadWebViewData

        +
        +fun loadWebViewData(paymentId: String?, checkoutUrl: String?): Unit +

        Validates again the paymentId and checkoutUrl

        +
        +

        onCreate

        +
        +fun onCreate(savedInstanceState: Bundle?): Unit
        +

        onProcessCanceled

        +
        +fun onProcessCanceled(): Unit +

        BaseWebViewActivity callback +Notifies this activity that the payment was canceled +Handle here the way the result gets delivered to the application

        +
        +

        onProcessFinishedSuccess

        +
        +fun onProcessFinishedSuccess(): Unit +

        BaseWebViewActivity callback +Notifies this activity that the payment has finished with success +Handle here the way the result gets delivered to the application

        +
        +

        onResume

        +
        +fun onResume(): Unit +

        Activity onResume() +Call presenter onResume to store new state of view

        +
        +

        onSaveInstanceState

        +
        +fun onSaveInstanceState(outState: Bundle?, outPersistentState: PersistableBundle?): Unit +

        Store the variables in activity state so it can be retrieved later

        +
        +

        onStop

        +
        +fun onStop(): Unit +

        Activity onStop() +Call presenter onStop to clear the state of view

        +
        +

        openBankIdApp

        +
        +fun openBankIdApp(deepLink: String?): Unit +

        Case when customer's credit card supports BankId

        +
        +

        showLoader

        +
        +fun showLoader(show: Boolean): Unit +

        Hide/show the ProgressView based on the flag

        +
        +

        Inherited Functions

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +

        enableBackNavigation

        +
        +open fun enableBackNavigation(enable: Boolean): Unit +

        Enable/disable the back button navigation

        +
        +

        enableForwardNavigation

        +
        +open fun enableForwardNavigation(enable: Boolean): Unit +

        Enable/disable the forward button navigation

        +
        +

        getCancelURL

        +
        +open fun getCancelURL(): String? +

        Returns the cancel URL received from the merchant app

        +
        +

        getCheckoutPage

        +
        +open fun getCheckoutPage(): String +

        Returns the checkout URL provided by merchant app

        +
        +

        getPaymentIdentifier

        +
        +open fun getPaymentIdentifier(): String +

        Returns the payment identifier provided by merchant app

        +
        +

        getRedirectUrl

        +
        +open fun getRedirectUrl(): String? +

        Returns the return URL received from the merchant app

        +
        +

        getRootFrame

        +
        +open fun getRootFrame(): FrameLayout +

        Get the root view of the WebView to load multiple WebViews as child pop-ups

        +
        +

        handleNavBarActionText

        +
        +open fun handleNavBarActionText(resId: Int): Unit +

        Update the icon on the action button in the navigation bar (For parent WebView it will be Close, +and for child WebView it will be Dismiss)

        +
        +

        init

        +
        +open fun init(bundle: Bundle?): Unit +

        Initialize the UI listeners and setup the WebView configuration

        +
        +

        loadUrl

        +
        +open fun loadUrl(url: String, paymentId: String): Unit +

        Load the received URL in the parent WebView

        +
        +

        onBackPressed

        +
        +open fun onBackPressed(): Unit +

        Activity onBackPressed() +Check if there are opened WebView pop-ups to be closed. If not, navigate back

        +
        +

        onPause

        +
        +open fun onPause(): Unit +

        Activity onPause() +Call presenter onPause to pause the WebView timers

        +
        +

        sendCancelResult

        +
        +open fun sendCancelResult(): Unit +

        Close the current activity and deliver canceled result to application

        +
        +

        sendOKResult

        +
        +open fun sendOKResult(): Unit +

        Close the current activity and deliver success result to application

        +
        +

        showProgressView

        +
        +open fun showProgressView(show: Boolean): Unit +

        Show/hide the loader based on WebView callbacks

        +
        +

        Companion Object Properties

        + + + + + + + +
        +

        BUNDLE_PAYMENT_INFO

        +
        +const val BUNDLE_PAYMENT_INFO: String
        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/init-data.html b/documentation/eu.nets.mia.webview/-mi-a-activity/init-data.html new file mode 100644 index 0000000..cb5ec74 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/init-data.html @@ -0,0 +1,20 @@ + + + +MiAActivity.initData - mia + + + +mia / eu.nets.mia.webview / MiAActivity / initData
        +
        +

        initData

        + +fun initData(bundle: Bundle?): Unit +

        Overrides MiAActivityView.initData

        +

        Initialize the data received from the merchant app

        +

        Parameters

        +

        +bundle - Can be the Intent bundle data (from the merchant app directly), or + savedInstanceState bundle data (SDK stored in case the app goes to background)

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/load-web-view-data.html b/documentation/eu.nets.mia.webview/-mi-a-activity/load-web-view-data.html new file mode 100644 index 0000000..eb7561d --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/load-web-view-data.html @@ -0,0 +1,24 @@ + + + +MiAActivity.loadWebViewData - mia + + + +mia / eu.nets.mia.webview / MiAActivity / loadWebViewData
        +
        +

        loadWebViewData

        + +fun loadWebViewData(paymentId: String?, checkoutUrl: String?): Unit +

        Overrides MiAActivityView.loadWebViewData

        +

        Validates again the paymentId and checkoutUrl

        +
        • if are valid, it will notify the BaseActivity to load the specific URL
        • +
        • if not valid, cancel the process with error - something went wrong
        • +
        +

        Parameters

        +

        +paymentId - the ID of the payment provided by merchant app

        +

        +checkoutUrl - the checkout url provided by merchant app

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-create.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-create.html new file mode 100644 index 0000000..ec7cccf --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-create.html @@ -0,0 +1,15 @@ + + + +MiAActivity.onCreate - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onCreate
        +
        +

        onCreate

        + +protected fun onCreate(savedInstanceState: Bundle?): Unit +

        Overrides BaseWebViewActivity.onCreate

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-canceled.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-canceled.html new file mode 100644 index 0000000..31cc788 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-canceled.html @@ -0,0 +1,18 @@ + + + +MiAActivity.onProcessCanceled - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onProcessCanceled
        +
        +

        onProcessCanceled

        + +fun onProcessCanceled(): Unit +

        Overrides BaseWebViewActivity.onProcessCanceled

        +

        BaseWebViewActivity callback +Notifies this activity that the payment was canceled +Handle here the way the result gets delivered to the application

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-finished-success.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-finished-success.html new file mode 100644 index 0000000..f571194 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-process-finished-success.html @@ -0,0 +1,18 @@ + + + +MiAActivity.onProcessFinishedSuccess - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onProcessFinishedSuccess
        +
        +

        onProcessFinishedSuccess

        + +fun onProcessFinishedSuccess(): Unit +

        Overrides BaseWebViewActivity.onProcessFinishedSuccess

        +

        BaseWebViewActivity callback +Notifies this activity that the payment has finished with success +Handle here the way the result gets delivered to the application

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-resume.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-resume.html new file mode 100644 index 0000000..6c4ca19 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-resume.html @@ -0,0 +1,17 @@ + + + +MiAActivity.onResume - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onResume
        +
        +

        onResume

        + +protected fun onResume(): Unit +

        Overrides BaseWebViewActivity.onResume

        +

        Activity onResume() +Call presenter onResume to store new state of view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-save-instance-state.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-save-instance-state.html new file mode 100644 index 0000000..876cc93 --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-save-instance-state.html @@ -0,0 +1,15 @@ + + + +MiAActivity.onSaveInstanceState - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onSaveInstanceState
        +
        +

        onSaveInstanceState

        + +fun onSaveInstanceState(outState: Bundle?, outPersistentState: PersistableBundle?): Unit +

        Store the variables in activity state so it can be retrieved later

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/on-stop.html b/documentation/eu.nets.mia.webview/-mi-a-activity/on-stop.html new file mode 100644 index 0000000..1d88efa --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/on-stop.html @@ -0,0 +1,17 @@ + + + +MiAActivity.onStop - mia + + + +mia / eu.nets.mia.webview / MiAActivity / onStop
        +
        +

        onStop

        + +protected fun onStop(): Unit +

        Overrides BaseWebViewActivity.onStop

        +

        Activity onStop() +Call presenter onStop to clear the state of view

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/open-bank-id-app.html b/documentation/eu.nets.mia.webview/-mi-a-activity/open-bank-id-app.html new file mode 100644 index 0000000..4757edd --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/open-bank-id-app.html @@ -0,0 +1,20 @@ + + + +MiAActivity.openBankIdApp - mia + + + +mia / eu.nets.mia.webview / MiAActivity / openBankIdApp
        +
        +

        openBankIdApp

        + +fun openBankIdApp(deepLink: String?): Unit +

        Overrides BaseWebView.openBankIdApp

        +

        Case when customer's credit card supports BankId

        +

        Parameters

        +

        +deepLink - bankId deeplink URL for app switch; +(if it's null, will launch the app using launcher intent; of not, will launch it using scheme url)

        + + diff --git a/documentation/eu.nets.mia.webview/-mi-a-activity/show-loader.html b/documentation/eu.nets.mia.webview/-mi-a-activity/show-loader.html new file mode 100644 index 0000000..64d667f --- /dev/null +++ b/documentation/eu.nets.mia.webview/-mi-a-activity/show-loader.html @@ -0,0 +1,19 @@ + + + +MiAActivity.showLoader - mia + + + +mia / eu.nets.mia.webview / MiAActivity / showLoader
        +
        +

        showLoader

        + +fun showLoader(show: Boolean): Unit +

        Overrides MiAActivityView.showLoader

        +

        Hide/show the ProgressView based on the flag

        +

        Parameters

        +

        +show - Boolean flag

        + + diff --git a/documentation/eu.nets.mia.webview/index.html b/documentation/eu.nets.mia.webview/index.html new file mode 100644 index 0000000..e754a26 --- /dev/null +++ b/documentation/eu.nets.mia.webview/index.html @@ -0,0 +1,53 @@ + + + +eu.nets.mia.webview - mia + + + +mia / eu.nets.mia.webview
        +
        +

        Package eu.nets.mia.webview

        +

        Types

        + + + + + + + + + + + + + + + + + + + +
        +

        MiAActivity

        +
        +class MiAActivity : BaseWebViewActivity, MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        MiAActivityPresenter

        +
        +interface MiAActivityPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        MiAActivityPresenterImpl

        +
        +open class MiAActivityPresenterImpl : MiAActivityPresenter +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        +

        MiAActivityView

        +
        +interface MiAActivityView +

        Copyright (c) 2020 Nets Denmark A/S*****

        +
        + + diff --git a/documentation/index-outline.html b/documentation/index-outline.html index b1822cf..a4186b0 100644 --- a/documentation/index-outline.html +++ b/documentation/index-outline.html @@ -23,6 +23,274 @@ +interface BaseWebView
        + +abstract class BaseWebViewActivity : AppCompatActivity, BaseWebView
        + +interface BaseWebViewPresenter
        + +open class BaseWebViewPresenterImpl : BaseWebViewPresenter, JSPaymentCallback
        + +open class HTMLInterceptor
        + +open class JSCallbackInterceptor
        + +interface JSPaymentCallback
        + +class MiAActivity : BaseWebViewActivity, MiAActivityView
        + +interface MiAActivityPresenter
        + +open class MiAActivityPresenterImpl : MiAActivityPresenter
        + +interface MiAActivityView
        + enum class MiAError
        +package eu.nets.mia.utils
        + +package eu.nets.mia.webview
        + +package eu.nets.mia.webview.base
        +
      diff --git a/documentation/index.html b/documentation/index.html index 5122ef3..0be67ee 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -24,6 +24,27 @@

      Packages

      + + +

      eu.nets.mia.utils

      + + + + + + +

      eu.nets.mia.webview

      + + + + + + +

      eu.nets.mia.webview.base

      + + + +

      Index

      diff --git a/documentation/package-list b/documentation/package-list index a278825..2fdb3e5 100644 --- a/documentation/package-list +++ b/documentation/package-list @@ -3,3 +3,6 @@ $dokka.linkExtension:html eu.nets.mia eu.nets.mia.data +eu.nets.mia.utils +eu.nets.mia.webview +eu.nets.mia.webview.base