diff --git a/.github/workflows/ios_clean_build.yml b/.github/workflows/ios_clean_build.yml index e3a0597a..146b22e1 100644 --- a/.github/workflows/ios_clean_build.yml +++ b/.github/workflows/ios_clean_build.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a43149..db03d25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.4.0 + +### New + +- Set minimum SDK version to Flutter 3.16/Dart 3.2 + ## 1.3.0 ### New diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/AdyenCheckoutPlugin.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/AdyenCheckoutPlugin.kt index 61615611..68e2c48b 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/AdyenCheckoutPlugin.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/AdyenCheckoutPlugin.kt @@ -1,10 +1,5 @@ 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 @@ -12,6 +7,11 @@ 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 diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/CheckoutPlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/CheckoutPlatformApi.kt index 91ab7299..bf107e77 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/CheckoutPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/CheckoutPlatformApi.kt @@ -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 @@ -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 @@ -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() } } diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/AdyenCSE.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/AdyenCSE.kt index 9eb752ca..5c8f193d 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/AdyenCSE.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/AdyenCSE.kt @@ -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( diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidation.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidation.kt index da496403..111e9280 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidation.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidation.kt @@ -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 @@ -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( @@ -21,12 +21,12 @@ 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 } } @@ -34,18 +34,18 @@ internal object CardValidation { 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 } } diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/ComponentPlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/ComponentPlatformApi.kt index 5cfc5395..8fcc0bea 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/ComponentPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/ComponentPlatformApi.kt @@ -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 @@ -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 @@ -81,7 +83,7 @@ class ComponentPlatformApi( val paymentMethodJson = JSONObject(paymentMethodResponse) val paymentMethod = PaymentMethod.SERIALIZER.deserialize(paymentMethodJson) when (instantPaymentConfigurationDTO.instantPaymentType) { - InstantPaymentType.GOOGLEPAY -> + InstantPaymentType.GOOGLE_PAY -> googlePayComponentManager.initialize( paymentMethod, componentId, @@ -89,7 +91,7 @@ class ComponentPlatformApi( callback ) - InstantPaymentType.INSTANT, InstantPaymentType.APPLEPAY -> return + InstantPaymentType.INSTANT, InstantPaymentType.APPLE_PAY -> return } } @@ -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, diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentCallback.kt index 80685102..c35597de 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentCallback.kt @@ -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, @@ -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, ) @@ -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 = diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentManager.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentManager.kt index ac4b4a4f..f8160726 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentManager.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/action/ActionComponentManager.kt @@ -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 diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentAdvancedCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentAdvancedCallback.kt index e52f1ebd..d84941b1 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentAdvancedCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentAdvancedCallback.kt @@ -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>( private val componentFlutterApi: ComponentFlutterInterface, @@ -20,7 +19,7 @@ abstract class ComponentAdvancedCallback>( override fun onSubmit(state: T) { val model = ComponentCommunicationModel( - ComponentCommunicationType.ONSUBMIT, + ComponentCommunicationType.ON_SUBMIT, componentId = componentId, data = PaymentComponentData.SERIALIZER.serialize(state.data).toString(), ) @@ -30,7 +29,7 @@ abstract class ComponentAdvancedCallback>( override fun onAdditionalDetails(actionComponentData: ActionComponentData) { val model = ComponentCommunicationModel( - ComponentCommunicationType.ADDITIONALDETAILS, + ComponentCommunicationType.ADDITIONAL_DETAILS, componentId = componentId, data = ActionComponentData.SERIALIZER.serialize(actionComponentData).toString(), ) @@ -43,7 +42,7 @@ abstract class ComponentAdvancedCallback>( (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 diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentSessionCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentSessionCallback.kt index 4ce6c615..8c789f2b 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentSessionCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/base/ComponentSessionCallback.kt @@ -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 @@ -49,7 +49,7 @@ abstract class ComponentSessionCallback>( (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 diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/BaseCardComponent.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/BaseCardComponent.kt index 94512633..59b74311 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/BaseCardComponent.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/BaseCardComponent.kt @@ -1,12 +1,12 @@ package com.adyen.checkout.flutter.components.card -import CardComponentConfigurationDTO -import ComponentFlutterInterface import android.content.Context import android.view.View import androidx.activity.ComponentActivity import com.adyen.checkout.card.CardComponent import com.adyen.checkout.flutter.components.view.DynamicComponentView +import com.adyen.checkout.flutter.generated.CardComponentConfigurationDTO +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAmount import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAnalyticsConfiguration import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCardConfiguration diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentFactory.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentFactory.kt index 908a7532..532a2070 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentFactory.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentFactory.kt @@ -1,10 +1,10 @@ package com.adyen.checkout.flutter.components.card -import ComponentFlutterInterface import android.content.Context import androidx.fragment.app.FragmentActivity import com.adyen.checkout.flutter.components.card.advanced.CardAdvancedComponent import com.adyen.checkout.flutter.components.card.session.CardSessionComponent +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.flutter.session.SessionHolder import io.flutter.plugin.platform.PlatformView import io.flutter.plugin.platform.PlatformViewFactory diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentManager.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentManager.kt index 76deffc6..3ec87d7e 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentManager.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/CardComponentManager.kt @@ -1,8 +1,8 @@ package com.adyen.checkout.flutter.components.card -import ComponentFlutterInterface import androidx.fragment.app.FragmentActivity import com.adyen.checkout.action.core.internal.ActionHandlingComponent +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.flutter.session.SessionHolder import io.flutter.embedding.engine.plugins.FlutterPlugin diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedCallback.kt index c788e100..7de6b91d 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedCallback.kt @@ -1,8 +1,8 @@ package com.adyen.checkout.flutter.components.card.advanced -import ComponentFlutterInterface import com.adyen.checkout.card.CardComponentState import com.adyen.checkout.flutter.components.base.ComponentAdvancedCallback +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface internal class CardAdvancedCallback( private val componentFlutterApi: ComponentFlutterInterface, diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedComponent.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedComponent.kt index 83095e60..806c8432 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedComponent.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/advanced/CardAdvancedComponent.kt @@ -1,12 +1,12 @@ package com.adyen.checkout.flutter.components.card.advanced -import ComponentFlutterInterface import android.content.Context import androidx.fragment.app.FragmentActivity import com.adyen.checkout.card.CardComponent import com.adyen.checkout.components.core.PaymentMethod import com.adyen.checkout.components.core.StoredPaymentMethod import com.adyen.checkout.flutter.components.card.BaseCardComponent +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import org.json.JSONObject import java.util.UUID diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionCallback.kt index f8ead927..6335549f 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionCallback.kt @@ -1,9 +1,9 @@ package com.adyen.checkout.flutter.components.card.session -import ComponentFlutterInterface import com.adyen.checkout.card.CardComponentState import com.adyen.checkout.components.core.action.Action import com.adyen.checkout.flutter.components.base.ComponentSessionCallback +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface internal class CardSessionCallback( private val componentFlutterApi: ComponentFlutterInterface, diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionComponent.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionComponent.kt index ba712cb3..ee0b7b8b 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionComponent.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/card/session/CardSessionComponent.kt @@ -1,6 +1,5 @@ package com.adyen.checkout.flutter.components.card.session -import ComponentFlutterInterface import android.content.Context import androidx.fragment.app.FragmentActivity import com.adyen.checkout.card.CardComponent @@ -9,6 +8,7 @@ import com.adyen.checkout.components.core.PaymentMethod import com.adyen.checkout.components.core.StoredPaymentMethod import com.adyen.checkout.components.core.action.Action import com.adyen.checkout.flutter.components.card.BaseCardComponent +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.flutter.session.SessionHolder import com.adyen.checkout.sessions.core.CheckoutSession import com.adyen.checkout.sessions.core.SessionSetupResponse diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayAdvancedCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayAdvancedCallback.kt index 00a968d0..8a3d5237 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayAdvancedCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayAdvancedCallback.kt @@ -1,10 +1,11 @@ package com.adyen.checkout.flutter.components.googlepay -import ComponentCommunicationModel -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.PaymentComponentData import com.adyen.checkout.flutter.components.base.ComponentAdvancedCallback +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.utils.Constants import com.adyen.checkout.googlepay.GooglePayComponentState import org.json.JSONObject @@ -27,7 +28,7 @@ class GooglePayAdvancedCallback( } val model = ComponentCommunicationModel( - ComponentCommunicationType.ONSUBMIT, + ComponentCommunicationType.ON_SUBMIT, componentId = componentId, data = submitData.toString(), ) diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayComponentManager.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayComponentManager.kt index 32dcf1cd..bbfda09d 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayComponentManager.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePayComponentManager.kt @@ -1,8 +1,5 @@ package com.adyen.checkout.flutter.components.googlepay -import ComponentFlutterInterface -import InstantPaymentConfigurationDTO -import InstantPaymentSetupResultDTO import android.content.Intent import androidx.fragment.app.FragmentActivity import com.adyen.checkout.action.core.internal.ActionHandlingComponent @@ -11,14 +8,17 @@ import com.adyen.checkout.components.core.ComponentAvailableCallback import com.adyen.checkout.components.core.Order import com.adyen.checkout.components.core.PaymentMethod import com.adyen.checkout.components.core.action.Action +import com.adyen.checkout.flutter.components.view.ComponentLoadingBottomSheet +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface +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.session.SessionHolder +import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToGooglePayCheckoutConfiguration import com.adyen.checkout.flutter.utils.Constants import com.adyen.checkout.googlepay.GooglePayComponent -import com.adyen.checkout.flutter.components.view.ComponentLoadingBottomSheet -import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToGooglePayCheckoutConfiguration import com.adyen.checkout.sessions.core.CheckoutSession import com.adyen.checkout.sessions.core.SessionSetupResponse -import java.lang.Exception import java.util.UUID class GooglePayComponentManager( @@ -51,7 +51,7 @@ class GooglePayComponentManager( setupCallback?.invoke( Result.success( InstantPaymentSetupResultDTO( - InstantPaymentType.GOOGLEPAY, + InstantPaymentType.GOOGLE_PAY, true, allowedPaymentMethods ) diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePaySessionCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePaySessionCallback.kt index 2f1172b1..dd03c1e2 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePaySessionCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/googlepay/GooglePaySessionCallback.kt @@ -1,10 +1,11 @@ package com.adyen.checkout.flutter.components.googlepay -import ComponentCommunicationModel -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.action.Action import com.adyen.checkout.flutter.components.base.ComponentSessionCallback +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.googlepay.GooglePayComponentState import com.adyen.checkout.sessions.core.SessionPaymentResult diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/InstantComponentManager.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/InstantComponentManager.kt index 4318d2c2..0f8dd3f4 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/InstantComponentManager.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/InstantComponentManager.kt @@ -1,9 +1,5 @@ package com.adyen.checkout.flutter.components.instant -import ComponentCommunicationModel -import ComponentFlutterInterface -import InstantPaymentConfigurationDTO -import PaymentResultDTO import androidx.fragment.app.FragmentActivity import com.adyen.checkout.action.core.internal.ActionHandlingComponent import com.adyen.checkout.components.core.CheckoutConfiguration @@ -17,6 +13,12 @@ import com.adyen.checkout.flutter.components.instant.advanced.InstantComponentAd import com.adyen.checkout.flutter.components.instant.session.IdealComponentSessionCallback import com.adyen.checkout.flutter.components.instant.session.InstantComponentSessionCallback 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.InstantPaymentConfigurationDTO +import com.adyen.checkout.flutter.generated.PaymentResultDTO +import com.adyen.checkout.flutter.generated.PaymentResultEnum import com.adyen.checkout.flutter.session.SessionHolder import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCheckoutConfiguration import com.adyen.checkout.flutter.utils.Constants diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/IdealComponentAdvancedCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/IdealComponentAdvancedCallback.kt index fa7cb9c2..78d196b4 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/IdealComponentAdvancedCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/IdealComponentAdvancedCallback.kt @@ -1,10 +1,11 @@ package com.adyen.checkout.flutter.components.instant.advanced -import ComponentCommunicationModel -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.PaymentComponentData import com.adyen.checkout.flutter.components.base.ComponentAdvancedCallback +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.utils.Constants import com.adyen.checkout.ideal.IdealComponentState import org.json.JSONObject @@ -23,7 +24,7 @@ class IdealComponentAdvancedCallback( } val model = ComponentCommunicationModel( - ComponentCommunicationType.ONSUBMIT, + ComponentCommunicationType.ON_SUBMIT, componentId = componentId, data = submitData.toString(), ) diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/InstantComponentAdvancedCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/InstantComponentAdvancedCallback.kt index f69f625e..dedfd1ac 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/InstantComponentAdvancedCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/advanced/InstantComponentAdvancedCallback.kt @@ -1,10 +1,11 @@ package com.adyen.checkout.flutter.components.instant.advanced -import ComponentCommunicationModel -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.PaymentComponentData import com.adyen.checkout.flutter.components.base.ComponentAdvancedCallback +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.utils.Constants import com.adyen.checkout.instant.InstantComponentState import org.json.JSONObject @@ -23,7 +24,7 @@ class InstantComponentAdvancedCallback( } val model = ComponentCommunicationModel( - ComponentCommunicationType.ONSUBMIT, + ComponentCommunicationType.ON_SUBMIT, componentId = componentId, data = submitData.toString(), ) diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/IdealComponentSessionCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/IdealComponentSessionCallback.kt index d3b0c013..cfcd8452 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/IdealComponentSessionCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/IdealComponentSessionCallback.kt @@ -1,9 +1,9 @@ package com.adyen.checkout.flutter.components.instant.session -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.action.Action import com.adyen.checkout.flutter.components.base.ComponentSessionCallback +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.ideal.IdealComponentState import com.adyen.checkout.sessions.core.SessionPaymentResult diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/InstantComponentSessionCallback.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/InstantComponentSessionCallback.kt index 022f3113..24ced632 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/InstantComponentSessionCallback.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/instant/session/InstantComponentSessionCallback.kt @@ -1,9 +1,9 @@ package com.adyen.checkout.flutter.components.instant.session -import ComponentFlutterInterface import com.adyen.checkout.components.core.ComponentError import com.adyen.checkout.components.core.action.Action import com.adyen.checkout.flutter.components.base.ComponentSessionCallback +import com.adyen.checkout.flutter.generated.ComponentFlutterInterface import com.adyen.checkout.instant.InstantComponentState import com.adyen.checkout.sessions.core.SessionPaymentResult diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/components/view/DynamicComponentView.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/components/view/DynamicComponentView.kt index 790099ae..7c693b13 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/components/view/DynamicComponentView.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/components/view/DynamicComponentView.kt @@ -1,8 +1,5 @@ package com.adyen.checkout.flutter.components.view -import ComponentCommunicationModel -import ComponentCommunicationType -import ComponentFlutterInterface import android.content.Context import android.util.AttributeSet import android.view.ViewGroup @@ -15,6 +12,9 @@ import androidx.core.view.children import androidx.core.view.postDelayed import com.adyen.checkout.card.CardComponent import com.adyen.checkout.components.core.internal.Component +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.ui.core.AdyenComponentView import com.adyen.checkout.ui.core.internal.ui.ViewableComponent import com.google.android.material.button.MaterialButton diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt index 86aadf53..f3688e50 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt @@ -1,17 +1,5 @@ package com.adyen.checkout.flutter.dropIn -import DeletedStoredPaymentMethodResultDTO -import DropInConfigurationDTO -import DropInFlutterInterface -import DropInPlatformInterface -import OrderCancelResultDTO -import PaymentEventDTO -import PaymentEventType -import PaymentResultDTO -import PaymentResultEnum -import PaymentResultModelDTO -import PlatformCommunicationModel -import PlatformCommunicationType import androidx.activity.result.ActivityResultLauncher import androidx.fragment.app.FragmentActivity import androidx.lifecycle.lifecycleScope @@ -39,10 +27,22 @@ import com.adyen.checkout.flutter.dropIn.advanced.DropInPaymentResultMessenger import com.adyen.checkout.flutter.dropIn.advanced.DropInServiceResultMessenger import com.adyen.checkout.flutter.dropIn.model.DropInType import com.adyen.checkout.flutter.dropIn.session.SessionDropInService +import com.adyen.checkout.flutter.generated.DeletedStoredPaymentMethodResultDTO +import com.adyen.checkout.flutter.generated.DropInConfigurationDTO +import com.adyen.checkout.flutter.generated.DropInFlutterInterface +import com.adyen.checkout.flutter.generated.DropInPlatformInterface +import com.adyen.checkout.flutter.generated.OrderCancelResultDTO +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.generated.PlatformCommunicationModel +import com.adyen.checkout.flutter.generated.PlatformCommunicationType import com.adyen.checkout.flutter.session.SessionHolder import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToDropInConfiguration -import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToOrderResponseModel import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToEnvironment +import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToOrderResponseModel import com.adyen.checkout.sessions.core.CheckoutSession import com.adyen.checkout.sessions.core.SessionSetupResponse import kotlinx.coroutines.Dispatchers @@ -156,7 +156,7 @@ class DropInPlatformApi( val model = PlatformCommunicationModel( - PlatformCommunicationType.PAYMENTCOMPONENT, + PlatformCommunicationType.PAYMENT_COMPONENT, data = message.contentIfNotHandled.toString(), ) dropInFlutterApi.onDropInAdvancedPlatformCommunication(model) {} @@ -173,7 +173,7 @@ class DropInPlatformApi( val dropInStoredPaymentMethodDeletionModel = message.contentIfNotHandled val platformCommunicationModel = PlatformCommunicationModel( - PlatformCommunicationType.DELETESTOREDPAYMENTMETHOD, + PlatformCommunicationType.DELETE_STORED_PAYMENT_METHOD, data = dropInStoredPaymentMethodDeletionModel?.storedPaymentMethodId, ) @@ -202,7 +202,7 @@ class DropInPlatformApi( val platformCommunicationModel = PlatformCommunicationModel( - PlatformCommunicationType.ADDITIONALDETAILS, + PlatformCommunicationType.ADDITIONAL_DETAILS, data = message.contentIfNotHandled.toString(), ) @@ -219,7 +219,7 @@ class DropInPlatformApi( val platformCommunicationModel = PlatformCommunicationModel( - PlatformCommunicationType.BALANCECHECK, + PlatformCommunicationType.BALANCE_CHECK, data = message.contentIfNotHandled.toString() ) dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel) {} @@ -235,7 +235,7 @@ class DropInPlatformApi( val platformCommunicationModel = PlatformCommunicationModel( - PlatformCommunicationType.REQUESTORDER, + PlatformCommunicationType.REQUEST_ORDER, data = message.contentIfNotHandled.toString() ) dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel) {} @@ -251,7 +251,7 @@ class DropInPlatformApi( val platformCommunicationModel = PlatformCommunicationModel( - PlatformCommunicationType.CANCELORDER, + PlatformCommunicationType.CANCEL_ORDER, data = message.contentIfNotHandled.toString() ) dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel) {} @@ -302,7 +302,7 @@ class DropInPlatformApi( when (sessionDropInResult) { is SessionDropInResult.CancelledByUser -> PaymentResultDTO( - PaymentResultEnum.CANCELLEDBYUSER + PaymentResultEnum.CANCELLED_BY_USER ) is SessionDropInResult.Error -> @@ -347,7 +347,7 @@ class DropInPlatformApi( when (dropInAdvancedFlowResult) { is DropInResult.CancelledByUser -> PaymentResultDTO( - PaymentResultEnum.CANCELLEDBYUSER + PaymentResultEnum.CANCELLED_BY_USER ) is DropInResult.Error -> diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt index 8d16cb0a..ac44190e 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt @@ -1,10 +1,5 @@ package com.adyen.checkout.flutter.dropIn.advanced -import DeletedStoredPaymentMethodResultDTO -import ErrorDTO -import OrderCancelResultDTO -import PaymentEventDTO -import PaymentEventType import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -27,6 +22,11 @@ import com.adyen.checkout.dropin.OrderDropInServiceResult import com.adyen.checkout.dropin.RecurringDropInServiceResult import com.adyen.checkout.flutter.dropIn.model.DropInStoredPaymentMethodDeletionModel import com.adyen.checkout.flutter.dropIn.model.DropInType +import com.adyen.checkout.flutter.generated.DeletedStoredPaymentMethodResultDTO +import com.adyen.checkout.flutter.generated.ErrorDTO +import com.adyen.checkout.flutter.generated.OrderCancelResultDTO +import com.adyen.checkout.flutter.generated.PaymentEventDTO +import com.adyen.checkout.flutter.generated.PaymentEventType import com.adyen.checkout.flutter.utils.Constants import com.adyen.checkout.googlepay.GooglePayComponentState import org.json.JSONObject diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/DropInServiceResultMessenger.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/DropInServiceResultMessenger.kt index 9a596224..b18513d1 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/DropInServiceResultMessenger.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/DropInServiceResultMessenger.kt @@ -1,10 +1,10 @@ package com.adyen.checkout.flutter.dropIn.advanced -import DeletedStoredPaymentMethodResultDTO -import OrderCancelResultDTO -import PaymentEventDTO import androidx.lifecycle.LiveData import com.adyen.checkout.flutter.dropIn.model.DropInStoredPaymentMethodDeletionModel +import com.adyen.checkout.flutter.generated.DeletedStoredPaymentMethodResultDTO +import com.adyen.checkout.flutter.generated.OrderCancelResultDTO +import com.adyen.checkout.flutter.generated.PaymentEventDTO import com.adyen.checkout.flutter.utils.Event import org.json.JSONObject diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/session/SessionDropInService.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/session/SessionDropInService.kt index 4dfcafd1..d6d2aabd 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/session/SessionDropInService.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/session/SessionDropInService.kt @@ -1,6 +1,5 @@ package com.adyen.checkout.flutter.dropIn.session -import DeletedStoredPaymentMethodResultDTO import android.content.Intent import android.os.IBinder import androidx.lifecycle.Lifecycle @@ -14,6 +13,7 @@ import com.adyen.checkout.flutter.dropIn.advanced.DropInPaymentMethodDeletionPla import com.adyen.checkout.flutter.dropIn.advanced.DropInPaymentMethodDeletionResultMessenger import com.adyen.checkout.flutter.dropIn.model.DropInStoredPaymentMethodDeletionModel import com.adyen.checkout.flutter.dropIn.model.DropInType +import com.adyen.checkout.flutter.generated.DeletedStoredPaymentMethodResultDTO class SessionDropInService : SessionDropInService(), LifecycleOwner { private val dispatcher = ServiceLifecycleDispatcher(this) diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt similarity index 59% rename from android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt rename to android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt index b215f8b9..454ee634 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt @@ -1,6 +1,8 @@ -// Autogenerated from Pigeon (v16.0.5), do not edit directly. +// Autogenerated from Pigeon (v21.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") +package com.adyen.checkout.flutter.generated import android.util.Log import io.flutter.plugin.common.BasicMessageChannel @@ -15,14 +17,14 @@ private fun wrapResult(result: Any?): List { } private fun wrapError(exception: Throwable): List { - if (exception is AdyenPigeonError) { - return listOf( + return if (exception is AdyenPigeonError) { + listOf( exception.code, exception.message, exception.details ) } else { - return listOf( + listOf( exception.javaClass.simpleName, exception.toString(), "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) @@ -48,7 +50,7 @@ class AdyenPigeonError ( enum class Environment(val raw: Int) { TEST(0), EUROPE(1), - UNITEDSTATES(2), + UNITED_STATES(2), AUSTRALIA(3), INDIA(4), APSE(5); @@ -62,7 +64,7 @@ enum class Environment(val raw: Int) { enum class AddressMode(val raw: Int) { FULL(0), - POSTALCODE(1), + POSTAL_CODE(1), NONE(2); companion object { @@ -73,7 +75,7 @@ enum class AddressMode(val raw: Int) { } enum class CardAuthMethod(val raw: Int) { - PANONLY(0), + PAN_ONLY(0), CRYPTOGRAM3DS(1); companion object { @@ -84,9 +86,9 @@ enum class CardAuthMethod(val raw: Int) { } enum class TotalPriceStatus(val raw: Int) { - NOTCURRENTLYKNOWN(0), + NOT_CURRENTLY_KNOWN(0), ESTIMATED(1), - FINALPRICE(2); + FINAL_PRICE(2); companion object { fun ofRaw(raw: Int): TotalPriceStatus? { @@ -118,7 +120,7 @@ enum class CashAppPayEnvironment(val raw: Int) { } enum class PaymentResultEnum(val raw: Int) { - CANCELLEDBYUSER(0), + CANCELLED_BY_USER(0), ERROR(1), FINISHED(2); @@ -130,13 +132,13 @@ enum class PaymentResultEnum(val raw: Int) { } enum class PlatformCommunicationType(val raw: Int) { - PAYMENTCOMPONENT(0), - ADDITIONALDETAILS(1), + PAYMENT_COMPONENT(0), + ADDITIONAL_DETAILS(1), RESULT(2), - DELETESTOREDPAYMENTMETHOD(3), - BALANCECHECK(4), - REQUESTORDER(5), - CANCELORDER(6); + DELETE_STORED_PAYMENT_METHOD(3), + BALANCE_CHECK(4), + REQUEST_ORDER(5), + CANCEL_ORDER(6); companion object { fun ofRaw(raw: Int): PlatformCommunicationType? { @@ -146,8 +148,8 @@ enum class PlatformCommunicationType(val raw: Int) { } enum class ComponentCommunicationType(val raw: Int) { - ONSUBMIT(0), - ADDITIONALDETAILS(1), + ON_SUBMIT(0), + ADDITIONAL_DETAILS(1), LOADING(2), RESULT(3), RESIZE(4); @@ -184,8 +186,8 @@ enum class FieldVisibility(val raw: Int) { } enum class InstantPaymentType(val raw: Int) { - GOOGLEPAY(0), - APPLEPAY(1), + GOOGLE_PAY(0), + APPLE_PAY(1), INSTANT(2); companion object { @@ -198,8 +200,8 @@ enum class InstantPaymentType(val raw: Int) { enum class ApplePayShippingType(val raw: Int) { SHIPPING(0), DELIVERY(1), - STOREPICKUP(2), - SERVICEPICKUP(3); + STORE_PICKUP(2), + SERVICE_PICKUP(3); companion object { fun ofRaw(raw: Int): ApplePayShippingType? { @@ -232,11 +234,11 @@ enum class ApplePaySummaryItemType(val raw: Int) { enum class CardNumberValidationResultDTO(val raw: Int) { VALID(0), - INVALIDILLEGALCHARACTERS(1), - INVALIDLUHNCHECK(2), - INVALIDTOOSHORT(3), - INVALIDTOOLONG(4), - INVALIDOTHERREASON(5); + INVALID_ILLEGAL_CHARACTERS(1), + INVALID_LUHN_CHECK(2), + INVALID_TOO_SHORT(3), + INVALID_TOO_LONG(4), + INVALID_OTHER_REASON(5); companion object { fun ofRaw(raw: Int): CardNumberValidationResultDTO? { @@ -247,10 +249,10 @@ enum class CardNumberValidationResultDTO(val raw: Int) { enum class CardExpiryDateValidationResultDTO(val raw: Int) { VALID(0), - INVALIDTOOFARINTHEFUTURE(1), - INVALIDTOOOLD(2), - NONPARSEABLEDATE(3), - INVALIDOTHERREASON(4); + INVALID_TOO_FAR_IN_THE_FUTURE(1), + INVALID_TOO_OLD(2), + NON_PARSEABLE_DATE(3), + INVALID_OTHER_REASON(4); companion object { fun ofRaw(raw: Int): CardExpiryDateValidationResultDTO? { @@ -278,16 +280,16 @@ data class SessionDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): SessionDTO { - val id = list[0] as String - val sessionData = list[1] as String - val paymentMethodsJson = list[2] as String + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): SessionDTO { + val id = __pigeon_list[0] as String + val sessionData = __pigeon_list[1] as String + val paymentMethodsJson = __pigeon_list[2] as String return SessionDTO(id, sessionData, paymentMethodsJson) } } fun toList(): List { - return listOf( + return listOf( id, sessionData, paymentMethodsJson, @@ -302,15 +304,15 @@ data class AmountDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): AmountDTO { - val currency = list[0] as String - val value = list[1].let { if (it is Int) it.toLong() else it as Long } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): AmountDTO { + val currency = __pigeon_list[0] as String + val value = __pigeon_list[1].let { num -> if (num is Int) num.toLong() else num as Long } return AmountDTO(currency, value) } } fun toList(): List { - return listOf( + return listOf( currency, value, ) @@ -324,15 +326,15 @@ data class AnalyticsOptionsDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): AnalyticsOptionsDTO { - val enabled = list[0] as Boolean - val version = list[1] as String + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): AnalyticsOptionsDTO { + val enabled = __pigeon_list[0] as Boolean + val version = __pigeon_list[1] as String return AnalyticsOptionsDTO(enabled, version) } } fun toList(): List { - return listOf( + return listOf( enabled, version, ) @@ -360,49 +362,39 @@ data class DropInConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): DropInConfigurationDTO { - val environment = Environment.ofRaw(list[0] as Int)!! - val clientKey = list[1] as String - val countryCode = list[2] as String - val amount: AmountDTO? = (list[3] as List?)?.let { - AmountDTO.fromList(it) - } - val shopperLocale = list[4] as String? - val cardConfigurationDTO: CardConfigurationDTO? = (list[5] as List?)?.let { - CardConfigurationDTO.fromList(it) - } - val applePayConfigurationDTO: ApplePayConfigurationDTO? = (list[6] as List?)?.let { - ApplePayConfigurationDTO.fromList(it) - } - val googlePayConfigurationDTO: GooglePayConfigurationDTO? = (list[7] as List?)?.let { - GooglePayConfigurationDTO.fromList(it) - } - val cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? = (list[8] as List?)?.let { - CashAppPayConfigurationDTO.fromList(it) - } - val analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[9] as List) - val showPreselectedStoredPaymentMethod = list[10] as Boolean - val skipListWhenSinglePaymentMethod = list[11] as Boolean - val isRemoveStoredPaymentMethodEnabled = list[12] as Boolean - val preselectedPaymentMethodTitle = list[13] as String? - val paymentMethodNames = list[14] as Map? - val isPartialPaymentSupported = list[15] as Boolean + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): DropInConfigurationDTO { + val environment = __pigeon_list[0] as Environment + val clientKey = __pigeon_list[1] as String + val countryCode = __pigeon_list[2] as String + val amount = __pigeon_list[3] as AmountDTO? + val shopperLocale = __pigeon_list[4] as String? + val cardConfigurationDTO = __pigeon_list[5] as CardConfigurationDTO? + val applePayConfigurationDTO = __pigeon_list[6] as ApplePayConfigurationDTO? + val googlePayConfigurationDTO = __pigeon_list[7] as GooglePayConfigurationDTO? + val cashAppPayConfigurationDTO = __pigeon_list[8] as CashAppPayConfigurationDTO? + val analyticsOptionsDTO = __pigeon_list[9] as AnalyticsOptionsDTO + val showPreselectedStoredPaymentMethod = __pigeon_list[10] as Boolean + val skipListWhenSinglePaymentMethod = __pigeon_list[11] as Boolean + val isRemoveStoredPaymentMethodEnabled = __pigeon_list[12] as Boolean + val preselectedPaymentMethodTitle = __pigeon_list[13] as String? + val paymentMethodNames = __pigeon_list[14] as Map? + val isPartialPaymentSupported = __pigeon_list[15] as Boolean return DropInConfigurationDTO(environment, clientKey, countryCode, amount, shopperLocale, cardConfigurationDTO, applePayConfigurationDTO, googlePayConfigurationDTO, cashAppPayConfigurationDTO, analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, preselectedPaymentMethodTitle, paymentMethodNames, isPartialPaymentSupported) } } fun toList(): List { - return listOf( - environment.raw, + return listOf( + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - cardConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList(), - googlePayConfigurationDTO?.toList(), - cashAppPayConfigurationDTO?.toList(), - analyticsOptionsDTO.toList(), + cardConfigurationDTO, + applePayConfigurationDTO, + googlePayConfigurationDTO, + cashAppPayConfigurationDTO, + analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, @@ -426,28 +418,28 @@ data class CardConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): CardConfigurationDTO { - val holderNameRequired = list[0] as Boolean - val addressMode = AddressMode.ofRaw(list[1] as Int)!! - val showStorePaymentField = list[2] as Boolean - val showCvcForStoredCard = list[3] as Boolean - val showCvc = list[4] as Boolean - val kcpFieldVisibility = FieldVisibility.ofRaw(list[5] as Int)!! - val socialSecurityNumberFieldVisibility = FieldVisibility.ofRaw(list[6] as Int)!! - val supportedCardTypes = list[7] as List + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): CardConfigurationDTO { + val holderNameRequired = __pigeon_list[0] as Boolean + val addressMode = __pigeon_list[1] as AddressMode + val showStorePaymentField = __pigeon_list[2] as Boolean + val showCvcForStoredCard = __pigeon_list[3] as Boolean + val showCvc = __pigeon_list[4] as Boolean + val kcpFieldVisibility = __pigeon_list[5] as FieldVisibility + val socialSecurityNumberFieldVisibility = __pigeon_list[6] as FieldVisibility + val supportedCardTypes = __pigeon_list[7] as List return CardConfigurationDTO(holderNameRequired, addressMode, showStorePaymentField, showCvcForStoredCard, showCvc, kcpFieldVisibility, socialSecurityNumberFieldVisibility, supportedCardTypes) } } fun toList(): List { - return listOf( + return listOf( holderNameRequired, - addressMode.raw, + addressMode, showStorePaymentField, showCvcForStoredCard, showCvc, - kcpFieldVisibility.raw, - socialSecurityNumberFieldVisibility.raw, + kcpFieldVisibility, + socialSecurityNumberFieldVisibility, supportedCardTypes, ) } @@ -472,49 +464,41 @@ data class ApplePayConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ApplePayConfigurationDTO { - val merchantId = list[0] as String - val merchantName = list[1] as String - val allowOnboarding = list[2] as Boolean? - val summaryItems = list[3] as List? - val requiredBillingContactFields = list[4] as List? - val billingContact: ApplePayContactDTO? = (list[5] as List?)?.let { - ApplePayContactDTO.fromList(it) - } - val requiredShippingContactFields = list[6] as List? - val shippingContact: ApplePayContactDTO? = (list[7] as List?)?.let { - ApplePayContactDTO.fromList(it) - } - val applePayShippingType: ApplePayShippingType? = (list[8] as Int?)?.let { - ApplePayShippingType.ofRaw(it) - } - val allowShippingContactEditing = list[9] as Boolean? - val shippingMethods = list[10] as List? - val applicationData = list[11] as String? - val supportedCountries = list[12] as List? - val merchantCapability: ApplePayMerchantCapability? = (list[13] as Int?)?.let { - ApplePayMerchantCapability.ofRaw(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ApplePayConfigurationDTO { + val merchantId = __pigeon_list[0] as String + val merchantName = __pigeon_list[1] as String + val allowOnboarding = __pigeon_list[2] as Boolean? + val summaryItems = __pigeon_list[3] as List? + val requiredBillingContactFields = __pigeon_list[4] as List? + val billingContact = __pigeon_list[5] as ApplePayContactDTO? + val requiredShippingContactFields = __pigeon_list[6] as List? + val shippingContact = __pigeon_list[7] as ApplePayContactDTO? + val applePayShippingType = __pigeon_list[8] as ApplePayShippingType? + val allowShippingContactEditing = __pigeon_list[9] as Boolean? + val shippingMethods = __pigeon_list[10] as List? + val applicationData = __pigeon_list[11] as String? + val supportedCountries = __pigeon_list[12] as List? + val merchantCapability = __pigeon_list[13] as ApplePayMerchantCapability? return ApplePayConfigurationDTO(merchantId, merchantName, allowOnboarding, summaryItems, requiredBillingContactFields, billingContact, requiredShippingContactFields, shippingContact, applePayShippingType, allowShippingContactEditing, shippingMethods, applicationData, supportedCountries, merchantCapability) } } fun toList(): List { - return listOf( + return listOf( merchantId, merchantName, allowOnboarding, summaryItems, requiredBillingContactFields, - billingContact?.toList(), + billingContact, requiredShippingContactFields, - shippingContact?.toList(), - applePayShippingType?.raw, + shippingContact, + applePayShippingType, allowShippingContactEditing, shippingMethods, applicationData, supportedCountries, - merchantCapability?.raw, + merchantCapability, ) } } @@ -538,27 +522,27 @@ data class ApplePayContactDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ApplePayContactDTO { - val phoneNumber = list[0] as String? - val emailAddress = list[1] as String? - val givenName = list[2] as String? - val familyName = list[3] as String? - val phoneticGivenName = list[4] as String? - val phoneticFamilyName = list[5] as String? - val addressLines = list[6] as List? - val subLocality = list[7] as String? - val city = list[8] as String? - val postalCode = list[9] as String? - val subAdministrativeArea = list[10] as String? - val administrativeArea = list[11] as String? - val country = list[12] as String? - val countryCode = list[13] as String? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ApplePayContactDTO { + val phoneNumber = __pigeon_list[0] as String? + val emailAddress = __pigeon_list[1] as String? + val givenName = __pigeon_list[2] as String? + val familyName = __pigeon_list[3] as String? + val phoneticGivenName = __pigeon_list[4] as String? + val phoneticFamilyName = __pigeon_list[5] as String? + val addressLines = __pigeon_list[6] as List? + val subLocality = __pigeon_list[7] as String? + val city = __pigeon_list[8] as String? + val postalCode = __pigeon_list[9] as String? + val subAdministrativeArea = __pigeon_list[10] as String? + val administrativeArea = __pigeon_list[11] as String? + val country = __pigeon_list[12] as String? + val countryCode = __pigeon_list[13] as String? return ApplePayContactDTO(phoneNumber, emailAddress, givenName, familyName, phoneticGivenName, phoneticFamilyName, addressLines, subLocality, city, postalCode, subAdministrativeArea, administrativeArea, country, countryCode) } } fun toList(): List { - return listOf( + return listOf( phoneNumber, emailAddress, givenName, @@ -588,22 +572,22 @@ data class ApplePayShippingMethodDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ApplePayShippingMethodDTO { - val label = list[0] as String - val detail = list[1] as String - val amount = AmountDTO.fromList(list[2] as List) - val identifier = list[3] as String - val startDate = list[4] as String? - val endDate = list[5] as String? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ApplePayShippingMethodDTO { + val label = __pigeon_list[0] as String + val detail = __pigeon_list[1] as String + val amount = __pigeon_list[2] as AmountDTO + val identifier = __pigeon_list[3] as String + val startDate = __pigeon_list[4] as String? + val endDate = __pigeon_list[5] as String? return ApplePayShippingMethodDTO(label, detail, amount, identifier, startDate, endDate) } } fun toList(): List { - return listOf( + return listOf( label, detail, - amount.toList(), + amount, identifier, startDate, endDate, @@ -619,19 +603,19 @@ data class ApplePaySummaryItemDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ApplePaySummaryItemDTO { - val label = list[0] as String - val amount = AmountDTO.fromList(list[1] as List) - val type = ApplePaySummaryItemType.ofRaw(list[2] as Int)!! + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ApplePaySummaryItemDTO { + val label = __pigeon_list[0] as String + val amount = __pigeon_list[1] as AmountDTO + val type = __pigeon_list[2] as ApplePaySummaryItemType return ApplePaySummaryItemDTO(label, amount, type) } } fun toList(): List { - return listOf( + return listOf( label, - amount.toList(), - type.raw, + amount, + type, ) } } @@ -656,40 +640,32 @@ data class GooglePayConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): GooglePayConfigurationDTO { - val googlePayEnvironment = GooglePayEnvironment.ofRaw(list[0] as Int)!! - val merchantAccount = list[1] as String? - val merchantInfoDTO: MerchantInfoDTO? = (list[2] as List?)?.let { - MerchantInfoDTO.fromList(it) - } - val totalPriceStatus: TotalPriceStatus? = (list[3] as Int?)?.let { - TotalPriceStatus.ofRaw(it) - } - val allowedCardNetworks = list[4] as List? - val allowedAuthMethods = list[5] as List? - val allowPrepaidCards = list[6] as Boolean? - val allowCreditCards = list[7] as Boolean? - val assuranceDetailsRequired = list[8] as Boolean? - val emailRequired = list[9] as Boolean? - val existingPaymentMethodRequired = list[10] as Boolean? - val shippingAddressRequired = list[11] as Boolean? - val shippingAddressParametersDTO: ShippingAddressParametersDTO? = (list[12] as List?)?.let { - ShippingAddressParametersDTO.fromList(it) - } - val billingAddressRequired = list[13] as Boolean? - val billingAddressParametersDTO: BillingAddressParametersDTO? = (list[14] as List?)?.let { - BillingAddressParametersDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): GooglePayConfigurationDTO { + val googlePayEnvironment = __pigeon_list[0] as GooglePayEnvironment + val merchantAccount = __pigeon_list[1] as String? + val merchantInfoDTO = __pigeon_list[2] as MerchantInfoDTO? + val totalPriceStatus = __pigeon_list[3] as TotalPriceStatus? + val allowedCardNetworks = __pigeon_list[4] as List? + val allowedAuthMethods = __pigeon_list[5] as List? + val allowPrepaidCards = __pigeon_list[6] as Boolean? + val allowCreditCards = __pigeon_list[7] as Boolean? + val assuranceDetailsRequired = __pigeon_list[8] as Boolean? + val emailRequired = __pigeon_list[9] as Boolean? + val existingPaymentMethodRequired = __pigeon_list[10] as Boolean? + val shippingAddressRequired = __pigeon_list[11] as Boolean? + val shippingAddressParametersDTO = __pigeon_list[12] as ShippingAddressParametersDTO? + val billingAddressRequired = __pigeon_list[13] as Boolean? + val billingAddressParametersDTO = __pigeon_list[14] as BillingAddressParametersDTO? return GooglePayConfigurationDTO(googlePayEnvironment, merchantAccount, merchantInfoDTO, totalPriceStatus, allowedCardNetworks, allowedAuthMethods, allowPrepaidCards, allowCreditCards, assuranceDetailsRequired, emailRequired, existingPaymentMethodRequired, shippingAddressRequired, shippingAddressParametersDTO, billingAddressRequired, billingAddressParametersDTO) } } fun toList(): List { - return listOf( - googlePayEnvironment.raw, + return listOf( + googlePayEnvironment, merchantAccount, - merchantInfoDTO?.toList(), - totalPriceStatus?.raw, + merchantInfoDTO, + totalPriceStatus, allowedCardNetworks, allowedAuthMethods, allowPrepaidCards, @@ -698,9 +674,9 @@ data class GooglePayConfigurationDTO ( emailRequired, existingPaymentMethodRequired, shippingAddressRequired, - shippingAddressParametersDTO?.toList(), + shippingAddressParametersDTO, billingAddressRequired, - billingAddressParametersDTO?.toList(), + billingAddressParametersDTO, ) } } @@ -712,15 +688,15 @@ data class MerchantInfoDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): MerchantInfoDTO { - val merchantName = list[0] as String? - val merchantId = list[1] as String? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): MerchantInfoDTO { + val merchantName = __pigeon_list[0] as String? + val merchantId = __pigeon_list[1] as String? return MerchantInfoDTO(merchantName, merchantId) } } fun toList(): List { - return listOf( + return listOf( merchantName, merchantId, ) @@ -734,15 +710,15 @@ data class ShippingAddressParametersDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ShippingAddressParametersDTO { - val allowedCountryCodes = list[0] as List? - val isPhoneNumberRequired = list[1] as Boolean? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ShippingAddressParametersDTO { + val allowedCountryCodes = __pigeon_list[0] as List? + val isPhoneNumberRequired = __pigeon_list[1] as Boolean? return ShippingAddressParametersDTO(allowedCountryCodes, isPhoneNumberRequired) } } fun toList(): List { - return listOf( + return listOf( allowedCountryCodes, isPhoneNumberRequired, ) @@ -756,15 +732,15 @@ data class BillingAddressParametersDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): BillingAddressParametersDTO { - val format = list[0] as String? - val isPhoneNumberRequired = list[1] as Boolean? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): BillingAddressParametersDTO { + val format = __pigeon_list[0] as String? + val isPhoneNumberRequired = __pigeon_list[1] as Boolean? return BillingAddressParametersDTO(format, isPhoneNumberRequired) } } fun toList(): List { - return listOf( + return listOf( format, isPhoneNumberRequired, ) @@ -778,16 +754,16 @@ data class CashAppPayConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): CashAppPayConfigurationDTO { - val cashAppPayEnvironment = CashAppPayEnvironment.ofRaw(list[0] as Int)!! - val returnUrl = list[1] as String + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): CashAppPayConfigurationDTO { + val cashAppPayEnvironment = __pigeon_list[0] as CashAppPayEnvironment + val returnUrl = __pigeon_list[1] as String return CashAppPayConfigurationDTO(cashAppPayEnvironment, returnUrl) } } fun toList(): List { - return listOf( - cashAppPayEnvironment.raw, + return listOf( + cashAppPayEnvironment, returnUrl, ) } @@ -801,21 +777,19 @@ data class PaymentResultDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): PaymentResultDTO { - val type = PaymentResultEnum.ofRaw(list[0] as Int)!! - val reason = list[1] as String? - val result: PaymentResultModelDTO? = (list[2] as List?)?.let { - PaymentResultModelDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): PaymentResultDTO { + val type = __pigeon_list[0] as PaymentResultEnum + val reason = __pigeon_list[1] as String? + val result = __pigeon_list[2] as PaymentResultModelDTO? return PaymentResultDTO(type, reason, result) } } fun toList(): List { - return listOf( - type.raw, + return listOf( + type, reason, - result?.toList(), + result, ) } } @@ -830,25 +804,23 @@ data class PaymentResultModelDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): PaymentResultModelDTO { - val sessionId = list[0] as String? - val sessionData = list[1] as String? - val sessionResult = list[2] as String? - val resultCode = list[3] as String? - val order: OrderResponseDTO? = (list[4] as List?)?.let { - OrderResponseDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): PaymentResultModelDTO { + val sessionId = __pigeon_list[0] as String? + val sessionData = __pigeon_list[1] as String? + val sessionResult = __pigeon_list[2] as String? + val resultCode = __pigeon_list[3] as String? + val order = __pigeon_list[4] as OrderResponseDTO? return PaymentResultModelDTO(sessionId, sessionData, sessionResult, resultCode, order) } } fun toList(): List { - return listOf( + return listOf( sessionId, sessionData, sessionResult, resultCode, - order?.toList(), + order, ) } } @@ -862,25 +834,21 @@ data class OrderResponseDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): OrderResponseDTO { - val pspReference = list[0] as String - val orderData = list[1] as String - val amount: AmountDTO? = (list[2] as List?)?.let { - AmountDTO.fromList(it) - } - val remainingAmount: AmountDTO? = (list[3] as List?)?.let { - AmountDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): OrderResponseDTO { + val pspReference = __pigeon_list[0] as String + val orderData = __pigeon_list[1] as String + val amount = __pigeon_list[2] as AmountDTO? + val remainingAmount = __pigeon_list[3] as AmountDTO? return OrderResponseDTO(pspReference, orderData, amount, remainingAmount) } } fun toList(): List { - return listOf( + return listOf( pspReference, orderData, - amount?.toList(), - remainingAmount?.toList(), + amount, + remainingAmount, ) } } @@ -893,21 +861,19 @@ data class PlatformCommunicationModel ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): PlatformCommunicationModel { - val type = PlatformCommunicationType.ofRaw(list[0] as Int)!! - val data = list[1] as String? - val paymentResult: PaymentResultDTO? = (list[2] as List?)?.let { - PaymentResultDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): PlatformCommunicationModel { + val type = __pigeon_list[0] as PlatformCommunicationType + val data = __pigeon_list[1] as String? + val paymentResult = __pigeon_list[2] as PaymentResultDTO? return PlatformCommunicationModel(type, data, paymentResult) } } fun toList(): List { - return listOf( - type.raw, + return listOf( + type, data, - paymentResult?.toList(), + paymentResult, ) } } @@ -921,23 +887,21 @@ data class ComponentCommunicationModel ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ComponentCommunicationModel { - val type = ComponentCommunicationType.ofRaw(list[0] as Int)!! - val componentId = list[1] as String - val data = list[2] - val paymentResult: PaymentResultDTO? = (list[3] as List?)?.let { - PaymentResultDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ComponentCommunicationModel { + val type = __pigeon_list[0] as ComponentCommunicationType + val componentId = __pigeon_list[1] as String + val data = __pigeon_list[2] + val paymentResult = __pigeon_list[3] as PaymentResultDTO? return ComponentCommunicationModel(type, componentId, data, paymentResult) } } fun toList(): List { - return listOf( - type.raw, + return listOf( + type, componentId, data, - paymentResult?.toList(), + paymentResult, ) } } @@ -951,23 +915,21 @@ data class PaymentEventDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): PaymentEventDTO { - val paymentEventType = PaymentEventType.ofRaw(list[0] as Int)!! - val result = list[1] as String? - val data = list[2] as Map? - val error: ErrorDTO? = (list[3] as List?)?.let { - ErrorDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): PaymentEventDTO { + val paymentEventType = __pigeon_list[0] as PaymentEventType + val result = __pigeon_list[1] as String? + val data = __pigeon_list[2] as Map? + val error = __pigeon_list[3] as ErrorDTO? return PaymentEventDTO(paymentEventType, result, data, error) } } fun toList(): List { - return listOf( - paymentEventType.raw, + return listOf( + paymentEventType, result, data, - error?.toList(), + error, ) } } @@ -980,16 +942,16 @@ data class ErrorDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ErrorDTO { - val errorMessage = list[0] as String? - val reason = list[1] as String? - val dismissDropIn = list[2] as Boolean? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ErrorDTO { + val errorMessage = __pigeon_list[0] as String? + val reason = __pigeon_list[1] as String? + val dismissDropIn = __pigeon_list[2] as Boolean? return ErrorDTO(errorMessage, reason, dismissDropIn) } } fun toList(): List { - return listOf( + return listOf( errorMessage, reason, dismissDropIn, @@ -1004,15 +966,15 @@ data class DeletedStoredPaymentMethodResultDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): DeletedStoredPaymentMethodResultDTO { - val storedPaymentMethodId = list[0] as String - val isSuccessfullyRemoved = list[1] as Boolean + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): DeletedStoredPaymentMethodResultDTO { + val storedPaymentMethodId = __pigeon_list[0] as String + val isSuccessfullyRemoved = __pigeon_list[1] as Boolean return DeletedStoredPaymentMethodResultDTO(storedPaymentMethodId, isSuccessfullyRemoved) } } fun toList(): List { - return listOf( + return listOf( storedPaymentMethodId, isSuccessfullyRemoved, ) @@ -1031,29 +993,27 @@ data class CardComponentConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): CardComponentConfigurationDTO { - val environment = Environment.ofRaw(list[0] as Int)!! - val clientKey = list[1] as String - val countryCode = list[2] as String - val amount: AmountDTO? = (list[3] as List?)?.let { - AmountDTO.fromList(it) - } - val shopperLocale = list[4] as String? - val cardConfiguration = CardConfigurationDTO.fromList(list[5] as List) - val analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as List) + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): CardComponentConfigurationDTO { + val environment = __pigeon_list[0] as Environment + val clientKey = __pigeon_list[1] as String + val countryCode = __pigeon_list[2] as String + val amount = __pigeon_list[3] as AmountDTO? + val shopperLocale = __pigeon_list[4] as String? + val cardConfiguration = __pigeon_list[5] as CardConfigurationDTO + val analyticsOptionsDTO = __pigeon_list[6] as AnalyticsOptionsDTO return CardComponentConfigurationDTO(environment, clientKey, countryCode, amount, shopperLocale, cardConfiguration, analyticsOptionsDTO) } } fun toList(): List { - return listOf( - environment.raw, + return listOf( + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - cardConfiguration.toList(), - analyticsOptionsDTO.toList(), + cardConfiguration, + analyticsOptionsDTO, ) } } @@ -1072,37 +1032,31 @@ data class InstantPaymentConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): InstantPaymentConfigurationDTO { - val instantPaymentType = InstantPaymentType.ofRaw(list[0] as Int)!! - val environment = Environment.ofRaw(list[1] as Int)!! - val clientKey = list[2] as String - val countryCode = list[3] as String - val amount: AmountDTO? = (list[4] as List?)?.let { - AmountDTO.fromList(it) - } - val shopperLocale = list[5] as String? - val analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as List) - val googlePayConfigurationDTO: GooglePayConfigurationDTO? = (list[7] as List?)?.let { - GooglePayConfigurationDTO.fromList(it) - } - val applePayConfigurationDTO: ApplePayConfigurationDTO? = (list[8] as List?)?.let { - ApplePayConfigurationDTO.fromList(it) - } + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): InstantPaymentConfigurationDTO { + val instantPaymentType = __pigeon_list[0] as InstantPaymentType + val environment = __pigeon_list[1] as Environment + val clientKey = __pigeon_list[2] as String + val countryCode = __pigeon_list[3] as String + val amount = __pigeon_list[4] as AmountDTO? + val shopperLocale = __pigeon_list[5] as String? + val analyticsOptionsDTO = __pigeon_list[6] as AnalyticsOptionsDTO + val googlePayConfigurationDTO = __pigeon_list[7] as GooglePayConfigurationDTO? + val applePayConfigurationDTO = __pigeon_list[8] as ApplePayConfigurationDTO? return InstantPaymentConfigurationDTO(instantPaymentType, environment, clientKey, countryCode, amount, shopperLocale, analyticsOptionsDTO, googlePayConfigurationDTO, applePayConfigurationDTO) } } fun toList(): List { - return listOf( - instantPaymentType.raw, - environment.raw, + return listOf( + instantPaymentType, + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - analyticsOptionsDTO.toList(), - googlePayConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList(), + analyticsOptionsDTO, + googlePayConfigurationDTO, + applePayConfigurationDTO, ) } } @@ -1115,17 +1069,17 @@ data class InstantPaymentSetupResultDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): InstantPaymentSetupResultDTO { - val instantPaymentType = InstantPaymentType.ofRaw(list[0] as Int)!! - val isSupported = list[1] as Boolean - val resultData = list[2] + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): InstantPaymentSetupResultDTO { + val instantPaymentType = __pigeon_list[0] as InstantPaymentType + val isSupported = __pigeon_list[1] as Boolean + val resultData = __pigeon_list[2] return InstantPaymentSetupResultDTO(instantPaymentType, isSupported, resultData) } } fun toList(): List { - return listOf( - instantPaymentType.raw, + return listOf( + instantPaymentType, isSupported, resultData, ) @@ -1141,17 +1095,17 @@ data class UnencryptedCardDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): UnencryptedCardDTO { - val cardNumber = list[0] as String? - val expiryMonth = list[1] as String? - val expiryYear = list[2] as String? - val cvc = list[3] as String? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): UnencryptedCardDTO { + val cardNumber = __pigeon_list[0] as String? + val expiryMonth = __pigeon_list[1] as String? + val expiryYear = __pigeon_list[2] as String? + val cvc = __pigeon_list[3] as String? return UnencryptedCardDTO(cardNumber, expiryMonth, expiryYear, cvc) } } fun toList(): List { - return listOf( + return listOf( cardNumber, expiryMonth, expiryYear, @@ -1169,17 +1123,17 @@ data class EncryptedCardDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): EncryptedCardDTO { - val encryptedCardNumber = list[0] as String? - val encryptedExpiryMonth = list[1] as String? - val encryptedExpiryYear = list[2] as String? - val encryptedSecurityCode = list[3] as String? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): EncryptedCardDTO { + val encryptedCardNumber = __pigeon_list[0] as String? + val encryptedExpiryMonth = __pigeon_list[1] as String? + val encryptedExpiryYear = __pigeon_list[2] as String? + val encryptedSecurityCode = __pigeon_list[3] as String? return EncryptedCardDTO(encryptedCardNumber, encryptedExpiryMonth, encryptedExpiryYear, encryptedSecurityCode) } } fun toList(): List { - return listOf( + return listOf( encryptedCardNumber, encryptedExpiryMonth, encryptedExpiryYear, @@ -1198,25 +1152,23 @@ data class ActionComponentConfigurationDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): ActionComponentConfigurationDTO { - val environment = Environment.ofRaw(list[0] as Int)!! - val clientKey = list[1] as String - val shopperLocale = list[2] as String? - val amount: AmountDTO? = (list[3] as List?)?.let { - AmountDTO.fromList(it) - } - val analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[4] as List) + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): ActionComponentConfigurationDTO { + val environment = __pigeon_list[0] as Environment + val clientKey = __pigeon_list[1] as String + val shopperLocale = __pigeon_list[2] as String? + val amount = __pigeon_list[3] as AmountDTO? + val analyticsOptionsDTO = __pigeon_list[4] as AnalyticsOptionsDTO return ActionComponentConfigurationDTO(environment, clientKey, shopperLocale, amount, analyticsOptionsDTO) } } fun toList(): List { - return listOf( - environment.raw, + return listOf( + environment, clientKey, shopperLocale, - amount?.toList(), - analyticsOptionsDTO.toList(), + amount, + analyticsOptionsDTO, ) } } @@ -1228,168 +1180,256 @@ data class OrderCancelResultDTO ( ) { companion object { - @Suppress("UNCHECKED_CAST") - fun fromList(list: List): OrderCancelResultDTO { - val orderCancelResponseBody = list[0] as Map - val updatedPaymentMethodsResponseBody = list[1] as Map? + @Suppress("LocalVariableName") + fun fromList(__pigeon_list: List): OrderCancelResultDTO { + val orderCancelResponseBody = __pigeon_list[0] as Map + val updatedPaymentMethodsResponseBody = __pigeon_list[1] as Map? return OrderCancelResultDTO(orderCancelResponseBody, updatedPaymentMethodsResponseBody) } } fun toList(): List { - return listOf( + return listOf( orderCancelResponseBody, updatedPaymentMethodsResponseBody, ) } } - -@Suppress("UNCHECKED_CAST") -private object CheckoutPlatformInterfaceCodec : StandardMessageCodec() { +private object PlatformApiPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - ActionComponentConfigurationDTO.fromList(it) - } - } 129.toByte() -> { return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) + SessionDTO.fromList(it) } } 130.toByte() -> { return (readValue(buffer) as? List)?.let { - AnalyticsOptionsDTO.fromList(it) + AmountDTO.fromList(it) } } 131.toByte() -> { return (readValue(buffer) as? List)?.let { - ApplePayConfigurationDTO.fromList(it) + AnalyticsOptionsDTO.fromList(it) } } 132.toByte() -> { return (readValue(buffer) as? List)?.let { - ApplePayContactDTO.fromList(it) + DropInConfigurationDTO.fromList(it) } } 133.toByte() -> { return (readValue(buffer) as? List)?.let { - ApplePayShippingMethodDTO.fromList(it) + CardConfigurationDTO.fromList(it) } } 134.toByte() -> { return (readValue(buffer) as? List)?.let { - ApplePaySummaryItemDTO.fromList(it) + ApplePayConfigurationDTO.fromList(it) } } 135.toByte() -> { return (readValue(buffer) as? List)?.let { - BillingAddressParametersDTO.fromList(it) + ApplePayContactDTO.fromList(it) } } 136.toByte() -> { return (readValue(buffer) as? List)?.let { - CardComponentConfigurationDTO.fromList(it) + ApplePayShippingMethodDTO.fromList(it) } } 137.toByte() -> { return (readValue(buffer) as? List)?.let { - CardConfigurationDTO.fromList(it) + ApplePaySummaryItemDTO.fromList(it) } } 138.toByte() -> { return (readValue(buffer) as? List)?.let { - CashAppPayConfigurationDTO.fromList(it) + GooglePayConfigurationDTO.fromList(it) } } 139.toByte() -> { return (readValue(buffer) as? List)?.let { - ComponentCommunicationModel.fromList(it) + MerchantInfoDTO.fromList(it) } } 140.toByte() -> { return (readValue(buffer) as? List)?.let { - DeletedStoredPaymentMethodResultDTO.fromList(it) + ShippingAddressParametersDTO.fromList(it) } } 141.toByte() -> { return (readValue(buffer) as? List)?.let { - DropInConfigurationDTO.fromList(it) + BillingAddressParametersDTO.fromList(it) } } 142.toByte() -> { return (readValue(buffer) as? List)?.let { - EncryptedCardDTO.fromList(it) + CashAppPayConfigurationDTO.fromList(it) } } 143.toByte() -> { return (readValue(buffer) as? List)?.let { - ErrorDTO.fromList(it) + PaymentResultDTO.fromList(it) } } 144.toByte() -> { return (readValue(buffer) as? List)?.let { - GooglePayConfigurationDTO.fromList(it) + PaymentResultModelDTO.fromList(it) } } 145.toByte() -> { return (readValue(buffer) as? List)?.let { - InstantPaymentConfigurationDTO.fromList(it) + OrderResponseDTO.fromList(it) } } 146.toByte() -> { return (readValue(buffer) as? List)?.let { - InstantPaymentSetupResultDTO.fromList(it) + PlatformCommunicationModel.fromList(it) } } 147.toByte() -> { return (readValue(buffer) as? List)?.let { - MerchantInfoDTO.fromList(it) + ComponentCommunicationModel.fromList(it) } } 148.toByte() -> { return (readValue(buffer) as? List)?.let { - OrderCancelResultDTO.fromList(it) + PaymentEventDTO.fromList(it) } } 149.toByte() -> { return (readValue(buffer) as? List)?.let { - OrderResponseDTO.fromList(it) + ErrorDTO.fromList(it) } } 150.toByte() -> { return (readValue(buffer) as? List)?.let { - PaymentEventDTO.fromList(it) + DeletedStoredPaymentMethodResultDTO.fromList(it) } } 151.toByte() -> { return (readValue(buffer) as? List)?.let { - PaymentResultDTO.fromList(it) + CardComponentConfigurationDTO.fromList(it) } } 152.toByte() -> { return (readValue(buffer) as? List)?.let { - PaymentResultModelDTO.fromList(it) + InstantPaymentConfigurationDTO.fromList(it) } } 153.toByte() -> { return (readValue(buffer) as? List)?.let { - PlatformCommunicationModel.fromList(it) + InstantPaymentSetupResultDTO.fromList(it) } } 154.toByte() -> { return (readValue(buffer) as? List)?.let { - SessionDTO.fromList(it) + UnencryptedCardDTO.fromList(it) } } 155.toByte() -> { return (readValue(buffer) as? List)?.let { - ShippingAddressParametersDTO.fromList(it) + EncryptedCardDTO.fromList(it) } } 156.toByte() -> { return (readValue(buffer) as? List)?.let { - UnencryptedCardDTO.fromList(it) + ActionComponentConfigurationDTO.fromList(it) + } + } + 157.toByte() -> { + return (readValue(buffer) as? List)?.let { + OrderCancelResultDTO.fromList(it) + } + } + 158.toByte() -> { + return (readValue(buffer) as Int?)?.let { + Environment.ofRaw(it) + } + } + 159.toByte() -> { + return (readValue(buffer) as Int?)?.let { + AddressMode.ofRaw(it) + } + } + 160.toByte() -> { + return (readValue(buffer) as Int?)?.let { + CardAuthMethod.ofRaw(it) + } + } + 161.toByte() -> { + return (readValue(buffer) as Int?)?.let { + TotalPriceStatus.ofRaw(it) + } + } + 162.toByte() -> { + return (readValue(buffer) as Int?)?.let { + GooglePayEnvironment.ofRaw(it) + } + } + 163.toByte() -> { + return (readValue(buffer) as Int?)?.let { + CashAppPayEnvironment.ofRaw(it) + } + } + 164.toByte() -> { + return (readValue(buffer) as Int?)?.let { + PaymentResultEnum.ofRaw(it) + } + } + 165.toByte() -> { + return (readValue(buffer) as Int?)?.let { + PlatformCommunicationType.ofRaw(it) + } + } + 166.toByte() -> { + return (readValue(buffer) as Int?)?.let { + ComponentCommunicationType.ofRaw(it) + } + } + 167.toByte() -> { + return (readValue(buffer) as Int?)?.let { + PaymentEventType.ofRaw(it) + } + } + 168.toByte() -> { + return (readValue(buffer) as Int?)?.let { + FieldVisibility.ofRaw(it) + } + } + 169.toByte() -> { + return (readValue(buffer) as Int?)?.let { + InstantPaymentType.ofRaw(it) + } + } + 170.toByte() -> { + return (readValue(buffer) as Int?)?.let { + ApplePayShippingType.ofRaw(it) + } + } + 171.toByte() -> { + return (readValue(buffer) as Int?)?.let { + ApplePayMerchantCapability.ofRaw(it) + } + } + 172.toByte() -> { + return (readValue(buffer) as Int?)?.let { + ApplePaySummaryItemType.ofRaw(it) + } + } + 173.toByte() -> { + return (readValue(buffer) as Int?)?.let { + CardNumberValidationResultDTO.ofRaw(it) + } + } + 174.toByte() -> { + return (readValue(buffer) as Int?)?.let { + CardExpiryDateValidationResultDTO.ofRaw(it) + } + } + 175.toByte() -> { + return (readValue(buffer) as Int?)?.let { + CardSecurityCodeValidationResultDTO.ofRaw(it) } } else -> super.readValueOfType(type, buffer) @@ -1397,127 +1437,200 @@ private object CheckoutPlatformInterfaceCodec : StandardMessageCodec() { } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { - is ActionComponentConfigurationDTO -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is AmountDTO -> { + is SessionDTO -> { stream.write(129) writeValue(stream, value.toList()) } - is AnalyticsOptionsDTO -> { + is AmountDTO -> { stream.write(130) writeValue(stream, value.toList()) } - is ApplePayConfigurationDTO -> { + is AnalyticsOptionsDTO -> { stream.write(131) writeValue(stream, value.toList()) } - is ApplePayContactDTO -> { + is DropInConfigurationDTO -> { stream.write(132) writeValue(stream, value.toList()) } - is ApplePayShippingMethodDTO -> { + is CardConfigurationDTO -> { stream.write(133) writeValue(stream, value.toList()) } - is ApplePaySummaryItemDTO -> { + is ApplePayConfigurationDTO -> { stream.write(134) writeValue(stream, value.toList()) } - is BillingAddressParametersDTO -> { + is ApplePayContactDTO -> { stream.write(135) writeValue(stream, value.toList()) } - is CardComponentConfigurationDTO -> { + is ApplePayShippingMethodDTO -> { stream.write(136) writeValue(stream, value.toList()) } - is CardConfigurationDTO -> { + is ApplePaySummaryItemDTO -> { stream.write(137) writeValue(stream, value.toList()) } - is CashAppPayConfigurationDTO -> { + is GooglePayConfigurationDTO -> { stream.write(138) writeValue(stream, value.toList()) } - is ComponentCommunicationModel -> { + is MerchantInfoDTO -> { stream.write(139) writeValue(stream, value.toList()) } - is DeletedStoredPaymentMethodResultDTO -> { + is ShippingAddressParametersDTO -> { stream.write(140) writeValue(stream, value.toList()) } - is DropInConfigurationDTO -> { + is BillingAddressParametersDTO -> { stream.write(141) writeValue(stream, value.toList()) } - is EncryptedCardDTO -> { + is CashAppPayConfigurationDTO -> { stream.write(142) writeValue(stream, value.toList()) } - is ErrorDTO -> { + is PaymentResultDTO -> { stream.write(143) writeValue(stream, value.toList()) } - is GooglePayConfigurationDTO -> { + is PaymentResultModelDTO -> { stream.write(144) writeValue(stream, value.toList()) } - is InstantPaymentConfigurationDTO -> { + is OrderResponseDTO -> { stream.write(145) writeValue(stream, value.toList()) } - is InstantPaymentSetupResultDTO -> { + is PlatformCommunicationModel -> { stream.write(146) writeValue(stream, value.toList()) } - is MerchantInfoDTO -> { + is ComponentCommunicationModel -> { stream.write(147) writeValue(stream, value.toList()) } - is OrderCancelResultDTO -> { + is PaymentEventDTO -> { stream.write(148) writeValue(stream, value.toList()) } - is OrderResponseDTO -> { + is ErrorDTO -> { stream.write(149) writeValue(stream, value.toList()) } - is PaymentEventDTO -> { + is DeletedStoredPaymentMethodResultDTO -> { stream.write(150) writeValue(stream, value.toList()) } - is PaymentResultDTO -> { + is CardComponentConfigurationDTO -> { stream.write(151) writeValue(stream, value.toList()) } - is PaymentResultModelDTO -> { + is InstantPaymentConfigurationDTO -> { stream.write(152) writeValue(stream, value.toList()) } - is PlatformCommunicationModel -> { + is InstantPaymentSetupResultDTO -> { stream.write(153) writeValue(stream, value.toList()) } - is SessionDTO -> { + is UnencryptedCardDTO -> { stream.write(154) writeValue(stream, value.toList()) } - is ShippingAddressParametersDTO -> { + is EncryptedCardDTO -> { stream.write(155) writeValue(stream, value.toList()) } - is UnencryptedCardDTO -> { + is ActionComponentConfigurationDTO -> { stream.write(156) writeValue(stream, value.toList()) } + is OrderCancelResultDTO -> { + stream.write(157) + writeValue(stream, value.toList()) + } + is Environment -> { + stream.write(158) + writeValue(stream, value.raw) + } + is AddressMode -> { + stream.write(159) + writeValue(stream, value.raw) + } + is CardAuthMethod -> { + stream.write(160) + writeValue(stream, value.raw) + } + is TotalPriceStatus -> { + stream.write(161) + writeValue(stream, value.raw) + } + is GooglePayEnvironment -> { + stream.write(162) + writeValue(stream, value.raw) + } + is CashAppPayEnvironment -> { + stream.write(163) + writeValue(stream, value.raw) + } + is PaymentResultEnum -> { + stream.write(164) + writeValue(stream, value.raw) + } + is PlatformCommunicationType -> { + stream.write(165) + writeValue(stream, value.raw) + } + is ComponentCommunicationType -> { + stream.write(166) + writeValue(stream, value.raw) + } + is PaymentEventType -> { + stream.write(167) + writeValue(stream, value.raw) + } + is FieldVisibility -> { + stream.write(168) + writeValue(stream, value.raw) + } + is InstantPaymentType -> { + stream.write(169) + writeValue(stream, value.raw) + } + is ApplePayShippingType -> { + stream.write(170) + writeValue(stream, value.raw) + } + is ApplePayMerchantCapability -> { + stream.write(171) + writeValue(stream, value.raw) + } + is ApplePaySummaryItemType -> { + stream.write(172) + writeValue(stream, value.raw) + } + is CardNumberValidationResultDTO -> { + stream.write(173) + writeValue(stream, value.raw) + } + is CardExpiryDateValidationResultDTO -> { + stream.write(174) + writeValue(stream, value.raw) + } + is CardSecurityCodeValidationResultDTO -> { + stream.write(175) + writeValue(stream, value.raw) + } else -> super.writeValue(stream, value) } } } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface CheckoutPlatformInterface { fun getReturnUrl(callback: (Result) -> Unit) @@ -1533,16 +1646,17 @@ interface CheckoutPlatformInterface { companion object { /** The codec used by CheckoutPlatformInterface. */ val codec: MessageCodec by lazy { - CheckoutPlatformInterfaceCodec + PlatformApiPigeonCodec } /** Sets up an instance of `CheckoutPlatformInterface` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: CheckoutPlatformInterface?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: CheckoutPlatformInterface?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - api.getReturnUrl() { result: Result -> + api.getReturnUrl{ result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(wrapError(error)) @@ -1557,7 +1671,7 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1579,15 +1693,14 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped: List - try { + val wrapped: List = try { api.clearSession() - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1596,7 +1709,7 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1617,7 +1730,7 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1638,17 +1751,16 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val cardNumberArg = args[0] as String val enableLuhnCheckArg = args[1] as Boolean - var wrapped: List - try { - wrapped = listOf(api.validateCardNumber(cardNumberArg, enableLuhnCheckArg).raw) + val wrapped: List = try { + listOf(api.validateCardNumber(cardNumberArg, enableLuhnCheckArg)) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1657,17 +1769,16 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val expiryMonthArg = args[0] as String val expiryYearArg = args[1] as String - var wrapped: List - try { - wrapped = listOf(api.validateCardExpiryDate(expiryMonthArg, expiryYearArg).raw) + val wrapped: List = try { + listOf(api.validateCardExpiryDate(expiryMonthArg, expiryYearArg)) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1676,17 +1787,16 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val securityCodeArg = args[0] as String val cardBrandArg = args[1] as String? - var wrapped: List - try { - wrapped = listOf(api.validateCardSecurityCode(securityCodeArg, cardBrandArg).raw) + val wrapped: List = try { + listOf(api.validateCardSecurityCode(securityCodeArg, cardBrandArg)) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1695,17 +1805,16 @@ interface CheckoutPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val loggingEnabledArg = args[0] as Boolean - var wrapped: List - try { + val wrapped: List = try { api.enableConsoleLogging(loggingEnabledArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1716,182 +1825,6 @@ interface CheckoutPlatformInterface { } } } -@Suppress("UNCHECKED_CAST") -private object DropInPlatformInterfaceCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - AnalyticsOptionsDTO.fromList(it) - } - } - 131.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayConfigurationDTO.fromList(it) - } - } - 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayContactDTO.fromList(it) - } - } - 133.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayShippingMethodDTO.fromList(it) - } - } - 134.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePaySummaryItemDTO.fromList(it) - } - } - 135.toByte() -> { - return (readValue(buffer) as? List)?.let { - BillingAddressParametersDTO.fromList(it) - } - } - 136.toByte() -> { - return (readValue(buffer) as? List)?.let { - CardConfigurationDTO.fromList(it) - } - } - 137.toByte() -> { - return (readValue(buffer) as? List)?.let { - CashAppPayConfigurationDTO.fromList(it) - } - } - 138.toByte() -> { - return (readValue(buffer) as? List)?.let { - DeletedStoredPaymentMethodResultDTO.fromList(it) - } - } - 139.toByte() -> { - return (readValue(buffer) as? List)?.let { - DropInConfigurationDTO.fromList(it) - } - } - 140.toByte() -> { - return (readValue(buffer) as? List)?.let { - ErrorDTO.fromList(it) - } - } - 141.toByte() -> { - return (readValue(buffer) as? List)?.let { - GooglePayConfigurationDTO.fromList(it) - } - } - 142.toByte() -> { - return (readValue(buffer) as? List)?.let { - MerchantInfoDTO.fromList(it) - } - } - 143.toByte() -> { - return (readValue(buffer) as? List)?.let { - OrderCancelResultDTO.fromList(it) - } - } - 144.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentEventDTO.fromList(it) - } - } - 145.toByte() -> { - return (readValue(buffer) as? List)?.let { - ShippingAddressParametersDTO.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is AmountDTO -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is AmountDTO -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is AnalyticsOptionsDTO -> { - stream.write(130) - writeValue(stream, value.toList()) - } - is ApplePayConfigurationDTO -> { - stream.write(131) - writeValue(stream, value.toList()) - } - is ApplePayContactDTO -> { - stream.write(132) - writeValue(stream, value.toList()) - } - is ApplePayShippingMethodDTO -> { - stream.write(133) - writeValue(stream, value.toList()) - } - is ApplePaySummaryItemDTO -> { - stream.write(134) - writeValue(stream, value.toList()) - } - is BillingAddressParametersDTO -> { - stream.write(135) - writeValue(stream, value.toList()) - } - is CardConfigurationDTO -> { - stream.write(136) - writeValue(stream, value.toList()) - } - is CashAppPayConfigurationDTO -> { - stream.write(137) - writeValue(stream, value.toList()) - } - is DeletedStoredPaymentMethodResultDTO -> { - stream.write(138) - writeValue(stream, value.toList()) - } - is DropInConfigurationDTO -> { - stream.write(139) - writeValue(stream, value.toList()) - } - is ErrorDTO -> { - stream.write(140) - writeValue(stream, value.toList()) - } - is GooglePayConfigurationDTO -> { - stream.write(141) - writeValue(stream, value.toList()) - } - is MerchantInfoDTO -> { - stream.write(142) - writeValue(stream, value.toList()) - } - is OrderCancelResultDTO -> { - stream.write(143) - writeValue(stream, value.toList()) - } - is PaymentEventDTO -> { - stream.write(144) - writeValue(stream, value.toList()) - } - is ShippingAddressParametersDTO -> { - stream.write(145) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ interface DropInPlatformInterface { fun showDropInSession(dropInConfigurationDTO: DropInConfigurationDTO) @@ -1907,23 +1840,23 @@ interface DropInPlatformInterface { companion object { /** The codec used by DropInPlatformInterface. */ val codec: MessageCodec by lazy { - DropInPlatformInterfaceCodec + PlatformApiPigeonCodec } /** Sets up an instance of `DropInPlatformInterface` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: DropInPlatformInterface?) { + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: DropInPlatformInterface?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val dropInConfigurationDTOArg = args[0] as DropInConfigurationDTO - var wrapped: List - try { + val wrapped: List = try { api.showDropInSession(dropInConfigurationDTOArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1932,18 +1865,17 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val dropInConfigurationDTOArg = args[0] as DropInConfigurationDTO val paymentMethodsResponseArg = args[1] as String - var wrapped: List - try { + val wrapped: List = try { api.showDropInAdvanced(dropInConfigurationDTOArg, paymentMethodsResponseArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1952,17 +1884,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val paymentsResultArg = args[0] as PaymentEventDTO - var wrapped: List - try { + val wrapped: List = try { api.onPaymentsResult(paymentsResultArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1971,17 +1902,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val paymentsDetailsResultArg = args[0] as PaymentEventDTO - var wrapped: List - try { + val wrapped: List = try { api.onPaymentsDetailsResult(paymentsDetailsResultArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -1990,17 +1920,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val deleteStoredPaymentMethodResultDTOArg = args[0] as DeletedStoredPaymentMethodResultDTO - var wrapped: List - try { + val wrapped: List = try { api.onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTOArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2009,17 +1938,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val balanceCheckResponseArg = args[0] as String - var wrapped: List - try { + val wrapped: List = try { api.onBalanceCheckResult(balanceCheckResponseArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2028,17 +1956,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val orderRequestResponseArg = args[0] as String - var wrapped: List - try { + val wrapped: List = try { api.onOrderRequestResult(orderRequestResponseArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2047,17 +1974,16 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val orderCancelResultArg = args[0] as OrderCancelResultDTO - var wrapped: List - try { + val wrapped: List = try { api.onOrderCancelResult(orderCancelResultArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2066,15 +1992,14 @@ interface DropInPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { _, reply -> - var wrapped: List - try { + val wrapped: List = try { api.cleanUpDropIn() - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2085,77 +2010,18 @@ interface DropInPlatformInterface { } } } -@Suppress("UNCHECKED_CAST") -private object DropInFlutterInterfaceCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - OrderResponseDTO.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultDTO.fromList(it) - } - } - 131.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultModelDTO.fromList(it) - } - } - 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformCommunicationModel.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is AmountDTO -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is OrderResponseDTO -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is PaymentResultDTO -> { - stream.write(130) - writeValue(stream, value.toList()) - } - is PaymentResultModelDTO -> { - stream.write(131) - writeValue(stream, value.toList()) - } - is PlatformCommunicationModel -> { - stream.write(132) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -@Suppress("UNCHECKED_CAST") -class DropInFlutterInterface(private val binaryMessenger: BinaryMessenger) { +class DropInFlutterInterface(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { companion object { /** The codec used by DropInFlutterInterface. */ val codec: MessageCodec by lazy { - DropInFlutterInterfaceCodec + PlatformApiPigeonCodec } } fun onDropInSessionPlatformCommunication(platformCommunicationModelArg: PlatformCommunicationModel, callback: (Result) -> Unit) { - val channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication" + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(platformCommunicationModelArg)) { if (it is List<*>) { @@ -2171,7 +2037,8 @@ class DropInFlutterInterface(private val binaryMessenger: BinaryMessenger) { } fun onDropInAdvancedPlatformCommunication(platformCommunicationModelArg: PlatformCommunicationModel, callback: (Result) -> Unit) { - val channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication" + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(platformCommunicationModelArg)) { if (it is List<*>) { @@ -2186,351 +2053,74 @@ class DropInFlutterInterface(private val binaryMessenger: BinaryMessenger) { } } } -@Suppress("UNCHECKED_CAST") -private object ComponentPlatformInterfaceCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - ActionComponentConfigurationDTO.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - AnalyticsOptionsDTO.fromList(it) - } - } - 131.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayConfigurationDTO.fromList(it) +/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ +interface ComponentPlatformInterface { + fun updateViewHeight(viewId: Long) + fun onPaymentsResult(componentId: String, paymentsResult: PaymentEventDTO) + fun onPaymentsDetailsResult(componentId: String, paymentsDetailsResult: PaymentEventDTO) + fun isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, paymentMethodResponse: String, componentId: String, callback: (Result) -> Unit) + fun onInstantPaymentPressed(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, encodedPaymentMethod: String, componentId: String) + fun handleAction(actionComponentConfiguration: ActionComponentConfigurationDTO, componentId: String, actionResponse: Map?) + fun onDispose(componentId: String) + + companion object { + /** The codec used by ComponentPlatformInterface. */ + val codec: MessageCodec by lazy { + PlatformApiPigeonCodec + } + /** Sets up an instance of `ComponentPlatformInterface` to handle messages through the `binaryMessenger`. */ + @JvmOverloads + fun setUp(binaryMessenger: BinaryMessenger, api: ComponentPlatformInterface?, messageChannelSuffix: String = "") { + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val viewIdArg = args[0].let { num -> if (num is Int) num.toLong() else num as Long } + val wrapped: List = try { + api.updateViewHeight(viewIdArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) } } - 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayContactDTO.fromList(it) + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult$separatedMessageChannelSuffix", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val componentIdArg = args[0] as String + val paymentsResultArg = args[1] as PaymentEventDTO + val wrapped: List = try { + api.onPaymentsResult(componentIdArg, paymentsResultArg) + listOf(null) + } catch (exception: Throwable) { + wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) } } - 133.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePayShippingMethodDTO.fromList(it) - } - } - 134.toByte() -> { - return (readValue(buffer) as? List)?.let { - ApplePaySummaryItemDTO.fromList(it) - } - } - 135.toByte() -> { - return (readValue(buffer) as? List)?.let { - BillingAddressParametersDTO.fromList(it) - } - } - 136.toByte() -> { - return (readValue(buffer) as? List)?.let { - CardComponentConfigurationDTO.fromList(it) - } - } - 137.toByte() -> { - return (readValue(buffer) as? List)?.let { - CardConfigurationDTO.fromList(it) - } - } - 138.toByte() -> { - return (readValue(buffer) as? List)?.let { - CashAppPayConfigurationDTO.fromList(it) - } - } - 139.toByte() -> { - return (readValue(buffer) as? List)?.let { - ComponentCommunicationModel.fromList(it) - } - } - 140.toByte() -> { - return (readValue(buffer) as? List)?.let { - DeletedStoredPaymentMethodResultDTO.fromList(it) - } - } - 141.toByte() -> { - return (readValue(buffer) as? List)?.let { - DropInConfigurationDTO.fromList(it) - } - } - 142.toByte() -> { - return (readValue(buffer) as? List)?.let { - EncryptedCardDTO.fromList(it) - } - } - 143.toByte() -> { - return (readValue(buffer) as? List)?.let { - ErrorDTO.fromList(it) - } - } - 144.toByte() -> { - return (readValue(buffer) as? List)?.let { - GooglePayConfigurationDTO.fromList(it) - } - } - 145.toByte() -> { - return (readValue(buffer) as? List)?.let { - InstantPaymentConfigurationDTO.fromList(it) - } - } - 146.toByte() -> { - return (readValue(buffer) as? List)?.let { - InstantPaymentSetupResultDTO.fromList(it) - } - } - 147.toByte() -> { - return (readValue(buffer) as? List)?.let { - MerchantInfoDTO.fromList(it) - } - } - 148.toByte() -> { - return (readValue(buffer) as? List)?.let { - OrderCancelResultDTO.fromList(it) - } - } - 149.toByte() -> { - return (readValue(buffer) as? List)?.let { - OrderResponseDTO.fromList(it) - } - } - 150.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentEventDTO.fromList(it) - } - } - 151.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultDTO.fromList(it) - } - } - 152.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultModelDTO.fromList(it) - } - } - 153.toByte() -> { - return (readValue(buffer) as? List)?.let { - PlatformCommunicationModel.fromList(it) - } - } - 154.toByte() -> { - return (readValue(buffer) as? List)?.let { - SessionDTO.fromList(it) - } - } - 155.toByte() -> { - return (readValue(buffer) as? List)?.let { - ShippingAddressParametersDTO.fromList(it) - } - } - 156.toByte() -> { - return (readValue(buffer) as? List)?.let { - UnencryptedCardDTO.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is ActionComponentConfigurationDTO -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is AmountDTO -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is AnalyticsOptionsDTO -> { - stream.write(130) - writeValue(stream, value.toList()) - } - is ApplePayConfigurationDTO -> { - stream.write(131) - writeValue(stream, value.toList()) - } - is ApplePayContactDTO -> { - stream.write(132) - writeValue(stream, value.toList()) - } - is ApplePayShippingMethodDTO -> { - stream.write(133) - writeValue(stream, value.toList()) - } - is ApplePaySummaryItemDTO -> { - stream.write(134) - writeValue(stream, value.toList()) - } - is BillingAddressParametersDTO -> { - stream.write(135) - writeValue(stream, value.toList()) - } - is CardComponentConfigurationDTO -> { - stream.write(136) - writeValue(stream, value.toList()) - } - is CardConfigurationDTO -> { - stream.write(137) - writeValue(stream, value.toList()) - } - is CashAppPayConfigurationDTO -> { - stream.write(138) - writeValue(stream, value.toList()) - } - is ComponentCommunicationModel -> { - stream.write(139) - writeValue(stream, value.toList()) - } - is DeletedStoredPaymentMethodResultDTO -> { - stream.write(140) - writeValue(stream, value.toList()) - } - is DropInConfigurationDTO -> { - stream.write(141) - writeValue(stream, value.toList()) - } - is EncryptedCardDTO -> { - stream.write(142) - writeValue(stream, value.toList()) - } - is ErrorDTO -> { - stream.write(143) - writeValue(stream, value.toList()) - } - is GooglePayConfigurationDTO -> { - stream.write(144) - writeValue(stream, value.toList()) - } - is InstantPaymentConfigurationDTO -> { - stream.write(145) - writeValue(stream, value.toList()) - } - is InstantPaymentSetupResultDTO -> { - stream.write(146) - writeValue(stream, value.toList()) - } - is MerchantInfoDTO -> { - stream.write(147) - writeValue(stream, value.toList()) - } - is OrderCancelResultDTO -> { - stream.write(148) - writeValue(stream, value.toList()) - } - is OrderResponseDTO -> { - stream.write(149) - writeValue(stream, value.toList()) - } - is PaymentEventDTO -> { - stream.write(150) - writeValue(stream, value.toList()) - } - is PaymentResultDTO -> { - stream.write(151) - writeValue(stream, value.toList()) - } - is PaymentResultModelDTO -> { - stream.write(152) - writeValue(stream, value.toList()) - } - is PlatformCommunicationModel -> { - stream.write(153) - writeValue(stream, value.toList()) - } - is SessionDTO -> { - stream.write(154) - writeValue(stream, value.toList()) - } - is ShippingAddressParametersDTO -> { - stream.write(155) - writeValue(stream, value.toList()) - } - is UnencryptedCardDTO -> { - stream.write(156) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - -/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ -interface ComponentPlatformInterface { - fun updateViewHeight(viewId: Long) - fun onPaymentsResult(componentId: String, paymentsResult: PaymentEventDTO) - fun onPaymentsDetailsResult(componentId: String, paymentsDetailsResult: PaymentEventDTO) - fun isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, paymentMethodResponse: String, componentId: String, callback: (Result) -> Unit) - fun onInstantPaymentPressed(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, encodedPaymentMethod: String, componentId: String) - fun handleAction(actionComponentConfiguration: ActionComponentConfigurationDTO, componentId: String, actionResponse: Map?) - fun onDispose(componentId: String) - - companion object { - /** The codec used by ComponentPlatformInterface. */ - val codec: MessageCodec by lazy { - ComponentPlatformInterfaceCodec - } - /** Sets up an instance of `ComponentPlatformInterface` to handle messages through the `binaryMessenger`. */ - @Suppress("UNCHECKED_CAST") - fun setUp(binaryMessenger: BinaryMessenger, api: ComponentPlatformInterface?) { run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val viewIdArg = args[0].let { if (it is Int) it.toLong() else it as Long } - var wrapped: List - try { - api.updateViewHeight(viewIdArg) - wrapped = listOf(null) - } catch (exception: Throwable) { - wrapped = wrapError(exception) - } - reply.reply(wrapped) - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult", codec) - if (api != null) { - channel.setMessageHandler { message, reply -> - val args = message as List - val componentIdArg = args[0] as String - val paymentsResultArg = args[1] as PaymentEventDTO - var wrapped: List - try { - api.onPaymentsResult(componentIdArg, paymentsResultArg) - wrapped = listOf(null) - } catch (exception: Throwable) { - wrapped = wrapError(exception) - } - reply.reply(wrapped) - } - } else { - channel.setMessageHandler(null) - } - } - run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val componentIdArg = args[0] as String val paymentsDetailsResultArg = args[1] as PaymentEventDTO - var wrapped: List - try { + val wrapped: List = try { api.onPaymentsDetailsResult(componentIdArg, paymentsDetailsResultArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2539,7 +2129,7 @@ interface ComponentPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2561,19 +2151,18 @@ interface ComponentPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val instantPaymentConfigurationDTOArg = args[0] as InstantPaymentConfigurationDTO val encodedPaymentMethodArg = args[1] as String val componentIdArg = args[2] as String - var wrapped: List - try { + val wrapped: List = try { api.onInstantPaymentPressed(instantPaymentConfigurationDTOArg, encodedPaymentMethodArg, componentIdArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2582,19 +2171,18 @@ interface ComponentPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val actionComponentConfigurationArg = args[0] as ActionComponentConfigurationDTO val componentIdArg = args[1] as String val actionResponseArg = args[2] as Map? - var wrapped: List - try { + val wrapped: List = try { api.handleAction(actionComponentConfigurationArg, componentIdArg, actionResponseArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2603,17 +2191,16 @@ interface ComponentPlatformInterface { } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose$separatedMessageChannelSuffix", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val componentIdArg = args[0] as String - var wrapped: List - try { + val wrapped: List = try { api.onDispose(componentIdArg) - wrapped = listOf(null) + listOf(null) } catch (exception: Throwable) { - wrapped = wrapError(exception) + wrapError(exception) } reply.reply(wrapped) } @@ -2624,113 +2211,18 @@ interface ComponentPlatformInterface { } } } -@Suppress("UNCHECKED_CAST") -private object ComponentFlutterInterfaceCodec : StandardMessageCodec() { - override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { - return when (type) { - 128.toByte() -> { - return (readValue(buffer) as? List)?.let { - AmountDTO.fromList(it) - } - } - 129.toByte() -> { - return (readValue(buffer) as? List)?.let { - AnalyticsOptionsDTO.fromList(it) - } - } - 130.toByte() -> { - return (readValue(buffer) as? List)?.let { - CardComponentConfigurationDTO.fromList(it) - } - } - 131.toByte() -> { - return (readValue(buffer) as? List)?.let { - CardConfigurationDTO.fromList(it) - } - } - 132.toByte() -> { - return (readValue(buffer) as? List)?.let { - ComponentCommunicationModel.fromList(it) - } - } - 133.toByte() -> { - return (readValue(buffer) as? List)?.let { - OrderResponseDTO.fromList(it) - } - } - 134.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultDTO.fromList(it) - } - } - 135.toByte() -> { - return (readValue(buffer) as? List)?.let { - PaymentResultModelDTO.fromList(it) - } - } - 136.toByte() -> { - return (readValue(buffer) as? List)?.let { - SessionDTO.fromList(it) - } - } - else -> super.readValueOfType(type, buffer) - } - } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - when (value) { - is AmountDTO -> { - stream.write(128) - writeValue(stream, value.toList()) - } - is AnalyticsOptionsDTO -> { - stream.write(129) - writeValue(stream, value.toList()) - } - is CardComponentConfigurationDTO -> { - stream.write(130) - writeValue(stream, value.toList()) - } - is CardConfigurationDTO -> { - stream.write(131) - writeValue(stream, value.toList()) - } - is ComponentCommunicationModel -> { - stream.write(132) - writeValue(stream, value.toList()) - } - is OrderResponseDTO -> { - stream.write(133) - writeValue(stream, value.toList()) - } - is PaymentResultDTO -> { - stream.write(134) - writeValue(stream, value.toList()) - } - is PaymentResultModelDTO -> { - stream.write(135) - writeValue(stream, value.toList()) - } - is SessionDTO -> { - stream.write(136) - writeValue(stream, value.toList()) - } - else -> super.writeValue(stream, value) - } - } -} - /** Generated class from Pigeon that represents Flutter messages that can be called from Kotlin. */ -@Suppress("UNCHECKED_CAST") -class ComponentFlutterInterface(private val binaryMessenger: BinaryMessenger) { +class ComponentFlutterInterface(private val binaryMessenger: BinaryMessenger, private val messageChannelSuffix: String = "") { companion object { /** The codec used by ComponentFlutterInterface. */ val codec: MessageCodec by lazy { - ComponentFlutterInterfaceCodec + PlatformApiPigeonCodec } } fun _generateCodecForDTOs(cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTOArg: SessionDTO, callback: (Result) -> Unit) { - val channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs" + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(cardComponentConfigurationDTOArg, sessionDTOArg)) { if (it is List<*>) { @@ -2746,7 +2238,8 @@ class ComponentFlutterInterface(private val binaryMessenger: BinaryMessenger) { } fun onComponentCommunication(componentCommunicationModelArg: ComponentCommunicationModel, callback: (Result) -> Unit) { - val channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication" + val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else "" + val channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication$separatedMessageChannelSuffix" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(componentCommunicationModelArg)) { if (it is List<*>) { diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/utils/ConfigurationMapper.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/utils/ConfigurationMapper.kt index 2f67a616..ebaeaf0d 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/utils/ConfigurationMapper.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/utils/ConfigurationMapper.kt @@ -1,25 +1,5 @@ package com.adyen.checkout.flutter.utils -import ActionComponentConfigurationDTO -import AddressMode -import AmountDTO -import AnalyticsOptionsDTO -import BillingAddressParametersDTO -import CardConfigurationDTO -import CashAppPayConfigurationDTO -import CashAppPayEnvironment -import DropInConfigurationDTO -import EncryptedCardDTO -import Environment -import FieldVisibility -import GooglePayConfigurationDTO -import GooglePayEnvironment -import InstantPaymentConfigurationDTO -import MerchantInfoDTO -import OrderResponseDTO -import ShippingAddressParametersDTO -import TotalPriceStatus -import UnencryptedCardDTO import android.content.Context import com.adyen.checkout.card.AddressConfiguration import com.adyen.checkout.card.CardConfiguration @@ -37,7 +17,26 @@ import com.adyen.checkout.components.core.internal.analytics.AnalyticsPlatformPa import com.adyen.checkout.cse.EncryptedCard import com.adyen.checkout.cse.UnencryptedCard import com.adyen.checkout.dropin.DropInConfiguration -import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToEnvironment +import com.adyen.checkout.flutter.generated.ActionComponentConfigurationDTO +import com.adyen.checkout.flutter.generated.AddressMode +import com.adyen.checkout.flutter.generated.AmountDTO +import com.adyen.checkout.flutter.generated.AnalyticsOptionsDTO +import com.adyen.checkout.flutter.generated.BillingAddressParametersDTO +import com.adyen.checkout.flutter.generated.CardConfigurationDTO +import com.adyen.checkout.flutter.generated.CashAppPayConfigurationDTO +import com.adyen.checkout.flutter.generated.CashAppPayEnvironment +import com.adyen.checkout.flutter.generated.DropInConfigurationDTO +import com.adyen.checkout.flutter.generated.EncryptedCardDTO +import com.adyen.checkout.flutter.generated.Environment +import com.adyen.checkout.flutter.generated.FieldVisibility +import com.adyen.checkout.flutter.generated.GooglePayConfigurationDTO +import com.adyen.checkout.flutter.generated.GooglePayEnvironment +import com.adyen.checkout.flutter.generated.InstantPaymentConfigurationDTO +import com.adyen.checkout.flutter.generated.MerchantInfoDTO +import com.adyen.checkout.flutter.generated.OrderResponseDTO +import com.adyen.checkout.flutter.generated.ShippingAddressParametersDTO +import com.adyen.checkout.flutter.generated.TotalPriceStatus +import com.adyen.checkout.flutter.generated.UnencryptedCardDTO import com.adyen.checkout.googlepay.BillingAddressParameters import com.adyen.checkout.googlepay.GooglePayConfiguration import com.adyen.checkout.googlepay.MerchantInfo @@ -205,7 +204,7 @@ object ConfigurationMapper { private fun AddressMode.mapToAddressConfiguration(): AddressConfiguration { return when (this) { AddressMode.FULL -> AddressConfiguration.FullAddress() - AddressMode.POSTALCODE -> AddressConfiguration.PostalCode() + AddressMode.POSTAL_CODE -> AddressConfiguration.PostalCode() AddressMode.NONE -> AddressConfiguration.None } } @@ -240,7 +239,7 @@ object ConfigurationMapper { return when (this) { Environment.TEST -> SDKEnvironment.TEST Environment.EUROPE -> SDKEnvironment.EUROPE - Environment.UNITEDSTATES -> SDKEnvironment.UNITED_STATES + Environment.UNITED_STATES -> SDKEnvironment.UNITED_STATES Environment.AUSTRALIA -> SDKEnvironment.AUSTRALIA Environment.INDIA -> SDKEnvironment.INDIA Environment.APSE -> SDKEnvironment.APSE @@ -346,9 +345,9 @@ object ConfigurationMapper { private fun TotalPriceStatus.mapToTotalPriceStatus(): String { return when (this) { - TotalPriceStatus.NOTCURRENTLYKNOWN -> "NOT_CURRENTLY_KNOWN" + TotalPriceStatus.NOT_CURRENTLY_KNOWN -> "NOT_CURRENTLY_KNOWN" TotalPriceStatus.ESTIMATED -> "ESTIMATED" - TotalPriceStatus.FINALPRICE -> "FINAL" + TotalPriceStatus.FINAL_PRICE -> "FINAL" } } diff --git a/android/src/test/kotlin/com/adyen/checkout/flutter/ConfigurationMapperTest.kt b/android/src/test/kotlin/com/adyen/checkout/flutter/ConfigurationMapperTest.kt index fe99bcbb..346ac1d2 100644 --- a/android/src/test/kotlin/com/adyen/checkout/flutter/ConfigurationMapperTest.kt +++ b/android/src/test/kotlin/com/adyen/checkout/flutter/ConfigurationMapperTest.kt @@ -1,20 +1,20 @@ package com.adyen.checkout.flutter -import AmountDTO -import AnalyticsOptionsDTO -import CardConfigurationDTO -import DropInConfigurationDTO -import Environment -import FieldVisibility import android.content.Context import com.adyen.checkout.card.AddressConfiguration import com.adyen.checkout.card.KCPAuthVisibility import com.adyen.checkout.card.SocialSecurityNumberVisibility import com.adyen.checkout.components.core.Amount import com.adyen.checkout.components.core.AnalyticsConfiguration -import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToDropInConfiguration -import com.adyen.checkout.flutter.utils.ConfigurationMapper.fromDTO +import com.adyen.checkout.flutter.generated.AddressMode +import com.adyen.checkout.flutter.generated.AmountDTO +import com.adyen.checkout.flutter.generated.AnalyticsOptionsDTO +import com.adyen.checkout.flutter.generated.CardConfigurationDTO +import com.adyen.checkout.flutter.generated.DropInConfigurationDTO +import com.adyen.checkout.flutter.generated.Environment +import com.adyen.checkout.flutter.generated.FieldVisibility import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToCardConfiguration +import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToDropInConfiguration import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.mockito.Mockito.mock diff --git a/android/src/test/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidationTest.kt b/android/src/test/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidationTest.kt index c888f345..2b602b31 100644 --- a/android/src/test/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidationTest.kt +++ b/android/src/test/kotlin/com/adyen/checkout/flutter/apiOnly/CardValidationTest.kt @@ -1,6 +1,8 @@ package com.adyen.checkout.flutter.apiOnly -import CardNumberValidationResultDTO +import com.adyen.checkout.flutter.generated.CardExpiryDateValidationResultDTO +import com.adyen.checkout.flutter.generated.CardNumberValidationResultDTO +import com.adyen.checkout.flutter.generated.CardSecurityCodeValidationResultDTO import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Nested import org.junit.jupiter.api.Test @@ -50,7 +52,7 @@ internal class CardValidationTest { val validationResult = CardValidation.validateCardNumber(cardNumber, true) - assertEquals(CardNumberValidationResultDTO.INVALIDLUHNCHECK, validationResult) + assertEquals(CardNumberValidationResultDTO.INVALID_LUHN_CHECK, validationResult) } @Test @@ -59,7 +61,7 @@ internal class CardValidationTest { val validationResult = CardValidation.validateCardNumber(cardNumber, true) - assertEquals(CardNumberValidationResultDTO.INVALIDTOOSHORT, validationResult) + assertEquals(CardNumberValidationResultDTO.INVALID_TOO_SHORT, validationResult) } @Test @@ -68,7 +70,7 @@ internal class CardValidationTest { val validationResult = CardValidation.validateCardNumber(cardNumber, true) - assertEquals(CardNumberValidationResultDTO.INVALIDTOOLONG, validationResult) + assertEquals(CardNumberValidationResultDTO.INVALID_TOO_LONG, validationResult) } @Test @@ -77,7 +79,7 @@ internal class CardValidationTest { val validationResult = CardValidation.validateCardNumber(cardNumber, true) - assertEquals(CardNumberValidationResultDTO.INVALIDILLEGALCHARACTERS, validationResult) + assertEquals(CardNumberValidationResultDTO.INVALID_ILLEGAL_CHARACTERS, validationResult) } @Test @@ -86,7 +88,7 @@ internal class CardValidationTest { val validationResult = CardValidation.validateCardNumber(cardNumber, true) - assertEquals(CardNumberValidationResultDTO.INVALIDTOOSHORT, validationResult) + assertEquals(CardNumberValidationResultDTO.INVALID_TOO_SHORT, validationResult) } } @@ -105,14 +107,14 @@ internal class CardValidationTest { fun `given date is too far in the future when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("12", "2099") - assertEquals(CardExpiryDateValidationResultDTO.INVALIDTOOFARINTHEFUTURE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.INVALID_TOO_FAR_IN_THE_FUTURE, validationResult) } @Test fun `given date is too old when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("12", "2018") - assertEquals(CardExpiryDateValidationResultDTO.INVALIDTOOOLD, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.INVALID_TOO_OLD, validationResult) } @@ -120,42 +122,42 @@ internal class CardValidationTest { fun `given date is empty when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("", "") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } @Test fun `given date is invalid when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("30", "10") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } @Test fun `given month is missing when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("", "10") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } @Test fun `given year is missing when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("5", "") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } @Test fun `given values are wrong when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("av", "test") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } @Test fun `given values are too long when validate card expiry date then result should be invalid`() { val validationResult = CardValidation.validateCardExpiryDate("1234", "56789") - assertEquals(CardExpiryDateValidationResultDTO.NONPARSEABLEDATE, validationResult) + assertEquals(CardExpiryDateValidationResultDTO.NON_PARSEABLE_DATE, validationResult) } } diff --git a/ios/.swiftlint.yml b/ios/.swiftlint.yml index 74e8a043..e92839d3 100644 --- a/ios/.swiftlint.yml +++ b/ios/.swiftlint.yml @@ -3,7 +3,7 @@ disabled_rules: - type_name excluded: - - Classes/PlatformApi.swift + - Classes/generated/PlatformApi.swift line_length: warning: 140 diff --git a/ios/Classes/PlatformApi.swift b/ios/Classes/generated/PlatformApi.swift similarity index 60% rename from ios/Classes/PlatformApi.swift rename to ios/Classes/generated/PlatformApi.swift index 856683d9..db6fedb7 100644 --- a/ios/Classes/PlatformApi.swift +++ b/ios/Classes/generated/PlatformApi.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v16.0.5), do not edit directly. +// Autogenerated from Pigeon (v21.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -11,11 +11,35 @@ import Foundation #error("Unsupported platform.") #endif +/// Error class for passing custom error details to Dart side. +final class AdyenPigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + "AdyenPigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } +} + private func wrapResult(_ result: Any?) -> [Any?] { [result] } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? AdyenPigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, @@ -30,8 +54,8 @@ private func wrapError(_ error: Any) -> [Any?] { ] } -private func createConnectionError(withChannelName channelName: String) -> FlutterError { - FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") +private func createConnectionError(withChannelName channelName: String) -> AdyenPigeonError { + AdyenPigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -166,10 +190,11 @@ struct SessionDTO { var sessionData: String var paymentMethodsJson: String - static func fromList(_ list: [Any?]) -> SessionDTO? { - let id = list[0] as! String - let sessionData = list[1] as! String - let paymentMethodsJson = list[2] as! String + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> SessionDTO? { + let id = __pigeon_list[0] as! String + let sessionData = __pigeon_list[1] as! String + let paymentMethodsJson = __pigeon_list[2] as! String return SessionDTO( id: id, @@ -192,9 +217,10 @@ struct AmountDTO { var currency: String var value: Int64 - static func fromList(_ list: [Any?]) -> AmountDTO? { - let currency = list[0] as! String - let value = list[1] is Int64 ? list[1] as! Int64 : Int64(list[1] as! Int32) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> AmountDTO? { + let currency = __pigeon_list[0] as! String + let value = __pigeon_list[1] is Int64 ? __pigeon_list[1] as! Int64 : Int64(__pigeon_list[1] as! Int32) return AmountDTO( currency: currency, @@ -215,9 +241,10 @@ struct AnalyticsOptionsDTO { var enabled: Bool var version: String - static func fromList(_ list: [Any?]) -> AnalyticsOptionsDTO? { - let enabled = list[0] as! Bool - let version = list[1] as! String + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> AnalyticsOptionsDTO? { + let enabled = __pigeon_list[0] as! Bool + let version = __pigeon_list[1] as! String return AnalyticsOptionsDTO( enabled: enabled, @@ -252,38 +279,24 @@ struct DropInConfigurationDTO { var paymentMethodNames: [String?: String?]? var isPartialPaymentSupported: Bool - static func fromList(_ list: [Any?]) -> DropInConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let countryCode = list[2] as! String - var amount: AmountDTO? - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[4]) - var cardConfigurationDTO: CardConfigurationDTO? - if let cardConfigurationDTOList: [Any?] = nilOrValue(list[5]) { - cardConfigurationDTO = CardConfigurationDTO.fromList(cardConfigurationDTOList) - } - var applePayConfigurationDTO: ApplePayConfigurationDTO? - if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[6]) { - applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) - } - var googlePayConfigurationDTO: GooglePayConfigurationDTO? - if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { - googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) - } - var cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? - if let cashAppPayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { - cashAppPayConfigurationDTO = CashAppPayConfigurationDTO.fromList(cashAppPayConfigurationDTOList) - } - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[9] as! [Any?])! - let showPreselectedStoredPaymentMethod = list[10] as! Bool - let skipListWhenSinglePaymentMethod = list[11] as! Bool - let isRemoveStoredPaymentMethodEnabled = list[12] as! Bool - let preselectedPaymentMethodTitle: String? = nilOrValue(list[13]) - let paymentMethodNames: [String?: String?]? = nilOrValue(list[14]) - let isPartialPaymentSupported = list[15] as! Bool + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> DropInConfigurationDTO? { + let environment = __pigeon_list[0] as! Environment + let clientKey = __pigeon_list[1] as! String + let countryCode = __pigeon_list[2] as! String + let amount: AmountDTO? = nilOrValue(__pigeon_list[3]) + let shopperLocale: String? = nilOrValue(__pigeon_list[4]) + let cardConfigurationDTO: CardConfigurationDTO? = nilOrValue(__pigeon_list[5]) + let applePayConfigurationDTO: ApplePayConfigurationDTO? = nilOrValue(__pigeon_list[6]) + let googlePayConfigurationDTO: GooglePayConfigurationDTO? = nilOrValue(__pigeon_list[7]) + let cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? = nilOrValue(__pigeon_list[8]) + let analyticsOptionsDTO = __pigeon_list[9] as! AnalyticsOptionsDTO + let showPreselectedStoredPaymentMethod = __pigeon_list[10] as! Bool + let skipListWhenSinglePaymentMethod = __pigeon_list[11] as! Bool + let isRemoveStoredPaymentMethodEnabled = __pigeon_list[12] as! Bool + let preselectedPaymentMethodTitle: String? = nilOrValue(__pigeon_list[13]) + let paymentMethodNames: [String?: String?]? = nilOrValue(__pigeon_list[14]) + let isPartialPaymentSupported = __pigeon_list[15] as! Bool return DropInConfigurationDTO( environment: environment, @@ -307,16 +320,16 @@ struct DropInConfigurationDTO { func toList() -> [Any?] { [ - environment.rawValue, + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - cardConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList(), - googlePayConfigurationDTO?.toList(), - cashAppPayConfigurationDTO?.toList(), - analyticsOptionsDTO.toList(), + cardConfigurationDTO, + applePayConfigurationDTO, + googlePayConfigurationDTO, + cashAppPayConfigurationDTO, + analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, @@ -338,15 +351,16 @@ struct CardConfigurationDTO { var socialSecurityNumberFieldVisibility: FieldVisibility var supportedCardTypes: [String?] - static func fromList(_ list: [Any?]) -> CardConfigurationDTO? { - let holderNameRequired = list[0] as! Bool - let addressMode = AddressMode(rawValue: list[1] as! Int)! - let showStorePaymentField = list[2] as! Bool - let showCvcForStoredCard = list[3] as! Bool - let showCvc = list[4] as! Bool - let kcpFieldVisibility = FieldVisibility(rawValue: list[5] as! Int)! - let socialSecurityNumberFieldVisibility = FieldVisibility(rawValue: list[6] as! Int)! - let supportedCardTypes = list[7] as! [String?] + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> CardConfigurationDTO? { + let holderNameRequired = __pigeon_list[0] as! Bool + let addressMode = __pigeon_list[1] as! AddressMode + let showStorePaymentField = __pigeon_list[2] as! Bool + let showCvcForStoredCard = __pigeon_list[3] as! Bool + let showCvc = __pigeon_list[4] as! Bool + let kcpFieldVisibility = __pigeon_list[5] as! FieldVisibility + let socialSecurityNumberFieldVisibility = __pigeon_list[6] as! FieldVisibility + let supportedCardTypes = __pigeon_list[7] as! [String?] return CardConfigurationDTO( holderNameRequired: holderNameRequired, @@ -363,12 +377,12 @@ struct CardConfigurationDTO { func toList() -> [Any?] { [ holderNameRequired, - addressMode.rawValue, + addressMode, showStorePaymentField, showCvcForStoredCard, showCvc, - kcpFieldVisibility.rawValue, - socialSecurityNumberFieldVisibility.rawValue, + kcpFieldVisibility, + socialSecurityNumberFieldVisibility, supportedCardTypes ] } @@ -391,35 +405,22 @@ struct ApplePayConfigurationDTO { var supportedCountries: [String?]? var merchantCapability: ApplePayMerchantCapability? - static func fromList(_ list: [Any?]) -> ApplePayConfigurationDTO? { - let merchantId = list[0] as! String - let merchantName = list[1] as! String - let allowOnboarding: Bool? = nilOrValue(list[2]) - let summaryItems: [ApplePaySummaryItemDTO?]? = nilOrValue(list[3]) - let requiredBillingContactFields: [String?]? = nilOrValue(list[4]) - var billingContact: ApplePayContactDTO? - if let billingContactList: [Any?] = nilOrValue(list[5]) { - billingContact = ApplePayContactDTO.fromList(billingContactList) - } - let requiredShippingContactFields: [String?]? = nilOrValue(list[6]) - var shippingContact: ApplePayContactDTO? - if let shippingContactList: [Any?] = nilOrValue(list[7]) { - shippingContact = ApplePayContactDTO.fromList(shippingContactList) - } - var applePayShippingType: ApplePayShippingType? - let applePayShippingTypeEnumVal: Int? = nilOrValue(list[8]) - if let applePayShippingTypeRawValue = applePayShippingTypeEnumVal { - applePayShippingType = ApplePayShippingType(rawValue: applePayShippingTypeRawValue)! - } - let allowShippingContactEditing: Bool? = nilOrValue(list[9]) - let shippingMethods: [ApplePayShippingMethodDTO?]? = nilOrValue(list[10]) - let applicationData: String? = nilOrValue(list[11]) - let supportedCountries: [String?]? = nilOrValue(list[12]) - var merchantCapability: ApplePayMerchantCapability? - let merchantCapabilityEnumVal: Int? = nilOrValue(list[13]) - if let merchantCapabilityRawValue = merchantCapabilityEnumVal { - merchantCapability = ApplePayMerchantCapability(rawValue: merchantCapabilityRawValue)! - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ApplePayConfigurationDTO? { + let merchantId = __pigeon_list[0] as! String + let merchantName = __pigeon_list[1] as! String + let allowOnboarding: Bool? = nilOrValue(__pigeon_list[2]) + let summaryItems: [ApplePaySummaryItemDTO?]? = nilOrValue(__pigeon_list[3]) + let requiredBillingContactFields: [String?]? = nilOrValue(__pigeon_list[4]) + let billingContact: ApplePayContactDTO? = nilOrValue(__pigeon_list[5]) + let requiredShippingContactFields: [String?]? = nilOrValue(__pigeon_list[6]) + let shippingContact: ApplePayContactDTO? = nilOrValue(__pigeon_list[7]) + let applePayShippingType: ApplePayShippingType? = nilOrValue(__pigeon_list[8]) + let allowShippingContactEditing: Bool? = nilOrValue(__pigeon_list[9]) + let shippingMethods: [ApplePayShippingMethodDTO?]? = nilOrValue(__pigeon_list[10]) + let applicationData: String? = nilOrValue(__pigeon_list[11]) + let supportedCountries: [String?]? = nilOrValue(__pigeon_list[12]) + let merchantCapability: ApplePayMerchantCapability? = nilOrValue(__pigeon_list[13]) return ApplePayConfigurationDTO( merchantId: merchantId, @@ -446,15 +447,15 @@ struct ApplePayConfigurationDTO { allowOnboarding, summaryItems, requiredBillingContactFields, - billingContact?.toList(), + billingContact, requiredShippingContactFields, - shippingContact?.toList(), - applePayShippingType?.rawValue, + shippingContact, + applePayShippingType, allowShippingContactEditing, shippingMethods, applicationData, supportedCountries, - merchantCapability?.rawValue + merchantCapability ] } } @@ -476,21 +477,22 @@ struct ApplePayContactDTO { var country: String? var countryCode: String? - static func fromList(_ list: [Any?]) -> ApplePayContactDTO? { - let phoneNumber: String? = nilOrValue(list[0]) - let emailAddress: String? = nilOrValue(list[1]) - let givenName: String? = nilOrValue(list[2]) - let familyName: String? = nilOrValue(list[3]) - let phoneticGivenName: String? = nilOrValue(list[4]) - let phoneticFamilyName: String? = nilOrValue(list[5]) - let addressLines: [String?]? = nilOrValue(list[6]) - let subLocality: String? = nilOrValue(list[7]) - let city: String? = nilOrValue(list[8]) - let postalCode: String? = nilOrValue(list[9]) - let subAdministrativeArea: String? = nilOrValue(list[10]) - let administrativeArea: String? = nilOrValue(list[11]) - let country: String? = nilOrValue(list[12]) - let countryCode: String? = nilOrValue(list[13]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ApplePayContactDTO? { + let phoneNumber: String? = nilOrValue(__pigeon_list[0]) + let emailAddress: String? = nilOrValue(__pigeon_list[1]) + let givenName: String? = nilOrValue(__pigeon_list[2]) + let familyName: String? = nilOrValue(__pigeon_list[3]) + let phoneticGivenName: String? = nilOrValue(__pigeon_list[4]) + let phoneticFamilyName: String? = nilOrValue(__pigeon_list[5]) + let addressLines: [String?]? = nilOrValue(__pigeon_list[6]) + let subLocality: String? = nilOrValue(__pigeon_list[7]) + let city: String? = nilOrValue(__pigeon_list[8]) + let postalCode: String? = nilOrValue(__pigeon_list[9]) + let subAdministrativeArea: String? = nilOrValue(__pigeon_list[10]) + let administrativeArea: String? = nilOrValue(__pigeon_list[11]) + let country: String? = nilOrValue(__pigeon_list[12]) + let countryCode: String? = nilOrValue(__pigeon_list[13]) return ApplePayContactDTO( phoneNumber: phoneNumber, @@ -539,13 +541,14 @@ struct ApplePayShippingMethodDTO { var startDate: String? var endDate: String? - static func fromList(_ list: [Any?]) -> ApplePayShippingMethodDTO? { - let label = list[0] as! String - let detail = list[1] as! String - let amount = AmountDTO.fromList(list[2] as! [Any?])! - let identifier = list[3] as! String - let startDate: String? = nilOrValue(list[4]) - let endDate: String? = nilOrValue(list[5]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ApplePayShippingMethodDTO? { + let label = __pigeon_list[0] as! String + let detail = __pigeon_list[1] as! String + let amount = __pigeon_list[2] as! AmountDTO + let identifier = __pigeon_list[3] as! String + let startDate: String? = nilOrValue(__pigeon_list[4]) + let endDate: String? = nilOrValue(__pigeon_list[5]) return ApplePayShippingMethodDTO( label: label, @@ -561,7 +564,7 @@ struct ApplePayShippingMethodDTO { [ label, detail, - amount.toList(), + amount, identifier, startDate, endDate @@ -575,10 +578,11 @@ struct ApplePaySummaryItemDTO { var amount: AmountDTO var type: ApplePaySummaryItemType - static func fromList(_ list: [Any?]) -> ApplePaySummaryItemDTO? { - let label = list[0] as! String - let amount = AmountDTO.fromList(list[1] as! [Any?])! - let type = ApplePaySummaryItemType(rawValue: list[2] as! Int)! + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ApplePaySummaryItemDTO? { + let label = __pigeon_list[0] as! String + let amount = __pigeon_list[1] as! AmountDTO + let type = __pigeon_list[2] as! ApplePaySummaryItemType return ApplePaySummaryItemDTO( label: label, @@ -590,8 +594,8 @@ struct ApplePaySummaryItemDTO { func toList() -> [Any?] { [ label, - amount.toList(), - type.rawValue + amount, + type ] } } @@ -614,35 +618,23 @@ struct GooglePayConfigurationDTO { var billingAddressRequired: Bool? var billingAddressParametersDTO: BillingAddressParametersDTO? - static func fromList(_ list: [Any?]) -> GooglePayConfigurationDTO? { - let googlePayEnvironment = GooglePayEnvironment(rawValue: list[0] as! Int)! - let merchantAccount: String? = nilOrValue(list[1]) - var merchantInfoDTO: MerchantInfoDTO? - if let merchantInfoDTOList: [Any?] = nilOrValue(list[2]) { - merchantInfoDTO = MerchantInfoDTO.fromList(merchantInfoDTOList) - } - var totalPriceStatus: TotalPriceStatus? - let totalPriceStatusEnumVal: Int? = nilOrValue(list[3]) - if let totalPriceStatusRawValue = totalPriceStatusEnumVal { - totalPriceStatus = TotalPriceStatus(rawValue: totalPriceStatusRawValue)! - } - let allowedCardNetworks: [String?]? = nilOrValue(list[4]) - let allowedAuthMethods: [String?]? = nilOrValue(list[5]) - let allowPrepaidCards: Bool? = nilOrValue(list[6]) - let allowCreditCards: Bool? = nilOrValue(list[7]) - let assuranceDetailsRequired: Bool? = nilOrValue(list[8]) - let emailRequired: Bool? = nilOrValue(list[9]) - let existingPaymentMethodRequired: Bool? = nilOrValue(list[10]) - let shippingAddressRequired: Bool? = nilOrValue(list[11]) - var shippingAddressParametersDTO: ShippingAddressParametersDTO? - if let shippingAddressParametersDTOList: [Any?] = nilOrValue(list[12]) { - shippingAddressParametersDTO = ShippingAddressParametersDTO.fromList(shippingAddressParametersDTOList) - } - let billingAddressRequired: Bool? = nilOrValue(list[13]) - var billingAddressParametersDTO: BillingAddressParametersDTO? - if let billingAddressParametersDTOList: [Any?] = nilOrValue(list[14]) { - billingAddressParametersDTO = BillingAddressParametersDTO.fromList(billingAddressParametersDTOList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> GooglePayConfigurationDTO? { + let googlePayEnvironment = __pigeon_list[0] as! GooglePayEnvironment + let merchantAccount: String? = nilOrValue(__pigeon_list[1]) + let merchantInfoDTO: MerchantInfoDTO? = nilOrValue(__pigeon_list[2]) + let totalPriceStatus: TotalPriceStatus? = nilOrValue(__pigeon_list[3]) + let allowedCardNetworks: [String?]? = nilOrValue(__pigeon_list[4]) + let allowedAuthMethods: [String?]? = nilOrValue(__pigeon_list[5]) + let allowPrepaidCards: Bool? = nilOrValue(__pigeon_list[6]) + let allowCreditCards: Bool? = nilOrValue(__pigeon_list[7]) + let assuranceDetailsRequired: Bool? = nilOrValue(__pigeon_list[8]) + let emailRequired: Bool? = nilOrValue(__pigeon_list[9]) + let existingPaymentMethodRequired: Bool? = nilOrValue(__pigeon_list[10]) + let shippingAddressRequired: Bool? = nilOrValue(__pigeon_list[11]) + let shippingAddressParametersDTO: ShippingAddressParametersDTO? = nilOrValue(__pigeon_list[12]) + let billingAddressRequired: Bool? = nilOrValue(__pigeon_list[13]) + let billingAddressParametersDTO: BillingAddressParametersDTO? = nilOrValue(__pigeon_list[14]) return GooglePayConfigurationDTO( googlePayEnvironment: googlePayEnvironment, @@ -665,10 +657,10 @@ struct GooglePayConfigurationDTO { func toList() -> [Any?] { [ - googlePayEnvironment.rawValue, + googlePayEnvironment, merchantAccount, - merchantInfoDTO?.toList(), - totalPriceStatus?.rawValue, + merchantInfoDTO, + totalPriceStatus, allowedCardNetworks, allowedAuthMethods, allowPrepaidCards, @@ -677,9 +669,9 @@ struct GooglePayConfigurationDTO { emailRequired, existingPaymentMethodRequired, shippingAddressRequired, - shippingAddressParametersDTO?.toList(), + shippingAddressParametersDTO, billingAddressRequired, - billingAddressParametersDTO?.toList() + billingAddressParametersDTO ] } } @@ -689,9 +681,10 @@ struct MerchantInfoDTO { var merchantName: String? var merchantId: String? - static func fromList(_ list: [Any?]) -> MerchantInfoDTO? { - let merchantName: String? = nilOrValue(list[0]) - let merchantId: String? = nilOrValue(list[1]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> MerchantInfoDTO? { + let merchantName: String? = nilOrValue(__pigeon_list[0]) + let merchantId: String? = nilOrValue(__pigeon_list[1]) return MerchantInfoDTO( merchantName: merchantName, @@ -712,9 +705,10 @@ struct ShippingAddressParametersDTO { var allowedCountryCodes: [String?]? var isPhoneNumberRequired: Bool? - static func fromList(_ list: [Any?]) -> ShippingAddressParametersDTO? { - let allowedCountryCodes: [String?]? = nilOrValue(list[0]) - let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ShippingAddressParametersDTO? { + let allowedCountryCodes: [String?]? = nilOrValue(__pigeon_list[0]) + let isPhoneNumberRequired: Bool? = nilOrValue(__pigeon_list[1]) return ShippingAddressParametersDTO( allowedCountryCodes: allowedCountryCodes, @@ -735,9 +729,10 @@ struct BillingAddressParametersDTO { var format: String? var isPhoneNumberRequired: Bool? - static func fromList(_ list: [Any?]) -> BillingAddressParametersDTO? { - let format: String? = nilOrValue(list[0]) - let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> BillingAddressParametersDTO? { + let format: String? = nilOrValue(__pigeon_list[0]) + let isPhoneNumberRequired: Bool? = nilOrValue(__pigeon_list[1]) return BillingAddressParametersDTO( format: format, @@ -758,9 +753,10 @@ struct CashAppPayConfigurationDTO { var cashAppPayEnvironment: CashAppPayEnvironment var returnUrl: String - static func fromList(_ list: [Any?]) -> CashAppPayConfigurationDTO? { - let cashAppPayEnvironment = CashAppPayEnvironment(rawValue: list[0] as! Int)! - let returnUrl = list[1] as! String + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> CashAppPayConfigurationDTO? { + let cashAppPayEnvironment = __pigeon_list[0] as! CashAppPayEnvironment + let returnUrl = __pigeon_list[1] as! String return CashAppPayConfigurationDTO( cashAppPayEnvironment: cashAppPayEnvironment, @@ -770,7 +766,7 @@ struct CashAppPayConfigurationDTO { func toList() -> [Any?] { [ - cashAppPayEnvironment.rawValue, + cashAppPayEnvironment, returnUrl ] } @@ -782,13 +778,11 @@ struct PaymentResultDTO { var reason: String? var result: PaymentResultModelDTO? - static func fromList(_ list: [Any?]) -> PaymentResultDTO? { - let type = PaymentResultEnum(rawValue: list[0] as! Int)! - let reason: String? = nilOrValue(list[1]) - var result: PaymentResultModelDTO? - if let resultList: [Any?] = nilOrValue(list[2]) { - result = PaymentResultModelDTO.fromList(resultList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> PaymentResultDTO? { + let type = __pigeon_list[0] as! PaymentResultEnum + let reason: String? = nilOrValue(__pigeon_list[1]) + let result: PaymentResultModelDTO? = nilOrValue(__pigeon_list[2]) return PaymentResultDTO( type: type, @@ -799,9 +793,9 @@ struct PaymentResultDTO { func toList() -> [Any?] { [ - type.rawValue, + type, reason, - result?.toList() + result ] } } @@ -814,15 +808,13 @@ struct PaymentResultModelDTO { var resultCode: String? var order: OrderResponseDTO? - static func fromList(_ list: [Any?]) -> PaymentResultModelDTO? { - let sessionId: String? = nilOrValue(list[0]) - let sessionData: String? = nilOrValue(list[1]) - let sessionResult: String? = nilOrValue(list[2]) - let resultCode: String? = nilOrValue(list[3]) - var order: OrderResponseDTO? - if let orderList: [Any?] = nilOrValue(list[4]) { - order = OrderResponseDTO.fromList(orderList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> PaymentResultModelDTO? { + let sessionId: String? = nilOrValue(__pigeon_list[0]) + let sessionData: String? = nilOrValue(__pigeon_list[1]) + let sessionResult: String? = nilOrValue(__pigeon_list[2]) + let resultCode: String? = nilOrValue(__pigeon_list[3]) + let order: OrderResponseDTO? = nilOrValue(__pigeon_list[4]) return PaymentResultModelDTO( sessionId: sessionId, @@ -839,7 +831,7 @@ struct PaymentResultModelDTO { sessionData, sessionResult, resultCode, - order?.toList() + order ] } } @@ -851,17 +843,12 @@ struct OrderResponseDTO { var amount: AmountDTO? var remainingAmount: AmountDTO? - static func fromList(_ list: [Any?]) -> OrderResponseDTO? { - let pspReference = list[0] as! String - let orderData = list[1] as! String - var amount: AmountDTO? - if let amountList: [Any?] = nilOrValue(list[2]) { - amount = AmountDTO.fromList(amountList) - } - var remainingAmount: AmountDTO? - if let remainingAmountList: [Any?] = nilOrValue(list[3]) { - remainingAmount = AmountDTO.fromList(remainingAmountList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> OrderResponseDTO? { + let pspReference = __pigeon_list[0] as! String + let orderData = __pigeon_list[1] as! String + let amount: AmountDTO? = nilOrValue(__pigeon_list[2]) + let remainingAmount: AmountDTO? = nilOrValue(__pigeon_list[3]) return OrderResponseDTO( pspReference: pspReference, @@ -875,8 +862,8 @@ struct OrderResponseDTO { [ pspReference, orderData, - amount?.toList(), - remainingAmount?.toList() + amount, + remainingAmount ] } } @@ -887,13 +874,11 @@ struct PlatformCommunicationModel { var data: String? var paymentResult: PaymentResultDTO? - static func fromList(_ list: [Any?]) -> PlatformCommunicationModel? { - let type = PlatformCommunicationType(rawValue: list[0] as! Int)! - let data: String? = nilOrValue(list[1]) - var paymentResult: PaymentResultDTO? - if let paymentResultList: [Any?] = nilOrValue(list[2]) { - paymentResult = PaymentResultDTO.fromList(paymentResultList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> PlatformCommunicationModel? { + let type = __pigeon_list[0] as! PlatformCommunicationType + let data: String? = nilOrValue(__pigeon_list[1]) + let paymentResult: PaymentResultDTO? = nilOrValue(__pigeon_list[2]) return PlatformCommunicationModel( type: type, @@ -904,9 +889,9 @@ struct PlatformCommunicationModel { func toList() -> [Any?] { [ - type.rawValue, + type, data, - paymentResult?.toList() + paymentResult ] } } @@ -918,14 +903,12 @@ struct ComponentCommunicationModel { var data: Any? var paymentResult: PaymentResultDTO? - static func fromList(_ list: [Any?]) -> ComponentCommunicationModel? { - let type = ComponentCommunicationType(rawValue: list[0] as! Int)! - let componentId = list[1] as! String - let data: Any? = list[2] - var paymentResult: PaymentResultDTO? - if let paymentResultList: [Any?] = nilOrValue(list[3]) { - paymentResult = PaymentResultDTO.fromList(paymentResultList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ComponentCommunicationModel? { + let type = __pigeon_list[0] as! ComponentCommunicationType + let componentId = __pigeon_list[1] as! String + let data: Any? = __pigeon_list[2] + let paymentResult: PaymentResultDTO? = nilOrValue(__pigeon_list[3]) return ComponentCommunicationModel( type: type, @@ -937,10 +920,10 @@ struct ComponentCommunicationModel { func toList() -> [Any?] { [ - type.rawValue, + type, componentId, data, - paymentResult?.toList() + paymentResult ] } } @@ -952,14 +935,12 @@ struct PaymentEventDTO { var data: [String?: Any?]? var error: ErrorDTO? - static func fromList(_ list: [Any?]) -> PaymentEventDTO? { - let paymentEventType = PaymentEventType(rawValue: list[0] as! Int)! - let result: String? = nilOrValue(list[1]) - let data: [String?: Any?]? = nilOrValue(list[2]) - var error: ErrorDTO? - if let errorList: [Any?] = nilOrValue(list[3]) { - error = ErrorDTO.fromList(errorList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> PaymentEventDTO? { + let paymentEventType = __pigeon_list[0] as! PaymentEventType + let result: String? = nilOrValue(__pigeon_list[1]) + let data: [String?: Any?]? = nilOrValue(__pigeon_list[2]) + let error: ErrorDTO? = nilOrValue(__pigeon_list[3]) return PaymentEventDTO( paymentEventType: paymentEventType, @@ -971,10 +952,10 @@ struct PaymentEventDTO { func toList() -> [Any?] { [ - paymentEventType.rawValue, + paymentEventType, result, data, - error?.toList() + error ] } } @@ -985,10 +966,11 @@ struct ErrorDTO { var reason: String? var dismissDropIn: Bool? - static func fromList(_ list: [Any?]) -> ErrorDTO? { - let errorMessage: String? = nilOrValue(list[0]) - let reason: String? = nilOrValue(list[1]) - let dismissDropIn: Bool? = nilOrValue(list[2]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ErrorDTO? { + let errorMessage: String? = nilOrValue(__pigeon_list[0]) + let reason: String? = nilOrValue(__pigeon_list[1]) + let dismissDropIn: Bool? = nilOrValue(__pigeon_list[2]) return ErrorDTO( errorMessage: errorMessage, @@ -1011,9 +993,10 @@ struct DeletedStoredPaymentMethodResultDTO { var storedPaymentMethodId: String var isSuccessfullyRemoved: Bool - static func fromList(_ list: [Any?]) -> DeletedStoredPaymentMethodResultDTO? { - let storedPaymentMethodId = list[0] as! String - let isSuccessfullyRemoved = list[1] as! Bool + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> DeletedStoredPaymentMethodResultDTO? { + let storedPaymentMethodId = __pigeon_list[0] as! String + let isSuccessfullyRemoved = __pigeon_list[1] as! Bool return DeletedStoredPaymentMethodResultDTO( storedPaymentMethodId: storedPaymentMethodId, @@ -1039,17 +1022,15 @@ struct CardComponentConfigurationDTO { var cardConfiguration: CardConfigurationDTO var analyticsOptionsDTO: AnalyticsOptionsDTO - static func fromList(_ list: [Any?]) -> CardComponentConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let countryCode = list[2] as! String - var amount: AmountDTO? - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[4]) - let cardConfiguration = CardConfigurationDTO.fromList(list[5] as! [Any?])! - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> CardComponentConfigurationDTO? { + let environment = __pigeon_list[0] as! Environment + let clientKey = __pigeon_list[1] as! String + let countryCode = __pigeon_list[2] as! String + let amount: AmountDTO? = nilOrValue(__pigeon_list[3]) + let shopperLocale: String? = nilOrValue(__pigeon_list[4]) + let cardConfiguration = __pigeon_list[5] as! CardConfigurationDTO + let analyticsOptionsDTO = __pigeon_list[6] as! AnalyticsOptionsDTO return CardComponentConfigurationDTO( environment: environment, @@ -1064,13 +1045,13 @@ struct CardComponentConfigurationDTO { func toList() -> [Any?] { [ - environment.rawValue, + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - cardConfiguration.toList(), - analyticsOptionsDTO.toList() + cardConfiguration, + analyticsOptionsDTO ] } } @@ -1087,25 +1068,17 @@ struct InstantPaymentConfigurationDTO { var googlePayConfigurationDTO: GooglePayConfigurationDTO? var applePayConfigurationDTO: ApplePayConfigurationDTO? - static func fromList(_ list: [Any?]) -> InstantPaymentConfigurationDTO? { - let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! - let environment = Environment(rawValue: list[1] as! Int)! - let clientKey = list[2] as! String - let countryCode = list[3] as! String - var amount: AmountDTO? - if let amountList: [Any?] = nilOrValue(list[4]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[5]) - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! - var googlePayConfigurationDTO: GooglePayConfigurationDTO? - if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { - googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) - } - var applePayConfigurationDTO: ApplePayConfigurationDTO? - if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { - applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> InstantPaymentConfigurationDTO? { + let instantPaymentType = __pigeon_list[0] as! InstantPaymentType + let environment = __pigeon_list[1] as! Environment + let clientKey = __pigeon_list[2] as! String + let countryCode = __pigeon_list[3] as! String + let amount: AmountDTO? = nilOrValue(__pigeon_list[4]) + let shopperLocale: String? = nilOrValue(__pigeon_list[5]) + let analyticsOptionsDTO = __pigeon_list[6] as! AnalyticsOptionsDTO + let googlePayConfigurationDTO: GooglePayConfigurationDTO? = nilOrValue(__pigeon_list[7]) + let applePayConfigurationDTO: ApplePayConfigurationDTO? = nilOrValue(__pigeon_list[8]) return InstantPaymentConfigurationDTO( instantPaymentType: instantPaymentType, @@ -1122,15 +1095,15 @@ struct InstantPaymentConfigurationDTO { func toList() -> [Any?] { [ - instantPaymentType.rawValue, - environment.rawValue, + instantPaymentType, + environment, clientKey, countryCode, - amount?.toList(), + amount, shopperLocale, - analyticsOptionsDTO.toList(), - googlePayConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList() + analyticsOptionsDTO, + googlePayConfigurationDTO, + applePayConfigurationDTO ] } } @@ -1141,10 +1114,11 @@ struct InstantPaymentSetupResultDTO { var isSupported: Bool var resultData: Any? - static func fromList(_ list: [Any?]) -> InstantPaymentSetupResultDTO? { - let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! - let isSupported = list[1] as! Bool - let resultData: Any? = list[2] + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> InstantPaymentSetupResultDTO? { + let instantPaymentType = __pigeon_list[0] as! InstantPaymentType + let isSupported = __pigeon_list[1] as! Bool + let resultData: Any? = __pigeon_list[2] return InstantPaymentSetupResultDTO( instantPaymentType: instantPaymentType, @@ -1155,7 +1129,7 @@ struct InstantPaymentSetupResultDTO { func toList() -> [Any?] { [ - instantPaymentType.rawValue, + instantPaymentType, isSupported, resultData ] @@ -1169,11 +1143,12 @@ struct UnencryptedCardDTO { var expiryYear: String? var cvc: String? - static func fromList(_ list: [Any?]) -> UnencryptedCardDTO? { - let cardNumber: String? = nilOrValue(list[0]) - let expiryMonth: String? = nilOrValue(list[1]) - let expiryYear: String? = nilOrValue(list[2]) - let cvc: String? = nilOrValue(list[3]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> UnencryptedCardDTO? { + let cardNumber: String? = nilOrValue(__pigeon_list[0]) + let expiryMonth: String? = nilOrValue(__pigeon_list[1]) + let expiryYear: String? = nilOrValue(__pigeon_list[2]) + let cvc: String? = nilOrValue(__pigeon_list[3]) return UnencryptedCardDTO( cardNumber: cardNumber, @@ -1200,11 +1175,12 @@ struct EncryptedCardDTO { var encryptedExpiryYear: String? var encryptedSecurityCode: String? - static func fromList(_ list: [Any?]) -> EncryptedCardDTO? { - let encryptedCardNumber: String? = nilOrValue(list[0]) - let encryptedExpiryMonth: String? = nilOrValue(list[1]) - let encryptedExpiryYear: String? = nilOrValue(list[2]) - let encryptedSecurityCode: String? = nilOrValue(list[3]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> EncryptedCardDTO? { + let encryptedCardNumber: String? = nilOrValue(__pigeon_list[0]) + let encryptedExpiryMonth: String? = nilOrValue(__pigeon_list[1]) + let encryptedExpiryYear: String? = nilOrValue(__pigeon_list[2]) + let encryptedSecurityCode: String? = nilOrValue(__pigeon_list[3]) return EncryptedCardDTO( encryptedCardNumber: encryptedCardNumber, @@ -1232,15 +1208,13 @@ struct ActionComponentConfigurationDTO { var amount: AmountDTO? var analyticsOptionsDTO: AnalyticsOptionsDTO - static func fromList(_ list: [Any?]) -> ActionComponentConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let shopperLocale: String? = nilOrValue(list[2]) - var amount: AmountDTO? - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[4] as! [Any?])! + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> ActionComponentConfigurationDTO? { + let environment = __pigeon_list[0] as! Environment + let clientKey = __pigeon_list[1] as! String + let shopperLocale: String? = nilOrValue(__pigeon_list[2]) + let amount: AmountDTO? = nilOrValue(__pigeon_list[3]) + let analyticsOptionsDTO = __pigeon_list[4] as! AnalyticsOptionsDTO return ActionComponentConfigurationDTO( environment: environment, @@ -1253,11 +1227,11 @@ struct ActionComponentConfigurationDTO { func toList() -> [Any?] { [ - environment.rawValue, + environment, clientKey, shopperLocale, - amount?.toList(), - analyticsOptionsDTO.toList() + amount, + analyticsOptionsDTO ] } } @@ -1267,9 +1241,10 @@ struct OrderCancelResultDTO { var orderCancelResponseBody: [String?: Any?] var updatedPaymentMethodsResponseBody: [String?: Any?]? - static func fromList(_ list: [Any?]) -> OrderCancelResultDTO? { - let orderCancelResponseBody = list[0] as! [String?: Any?] - let updatedPaymentMethodsResponseBody: [String?: Any?]? = nilOrValue(list[1]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> OrderCancelResultDTO? { + let orderCancelResponseBody = __pigeon_list[0] as! [String?: Any?] + let updatedPaymentMethodsResponseBody: [String?: Any?]? = nilOrValue(__pigeon_list[1]) return OrderCancelResultDTO( orderCancelResponseBody: orderCancelResponseBody, @@ -1285,180 +1260,360 @@ struct OrderCancelResultDTO { } } -private class CheckoutPlatformInterfaceCodecReader: FlutterStandardReader { +private class PlatformApiPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) + return SessionDTO.fromList(self.readValue() as! [Any?]) case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) + return AmountDTO.fromList(self.readValue() as! [Any?]) case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) + return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) + return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) + return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) case 136: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) case 137: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) + return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) case 138: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) + return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) case 139: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) + return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) case 140: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) + return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) case 141: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) + return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) case 142: - return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) + return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) case 143: - return ErrorDTO.fromList(self.readValue() as! [Any?]) + return PaymentResultDTO.fromList(self.readValue() as! [Any?]) case 144: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) case 145: - return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) + return OrderResponseDTO.fromList(self.readValue() as! [Any?]) case 146: - return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) + return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) case 147: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) + return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) case 148: - return OrderCancelResultDTO.fromList(self.readValue() as! [Any?]) + return PaymentEventDTO.fromList(self.readValue() as! [Any?]) case 149: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) + return ErrorDTO.fromList(self.readValue() as! [Any?]) case 150: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) + return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) case 151: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) + return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) case 152: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) + return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) case 153: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) + return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) case 154: - return SessionDTO.fromList(self.readValue() as! [Any?]) + return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) case 155: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) case 156: - return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) + return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 157: + return OrderCancelResultDTO.fromList(self.readValue() as! [Any?]) + case 158: + var enumResult: Environment? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = Environment(rawValue: enumResultAsInt) + } + return enumResult + case 159: + var enumResult: AddressMode? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = AddressMode(rawValue: enumResultAsInt) + } + return enumResult + case 160: + var enumResult: CardAuthMethod? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = CardAuthMethod(rawValue: enumResultAsInt) + } + return enumResult + case 161: + var enumResult: TotalPriceStatus? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = TotalPriceStatus(rawValue: enumResultAsInt) + } + return enumResult + case 162: + var enumResult: GooglePayEnvironment? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = GooglePayEnvironment(rawValue: enumResultAsInt) + } + return enumResult + case 163: + var enumResult: CashAppPayEnvironment? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = CashAppPayEnvironment(rawValue: enumResultAsInt) + } + return enumResult + case 164: + var enumResult: PaymentResultEnum? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = PaymentResultEnum(rawValue: enumResultAsInt) + } + return enumResult + case 165: + var enumResult: PlatformCommunicationType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = PlatformCommunicationType(rawValue: enumResultAsInt) + } + return enumResult + case 166: + var enumResult: ComponentCommunicationType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = ComponentCommunicationType(rawValue: enumResultAsInt) + } + return enumResult + case 167: + var enumResult: PaymentEventType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = PaymentEventType(rawValue: enumResultAsInt) + } + return enumResult + case 168: + var enumResult: FieldVisibility? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = FieldVisibility(rawValue: enumResultAsInt) + } + return enumResult + case 169: + var enumResult: InstantPaymentType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = InstantPaymentType(rawValue: enumResultAsInt) + } + return enumResult + case 170: + var enumResult: ApplePayShippingType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = ApplePayShippingType(rawValue: enumResultAsInt) + } + return enumResult + case 171: + var enumResult: ApplePayMerchantCapability? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = ApplePayMerchantCapability(rawValue: enumResultAsInt) + } + return enumResult + case 172: + var enumResult: ApplePaySummaryItemType? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = ApplePaySummaryItemType(rawValue: enumResultAsInt) + } + return enumResult + case 173: + var enumResult: CardNumberValidationResultDTO? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = CardNumberValidationResultDTO(rawValue: enumResultAsInt) + } + return enumResult + case 174: + var enumResult: CardExpiryDateValidationResultDTO? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = CardExpiryDateValidationResultDTO(rawValue: enumResultAsInt) + } + return enumResult + case 175: + var enumResult: CardSecurityCodeValidationResultDTO? = nil + let enumResultAsInt: Int? = nilOrValue(self.readValue() as? Int) + if let enumResultAsInt { + enumResult = CardSecurityCodeValidationResultDTO(rawValue: enumResultAsInt) + } + return enumResult default: return super.readValue(ofType: type) } } } -private class CheckoutPlatformInterfaceCodecWriter: FlutterStandardWriter { +private class PlatformApiPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { - if let value = value as? ActionComponentConfigurationDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { + if let value = value as? SessionDTO { super.writeByte(129) super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { + } else if let value = value as? AmountDTO { super.writeByte(130) super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { + } else if let value = value as? AnalyticsOptionsDTO { super.writeByte(131) super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { + } else if let value = value as? DropInConfigurationDTO { super.writeByte(132) super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { + } else if let value = value as? CardConfigurationDTO { super.writeByte(133) super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { + } else if let value = value as? ApplePayConfigurationDTO { super.writeByte(134) super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { + } else if let value = value as? ApplePayContactDTO { super.writeByte(135) super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { + } else if let value = value as? ApplePayShippingMethodDTO { super.writeByte(136) super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { + } else if let value = value as? ApplePaySummaryItemDTO { super.writeByte(137) super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { + } else if let value = value as? GooglePayConfigurationDTO { super.writeByte(138) super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { + } else if let value = value as? MerchantInfoDTO { super.writeByte(139) super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { + } else if let value = value as? ShippingAddressParametersDTO { super.writeByte(140) super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { + } else if let value = value as? BillingAddressParametersDTO { super.writeByte(141) super.writeValue(value.toList()) - } else if let value = value as? EncryptedCardDTO { + } else if let value = value as? CashAppPayConfigurationDTO { super.writeByte(142) super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { + } else if let value = value as? PaymentResultDTO { super.writeByte(143) super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { + } else if let value = value as? PaymentResultModelDTO { super.writeByte(144) super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentConfigurationDTO { + } else if let value = value as? OrderResponseDTO { super.writeByte(145) super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentSetupResultDTO { + } else if let value = value as? PlatformCommunicationModel { super.writeByte(146) super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { + } else if let value = value as? ComponentCommunicationModel { super.writeByte(147) super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResultDTO { + } else if let value = value as? PaymentEventDTO { super.writeByte(148) super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { + } else if let value = value as? ErrorDTO { super.writeByte(149) super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { + } else if let value = value as? DeletedStoredPaymentMethodResultDTO { super.writeByte(150) super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { + } else if let value = value as? CardComponentConfigurationDTO { super.writeByte(151) super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { + } else if let value = value as? InstantPaymentConfigurationDTO { super.writeByte(152) super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { + } else if let value = value as? InstantPaymentSetupResultDTO { super.writeByte(153) super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { + } else if let value = value as? UnencryptedCardDTO { super.writeByte(154) super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { + } else if let value = value as? EncryptedCardDTO { super.writeByte(155) super.writeValue(value.toList()) - } else if let value = value as? UnencryptedCardDTO { + } else if let value = value as? ActionComponentConfigurationDTO { super.writeByte(156) super.writeValue(value.toList()) + } else if let value = value as? OrderCancelResultDTO { + super.writeByte(157) + super.writeValue(value.toList()) + } else if let value = value as? Environment { + super.writeByte(158) + super.writeValue(value.rawValue) + } else if let value = value as? AddressMode { + super.writeByte(159) + super.writeValue(value.rawValue) + } else if let value = value as? CardAuthMethod { + super.writeByte(160) + super.writeValue(value.rawValue) + } else if let value = value as? TotalPriceStatus { + super.writeByte(161) + super.writeValue(value.rawValue) + } else if let value = value as? GooglePayEnvironment { + super.writeByte(162) + super.writeValue(value.rawValue) + } else if let value = value as? CashAppPayEnvironment { + super.writeByte(163) + super.writeValue(value.rawValue) + } else if let value = value as? PaymentResultEnum { + super.writeByte(164) + super.writeValue(value.rawValue) + } else if let value = value as? PlatformCommunicationType { + super.writeByte(165) + super.writeValue(value.rawValue) + } else if let value = value as? ComponentCommunicationType { + super.writeByte(166) + super.writeValue(value.rawValue) + } else if let value = value as? PaymentEventType { + super.writeByte(167) + super.writeValue(value.rawValue) + } else if let value = value as? FieldVisibility { + super.writeByte(168) + super.writeValue(value.rawValue) + } else if let value = value as? InstantPaymentType { + super.writeByte(169) + super.writeValue(value.rawValue) + } else if let value = value as? ApplePayShippingType { + super.writeByte(170) + super.writeValue(value.rawValue) + } else if let value = value as? ApplePayMerchantCapability { + super.writeByte(171) + super.writeValue(value.rawValue) + } else if let value = value as? ApplePaySummaryItemType { + super.writeByte(172) + super.writeValue(value.rawValue) + } else if let value = value as? CardNumberValidationResultDTO { + super.writeByte(173) + super.writeValue(value.rawValue) + } else if let value = value as? CardExpiryDateValidationResultDTO { + super.writeByte(174) + super.writeValue(value.rawValue) + } else if let value = value as? CardSecurityCodeValidationResultDTO { + super.writeByte(175) + super.writeValue(value.rawValue) } else { super.writeValue(value) } } } -private class CheckoutPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { +private class PlatformApiPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - CheckoutPlatformInterfaceCodecReader(data: data) + PlatformApiPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - CheckoutPlatformInterfaceCodecWriter(data: data) + PlatformApiPigeonCodecWriter(data: data) } } -class CheckoutPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = CheckoutPlatformInterfaceCodec(readerWriter: CheckoutPlatformInterfaceCodecReaderWriter()) +class PlatformApiPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = PlatformApiPigeonCodec(readerWriter: PlatformApiPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -1476,11 +1631,11 @@ protocol CheckoutPlatformInterface { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class CheckoutPlatformInterfaceSetup { - /// The codec used by CheckoutPlatformInterface. - static var codec: FlutterStandardMessageCodec { CheckoutPlatformInterfaceCodec.shared } + static var codec: FlutterStandardMessageCodec { PlatformApiPigeonCodec.shared } /// Sets up an instance of `CheckoutPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CheckoutPlatformInterface?) { - let getReturnUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CheckoutPlatformInterface?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let getReturnUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { getReturnUrlChannel.setMessageHandler { _, reply in api.getReturnUrl { result in @@ -1495,7 +1650,7 @@ class CheckoutPlatformInterfaceSetup { } else { getReturnUrlChannel.setMessageHandler(nil) } - let createSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession", binaryMessenger: binaryMessenger, codec: codec) + let createSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { createSessionChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1514,7 +1669,7 @@ class CheckoutPlatformInterfaceSetup { } else { createSessionChannel.setMessageHandler(nil) } - let clearSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", binaryMessenger: binaryMessenger, codec: codec) + let clearSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { clearSessionChannel.setMessageHandler { _, reply in do { @@ -1527,7 +1682,7 @@ class CheckoutPlatformInterfaceSetup { } else { clearSessionChannel.setMessageHandler(nil) } - let encryptCardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard", binaryMessenger: binaryMessenger, codec: codec) + let encryptCardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { encryptCardChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1545,7 +1700,7 @@ class CheckoutPlatformInterfaceSetup { } else { encryptCardChannel.setMessageHandler(nil) } - let encryptBinChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin", binaryMessenger: binaryMessenger, codec: codec) + let encryptBinChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { encryptBinChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1563,7 +1718,7 @@ class CheckoutPlatformInterfaceSetup { } else { encryptBinChannel.setMessageHandler(nil) } - let validateCardNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber", binaryMessenger: binaryMessenger, codec: codec) + let validateCardNumberChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { validateCardNumberChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1571,7 +1726,7 @@ class CheckoutPlatformInterfaceSetup { let enableLuhnCheckArg = args[1] as! Bool do { let result = try api.validateCardNumber(cardNumber: cardNumberArg, enableLuhnCheck: enableLuhnCheckArg) - reply(wrapResult(result.rawValue)) + reply(wrapResult(result)) } catch { reply(wrapError(error)) } @@ -1579,7 +1734,7 @@ class CheckoutPlatformInterfaceSetup { } else { validateCardNumberChannel.setMessageHandler(nil) } - let validateCardExpiryDateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate", binaryMessenger: binaryMessenger, codec: codec) + let validateCardExpiryDateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { validateCardExpiryDateChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1587,7 +1742,7 @@ class CheckoutPlatformInterfaceSetup { let expiryYearArg = args[1] as! String do { let result = try api.validateCardExpiryDate(expiryMonth: expiryMonthArg, expiryYear: expiryYearArg) - reply(wrapResult(result.rawValue)) + reply(wrapResult(result)) } catch { reply(wrapError(error)) } @@ -1595,7 +1750,7 @@ class CheckoutPlatformInterfaceSetup { } else { validateCardExpiryDateChannel.setMessageHandler(nil) } - let validateCardSecurityCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode", binaryMessenger: binaryMessenger, codec: codec) + let validateCardSecurityCodeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { validateCardSecurityCodeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1603,7 +1758,7 @@ class CheckoutPlatformInterfaceSetup { let cardBrandArg: String? = nilOrValue(args[1]) do { let result = try api.validateCardSecurityCode(securityCode: securityCodeArg, cardBrand: cardBrandArg) - reply(wrapResult(result.rawValue)) + reply(wrapResult(result)) } catch { reply(wrapError(error)) } @@ -1611,7 +1766,7 @@ class CheckoutPlatformInterfaceSetup { } else { validateCardSecurityCodeChannel.setMessageHandler(nil) } - let enableConsoleLoggingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging", binaryMessenger: binaryMessenger, codec: codec) + let enableConsoleLoggingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { enableConsoleLoggingChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1629,147 +1784,26 @@ class CheckoutPlatformInterfaceSetup { } } -private class DropInPlatformInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) - case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) - case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) - case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 136: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 137: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 138: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) - case 139: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 140: - return ErrorDTO.fromList(self.readValue() as! [Any?]) - case 141: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 142: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) - case 143: - return OrderCancelResultDTO.fromList(self.readValue() as! [Any?]) - case 144: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) - case 145: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class DropInPlatformInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { - super.writeByte(138) - super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { - super.writeByte(139) - super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { - super.writeByte(140) - super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { - super.writeByte(141) - super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { - super.writeByte(142) - super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResultDTO { - super.writeByte(143) - super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { - super.writeByte(145) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class DropInPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - DropInPlatformInterfaceCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - DropInPlatformInterfaceCodecWriter(data: data) - } -} - -class DropInPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = DropInPlatformInterfaceCodec(readerWriter: DropInPlatformInterfaceCodecReaderWriter()) -} - -/// Generated protocol from Pigeon that represents a handler of messages from Flutter. -protocol DropInPlatformInterface { - func showDropInSession(dropInConfigurationDTO: DropInConfigurationDTO) throws - func showDropInAdvanced(dropInConfigurationDTO: DropInConfigurationDTO, paymentMethodsResponse: String) throws - func onPaymentsResult(paymentsResult: PaymentEventDTO) throws - func onPaymentsDetailsResult(paymentsDetailsResult: PaymentEventDTO) throws - func onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: DeletedStoredPaymentMethodResultDTO) throws - func onBalanceCheckResult(balanceCheckResponse: String) throws - func onOrderRequestResult(orderRequestResponse: String) throws - func onOrderCancelResult(orderCancelResult: OrderCancelResultDTO) throws - func cleanUpDropIn() throws +/// Generated protocol from Pigeon that represents a handler of messages from Flutter. +protocol DropInPlatformInterface { + func showDropInSession(dropInConfigurationDTO: DropInConfigurationDTO) throws + func showDropInAdvanced(dropInConfigurationDTO: DropInConfigurationDTO, paymentMethodsResponse: String) throws + func onPaymentsResult(paymentsResult: PaymentEventDTO) throws + func onPaymentsDetailsResult(paymentsDetailsResult: PaymentEventDTO) throws + func onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: DeletedStoredPaymentMethodResultDTO) throws + func onBalanceCheckResult(balanceCheckResponse: String) throws + func onOrderRequestResult(orderRequestResponse: String) throws + func onOrderCancelResult(orderCancelResult: OrderCancelResultDTO) throws + func cleanUpDropIn() throws } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class DropInPlatformInterfaceSetup { - /// The codec used by DropInPlatformInterface. - static var codec: FlutterStandardMessageCodec { DropInPlatformInterfaceCodec.shared } + static var codec: FlutterStandardMessageCodec { PlatformApiPigeonCodec.shared } /// Sets up an instance of `DropInPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: DropInPlatformInterface?) { - let showDropInSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: DropInPlatformInterface?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let showDropInSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { showDropInSessionChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1784,7 +1818,7 @@ class DropInPlatformInterfaceSetup { } else { showDropInSessionChannel.setMessageHandler(nil) } - let showDropInAdvancedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced", binaryMessenger: binaryMessenger, codec: codec) + let showDropInAdvancedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { showDropInAdvancedChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1800,7 +1834,7 @@ class DropInPlatformInterfaceSetup { } else { showDropInAdvancedChannel.setMessageHandler(nil) } - let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) + let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onPaymentsResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1815,7 +1849,7 @@ class DropInPlatformInterfaceSetup { } else { onPaymentsResultChannel.setMessageHandler(nil) } - let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) + let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onPaymentsDetailsResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1830,7 +1864,7 @@ class DropInPlatformInterfaceSetup { } else { onPaymentsDetailsResultChannel.setMessageHandler(nil) } - let onDeleteStoredPaymentMethodResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult", binaryMessenger: binaryMessenger, codec: codec) + let onDeleteStoredPaymentMethodResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onDeleteStoredPaymentMethodResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1845,7 +1879,7 @@ class DropInPlatformInterfaceSetup { } else { onDeleteStoredPaymentMethodResultChannel.setMessageHandler(nil) } - let onBalanceCheckResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult", binaryMessenger: binaryMessenger, codec: codec) + let onBalanceCheckResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onBalanceCheckResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1860,7 +1894,7 @@ class DropInPlatformInterfaceSetup { } else { onBalanceCheckResultChannel.setMessageHandler(nil) } - let onOrderRequestResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult", binaryMessenger: binaryMessenger, codec: codec) + let onOrderRequestResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onOrderRequestResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1875,7 +1909,7 @@ class DropInPlatformInterfaceSetup { } else { onOrderRequestResultChannel.setMessageHandler(nil) } - let onOrderCancelResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult", binaryMessenger: binaryMessenger, codec: codec) + let onOrderCancelResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onOrderCancelResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1890,7 +1924,7 @@ class DropInPlatformInterfaceSetup { } else { onOrderCancelResultChannel.setMessageHandler(nil) } - let cleanUpDropInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn", binaryMessenger: binaryMessenger, codec: codec) + let cleanUpDropInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { cleanUpDropInChannel.setMessageHandler { _, reply in do { @@ -1906,80 +1940,26 @@ class DropInPlatformInterfaceSetup { } } -private class DropInFlutterInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 130: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 131: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 132: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class DropInFlutterInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { - super.writeByte(132) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class DropInFlutterInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - DropInFlutterInterfaceCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - DropInFlutterInterfaceCodecWriter(data: data) - } -} - -class DropInFlutterInterfaceCodec: FlutterStandardMessageCodec { - static let shared = DropInFlutterInterfaceCodec(readerWriter: DropInFlutterInterfaceCodecReaderWriter()) -} - /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol DropInFlutterInterfaceProtocol { - func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) - func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) + func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) + func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) } class DropInFlutterInterface: DropInFlutterInterfaceProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger) { + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" } - var codec: FlutterStandardMessageCodec { - DropInFlutterInterfaceCodec.shared + var codec: PlatformApiPigeonCodec { + PlatformApiPigeonCodec.shared } - func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication" + func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -1990,15 +1970,15 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) + completion(.failure(AdyenPigeonError(code: code, message: message, details: details))) } else { completion(.success(())) } } } - func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication" + func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -2009,7 +1989,7 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) + completion(.failure(AdyenPigeonError(code: code, message: message, details: details))) } else { completion(.success(())) } @@ -2017,182 +1997,6 @@ class DropInFlutterInterface: DropInFlutterInterfaceProtocol { } } -private class ComponentPlatformInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) - case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) - case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) - case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 136: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 137: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 138: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 139: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) - case 140: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) - case 141: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 142: - return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) - case 143: - return ErrorDTO.fromList(self.readValue() as! [Any?]) - case 144: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 145: - return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 146: - return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) - case 147: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) - case 148: - return OrderCancelResultDTO.fromList(self.readValue() as! [Any?]) - case 149: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 150: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) - case 151: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 152: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 153: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) - case 154: - return SessionDTO.fromList(self.readValue() as! [Any?]) - case 155: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 156: - return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class ComponentPlatformInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? ActionComponentConfigurationDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { - super.writeByte(138) - super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { - super.writeByte(139) - super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { - super.writeByte(140) - super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { - super.writeByte(141) - super.writeValue(value.toList()) - } else if let value = value as? EncryptedCardDTO { - super.writeByte(142) - super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { - super.writeByte(143) - super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentConfigurationDTO { - super.writeByte(145) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentSetupResultDTO { - super.writeByte(146) - super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { - super.writeByte(147) - super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResultDTO { - super.writeByte(148) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(149) - super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { - super.writeByte(150) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(151) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(152) - super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { - super.writeByte(153) - super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { - super.writeByte(154) - super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { - super.writeByte(155) - super.writeValue(value.toList()) - } else if let value = value as? UnencryptedCardDTO { - super.writeByte(156) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class ComponentPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - ComponentPlatformInterfaceCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - ComponentPlatformInterfaceCodecWriter(data: data) - } -} - -class ComponentPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = ComponentPlatformInterfaceCodec(readerWriter: ComponentPlatformInterfaceCodecReaderWriter()) -} - /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol ComponentPlatformInterface { func updateViewHeight(viewId: Int64) throws @@ -2206,11 +2010,11 @@ protocol ComponentPlatformInterface { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class ComponentPlatformInterfaceSetup { - /// The codec used by ComponentPlatformInterface. - static var codec: FlutterStandardMessageCodec { ComponentPlatformInterfaceCodec.shared } + static var codec: FlutterStandardMessageCodec { PlatformApiPigeonCodec.shared } /// Sets up an instance of `ComponentPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ComponentPlatformInterface?) { - let updateViewHeightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ComponentPlatformInterface?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let updateViewHeightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { updateViewHeightChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2225,7 +2029,7 @@ class ComponentPlatformInterfaceSetup { } else { updateViewHeightChannel.setMessageHandler(nil) } - let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) + let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onPaymentsResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2241,7 +2045,7 @@ class ComponentPlatformInterfaceSetup { } else { onPaymentsResultChannel.setMessageHandler(nil) } - let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) + let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onPaymentsDetailsResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2257,7 +2061,7 @@ class ComponentPlatformInterfaceSetup { } else { onPaymentsDetailsResultChannel.setMessageHandler(nil) } - let isInstantPaymentSupportedByPlatformChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform", binaryMessenger: binaryMessenger, codec: codec) + let isInstantPaymentSupportedByPlatformChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { isInstantPaymentSupportedByPlatformChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2276,7 +2080,7 @@ class ComponentPlatformInterfaceSetup { } else { isInstantPaymentSupportedByPlatformChannel.setMessageHandler(nil) } - let onInstantPaymentPressedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed", binaryMessenger: binaryMessenger, codec: codec) + let onInstantPaymentPressedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onInstantPaymentPressedChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2293,7 +2097,7 @@ class ComponentPlatformInterfaceSetup { } else { onInstantPaymentPressedChannel.setMessageHandler(nil) } - let handleActionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction", binaryMessenger: binaryMessenger, codec: codec) + let handleActionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { handleActionChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2310,7 +2114,7 @@ class ComponentPlatformInterfaceSetup { } else { handleActionChannel.setMessageHandler(nil) } - let onDisposeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose", binaryMessenger: binaryMessenger, codec: codec) + let onDisposeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api { onDisposeChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2328,100 +2132,26 @@ class ComponentPlatformInterfaceSetup { } } -private class ComponentFlutterInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 130: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 131: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) - case 133: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 134: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 135: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 136: - return SessionDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } -} - -private class ComponentFlutterInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } -} - -private class ComponentFlutterInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - ComponentFlutterInterfaceCodecReader(data: data) - } - - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - ComponentFlutterInterfaceCodecWriter(data: data) - } -} - -class ComponentFlutterInterfaceCodec: FlutterStandardMessageCodec { - static let shared = ComponentFlutterInterfaceCodec(readerWriter: ComponentFlutterInterfaceCodecReaderWriter()) -} - /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol ComponentFlutterInterfaceProtocol { - func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) - func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) + func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) + func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) } class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol { private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger) { + private let messageChannelSuffix: String + init(binaryMessenger: FlutterBinaryMessenger, messageChannelSuffix: String = "") { self.binaryMessenger = binaryMessenger + self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" } - var codec: FlutterStandardMessageCodec { - ComponentFlutterInterfaceCodec.shared + var codec: PlatformApiPigeonCodec { + PlatformApiPigeonCodec.shared } - func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) { - let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs" + func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([cardComponentConfigurationDTOArg, sessionDTOArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -2432,15 +2162,15 @@ class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) + completion(.failure(AdyenPigeonError(code: code, message: message, details: details))) } else { completion(.success(())) } } } - func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication" + func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication\(messageChannelSuffix)" let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([componentCommunicationModelArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { @@ -2451,7 +2181,7 @@ class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol { let code: String = listResponse[0] as! String let message: String? = nilOrValue(listResponse[1]) let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) + completion(.failure(AdyenPigeonError(code: code, message: message, details: details))) } else { completion(.success(())) } diff --git a/lib/src/components/component_flutter_api.dart b/lib/src/components/component_flutter_api.dart index 5bfcde8d..a216aec2 100644 --- a/lib/src/components/component_flutter_api.dart +++ b/lib/src/components/component_flutter_api.dart @@ -12,7 +12,7 @@ class ComponentFlutterApi implements ComponentFlutterInterface { static ComponentFlutterApi _initComponentFlutterApi() { ComponentFlutterApi componentFlutterApi = ComponentFlutterApi._init(); - ComponentFlutterInterface.setup(componentFlutterApi); + ComponentFlutterInterface.setUp(componentFlutterApi); _componentCommunicationStream = StreamController.broadcast(); return componentFlutterApi; @@ -34,7 +34,7 @@ class ComponentFlutterApi implements ComponentFlutterInterface { if (componentCommunicationStream.hasListener == false) { _instance = null; _componentCommunicationStream.close(); - ComponentFlutterInterface.setup(null); + ComponentFlutterInterface.setUp(null); } } } diff --git a/lib/src/drop_in/drop_in.dart b/lib/src/drop_in/drop_in.dart index 93e0303e..c404ad4e 100644 --- a/lib/src/drop_in/drop_in.dart +++ b/lib/src/drop_in/drop_in.dart @@ -17,7 +17,7 @@ class DropIn { this.dropInFlutterApi, this.dropInPlatformApi, ) { - DropInFlutterInterface.setup(dropInFlutterApi); + DropInFlutterInterface.setUp(dropInFlutterApi); } final PaymentEventHandler _paymentEventHandler = PaymentEventHandler(); diff --git a/lib/src/generated/platform_api.g.dart b/lib/src/generated/platform_api.g.dart index f878f916..db4335b0 100644 --- a/lib/src/generated/platform_api.g.dart +++ b/lib/src/generated/platform_api.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v16.0.5), do not edit directly. +// Autogenerated from Pigeon (v21.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -15,8 +15,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -280,16 +279,16 @@ class DropInConfigurationDTO { Object encode() { return [ - environment.index, + environment, clientKey, countryCode, - amount?.encode(), + amount, shopperLocale, - cardConfigurationDTO?.encode(), - applePayConfigurationDTO?.encode(), - googlePayConfigurationDTO?.encode(), - cashAppPayConfigurationDTO?.encode(), - analyticsOptionsDTO.encode(), + cardConfigurationDTO, + applePayConfigurationDTO, + googlePayConfigurationDTO, + cashAppPayConfigurationDTO, + analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, @@ -302,33 +301,21 @@ class DropInConfigurationDTO { static DropInConfigurationDTO decode(Object result) { result as List; return DropInConfigurationDTO( - environment: Environment.values[result[0]! as int], + environment: result[0]! as Environment, clientKey: result[1]! as String, countryCode: result[2]! as String, - amount: result[3] != null - ? AmountDTO.decode(result[3]! as List) - : null, + amount: result[3] as AmountDTO?, shopperLocale: result[4] as String?, - cardConfigurationDTO: result[5] != null - ? CardConfigurationDTO.decode(result[5]! as List) - : null, - applePayConfigurationDTO: result[6] != null - ? ApplePayConfigurationDTO.decode(result[6]! as List) - : null, - googlePayConfigurationDTO: result[7] != null - ? GooglePayConfigurationDTO.decode(result[7]! as List) - : null, - cashAppPayConfigurationDTO: result[8] != null - ? CashAppPayConfigurationDTO.decode(result[8]! as List) - : null, - analyticsOptionsDTO: - AnalyticsOptionsDTO.decode(result[9]! as List), + cardConfigurationDTO: result[5] as CardConfigurationDTO?, + applePayConfigurationDTO: result[6] as ApplePayConfigurationDTO?, + googlePayConfigurationDTO: result[7] as GooglePayConfigurationDTO?, + cashAppPayConfigurationDTO: result[8] as CashAppPayConfigurationDTO?, + analyticsOptionsDTO: result[9]! as AnalyticsOptionsDTO, showPreselectedStoredPaymentMethod: result[10]! as bool, skipListWhenSinglePaymentMethod: result[11]! as bool, isRemoveStoredPaymentMethodEnabled: result[12]! as bool, preselectedPaymentMethodTitle: result[13] as String?, - paymentMethodNames: - (result[14] as Map?)?.cast(), + paymentMethodNames: (result[14] as Map?)?.cast(), isPartialPaymentSupported: result[15]! as bool, ); } @@ -365,12 +352,12 @@ class CardConfigurationDTO { Object encode() { return [ holderNameRequired, - addressMode.index, + addressMode, showStorePaymentField, showCvcForStoredCard, showCvc, - kcpFieldVisibility.index, - socialSecurityNumberFieldVisibility.index, + kcpFieldVisibility, + socialSecurityNumberFieldVisibility, supportedCardTypes, ]; } @@ -379,13 +366,12 @@ class CardConfigurationDTO { result as List; return CardConfigurationDTO( holderNameRequired: result[0]! as bool, - addressMode: AddressMode.values[result[1]! as int], + addressMode: result[1]! as AddressMode, showStorePaymentField: result[2]! as bool, showCvcForStoredCard: result[3]! as bool, showCvc: result[4]! as bool, - kcpFieldVisibility: FieldVisibility.values[result[5]! as int], - socialSecurityNumberFieldVisibility: - FieldVisibility.values[result[6]! as int], + kcpFieldVisibility: result[5]! as FieldVisibility, + socialSecurityNumberFieldVisibility: result[6]! as FieldVisibility, supportedCardTypes: (result[7] as List?)!.cast(), ); } @@ -444,15 +430,15 @@ class ApplePayConfigurationDTO { allowOnboarding, summaryItems, requiredBillingContactFields, - billingContact?.encode(), + billingContact, requiredShippingContactFields, - shippingContact?.encode(), - applePayShippingType?.index, + shippingContact, + applePayShippingType, allowShippingContactEditing, shippingMethods, applicationData, supportedCountries, - merchantCapability?.index, + merchantCapability, ]; } @@ -462,29 +448,17 @@ class ApplePayConfigurationDTO { merchantId: result[0]! as String, merchantName: result[1]! as String, allowOnboarding: result[2] as bool?, - summaryItems: - (result[3] as List?)?.cast(), - requiredBillingContactFields: - (result[4] as List?)?.cast(), - billingContact: result[5] != null - ? ApplePayContactDTO.decode(result[5]! as List) - : null, - requiredShippingContactFields: - (result[6] as List?)?.cast(), - shippingContact: result[7] != null - ? ApplePayContactDTO.decode(result[7]! as List) - : null, - applePayShippingType: result[8] != null - ? ApplePayShippingType.values[result[8]! as int] - : null, + summaryItems: (result[3] as List?)?.cast(), + requiredBillingContactFields: (result[4] as List?)?.cast(), + billingContact: result[5] as ApplePayContactDTO?, + requiredShippingContactFields: (result[6] as List?)?.cast(), + shippingContact: result[7] as ApplePayContactDTO?, + applePayShippingType: result[8] as ApplePayShippingType?, allowShippingContactEditing: result[9] as bool?, - shippingMethods: - (result[10] as List?)?.cast(), + shippingMethods: (result[10] as List?)?.cast(), applicationData: result[11] as String?, supportedCountries: (result[12] as List?)?.cast(), - merchantCapability: result[13] != null - ? ApplePayMerchantCapability.values[result[13]! as int] - : null, + merchantCapability: result[13] as ApplePayMerchantCapability?, ); } } @@ -601,7 +575,7 @@ class ApplePayShippingMethodDTO { return [ label, detail, - amount.encode(), + amount, identifier, startDate, endDate, @@ -613,7 +587,7 @@ class ApplePayShippingMethodDTO { return ApplePayShippingMethodDTO( label: result[0]! as String, detail: result[1]! as String, - amount: AmountDTO.decode(result[2]! as List), + amount: result[2]! as AmountDTO, identifier: result[3]! as String, startDate: result[4] as String?, endDate: result[5] as String?, @@ -637,8 +611,8 @@ class ApplePaySummaryItemDTO { Object encode() { return [ label, - amount.encode(), - type.index, + amount, + type, ]; } @@ -646,8 +620,8 @@ class ApplePaySummaryItemDTO { result as List; return ApplePaySummaryItemDTO( label: result[0]! as String, - amount: AmountDTO.decode(result[1]! as List), - type: ApplePaySummaryItemType.values[result[2]! as int], + amount: result[1]! as AmountDTO, + type: result[2]! as ApplePaySummaryItemType, ); } } @@ -703,10 +677,10 @@ class GooglePayConfigurationDTO { Object encode() { return [ - googlePayEnvironment.index, + googlePayEnvironment, merchantAccount, - merchantInfoDTO?.encode(), - totalPriceStatus?.index, + merchantInfoDTO, + totalPriceStatus, allowedCardNetworks, allowedAuthMethods, allowPrepaidCards, @@ -715,22 +689,19 @@ class GooglePayConfigurationDTO { emailRequired, existingPaymentMethodRequired, shippingAddressRequired, - shippingAddressParametersDTO?.encode(), + shippingAddressParametersDTO, billingAddressRequired, - billingAddressParametersDTO?.encode(), + billingAddressParametersDTO, ]; } static GooglePayConfigurationDTO decode(Object result) { result as List; return GooglePayConfigurationDTO( - googlePayEnvironment: GooglePayEnvironment.values[result[0]! as int], + googlePayEnvironment: result[0]! as GooglePayEnvironment, merchantAccount: result[1] as String?, - merchantInfoDTO: result[2] != null - ? MerchantInfoDTO.decode(result[2]! as List) - : null, - totalPriceStatus: - result[3] != null ? TotalPriceStatus.values[result[3]! as int] : null, + merchantInfoDTO: result[2] as MerchantInfoDTO?, + totalPriceStatus: result[3] as TotalPriceStatus?, allowedCardNetworks: (result[4] as List?)?.cast(), allowedAuthMethods: (result[5] as List?)?.cast(), allowPrepaidCards: result[6] as bool?, @@ -739,13 +710,9 @@ class GooglePayConfigurationDTO { emailRequired: result[9] as bool?, existingPaymentMethodRequired: result[10] as bool?, shippingAddressRequired: result[11] as bool?, - shippingAddressParametersDTO: result[12] != null - ? ShippingAddressParametersDTO.decode(result[12]! as List) - : null, + shippingAddressParametersDTO: result[12] as ShippingAddressParametersDTO?, billingAddressRequired: result[13] as bool?, - billingAddressParametersDTO: result[14] != null - ? BillingAddressParametersDTO.decode(result[14]! as List) - : null, + billingAddressParametersDTO: result[14] as BillingAddressParametersDTO?, ); } } @@ -840,7 +807,7 @@ class CashAppPayConfigurationDTO { Object encode() { return [ - cashAppPayEnvironment.index, + cashAppPayEnvironment, returnUrl, ]; } @@ -848,7 +815,7 @@ class CashAppPayConfigurationDTO { static CashAppPayConfigurationDTO decode(Object result) { result as List; return CashAppPayConfigurationDTO( - cashAppPayEnvironment: CashAppPayEnvironment.values[result[0]! as int], + cashAppPayEnvironment: result[0]! as CashAppPayEnvironment, returnUrl: result[1]! as String, ); } @@ -869,20 +836,18 @@ class PaymentResultDTO { Object encode() { return [ - type.index, + type, reason, - result?.encode(), + result, ]; } static PaymentResultDTO decode(Object result) { result as List; return PaymentResultDTO( - type: PaymentResultEnum.values[result[0]! as int], + type: result[0]! as PaymentResultEnum, reason: result[1] as String?, - result: result[2] != null - ? PaymentResultModelDTO.decode(result[2]! as List) - : null, + result: result[2] as PaymentResultModelDTO?, ); } } @@ -912,7 +877,7 @@ class PaymentResultModelDTO { sessionData, sessionResult, resultCode, - order?.encode(), + order, ]; } @@ -923,9 +888,7 @@ class PaymentResultModelDTO { sessionData: result[1] as String?, sessionResult: result[2] as String?, resultCode: result[3] as String?, - order: result[4] != null - ? OrderResponseDTO.decode(result[4]! as List) - : null, + order: result[4] as OrderResponseDTO?, ); } } @@ -950,8 +913,8 @@ class OrderResponseDTO { return [ pspReference, orderData, - amount?.encode(), - remainingAmount?.encode(), + amount, + remainingAmount, ]; } @@ -960,12 +923,8 @@ class OrderResponseDTO { return OrderResponseDTO( pspReference: result[0]! as String, orderData: result[1]! as String, - amount: result[2] != null - ? AmountDTO.decode(result[2]! as List) - : null, - remainingAmount: result[3] != null - ? AmountDTO.decode(result[3]! as List) - : null, + amount: result[2] as AmountDTO?, + remainingAmount: result[3] as AmountDTO?, ); } } @@ -985,20 +944,18 @@ class PlatformCommunicationModel { Object encode() { return [ - type.index, + type, data, - paymentResult?.encode(), + paymentResult, ]; } static PlatformCommunicationModel decode(Object result) { result as List; return PlatformCommunicationModel( - type: PlatformCommunicationType.values[result[0]! as int], + type: result[0]! as PlatformCommunicationType, data: result[1] as String?, - paymentResult: result[2] != null - ? PaymentResultDTO.decode(result[2]! as List) - : null, + paymentResult: result[2] as PaymentResultDTO?, ); } } @@ -1021,22 +978,20 @@ class ComponentCommunicationModel { Object encode() { return [ - type.index, + type, componentId, data, - paymentResult?.encode(), + paymentResult, ]; } static ComponentCommunicationModel decode(Object result) { result as List; return ComponentCommunicationModel( - type: ComponentCommunicationType.values[result[0]! as int], + type: result[0]! as ComponentCommunicationType, componentId: result[1]! as String, data: result[2], - paymentResult: result[3] != null - ? PaymentResultDTO.decode(result[3]! as List) - : null, + paymentResult: result[3] as PaymentResultDTO?, ); } } @@ -1059,22 +1014,20 @@ class PaymentEventDTO { Object encode() { return [ - paymentEventType.index, + paymentEventType, result, data, - error?.encode(), + error, ]; } static PaymentEventDTO decode(Object result) { result as List; return PaymentEventDTO( - paymentEventType: PaymentEventType.values[result[0]! as int], + paymentEventType: result[0]! as PaymentEventType, result: result[1] as String?, data: (result[2] as Map?)?.cast(), - error: result[3] != null - ? ErrorDTO.decode(result[3]! as List) - : null, + error: result[3] as ErrorDTO?, ); } } @@ -1163,30 +1116,26 @@ class CardComponentConfigurationDTO { Object encode() { return [ - environment.index, + environment, clientKey, countryCode, - amount?.encode(), + amount, shopperLocale, - cardConfiguration.encode(), - analyticsOptionsDTO.encode(), + cardConfiguration, + analyticsOptionsDTO, ]; } static CardComponentConfigurationDTO decode(Object result) { result as List; return CardComponentConfigurationDTO( - environment: Environment.values[result[0]! as int], + environment: result[0]! as Environment, clientKey: result[1]! as String, countryCode: result[2]! as String, - amount: result[3] != null - ? AmountDTO.decode(result[3]! as List) - : null, + amount: result[3] as AmountDTO?, shopperLocale: result[4] as String?, - cardConfiguration: - CardConfigurationDTO.decode(result[5]! as List), - analyticsOptionsDTO: - AnalyticsOptionsDTO.decode(result[6]! as List), + cardConfiguration: result[5]! as CardConfigurationDTO, + analyticsOptionsDTO: result[6]! as AnalyticsOptionsDTO, ); } } @@ -1224,37 +1173,30 @@ class InstantPaymentConfigurationDTO { Object encode() { return [ - instantPaymentType.index, - environment.index, + instantPaymentType, + environment, clientKey, countryCode, - amount?.encode(), + amount, shopperLocale, - analyticsOptionsDTO.encode(), - googlePayConfigurationDTO?.encode(), - applePayConfigurationDTO?.encode(), + analyticsOptionsDTO, + googlePayConfigurationDTO, + applePayConfigurationDTO, ]; } static InstantPaymentConfigurationDTO decode(Object result) { result as List; return InstantPaymentConfigurationDTO( - instantPaymentType: InstantPaymentType.values[result[0]! as int], - environment: Environment.values[result[1]! as int], + instantPaymentType: result[0]! as InstantPaymentType, + environment: result[1]! as Environment, clientKey: result[2]! as String, countryCode: result[3]! as String, - amount: result[4] != null - ? AmountDTO.decode(result[4]! as List) - : null, + amount: result[4] as AmountDTO?, shopperLocale: result[5] as String?, - analyticsOptionsDTO: - AnalyticsOptionsDTO.decode(result[6]! as List), - googlePayConfigurationDTO: result[7] != null - ? GooglePayConfigurationDTO.decode(result[7]! as List) - : null, - applePayConfigurationDTO: result[8] != null - ? ApplePayConfigurationDTO.decode(result[8]! as List) - : null, + analyticsOptionsDTO: result[6]! as AnalyticsOptionsDTO, + googlePayConfigurationDTO: result[7] as GooglePayConfigurationDTO?, + applePayConfigurationDTO: result[8] as ApplePayConfigurationDTO?, ); } } @@ -1274,7 +1216,7 @@ class InstantPaymentSetupResultDTO { Object encode() { return [ - instantPaymentType.index, + instantPaymentType, isSupported, resultData, ]; @@ -1283,7 +1225,7 @@ class InstantPaymentSetupResultDTO { static InstantPaymentSetupResultDTO decode(Object result) { result as List; return InstantPaymentSetupResultDTO( - instantPaymentType: InstantPaymentType.values[result[0]! as int], + instantPaymentType: result[0]! as InstantPaymentType, isSupported: result[1]! as bool, resultData: result[2], ); @@ -1383,25 +1325,22 @@ class ActionComponentConfigurationDTO { Object encode() { return [ - environment.index, + environment, clientKey, shopperLocale, - amount?.encode(), - analyticsOptionsDTO.encode(), + amount, + analyticsOptionsDTO, ]; } static ActionComponentConfigurationDTO decode(Object result) { result as List; return ActionComponentConfigurationDTO( - environment: Environment.values[result[0]! as int], + environment: result[0]! as Environment, clientKey: result[1]! as String, shopperLocale: result[2] as String?, - amount: result[3] != null - ? AmountDTO.decode(result[3]! as List) - : null, - analyticsOptionsDTO: - AnalyticsOptionsDTO.decode(result[4]! as List), + amount: result[3] as AmountDTO?, + analyticsOptionsDTO: result[4]! as AnalyticsOptionsDTO, ); } } @@ -1426,105 +1365,158 @@ class OrderCancelResultDTO { static OrderCancelResultDTO decode(Object result) { result as List; return OrderCancelResultDTO( - orderCancelResponseBody: - (result[0] as Map?)!.cast(), - updatedPaymentMethodsResponseBody: - (result[1] as Map?)?.cast(), + orderCancelResponseBody: (result[0] as Map?)!.cast(), + updatedPaymentMethodsResponseBody: (result[1] as Map?)?.cast(), ); } } -class _CheckoutPlatformInterfaceCodec extends StandardMessageCodec { - const _CheckoutPlatformInterfaceCodec(); + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is ActionComponentConfigurationDTO) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AmountDTO) { + if (value is SessionDTO) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { + } else if (value is AmountDTO) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is ApplePayConfigurationDTO) { + } else if (value is AnalyticsOptionsDTO) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is ApplePayContactDTO) { + } else if (value is DropInConfigurationDTO) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is ApplePayShippingMethodDTO) { + } else if (value is CardConfigurationDTO) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is ApplePaySummaryItemDTO) { + } else if (value is ApplePayConfigurationDTO) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is BillingAddressParametersDTO) { + } else if (value is ApplePayContactDTO) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is CardComponentConfigurationDTO) { + } else if (value is ApplePayShippingMethodDTO) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { + } else if (value is ApplePaySummaryItemDTO) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is CashAppPayConfigurationDTO) { + } else if (value is GooglePayConfigurationDTO) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is ComponentCommunicationModel) { + } else if (value is MerchantInfoDTO) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is DeletedStoredPaymentMethodResultDTO) { + } else if (value is ShippingAddressParametersDTO) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is DropInConfigurationDTO) { + } else if (value is BillingAddressParametersDTO) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is EncryptedCardDTO) { + } else if (value is CashAppPayConfigurationDTO) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is ErrorDTO) { + } else if (value is PaymentResultDTO) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is GooglePayConfigurationDTO) { + } else if (value is PaymentResultModelDTO) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentConfigurationDTO) { + } else if (value is OrderResponseDTO) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentSetupResultDTO) { + } else if (value is PlatformCommunicationModel) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is MerchantInfoDTO) { + } else if (value is ComponentCommunicationModel) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is OrderCancelResultDTO) { + } else if (value is PaymentEventDTO) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { + } else if (value is ErrorDTO) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PaymentEventDTO) { + } else if (value is DeletedStoredPaymentMethodResultDTO) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { + } else if (value is CardComponentConfigurationDTO) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { + } else if (value is InstantPaymentConfigurationDTO) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is PlatformCommunicationModel) { + } else if (value is InstantPaymentSetupResultDTO) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is SessionDTO) { + } else if (value is UnencryptedCardDTO) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is ShippingAddressParametersDTO) { + } else if (value is EncryptedCardDTO) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is UnencryptedCardDTO) { + } else if (value is ActionComponentConfigurationDTO) { buffer.putUint8(156); writeValue(buffer, value.encode()); + } else if (value is OrderCancelResultDTO) { + buffer.putUint8(157); + writeValue(buffer, value.encode()); + } else if (value is Environment) { + buffer.putUint8(158); + writeValue(buffer, value.index); + } else if (value is AddressMode) { + buffer.putUint8(159); + writeValue(buffer, value.index); + } else if (value is CardAuthMethod) { + buffer.putUint8(160); + writeValue(buffer, value.index); + } else if (value is TotalPriceStatus) { + buffer.putUint8(161); + writeValue(buffer, value.index); + } else if (value is GooglePayEnvironment) { + buffer.putUint8(162); + writeValue(buffer, value.index); + } else if (value is CashAppPayEnvironment) { + buffer.putUint8(163); + writeValue(buffer, value.index); + } else if (value is PaymentResultEnum) { + buffer.putUint8(164); + writeValue(buffer, value.index); + } else if (value is PlatformCommunicationType) { + buffer.putUint8(165); + writeValue(buffer, value.index); + } else if (value is ComponentCommunicationType) { + buffer.putUint8(166); + writeValue(buffer, value.index); + } else if (value is PaymentEventType) { + buffer.putUint8(167); + writeValue(buffer, value.index); + } else if (value is FieldVisibility) { + buffer.putUint8(168); + writeValue(buffer, value.index); + } else if (value is InstantPaymentType) { + buffer.putUint8(169); + writeValue(buffer, value.index); + } else if (value is ApplePayShippingType) { + buffer.putUint8(170); + writeValue(buffer, value.index); + } else if (value is ApplePayMerchantCapability) { + buffer.putUint8(171); + writeValue(buffer, value.index); + } else if (value is ApplePaySummaryItemType) { + buffer.putUint8(172); + writeValue(buffer, value.index); + } else if (value is CardNumberValidationResultDTO) { + buffer.putUint8(173); + writeValue(buffer, value.index); + } else if (value is CardExpiryDateValidationResultDTO) { + buffer.putUint8(174); + writeValue(buffer, value.index); + } else if (value is CardSecurityCodeValidationResultDTO) { + buffer.putUint8(175); + writeValue(buffer, value.index); } else { super.writeValue(buffer, value); } @@ -1533,64 +1525,118 @@ class _CheckoutPlatformInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 129: + case 129: + return SessionDTO.decode(readValue(buffer)!); + case 130: return AmountDTO.decode(readValue(buffer)!); - case 130: + case 131: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: + case 132: + return DropInConfigurationDTO.decode(readValue(buffer)!); + case 133: + return CardConfigurationDTO.decode(readValue(buffer)!); + case 134: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: + case 135: return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: + case 136: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: + case 137: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: + case 138: + return GooglePayConfigurationDTO.decode(readValue(buffer)!); + case 139: + return MerchantInfoDTO.decode(readValue(buffer)!); + case 140: + return ShippingAddressParametersDTO.decode(readValue(buffer)!); + case 141: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: - return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 137: - return CardConfigurationDTO.decode(readValue(buffer)!); - case 138: + case 142: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 139: + case 143: + return PaymentResultDTO.decode(readValue(buffer)!); + case 144: + return PaymentResultModelDTO.decode(readValue(buffer)!); + case 145: + return OrderResponseDTO.decode(readValue(buffer)!); + case 146: + return PlatformCommunicationModel.decode(readValue(buffer)!); + case 147: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 140: - return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 141: - return DropInConfigurationDTO.decode(readValue(buffer)!); - case 142: - return EncryptedCardDTO.decode(readValue(buffer)!); - case 143: + case 148: + return PaymentEventDTO.decode(readValue(buffer)!); + case 149: return ErrorDTO.decode(readValue(buffer)!); - case 144: - return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 145: + case 150: + return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); + case 151: + return CardComponentConfigurationDTO.decode(readValue(buffer)!); + case 152: return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 146: + case 153: return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 147: - return MerchantInfoDTO.decode(readValue(buffer)!); - case 148: - return OrderCancelResultDTO.decode(readValue(buffer)!); - case 149: - return OrderResponseDTO.decode(readValue(buffer)!); - case 150: - return PaymentEventDTO.decode(readValue(buffer)!); - case 151: - return PaymentResultDTO.decode(readValue(buffer)!); - case 152: - return PaymentResultModelDTO.decode(readValue(buffer)!); - case 153: - return PlatformCommunicationModel.decode(readValue(buffer)!); - case 154: - return SessionDTO.decode(readValue(buffer)!); - case 155: - return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 156: + case 154: return UnencryptedCardDTO.decode(readValue(buffer)!); + case 155: + return EncryptedCardDTO.decode(readValue(buffer)!); + case 156: + return ActionComponentConfigurationDTO.decode(readValue(buffer)!); + case 157: + return OrderCancelResultDTO.decode(readValue(buffer)!); + case 158: + final int? value = readValue(buffer) as int?; + return value == null ? null : Environment.values[value]; + case 159: + final int? value = readValue(buffer) as int?; + return value == null ? null : AddressMode.values[value]; + case 160: + final int? value = readValue(buffer) as int?; + return value == null ? null : CardAuthMethod.values[value]; + case 161: + final int? value = readValue(buffer) as int?; + return value == null ? null : TotalPriceStatus.values[value]; + case 162: + final int? value = readValue(buffer) as int?; + return value == null ? null : GooglePayEnvironment.values[value]; + case 163: + final int? value = readValue(buffer) as int?; + return value == null ? null : CashAppPayEnvironment.values[value]; + case 164: + final int? value = readValue(buffer) as int?; + return value == null ? null : PaymentResultEnum.values[value]; + case 165: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformCommunicationType.values[value]; + case 166: + final int? value = readValue(buffer) as int?; + return value == null ? null : ComponentCommunicationType.values[value]; + case 167: + final int? value = readValue(buffer) as int?; + return value == null ? null : PaymentEventType.values[value]; + case 168: + final int? value = readValue(buffer) as int?; + return value == null ? null : FieldVisibility.values[value]; + case 169: + final int? value = readValue(buffer) as int?; + return value == null ? null : InstantPaymentType.values[value]; + case 170: + final int? value = readValue(buffer) as int?; + return value == null ? null : ApplePayShippingType.values[value]; + case 171: + final int? value = readValue(buffer) as int?; + return value == null ? null : ApplePayMerchantCapability.values[value]; + case 172: + final int? value = readValue(buffer) as int?; + return value == null ? null : ApplePaySummaryItemType.values[value]; + case 173: + final int? value = readValue(buffer) as int?; + return value == null ? null : CardNumberValidationResultDTO.values[value]; + case 174: + final int? value = readValue(buffer) as int?; + return value == null ? null : CardExpiryDateValidationResultDTO.values[value]; + case 175: + final int? value = readValue(buffer) as int?; + return value == null ? null : CardSecurityCodeValidationResultDTO.values[value]; default: return super.readValueOfType(type, buffer); } @@ -1601,18 +1647,18 @@ class CheckoutPlatformInterface { /// Constructor for [CheckoutPlatformInterface]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CheckoutPlatformInterface({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; + CheckoutPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = - _CheckoutPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String __pigeon_messageChannelSuffix; Future getReturnUrl() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -1637,19 +1683,15 @@ class CheckoutPlatformInterface { } } - Future createSession( - String sessionId, String sessionData, Object? configuration) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future createSession(String sessionId, String sessionData, Object? configuration) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([sessionId, sessionData, configuration]) - as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([sessionId, sessionData, configuration]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1669,10 +1711,8 @@ class CheckoutPlatformInterface { } Future clearSession() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -1692,18 +1732,15 @@ class CheckoutPlatformInterface { } } - Future encryptCard( - UnencryptedCardDTO unencryptedCardDTO, String publicKey) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future encryptCard(UnencryptedCardDTO unencryptedCardDTO, String publicKey) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([unencryptedCardDTO, publicKey]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([unencryptedCardDTO, publicKey]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1723,16 +1760,14 @@ class CheckoutPlatformInterface { } Future encryptBin(String bin, String publicKey) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([bin, publicKey]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([bin, publicKey]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1751,18 +1786,15 @@ class CheckoutPlatformInterface { } } - Future validateCardNumber( - String cardNumber, bool enableLuhnCheck) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future validateCardNumber(String cardNumber, bool enableLuhnCheck) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardNumber$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([cardNumber, enableLuhnCheck]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([cardNumber, enableLuhnCheck]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1777,23 +1809,19 @@ class CheckoutPlatformInterface { message: 'Host platform returned null value for non-null return value.', ); } else { - return CardNumberValidationResultDTO - .values[__pigeon_replyList[0]! as int]; + return (__pigeon_replyList[0] as CardNumberValidationResultDTO?)!; } } - Future validateCardExpiryDate( - String expiryMonth, String expiryYear) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future validateCardExpiryDate(String expiryMonth, String expiryYear) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardExpiryDate$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([expiryMonth, expiryYear]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([expiryMonth, expiryYear]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1808,23 +1836,19 @@ class CheckoutPlatformInterface { message: 'Host platform returned null value for non-null return value.', ); } else { - return CardExpiryDateValidationResultDTO - .values[__pigeon_replyList[0]! as int]; + return (__pigeon_replyList[0] as CardExpiryDateValidationResultDTO?)!; } } - Future validateCardSecurityCode( - String securityCode, String? cardBrand) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future validateCardSecurityCode(String securityCode, String? cardBrand) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.validateCardSecurityCode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([securityCode, cardBrand]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([securityCode, cardBrand]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1839,22 +1863,19 @@ class CheckoutPlatformInterface { message: 'Host platform returned null value for non-null return value.', ); } else { - return CardSecurityCodeValidationResultDTO - .values[__pigeon_replyList[0]! as int]; + return (__pigeon_replyList[0] as CardSecurityCodeValidationResultDTO?)!; } } Future enableConsoleLogging(bool loggingEnabled) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([loggingEnabled]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([loggingEnabled]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -1869,137 +1890,28 @@ class CheckoutPlatformInterface { } } -class _DropInPlatformInterfaceCodec extends StandardMessageCodec { - const _DropInPlatformInterfaceCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is AmountDTO) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AmountDTO) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is ApplePayConfigurationDTO) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is ApplePayContactDTO) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is ApplePayShippingMethodDTO) { - buffer.putUint8(133); - writeValue(buffer, value.encode()); - } else if (value is ApplePaySummaryItemDTO) { - buffer.putUint8(134); - writeValue(buffer, value.encode()); - } else if (value is BillingAddressParametersDTO) { - buffer.putUint8(135); - writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { - buffer.putUint8(136); - writeValue(buffer, value.encode()); - } else if (value is CashAppPayConfigurationDTO) { - buffer.putUint8(137); - writeValue(buffer, value.encode()); - } else if (value is DeletedStoredPaymentMethodResultDTO) { - buffer.putUint8(138); - writeValue(buffer, value.encode()); - } else if (value is DropInConfigurationDTO) { - buffer.putUint8(139); - writeValue(buffer, value.encode()); - } else if (value is ErrorDTO) { - buffer.putUint8(140); - writeValue(buffer, value.encode()); - } else if (value is GooglePayConfigurationDTO) { - buffer.putUint8(141); - writeValue(buffer, value.encode()); - } else if (value is MerchantInfoDTO) { - buffer.putUint8(142); - writeValue(buffer, value.encode()); - } else if (value is OrderCancelResultDTO) { - buffer.putUint8(143); - writeValue(buffer, value.encode()); - } else if (value is PaymentEventDTO) { - buffer.putUint8(144); - writeValue(buffer, value.encode()); - } else if (value is ShippingAddressParametersDTO) { - buffer.putUint8(145); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return AmountDTO.decode(readValue(buffer)!); - case 129: - return AmountDTO.decode(readValue(buffer)!); - case 130: - return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: - return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: - return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: - return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: - return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: - return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: - return CardConfigurationDTO.decode(readValue(buffer)!); - case 137: - return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 138: - return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 139: - return DropInConfigurationDTO.decode(readValue(buffer)!); - case 140: - return ErrorDTO.decode(readValue(buffer)!); - case 141: - return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 142: - return MerchantInfoDTO.decode(readValue(buffer)!); - case 143: - return OrderCancelResultDTO.decode(readValue(buffer)!); - case 144: - return PaymentEventDTO.decode(readValue(buffer)!); - case 145: - return ShippingAddressParametersDTO.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - class DropInPlatformInterface { /// Constructor for [DropInPlatformInterface]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - DropInPlatformInterface({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; + DropInPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = - _DropInPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future showDropInSession( - DropInConfigurationDTO dropInConfigurationDTO) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_messageChannelSuffix; + + Future showDropInSession(DropInConfigurationDTO dropInConfigurationDTO) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([dropInConfigurationDTO]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([dropInConfigurationDTO]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2013,19 +1925,15 @@ class DropInPlatformInterface { } } - Future showDropInAdvanced(DropInConfigurationDTO dropInConfigurationDTO, - String paymentMethodsResponse) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future showDropInAdvanced(DropInConfigurationDTO dropInConfigurationDTO, String paymentMethodsResponse) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([dropInConfigurationDTO, paymentMethodsResponse]) - as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([dropInConfigurationDTO, paymentMethodsResponse]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2040,16 +1948,14 @@ class DropInPlatformInterface { } Future onPaymentsResult(PaymentEventDTO paymentsResult) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([paymentsResult]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([paymentsResult]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2063,18 +1969,15 @@ class DropInPlatformInterface { } } - Future onPaymentsDetailsResult( - PaymentEventDTO paymentsDetailsResult) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onPaymentsDetailsResult(PaymentEventDTO paymentsDetailsResult) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([paymentsDetailsResult]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([paymentsDetailsResult]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2088,19 +1991,15 @@ class DropInPlatformInterface { } } - Future onDeleteStoredPaymentMethodResult( - DeletedStoredPaymentMethodResultDTO - deleteStoredPaymentMethodResultDTO) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onDeleteStoredPaymentMethodResult(DeletedStoredPaymentMethodResultDTO deleteStoredPaymentMethodResultDTO) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([deleteStoredPaymentMethodResultDTO]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([deleteStoredPaymentMethodResultDTO]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2115,16 +2014,14 @@ class DropInPlatformInterface { } Future onBalanceCheckResult(String balanceCheckResponse) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([balanceCheckResponse]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([balanceCheckResponse]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2139,16 +2036,14 @@ class DropInPlatformInterface { } Future onOrderRequestResult(String orderRequestResponse) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([orderRequestResponse]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([orderRequestResponse]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2162,18 +2057,15 @@ class DropInPlatformInterface { } } - Future onOrderCancelResult( - OrderCancelResultDTO orderCancelResult) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onOrderCancelResult(OrderCancelResultDTO orderCancelResult) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([orderCancelResult]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([orderCancelResult]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2188,10 +2080,8 @@ class DropInPlatformInterface { } Future cleanUpDropIn() async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2212,117 +2102,61 @@ class DropInPlatformInterface { } } -class _DropInFlutterInterfaceCodec extends StandardMessageCodec { - const _DropInFlutterInterfaceCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is AmountDTO) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is PlatformCommunicationModel) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return AmountDTO.decode(readValue(buffer)!); - case 129: - return OrderResponseDTO.decode(readValue(buffer)!); - case 130: - return PaymentResultDTO.decode(readValue(buffer)!); - case 131: - return PaymentResultModelDTO.decode(readValue(buffer)!); - case 132: - return PlatformCommunicationModel.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - abstract class DropInFlutterInterface { - static const MessageCodec pigeonChannelCodec = - _DropInFlutterInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void onDropInSessionPlatformCommunication( - PlatformCommunicationModel platformCommunicationModel); + void onDropInSessionPlatformCommunication(PlatformCommunicationModel platformCommunicationModel); - void onDropInAdvancedPlatformCommunication( - PlatformCommunicationModel platformCommunicationModel); + void onDropInAdvancedPlatformCommunication(PlatformCommunicationModel platformCommunicationModel); - static void setup(DropInFlutterInterface? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp(DropInFlutterInterface? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null.'); final List args = (message as List?)!; - final PlatformCommunicationModel? arg_platformCommunicationModel = - (args[0] as PlatformCommunicationModel?); + final PlatformCommunicationModel? arg_platformCommunicationModel = (args[0] as PlatformCommunicationModel?); assert(arg_platformCommunicationModel != null, 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null, expected non-null PlatformCommunicationModel.'); try { - api.onDropInSessionPlatformCommunication( - arg_platformCommunicationModel!); + api.onDropInSessionPlatformCommunication(arg_platformCommunicationModel!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null.'); final List args = (message as List?)!; - final PlatformCommunicationModel? arg_platformCommunicationModel = - (args[0] as PlatformCommunicationModel?); + final PlatformCommunicationModel? arg_platformCommunicationModel = (args[0] as PlatformCommunicationModel?); assert(arg_platformCommunicationModel != null, 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null, expected non-null PlatformCommunicationModel.'); try { - api.onDropInAdvancedPlatformCommunication( - arg_platformCommunicationModel!); + api.onDropInAdvancedPlatformCommunication(arg_platformCommunicationModel!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -2330,185 +2164,22 @@ abstract class DropInFlutterInterface { } } -class _ComponentPlatformInterfaceCodec extends StandardMessageCodec { - const _ComponentPlatformInterfaceCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ActionComponentConfigurationDTO) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AmountDTO) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is ApplePayConfigurationDTO) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is ApplePayContactDTO) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is ApplePayShippingMethodDTO) { - buffer.putUint8(133); - writeValue(buffer, value.encode()); - } else if (value is ApplePaySummaryItemDTO) { - buffer.putUint8(134); - writeValue(buffer, value.encode()); - } else if (value is BillingAddressParametersDTO) { - buffer.putUint8(135); - writeValue(buffer, value.encode()); - } else if (value is CardComponentConfigurationDTO) { - buffer.putUint8(136); - writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { - buffer.putUint8(137); - writeValue(buffer, value.encode()); - } else if (value is CashAppPayConfigurationDTO) { - buffer.putUint8(138); - writeValue(buffer, value.encode()); - } else if (value is ComponentCommunicationModel) { - buffer.putUint8(139); - writeValue(buffer, value.encode()); - } else if (value is DeletedStoredPaymentMethodResultDTO) { - buffer.putUint8(140); - writeValue(buffer, value.encode()); - } else if (value is DropInConfigurationDTO) { - buffer.putUint8(141); - writeValue(buffer, value.encode()); - } else if (value is EncryptedCardDTO) { - buffer.putUint8(142); - writeValue(buffer, value.encode()); - } else if (value is ErrorDTO) { - buffer.putUint8(143); - writeValue(buffer, value.encode()); - } else if (value is GooglePayConfigurationDTO) { - buffer.putUint8(144); - writeValue(buffer, value.encode()); - } else if (value is InstantPaymentConfigurationDTO) { - buffer.putUint8(145); - writeValue(buffer, value.encode()); - } else if (value is InstantPaymentSetupResultDTO) { - buffer.putUint8(146); - writeValue(buffer, value.encode()); - } else if (value is MerchantInfoDTO) { - buffer.putUint8(147); - writeValue(buffer, value.encode()); - } else if (value is OrderCancelResultDTO) { - buffer.putUint8(148); - writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { - buffer.putUint8(149); - writeValue(buffer, value.encode()); - } else if (value is PaymentEventDTO) { - buffer.putUint8(150); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { - buffer.putUint8(151); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { - buffer.putUint8(152); - writeValue(buffer, value.encode()); - } else if (value is PlatformCommunicationModel) { - buffer.putUint8(153); - writeValue(buffer, value.encode()); - } else if (value is SessionDTO) { - buffer.putUint8(154); - writeValue(buffer, value.encode()); - } else if (value is ShippingAddressParametersDTO) { - buffer.putUint8(155); - writeValue(buffer, value.encode()); - } else if (value is UnencryptedCardDTO) { - buffer.putUint8(156); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 129: - return AmountDTO.decode(readValue(buffer)!); - case 130: - return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: - return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: - return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: - return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: - return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: - return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: - return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 137: - return CardConfigurationDTO.decode(readValue(buffer)!); - case 138: - return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 139: - return ComponentCommunicationModel.decode(readValue(buffer)!); - case 140: - return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 141: - return DropInConfigurationDTO.decode(readValue(buffer)!); - case 142: - return EncryptedCardDTO.decode(readValue(buffer)!); - case 143: - return ErrorDTO.decode(readValue(buffer)!); - case 144: - return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 145: - return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 146: - return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 147: - return MerchantInfoDTO.decode(readValue(buffer)!); - case 148: - return OrderCancelResultDTO.decode(readValue(buffer)!); - case 149: - return OrderResponseDTO.decode(readValue(buffer)!); - case 150: - return PaymentEventDTO.decode(readValue(buffer)!); - case 151: - return PaymentResultDTO.decode(readValue(buffer)!); - case 152: - return PaymentResultModelDTO.decode(readValue(buffer)!); - case 153: - return PlatformCommunicationModel.decode(readValue(buffer)!); - case 154: - return SessionDTO.decode(readValue(buffer)!); - case 155: - return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 156: - return UnencryptedCardDTO.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - class ComponentPlatformInterface { /// Constructor for [ComponentPlatformInterface]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - ComponentPlatformInterface({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; + ComponentPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = - _ComponentPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String __pigeon_messageChannelSuffix; Future updateViewHeight(int viewId) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2528,18 +2199,15 @@ class ComponentPlatformInterface { } } - Future onPaymentsResult( - String componentId, PaymentEventDTO paymentsResult) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onPaymentsResult(String componentId, PaymentEventDTO paymentsResult) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([componentId, paymentsResult]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([componentId, paymentsResult]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2553,18 +2221,15 @@ class ComponentPlatformInterface { } } - Future onPaymentsDetailsResult( - String componentId, PaymentEventDTO paymentsDetailsResult) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onPaymentsDetailsResult(String componentId, PaymentEventDTO paymentsDetailsResult) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([componentId, paymentsDetailsResult]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([componentId, paymentsDetailsResult]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2578,24 +2243,15 @@ class ComponentPlatformInterface { } } - Future isInstantPaymentSupportedByPlatform( - InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, - String paymentMethodResponse, - String componentId) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future isInstantPaymentSupportedByPlatform(InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, String paymentMethodResponse, String componentId) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([ - instantPaymentConfigurationDTO, - paymentMethodResponse, - componentId - ]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([instantPaymentConfigurationDTO, paymentMethodResponse, componentId]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2614,24 +2270,15 @@ class ComponentPlatformInterface { } } - Future onInstantPaymentPressed( - InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, - String encodedPaymentMethod, - String componentId) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future onInstantPaymentPressed(InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, String encodedPaymentMethod, String componentId) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([ - instantPaymentConfigurationDTO, - encodedPaymentMethod, - componentId - ]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([instantPaymentConfigurationDTO, encodedPaymentMethod, componentId]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2645,24 +2292,15 @@ class ComponentPlatformInterface { } } - Future handleAction( - ActionComponentConfigurationDTO actionComponentConfiguration, - String componentId, - Map? actionResponse) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future handleAction(ActionComponentConfigurationDTO actionComponentConfiguration, String componentId, Map? actionResponse) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([ - actionComponentConfiguration, - componentId, - actionResponse - ]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([actionComponentConfiguration, componentId, actionResponse]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2677,10 +2315,8 @@ class ComponentPlatformInterface { } Future onDispose(String componentId) async { - const String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2701,131 +2337,55 @@ class ComponentPlatformInterface { } } -class _ComponentFlutterInterfaceCodec extends StandardMessageCodec { - const _ComponentFlutterInterfaceCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is AmountDTO) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else if (value is CardComponentConfigurationDTO) { - buffer.putUint8(130); - writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { - buffer.putUint8(131); - writeValue(buffer, value.encode()); - } else if (value is ComponentCommunicationModel) { - buffer.putUint8(132); - writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { - buffer.putUint8(133); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { - buffer.putUint8(134); - writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { - buffer.putUint8(135); - writeValue(buffer, value.encode()); - } else if (value is SessionDTO) { - buffer.putUint8(136); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return AmountDTO.decode(readValue(buffer)!); - case 129: - return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 130: - return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 131: - return CardConfigurationDTO.decode(readValue(buffer)!); - case 132: - return ComponentCommunicationModel.decode(readValue(buffer)!); - case 133: - return OrderResponseDTO.decode(readValue(buffer)!); - case 134: - return PaymentResultDTO.decode(readValue(buffer)!); - case 135: - return PaymentResultModelDTO.decode(readValue(buffer)!); - case 136: - return SessionDTO.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - abstract class ComponentFlutterInterface { - static const MessageCodec pigeonChannelCodec = - _ComponentFlutterInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void _generateCodecForDTOs( - CardComponentConfigurationDTO cardComponentConfigurationDTO, - SessionDTO sessionDTO); + void _generateCodecForDTOs(CardComponentConfigurationDTO cardComponentConfigurationDTO, SessionDTO sessionDTO); - void onComponentCommunication( - ComponentCommunicationModel componentCommunicationModel); + void onComponentCommunication(ComponentCommunicationModel componentCommunicationModel); - static void setup(ComponentFlutterInterface? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp(ComponentFlutterInterface? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null.'); final List args = (message as List?)!; - final CardComponentConfigurationDTO? - arg_cardComponentConfigurationDTO = - (args[0] as CardComponentConfigurationDTO?); + final CardComponentConfigurationDTO? arg_cardComponentConfigurationDTO = (args[0] as CardComponentConfigurationDTO?); assert(arg_cardComponentConfigurationDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null CardComponentConfigurationDTO.'); final SessionDTO? arg_sessionDTO = (args[1] as SessionDTO?); assert(arg_sessionDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null SessionDTO.'); try { - api._generateCodecForDTOs( - arg_cardComponentConfigurationDTO!, arg_sessionDTO!); + api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, arg_sessionDTO!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication was null.'); final List args = (message as List?)!; - final ComponentCommunicationModel? arg_componentCommunicationModel = - (args[0] as ComponentCommunicationModel?); + final ComponentCommunicationModel? arg_componentCommunicationModel = (args[0] as ComponentCommunicationModel?); assert(arg_componentCommunicationModel != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication was null, expected non-null ComponentCommunicationModel.'); try { @@ -2833,9 +2393,8 @@ abstract class ComponentFlutterInterface { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/pigeons/platform_api.dart b/pigeons/platform_api.dart index 1f393903..175cd954 100644 --- a/pigeons/platform_api.dart +++ b/pigeons/platform_api.dart @@ -5,10 +5,13 @@ import 'package:pigeon/pigeon.dart'; dartOut: 'lib/src/generated/platform_api.g.dart', dartOptions: DartOptions(), kotlinOut: - 'android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt', - kotlinOptions: KotlinOptions(errorClassName: "AdyenPigeonError"), - swiftOut: 'ios/Classes/PlatformApi.swift', - swiftOptions: SwiftOptions(), + 'android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt', + kotlinOptions: KotlinOptions( + package: "com.adyen.checkout.flutter.generated", + errorClassName: "AdyenPigeonError", + ), + swiftOut: 'ios/Classes/generated/PlatformApi.swift', + swiftOptions: SwiftOptions(errorClassName: "AdyenPigeonError"), dartPackageName: 'adyen_checkout', )) enum Environment { diff --git a/pubspec.yaml b/pubspec.yaml index bd30ffb7..b81ffe9c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,21 +13,20 @@ topics: - online-payments environment: - sdk: ^3.0.6 - flutter: ">=3.10.6" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: sdk: flutter - plugin_platform_interface: ^2.1.7 - stream_transform: ^2.1.0 + plugin_platform_interface: ^2.1.8 pay: ^2.0.0 dev_dependencies: flutter_test: sdk: flutter flutter_lints: 3.0.1 - pigeon: 16.0.5 + pigeon: 21.1.0 flutter: assets: