From 73be47d6653da904cd704e7f146bbe2f729f045f Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Thu, 6 Mar 2025 10:45:59 +0100 Subject: [PATCH 1/4] Added binLookup to card component for Android --- .../components/card/BaseCardComponent.kt | 30 + .../checkout/flutter/generated/PlatformApi.kt | 4 +- .../card/card_advanced_component_screen.dart | 41 +- .../card/card_session_component_screen.dart | 41 +- .../components/card/adyen_card_component.dart | 2 + .../components/card/base_card_component.dart | 36 + .../card/card_advanced_component.dart | 1 + .../card/card_session_component.dart | 1 + lib/src/drop_in/drop_in.dart | 6 +- lib/src/generated/platform_api.g.dart | 625 +++++++----------- lib/src/util/dto_mapper.dart | 5 + pigeons/platform_api.dart | 2 + 12 files changed, 387 insertions(+), 407 deletions(-) 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 59b74311..bd3406f7 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 @@ -5,7 +5,10 @@ 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.BinLookupDataDTO import com.adyen.checkout.flutter.generated.CardComponentConfigurationDTO +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.ConfigurationMapper.mapToAmount import com.adyen.checkout.flutter.utils.ConfigurationMapper.mapToAnalyticsConfiguration @@ -49,11 +52,38 @@ abstract class BaseCardComponent( } fun addComponent(cardComponent: CardComponent) { + setOnBinLookupListener(cardComponent) + setOnBinValueListener(cardComponent) dynamicComponentView.addComponent(cardComponent, activity) } fun setCurrentCardComponent() = setCurrentCardComponent(this) + private fun setOnBinLookupListener(cardComponent: CardComponent) { + cardComponent.setOnBinLookupListener { binLookupData -> + val binLookupDataDtoList = binLookupData.map { BinLookupDataDTO(it.brand) } + val componentCommunicationModel = + ComponentCommunicationModel( + ComponentCommunicationType.BIN_LOOKUP, + componentId, + binLookupDataDtoList + ) + componentFlutterApi.onComponentCommunication(componentCommunicationModel) {} + } + } + + private fun setOnBinValueListener(cardComponent: CardComponent) { + cardComponent.setOnBinValueListener { binValue -> + val componentCommunicationModel = + ComponentCommunicationModel( + ComponentCommunicationType.BIN_VALUE, + componentId, + binValue + ) + componentFlutterApi.onComponentCommunication(componentCommunicationModel) {} + } + } + companion object { const val CARD_COMPONENT_CONFIGURATION_KEY = "cardComponentConfiguration" const val PAYMENT_METHOD_KEY = "paymentMethod" diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt index bd682a37..1ec36ef1 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/generated/PlatformApi.kt @@ -154,7 +154,9 @@ enum class ComponentCommunicationType(val raw: Int) { ADDITIONAL_DETAILS(1), LOADING(2), RESULT(3), - RESIZE(4); + RESIZE(4), + BIN_LOOKUP(5), + BIN_VALUE(6); companion object { fun ofRaw(raw: Int): ComponentCommunicationType? { diff --git a/example/lib/screens/component/card/card_advanced_component_screen.dart b/example/lib/screens/component/card/card_advanced_component_screen.dart index 2fb7d499..a34d0d6d 100644 --- a/example/lib/screens/component/card/card_advanced_component_screen.dart +++ b/example/lib/screens/component/card/card_advanced_component_screen.dart @@ -8,26 +8,31 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; class CardAdvancedComponentScreen extends StatelessWidget { - CardAdvancedComponentScreen({ + const CardAdvancedComponentScreen({ required this.repository, super.key, }); final AdyenCardComponentRepository repository; - final CardComponentConfiguration cardComponentConfiguration = - CardComponentConfiguration( - environment: Config.environment, - clientKey: Config.clientKey, - countryCode: Config.countryCode, - shopperLocale: Config.shopperLocale, - cardConfiguration: const CardConfiguration( - holderNameRequired: true, - addressMode: AddressMode.full, - ), - ); @override Widget build(BuildContext context) { + final CardComponentConfiguration cardComponentConfiguration = + CardComponentConfiguration( + environment: Config.environment, + clientKey: Config.clientKey, + countryCode: Config.countryCode, + shopperLocale: Config.shopperLocale, + cardConfiguration: CardConfiguration( + holderNameRequired: true, + addressMode: AddressMode.full, + cardCallbacks: CardCallbacks( + onBinLookup: _onBinLookup, + onBinValue: _onBinValue, + ), + ), + ); + return Scaffold( backgroundColor: Colors.white, appBar: AppBar(title: const Text('Adyen card component')), @@ -44,6 +49,7 @@ class CardAdvancedComponentScreen extends StatelessWidget { child: Column( children: [ _buildCardWidget( + cardComponentConfiguration, snapshot.data!, context, ), @@ -58,6 +64,7 @@ class CardAdvancedComponentScreen extends StatelessWidget { } Widget _buildCardWidget( + CardComponentConfiguration cardComponentConfiguration, Map paymentMethods, BuildContext context, ) { @@ -94,4 +101,14 @@ class CardAdvancedComponentScreen extends StatelessWidget { return paymentMethod; } + + void _onBinLookup(List binLookupData) { + for (var element in binLookupData) { + debugPrint("Bin lookup data: brand:${element.brand}"); + } + } + + void _onBinValue(String binValue) { + debugPrint("Bin value: $binValue"); + } } diff --git a/example/lib/screens/component/card/card_session_component_screen.dart b/example/lib/screens/component/card/card_session_component_screen.dart index c589183e..52552583 100644 --- a/example/lib/screens/component/card/card_session_component_screen.dart +++ b/example/lib/screens/component/card/card_session_component_screen.dart @@ -8,29 +8,35 @@ import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; class CardSessionComponentScreen extends StatelessWidget { - CardSessionComponentScreen({ + const CardSessionComponentScreen({ required this.repository, super.key, }); final AdyenCardComponentRepository repository; - final CardComponentConfiguration cardComponentConfiguration = - CardComponentConfiguration( - environment: Config.environment, - clientKey: Config.clientKey, - countryCode: Config.countryCode, - shopperLocale: Config.shopperLocale, - cardConfiguration: const CardConfiguration(), - ); @override Widget build(BuildContext context) { + final CardComponentConfiguration cardComponentConfiguration = + CardComponentConfiguration( + environment: Config.environment, + clientKey: Config.clientKey, + countryCode: Config.countryCode, + shopperLocale: Config.shopperLocale, + cardConfiguration: CardConfiguration( + cardCallbacks: CardCallbacks( + onBinLookup: _onBinLookup, + onBinValue: _onBinValue, + ), + ), + ); + return Scaffold( backgroundColor: Colors.white, appBar: AppBar(title: const Text('Adyen card component')), body: SafeArea( child: FutureBuilder( - future: _getSessionCheckout(), + future: _getSessionCheckout(cardComponentConfiguration), builder: (BuildContext context, AsyncSnapshot snapshot) { if (snapshot.hasData) { @@ -63,8 +69,9 @@ class CardSessionComponentScreen extends StatelessWidget { ); } - Future _getSessionCheckout() async => - await repository.createSessionCheckout(cardComponentConfiguration); + Future _getSessionCheckout( + CardComponentConfiguration configuration) async => + await repository.createSessionCheckout(configuration); Map _extractPaymentMethod( Map paymentMethods) { @@ -86,4 +93,14 @@ class CardSessionComponentScreen extends StatelessWidget { return paymentMethod; } + + void _onBinLookup(List binLookupData) { + for (var element in binLookupData) { + debugPrint("Bin lookup data: brand:${element.brand}"); + } + } + + void _onBinValue(String binValue) { + debugPrint("Bin value: $binValue"); + } } diff --git a/lib/src/components/card/adyen_card_component.dart b/lib/src/components/card/adyen_card_component.dart index abb3c982..a0adfaf5 100644 --- a/lib/src/components/card/adyen_card_component.dart +++ b/lib/src/components/card/adyen_card_component.dart @@ -66,6 +66,7 @@ class AdyenCardComponent extends StatelessWidget { onPaymentResult: onPaymentResult, initialViewHeight: initialHeight, isStoredPaymentMethod: isStoredPaymentMethod, + cardCallbacks: configuration.cardConfiguration.cardCallbacks, ); } @@ -87,6 +88,7 @@ class AdyenCardComponent extends StatelessWidget { initialViewHeight: initialHeight, isStoredPaymentMethod: isStoredPaymentMethod, gestureRecognizers: gestureRecognizers, + cardCallbacks: configuration.cardConfiguration.cardCallbacks, ); } diff --git a/lib/src/components/card/base_card_component.dart b/lib/src/components/card/base_card_component.dart index 1e096fc4..5de13d54 100644 --- a/lib/src/components/card/base_card_component.dart +++ b/lib/src/components/card/base_card_component.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:adyen_checkout/src/common/model/card_callbacks/card_callbacks.dart'; import 'package:adyen_checkout/src/common/model/payment_result.dart'; import 'package:adyen_checkout/src/components/card/card_component_container.dart'; import 'package:adyen_checkout/src/components/component_flutter_api.dart'; @@ -8,6 +9,7 @@ import 'package:adyen_checkout/src/components/platform/android_platform_view.dar import 'package:adyen_checkout/src/components/platform/ios_platform_view.dart'; import 'package:adyen_checkout/src/generated/platform_api.g.dart'; import 'package:adyen_checkout/src/logging/adyen_logger.dart'; +import 'package:adyen_checkout/src/util/dto_mapper.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; @@ -21,6 +23,7 @@ abstract class BaseCardComponent extends StatefulWidget { final bool isStoredPaymentMethod; final Set>? gestureRecognizers; final AdyenLogger adyenLogger; + final CardCallbacksInterface? cardCallbacks; abstract final String componentId; abstract final Map creationParams; abstract final String viewType; @@ -34,6 +37,7 @@ abstract class BaseCardComponent extends StatefulWidget { required this.isStoredPaymentMethod, this.gestureRecognizers, AdyenLogger? adyenLogger, + this.cardCallbacks, }) : adyenLogger = adyenLogger ?? AdyenLogger.instance; void handleComponentCommunication(ComponentCommunicationModel event); @@ -138,6 +142,10 @@ class _BaseCardComponentState extends State { _resizeViewport(event); } else if (event.type case ComponentCommunicationType.result) { widget.onResult(event); + } else if (event.type case ComponentCommunicationType.binLookup) { + _handleOnBinLookup(event, widget.cardCallbacks?.onBinLookup); + } else if (event.type case ComponentCommunicationType.binValue) { + _handleOnBinValue(event, widget.cardCallbacks?.onBinValue); } else { widget.handleComponentCommunication(event); } @@ -153,4 +161,32 @@ class _BaseCardComponentState extends State { }); } } + + void _handleOnBinLookup( + ComponentCommunicationModel event, + Function? binLookupCallback, + ) { + if (binLookupCallback == null) { + return; + } + + if (event.data case List binLookupDataDTOList) { + binLookupCallback.call(binLookupDataDTOList + .whereType() + .toBinLookupDataList()); + } + } + + void _handleOnBinValue( + ComponentCommunicationModel event, + Function? binValueCallback, + ) { + if (binValueCallback == null) { + return; + } + + if (event.data case String binValue) { + binValueCallback.call(binValue); + } + } } diff --git a/lib/src/components/card/card_advanced_component.dart b/lib/src/components/card/card_advanced_component.dart index 9a8e0b7d..40c66856 100644 --- a/lib/src/components/card/card_advanced_component.dart +++ b/lib/src/components/card/card_advanced_component.dart @@ -29,6 +29,7 @@ class CardAdvancedComponent extends BaseCardComponent { required super.isStoredPaymentMethod, super.gestureRecognizers, super.adyenLogger, + super.cardCallbacks, PaymentEventHandler? paymentEventHandler, }) : paymentEventHandler = paymentEventHandler ?? PaymentEventHandler(); diff --git a/lib/src/components/card/card_session_component.dart b/lib/src/components/card/card_session_component.dart index bd5de65c..1f327996 100644 --- a/lib/src/components/card/card_session_component.dart +++ b/lib/src/components/card/card_session_component.dart @@ -25,6 +25,7 @@ class CardSessionComponent extends BaseCardComponent { required super.isStoredPaymentMethod, super.gestureRecognizers, super.adyenLogger, + super.cardCallbacks, }); @override diff --git a/lib/src/drop_in/drop_in.dart b/lib/src/drop_in/drop_in.dart index bd89810f..8182dd8c 100644 --- a/lib/src/drop_in/drop_in.dart +++ b/lib/src/drop_in/drop_in.dart @@ -366,11 +366,9 @@ class DropIn { } if (event.data case List binLookupDataDTOList) { - final List binLookupDataList = binLookupDataDTOList + binLookupCallback.call(binLookupDataDTOList .whereType() - .map((entry) => BinLookupData(brand: entry.brand)) - .toList(); - binLookupCallback.call(binLookupDataList); + .toBinLookupDataList()); } } diff --git a/lib/src/generated/platform_api.g.dart b/lib/src/generated/platform_api.g.dart index f0e18b43..4d41c5b1 100644 --- a/lib/src/generated/platform_api.g.dart +++ b/lib/src/generated/platform_api.g.dart @@ -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 []; } @@ -86,6 +85,8 @@ enum ComponentCommunicationType { loading, result, resize, + binLookup, + binValue, } enum PaymentEventType { @@ -318,8 +319,7 @@ class DropInConfigurationDTO { 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, ); } @@ -452,18 +452,14 @@ 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(), + summaryItems: (result[3] as List?)?.cast(), + requiredBillingContactFields: (result[4] as List?)?.cast(), billingContact: result[5] as ApplePayContactDTO?, - requiredShippingContactFields: - (result[6] as List?)?.cast(), + 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] as ApplePayMerchantCapability?, @@ -1368,10 +1364,8 @@ 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(), ); } } @@ -1397,6 +1391,7 @@ class BinLookupDataDTO { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -1404,145 +1399,145 @@ class _PigeonCodec extends StandardMessageCodec { if (value is SessionDTO) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is AmountDTO) { + } else if (value is AmountDTO) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { + } else if (value is AnalyticsOptionsDTO) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is DropInConfigurationDTO) { + } else if (value is DropInConfigurationDTO) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { + } else if (value is CardConfigurationDTO) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is ApplePayConfigurationDTO) { + } else if (value is ApplePayConfigurationDTO) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is ApplePayContactDTO) { + } else if (value is ApplePayContactDTO) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is ApplePayShippingMethodDTO) { + } else if (value is ApplePayShippingMethodDTO) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is ApplePaySummaryItemDTO) { + } else if (value is ApplePaySummaryItemDTO) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is GooglePayConfigurationDTO) { + } else if (value is GooglePayConfigurationDTO) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is MerchantInfoDTO) { + } else if (value is MerchantInfoDTO) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is ShippingAddressParametersDTO) { + } else if (value is ShippingAddressParametersDTO) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is BillingAddressParametersDTO) { + } else if (value is BillingAddressParametersDTO) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is CashAppPayConfigurationDTO) { + } else if (value is CashAppPayConfigurationDTO) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { + } else if (value is PaymentResultDTO) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { + } else if (value is PaymentResultModelDTO) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { + } else if (value is OrderResponseDTO) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is CheckoutEvent) { + } else if (value is CheckoutEvent) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is ComponentCommunicationModel) { + } else if (value is ComponentCommunicationModel) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PaymentEventDTO) { + } else if (value is PaymentEventDTO) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is ErrorDTO) { + } else if (value is ErrorDTO) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is DeletedStoredPaymentMethodResultDTO) { + } else if (value is DeletedStoredPaymentMethodResultDTO) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is CardComponentConfigurationDTO) { + } else if (value is CardComponentConfigurationDTO) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentConfigurationDTO) { + } else if (value is InstantPaymentConfigurationDTO) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentSetupResultDTO) { + } else if (value is InstantPaymentSetupResultDTO) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is UnencryptedCardDTO) { + } else if (value is UnencryptedCardDTO) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is EncryptedCardDTO) { + } else if (value is EncryptedCardDTO) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is ActionComponentConfigurationDTO) { + } else if (value is ActionComponentConfigurationDTO) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is OrderCancelResultDTO) { + } else if (value is OrderCancelResultDTO) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is BinLookupDataDTO) { + } else if (value is BinLookupDataDTO) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is Environment) { + } else if (value is Environment) { buffer.putUint8(159); writeValue(buffer, value.index); - } else if (value is AddressMode) { + } else if (value is AddressMode) { buffer.putUint8(160); writeValue(buffer, value.index); - } else if (value is CardAuthMethod) { + } else if (value is CardAuthMethod) { buffer.putUint8(161); writeValue(buffer, value.index); - } else if (value is TotalPriceStatus) { + } else if (value is TotalPriceStatus) { buffer.putUint8(162); writeValue(buffer, value.index); - } else if (value is GooglePayEnvironment) { + } else if (value is GooglePayEnvironment) { buffer.putUint8(163); writeValue(buffer, value.index); - } else if (value is CashAppPayEnvironment) { + } else if (value is CashAppPayEnvironment) { buffer.putUint8(164); writeValue(buffer, value.index); - } else if (value is PaymentResultEnum) { + } else if (value is PaymentResultEnum) { buffer.putUint8(165); writeValue(buffer, value.index); - } else if (value is CheckoutEventType) { + } else if (value is CheckoutEventType) { buffer.putUint8(166); writeValue(buffer, value.index); - } else if (value is ComponentCommunicationType) { + } else if (value is ComponentCommunicationType) { buffer.putUint8(167); writeValue(buffer, value.index); - } else if (value is PaymentEventType) { + } else if (value is PaymentEventType) { buffer.putUint8(168); writeValue(buffer, value.index); - } else if (value is FieldVisibility) { + } else if (value is FieldVisibility) { buffer.putUint8(169); writeValue(buffer, value.index); - } else if (value is InstantPaymentType) { + } else if (value is InstantPaymentType) { buffer.putUint8(170); writeValue(buffer, value.index); - } else if (value is ApplePayShippingType) { + } else if (value is ApplePayShippingType) { buffer.putUint8(171); writeValue(buffer, value.index); - } else if (value is ApplePayMerchantCapability) { + } else if (value is ApplePayMerchantCapability) { buffer.putUint8(172); writeValue(buffer, value.index); - } else if (value is ApplePaySummaryItemType) { + } else if (value is ApplePaySummaryItemType) { buffer.putUint8(173); writeValue(buffer, value.index); - } else if (value is CardNumberValidationResultDTO) { + } else if (value is CardNumberValidationResultDTO) { buffer.putUint8(174); writeValue(buffer, value.index); - } else if (value is CardExpiryDateValidationResultDTO) { + } else if (value is CardExpiryDateValidationResultDTO) { buffer.putUint8(175); writeValue(buffer, value.index); - } else if (value is CardSecurityCodeValidationResultDTO) { + } else if (value is CardSecurityCodeValidationResultDTO) { buffer.putUint8(176); writeValue(buffer, value.index); } else { @@ -1553,126 +1548,120 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: return SessionDTO.decode(readValue(buffer)!); - case 130: + case 130: return AmountDTO.decode(readValue(buffer)!); - case 131: + case 131: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 132: + case 132: return DropInConfigurationDTO.decode(readValue(buffer)!); - case 133: + case 133: return CardConfigurationDTO.decode(readValue(buffer)!); - case 134: + case 134: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 135: + case 135: return ApplePayContactDTO.decode(readValue(buffer)!); - case 136: + case 136: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 137: + case 137: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 138: + case 138: return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 139: + case 139: return MerchantInfoDTO.decode(readValue(buffer)!); - case 140: + case 140: return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 141: + case 141: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 142: + case 142: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 143: + case 143: return PaymentResultDTO.decode(readValue(buffer)!); - case 144: + case 144: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 145: + case 145: return OrderResponseDTO.decode(readValue(buffer)!); - case 146: + case 146: return CheckoutEvent.decode(readValue(buffer)!); - case 147: + case 147: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 148: + case 148: return PaymentEventDTO.decode(readValue(buffer)!); - case 149: + case 149: return ErrorDTO.decode(readValue(buffer)!); - case 150: + case 150: return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 151: + case 151: return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 152: + case 152: return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 153: + case 153: return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 154: + case 154: return UnencryptedCardDTO.decode(readValue(buffer)!); - case 155: + case 155: return EncryptedCardDTO.decode(readValue(buffer)!); - case 156: + case 156: return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 157: + case 157: return OrderCancelResultDTO.decode(readValue(buffer)!); - case 158: + case 158: return BinLookupDataDTO.decode(readValue(buffer)!); - case 159: + case 159: final int? value = readValue(buffer) as int?; return value == null ? null : Environment.values[value]; - case 160: + case 160: final int? value = readValue(buffer) as int?; return value == null ? null : AddressMode.values[value]; - case 161: + case 161: final int? value = readValue(buffer) as int?; return value == null ? null : CardAuthMethod.values[value]; - case 162: + case 162: final int? value = readValue(buffer) as int?; return value == null ? null : TotalPriceStatus.values[value]; - case 163: + case 163: final int? value = readValue(buffer) as int?; return value == null ? null : GooglePayEnvironment.values[value]; - case 164: + case 164: final int? value = readValue(buffer) as int?; return value == null ? null : CashAppPayEnvironment.values[value]; - case 165: + case 165: final int? value = readValue(buffer) as int?; return value == null ? null : PaymentResultEnum.values[value]; - case 166: + case 166: final int? value = readValue(buffer) as int?; return value == null ? null : CheckoutEventType.values[value]; - case 167: + case 167: final int? value = readValue(buffer) as int?; return value == null ? null : ComponentCommunicationType.values[value]; - case 168: + case 168: final int? value = readValue(buffer) as int?; return value == null ? null : PaymentEventType.values[value]; - case 169: + case 169: final int? value = readValue(buffer) as int?; return value == null ? null : FieldVisibility.values[value]; - case 170: + case 170: final int? value = readValue(buffer) as int?; return value == null ? null : InstantPaymentType.values[value]; - case 171: + case 171: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePayShippingType.values[value]; - case 172: + case 172: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePayMerchantCapability.values[value]; - case 173: + case 173: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePaySummaryItemType.values[value]; - case 174: + case 174: final int? value = readValue(buffer) as int?; - return value == null - ? null - : CardNumberValidationResultDTO.values[value]; - case 175: + return value == null ? null : CardNumberValidationResultDTO.values[value]; + case 175: final int? value = readValue(buffer) as int?; - return value == null - ? null - : CardExpiryDateValidationResultDTO.values[value]; - case 176: + return value == null ? null : CardExpiryDateValidationResultDTO.values[value]; + case 176: final int? value = readValue(buffer) as int?; - return value == null - ? null - : CardSecurityCodeValidationResultDTO.values[value]; + return value == null ? null : CardSecurityCodeValidationResultDTO.values[value]; default: return super.readValueOfType(type, buffer); } @@ -1683,11 +1672,9 @@ 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, String messageChannelSuffix = ''}) + CheckoutPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -1695,10 +1682,8 @@ class CheckoutPlatformInterface { final String __pigeon_messageChannelSuffix; Future getReturnUrl() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl$__pigeon_messageChannelSuffix'; - 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, @@ -1723,19 +1708,15 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1755,10 +1736,8 @@ class CheckoutPlatformInterface { } Future clearSession() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession$__pigeon_messageChannelSuffix'; - 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, @@ -1778,18 +1757,15 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1809,16 +1785,14 @@ class CheckoutPlatformInterface { } Future encryptBin(String bin, String publicKey) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin$__pigeon_messageChannelSuffix'; - 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) { @@ -1837,18 +1811,15 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1867,18 +1838,15 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1897,18 +1865,15 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1928,16 +1893,14 @@ class CheckoutPlatformInterface { } Future enableConsoleLogging(bool loggingEnabled) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging$__pigeon_messageChannelSuffix'; - 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) { @@ -1956,29 +1919,24 @@ 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, String messageChannelSuffix = ''}) + DropInPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); 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( + 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) { @@ -1992,19 +1950,15 @@ class DropInPlatformInterface { } } - 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( + 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) { @@ -2019,16 +1973,14 @@ class DropInPlatformInterface { } Future onPaymentsResult(PaymentEventDTO paymentsResult) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2042,18 +1994,15 @@ class DropInPlatformInterface { } } - Future onPaymentsDetailsResult( - PaymentEventDTO paymentsDetailsResult) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2067,19 +2016,15 @@ class DropInPlatformInterface { } } - Future onDeleteStoredPaymentMethodResult( - DeletedStoredPaymentMethodResultDTO - deleteStoredPaymentMethodResultDTO) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2094,16 +2039,14 @@ class DropInPlatformInterface { } Future onBalanceCheckResult(String balanceCheckResponse) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2118,16 +2061,14 @@ class DropInPlatformInterface { } Future onOrderRequestResult(String orderRequestResponse) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2141,18 +2082,15 @@ class DropInPlatformInterface { } } - Future onOrderCancelResult( - OrderCancelResultDTO orderCancelResult) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2167,10 +2105,8 @@ class DropInPlatformInterface { } Future cleanUpDropIn() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn$__pigeon_messageChannelSuffix'; - 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, @@ -2196,25 +2132,18 @@ abstract class CheckoutFlutterInterface { void send(CheckoutEvent event); - static void setUp( - CheckoutFlutterInterface? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CheckoutFlutterInterface? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send$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.CheckoutFlutterInterface.send was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send was null.'); final List args = (message as List?)!; final CheckoutEvent? arg_event = (args[0] as CheckoutEvent?); assert(arg_event != null, @@ -2224,9 +2153,8 @@ abstract class CheckoutFlutterInterface { 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())); } }); } @@ -2238,11 +2166,9 @@ 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, String messageChannelSuffix = ''}) + ComponentPlatformInterface({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -2250,10 +2176,8 @@ class ComponentPlatformInterface { final String __pigeon_messageChannelSuffix; Future updateViewHeight(int viewId) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight$__pigeon_messageChannelSuffix'; - 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, @@ -2273,18 +2197,15 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2298,18 +2219,15 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2323,24 +2241,15 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2359,24 +2268,15 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2390,24 +2290,15 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2422,10 +2313,8 @@ class ComponentPlatformInterface { } Future onDispose(String componentId) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose$__pigeon_messageChannelSuffix'; - 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, @@ -2449,74 +2338,55 @@ class ComponentPlatformInterface { abstract class ComponentFlutterInterface { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void _generateCodecForDTOs( - CardComponentConfigurationDTO cardComponentConfigurationDTO, - SessionDTO sessionDTO, - BinLookupDataDTO binLookupDataDTO); - - void onComponentCommunication( - ComponentCommunicationModel componentCommunicationModel); - - static void setUp( - ComponentFlutterInterface? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + void _generateCodecForDTOs(CardComponentConfigurationDTO cardComponentConfigurationDTO, SessionDTO sessionDTO, BinLookupDataDTO binLookupDataDTO); + + void onComponentCommunication(ComponentCommunicationModel componentCommunicationModel); + + 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$messageChannelSuffix', - 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.'); - final BinLookupDataDTO? arg_binLookupDataDTO = - (args[2] as BinLookupDataDTO?); + final BinLookupDataDTO? arg_binLookupDataDTO = (args[2] as BinLookupDataDTO?); assert(arg_binLookupDataDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null BinLookupDataDTO.'); try { - api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, - arg_sessionDTO!, arg_binLookupDataDTO!); + api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, arg_sessionDTO!, arg_binLookupDataDTO!); 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$messageChannelSuffix', - 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 { @@ -2524,9 +2394,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/lib/src/util/dto_mapper.dart b/lib/src/util/dto_mapper.dart index 2021a7e2..7bdd6ac4 100644 --- a/lib/src/util/dto_mapper.dart +++ b/lib/src/util/dto_mapper.dart @@ -313,3 +313,8 @@ extension OrderCancelResponseMapper on OrderCancelResult { updatedPaymentMethodsResponseBody: updatedPaymentMethodsResponseBody, ); } + +extension BinLookupDataMapper on Iterable { + List toBinLookupDataList() => + map((entry) => BinLookupData(brand: entry.brand)).toList(); +} diff --git a/pigeons/platform_api.dart b/pigeons/platform_api.dart index a7226cfd..55d6f56f 100644 --- a/pigeons/platform_api.dart +++ b/pigeons/platform_api.dart @@ -74,6 +74,8 @@ enum ComponentCommunicationType { loading, result, resize, + binLookup, + binValue } enum PaymentEventType { From 7453ea0c139e81c3c2d3077b394e528b845111d0 Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Thu, 6 Mar 2025 11:43:35 +0100 Subject: [PATCH 2/4] Added bin lookup for card component on iOS --- .../components/card/BaseCardComponent.swift | 50 ++ .../card/advanced/CardAdvancedComponent.swift | 22 +- .../card/session/CardSessionComponent.swift | 23 +- ios/Classes/generated/PlatformApi.swift | 2 + lib/src/generated/platform_api.g.dart | 623 +++++++++++------- 5 files changed, 441 insertions(+), 279 deletions(-) diff --git a/ios/Classes/components/card/BaseCardComponent.swift b/ios/Classes/components/card/BaseCardComponent.swift index fa9ddec5..5b98f6d3 100644 --- a/ios/Classes/components/card/BaseCardComponent.swift +++ b/ios/Classes/components/card/BaseCardComponent.swift @@ -55,6 +55,20 @@ class BaseCardComponent: NSObject, FlutterPlatformView, UIScrollViewDelegate { return rootViewController } + + func buildCardComponent( + paymentMethodString: String, + isStoredPaymentMethod: Bool, + cardComponentConfiguration: CardComponentConfigurationDTO, + adyenContext: AdyenContext + ) throws -> CardComponent { + let cardConfiguration = cardComponentConfiguration.cardConfiguration.mapToCardComponentConfiguration( + shopperLocale: cardComponentConfiguration.shopperLocale) + let paymentMethod: AnyCardPaymentMethod = isStoredPaymentMethod + ? try JSONDecoder().decode(StoredCardPaymentMethod.self, from: Data(paymentMethodString.utf8)) + : try JSONDecoder().decode(CardPaymentMethod.self, from: Data(paymentMethodString.utf8)) + return CardComponent(paymentMethod: paymentMethod, context: adyenContext, configuration: cardConfiguration) + } func showCardComponent(cardComponent: CardComponent) { self.cardComponent = cardComponent @@ -149,3 +163,39 @@ class BaseCardComponent: NSObject, FlutterPlatformView, UIScrollViewDelegate { } } } + +extension BaseCardComponent: CardComponentDelegate { + func didSubmit(lastFour: String, finalBIN: String, component: Adyen.CardComponent) {} + + func didChangeBIN(_ value: String, component: Adyen.CardComponent) { + let componentCommunicationModel = ComponentCommunicationModel( + type: ComponentCommunicationType.binValue, + componentId: componentId, + data: value + ) + componentFlutterApi.onComponentCommunication( + componentCommunicationModel: componentCommunicationModel, + completion: { _ in } + ) + } + + func didChangeCardBrand(_ value: [Adyen.CardBrand]?, component: Adyen.CardComponent) { + guard let binLookupData = value else { + return + } + + let binLookupDataDtoList: [BinLookupDataDTO] = binLookupData.map { cardBrand in + BinLookupDataDTO(brand: cardBrand.type.rawValue) + } + + let componentCommunicationModel = ComponentCommunicationModel( + type: ComponentCommunicationType.binLookup, + componentId: componentId, + data: binLookupDataDtoList + ) + componentFlutterApi.onComponentCommunication( + componentCommunicationModel: componentCommunicationModel, + completion: { _ in } + ) + } +} diff --git a/ios/Classes/components/card/advanced/CardAdvancedComponent.swift b/ios/Classes/components/card/advanced/CardAdvancedComponent.swift index ad88bfa5..de260751 100644 --- a/ios/Classes/components/card/advanced/CardAdvancedComponent.swift +++ b/ios/Classes/components/card/advanced/CardAdvancedComponent.swift @@ -53,31 +53,21 @@ class CardAdvancedComponent: BaseCardComponent { private func setupCardComponent() throws -> CardComponent { guard let cardComponentConfiguration else { throw PlatformError(errorDescription: "Card configuration not found") } guard let paymentMethodString = paymentMethod else { throw PlatformError(errorDescription: "Payment method not found") } + let adyenContext = try cardComponentConfiguration.createAdyenContext() let cardComponent = try buildCardComponent( paymentMethodString: paymentMethodString, isStoredPaymentMethod: isStoredPaymentMethod, - cardComponentConfiguration: cardComponentConfiguration + cardComponentConfiguration: cardComponentConfiguration, + adyenContext: adyenContext ) + + actionComponent = buildActionComponent(adyenContext: adyenContext) cardDelegate = CardAdvancedFlowDelegate(componentFlutterApi: componentFlutterApi, componentId: componentId) cardComponent.delegate = cardDelegate + cardComponent.cardComponentDelegate = self return cardComponent } - private func buildCardComponent( - paymentMethodString: String, - isStoredPaymentMethod: Bool, - cardComponentConfiguration: CardComponentConfigurationDTO - ) throws -> CardComponent { - let adyenContext = try cardComponentConfiguration.createAdyenContext() - let cardConfiguration = cardComponentConfiguration.cardConfiguration.mapToCardComponentConfiguration( - shopperLocale: cardComponentConfiguration.shopperLocale) - let paymentMethod: AnyCardPaymentMethod = isStoredPaymentMethod - ? try JSONDecoder().decode(StoredCardPaymentMethod.self, from: Data(paymentMethodString.utf8)) - : try JSONDecoder().decode(CardPaymentMethod.self, from: Data(paymentMethodString.utf8)) - actionComponent = buildActionComponent(adyenContext: adyenContext) - return CardComponent(paymentMethod: paymentMethod, context: adyenContext, configuration: cardConfiguration) - } - private func buildActionComponent(adyenContext: AdyenContext) -> AdyenActionComponent { let actionComponent = AdyenActionComponent(context: adyenContext) actionComponent.delegate = actionComponentDelegate diff --git a/ios/Classes/components/card/session/CardSessionComponent.swift b/ios/Classes/components/card/session/CardSessionComponent.swift index e3604319..16ef8af0 100644 --- a/ios/Classes/components/card/session/CardSessionComponent.swift +++ b/ios/Classes/components/card/session/CardSessionComponent.swift @@ -42,31 +42,18 @@ class CardSessionComponent: BaseCardComponent { guard let cardComponentConfiguration else { throw PlatformError(errorDescription: "Card configuration not found") } guard let paymentMethodString = paymentMethod else { throw PlatformError(errorDescription: "Payment method not found") } guard let session = sessionHolder.session else { throw PlatformError(errorDescription: "Session not found") } + let adyenContext = try cardComponentConfiguration.createAdyenContext() let cardComponent = try buildCardComponent( paymentMethodString: paymentMethodString, - cardComponentConfiguration: cardComponentConfiguration + isStoredPaymentMethod: isStoredPaymentMethod, + cardComponentConfiguration: cardComponentConfiguration, + adyenContext: adyenContext ) cardComponent.delegate = session + cardComponent.cardComponentDelegate = self return cardComponent } - private func buildCardComponent( - paymentMethodString: String, - cardComponentConfiguration: CardComponentConfigurationDTO - ) throws -> CardComponent { - let cardPaymentMethod: AnyCardPaymentMethod = isStoredPaymentMethod - ? try JSONDecoder().decode(StoredCardPaymentMethod.self, from: Data(paymentMethodString.utf8)) - : try JSONDecoder().decode(CardPaymentMethod.self, from: Data(paymentMethodString.utf8)) - let adyenContext = try cardComponentConfiguration.createAdyenContext() - let cardConfiguration = cardComponentConfiguration.cardConfiguration.mapToCardComponentConfiguration( - shopperLocale: cardComponentConfiguration.shopperLocale) - return CardComponent( - paymentMethod: cardPaymentMethod, - context: adyenContext, - configuration: cardConfiguration - ) - } - private func setupSessionFlowDelegate() { if let componentSessionFlowDelegate = (sessionHolder.sessionDelegate as? ComponentSessionFlowHandler) { componentSessionFlowDelegate.finalizeCallback = finalizeAndDismissSessionComponent diff --git a/ios/Classes/generated/PlatformApi.swift b/ios/Classes/generated/PlatformApi.swift index 50e7c38b..08e4c5cc 100644 --- a/ios/Classes/generated/PlatformApi.swift +++ b/ios/Classes/generated/PlatformApi.swift @@ -127,6 +127,8 @@ enum ComponentCommunicationType: Int { case loading = 2 case result = 3 case resize = 4 + case binLookup = 5 + case binValue = 6 } enum PaymentEventType: Int { diff --git a/lib/src/generated/platform_api.g.dart b/lib/src/generated/platform_api.g.dart index 4d41c5b1..4220c743 100644 --- a/lib/src/generated/platform_api.g.dart +++ b/lib/src/generated/platform_api.g.dart @@ -15,7 +15,8 @@ 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 []; } @@ -319,7 +320,8 @@ class DropInConfigurationDTO { 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, ); } @@ -452,14 +454,18 @@ 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(), + summaryItems: + (result[3] as List?)?.cast(), + requiredBillingContactFields: + (result[4] as List?)?.cast(), billingContact: result[5] as ApplePayContactDTO?, - requiredShippingContactFields: (result[6] as List?)?.cast(), + 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] as ApplePayMerchantCapability?, @@ -1364,8 +1370,10 @@ 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(), ); } } @@ -1391,7 +1399,6 @@ class BinLookupDataDTO { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -1399,145 +1406,145 @@ class _PigeonCodec extends StandardMessageCodec { if (value is SessionDTO) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is AmountDTO) { + } else if (value is AmountDTO) { buffer.putUint8(130); writeValue(buffer, value.encode()); - } else if (value is AnalyticsOptionsDTO) { + } else if (value is AnalyticsOptionsDTO) { buffer.putUint8(131); writeValue(buffer, value.encode()); - } else if (value is DropInConfigurationDTO) { + } else if (value is DropInConfigurationDTO) { buffer.putUint8(132); writeValue(buffer, value.encode()); - } else if (value is CardConfigurationDTO) { + } else if (value is CardConfigurationDTO) { buffer.putUint8(133); writeValue(buffer, value.encode()); - } else if (value is ApplePayConfigurationDTO) { + } else if (value is ApplePayConfigurationDTO) { buffer.putUint8(134); writeValue(buffer, value.encode()); - } else if (value is ApplePayContactDTO) { + } else if (value is ApplePayContactDTO) { buffer.putUint8(135); writeValue(buffer, value.encode()); - } else if (value is ApplePayShippingMethodDTO) { + } else if (value is ApplePayShippingMethodDTO) { buffer.putUint8(136); writeValue(buffer, value.encode()); - } else if (value is ApplePaySummaryItemDTO) { + } else if (value is ApplePaySummaryItemDTO) { buffer.putUint8(137); writeValue(buffer, value.encode()); - } else if (value is GooglePayConfigurationDTO) { + } else if (value is GooglePayConfigurationDTO) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is MerchantInfoDTO) { + } else if (value is MerchantInfoDTO) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is ShippingAddressParametersDTO) { + } else if (value is ShippingAddressParametersDTO) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is BillingAddressParametersDTO) { + } else if (value is BillingAddressParametersDTO) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is CashAppPayConfigurationDTO) { + } else if (value is CashAppPayConfigurationDTO) { buffer.putUint8(142); writeValue(buffer, value.encode()); - } else if (value is PaymentResultDTO) { + } else if (value is PaymentResultDTO) { buffer.putUint8(143); writeValue(buffer, value.encode()); - } else if (value is PaymentResultModelDTO) { + } else if (value is PaymentResultModelDTO) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is OrderResponseDTO) { + } else if (value is OrderResponseDTO) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is CheckoutEvent) { + } else if (value is CheckoutEvent) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is ComponentCommunicationModel) { + } else if (value is ComponentCommunicationModel) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PaymentEventDTO) { + } else if (value is PaymentEventDTO) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is ErrorDTO) { + } else if (value is ErrorDTO) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is DeletedStoredPaymentMethodResultDTO) { + } else if (value is DeletedStoredPaymentMethodResultDTO) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is CardComponentConfigurationDTO) { + } else if (value is CardComponentConfigurationDTO) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentConfigurationDTO) { + } else if (value is InstantPaymentConfigurationDTO) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is InstantPaymentSetupResultDTO) { + } else if (value is InstantPaymentSetupResultDTO) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is UnencryptedCardDTO) { + } else if (value is UnencryptedCardDTO) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is EncryptedCardDTO) { + } else if (value is EncryptedCardDTO) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is ActionComponentConfigurationDTO) { + } else if (value is ActionComponentConfigurationDTO) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is OrderCancelResultDTO) { + } else if (value is OrderCancelResultDTO) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is BinLookupDataDTO) { + } else if (value is BinLookupDataDTO) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is Environment) { + } else if (value is Environment) { buffer.putUint8(159); writeValue(buffer, value.index); - } else if (value is AddressMode) { + } else if (value is AddressMode) { buffer.putUint8(160); writeValue(buffer, value.index); - } else if (value is CardAuthMethod) { + } else if (value is CardAuthMethod) { buffer.putUint8(161); writeValue(buffer, value.index); - } else if (value is TotalPriceStatus) { + } else if (value is TotalPriceStatus) { buffer.putUint8(162); writeValue(buffer, value.index); - } else if (value is GooglePayEnvironment) { + } else if (value is GooglePayEnvironment) { buffer.putUint8(163); writeValue(buffer, value.index); - } else if (value is CashAppPayEnvironment) { + } else if (value is CashAppPayEnvironment) { buffer.putUint8(164); writeValue(buffer, value.index); - } else if (value is PaymentResultEnum) { + } else if (value is PaymentResultEnum) { buffer.putUint8(165); writeValue(buffer, value.index); - } else if (value is CheckoutEventType) { + } else if (value is CheckoutEventType) { buffer.putUint8(166); writeValue(buffer, value.index); - } else if (value is ComponentCommunicationType) { + } else if (value is ComponentCommunicationType) { buffer.putUint8(167); writeValue(buffer, value.index); - } else if (value is PaymentEventType) { + } else if (value is PaymentEventType) { buffer.putUint8(168); writeValue(buffer, value.index); - } else if (value is FieldVisibility) { + } else if (value is FieldVisibility) { buffer.putUint8(169); writeValue(buffer, value.index); - } else if (value is InstantPaymentType) { + } else if (value is InstantPaymentType) { buffer.putUint8(170); writeValue(buffer, value.index); - } else if (value is ApplePayShippingType) { + } else if (value is ApplePayShippingType) { buffer.putUint8(171); writeValue(buffer, value.index); - } else if (value is ApplePayMerchantCapability) { + } else if (value is ApplePayMerchantCapability) { buffer.putUint8(172); writeValue(buffer, value.index); - } else if (value is ApplePaySummaryItemType) { + } else if (value is ApplePaySummaryItemType) { buffer.putUint8(173); writeValue(buffer, value.index); - } else if (value is CardNumberValidationResultDTO) { + } else if (value is CardNumberValidationResultDTO) { buffer.putUint8(174); writeValue(buffer, value.index); - } else if (value is CardExpiryDateValidationResultDTO) { + } else if (value is CardExpiryDateValidationResultDTO) { buffer.putUint8(175); writeValue(buffer, value.index); - } else if (value is CardSecurityCodeValidationResultDTO) { + } else if (value is CardSecurityCodeValidationResultDTO) { buffer.putUint8(176); writeValue(buffer, value.index); } else { @@ -1548,120 +1555,126 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: return SessionDTO.decode(readValue(buffer)!); - case 130: + case 130: return AmountDTO.decode(readValue(buffer)!); - case 131: + case 131: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 132: + case 132: return DropInConfigurationDTO.decode(readValue(buffer)!); - case 133: + case 133: return CardConfigurationDTO.decode(readValue(buffer)!); - case 134: + case 134: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 135: + case 135: return ApplePayContactDTO.decode(readValue(buffer)!); - case 136: + case 136: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 137: + case 137: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 138: + case 138: return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 139: + case 139: return MerchantInfoDTO.decode(readValue(buffer)!); - case 140: + case 140: return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 141: + case 141: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 142: + case 142: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 143: + case 143: return PaymentResultDTO.decode(readValue(buffer)!); - case 144: + case 144: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 145: + case 145: return OrderResponseDTO.decode(readValue(buffer)!); - case 146: + case 146: return CheckoutEvent.decode(readValue(buffer)!); - case 147: + case 147: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 148: + case 148: return PaymentEventDTO.decode(readValue(buffer)!); - case 149: + case 149: return ErrorDTO.decode(readValue(buffer)!); - case 150: + case 150: return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 151: + case 151: return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 152: + case 152: return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 153: + case 153: return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 154: + case 154: return UnencryptedCardDTO.decode(readValue(buffer)!); - case 155: + case 155: return EncryptedCardDTO.decode(readValue(buffer)!); - case 156: + case 156: return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 157: + case 157: return OrderCancelResultDTO.decode(readValue(buffer)!); - case 158: + case 158: return BinLookupDataDTO.decode(readValue(buffer)!); - case 159: + case 159: final int? value = readValue(buffer) as int?; return value == null ? null : Environment.values[value]; - case 160: + case 160: final int? value = readValue(buffer) as int?; return value == null ? null : AddressMode.values[value]; - case 161: + case 161: final int? value = readValue(buffer) as int?; return value == null ? null : CardAuthMethod.values[value]; - case 162: + case 162: final int? value = readValue(buffer) as int?; return value == null ? null : TotalPriceStatus.values[value]; - case 163: + case 163: final int? value = readValue(buffer) as int?; return value == null ? null : GooglePayEnvironment.values[value]; - case 164: + case 164: final int? value = readValue(buffer) as int?; return value == null ? null : CashAppPayEnvironment.values[value]; - case 165: + case 165: final int? value = readValue(buffer) as int?; return value == null ? null : PaymentResultEnum.values[value]; - case 166: + case 166: final int? value = readValue(buffer) as int?; return value == null ? null : CheckoutEventType.values[value]; - case 167: + case 167: final int? value = readValue(buffer) as int?; return value == null ? null : ComponentCommunicationType.values[value]; - case 168: + case 168: final int? value = readValue(buffer) as int?; return value == null ? null : PaymentEventType.values[value]; - case 169: + case 169: final int? value = readValue(buffer) as int?; return value == null ? null : FieldVisibility.values[value]; - case 170: + case 170: final int? value = readValue(buffer) as int?; return value == null ? null : InstantPaymentType.values[value]; - case 171: + case 171: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePayShippingType.values[value]; - case 172: + case 172: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePayMerchantCapability.values[value]; - case 173: + case 173: final int? value = readValue(buffer) as int?; return value == null ? null : ApplePaySummaryItemType.values[value]; - case 174: + case 174: final int? value = readValue(buffer) as int?; - return value == null ? null : CardNumberValidationResultDTO.values[value]; - case 175: + return value == null + ? null + : CardNumberValidationResultDTO.values[value]; + case 175: final int? value = readValue(buffer) as int?; - return value == null ? null : CardExpiryDateValidationResultDTO.values[value]; - case 176: + return value == null + ? null + : CardExpiryDateValidationResultDTO.values[value]; + case 176: final int? value = readValue(buffer) as int?; - return value == null ? null : CardSecurityCodeValidationResultDTO.values[value]; + return value == null + ? null + : CardSecurityCodeValidationResultDTO.values[value]; default: return super.readValueOfType(type, buffer); } @@ -1672,9 +1685,11 @@ 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, String messageChannelSuffix = ''}) + CheckoutPlatformInterface( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -1682,8 +1697,10 @@ class CheckoutPlatformInterface { final String __pigeon_messageChannelSuffix; Future getReturnUrl() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl$__pigeon_messageChannelSuffix'; - 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, @@ -1708,15 +1725,19 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1736,8 +1757,10 @@ class CheckoutPlatformInterface { } Future clearSession() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession$__pigeon_messageChannelSuffix'; - 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, @@ -1757,15 +1780,18 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1785,14 +1811,16 @@ class CheckoutPlatformInterface { } Future encryptBin(String bin, String publicKey) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin$__pigeon_messageChannelSuffix'; - 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) { @@ -1811,15 +1839,18 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1838,15 +1869,18 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1865,15 +1899,18 @@ class CheckoutPlatformInterface { } } - 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( + 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) { @@ -1893,14 +1930,16 @@ class CheckoutPlatformInterface { } Future enableConsoleLogging(bool loggingEnabled) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging$__pigeon_messageChannelSuffix'; - 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) { @@ -1919,24 +1958,29 @@ 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, String messageChannelSuffix = ''}) + DropInPlatformInterface( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); 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( + 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) { @@ -1950,15 +1994,19 @@ class DropInPlatformInterface { } } - 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( + 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) { @@ -1973,14 +2021,16 @@ class DropInPlatformInterface { } Future onPaymentsResult(PaymentEventDTO paymentsResult) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult$__pigeon_messageChannelSuffix'; - 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) { @@ -1994,15 +2044,18 @@ class DropInPlatformInterface { } } - Future onPaymentsDetailsResult(PaymentEventDTO paymentsDetailsResult) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2016,15 +2069,19 @@ class DropInPlatformInterface { } } - Future onDeleteStoredPaymentMethodResult(DeletedStoredPaymentMethodResultDTO deleteStoredPaymentMethodResultDTO) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2039,14 +2096,16 @@ class DropInPlatformInterface { } Future onBalanceCheckResult(String balanceCheckResponse) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2061,14 +2120,16 @@ class DropInPlatformInterface { } Future onOrderRequestResult(String orderRequestResponse) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2082,15 +2143,18 @@ class DropInPlatformInterface { } } - Future onOrderCancelResult(OrderCancelResultDTO orderCancelResult) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult$__pigeon_messageChannelSuffix'; - 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) { @@ -2105,8 +2169,10 @@ class DropInPlatformInterface { } Future cleanUpDropIn() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn$__pigeon_messageChannelSuffix'; - 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, @@ -2132,18 +2198,25 @@ abstract class CheckoutFlutterInterface { void send(CheckoutEvent event); - static void setUp(CheckoutFlutterInterface? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CheckoutFlutterInterface? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send$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.CheckoutFlutterInterface.send was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.CheckoutFlutterInterface.send was null.'); final List args = (message as List?)!; final CheckoutEvent? arg_event = (args[0] as CheckoutEvent?); assert(arg_event != null, @@ -2153,8 +2226,9 @@ abstract class CheckoutFlutterInterface { 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())); } }); } @@ -2166,9 +2240,11 @@ 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, String messageChannelSuffix = ''}) + ComponentPlatformInterface( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -2176,8 +2252,10 @@ class ComponentPlatformInterface { final String __pigeon_messageChannelSuffix; Future updateViewHeight(int viewId) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight$__pigeon_messageChannelSuffix'; - 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, @@ -2197,15 +2275,18 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2219,15 +2300,18 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2241,15 +2325,24 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2268,15 +2361,24 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2290,15 +2392,24 @@ class ComponentPlatformInterface { } } - 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( + 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) { @@ -2313,8 +2424,10 @@ class ComponentPlatformInterface { } Future onDispose(String componentId) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose$__pigeon_messageChannelSuffix'; - 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, @@ -2338,55 +2451,74 @@ class ComponentPlatformInterface { abstract class ComponentFlutterInterface { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void _generateCodecForDTOs(CardComponentConfigurationDTO cardComponentConfigurationDTO, SessionDTO sessionDTO, BinLookupDataDTO binLookupDataDTO); - - void onComponentCommunication(ComponentCommunicationModel componentCommunicationModel); - - static void setUp(ComponentFlutterInterface? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + void _generateCodecForDTOs( + CardComponentConfigurationDTO cardComponentConfigurationDTO, + SessionDTO sessionDTO, + BinLookupDataDTO binLookupDataDTO); + + void onComponentCommunication( + ComponentCommunicationModel componentCommunicationModel); + + static void setUp( + ComponentFlutterInterface? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + '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.'); - final BinLookupDataDTO? arg_binLookupDataDTO = (args[2] as BinLookupDataDTO?); + final BinLookupDataDTO? arg_binLookupDataDTO = + (args[2] as BinLookupDataDTO?); assert(arg_binLookupDataDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null BinLookupDataDTO.'); try { - api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, arg_sessionDTO!, arg_binLookupDataDTO!); + api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, + arg_sessionDTO!, arg_binLookupDataDTO!); 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( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + '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 { @@ -2394,8 +2526,9 @@ 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())); } }); } From 179c49b70c10c29fe14130d61975e7f0de7fa1b7 Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Thu, 6 Mar 2025 11:44:19 +0100 Subject: [PATCH 3/4] Added changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26845db8..418af500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### New -- Added bin lookup callbacks for Drop-In. +- Added bin lookup callbacks for Card Component and Drop-In. - Set minimum SDK version to Flutter 3.16/Dart 3.2 - Android Components/Drop-in version: [5.9.0](https://docs.adyen.com/online-payments/release-notes/?title%5B0%5D=Android+Components%2FDrop-in#releaseNote=2025-01-17-android-componentsdrop-in-5.9.0). From 31f921c5546fe3ee74be68c75ee72c4fd234f0fa Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Mon, 10 Mar 2025 14:27:53 +0100 Subject: [PATCH 4/4] Aligned creation of card component between session and advanced flow --- .../components/card/BaseCardComponent.swift | 19 +++++++++++--- .../card/advanced/CardAdvancedComponent.swift | 25 ++++++++----------- .../card/session/CardSessionComponent.swift | 13 +++------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/ios/Classes/components/card/BaseCardComponent.swift b/ios/Classes/components/card/BaseCardComponent.swift index 5b98f6d3..d0fa4dd6 100644 --- a/ios/Classes/components/card/BaseCardComponent.swift +++ b/ios/Classes/components/card/BaseCardComponent.swift @@ -57,17 +57,28 @@ class BaseCardComponent: NSObject, FlutterPlatformView, UIScrollViewDelegate { } func buildCardComponent( - paymentMethodString: String, + paymentMethodString: String?, isStoredPaymentMethod: Bool, - cardComponentConfiguration: CardComponentConfigurationDTO, - adyenContext: AdyenContext + cardComponentConfiguration: CardComponentConfigurationDTO?, + componentDelegate: PaymentComponentDelegate?, + cardDelegate: CardComponentDelegate? ) throws -> CardComponent { + guard let paymentMethodString = paymentMethod else { throw PlatformError(errorDescription: "Payment method not found") } + guard let cardComponentConfiguration else { throw PlatformError(errorDescription: "Card configuration not found") } + let adyenContext = try cardComponentConfiguration.createAdyenContext() let cardConfiguration = cardComponentConfiguration.cardConfiguration.mapToCardComponentConfiguration( shopperLocale: cardComponentConfiguration.shopperLocale) let paymentMethod: AnyCardPaymentMethod = isStoredPaymentMethod ? try JSONDecoder().decode(StoredCardPaymentMethod.self, from: Data(paymentMethodString.utf8)) : try JSONDecoder().decode(CardPaymentMethod.self, from: Data(paymentMethodString.utf8)) - return CardComponent(paymentMethod: paymentMethod, context: adyenContext, configuration: cardConfiguration) + let cardComponent = CardComponent( + paymentMethod: paymentMethod, + context: adyenContext, + configuration: cardConfiguration + ) + cardComponent.delegate = componentDelegate + cardComponent.cardComponentDelegate = cardDelegate + return cardComponent } func showCardComponent(cardComponent: CardComponent) { diff --git a/ios/Classes/components/card/advanced/CardAdvancedComponent.swift b/ios/Classes/components/card/advanced/CardAdvancedComponent.swift index de260751..a0edb0de 100644 --- a/ios/Classes/components/card/advanced/CardAdvancedComponent.swift +++ b/ios/Classes/components/card/advanced/CardAdvancedComponent.swift @@ -7,7 +7,7 @@ class CardAdvancedComponent: BaseCardComponent { private var actionComponentDelegate: ActionComponentDelegate? private var actionComponent: AdyenActionComponent? private var presentationDelegate: PresentationDelegate? - private var cardDelegate: PaymentComponentDelegate? + private var componentDelegate: PaymentComponentDelegate? override init( frame: CGRect, @@ -38,6 +38,7 @@ class CardAdvancedComponent: BaseCardComponent { private func setupCardComponentView() { do { let cardComponent = try setupCardComponent() + actionComponent = buildActionComponent(adyenContext: cardComponent.context) showCardComponent(cardComponent: cardComponent) componentPlatformApi.onActionCallback = { [weak self] jsonActionResponse in self?.onAction(actionResponse: jsonActionResponse) @@ -51,21 +52,17 @@ class CardAdvancedComponent: BaseCardComponent { } private func setupCardComponent() throws -> CardComponent { - guard let cardComponentConfiguration else { throw PlatformError(errorDescription: "Card configuration not found") } - guard let paymentMethodString = paymentMethod else { throw PlatformError(errorDescription: "Payment method not found") } - let adyenContext = try cardComponentConfiguration.createAdyenContext() - let cardComponent = try buildCardComponent( - paymentMethodString: paymentMethodString, + componentDelegate = CardAdvancedFlowDelegate( + componentFlutterApi: componentFlutterApi, + componentId: componentId + ) + return try buildCardComponent( + paymentMethodString: paymentMethod, isStoredPaymentMethod: isStoredPaymentMethod, cardComponentConfiguration: cardComponentConfiguration, - adyenContext: adyenContext - ) - - actionComponent = buildActionComponent(adyenContext: adyenContext) - cardDelegate = CardAdvancedFlowDelegate(componentFlutterApi: componentFlutterApi, componentId: componentId) - cardComponent.delegate = cardDelegate - cardComponent.cardComponentDelegate = self - return cardComponent + componentDelegate: componentDelegate, + cardDelegate: self + ) } private func buildActionComponent(adyenContext: AdyenContext) -> AdyenActionComponent { diff --git a/ios/Classes/components/card/session/CardSessionComponent.swift b/ios/Classes/components/card/session/CardSessionComponent.swift index 16ef8af0..a3e4b18d 100644 --- a/ios/Classes/components/card/session/CardSessionComponent.swift +++ b/ios/Classes/components/card/session/CardSessionComponent.swift @@ -39,19 +39,14 @@ class CardSessionComponent: BaseCardComponent { } private func setupCardComponent() throws -> CardComponent { - guard let cardComponentConfiguration else { throw PlatformError(errorDescription: "Card configuration not found") } - guard let paymentMethodString = paymentMethod else { throw PlatformError(errorDescription: "Payment method not found") } guard let session = sessionHolder.session else { throw PlatformError(errorDescription: "Session not found") } - let adyenContext = try cardComponentConfiguration.createAdyenContext() - let cardComponent = try buildCardComponent( - paymentMethodString: paymentMethodString, + return try buildCardComponent( + paymentMethodString: paymentMethod, isStoredPaymentMethod: isStoredPaymentMethod, cardComponentConfiguration: cardComponentConfiguration, - adyenContext: adyenContext + componentDelegate: session, + cardDelegate: self ) - cardComponent.delegate = session - cardComponent.cardComponentDelegate = self - return cardComponent } private func setupSessionFlowDelegate() {