diff --git a/.github/workflows/stripe_terminal_integration.yml b/.github/workflows/stripe_terminal_integration.yml index 0a3b9c2..8702ec6 100644 --- a/.github/workflows/stripe_terminal_integration.yml +++ b/.github/workflows/stripe_terminal_integration.yml @@ -35,15 +35,15 @@ jobs: - name: Analyze code run: flutter analyze --no-fatal-infos - # Android - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'zulu' - - run: ./gradlew spotlessCheck - working-directory: stripe_terminal/android - - run: ./gradlew :mek_stripe_terminal:assemble --project-dir ../example/android - working-directory: stripe_terminal/android +# # Android +# - uses: actions/setup-java@v3 +# with: +# java-version: '17' +# distribution: 'zulu' +# - run: ./gradlew spotlessCheck +# working-directory: stripe_terminal/android +# - run: ./gradlew :mek_stripe_terminal:assemble --project-dir ../example/android +# working-directory: stripe_terminal/android integration-example: runs-on: macos-latest diff --git a/stripe_terminal/.metadata b/stripe_terminal/.metadata index a7302d6..5a15fe0 100644 --- a/stripe_terminal/.metadata +++ b/stripe_terminal/.metadata @@ -1,11 +1,11 @@ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # -# This file should be version controlled. +# This file should be version controlled and should not be manually edited. version: - revision: 796c8ef79279f9c774545b3771238c3098dbefab - channel: stable + revision: "41456452f29d64e8deb623a3c927524bcf9f111b" + channel: "stable" project_type: plugin @@ -13,14 +13,14 @@ project_type: plugin migration: platforms: - platform: root - create_revision: 796c8ef79279f9c774545b3771238c3098dbefab - base_revision: 796c8ef79279f9c774545b3771238c3098dbefab + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: android - create_revision: 796c8ef79279f9c774545b3771238c3098dbefab - base_revision: 796c8ef79279f9c774545b3771238c3098dbefab + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b - platform: ios - create_revision: 796c8ef79279f9c774545b3771238c3098dbefab - base_revision: 796c8ef79279f9c774545b3771238c3098dbefab + create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b + base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b # User provided section diff --git a/stripe_terminal/CHANGELOG.md b/stripe_terminal/CHANGELOG.md index 0ea5545..1e18e7a 100644 --- a/stripe_terminal/CHANGELOG.md +++ b/stripe_terminal/CHANGELOG.md @@ -1,6 +1,7 @@ -## 3.3.0 -- chore: Bumped [Android](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#330---2024-01-30) - and [IOS](https://github.com/stripe/stripe-terminal-ios/blob/master/CHANGELOG.md#330-2024-02-02) sdks versions to `3.3.0` +## 3.4.0 +- chore: Bumped [Android](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#340---2024-03-04) + and [IOS](https://github.com/stripe/stripe-terminal-ios/blob/master/CHANGELOG.md#340-2024-03-04) sdks versions to `3.4.0` +- refactor: Renamed `TerminalExceptionCode.bluetoothConnectionFailedBatteryCriticallyLow` to `TerminalExceptionCode.readerBatteryCriticallyLow` ## 3.2.1 - chore: Bumped [Android](https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#321---2023-12-18) diff --git a/stripe_terminal/android/build.gradle b/stripe_terminal/android/build.gradle index 93be518..3a612d8 100644 --- a/stripe_terminal/android/build.gradle +++ b/stripe_terminal/android/build.gradle @@ -1,13 +1,11 @@ buildscript { - ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.1.3' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.android.tools.build:gradle:7.3.0' } } @@ -29,8 +27,11 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - namespace "mek.stripeterminal" - compileSdk 34 + if (project.android.hasProperty("namespace")) { + namespace "mek.stripeterminal" + } + + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -52,7 +53,7 @@ android { dependencies { testImplementation 'org.jetbrains.kotlin:kotlin-test' - testImplementation 'org.mockito:mockito-core:5.1.1' + testImplementation 'org.mockito:mockito-core:5.0.0' } testOptions { @@ -69,9 +70,8 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - api "com.stripe:stripeterminal-localmobile:3.2.1" - api "com.stripe:stripeterminal-core:3.2.1" + implementation "com.stripe:stripeterminal-localmobile:3.4.0" + implementation "com.stripe:stripeterminal-core:3.4.0" } spotless { diff --git a/stripe_terminal/android/gradle.properties b/stripe_terminal/android/gradle.properties deleted file mode 100644 index b3e729d..0000000 --- a/stripe_terminal/android/gradle.properties +++ /dev/null @@ -1,16 +0,0 @@ -## 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. -# Default value: -Xmx1024m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -# -# 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 -#Fri Jul 21 11:00:59 CEST 2023 -android.enableJetifier=true -android.useAndroidX=true -org.gradle.jvmargs=-Xmx1536M diff --git a/stripe_terminal/android/gradle/wrapper/gradle-wrapper.jar b/stripe_terminal/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 41d9927..0000000 Binary files a/stripe_terminal/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/stripe_terminal/android/gradle/wrapper/gradle-wrapper.properties b/stripe_terminal/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index da1db5f..0000000 --- a/stripe_terminal/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/stripe_terminal/android/gradlew b/stripe_terminal/android/gradlew deleted file mode 100755 index 1b6c787..0000000 --- a/stripe_terminal/android/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - 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" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/stripe_terminal/android/gradlew.bat b/stripe_terminal/android/gradlew.bat deleted file mode 100644 index 107acd3..0000000 --- a/stripe_terminal/android/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@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 Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@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 execute - -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 execute - -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 - -: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 %* - -: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/stripe_terminal/android/src/main/AndroidManifest.xml b/stripe_terminal/android/src/main/AndroidManifest.xml index 5d6cd93..7573c50 100644 --- a/stripe_terminal/android/src/main/AndroidManifest.xml +++ b/stripe_terminal/android/src/main/AndroidManifest.xml @@ -1,4 +1,5 @@ - + diff --git a/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/api/TerminalApi.kt b/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/api/TerminalApi.kt index 046b6c3..531cb78 100644 --- a/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/api/TerminalApi.kt +++ b/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/api/TerminalApi.kt @@ -7,6 +7,9 @@ import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MethodCall import io.flutter.plugin.common.MethodChannel import kotlinx.coroutines.CoroutineScope +import kotlin.coroutines.resume +import kotlin.coroutines.resumeWithException +import kotlin.coroutines.suspendCoroutine import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.MainScope import kotlinx.coroutines.cancel @@ -16,33 +19,44 @@ import kotlinx.coroutines.withContext class PlatformError( val code: String, message: String?, - val details: Any? = null -) : RuntimeException(message ?: code) + val details: Any? = null, +): RuntimeException(message ?: code) + class Result( private val result: MethodChannel.Result, - private val serializer: (data: T) -> Any? + private val serializer: (data: T) -> Any?, ) { - fun success(data: T) = result.success(serializer(data)) + fun success( + data: T, + ) = result.success(serializer(data)) - fun error(error: PlatformError) { + fun error( + error: PlatformError, + ) { result.error(error.code, error.message, error.details) } } class ControllerSink( private val sink: EventChannel.EventSink, - private val serializer: (data: T) -> Any? + private val serializer: (data: T) -> Any?, ) { - fun success(data: T) = sink.success(serializer(data)) + fun success( + data: T, + ) = sink.success(serializer(data)) - fun error(error: PlatformError) = sink.error(error.code, error.message, error.details) + fun error( + error: PlatformError, + ) = sink.error(error.code, error.message, error.details) fun endOfStream() = sink.endOfStream() } interface TerminalPlatformApi { - fun onInit(shouldPrintLogs: Boolean) + fun onInit( + shouldPrintLogs: Boolean, + ) fun onClearCachedCredentials() @@ -50,60 +64,78 @@ interface TerminalPlatformApi { fun onSupportsReadersOfType( deviceType: DeviceTypeApi?, - discoveryConfiguration: DiscoveryConfigurationApi + discoveryConfiguration: DiscoveryConfigurationApi, ): Boolean fun onConnectBluetoothReader( result: Result, serialNumber: String, locationId: String, - autoReconnectOnUnexpectedDisconnect: Boolean + autoReconnectOnUnexpectedDisconnect: Boolean, ) - fun onConnectHandoffReader(result: Result, serialNumber: String) + fun onConnectHandoffReader( + result: Result, + serialNumber: String, + ) fun onConnectInternetReader( result: Result, serialNumber: String, - failIfInUse: Boolean + failIfInUse: Boolean, ) - fun onConnectMobileReader(result: Result, serialNumber: String, locationId: String) + fun onConnectMobileReader( + result: Result, + serialNumber: String, + locationId: String, + ) fun onConnectUsbReader( result: Result, serialNumber: String, locationId: String, - autoReconnectOnUnexpectedDisconnect: Boolean + autoReconnectOnUnexpectedDisconnect: Boolean, ) fun onGetConnectedReader(): ReaderApi? - fun onCancelReaderReconnection(result: Result) + fun onCancelReaderReconnection( + result: Result, + ) fun onListLocations( result: Result>, endingBefore: String?, limit: Long?, - startingAfter: String? + startingAfter: String?, ) fun onInstallAvailableUpdate() - fun onCancelReaderUpdate(result: Result) + fun onCancelReaderUpdate( + result: Result, + ) - fun onDisconnectReader(result: Result) + fun onDisconnectReader( + result: Result, + ) - fun onSetSimulatorConfiguration(configuration: SimulatorConfigurationApi) + fun onSetSimulatorConfiguration( + configuration: SimulatorConfigurationApi, + ) fun onGetPaymentStatus(): PaymentStatusApi fun onCreatePaymentIntent( result: Result, - parameters: PaymentIntentParametersApi + parameters: PaymentIntentParametersApi, ) - fun onRetrievePaymentIntent(result: Result, clientSecret: String) + fun onRetrievePaymentIntent( + result: Result, + clientSecret: String, + ) fun onStartCollectPaymentMethod( result: Result, @@ -112,14 +144,23 @@ interface TerminalPlatformApi { skipTipping: Boolean, tippingConfiguration: TippingConfigurationApi?, shouldUpdatePaymentIntent: Boolean, - customerCancellationEnabled: Boolean + customerCancellationEnabled: Boolean, ) - fun onStopCollectPaymentMethod(result: Result, operationId: Long) + fun onStopCollectPaymentMethod( + result: Result, + operationId: Long, + ) - fun onConfirmPaymentIntent(result: Result, paymentIntentId: String) + fun onConfirmPaymentIntent( + result: Result, + paymentIntentId: String, + ) - fun onCancelPaymentIntent(result: Result, paymentIntentId: String) + fun onCancelPaymentIntent( + result: Result, + paymentIntentId: String, + ) fun onCreateSetupIntent( result: Result, @@ -127,24 +168,36 @@ interface TerminalPlatformApi { metadata: HashMap?, onBehalfOf: String?, description: String?, - usage: SetupIntentUsageApi? + usage: SetupIntentUsageApi?, ) - fun onRetrieveSetupIntent(result: Result, clientSecret: String) + fun onRetrieveSetupIntent( + result: Result, + clientSecret: String, + ) fun onStartCollectSetupIntentPaymentMethod( result: Result, operationId: Long, setupIntentId: String, customerConsentCollected: Boolean, - customerCancellationEnabled: Boolean + customerCancellationEnabled: Boolean, ) - fun onStopCollectSetupIntentPaymentMethod(result: Result, operationId: Long) + fun onStopCollectSetupIntentPaymentMethod( + result: Result, + operationId: Long, + ) - fun onConfirmSetupIntent(result: Result, setupIntentId: String) + fun onConfirmSetupIntent( + result: Result, + setupIntentId: String, + ) - fun onCancelSetupIntent(result: Result, setupIntentId: String) + fun onCancelSetupIntent( + result: Result, + setupIntentId: String, + ) fun onStartCollectRefundPaymentMethod( result: Result, @@ -155,21 +208,33 @@ interface TerminalPlatformApi { metadata: HashMap?, reverseTransfer: Boolean?, refundApplicationFee: Boolean?, - customerCancellationEnabled: Boolean + customerCancellationEnabled: Boolean, ) - fun onStopCollectRefundPaymentMethod(result: Result, operationId: Long) + fun onStopCollectRefundPaymentMethod( + result: Result, + operationId: Long, + ) - fun onConfirmRefund(result: Result) + fun onConfirmRefund( + result: Result, + ) - fun onSetReaderDisplay(result: Result, cart: CartApi) + fun onSetReaderDisplay( + result: Result, + cart: CartApi, + ) - fun onClearReaderDisplay(result: Result) + fun onClearReaderDisplay( + result: Result, + ) - private fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { + private fun onMethodCall( + call: MethodCall, + result: MethodChannel.Result, + ) { try { val args = call.arguments>()!! - fun runAsync(callback: suspend () -> Any?) { coroutineScope.launch { val res = callback() @@ -190,27 +255,12 @@ interface TerminalPlatformApi { result.success(res.ordinal) } "supportsReadersOfType" -> { - val res = - onSupportsReadersOfType( - (args[0] as Int?)?.let { - DeviceTypeApi.values()[it] - }, - (args[1] as List).let { - DiscoveryConfigurationApi.deserialize( - it - ) - } - ) + val res = onSupportsReadersOfType((args[0] as Int?)?.let { DeviceTypeApi.values()[it] }, (args[1] as List).let { DiscoveryConfigurationApi.deserialize(it) }) result.success(res) } "connectBluetoothReader" -> { val res = Result(result) { it.serialize() } - onConnectBluetoothReader( - res, - args[0] as String, - args[1] as String, - args[2] as Boolean - ) + onConnectBluetoothReader(res, args[0] as String, args[1] as String, args[2] as Boolean) } "connectHandoffReader" -> { val res = Result(result) { it.serialize() } @@ -226,12 +276,7 @@ interface TerminalPlatformApi { } "connectUsbReader" -> { val res = Result(result) { it.serialize() } - onConnectUsbReader( - res, - args[0] as String, - args[1] as String, - args[2] as Boolean - ) + onConnectUsbReader(res, args[0] as String, args[1] as String, args[2] as Boolean) } "getConnectedReader" -> { val res = onGetConnectedReader() @@ -242,13 +287,8 @@ interface TerminalPlatformApi { onCancelReaderReconnection(res) } "listLocations" -> { - val res = Result>(result) { it.map { it.serialize() } } - onListLocations( - res, - args[0] as String?, - (args[1] as? Number)?.toLong(), - args[2] as String? - ) + val res = Result>(result) { it.map { it.serialize()} } + onListLocations(res, args[0] as String?, (args[1] as? Number)?.toLong(), args[2] as String?) } "installAvailableUpdate" -> { onInstallAvailableUpdate() @@ -263,11 +303,7 @@ interface TerminalPlatformApi { onDisconnectReader(res) } "setSimulatorConfiguration" -> { - onSetSimulatorConfiguration( - (args[0] as List).let { - SimulatorConfigurationApi.deserialize(it) - } - ) + onSetSimulatorConfiguration((args[0] as List).let { SimulatorConfigurationApi.deserialize(it) }) result.success(null) } "getPaymentStatus" -> { @@ -276,12 +312,7 @@ interface TerminalPlatformApi { } "createPaymentIntent" -> { val res = Result(result) { it.serialize() } - onCreatePaymentIntent( - res, - (args[0] as List).let { - PaymentIntentParametersApi.deserialize(it) - } - ) + onCreatePaymentIntent(res, (args[0] as List).let { PaymentIntentParametersApi.deserialize(it) }) } "retrievePaymentIntent" -> { val res = Result(result) { it.serialize() } @@ -289,17 +320,7 @@ interface TerminalPlatformApi { } "startCollectPaymentMethod" -> { val res = Result(result) { it.serialize() } - onStartCollectPaymentMethod( - res, - (args[0] as Number).toLong(), - args[1] as String, - args[2] as Boolean, - (args[3] as List?)?.let { - TippingConfigurationApi.deserialize(it) - }, - args[4] as Boolean, - args[5] as Boolean - ) + onStartCollectPaymentMethod(res, (args[0] as Number).toLong(), args[1] as String, args[2] as Boolean, (args[3] as List?)?.let { TippingConfigurationApi.deserialize(it) }, args[4] as Boolean, args[5] as Boolean) } "stopCollectPaymentMethod" -> { val res = Result(result) { null } @@ -315,21 +336,7 @@ interface TerminalPlatformApi { } "createSetupIntent" -> { val res = Result(result) { it.serialize() } - onCreateSetupIntent( - res, - args[0] as String?, - args[1]?.let { - hashMapOf( - *(it as HashMap<*, *>).map { - (k, v) -> - k as String to v as String - }.toTypedArray() - ) - }, - args[2] as String?, - args[3] as String?, - (args[4] as Int?)?.let { SetupIntentUsageApi.values()[it] } - ) + onCreateSetupIntent(res, args[0] as String?, args[1]?.let { hashMapOf(*(it as HashMap<*, *>).map { (k, v) -> k as String to v as String }.toTypedArray()) }, args[2] as String?, args[3] as String?, (args[4] as Int?)?.let { SetupIntentUsageApi.values()[it] }) } "retrieveSetupIntent" -> { val res = Result(result) { it.serialize() } @@ -337,13 +344,7 @@ interface TerminalPlatformApi { } "startCollectSetupIntentPaymentMethod" -> { val res = Result(result) { it.serialize() } - onStartCollectSetupIntentPaymentMethod( - res, - (args[0] as Number).toLong(), - args[1] as String, - args[2] as Boolean, - args[3] as Boolean - ) + onStartCollectSetupIntentPaymentMethod(res, (args[0] as Number).toLong(), args[1] as String, args[2] as Boolean, args[3] as Boolean) } "stopCollectSetupIntentPaymentMethod" -> { val res = Result(result) { null } @@ -359,18 +360,7 @@ interface TerminalPlatformApi { } "startCollectRefundPaymentMethod" -> { val res = Result(result) { null } - onStartCollectRefundPaymentMethod( - res, (args[0] as Number).toLong(), args[1] as String, (args[2] as Number).toLong(), args[3] as String, - args[4]?.let { - hashMapOf( - *(it as HashMap<*, *>).map { - (k, v) -> - k as String to v as String - }.toTypedArray() - ) - }, - args[5] as Boolean?, args[6] as Boolean?, args[7] as Boolean - ) + onStartCollectRefundPaymentMethod(res, (args[0] as Number).toLong(), args[1] as String, (args[2] as Number).toLong(), args[3] as String, args[4]?.let { hashMapOf(*(it as HashMap<*, *>).map { (k, v) -> k as String to v as String }.toTypedArray()) }, args[5] as Boolean?, args[6] as Boolean?, args[7] as Boolean) } "stopCollectRefundPaymentMethod" -> { val res = Result(result) { null } @@ -401,7 +391,7 @@ interface TerminalPlatformApi { fun setHandler( binaryMessenger: BinaryMessenger, api: TerminalPlatformApi, - coroutineScope: CoroutineScope? = null + coroutineScope: CoroutineScope? = null, ) { channel = MethodChannel(binaryMessenger, "mek_stripe_terminal#TerminalPlatform") this.coroutineScope = coroutineScope ?: MainScope() @@ -416,131 +406,137 @@ interface TerminalPlatformApi { } class DiscoverReadersControllerApi( - binaryMessenger: BinaryMessenger + binaryMessenger: BinaryMessenger, ) { - private val channel: EventChannel = - EventChannel(binaryMessenger, "mek_stripe_terminal#TerminalPlatform#discoverReaders") + private val channel: EventChannel = EventChannel(binaryMessenger, "mek_stripe_terminal#TerminalPlatform#discoverReaders") fun setHandler( - onListen: ( - sink: ControllerSink>, - configuration: DiscoveryConfigurationApi - ) -> Unit, - onCancel: () -> Unit + onListen: (sink: ControllerSink>, configuration: DiscoveryConfigurationApi) -> Unit, + onCancel: () -> Unit, ) { - channel.setStreamHandler( - object : EventChannel.StreamHandler { - override fun onListen(arguments: Any?, events: EventChannel.EventSink) { - val args = arguments as List - val sink = ControllerSink>(events) { it.map { it.serialize() } } - onListen( - sink, - (args[0] as List).let { DiscoveryConfigurationApi.deserialize(it) } - ) - } - - override fun onCancel(arguments: Any?) = onCancel() + channel.setStreamHandler(object : EventChannel.StreamHandler { + override fun onListen(arguments: Any?, events: EventChannel.EventSink) { + val args = arguments as List + val sink = ControllerSink>(events) {it.map { it.serialize()} } + onListen(sink, (args[0] as List).let { DiscoveryConfigurationApi.deserialize(it) }) } - ) + override fun onCancel(arguments: Any?) = onCancel() + }) } fun removeHandler() = channel.setStreamHandler(null) } class TerminalHandlersApi( - binaryMessenger: BinaryMessenger + binaryMessenger: BinaryMessenger, ) { - private val channel: MethodChannel = - MethodChannel(binaryMessenger, "mek_stripe_terminal#TerminalHandlers") + private val channel: MethodChannel = MethodChannel(binaryMessenger, "mek_stripe_terminal#TerminalHandlers") fun requestConnectionToken( onError: (error: PlatformError) -> Unit, - onSuccess: (data: String) -> Unit + onSuccess: (data: String) -> Unit, ) { channel.invokeMethod( "_onRequestConnectionToken", listOf(), object : MethodChannel.Result { override fun notImplemented() {} - - override fun error(code: String, message: String?, details: Any?) = + override fun error(code: String, message: String?, details: Any?) = onError(PlatformError(code, message, details)) - - override fun success(result: Any?) = onSuccess(result as String) + override fun success(result: Any?) = + onSuccess(result as String) } ) } - fun unexpectedReaderDisconnect(reader: ReaderApi) { + fun unexpectedReaderDisconnect( + reader: ReaderApi, + ) { channel.invokeMethod("_onUnexpectedReaderDisconnect", listOf(reader.serialize())) } - fun connectionStatusChange(connectionStatus: ConnectionStatusApi) { + fun connectionStatusChange( + connectionStatus: ConnectionStatusApi, + ) { channel.invokeMethod("_onConnectionStatusChange", listOf(connectionStatus.ordinal)) } - fun paymentStatusChange(paymentStatus: PaymentStatusApi) { + fun paymentStatusChange( + paymentStatus: PaymentStatusApi, + ) { channel.invokeMethod("_onPaymentStatusChange", listOf(paymentStatus.ordinal)) } - fun readerReportEvent(event: ReaderEventApi) { + fun readerReportEvent( + event: ReaderEventApi, + ) { channel.invokeMethod("_onReaderReportEvent", listOf(event.ordinal)) } - fun readerRequestDisplayMessage(message: ReaderDisplayMessageApi) { + fun readerRequestDisplayMessage( + message: ReaderDisplayMessageApi, + ) { channel.invokeMethod("_onReaderRequestDisplayMessage", listOf(message.ordinal)) } - fun readerRequestInput(options: List) { - channel.invokeMethod("_onReaderRequestInput", listOf(options.map { it.ordinal })) + fun readerRequestInput( + options: List, + ) { + channel.invokeMethod("_onReaderRequestInput", listOf(options.map { it.ordinal} )) } fun readerBatteryLevelUpdate( batteryLevel: Double, batteryStatus: BatteryStatusApi?, - isCharging: Boolean + isCharging: Boolean, ) { - channel.invokeMethod( - "_onReaderBatteryLevelUpdate", - listOf(batteryLevel, batteryStatus?.ordinal, isCharging) - ) + channel.invokeMethod("_onReaderBatteryLevelUpdate", listOf(batteryLevel, batteryStatus?.ordinal, isCharging)) } fun readerReportLowBatteryWarning() { channel.invokeMethod("_onReaderReportLowBatteryWarning", listOf()) } - fun readerReportAvailableUpdate(update: ReaderSoftwareUpdateApi) { + fun readerReportAvailableUpdate( + update: ReaderSoftwareUpdateApi, + ) { channel.invokeMethod("_onReaderReportAvailableUpdate", listOf(update.serialize())) } - fun readerStartInstallingUpdate(update: ReaderSoftwareUpdateApi) { + fun readerStartInstallingUpdate( + update: ReaderSoftwareUpdateApi, + ) { channel.invokeMethod("_onReaderStartInstallingUpdate", listOf(update.serialize())) } - fun readerReportSoftwareUpdateProgress(progress: Double) { + fun readerReportSoftwareUpdateProgress( + progress: Double, + ) { channel.invokeMethod("_onReaderReportSoftwareUpdateProgress", listOf(progress)) } fun readerFinishInstallingUpdate( update: ReaderSoftwareUpdateApi?, - exception: TerminalExceptionApi? + exception: TerminalExceptionApi?, ) { - channel.invokeMethod( - "_onReaderFinishInstallingUpdate", - listOf(update?.serialize(), exception?.serialize()) - ) + channel.invokeMethod("_onReaderFinishInstallingUpdate", listOf(update?.serialize(), exception?.serialize())) } - fun readerReconnectFailed(reader: ReaderApi) { + fun readerReconnectFailed( + reader: ReaderApi, + ) { channel.invokeMethod("_onReaderReconnectFailed", listOf(reader.serialize())) } - fun readerReconnectStarted(reader: ReaderApi) { + fun readerReconnectStarted( + reader: ReaderApi, + ) { channel.invokeMethod("_onReaderReconnectStarted", listOf(reader.serialize())) } - fun readerReconnectSucceeded(reader: ReaderApi) { + fun readerReconnectSucceeded( + reader: ReaderApi, + ) { channel.invokeMethod("_onReaderReconnectSucceeded", listOf(reader.serialize())) } } @@ -551,7 +547,7 @@ data class AddressApi( val line1: String?, val line2: String?, val postalCode: String?, - val state: String? + val state: String?, ) { fun serialize(): List { return listOf( @@ -560,42 +556,31 @@ data class AddressApi( line1, line2, postalCode, - state + state, ) } } data class AmountDetailsApi( - val tip: TipApi? + val tip: TipApi?, ) { fun serialize(): List { return listOf( - tip?.serialize() + tip?.serialize(), ) } } enum class BatteryStatusApi { - CRITICAL, - LOW, - NOMINAL + CRITICAL, LOW, NOMINAL; } enum class CaptureMethodApi { - AUTOMATIC, - MANUAL + AUTOMATIC, MANUAL; } enum class CardBrandApi { - AMEX, - DINERS_CLUB, - DISCOVER, - JCB, - MASTER_CARD, - UNION_PAY, - VISA, - INTERAC, - EFTPOS_AU + AMEX, DINERS_CLUB, DISCOVER, JCB, MASTER_CARD, UNION_PAY, VISA, INTERAC, EFTPOS_AU; } data class CardDetailsApi( @@ -604,7 +589,7 @@ data class CardDetailsApi( val expMonth: Long, val expYear: Long, val funding: CardFundingTypeApi?, - val last4: String? + val last4: String?, ) { fun serialize(): List { return listOf( @@ -613,31 +598,29 @@ data class CardDetailsApi( expMonth, expYear, funding?.ordinal, - last4 + last4, ) } } enum class CardFundingTypeApi { - CREDIT, - DEBIT, - PREPAID + CREDIT, DEBIT, PREPAID; } data class CardNetworksApi( val available: List, - val preferred: String? + val preferred: String?, ) { fun serialize(): List { return listOf( - available.map { it.ordinal }, - preferred + available.map { it.ordinal} , + preferred, ) } } enum class CardPresentCaptureMethodApi { - MANUAL_PREFERRED + MANUAL_PREFERRED; } data class CardPresentDetailsApi( @@ -652,7 +635,7 @@ data class CardPresentDetailsApi( val incrementalAuthorizationStatus: IncrementalAuthorizationStatusApi?, val last4: String?, val networks: CardNetworksApi?, - val receipt: ReceiptDetailsApi? + val receipt: ReceiptDetailsApi?, ) { fun serialize(): List { return listOf( @@ -667,7 +650,7 @@ data class CardPresentDetailsApi( incrementalAuthorizationStatus?.ordinal, last4, networks?.serialize(), - receipt?.serialize() + receipt?.serialize(), ) } } @@ -676,40 +659,41 @@ data class CardPresentParametersApi( val captureMethod: CardPresentCaptureMethodApi?, val requestExtendedAuthorization: Boolean?, val requestIncrementalAuthorizationSupport: Boolean?, - val requestedPriority: CardPresentRoutingApi? + val requestedPriority: CardPresentRoutingApi?, ) { companion object { - fun deserialize(serialized: List): CardPresentParametersApi { + fun deserialize( + serialized: List, + ): CardPresentParametersApi { return CardPresentParametersApi( captureMethod = (serialized[0] as Int?)?.let { CardPresentCaptureMethodApi.values()[it] }, requestExtendedAuthorization = serialized[1] as Boolean?, requestIncrementalAuthorizationSupport = serialized[2] as Boolean?, - requestedPriority = (serialized[3] as Int?)?.let { CardPresentRoutingApi.values()[it] } + requestedPriority = (serialized[3] as Int?)?.let { CardPresentRoutingApi.values()[it] }, ) } } } enum class CardPresentRoutingApi { - DOMESTIC, - INTERNATIONAL + DOMESTIC, INTERNATIONAL; } data class CartApi( val currency: String, val lineItems: List, val tax: Long, - val total: Long + val total: Long, ) { companion object { - fun deserialize(serialized: List): CartApi { + fun deserialize( + serialized: List, + ): CartApi { return CartApi( currency = serialized[0] as String, - lineItems = (serialized[1] as List<*>).map { - (it as List).let { CartLineItemApi.deserialize(it) } - }, + lineItems = (serialized[1] as List<*>).map { (it as List).let { CartLineItemApi.deserialize(it) } }, tax = (serialized[2] as Number).toLong(), - total = (serialized[3] as Number).toLong() + total = (serialized[3] as Number).toLong(), ) } } @@ -718,14 +702,16 @@ data class CartApi( data class CartLineItemApi( val amount: Long, val description: String, - val quantity: Long + val quantity: Long, ) { companion object { - fun deserialize(serialized: List): CartLineItemApi { + fun deserialize( + serialized: List, + ): CartLineItemApi { return CartLineItemApi( amount = (serialized[0] as Number).toLong(), description = serialized[1] as String, - quantity = (serialized[2] as Number).toLong() + quantity = (serialized[2] as Number).toLong(), ) } } @@ -741,7 +727,7 @@ data class ChargeApi( val metadata: HashMap, val paymentMethodDetails: PaymentMethodDetailsApi?, val statementDescriptorSuffix: String?, - val status: ChargeStatusApi + val status: ChargeStatusApi, ) { fun serialize(): List { return listOf( @@ -754,67 +740,39 @@ data class ChargeApi( hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()), paymentMethodDetails?.serialize(), statementDescriptorSuffix, - status.ordinal + status.ordinal, ) } } enum class ChargeStatusApi { - SUCCEEDED, - PENDING, - FAILED + SUCCEEDED, PENDING, FAILED; } enum class ConfirmationMethodApi { - AUTOMATIC, - MANUAL + AUTOMATIC, MANUAL; } enum class ConnectionStatusApi { - NOT_CONNECTED, - CONNECTED, - CONNECTING + NOT_CONNECTED, CONNECTED, CONNECTING; } enum class DeviceTypeApi { - CHIPPER1_X, - CHIPPER2_X, - STRIPE_M2, - COTS_DEVICE, - VERIFONE_P400, - WISE_CUBE, - WISE_PAD3, - WISE_PAD3S, - WISE_POS_E, - WISE_POS_E_DEVKIT, - ETNA, - STRIPE_S700, - STRIPE_S700_DEVKIT, - APPLE_BUILT_IN + CHIPPER1_X, CHIPPER2_X, STRIPE_M2, COTS_DEVICE, VERIFONE_P400, WISE_CUBE, WISE_PAD3, WISE_PAD3S, WISE_POS_E, WISE_POS_E_DEVKIT, ETNA, STRIPE_S700, STRIPE_S700_DEVKIT, APPLE_BUILT_IN; } sealed class DiscoveryConfigurationApi { companion object { - fun deserialize(serialized: List): DiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): DiscoveryConfigurationApi { return when (serialized[0]) { - "BluetoothDiscoveryConfiguration" -> BluetoothDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) - "BluetoothProximityDiscoveryConfiguration" -> BluetoothProximityDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) - "HandoffDiscoveryConfiguration" -> HandoffDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) - "InternetDiscoveryConfiguration" -> InternetDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) - "LocalMobileDiscoveryConfiguration" -> LocalMobileDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) - "UsbDiscoveryConfiguration" -> UsbDiscoveryConfigurationApi.deserialize( - serialized.drop(1) - ) + "BluetoothDiscoveryConfiguration" -> BluetoothDiscoveryConfigurationApi.deserialize(serialized.drop(1)) + "BluetoothProximityDiscoveryConfiguration" -> BluetoothProximityDiscoveryConfigurationApi.deserialize(serialized.drop(1)) + "HandoffDiscoveryConfiguration" -> HandoffDiscoveryConfigurationApi.deserialize(serialized.drop(1)) + "InternetDiscoveryConfiguration" -> InternetDiscoveryConfigurationApi.deserialize(serialized.drop(1)) + "LocalMobileDiscoveryConfiguration" -> LocalMobileDiscoveryConfigurationApi.deserialize(serialized.drop(1)) + "UsbDiscoveryConfiguration" -> UsbDiscoveryConfigurationApi.deserialize(serialized.drop(1)) else -> throw Error() } } @@ -823,59 +781,70 @@ sealed class DiscoveryConfigurationApi { data class BluetoothDiscoveryConfigurationApi( val isSimulated: Boolean, - val timeout: Long? -) : DiscoveryConfigurationApi() { + val timeout: Long?, +): DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): BluetoothDiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): BluetoothDiscoveryConfigurationApi { return BluetoothDiscoveryConfigurationApi( isSimulated = serialized[0] as Boolean, - timeout = serialized[1] as Long? + timeout = serialized[1] as Long?, ) } } } data class BluetoothProximityDiscoveryConfigurationApi( - val isSimulated: Boolean -) : DiscoveryConfigurationApi() { + val isSimulated: Boolean, +): DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): BluetoothProximityDiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): BluetoothProximityDiscoveryConfigurationApi { return BluetoothProximityDiscoveryConfigurationApi( - isSimulated = serialized[0] as Boolean + isSimulated = serialized[0] as Boolean, ) } } } -class HandoffDiscoveryConfigurationApi : DiscoveryConfigurationApi() { +class HandoffDiscoveryConfigurationApi: DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): HandoffDiscoveryConfigurationApi { - return HandoffDiscoveryConfigurationApi() + fun deserialize( + serialized: List, + ): HandoffDiscoveryConfigurationApi { + return HandoffDiscoveryConfigurationApi( + ) } } } data class InternetDiscoveryConfigurationApi( val isSimulated: Boolean, - val locationId: String? -) : DiscoveryConfigurationApi() { + val locationId: String?, +): DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): InternetDiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): InternetDiscoveryConfigurationApi { return InternetDiscoveryConfigurationApi( isSimulated = serialized[0] as Boolean, - locationId = serialized[1] as String? + locationId = serialized[1] as String?, ) } } } data class LocalMobileDiscoveryConfigurationApi( - val isSimulated: Boolean -) : DiscoveryConfigurationApi() { + val isSimulated: Boolean, +): DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): LocalMobileDiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): LocalMobileDiscoveryConfigurationApi { return LocalMobileDiscoveryConfigurationApi( - isSimulated = serialized[0] as Boolean + isSimulated = serialized[0] as Boolean, ) } } @@ -883,21 +852,22 @@ data class LocalMobileDiscoveryConfigurationApi( data class UsbDiscoveryConfigurationApi( val isSimulated: Boolean, - val timeout: Long? -) : DiscoveryConfigurationApi() { + val timeout: Long?, +): DiscoveryConfigurationApi() { companion object { - fun deserialize(serialized: List): UsbDiscoveryConfigurationApi { + fun deserialize( + serialized: List, + ): UsbDiscoveryConfigurationApi { return UsbDiscoveryConfigurationApi( isSimulated = serialized[0] as Boolean, - timeout = serialized[1] as Long? + timeout = serialized[1] as Long?, ) } } } enum class IncrementalAuthorizationStatusApi { - NOT_SUPPORTED, - SUPPORTED + NOT_SUPPORTED, SUPPORTED; } data class LocationApi( @@ -905,7 +875,7 @@ data class LocationApi( val displayName: String?, val id: String?, val livemode: Boolean?, - val metadata: HashMap + val metadata: HashMap, ) { fun serialize(): List { return listOf( @@ -913,14 +883,13 @@ data class LocationApi( displayName, id, livemode, - hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()) + hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()), ) } } enum class LocationStatusApi { - SET, - NOT_SET + SET, NOT_SET; } data class PaymentIntentApi( @@ -953,7 +922,7 @@ data class PaymentIntentApi( val statementDescriptor: String?, val statementDescriptorSuffix: String?, val status: PaymentIntentStatusApi, - val transferGroup: String? + val transferGroup: String?, ) { fun serialize(): List { return listOf( @@ -967,7 +936,7 @@ data class PaymentIntentApi( canceledAt, cancellationReason, captureMethod.ordinal, - charges.map { it.serialize() }, + charges.map { it.serialize()} , clientSecret, confirmationMethod?.ordinal, created, @@ -986,7 +955,7 @@ data class PaymentIntentApi( statementDescriptor, statementDescriptorSuffix, status.ordinal, - transferGroup + transferGroup, ) } } @@ -1007,10 +976,12 @@ data class PaymentIntentParametersApi( val statementDescriptor: String?, val statementDescriptorSuffix: String?, val transferDataDestination: String?, - val transferGroup: String? + val transferGroup: String?, ) { companion object { - fun deserialize(serialized: List): PaymentIntentParametersApi { + fun deserialize( + serialized: List, + ): PaymentIntentParametersApi { return PaymentIntentParametersApi( amount = (serialized[0] as Number).toLong(), applicationFeeAmount = (serialized[1] as? Number)?.toLong(), @@ -1018,40 +989,27 @@ data class PaymentIntentParametersApi( currency = serialized[3] as String, customerId = serialized[4] as String?, description = serialized[5] as String?, - metadata = hashMapOf( - *(serialized[6] as HashMap<*, *>).map { (k, v) -> k as String to v as String }.toTypedArray() - ), + metadata = hashMapOf(*(serialized[6] as HashMap<*, *>).map { (k, v) -> k as String to v as String }.toTypedArray()), onBehalfOf = serialized[7] as String?, - paymentMethodOptionsParameters = (serialized[8] as List?)?.let { - PaymentMethodOptionsParametersApi.deserialize(it) - }, - paymentMethodTypes = (serialized[9] as List<*>).map { - (it as Int).let { PaymentMethodTypeApi.values()[it] } - }, + paymentMethodOptionsParameters = (serialized[8] as List?)?.let { PaymentMethodOptionsParametersApi.deserialize(it) }, + paymentMethodTypes = (serialized[9] as List<*>).map { (it as Int).let { PaymentMethodTypeApi.values()[it] } }, receiptEmail = serialized[10] as String?, setupFutureUsage = (serialized[11] as Int?)?.let { PaymentIntentUsageApi.values()[it] }, statementDescriptor = serialized[12] as String?, statementDescriptorSuffix = serialized[13] as String?, transferDataDestination = serialized[14] as String?, - transferGroup = serialized[15] as String? + transferGroup = serialized[15] as String?, ) } } } enum class PaymentIntentStatusApi { - CANCELED, - PROCESSING, - REQUIRES_CAPTURE, - REQUIRES_CONFIRMATION, - REQUIRES_PAYMENT_METHOD, - REQUIRES_ACTION, - SUCCEEDED + CANCELED, PROCESSING, REQUIRES_CAPTURE, REQUIRES_CONFIRMATION, REQUIRES_PAYMENT_METHOD, REQUIRES_ACTION, SUCCEEDED; } enum class PaymentIntentUsageApi { - ON_SESSION, - OFF_SESSION + ON_SESSION, OFF_SESSION; } data class PaymentMethodApi( @@ -1060,7 +1018,7 @@ data class PaymentMethodApi( val customerId: String?, val id: String, val interacPresent: CardPresentDetailsApi?, - val metadata: HashMap + val metadata: HashMap, ) { fun serialize(): List { return listOf( @@ -1069,48 +1027,43 @@ data class PaymentMethodApi( customerId, id, interacPresent?.serialize(), - hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()) + hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()), ) } } data class PaymentMethodDetailsApi( val cardPresent: CardPresentDetailsApi?, - val interacPresent: CardPresentDetailsApi? + val interacPresent: CardPresentDetailsApi?, ) { fun serialize(): List { return listOf( cardPresent?.serialize(), - interacPresent?.serialize() + interacPresent?.serialize(), ) } } data class PaymentMethodOptionsParametersApi( - val cardPresentParameters: CardPresentParametersApi + val cardPresentParameters: CardPresentParametersApi, ) { companion object { - fun deserialize(serialized: List): PaymentMethodOptionsParametersApi { + fun deserialize( + serialized: List, + ): PaymentMethodOptionsParametersApi { return PaymentMethodOptionsParametersApi( - cardPresentParameters = (serialized[0] as List).let { - CardPresentParametersApi.deserialize(it) - } + cardPresentParameters = (serialized[0] as List).let { CardPresentParametersApi.deserialize(it) }, ) } } } enum class PaymentMethodTypeApi { - CARD_PRESENT, - CARD, - INTERACT_PRESENT + CARD_PRESENT, CARD, INTERACT_PRESENT; } enum class PaymentStatusApi { - NOT_READY, - READY, - WAITING_FOR_INPUT, - PROCESSING + NOT_READY, READY, WAITING_FOR_INPUT, PROCESSING; } data class ReaderApi( @@ -1122,7 +1075,7 @@ data class ReaderApi( val locationId: String?, val locationStatus: LocationStatusApi?, val serialNumber: String, - val simulated: Boolean + val simulated: Boolean, ) { fun serialize(): List { return listOf( @@ -1134,34 +1087,21 @@ data class ReaderApi( locationId, locationStatus?.ordinal, serialNumber, - simulated + simulated, ) } } enum class ReaderDisplayMessageApi { - CHECK_MOBILE_DEVICE, - RETRY_CARD, - INSERT_CARD, - INSERT_OR_SWIPE_CARD, - SWIPE_CARD, - REMOVE_CARD, - MULTIPLE_CONTACTLESS_CARDS_DETECTED, - TRY_ANOTHER_READ_METHOD, - TRY_ANOTHER_CARD, - CARD_REMOVED_TOO_EARLY + CHECK_MOBILE_DEVICE, RETRY_CARD, INSERT_CARD, INSERT_OR_SWIPE_CARD, SWIPE_CARD, REMOVE_CARD, MULTIPLE_CONTACTLESS_CARDS_DETECTED, TRY_ANOTHER_READ_METHOD, TRY_ANOTHER_CARD, CARD_REMOVED_TOO_EARLY; } enum class ReaderEventApi { - CARD_INSERTED, - CARD_REMOVED + CARD_INSERTED, CARD_REMOVED; } enum class ReaderInputOptionApi { - INSERT_CARD, - SWIPE_CARD, - TAP_CARD, - MANUAL_ENTRY + INSERT_CARD, SWIPE_CARD, TAP_CARD, MANUAL_ENTRY; } data class ReaderSoftwareUpdateApi( @@ -1171,17 +1111,17 @@ data class ReaderSoftwareUpdateApi( val requiredAt: Long, val settingsVersion: String?, val timeEstimate: UpdateTimeEstimateApi, - val version: String + val version: String, ) { fun serialize(): List { return listOf( - components.map { it.ordinal }, + components.map { it.ordinal} , keyProfileName, onlyInstallRequiredUpdates, requiredAt, settingsVersion, timeEstimate.ordinal, - version + version, ) } } @@ -1194,7 +1134,7 @@ data class ReceiptDetailsApi( val authorizationResponseCode: String, val dedicatedFileName: String?, val terminalVerificationResults: String?, - val transactionStatusInformation: String? + val transactionStatusInformation: String?, ) { fun serialize(): List { return listOf( @@ -1205,7 +1145,7 @@ data class ReceiptDetailsApi( authorizationResponseCode, dedicatedFileName, terminalVerificationResults, - transactionStatusInformation + transactionStatusInformation, ) } } @@ -1220,7 +1160,7 @@ data class RefundApi( val metadata: HashMap, val paymentMethodDetails: PaymentMethodDetailsApi?, val reason: String?, - val status: RefundStatusApi? + val status: RefundStatusApi?, ) { fun serialize(): List { return listOf( @@ -1233,15 +1173,13 @@ data class RefundApi( hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()), paymentMethodDetails?.serialize(), reason, - status?.ordinal + status?.ordinal, ) } } enum class RefundStatusApi { - SUCCEEDED, - PENDING, - FAILED + SUCCEEDED, PENDING, FAILED; } data class SetupAttemptApi( @@ -1253,7 +1191,7 @@ data class SetupAttemptApi( val paymentMethodDetails: SetupAttemptPaymentMethodDetailsApi?, val paymentMethodId: String?, val setupIntentId: String, - val status: SetupAttemptStatusApi + val status: SetupAttemptStatusApi, ) { fun serialize(): List { return listOf( @@ -1265,42 +1203,37 @@ data class SetupAttemptApi( paymentMethodDetails?.serialize(), paymentMethodId, setupIntentId, - status.ordinal + status.ordinal, ) } } data class SetupAttemptCardPresentDetailsApi( val emvAuthData: String, - val generatedCard: String + val generatedCard: String, ) { fun serialize(): List { return listOf( emvAuthData, - generatedCard + generatedCard, ) } } data class SetupAttemptPaymentMethodDetailsApi( val cardPresent: SetupAttemptCardPresentDetailsApi?, - val interacPresent: SetupAttemptCardPresentDetailsApi? + val interacPresent: SetupAttemptCardPresentDetailsApi?, ) { fun serialize(): List { return listOf( cardPresent?.serialize(), - interacPresent?.serialize() + interacPresent?.serialize(), ) } } enum class SetupAttemptStatusApi { - REQUIRES_CONFIRMATION, - REQUIRES_ACTION, - PROCESSING, - SUCCEEDED, - FAILED, - ABANDONED + REQUIRES_CONFIRMATION, REQUIRES_ACTION, PROCESSING, SUCCEEDED, FAILED, ABANDONED; } data class SetupIntentApi( @@ -1310,7 +1243,7 @@ data class SetupIntentApi( val latestAttempt: SetupAttemptApi?, val metadata: HashMap, val status: SetupIntentStatusApi, - val usage: SetupIntentUsageApi + val usage: SetupIntentUsageApi, ) { fun serialize(): List { return listOf( @@ -1320,92 +1253,56 @@ data class SetupIntentApi( latestAttempt?.serialize(), hashMapOf(*metadata.map { (k, v) -> k to v }.toTypedArray()), status.ordinal, - usage.ordinal + usage.ordinal, ) } } enum class SetupIntentStatusApi { - REQUIRES_PAYMENT_METHOD, - REQUIRES_CONFIRMATION, - REQUIRES_ACTION, - PROCESSING, - SUCCEEDED, - CANCELLED + REQUIRES_PAYMENT_METHOD, REQUIRES_CONFIRMATION, REQUIRES_ACTION, PROCESSING, SUCCEEDED, CANCELLED; } enum class SetupIntentUsageApi { - ON_SESSION, - OFF_SESSION + ON_SESSION, OFF_SESSION; } enum class SimulateReaderUpdateApi { - AVAILABLE, - NONE, - REQUIRED, - RANDOM + AVAILABLE, NONE, REQUIRED, RANDOM; } data class SimulatedCardApi( val testCardNumber: String?, - val type: SimulatedCardTypeApi? + val type: SimulatedCardTypeApi?, ) { companion object { - fun deserialize(serialized: List): SimulatedCardApi { + fun deserialize( + serialized: List, + ): SimulatedCardApi { return SimulatedCardApi( testCardNumber = serialized[0] as String?, - type = (serialized[1] as Int?)?.let { SimulatedCardTypeApi.values()[it] } + type = (serialized[1] as Int?)?.let { SimulatedCardTypeApi.values()[it] }, ) } } } enum class SimulatedCardTypeApi { - VISA, - VISA_DEBIT, - VISA_US_COMMON_DEBIT, - MASTERCARD, - MASTER_DEBIT, - MASTERCARD_PREPAID, - AMEX, - AMEX2, - DISCOVER, - DISCOVER2, - DINERS, - DINERS14_DIGIT, - JBC, - UNION_PAY, - INTERAC, - EFTPOS_AU_DEBIT, - EFTPOS_AU_VISA_DEBIT, - EFTPOS_AU_DEBIT_MASTERCARD, - CHARGE_DECLINED, - CHARGE_DECLINED_INSUFFICIENT_FUNDS, - CHARGE_DECLINED_LOST_CARD, - CHARGE_DECLINED_STOLEN_CARD, - CHARGE_DECLINED_EXPIRED_CARD, - CHARGE_DECLINED_PROCESSING_ERROR, - ONLINE_PIN_CVM, - ONLINE_PIN_SCA_RETRY, - OFFLINE_PIN_CVM, - OFFLINE_PIN_SCA_RETRY + VISA, VISA_DEBIT, VISA_US_COMMON_DEBIT, MASTERCARD, MASTER_DEBIT, MASTERCARD_PREPAID, AMEX, AMEX2, DISCOVER, DISCOVER2, DINERS, DINERS14_DIGIT, JBC, UNION_PAY, INTERAC, EFTPOS_AU_DEBIT, EFTPOS_AU_VISA_DEBIT, EFTPOS_AU_DEBIT_MASTERCARD, CHARGE_DECLINED, CHARGE_DECLINED_INSUFFICIENT_FUNDS, CHARGE_DECLINED_LOST_CARD, CHARGE_DECLINED_STOLEN_CARD, CHARGE_DECLINED_EXPIRED_CARD, CHARGE_DECLINED_PROCESSING_ERROR, ONLINE_PIN_CVM, ONLINE_PIN_SCA_RETRY, OFFLINE_PIN_CVM, OFFLINE_PIN_SCA_RETRY; } data class SimulatorConfigurationApi( val simulatedCard: SimulatedCardApi, val simulatedTipAmount: Long?, - val update: SimulateReaderUpdateApi + val update: SimulateReaderUpdateApi, ) { companion object { - fun deserialize(serialized: List): SimulatorConfigurationApi { + fun deserialize( + serialized: List, + ): SimulatorConfigurationApi { return SimulatorConfigurationApi( - simulatedCard = (serialized[0] as List).let { - SimulatedCardApi.deserialize( - it - ) - }, + simulatedCard = (serialized[0] as List).let { SimulatedCardApi.deserialize(it) }, simulatedTipAmount = (serialized[1] as? Number)?.toLong(), - update = (serialized[2] as Int).let { SimulateReaderUpdateApi.values()[it] } + update = (serialized[2] as Int).let { SimulateReaderUpdateApi.values()[it] }, ) } } @@ -1416,7 +1313,7 @@ data class TerminalExceptionApi( val code: TerminalExceptionCodeApi, val message: String, val paymentIntent: PaymentIntentApi?, - val stackTrace: String? + val stackTrace: String?, ) { fun serialize(): List { return listOf( @@ -1424,166 +1321,43 @@ data class TerminalExceptionApi( code.ordinal, message, paymentIntent?.serialize(), - stackTrace + stackTrace, ) } } enum class TerminalExceptionCodeApi { - UNKNOWN, - READER_NOT_RECOVERED, - PAYMENT_INTENT_NOT_RECOVERED, - SETUP_INTENT_NOT_RECOVERED, - CANCEL_FAILED, - NOT_CONNECTED_TO_READER, - ALREADY_CONNECTED_TO_READER, - BLUETOOTH_DISABLED, - BLUETOOTH_PERMISSION_DENIED, - CONFIRM_INVALID_PAYMENT_INTENT, - INVALID_CLIENT_SECRET, - INVALID_READER_FOR_UPDATE, - UNSUPPORTED_OPERATION, - UNEXPECTED_OPERATION, - UNSUPPORTED_SDK, - FEATURE_NOT_AVAILABLE_WITH_CONNECTED_READER, - USB_PERMISSION_DENIED, - USB_DISCOVERY_TIMED_OUT, - INVALID_PARAMETER, - INVALID_REQUIRED_PARAMETER, - INVALID_TIP_PARAMETER, - LOCAL_MOBILE_UNSUPPORTED_DEVICE, - LOCAL_MOBILE_UNSUPPORTED_OPERATING_SYSTEM_VERSION, - LOCAL_MOBILE_DEVICE_TAMPERED, - LOCAL_MOBILE_DEBUG_NOT_SUPPORTED, - OFFLINE_MODE_UNSUPPORTED_OPERATING_SYSTEM_VERSION, - CANCELED, - LOCATION_SERVICES_DISABLED, - BLUETOOTH_SCAN_TIMED_OUT, - BLUETOOTH_LOW_ENERGY_UNSUPPORTED, - READER_SOFTWARE_UPDATE_FAILED_BATTERY_LOW, - READER_SOFTWARE_UPDATE_FAILED_INTERRUPTED, - READER_SOFTWARE_UPDATE_FAILED_EXPIRED_UPDATE, - BLUETOOTH_CONNECTION_FAILED_BATTERY_CRITICALLY_LOW, - CARD_INSERT_NOT_READ, - CARD_SWIPE_NOT_READ, - CARD_READ_TIMED_OUT, - CARD_REMOVED, - CUSTOMER_CONSENT_REQUIRED, - CARD_LEFT_IN_READER, - FEATURE_NOT_ENABLED_ON_ACCOUNT, - PASSCODE_NOT_ENABLED, - COMMAND_NOT_ALLOWED_DURING_CALL, - INVALID_AMOUNT, - INVALID_CURRENCY, - APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_REQUIRESI_CLOUD_SIGN_IN, - APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_CANCELED, - APPLE_BUILT_IN_READER_FAILED_TO_PREPARE, - APPLE_BUILT_IN_READER_DEVICE_BANNED, - APPLE_BUILT_IN_READER_T_O_S_NOT_YET_ACCEPTED, - APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_FAILED, - APPLE_BUILT_IN_READER_MERCHANT_BLOCKED, - APPLE_BUILT_IN_READER_INVALID_MERCHANT, - READER_BUSY, - INCOMPATIBLE_READER, - READER_COMMUNICATION_ERROR, - UNKNOWN_READER_IP_ADDRESS, - INTERNET_CONNECT_TIME_OUT, - CONNECT_FAILED_READER_IS_IN_USE, - READER_NOT_ACCESSIBLE_IN_BACKGROUND, - BLUETOOTH_ERROR, - BLUETOOTH_CONNECT_TIMED_OUT, - BLUETOOTH_DISCONNECTED, - BLUETOOTH_PEER_REMOVED_PAIRING_INFORMATION, - BLUETOOTH_ALREADY_PAIRED_WITH_ANOTHER_DEVICE, - BLUETOOTH_RECONNECT_STARTED, - USB_DISCONNECTED, - USB_RECONNECT_STARTED, - READER_CONNECTED_TO_ANOTHER_DEVICE, - READER_SOFTWARE_UPDATE_FAILED, - READER_SOFTWARE_UPDATE_FAILED_READER_ERROR, - READER_SOFTWARE_UPDATE_FAILED_SERVER_ERROR, - NFC_DISABLED, - UNSUPPORTED_READER_VERSION, - UNEXPECTED_SDK_ERROR, - UNEXPECTED_READER_ERROR, - ENCRYPTION_KEY_FAILURE, - ENCRYPTION_KEY_STILL_INITIALIZING, - DECLINED_BY_STRIPE_API, - DECLINED_BY_READER, - NOT_CONNECTED_TO_INTERNET, - REQUEST_TIMED_OUT, - STRIPE_API_CONNECTION_ERROR, - STRIPE_API_ERROR, - STRIPE_API_RESPONSE_DECODING_ERROR, - INTERNAL_NETWORK_ERROR, - CONNECTION_TOKEN_PROVIDER_ERROR, - SESSION_EXPIRED, - UNSUPPORTED_MOBILE_DEVICE_CONFIGURATION, - COMMAND_NOT_ALLOWED, - AMOUNT_EXCEEDS_MAX_OFFLINE_AMOUNT, - OFFLINE_PAYMENTS_DATABASE_TOO_LARGE, - READER_CONNECTION_NOT_AVAILABLE_OFFLINE, - READER_CONNECTION_OFFLINE_LOCATION_MISMATCH, - READER_CONNECTION_OFFLINE_NEEDS_UPDATE, - LOCATION_CONNECTION_NOT_AVAILABLE_OFFLINE, - NO_LAST_SEEN_ACCOUNT, - INVALID_OFFLINE_CURRENCY, - REFUND_FAILED, - CARD_SWIPE_NOT_AVAILABLE, - INTERAC_NOT_SUPPORTED_OFFLINE, - ONLINE_PIN_NOT_SUPPORTED_OFFLINE, - OFFLINE_AND_CARD_EXPIRED, - OFFLINE_TRANSACTION_DECLINED, - OFFLINE_COLLECT_AND_CONFIRM_MISMATCH, - FORWARDING_TEST_MODE_PAYMENT_IN_LIVE_MODE, - FORWARDING_LIVE_MODE_PAYMENT_IN_TEST_MODE, - OFFLINE_PAYMENT_INTENT_NOT_FOUND, - UPDATE_PAYMENT_INTENT_UNAVAILABLE_WHILE_OFFLINE, - UPDATE_PAYMENT_INTENT_UNAVAILABLE_WHILE_OFFLINE_MODE_ENABLED, - MISSING_EMV_DATA, - CONNECTION_TOKEN_PROVIDER_ERROR_WHILE_FORWARDING, - CONNECTION_TOKEN_PROVIDER_TIMED_OUT, - ACCOUNT_ID_MISMATCH_WHILE_FORWARDING, - OFFLINE_BEHAVIOR_FORCE_OFFLINE_WITH_FEATURE_DISABLED, - NOT_CONNECTED_TO_INTERNET_AND_OFFLINE_BEHAVIOR_REQUIRE_ONLINE, - TEST_CARD_IN_LIVE_MODE, - COLLECT_INPUTS_APPLICATION_ERROR, - COLLECT_INPUTS_TIMED_OUT, - COLLECT_INPUTS_UNSUPPORTED + UNKNOWN, READER_NOT_RECOVERED, PAYMENT_INTENT_NOT_RECOVERED, SETUP_INTENT_NOT_RECOVERED, CANCEL_FAILED, NOT_CONNECTED_TO_READER, ALREADY_CONNECTED_TO_READER, BLUETOOTH_DISABLED, BLUETOOTH_PERMISSION_DENIED, CONFIRM_INVALID_PAYMENT_INTENT, INVALID_CLIENT_SECRET, INVALID_READER_FOR_UPDATE, UNSUPPORTED_OPERATION, UNEXPECTED_OPERATION, UNSUPPORTED_SDK, FEATURE_NOT_AVAILABLE_WITH_CONNECTED_READER, USB_PERMISSION_DENIED, USB_DISCOVERY_TIMED_OUT, INVALID_PARAMETER, REQUEST_DYNAMIC_CURRENCY_CONVERSION_REQUIRES_UPDATE_PAYMENT_INTENT, DYNAMIC_CURRENCY_CONVERSION_NOT_AVAILABLE, INVALID_REQUIRED_PARAMETER, INVALID_TIP_PARAMETER, LOCAL_MOBILE_UNSUPPORTED_DEVICE, LOCAL_MOBILE_UNSUPPORTED_OPERATING_SYSTEM_VERSION, LOCAL_MOBILE_DEVICE_TAMPERED, LOCAL_MOBILE_DEBUG_NOT_SUPPORTED, OFFLINE_MODE_UNSUPPORTED_OPERATING_SYSTEM_VERSION, CANCELED, LOCATION_SERVICES_DISABLED, BLUETOOTH_SCAN_TIMED_OUT, BLUETOOTH_LOW_ENERGY_UNSUPPORTED, READER_SOFTWARE_UPDATE_FAILED_BATTERY_LOW, READER_SOFTWARE_UPDATE_FAILED_INTERRUPTED, READER_SOFTWARE_UPDATE_FAILED_EXPIRED_UPDATE, READER_BATTERY_CRITICALLY_LOW, CARD_INSERT_NOT_READ, CARD_SWIPE_NOT_READ, CARD_READ_TIMED_OUT, CARD_REMOVED, CUSTOMER_CONSENT_REQUIRED, CARD_LEFT_IN_READER, FEATURE_NOT_ENABLED_ON_ACCOUNT, PASSCODE_NOT_ENABLED, COMMAND_NOT_ALLOWED_DURING_CALL, INVALID_AMOUNT, INVALID_CURRENCY, APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_REQUIRESI_CLOUD_SIGN_IN, APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_CANCELED, APPLE_BUILT_IN_READER_FAILED_TO_PREPARE, APPLE_BUILT_IN_READER_DEVICE_BANNED, APPLE_BUILT_IN_READER_T_O_S_NOT_YET_ACCEPTED, APPLE_BUILT_IN_READER_T_O_S_ACCEPTANCE_FAILED, APPLE_BUILT_IN_READER_MERCHANT_BLOCKED, APPLE_BUILT_IN_READER_INVALID_MERCHANT, APPLE_BUILT_IN_READER_ACCOUNT_DEACTIVATED, READER_MISSING_ENCRYPTION_KEYS, READER_BUSY, INCOMPATIBLE_READER, READER_COMMUNICATION_ERROR, UNKNOWN_READER_IP_ADDRESS, INTERNET_CONNECT_TIME_OUT, CONNECT_FAILED_READER_IS_IN_USE, READER_NOT_ACCESSIBLE_IN_BACKGROUND, BLUETOOTH_ERROR, BLUETOOTH_CONNECT_TIMED_OUT, BLUETOOTH_DISCONNECTED, BLUETOOTH_PEER_REMOVED_PAIRING_INFORMATION, BLUETOOTH_ALREADY_PAIRED_WITH_ANOTHER_DEVICE, BLUETOOTH_RECONNECT_STARTED, USB_DISCONNECTED, USB_RECONNECT_STARTED, READER_CONNECTED_TO_ANOTHER_DEVICE, READER_SOFTWARE_UPDATE_FAILED, READER_SOFTWARE_UPDATE_FAILED_READER_ERROR, READER_SOFTWARE_UPDATE_FAILED_SERVER_ERROR, NFC_DISABLED, UNSUPPORTED_READER_VERSION, UNEXPECTED_SDK_ERROR, UNEXPECTED_READER_ERROR, ENCRYPTION_KEY_FAILURE, ENCRYPTION_KEY_STILL_INITIALIZING, DECLINED_BY_STRIPE_API, DECLINED_BY_READER, NOT_CONNECTED_TO_INTERNET, REQUEST_TIMED_OUT, STRIPE_API_CONNECTION_ERROR, STRIPE_API_ERROR, STRIPE_API_RESPONSE_DECODING_ERROR, INTERNAL_NETWORK_ERROR, CONNECTION_TOKEN_PROVIDER_ERROR, SESSION_EXPIRED, UNSUPPORTED_MOBILE_DEVICE_CONFIGURATION, COMMAND_NOT_ALLOWED, AMOUNT_EXCEEDS_MAX_OFFLINE_AMOUNT, OFFLINE_PAYMENTS_DATABASE_TOO_LARGE, READER_CONNECTION_NOT_AVAILABLE_OFFLINE, READER_CONNECTION_OFFLINE_LOCATION_MISMATCH, READER_CONNECTION_OFFLINE_NEEDS_UPDATE, LOCATION_CONNECTION_NOT_AVAILABLE_OFFLINE, NO_LAST_SEEN_ACCOUNT, INVALID_OFFLINE_CURRENCY, REFUND_FAILED, CARD_SWIPE_NOT_AVAILABLE, INTERAC_NOT_SUPPORTED_OFFLINE, ONLINE_PIN_NOT_SUPPORTED_OFFLINE, OFFLINE_AND_CARD_EXPIRED, OFFLINE_TRANSACTION_DECLINED, OFFLINE_COLLECT_AND_CONFIRM_MISMATCH, FORWARDING_TEST_MODE_PAYMENT_IN_LIVE_MODE, FORWARDING_LIVE_MODE_PAYMENT_IN_TEST_MODE, OFFLINE_PAYMENT_INTENT_NOT_FOUND, UPDATE_PAYMENT_INTENT_UNAVAILABLE_WHILE_OFFLINE, UPDATE_PAYMENT_INTENT_UNAVAILABLE_WHILE_OFFLINE_MODE_ENABLED, MISSING_EMV_DATA, CONNECTION_TOKEN_PROVIDER_ERROR_WHILE_FORWARDING, CONNECTION_TOKEN_PROVIDER_TIMED_OUT, ACCOUNT_ID_MISMATCH_WHILE_FORWARDING, OFFLINE_BEHAVIOR_FORCE_OFFLINE_WITH_FEATURE_DISABLED, NOT_CONNECTED_TO_INTERNET_AND_OFFLINE_BEHAVIOR_REQUIRE_ONLINE, TEST_CARD_IN_LIVE_MODE, COLLECT_INPUTS_APPLICATION_ERROR, COLLECT_INPUTS_TIMED_OUT, COLLECT_INPUTS_UNSUPPORTED, READER_SETTINGS_ERROR; } data class TipApi( - val amount: Long? + val amount: Long?, ) { fun serialize(): List { return listOf( - amount + amount, ) } } data class TippingConfigurationApi( - val eligibleAmount: Long + val eligibleAmount: Long, ) { companion object { - fun deserialize(serialized: List): TippingConfigurationApi { + fun deserialize( + serialized: List, + ): TippingConfigurationApi { return TippingConfigurationApi( - eligibleAmount = (serialized[0] as Number).toLong() + eligibleAmount = (serialized[0] as Number).toLong(), ) } } } enum class UpdateComponentApi { - INCREMENTAL, - FIRMWARE, - CONFIG, - KEYS + INCREMENTAL, FIRMWARE, CONFIG, KEYS; } enum class UpdateTimeEstimateApi { - LESS_THAN_ONE_MINUTE, - ONE_TO_TWO_MINUTES, - TWO_TO_FIVE_MINUTES, - FIVE_TO_FIFTEEN_MINUTES + LESS_THAN_ONE_MINUTE, ONE_TO_TWO_MINUTES, TWO_TO_FIVE_MINUTES, FIVE_TO_FIFTEEN_MINUTES; } diff --git a/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/ExceptionMappings.kt b/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/ExceptionMappings.kt index 98eee50..a1ef3bf 100644 --- a/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/ExceptionMappings.kt +++ b/stripe_terminal/android/src/main/kotlin/mek/stripeterminal/mappings/ExceptionMappings.kt @@ -108,5 +108,8 @@ private fun TerminalException.TerminalErrorCode.toApiCode(): TerminalExceptionCo TerminalException.TerminalErrorCode.COLLECT_INPUTS_TIMED_OUT -> TerminalExceptionCodeApi.COLLECT_INPUTS_TIMED_OUT TerminalException.TerminalErrorCode.COLLECT_INPUTS_INVALID_PARAMETER -> TerminalExceptionCodeApi.INVALID_PARAMETER TerminalException.TerminalErrorCode.COLLECT_INPUTS_UNSUPPORTED -> TerminalExceptionCodeApi.COLLECT_INPUTS_UNSUPPORTED + TerminalException.TerminalErrorCode.READER_BATTERY_CRITICALLY_LOW -> TerminalExceptionCodeApi.READER_BATTERY_CRITICALLY_LOW + TerminalException.TerminalErrorCode.READER_SETTINGS_ERROR -> TerminalExceptionCodeApi.READER_SETTINGS_ERROR + TerminalException.TerminalErrorCode.READER_MISSING_ENCRYPTION_KEYS -> TerminalExceptionCodeApi.READER_MISSING_ENCRYPTION_KEYS } } diff --git a/stripe_terminal/example/android/app/build.gradle b/stripe_terminal/example/android/app/build.gradle index 06569fc..727705f 100644 --- a/stripe_terminal/example/android/app/build.gradle +++ b/stripe_terminal/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,13 +22,10 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - namespace "mek.stripeterminal.example" - compileSdk 34 // flutter.compileSdkVersion + namespace "mek.stripe_terminal_example" +// compileSdkVersion flutter.compileSdkVersion + compileSdkVersion 34 ndkVersion flutter.ndkVersion compileOptions { @@ -44,7 +42,8 @@ android { } defaultConfig { - applicationId "mek.stripeterminal.example" + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "mek.stripe_terminal_example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 26 @@ -66,6 +65,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/stripe_terminal/example/android/app/src/main/AndroidManifest.xml b/stripe_terminal/example/android/app/src/main/AndroidManifest.xml index 804f407..4687758 100644 --- a/stripe_terminal/example/android/app/src/main/AndroidManifest.xml +++ b/stripe_terminal/example/android/app/src/main/AndroidManifest.xml @@ -12,7 +12,7 @@ android:icon="@mipmap/ic_launcher" android:label="stripe_terminal_example"> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" + plugins { + id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version '8.1.4' apply false + id 'org.jetbrains.kotlin.android' version '1.9.10' apply false +} + +include ":app" diff --git a/stripe_terminal/example/ios/Flutter/AppFrameworkInfo.plist b/stripe_terminal/example/ios/Flutter/AppFrameworkInfo.plist index 9625e10..7c56964 100644 --- a/stripe_terminal/example/ios/Flutter/AppFrameworkInfo.plist +++ b/stripe_terminal/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/stripe_terminal/example/ios/Podfile.lock b/stripe_terminal/example/ios/Podfile.lock index 6b37fd8..2f84acc 100644 --- a/stripe_terminal/example/ios/Podfile.lock +++ b/stripe_terminal/example/ios/Podfile.lock @@ -1,11 +1,11 @@ PODS: - Flutter (1.0.0) - - mek_stripe_terminal (3.2.1): + - mek_stripe_terminal (3.4.0): - Flutter - - StripeTerminal (~> 3.2.1) + - StripeTerminal (~> 3.4.0) - permission_handler_apple (9.1.1): - Flutter - - StripeTerminal (3.2.1) + - StripeTerminal (3.4.0) DEPENDENCIES: - Flutter (from `Flutter`) @@ -25,11 +25,11 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/permission_handler_apple/ios" SPEC CHECKSUMS: - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - mek_stripe_terminal: 6994276438779ae15e002b97d98f13f60ac11d7b + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + mek_stripe_terminal: 65034b98fe250693ba60e44b1f0b283b8d8c5700 permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 - StripeTerminal: 420b64bada15fae3b47946662793ae099acb5ed6 + StripeTerminal: bdca32b058179ff3595c7d886a1cc45d4e810c5c PODFILE CHECKSUM: cf4dc61115723a2c178f9ac6bcd06534dfb5b047 -COCOAPODS: 1.12.1 +COCOAPODS: 1.15.2 diff --git a/stripe_terminal/example/ios/Runner.xcodeproj/project.pbxproj b/stripe_terminal/example/ios/Runner.xcodeproj/project.pbxproj index 5734a5f..4078b54 100644 --- a/stripe_terminal/example/ios/Runner.xcodeproj/project.pbxproj +++ b/stripe_terminal/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,14 +8,14 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 1CC971B6E3375A4492F49B96 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 44DD29DBBAE91F2650BE3ADA /* Pods_Runner.framework */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 67C6DD3DD6D8B02EF4F9DAC8 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A416CF53C204774AD10CF9 /* Pods_Runner.framework */; }; + 60709A17AC67F8757DCFE398 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D8C9478DFCA22FD57DBC53B /* Pods_RunnerTests.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - A9B01832206A385DFBE0EBB3 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5A6172247C1B4080556E067 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -42,19 +42,20 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0FA8C2D1A98132E1E1EF9522 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 16A416CF53C204774AD10CF9 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 20EA22882F8B848375B39D44 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 2AA42BCEC4C0A269FED20F9A /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 522AB49F63F8535A6DAD6A6B /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - 742274D0E7CFE1AE523A6322 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 41F69A300DED9DC9FACB3A98 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 44DD29DBBAE91F2650BE3ADA /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4D8C9478DFCA22FD57DBC53B /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 52F1BA1F3C7D3AA84297B126 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 8FED9896B3542B696DEC6913 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -62,59 +63,45 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A24CCDCC1B124E9C33A4BEA7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - B1DBE4673F35A6880B492A21 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - C5A6172247C1B4080556E067 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B93BB615C3F6864049228179 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + CEEB7CCF65DC9F987949E2E9 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 3A18BAFE1CF39D217AD35955 /* Frameworks */ = { + 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A9B01832206A385DFBE0EBB3 /* Pods_RunnerTests.framework in Frameworks */, + 1CC971B6E3375A4492F49B96 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 97C146EB1CF9000F007C117D /* Frameworks */ = { + C280EC9DE0DE9B2055B6EDF6 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 67C6DD3DD6D8B02EF4F9DAC8 /* Pods_Runner.framework in Frameworks */, + 60709A17AC67F8757DCFE398 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 331C8082294A63A400263BE5 /* RunnerTests */ = { - isa = PBXGroup; - children = ( - 331C807B294A618700263BE5 /* RunnerTests.swift */, - ); - path = RunnerTests; - sourceTree = ""; - }; - 4317ABC454C18448C494594B /* Frameworks */ = { + 1633E2AF417FB1F00223A5CB /* Frameworks */ = { isa = PBXGroup; children = ( - 16A416CF53C204774AD10CF9 /* Pods_Runner.framework */, - C5A6172247C1B4080556E067 /* Pods_RunnerTests.framework */, + 44DD29DBBAE91F2650BE3ADA /* Pods_Runner.framework */, + 4D8C9478DFCA22FD57DBC53B /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; }; - 751DF252CF972EC9EB363452 /* Pods */ = { + 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( - A24CCDCC1B124E9C33A4BEA7 /* Pods-Runner.debug.xcconfig */, - 742274D0E7CFE1AE523A6322 /* Pods-Runner.release.xcconfig */, - B1DBE4673F35A6880B492A21 /* Pods-Runner.profile.xcconfig */, - 20EA22882F8B848375B39D44 /* Pods-RunnerTests.debug.xcconfig */, - 522AB49F63F8535A6DAD6A6B /* Pods-RunnerTests.release.xcconfig */, - 2AA42BCEC4C0A269FED20F9A /* Pods-RunnerTests.profile.xcconfig */, + 331C807B294A618700263BE5 /* RunnerTests.swift */, ); - path = Pods; + path = RunnerTests; sourceTree = ""; }; 9740EEB11CF90186004384FC /* Flutter */ = { @@ -135,8 +122,8 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, - 751DF252CF972EC9EB363452 /* Pods */, - 4317ABC454C18448C494594B /* Frameworks */, + CC5A9BF3395C0EAF237B8C5C /* Pods */, + 1633E2AF417FB1F00223A5CB /* Frameworks */, ); sourceTree = ""; }; @@ -164,6 +151,20 @@ path = Runner; sourceTree = ""; }; + CC5A9BF3395C0EAF237B8C5C /* Pods */ = { + isa = PBXGroup; + children = ( + 8FED9896B3542B696DEC6913 /* Pods-Runner.debug.xcconfig */, + 52F1BA1F3C7D3AA84297B126 /* Pods-Runner.release.xcconfig */, + B93BB615C3F6864049228179 /* Pods-Runner.profile.xcconfig */, + 41F69A300DED9DC9FACB3A98 /* Pods-RunnerTests.debug.xcconfig */, + 0FA8C2D1A98132E1E1EF9522 /* Pods-RunnerTests.release.xcconfig */, + CEEB7CCF65DC9F987949E2E9 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -171,10 +172,10 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - D19675C03AE6B9DCB060B314 /* [CP] Check Pods Manifest.lock */, + BD0C220B176C8E239ED99C20 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, - 3A18BAFE1CF39D217AD35955 /* Frameworks */, + C280EC9DE0DE9B2055B6EDF6 /* Frameworks */, ); buildRules = ( ); @@ -190,14 +191,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 06212380A5B401016BCE9879 /* [CP] Check Pods Manifest.lock */, + 58C8339F1EC355389470B2E5 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - D535F3835E7238C170AC1BD9 /* [CP] Embed Pods Frameworks */, + 242578C92C700360B79F6B52 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -214,6 +215,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { @@ -268,26 +270,21 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 06212380A5B401016BCE9879 /* [CP] Check Pods Manifest.lock */ = { + 242578C92C700360B79F6B52 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { @@ -306,6 +303,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 58C8339F1EC355389470B2E5 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -321,7 +340,7 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - D19675C03AE6B9DCB060B314 /* [CP] Check Pods Manifest.lock */ = { + BD0C220B176C8E239ED99C20 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -343,23 +362,6 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - D535F3835E7238C170AC1BD9 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -451,7 +453,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -467,14 +469,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 53SMKH5FUP; + DEVELOPMENT_TEAM = DZA2GZYF9B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -484,14 +486,14 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 20EA22882F8B848375B39D44 /* Pods-RunnerTests.debug.xcconfig */; + baseConfigurationReference = 41F69A300DED9DC9FACB3A98 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -502,14 +504,14 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 522AB49F63F8535A6DAD6A6B /* Pods-RunnerTests.release.xcconfig */; + baseConfigurationReference = 0FA8C2D1A98132E1E1EF9522 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -518,14 +520,14 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2AA42BCEC4C0A269FED20F9A /* Pods-RunnerTests.profile.xcconfig */; + baseConfigurationReference = CEEB7CCF65DC9F987949E2E9 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -579,7 +581,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -628,7 +630,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -646,14 +648,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 53SMKH5FUP; + DEVELOPMENT_TEAM = DZA2GZYF9B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -669,14 +671,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 53SMKH5FUP; + DEVELOPMENT_TEAM = DZA2GZYF9B; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = mek.stripeterminal.example; + PRODUCT_BUNDLE_IDENTIFIER = mek.stripeTerminalExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/stripe_terminal/example/pubspec.lock b/stripe_terminal/example/pubspec.lock index a274a31..0a682db 100644 --- a/stripe_terminal/example/pubspec.lock +++ b/stripe_terminal/example/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: "direct main" description: name: dio - sha256: "797e1e341c3dd2f69f2dad42564a6feff3bfb87187d05abb93b9609e6f1645c3" + sha256: "49af28382aefc53562459104f64d16b9dfd1e8ef68c862d5af436cc8356ce5a8" url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "5.4.1" flutter: dependency: "direct main" description: flutter @@ -140,7 +140,7 @@ packages: path: ".." relative: true source: path - version: "3.3.0" + version: "3.4.0" meta: dependency: transitive description: diff --git a/stripe_terminal/ios/Classes/Api/TerminalApi.swift b/stripe_terminal/ios/Classes/Api/TerminalApi.swift index 06ce076..008d0fb 100644 --- a/stripe_terminal/ios/Classes/Api/TerminalApi.swift +++ b/stripe_terminal/ios/Classes/Api/TerminalApi.swift @@ -1460,6 +1460,8 @@ enum TerminalExceptionCodeApi: Int { case usbPermissionDenied case usbDiscoveryTimedOut case invalidParameter + case requestDynamicCurrencyConversionRequiresUpdatePaymentIntent + case dynamicCurrencyConversionNotAvailable case invalidRequiredParameter case invalidTipParameter case localMobileUnsupportedDevice @@ -1474,7 +1476,7 @@ enum TerminalExceptionCodeApi: Int { case readerSoftwareUpdateFailedBatteryLow case readerSoftwareUpdateFailedInterrupted case readerSoftwareUpdateFailedExpiredUpdate - case bluetoothConnectionFailedBatteryCriticallyLow + case readerBatteryCriticallyLow case cardInsertNotRead case cardSwipeNotRead case cardReadTimedOut @@ -1494,6 +1496,8 @@ enum TerminalExceptionCodeApi: Int { case appleBuiltInReaderTOSAcceptanceFailed case appleBuiltInReaderMerchantBlocked case appleBuiltInReaderInvalidMerchant + case appleBuiltInReaderAccountDeactivated + case readerMissingEncryptionKeys case readerBusy case incompatibleReader case readerCommunicationError @@ -1561,6 +1565,7 @@ enum TerminalExceptionCodeApi: Int { case collectInputsApplicationError case collectInputsTimedOut case collectInputsUnsupported + case readerSettingsError } struct TipApi { diff --git a/stripe_terminal/ios/Classes/Mappings/ExceptionMappings.swift b/stripe_terminal/ios/Classes/Mappings/ExceptionMappings.swift index 45c8368..e6f8076 100644 --- a/stripe_terminal/ios/Classes/Mappings/ExceptionMappings.swift +++ b/stripe_terminal/ios/Classes/Mappings/ExceptionMappings.swift @@ -84,10 +84,18 @@ extension NSError { return .forwardingLiveModePaymentInTestMode case .readerConnectionConfigurationInvalid: return .invalidParameter + case .requestDynamicCurrencyConversionRequiresUpdatePaymentIntent: + return .requestDynamicCurrencyConversionRequiresUpdatePaymentIntent + case .dynamicCurrencyConversionNotAvailable: + return .dynamicCurrencyConversionNotAvailable case .readerTippingParameterInvalid: return .invalidTipParameter case .invalidLocationIdParameter: return .invalidParameter + case .collectInputsInvalidParameter: + return .invalidParameter + case .collectInputsUnsupported: + return .collectInputsUnsupported case .canceled: return .canceled case .locationServicesDisabled: @@ -107,7 +115,7 @@ extension NSError { case .readerSoftwareUpdateFailedExpiredUpdate: return .readerSoftwareUpdateFailedExpiredUpdate case .bluetoothConnectionFailedBatteryCriticallyLow: - return .bluetoothConnectionFailedBatteryCriticallyLow + return .readerBatteryCriticallyLow case .cardInsertNotRead: return .cardInsertNotRead case .cardSwipeNotRead: @@ -126,6 +134,8 @@ extension NSError { return .readerConnectionOfflineLocationMismatch case .readerConnectionOfflineNeedsUpdate: return .readerConnectionOfflineNeedsUpdate + case .readerConnectionOfflinePairingUnseenDisabled: + return .locationConnectionNotAvailableOffline case .noLastSeenAccount: return .noLastSeenAccount case .amountExceedsMaxOfflineAmount: @@ -150,6 +160,8 @@ extension NSError { return .appleBuiltInReaderTOSAcceptanceRequiresiCloudSignIn case .appleBuiltInReaderTOSAcceptanceCanceled: return .appleBuiltInReaderTOSAcceptanceCanceled + case .collectInputsTimedOut: + return .collectInputsTimedOut case .readerBusy: return .readerBusy case .incompatibleReader: @@ -198,6 +210,10 @@ extension NSError { return .appleBuiltInReaderMerchantBlocked case .appleBuiltInReaderInvalidMerchant: return .appleBuiltInReaderInvalidMerchant + case .appleBuiltInReaderAccountDeactivated: + return .appleBuiltInReaderAccountDeactivated + case .readerMissingEncryptionKeys: + return .readerMissingEncryptionKeys case .unexpectedSdkError: return .unexpectedSdkError case .unexpectedReaderError: @@ -206,6 +222,8 @@ extension NSError { return .encryptionKeyFailure case .encryptionKeyStillInitializing: return .encryptionKeyStillInitializing + case .collectInputsApplicationError: + return .collectInputsApplicationError case .declinedByStripeAPI: return .declinedByStripeApi case .declinedByReader: diff --git a/stripe_terminal/ios/mek_stripe_terminal.podspec b/stripe_terminal/ios/mek_stripe_terminal.podspec index 7a306f7..ddb9f84 100644 --- a/stripe_terminal/ios/mek_stripe_terminal.podspec +++ b/stripe_terminal/ios/mek_stripe_terminal.podspec @@ -25,5 +25,5 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' - s.dependency 'StripeTerminal', '~> 3.2.1' + s.dependency 'StripeTerminal', '~> 3.4.0' end diff --git a/stripe_terminal/lib/src/platform/terminal_platform.api.dart b/stripe_terminal/lib/src/platform/terminal_platform.api.dart index 21ce5f3..e481f04 100644 --- a/stripe_terminal/lib/src/platform/terminal_platform.api.dart +++ b/stripe_terminal/lib/src/platform/terminal_platform.api.dart @@ -1,6 +1,8 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: unused_element, unnecessary_lambdas, cast_nullable_to_non_nullable, prefer_if_elements_to_conditional_expressions +// ignore_for_file: cast_nullable_to_non_nullable +// ignore_for_file: prefer_if_elements_to_conditional_expressions +// ignore_for_file: unnecessary_lambdas, unused_element part of 'terminal_platform.dart'; diff --git a/stripe_terminal/lib/src/terminal_exception.dart b/stripe_terminal/lib/src/terminal_exception.dart index 5b9176b..2c5e574 100644 --- a/stripe_terminal/lib/src/terminal_exception.dart +++ b/stripe_terminal/lib/src/terminal_exception.dart @@ -1,6 +1,8 @@ import 'package:mek_stripe_terminal/src/models/payment_intent.dart'; import 'package:one_for_all/one_for_all.dart'; +/// Android exception codes: https://stripe.dev/stripe-terminal-android/external/com.stripe.stripeterminal.external.models/-terminal-exception/-terminal-error-code/index.html +/// IOS exception codes: https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPError.html @SerializableEnum(hostToFlutter: true) enum TerminalExceptionCode { // Flutter Plugin @@ -24,10 +26,12 @@ enum TerminalExceptionCode { // Android/IOS sdk - /// Only Android. Cancelling an operation failed + /// Cancelling an operation failed + /// Android(CANCEL_FAILED) cancelFailed, /// No reader is connected. Connect to a reader before trying again. + /// Android(NOT_CONNECTED_TO_READER) IOS(SCPErrorNotConnectedToReader) notConnectedToReader, /// Already connected to a reader. @@ -50,7 +54,7 @@ enum TerminalExceptionCode { /// A [PaymentIntent] or [SetupIntent] was referenced using an invalid client secret. invalidClientSecret, - /// Only IOS. [StripeTerminal.installUpdate] was passed an update that is for a different reader. ù + /// Only IOS. [StripeTerminal.installUpdate] was passed an update that is for a different reader. /// Updates can only be installed on the reader that was connected when the update was announced. invalidReaderForUpdate, @@ -88,8 +92,19 @@ enum TerminalExceptionCode { /// - ReaderConnectionConfigurationInvalid: An invalid ConnectionConfiguration was passed through connect. /// - invalidRequiredParameterOnBehalfOf: The [PaymentIntent] uses on_behalf_of but the Connected /// Account ID was not set in LocalMobileConnectionConfiguration + /// - SCPErrorCollectInputsInvalidParameter: An invalid parameter was used to start a collect + /// inputs operation. invalidParameter, + /// Error reported when calling collectPaymentMethod with request dynamic currency conversion and + /// a CollectConfiguration with updatePaymentIntent set to false. + /// IOS(SCPErrorRequestDynamicCurrencyConversionRequiresUpdatePaymentIntent) + requestDynamicCurrencyConversionRequiresUpdatePaymentIntent, + + /// Dynamic Currency Conversion is not currently available. + /// IOS(SCPErrorDynamicCurrencyConversionNotAvailable) + dynamicCurrencyConversionNotAvailable, + /// A required parameter was invalid or missing. invalidRequiredParameter, @@ -145,9 +160,9 @@ enum TerminalExceptionCode { /// Please disconnect and reconnect from the reader to retrieve a new update. readerSoftwareUpdateFailedExpiredUpdate, - /// Only IOS. The reader has a critically low battery and cannot connect to the device. + /// The reader has a critically low battery and cannot connect to the device. /// Charge the reader before trying again. - bluetoothConnectionFailedBatteryCriticallyLow, + readerBatteryCriticallyLow, /// The card is not a chip card. cardInsertNotRead, @@ -215,6 +230,15 @@ enum TerminalExceptionCode { /// Only IOS. This merchant account cannot be used with the Apple Built-In reader as it is invalid. appleBuiltInReaderInvalidMerchant, + /// Only IOS. An error that indicates the linked Apple ID account has been deactivated by the merchant. + appleBuiltInReaderAccountDeactivated, + + /// Please contact support at https://support.stripe.com/ for more help. + /// Android: The reader is missing encryption keys required for taking payments. Disconnect and + /// reconnect to the reader to attempt to re-install the keys. If the error persists, contact + /// Stripe support. + readerMissingEncryptionKeys, + /// The reader is busy. readerBusy, @@ -383,9 +407,10 @@ enum TerminalExceptionCode { /// to this reader while online to install required updates before this reader can be used for offline payments. readerConnectionOfflineNeedsUpdate, - /// Only Android. Connecting to the reader at this location failed. To connect a reader at a + /// Connecting to the reader at this location failed. To connect a reader at a /// specified location while offline, a reader must have been connected online at that location /// within the last several weeks. + /// Android(LOCATION_CONNECTION_NOT_AVAILABLE_OFFLINE) IOS(SCPErrorReaderConnectionOfflinePairingUnseenDisabled) locationConnectionNotAvailableOffline, /// The SDK has not activated a reader online yet, meaning there is no account with which @@ -482,9 +507,12 @@ enum TerminalExceptionCode { /// Error reported when a timeout occurs while processing a collect inputs operation. collectInputsTimedOut, - /// Only Android. Error reported when the connected account does not have access to this feature, + /// Error reported when the connected account does not have access to this feature, /// or the reader/SDK version is not compatible with the collect inputs operation. collectInputsUnsupported, + + /// Only Android. Error reported when an attempt to get or set reader settings has failed. + readerSettingsError, ; final String? message; @@ -512,8 +540,8 @@ class TerminalException implements Exception { String toString() => [ 'TerminalException: ${code.name}', message, - paymentIntent, - apiError, - stackTrace, - ].nonNulls.join('\n'); + if (paymentIntent != null) paymentIntent, + if (apiError != null) apiError, + if (stackTrace != null) stackTrace, + ].join('\n'); } diff --git a/stripe_terminal/pubspec.yaml b/stripe_terminal/pubspec.yaml index 8322150..cf7d22e 100644 --- a/stripe_terminal/pubspec.yaml +++ b/stripe_terminal/pubspec.yaml @@ -1,6 +1,6 @@ name: mek_stripe_terminal description: A StripeTerminal plugin to discover readers, connect to them and process payments. -version: 3.3.0 +version: 3.4.0 repository: https://github.com/BreX900/mek-packages/tree/main/stripe_terminal homepage: https://github.com/BreX900/mek-packages/tree/main/stripe_terminal topics: @@ -21,6 +21,9 @@ scripts: # To generate *.g.dart files build:runner: dart run build_runner watch --delete-conflicting-outputs + # + recreate-project: flutter create . --platforms=android,ios --project-name=stripe_terminal --template=plugin --org=mek + dependencies: flutter: { sdk: flutter }