Skip to content

Commit

Permalink
Merge pull request #351 from Adyen/feature/updateDependencies
Browse files Browse the repository at this point in the history
Updated pigeon and set minimum SDK version to Flutter 3.16/Dart 3.2
  • Loading branch information
Robert-SD authored Feb 6, 2025
2 parents 07f167e + 3df614e commit 871e908
Show file tree
Hide file tree
Showing 42 changed files with 1,989 additions and 3,186 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ios_clean_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
iPhone: [ "'iPhone 15'" ]
flutter-version: [ 3.19.x, 3.22.x, 3.24.x, 3.27.x ]
flutter-version: [ 3.16.x, 3.19.x, 3.22.x, 3.24.x, 3.27.x ]

steps:
- name: Provide more disk space
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.4.0

### New

- Set minimum SDK version to Flutter 3.16/Dart 3.2

## 1.3.0

### New
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.adyen.checkout.flutter

import CheckoutPlatformInterface
import ComponentFlutterInterface
import ComponentPlatformInterface
import DropInFlutterInterface
import DropInPlatformInterface
import android.content.Intent
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.adyen.checkout.dropin.DropIn
import com.adyen.checkout.flutter.components.ComponentPlatformApi
import com.adyen.checkout.flutter.dropIn.DropInPlatformApi
import com.adyen.checkout.flutter.generated.CheckoutPlatformInterface
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.ComponentPlatformInterface
import com.adyen.checkout.flutter.generated.DropInFlutterInterface
import com.adyen.checkout.flutter.generated.DropInPlatformInterface
import com.adyen.checkout.flutter.session.SessionHolder
import com.adyen.checkout.flutter.utils.Constants.Companion.WRONG_FLUTTER_ACTIVITY_USAGE_ERROR_MESSAGE
import io.flutter.embedding.engine.plugins.FlutterPlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
package com.adyen.checkout.flutter

import CardComponentConfigurationDTO
import CardExpiryDateValidationResultDTO
import CardNumberValidationResultDTO
import CardSecurityCodeValidationResultDTO
import CheckoutPlatformInterface
import DropInConfigurationDTO
import EncryptedCardDTO
import InstantPaymentConfigurationDTO
import SessionDTO
import UnencryptedCardDTO
import android.annotation.SuppressLint
import android.util.Log
import androidx.fragment.app.FragmentActivity
Expand All @@ -21,12 +11,23 @@ import com.adyen.checkout.core.AdyenLogger
import com.adyen.checkout.core.internal.util.Logger.NONE
import com.adyen.checkout.flutter.apiOnly.AdyenCSE
import com.adyen.checkout.flutter.apiOnly.CardValidation
import com.adyen.checkout.flutter.generated.CardComponentConfigurationDTO
import com.adyen.checkout.flutter.generated.CardExpiryDateValidationResultDTO
import com.adyen.checkout.flutter.generated.CardNumberValidationResultDTO
import com.adyen.checkout.flutter.generated.CardSecurityCodeValidationResultDTO
import com.adyen.checkout.flutter.generated.CheckoutPlatformInterface
import com.adyen.checkout.flutter.generated.DropInConfigurationDTO
import com.adyen.checkout.flutter.generated.EncryptedCardDTO
import com.adyen.checkout.flutter.generated.InstantPaymentConfigurationDTO
import com.adyen.checkout.flutter.generated.InstantPaymentType
import com.adyen.checkout.flutter.generated.SessionDTO
import com.adyen.checkout.flutter.generated.UnencryptedCardDTO
import com.adyen.checkout.flutter.session.SessionHolder
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAmount
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAnalyticsConfiguration
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToDropInConfiguration
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCardConfiguration
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCheckoutConfiguration
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAmount
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToDropInConfiguration
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToEnvironment
import com.adyen.checkout.redirect.RedirectComponent
import com.adyen.checkout.sessions.core.CheckoutSessionProvider
Expand Down Expand Up @@ -122,8 +123,10 @@ class CheckoutPlatformApi(

is InstantPaymentConfigurationDTO -> {
return when (configuration.instantPaymentType) {
InstantPaymentType.APPLEPAY -> throw IllegalStateException("Apple Pay is not supported on Android.")
InstantPaymentType.GOOGLEPAY -> configuration.mapToCheckoutConfiguration()
InstantPaymentType.APPLE_PAY -> throw IllegalStateException(
"Apple Pay is not supported on Android."
)
InstantPaymentType.GOOGLE_PAY -> configuration.mapToCheckoutConfiguration()
InstantPaymentType.INSTANT -> configuration.mapToCheckoutConfiguration()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.adyen.checkout.flutter.apiOnly

import EncryptedCardDTO
import UnencryptedCardDTO
import com.adyen.checkout.cse.CardEncrypter
import com.adyen.checkout.flutter.generated.EncryptedCardDTO
import com.adyen.checkout.flutter.generated.UnencryptedCardDTO
import com.adyen.checkout.flutter.utils.ConfigurationMapper.fromDTO
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToEncryptedCardDTO
import java.lang.Exception

internal object AdyenCSE {
fun encryptCard(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.adyen.checkout.flutter.apiOnly

import CardExpiryDateValidationResultDTO
import CardNumberValidationResultDTO
import CardSecurityCodeValidationResultDTO
import com.adyen.checkout.core.CardBrand
import com.adyen.checkout.core.ui.model.ExpiryDate
import com.adyen.checkout.core.ui.validation.CardExpiryDateValidationResult
Expand All @@ -11,6 +8,9 @@ import com.adyen.checkout.core.ui.validation.CardNumberValidationResult
import com.adyen.checkout.core.ui.validation.CardNumberValidator
import com.adyen.checkout.core.ui.validation.CardSecurityCodeValidationResult
import com.adyen.checkout.core.ui.validation.CardSecurityCodeValidator
import com.adyen.checkout.flutter.generated.CardExpiryDateValidationResultDTO
import com.adyen.checkout.flutter.generated.CardNumberValidationResultDTO
import com.adyen.checkout.flutter.generated.CardSecurityCodeValidationResultDTO

internal object CardValidation {
fun validateCardNumber(
Expand All @@ -21,31 +21,31 @@ internal object CardValidation {
return when (validationResult) {
is CardNumberValidationResult.Valid -> CardNumberValidationResultDTO.VALID
is CardNumberValidationResult.Invalid.IllegalCharacters ->
CardNumberValidationResultDTO.INVALIDILLEGALCHARACTERS
CardNumberValidationResultDTO.INVALID_ILLEGAL_CHARACTERS

is CardNumberValidationResult.Invalid.TooLong -> CardNumberValidationResultDTO.INVALIDTOOLONG
is CardNumberValidationResult.Invalid.TooShort -> CardNumberValidationResultDTO.INVALIDTOOSHORT
is CardNumberValidationResult.Invalid.LuhnCheck -> CardNumberValidationResultDTO.INVALIDLUHNCHECK
else -> CardNumberValidationResultDTO.INVALIDOTHERREASON
is CardNumberValidationResult.Invalid.TooLong -> CardNumberValidationResultDTO.INVALID_TOO_LONG
is CardNumberValidationResult.Invalid.TooShort -> CardNumberValidationResultDTO.INVALID_TOO_SHORT
is CardNumberValidationResult.Invalid.LuhnCheck -> CardNumberValidationResultDTO.INVALID_LUHN_CHECK
else -> CardNumberValidationResultDTO.INVALID_OTHER_REASON
}
}

fun validateCardExpiryDate(
expiryMonth: String,
expiryYear: String
): CardExpiryDateValidationResultDTO {
val expireMonth = expiryMonth.toIntOrNull() ?: return CardExpiryDateValidationResultDTO.NONPARSEABLEDATE
val expireYear = expiryYear.toIntOrNull() ?: return CardExpiryDateValidationResultDTO.NONPARSEABLEDATE
val expireMonth = expiryMonth.toIntOrNull() ?: return CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE
val expireYear = expiryYear.toIntOrNull() ?: return CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE
val expiryDate = ExpiryDate(expireMonth, expireYear)
val validationResult = CardExpiryDateValidator.validateExpiryDate(expiryDate)
return when (validationResult) {
is CardExpiryDateValidationResult.Valid -> CardExpiryDateValidationResultDTO.VALID
is CardExpiryDateValidationResult.Invalid.TooFarInTheFuture ->
CardExpiryDateValidationResultDTO.INVALIDTOOFARINTHEFUTURE
is CardExpiryDateValidationResult.Invalid.TooOld -> CardExpiryDateValidationResultDTO.INVALIDTOOOLD
CardExpiryDateValidationResultDTO.INVALID_TOO_FAR_IN_THE_FUTURE
is CardExpiryDateValidationResult.Invalid.TooOld -> CardExpiryDateValidationResultDTO.INVALID_TOO_OLD
is CardExpiryDateValidationResult.Invalid.NonParseableDate ->
CardExpiryDateValidationResultDTO.NONPARSEABLEDATE
else -> CardExpiryDateValidationResultDTO.INVALIDOTHERREASON
CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE
else -> CardExpiryDateValidationResultDTO.INVALID_OTHER_REASON
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package com.adyen.checkout.flutter.components

import ActionComponentConfigurationDTO
import ComponentCommunicationModel
import ComponentFlutterInterface
import ComponentPlatformInterface
import ErrorDTO
import InstantPaymentConfigurationDTO
import InstantPaymentSetupResultDTO
import InstantPaymentType
import PaymentEventDTO
import PaymentEventType
import PaymentResultDTO
import PaymentResultModelDTO
import android.content.Intent
import androidx.core.util.Consumer
import androidx.fragment.app.FragmentActivity
Expand All @@ -23,6 +11,20 @@ import com.adyen.checkout.flutter.components.card.CardComponentManager
import com.adyen.checkout.flutter.components.googlepay.GooglePayComponentManager
import com.adyen.checkout.flutter.components.instant.InstantComponentManager
import com.adyen.checkout.flutter.components.view.ComponentLoadingBottomSheet
import com.adyen.checkout.flutter.generated.ActionComponentConfigurationDTO
import com.adyen.checkout.flutter.generated.ComponentCommunicationModel
import com.adyen.checkout.flutter.generated.ComponentCommunicationType
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.ComponentPlatformInterface
import com.adyen.checkout.flutter.generated.ErrorDTO
import com.adyen.checkout.flutter.generated.InstantPaymentConfigurationDTO
import com.adyen.checkout.flutter.generated.InstantPaymentSetupResultDTO
import com.adyen.checkout.flutter.generated.InstantPaymentType
import com.adyen.checkout.flutter.generated.PaymentEventDTO
import com.adyen.checkout.flutter.generated.PaymentEventType
import com.adyen.checkout.flutter.generated.PaymentResultDTO
import com.adyen.checkout.flutter.generated.PaymentResultEnum
import com.adyen.checkout.flutter.generated.PaymentResultModelDTO
import com.adyen.checkout.flutter.session.SessionHolder
import com.adyen.checkout.flutter.utils.Constants
import com.adyen.checkout.googlepay.GooglePayComponent
Expand Down Expand Up @@ -81,15 +83,15 @@ class ComponentPlatformApi(
val paymentMethodJson = JSONObject(paymentMethodResponse)
val paymentMethod = PaymentMethod.SERIALIZER.deserialize(paymentMethodJson)
when (instantPaymentConfigurationDTO.instantPaymentType) {
InstantPaymentType.GOOGLEPAY ->
InstantPaymentType.GOOGLE_PAY ->
googlePayComponentManager.initialize(
paymentMethod,
componentId,
instantPaymentConfigurationDTO,
callback
)

InstantPaymentType.INSTANT, InstantPaymentType.APPLEPAY -> return
InstantPaymentType.INSTANT, InstantPaymentType.APPLE_PAY -> return
}
}

Expand All @@ -99,8 +101,8 @@ class ComponentPlatformApi(
componentId: String,
) {
when (instantPaymentConfigurationDTO.instantPaymentType) {
InstantPaymentType.GOOGLEPAY -> googlePayComponentManager.start()
InstantPaymentType.APPLEPAY -> return
InstantPaymentType.GOOGLE_PAY -> googlePayComponentManager.start()
InstantPaymentType.APPLE_PAY -> return
InstantPaymentType.INSTANT ->
instantComponentManager.start(
instantPaymentConfigurationDTO,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.adyen.checkout.flutter.components.action

import ComponentCommunicationModel
import ComponentFlutterInterface
import PaymentResultDTO
import PaymentResultEnum
import androidx.fragment.app.FragmentActivity
import com.adyen.checkout.components.core.ActionComponentCallback
import com.adyen.checkout.components.core.ActionComponentData
import com.adyen.checkout.components.core.ComponentError
import com.adyen.checkout.flutter.components.view.ComponentLoadingBottomSheet
import com.adyen.checkout.flutter.generated.ComponentCommunicationModel
import com.adyen.checkout.flutter.generated.ComponentCommunicationType
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.PaymentResultDTO
import com.adyen.checkout.flutter.generated.PaymentResultEnum

internal class ActionComponentCallback(
private val activity: FragmentActivity,
Expand All @@ -20,7 +21,7 @@ internal class ActionComponentCallback(
val data = ActionComponentData.SERIALIZER.serialize(actionComponentData).toString()
val model =
ComponentCommunicationModel(
type = ComponentCommunicationType.ADDITIONALDETAILS,
type = ComponentCommunicationType.ADDITIONAL_DETAILS,
componentId = componentId,
data = data,
)
Expand All @@ -31,8 +32,8 @@ internal class ActionComponentCallback(
ComponentLoadingBottomSheet.hide(activity.supportFragmentManager)
val type: PaymentResultEnum =
when (componentError.exception) {
is com.adyen.checkout.core.exception.CancellationException -> PaymentResultEnum.CANCELLEDBYUSER
is com.adyen.checkout.adyen3ds2.Cancelled3DS2Exception -> PaymentResultEnum.CANCELLEDBYUSER
is com.adyen.checkout.core.exception.CancellationException -> PaymentResultEnum.CANCELLED_BY_USER
is com.adyen.checkout.adyen3ds2.Cancelled3DS2Exception -> PaymentResultEnum.CANCELLED_BY_USER
else -> PaymentResultEnum.ERROR
}
val model =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.adyen.checkout.flutter.components.action

import ActionComponentConfigurationDTO
import ComponentCommunicationModel
import ComponentFlutterInterface
import PaymentResultDTO
import androidx.fragment.app.FragmentActivity
import com.adyen.checkout.action.core.GenericActionComponent
import com.adyen.checkout.action.core.internal.ActionHandlingComponent
import com.adyen.checkout.components.core.CheckoutConfiguration
import com.adyen.checkout.components.core.action.Action
import com.adyen.checkout.flutter.components.view.ComponentLoadingBottomSheet
import com.adyen.checkout.flutter.generated.ActionComponentConfigurationDTO
import com.adyen.checkout.flutter.generated.ComponentCommunicationModel
import com.adyen.checkout.flutter.generated.ComponentCommunicationType
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.PaymentResultDTO
import com.adyen.checkout.flutter.generated.PaymentResultEnum
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCheckoutConfiguration
import org.json.JSONObject
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.adyen.checkout.flutter.components.base

import ComponentCommunicationModel
import ComponentCommunicationType
import ComponentFlutterInterface
import PaymentResultDTO
import PaymentResultEnum
import com.adyen.checkout.components.core.ActionComponentData
import com.adyen.checkout.components.core.ComponentCallback
import com.adyen.checkout.components.core.ComponentError
import com.adyen.checkout.components.core.PaymentComponentData
import com.adyen.checkout.components.core.PaymentComponentState
import com.adyen.checkout.flutter.generated.ComponentCommunicationModel
import com.adyen.checkout.flutter.generated.ComponentCommunicationType
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.PaymentResultDTO
import com.adyen.checkout.flutter.generated.PaymentResultEnum
import com.adyen.checkout.flutter.utils.Constants
import java.util.concurrent.CancellationException

abstract class ComponentAdvancedCallback<T : PaymentComponentState<*>>(
private val componentFlutterApi: ComponentFlutterInterface,
Expand All @@ -20,7 +19,7 @@ abstract class ComponentAdvancedCallback<T : PaymentComponentState<*>>(
override fun onSubmit(state: T) {
val model =
ComponentCommunicationModel(
ComponentCommunicationType.ONSUBMIT,
ComponentCommunicationType.ON_SUBMIT,
componentId = componentId,
data = PaymentComponentData.SERIALIZER.serialize(state.data).toString(),
)
Expand All @@ -30,7 +29,7 @@ abstract class ComponentAdvancedCallback<T : PaymentComponentState<*>>(
override fun onAdditionalDetails(actionComponentData: ActionComponentData) {
val model =
ComponentCommunicationModel(
ComponentCommunicationType.ADDITIONALDETAILS,
ComponentCommunicationType.ADDITIONAL_DETAILS,
componentId = componentId,
data = ActionComponentData.SERIALIZER.serialize(actionComponentData).toString(),
)
Expand All @@ -43,7 +42,7 @@ abstract class ComponentAdvancedCallback<T : PaymentComponentState<*>>(
(componentError.exception is com.adyen.checkout.core.exception.CancellationException) ||
(componentError.exception is com.adyen.checkout.adyen3ds2.Cancelled3DS2Exception)
)
PaymentResultEnum.CANCELLEDBYUSER
PaymentResultEnum.CANCELLED_BY_USER
else
PaymentResultEnum.ERROR

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.adyen.checkout.flutter.components.base

import ComponentCommunicationModel
import ComponentCommunicationType
import ComponentFlutterInterface
import PaymentResultDTO
import PaymentResultEnum
import PaymentResultModelDTO
import com.adyen.checkout.components.core.ComponentError
import com.adyen.checkout.components.core.PaymentComponentState
import com.adyen.checkout.components.core.action.Action
import com.adyen.checkout.flutter.generated.ComponentCommunicationModel
import com.adyen.checkout.flutter.generated.ComponentCommunicationType
import com.adyen.checkout.flutter.generated.ComponentFlutterInterface
import com.adyen.checkout.flutter.generated.PaymentResultDTO
import com.adyen.checkout.flutter.generated.PaymentResultEnum
import com.adyen.checkout.flutter.generated.PaymentResultModelDTO
import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToOrderResponseModel
import com.adyen.checkout.flutter.utils.Constants
import com.adyen.checkout.sessions.core.SessionComponentCallback
Expand Down Expand Up @@ -49,7 +49,7 @@ abstract class ComponentSessionCallback<T : PaymentComponentState<*>>(
(componentError.exception is com.adyen.checkout.core.exception.CancellationException) ||
(componentError.exception is com.adyen.checkout.adyen3ds2.Cancelled3DS2Exception)
)
PaymentResultEnum.CANCELLEDBYUSER
PaymentResultEnum.CANCELLED_BY_USER
else
PaymentResultEnum.ERROR

Expand Down
Loading

0 comments on commit 871e908

Please sign in to comment.