From 5d3dafd3a1b15a214a1eaaf5cd635a3e771566ea Mon Sep 17 00:00:00 2001 From: Robert Schulze Dieckhoff Date: Tue, 19 Nov 2024 15:09:13 +0100 Subject: [PATCH] Completed partial payments for iOS and improved error handling for API callbacks --- .../com/adyen/checkout/flutter/PlatformApi.kt | 8 +- .../flutter/dropIn/DropInPlatformApi.kt | 16 +- .../dropIn/advanced/AdvancedDropInService.kt | 128 +- .../adyen/checkout/flutter/utils/Constants.kt | 6 + example/lib/network/service.dart | 3 +- example/lib/utils/payment_event_handler.dart | 3 +- ios/Classes/PlatformApi.swift | 4111 +++++++++-------- ios/Classes/dropIn/DropInPlatformApi.swift | 96 +- ios/Classes/utils/Constants.swift | 7 + lib/src/common/adyen_checkout_session.dart | 2 +- lib/src/drop_in/drop_in.dart | 79 +- lib/src/generated/platform_api.g.dart | 597 ++- lib/src/util/constants.dart | 8 + lib/src/util/dto_mapper.dart | 43 +- lib/src/util/payment_event_handler.dart | 5 +- pigeons/platform_api.dart | 2 + test/dto_mapping_test.dart | 3 +- 17 files changed, 2722 insertions(+), 2395 deletions(-) create mode 100644 ios/Classes/utils/Constants.swift diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt index a4624e3f..340a2b85 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/PlatformApi.kt @@ -315,8 +315,8 @@ data class DropInConfigurationDTO ( val skipListWhenSinglePaymentMethod: Boolean, val isRemoveStoredPaymentMethodEnabled: Boolean, val preselectedPaymentMethodTitle: String? = null, - val paymentMethodNames: Map? = null - + val paymentMethodNames: Map? = null, + val isPartialPaymentSupported: Boolean ) { companion object { @Suppress("UNCHECKED_CAST") @@ -346,7 +346,8 @@ data class DropInConfigurationDTO ( val isRemoveStoredPaymentMethodEnabled = list[12] as Boolean val preselectedPaymentMethodTitle = list[13] as String? val paymentMethodNames = list[14] as Map? - return DropInConfigurationDTO(environment, clientKey, countryCode, amount, shopperLocale, cardConfigurationDTO, applePayConfigurationDTO, googlePayConfigurationDTO, cashAppPayConfigurationDTO, analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, preselectedPaymentMethodTitle, paymentMethodNames) + val isPartialPaymentSupported = list[15] as Boolean + return DropInConfigurationDTO(environment, clientKey, countryCode, amount, shopperLocale, cardConfigurationDTO, applePayConfigurationDTO, googlePayConfigurationDTO, cashAppPayConfigurationDTO, analyticsOptionsDTO, showPreselectedStoredPaymentMethod, skipListWhenSinglePaymentMethod, isRemoveStoredPaymentMethodEnabled, preselectedPaymentMethodTitle, paymentMethodNames, isPartialPaymentSupported) } } fun toList(): List { @@ -366,6 +367,7 @@ data class DropInConfigurationDTO ( isRemoveStoredPaymentMethodEnabled, preselectedPaymentMethodTitle, paymentMethodNames, + isPartialPaymentSupported, ) } } diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt index 5da19880..e6fb1c50 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/DropInPlatformApi.kt @@ -90,13 +90,17 @@ class DropInPlatformApi( PaymentMethodsApiResponse.SERIALIZER.deserialize( JSONObject(paymentMethodsResponse), ) - val paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethodsApiResponse) + val paymentMethodsWithoutGiftCards = + removeGiftCardPaymentMethods( + paymentMethodsApiResponse, + dropInConfigurationDTO.isPartialPaymentSupported + ) val dropInConfiguration = dropInConfigurationDTO.mapToDropInConfiguration(activity.applicationContext) withContext(Dispatchers.Main) { DropIn.startPayment( activity.applicationContext, dropInAdvancedFlowLauncher, - paymentMethodsApiResponse, + paymentMethodsWithoutGiftCards, dropInConfiguration, AdvancedDropInService::class.java, ) @@ -269,10 +273,14 @@ class DropInPlatformApi( ) } - // Gift cards will be supported in a later version private fun removeGiftCardPaymentMethods( - paymentMethodsResponse: PaymentMethodsApiResponse + paymentMethodsResponse: PaymentMethodsApiResponse, + isPartialPaymentSupported: Boolean ): PaymentMethodsApiResponse { + if (isPartialPaymentSupported) { + return paymentMethodsResponse + } + val giftCardTypeIdentifier = "giftcard" val storedPaymentMethods = paymentMethodsResponse.storedPaymentMethods?.filterNot { it.type == giftCardTypeIdentifier } diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt index 174ad61c..3ee54a3f 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/dropIn/advanced/AdvancedDropInService.kt @@ -78,10 +78,10 @@ class AdvancedDropInService : DropInService(), LifecycleOwner { shouldUpdatePaymentMethods: Boolean ) { setOrderCancelObserver() - val event = JSONObject() - event.put("order", Order.SERIALIZER.serialize(order)) - event.put("shouldUpdatePaymentMethods", shouldUpdatePaymentMethods) - DropInOrderCancelPlatformMessenger.sendResult(event) + val cancelOrderData = JSONObject() + cancelOrderData.put(Constants.ORDER_KEY, Order.SERIALIZER.serialize(order)) + cancelOrderData.put(Constants.SHOULD_UPDATE_PAYMENT_METHODS_KEY, shouldUpdatePaymentMethods) + DropInOrderCancelPlatformMessenger.sendResult(cancelOrderData) } override fun onRemoveStoredPaymentMethod(storedPaymentMethod: StoredPaymentMethod) { @@ -246,8 +246,9 @@ class AdvancedDropInService : DropInService(), LifecycleOwner { ) } else { val updatedPaymentMethodsJSON = - JSONObject(paymentEventDTO.data["updatedPaymentMethods"] as HashMap<*, *>) - val orderResponseJSON = JSONObject(paymentEventDTO.data["orderResponse"] as HashMap<*, *>) + JSONObject(paymentEventDTO.data[Constants.UPDATED_PAYMENT_METHODS_KEY] as HashMap<*, *>) + val orderResponseJSON = + JSONObject(paymentEventDTO.data[Constants.ORDER_RESPONSE_KEY] as HashMap<*, *>) val paymentMethods = PaymentMethodsApiResponse.SERIALIZER.deserialize(updatedPaymentMethodsJSON) val orderResponse = OrderResponse.SERIALIZER.deserialize(orderResponseJSON) DropInServiceResult.Update(paymentMethods, orderResponse) @@ -272,63 +273,90 @@ class AdvancedDropInService : DropInService(), LifecycleOwner { } private fun mapToBalanceDropInServiceResult(response: String): BalanceDropInServiceResult { - if (response.isEmpty()) { - return BalanceDropInServiceResult.Error(errorDialog = null, reason = "Balance check failed") - } + try { + val jsonResponse = JSONObject(response) + return when (val resultCode = jsonResponse.optString(Constants.RESULT_CODE_KEY)) { + "Success" -> BalanceDropInServiceResult.Balance(BalanceResult.SERIALIZER.deserialize(jsonResponse)) + "NotEnoughBalance" -> + BalanceDropInServiceResult.Balance( + BalanceResult.SERIALIZER.deserialize( + jsonResponse + ) + ) - val jsonResponse = JSONObject(response) - return when (val resultCode = jsonResponse.optString("resultCode")) { - "Success" -> BalanceDropInServiceResult.Balance(BalanceResult.SERIALIZER.deserialize(jsonResponse)) - "NotEnoughBalance" -> BalanceDropInServiceResult.Balance(BalanceResult.SERIALIZER.deserialize(jsonResponse)) - else -> - BalanceDropInServiceResult.Error( - errorDialog = ErrorDialog(message = resultCode), - dismissDropIn = false, - ) + else -> + BalanceDropInServiceResult.Error( + errorDialog = + ErrorDialog( + title = resultCode, + message = jsonResponse.optString(Constants.MESSAGE_KEY) ?: "Unknown" + ), + dismissDropIn = false + ) + } + } catch (exception: Exception) { + return BalanceDropInServiceResult.Error( + errorDialog = null, + reason = "Failure parsing balance check response." + ) } } private fun mapToOrderDropInServiceResult(response: String): OrderDropInServiceResult { - if (response.isEmpty()) { - return OrderDropInServiceResult.Error(errorDialog = null, reason = "Order request failed") - } - - val jsonResponse = JSONObject(response) - return when (val resultCode = jsonResponse.optString("resultCode")) { - "Success" -> OrderDropInServiceResult.OrderCreated(OrderResponse.SERIALIZER.deserialize(jsonResponse)) - else -> - OrderDropInServiceResult.Error( - errorDialog = ErrorDialog(message = resultCode), - dismissDropIn = false, - ) + try { + val jsonResponse = JSONObject(response) + return when (val resultCode = jsonResponse.optString(Constants.RESULT_CODE_KEY)) { + "Success" -> OrderDropInServiceResult.OrderCreated(OrderResponse.SERIALIZER.deserialize(jsonResponse)) + else -> + OrderDropInServiceResult.Error( + errorDialog = + ErrorDialog( + title = resultCode, + message = jsonResponse.optString(Constants.MESSAGE_KEY) ?: "Unknown" + ), + dismissDropIn = false + ) + } + } catch (exception: Exception) { + return OrderDropInServiceResult.Error( + errorDialog = null, + reason = "Failure parsing order response." + ) } } private fun mapToOrderCancelDropInServiceResult( orderCancelResponseDTO: OrderCancelResponseDTO? ): DropInServiceResult? { - if (orderCancelResponseDTO == null || orderCancelResponseDTO.orderCancelResponseBody.isEmpty()) { - return DropInServiceResult.Error(errorDialog = null, reason = "Order cancellation failed") - } - - val orderCancelResponseBody = JSONObject(orderCancelResponseDTO.orderCancelResponseBody) - return when (val resultCode = orderCancelResponseBody.optString("resultCode")) { - "Received" -> { - if (orderCancelResponseDTO.updatedPaymentMethods?.isNotEmpty() == true) { - val updatedPaymentMethods = orderCancelResponseDTO.updatedPaymentMethods - val paymentMethods = - PaymentMethodsApiResponse.SERIALIZER.deserialize(JSONObject(updatedPaymentMethods)) - val orderResponse = OrderResponse.SERIALIZER.deserialize(orderCancelResponseBody) - sendResult(DropInServiceResult.Update(paymentMethods, orderResponse)) + try { + val orderCancelResponseBody = orderCancelResponseDTO?.orderCancelResponseBody?.let { JSONObject(it) } + return when (val resultCode = orderCancelResponseBody?.optString(Constants.RESULT_CODE_KEY)) { + "Received" -> { + if (orderCancelResponseDTO.updatedPaymentMethods?.isNotEmpty() == true) { + val updatedPaymentMethods = orderCancelResponseDTO.updatedPaymentMethods + val paymentMethods = + PaymentMethodsApiResponse.SERIALIZER.deserialize(JSONObject(updatedPaymentMethods)) + val orderResponse = OrderResponse.SERIALIZER.deserialize(orderCancelResponseBody) + sendResult(DropInServiceResult.Update(paymentMethods, orderResponse)) + } + null } - null - } - else -> - DropInServiceResult.Error( - errorDialog = ErrorDialog(message = resultCode), - dismissDropIn = false, - ) + else -> + DropInServiceResult.Error( + errorDialog = + ErrorDialog( + title = resultCode, + message = orderCancelResponseBody?.optString(Constants.MESSAGE_KEY) ?: "Unknown" + ), + dismissDropIn = false, + ) + } + } catch (exception: Exception) { + return DropInServiceResult.Error( + errorDialog = null, + reason = "Failure parsing order cancellation response." + ) } } diff --git a/android/src/main/kotlin/com/adyen/checkout/flutter/utils/Constants.kt b/android/src/main/kotlin/com/adyen/checkout/flutter/utils/Constants.kt index 7f201ab8..11465b84 100644 --- a/android/src/main/kotlin/com/adyen/checkout/flutter/utils/Constants.kt +++ b/android/src/main/kotlin/com/adyen/checkout/flutter/utils/Constants.kt @@ -15,5 +15,11 @@ class Constants { const val SDK_PAYMENT_CANCELED_IDENTIFIER = "Payment canceled" const val ADVANCED_PAYMENT_DATA_KEY = "data" const val ADVANCED_EXTRA_DATA_KEY = "extra" + const val ORDER_KEY = "order" + const val ORDER_RESPONSE_KEY = "orderResponse" + const val SHOULD_UPDATE_PAYMENT_METHODS_KEY = "shouldUpdatePaymentMethods" + const val UPDATED_PAYMENT_METHODS_KEY = "updatedPaymentMethods" + const val RESULT_CODE_KEY = "resultCode" + const val MESSAGE_KEY = "message" } } diff --git a/example/lib/network/service.dart b/example/lib/network/service.dart index 0396ca11..6b71c7ed 100644 --- a/example/lib/network/service.dart +++ b/example/lib/network/service.dart @@ -94,7 +94,8 @@ class Service { return jsonDecode(response.body); } - Future> postOrdersCancel(Map body) async { + Future> postOrdersCancel( + Map body) async { final response = await http.post( Uri.https(Config.baseUrl, "/${Config.apiVersion}/orders/cancel"), headers: _createHeaders(), diff --git a/example/lib/utils/payment_event_handler.dart b/example/lib/utils/payment_event_handler.dart index bf0c71bc..d8ab70cb 100644 --- a/example/lib/utils/payment_event_handler.dart +++ b/example/lib/utils/payment_event_handler.dart @@ -68,8 +68,7 @@ class PaymentEventHandler { bool _isNonFullyPaidOrder(jsonResponse) { if (jsonResponse.containsKey("order")) { - final remainingAmount = - jsonResponse["order"]["remainingAmount"]["value"]; + final remainingAmount = jsonResponse["order"]["remainingAmount"]["value"]; return remainingAmount > 0; } else { return false; diff --git a/ios/Classes/PlatformApi.swift b/ios/Classes/PlatformApi.swift index c3a389fb..75950c6b 100644 --- a/ios/Classes/PlatformApi.swift +++ b/ios/Classes/PlatformApi.swift @@ -4,2339 +4,2384 @@ import Foundation #if os(iOS) - import Flutter + import Flutter #elseif os(macOS) - import FlutterMacOS + import FlutterMacOS #else - #error("Unsupported platform.") + #error("Unsupported platform.") #endif private func wrapResult(_ result: Any?) -> [Any?] { - return [result] + [result] } private func wrapError(_ error: Any) -> [Any?] { - if let flutterError = error as? FlutterError { + if let flutterError = error as? FlutterError { + return [ + flutterError.code, + flutterError.message, + flutterError.details + ] + } return [ - flutterError.code, - flutterError.message, - flutterError.details, + "\(error)", + "\(type(of: error))", + "Stacktrace: \(Thread.callStackSymbols)" ] - } - return [ - "\(error)", - "\(type(of: error))", - "Stacktrace: \(Thread.callStackSymbols)", - ] } private func createConnectionError(withChannelName channelName: String) -> FlutterError { - return FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + FlutterError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil + value is NSNull || value == nil } private func nilOrValue(_ value: Any?) -> T? { - if value is NSNull { return nil } - return value as! T? + if value is NSNull { return nil } + return value as! T? } enum Environment: Int { - case test = 0 - case europe = 1 - case unitedStates = 2 - case australia = 3 - case india = 4 - case apse = 5 + case test = 0 + case europe = 1 + case unitedStates = 2 + case australia = 3 + case india = 4 + case apse = 5 } enum AddressMode: Int { - case full = 0 - case postalCode = 1 - case none = 2 + case full = 0 + case postalCode = 1 + case none = 2 } enum CardAuthMethod: Int { - case panOnly = 0 - case cryptogram3DS = 1 + case panOnly = 0 + case cryptogram3DS = 1 } enum TotalPriceStatus: Int { - case notCurrentlyKnown = 0 - case estimated = 1 - case finalPrice = 2 + case notCurrentlyKnown = 0 + case estimated = 1 + case finalPrice = 2 } enum GooglePayEnvironment: Int { - case test = 0 - case production = 1 + case test = 0 + case production = 1 } enum CashAppPayEnvironment: Int { - case sandbox = 0 - case production = 1 + case sandbox = 0 + case production = 1 } enum PaymentResultEnum: Int { - case cancelledByUser = 0 - case error = 1 - case finished = 2 + case cancelledByUser = 0 + case error = 1 + case finished = 2 } enum PlatformCommunicationType: Int { - case paymentComponent = 0 - case additionalDetails = 1 - case result = 2 - case deleteStoredPaymentMethod = 3 - case balanceCheck = 4 - case requestOrder = 5 - case cancelOrder = 6 + case paymentComponent = 0 + case additionalDetails = 1 + case result = 2 + case deleteStoredPaymentMethod = 3 + case balanceCheck = 4 + case requestOrder = 5 + case cancelOrder = 6 } enum ComponentCommunicationType: Int { - case onSubmit = 0 - case additionalDetails = 1 - case loading = 2 - case result = 3 - case resize = 4 + case onSubmit = 0 + case additionalDetails = 1 + case loading = 2 + case result = 3 + case resize = 4 } enum PaymentEventType: Int { - case finished = 0 - case action = 1 - case error = 2 - case update = 3 + case finished = 0 + case action = 1 + case error = 2 + case update = 3 } enum FieldVisibility: Int { - case show = 0 - case hide = 1 + case show = 0 + case hide = 1 } enum InstantPaymentType: Int { - case googlePay = 0 - case applePay = 1 - case instant = 2 + case googlePay = 0 + case applePay = 1 + case instant = 2 } enum ApplePayShippingType: Int { - case shipping = 0 - case delivery = 1 - case storePickup = 2 - case servicePickup = 3 + case shipping = 0 + case delivery = 1 + case storePickup = 2 + case servicePickup = 3 } enum ApplePayMerchantCapability: Int { - case debit = 0 - case credit = 1 + case debit = 0 + case credit = 1 } enum ApplePaySummaryItemType: Int { - case pending = 0 - case definite = 1 + case pending = 0 + case definite = 1 } /// Generated class from Pigeon that represents data sent in messages. struct SessionDTO { - var id: String - var sessionData: String - var paymentMethodsJson: String - - static func fromList(_ list: [Any?]) -> SessionDTO? { - let id = list[0] as! String - let sessionData = list[1] as! String - let paymentMethodsJson = list[2] as! String - - return SessionDTO( - id: id, - sessionData: sessionData, - paymentMethodsJson: paymentMethodsJson - ) - } - func toList() -> [Any?] { - return [ - id, - sessionData, - paymentMethodsJson, - ] - } + var id: String + var sessionData: String + var paymentMethodsJson: String + + static func fromList(_ list: [Any?]) -> SessionDTO? { + let id = list[0] as! String + let sessionData = list[1] as! String + let paymentMethodsJson = list[2] as! String + + return SessionDTO( + id: id, + sessionData: sessionData, + paymentMethodsJson: paymentMethodsJson + ) + } + + func toList() -> [Any?] { + [ + id, + sessionData, + paymentMethodsJson + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct AmountDTO { - var currency: String - var value: Int64 - - static func fromList(_ list: [Any?]) -> AmountDTO? { - let currency = list[0] as! String - let value = list[1] is Int64 ? list[1] as! Int64 : Int64(list[1] as! Int32) - - return AmountDTO( - currency: currency, - value: value - ) - } - func toList() -> [Any?] { - return [ - currency, - value, - ] - } + var currency: String + var value: Int64 + + static func fromList(_ list: [Any?]) -> AmountDTO? { + let currency = list[0] as! String + let value = list[1] is Int64 ? list[1] as! Int64 : Int64(list[1] as! Int32) + + return AmountDTO( + currency: currency, + value: value + ) + } + + func toList() -> [Any?] { + [ + currency, + value + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct AnalyticsOptionsDTO { - var enabled: Bool - var version: String - - static func fromList(_ list: [Any?]) -> AnalyticsOptionsDTO? { - let enabled = list[0] as! Bool - let version = list[1] as! String - - return AnalyticsOptionsDTO( - enabled: enabled, - version: version - ) - } - func toList() -> [Any?] { - return [ - enabled, - version, - ] - } + var enabled: Bool + var version: String + + static func fromList(_ list: [Any?]) -> AnalyticsOptionsDTO? { + let enabled = list[0] as! Bool + let version = list[1] as! String + + return AnalyticsOptionsDTO( + enabled: enabled, + version: version + ) + } + + func toList() -> [Any?] { + [ + enabled, + version + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct DropInConfigurationDTO { - var environment: Environment - var clientKey: String - var countryCode: String - var amount: AmountDTO? = nil - var shopperLocale: String? = nil - var cardConfigurationDTO: CardConfigurationDTO? = nil - var applePayConfigurationDTO: ApplePayConfigurationDTO? = nil - var googlePayConfigurationDTO: GooglePayConfigurationDTO? = nil - var cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? = nil - var analyticsOptionsDTO: AnalyticsOptionsDTO - var showPreselectedStoredPaymentMethod: Bool - var skipListWhenSinglePaymentMethod: Bool - var isRemoveStoredPaymentMethodEnabled: Bool - var preselectedPaymentMethodTitle: String? = nil - var paymentMethodNames: [String?: String?]? = nil - - static func fromList(_ list: [Any?]) -> DropInConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let countryCode = list[2] as! String - var amount: AmountDTO? = nil - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[4]) - var cardConfigurationDTO: CardConfigurationDTO? = nil - if let cardConfigurationDTOList: [Any?] = nilOrValue(list[5]) { - cardConfigurationDTO = CardConfigurationDTO.fromList(cardConfigurationDTOList) - } - var applePayConfigurationDTO: ApplePayConfigurationDTO? = nil - if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[6]) { - applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) - } - var googlePayConfigurationDTO: GooglePayConfigurationDTO? = nil - if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { - googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) - } - var cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? = nil - if let cashAppPayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { - cashAppPayConfigurationDTO = CashAppPayConfigurationDTO.fromList(cashAppPayConfigurationDTOList) - } - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[9] as! [Any?])! - let showPreselectedStoredPaymentMethod = list[10] as! Bool - let skipListWhenSinglePaymentMethod = list[11] as! Bool - let isRemoveStoredPaymentMethodEnabled = list[12] as! Bool - let preselectedPaymentMethodTitle: String? = nilOrValue(list[13]) - let paymentMethodNames: [String?: String?]? = nilOrValue(list[14]) - - return DropInConfigurationDTO( - environment: environment, - clientKey: clientKey, - countryCode: countryCode, - amount: amount, - shopperLocale: shopperLocale, - cardConfigurationDTO: cardConfigurationDTO, - applePayConfigurationDTO: applePayConfigurationDTO, - googlePayConfigurationDTO: googlePayConfigurationDTO, - cashAppPayConfigurationDTO: cashAppPayConfigurationDTO, - analyticsOptionsDTO: analyticsOptionsDTO, - showPreselectedStoredPaymentMethod: showPreselectedStoredPaymentMethod, - skipListWhenSinglePaymentMethod: skipListWhenSinglePaymentMethod, - isRemoveStoredPaymentMethodEnabled: isRemoveStoredPaymentMethodEnabled, - preselectedPaymentMethodTitle: preselectedPaymentMethodTitle, - paymentMethodNames: paymentMethodNames - ) - } - func toList() -> [Any?] { - return [ - environment.rawValue, - clientKey, - countryCode, - amount?.toList(), - shopperLocale, - cardConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList(), - googlePayConfigurationDTO?.toList(), - cashAppPayConfigurationDTO?.toList(), - analyticsOptionsDTO.toList(), - showPreselectedStoredPaymentMethod, - skipListWhenSinglePaymentMethod, - isRemoveStoredPaymentMethodEnabled, - preselectedPaymentMethodTitle, - paymentMethodNames, - ] - } + var environment: Environment + var clientKey: String + var countryCode: String + var amount: AmountDTO? + var shopperLocale: String? + var cardConfigurationDTO: CardConfigurationDTO? + var applePayConfigurationDTO: ApplePayConfigurationDTO? + var googlePayConfigurationDTO: GooglePayConfigurationDTO? + var cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? + var analyticsOptionsDTO: AnalyticsOptionsDTO + var showPreselectedStoredPaymentMethod: Bool + var skipListWhenSinglePaymentMethod: Bool + var isRemoveStoredPaymentMethodEnabled: Bool + var preselectedPaymentMethodTitle: String? + var paymentMethodNames: [String?: String?]? + var isPartialPaymentSupported: Bool + + static func fromList(_ list: [Any?]) -> DropInConfigurationDTO? { + let environment = Environment(rawValue: list[0] as! Int)! + let clientKey = list[1] as! String + let countryCode = list[2] as! String + var amount: AmountDTO? + if let amountList: [Any?] = nilOrValue(list[3]) { + amount = AmountDTO.fromList(amountList) + } + let shopperLocale: String? = nilOrValue(list[4]) + var cardConfigurationDTO: CardConfigurationDTO? + if let cardConfigurationDTOList: [Any?] = nilOrValue(list[5]) { + cardConfigurationDTO = CardConfigurationDTO.fromList(cardConfigurationDTOList) + } + var applePayConfigurationDTO: ApplePayConfigurationDTO? + if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[6]) { + applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) + } + var googlePayConfigurationDTO: GooglePayConfigurationDTO? + if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { + googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) + } + var cashAppPayConfigurationDTO: CashAppPayConfigurationDTO? + if let cashAppPayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { + cashAppPayConfigurationDTO = CashAppPayConfigurationDTO.fromList(cashAppPayConfigurationDTOList) + } + let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[9] as! [Any?])! + let showPreselectedStoredPaymentMethod = list[10] as! Bool + let skipListWhenSinglePaymentMethod = list[11] as! Bool + let isRemoveStoredPaymentMethodEnabled = list[12] as! Bool + let preselectedPaymentMethodTitle: String? = nilOrValue(list[13]) + let paymentMethodNames: [String?: String?]? = nilOrValue(list[14]) + let isPartialPaymentSupported = list[15] as! Bool + + return DropInConfigurationDTO( + environment: environment, + clientKey: clientKey, + countryCode: countryCode, + amount: amount, + shopperLocale: shopperLocale, + cardConfigurationDTO: cardConfigurationDTO, + applePayConfigurationDTO: applePayConfigurationDTO, + googlePayConfigurationDTO: googlePayConfigurationDTO, + cashAppPayConfigurationDTO: cashAppPayConfigurationDTO, + analyticsOptionsDTO: analyticsOptionsDTO, + showPreselectedStoredPaymentMethod: showPreselectedStoredPaymentMethod, + skipListWhenSinglePaymentMethod: skipListWhenSinglePaymentMethod, + isRemoveStoredPaymentMethodEnabled: isRemoveStoredPaymentMethodEnabled, + preselectedPaymentMethodTitle: preselectedPaymentMethodTitle, + paymentMethodNames: paymentMethodNames, + isPartialPaymentSupported: isPartialPaymentSupported + ) + } + + func toList() -> [Any?] { + [ + environment.rawValue, + clientKey, + countryCode, + amount?.toList(), + shopperLocale, + cardConfigurationDTO?.toList(), + applePayConfigurationDTO?.toList(), + googlePayConfigurationDTO?.toList(), + cashAppPayConfigurationDTO?.toList(), + analyticsOptionsDTO.toList(), + showPreselectedStoredPaymentMethod, + skipListWhenSinglePaymentMethod, + isRemoveStoredPaymentMethodEnabled, + preselectedPaymentMethodTitle, + paymentMethodNames, + isPartialPaymentSupported + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct CardConfigurationDTO { - var holderNameRequired: Bool - var addressMode: AddressMode - var showStorePaymentField: Bool - var showCvcForStoredCard: Bool - var showCvc: Bool - var kcpFieldVisibility: FieldVisibility - var socialSecurityNumberFieldVisibility: FieldVisibility - var supportedCardTypes: [String?] - - static func fromList(_ list: [Any?]) -> CardConfigurationDTO? { - let holderNameRequired = list[0] as! Bool - let addressMode = AddressMode(rawValue: list[1] as! Int)! - let showStorePaymentField = list[2] as! Bool - let showCvcForStoredCard = list[3] as! Bool - let showCvc = list[4] as! Bool - let kcpFieldVisibility = FieldVisibility(rawValue: list[5] as! Int)! - let socialSecurityNumberFieldVisibility = FieldVisibility(rawValue: list[6] as! Int)! - let supportedCardTypes = list[7] as! [String?] - - return CardConfigurationDTO( - holderNameRequired: holderNameRequired, - addressMode: addressMode, - showStorePaymentField: showStorePaymentField, - showCvcForStoredCard: showCvcForStoredCard, - showCvc: showCvc, - kcpFieldVisibility: kcpFieldVisibility, - socialSecurityNumberFieldVisibility: socialSecurityNumberFieldVisibility, - supportedCardTypes: supportedCardTypes - ) - } - func toList() -> [Any?] { - return [ - holderNameRequired, - addressMode.rawValue, - showStorePaymentField, - showCvcForStoredCard, - showCvc, - kcpFieldVisibility.rawValue, - socialSecurityNumberFieldVisibility.rawValue, - supportedCardTypes, - ] - } + var holderNameRequired: Bool + var addressMode: AddressMode + var showStorePaymentField: Bool + var showCvcForStoredCard: Bool + var showCvc: Bool + var kcpFieldVisibility: FieldVisibility + var socialSecurityNumberFieldVisibility: FieldVisibility + var supportedCardTypes: [String?] + + static func fromList(_ list: [Any?]) -> CardConfigurationDTO? { + let holderNameRequired = list[0] as! Bool + let addressMode = AddressMode(rawValue: list[1] as! Int)! + let showStorePaymentField = list[2] as! Bool + let showCvcForStoredCard = list[3] as! Bool + let showCvc = list[4] as! Bool + let kcpFieldVisibility = FieldVisibility(rawValue: list[5] as! Int)! + let socialSecurityNumberFieldVisibility = FieldVisibility(rawValue: list[6] as! Int)! + let supportedCardTypes = list[7] as! [String?] + + return CardConfigurationDTO( + holderNameRequired: holderNameRequired, + addressMode: addressMode, + showStorePaymentField: showStorePaymentField, + showCvcForStoredCard: showCvcForStoredCard, + showCvc: showCvc, + kcpFieldVisibility: kcpFieldVisibility, + socialSecurityNumberFieldVisibility: socialSecurityNumberFieldVisibility, + supportedCardTypes: supportedCardTypes + ) + } + + func toList() -> [Any?] { + [ + holderNameRequired, + addressMode.rawValue, + showStorePaymentField, + showCvcForStoredCard, + showCvc, + kcpFieldVisibility.rawValue, + socialSecurityNumberFieldVisibility.rawValue, + supportedCardTypes + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ApplePayConfigurationDTO { - var merchantId: String - var merchantName: String - var allowOnboarding: Bool? = nil - var summaryItems: [ApplePaySummaryItemDTO?]? = nil - var requiredBillingContactFields: [String?]? = nil - var billingContact: ApplePayContactDTO? = nil - var requiredShippingContactFields: [String?]? = nil - var shippingContact: ApplePayContactDTO? = nil - var applePayShippingType: ApplePayShippingType? = nil - var allowShippingContactEditing: Bool? = nil - var shippingMethods: [ApplePayShippingMethodDTO?]? = nil - var applicationData: String? = nil - var supportedCountries: [String?]? = nil - var merchantCapability: ApplePayMerchantCapability? = nil - - static func fromList(_ list: [Any?]) -> ApplePayConfigurationDTO? { - let merchantId = list[0] as! String - let merchantName = list[1] as! String - let allowOnboarding: Bool? = nilOrValue(list[2]) - let summaryItems: [ApplePaySummaryItemDTO?]? = nilOrValue(list[3]) - let requiredBillingContactFields: [String?]? = nilOrValue(list[4]) - var billingContact: ApplePayContactDTO? = nil - if let billingContactList: [Any?] = nilOrValue(list[5]) { - billingContact = ApplePayContactDTO.fromList(billingContactList) - } - let requiredShippingContactFields: [String?]? = nilOrValue(list[6]) - var shippingContact: ApplePayContactDTO? = nil - if let shippingContactList: [Any?] = nilOrValue(list[7]) { - shippingContact = ApplePayContactDTO.fromList(shippingContactList) - } - var applePayShippingType: ApplePayShippingType? = nil - let applePayShippingTypeEnumVal: Int? = nilOrValue(list[8]) - if let applePayShippingTypeRawValue = applePayShippingTypeEnumVal { - applePayShippingType = ApplePayShippingType(rawValue: applePayShippingTypeRawValue)! - } - let allowShippingContactEditing: Bool? = nilOrValue(list[9]) - let shippingMethods: [ApplePayShippingMethodDTO?]? = nilOrValue(list[10]) - let applicationData: String? = nilOrValue(list[11]) - let supportedCountries: [String?]? = nilOrValue(list[12]) - var merchantCapability: ApplePayMerchantCapability? = nil - let merchantCapabilityEnumVal: Int? = nilOrValue(list[13]) - if let merchantCapabilityRawValue = merchantCapabilityEnumVal { - merchantCapability = ApplePayMerchantCapability(rawValue: merchantCapabilityRawValue)! - } - - return ApplePayConfigurationDTO( - merchantId: merchantId, - merchantName: merchantName, - allowOnboarding: allowOnboarding, - summaryItems: summaryItems, - requiredBillingContactFields: requiredBillingContactFields, - billingContact: billingContact, - requiredShippingContactFields: requiredShippingContactFields, - shippingContact: shippingContact, - applePayShippingType: applePayShippingType, - allowShippingContactEditing: allowShippingContactEditing, - shippingMethods: shippingMethods, - applicationData: applicationData, - supportedCountries: supportedCountries, - merchantCapability: merchantCapability - ) - } - func toList() -> [Any?] { - return [ - merchantId, - merchantName, - allowOnboarding, - summaryItems, - requiredBillingContactFields, - billingContact?.toList(), - requiredShippingContactFields, - shippingContact?.toList(), - applePayShippingType?.rawValue, - allowShippingContactEditing, - shippingMethods, - applicationData, - supportedCountries, - merchantCapability?.rawValue, - ] - } + var merchantId: String + var merchantName: String + var allowOnboarding: Bool? + var summaryItems: [ApplePaySummaryItemDTO?]? + var requiredBillingContactFields: [String?]? + var billingContact: ApplePayContactDTO? + var requiredShippingContactFields: [String?]? + var shippingContact: ApplePayContactDTO? + var applePayShippingType: ApplePayShippingType? + var allowShippingContactEditing: Bool? + var shippingMethods: [ApplePayShippingMethodDTO?]? + var applicationData: String? + var supportedCountries: [String?]? + var merchantCapability: ApplePayMerchantCapability? + + static func fromList(_ list: [Any?]) -> ApplePayConfigurationDTO? { + let merchantId = list[0] as! String + let merchantName = list[1] as! String + let allowOnboarding: Bool? = nilOrValue(list[2]) + let summaryItems: [ApplePaySummaryItemDTO?]? = nilOrValue(list[3]) + let requiredBillingContactFields: [String?]? = nilOrValue(list[4]) + var billingContact: ApplePayContactDTO? + if let billingContactList: [Any?] = nilOrValue(list[5]) { + billingContact = ApplePayContactDTO.fromList(billingContactList) + } + let requiredShippingContactFields: [String?]? = nilOrValue(list[6]) + var shippingContact: ApplePayContactDTO? + if let shippingContactList: [Any?] = nilOrValue(list[7]) { + shippingContact = ApplePayContactDTO.fromList(shippingContactList) + } + var applePayShippingType: ApplePayShippingType? + let applePayShippingTypeEnumVal: Int? = nilOrValue(list[8]) + if let applePayShippingTypeRawValue = applePayShippingTypeEnumVal { + applePayShippingType = ApplePayShippingType(rawValue: applePayShippingTypeRawValue)! + } + let allowShippingContactEditing: Bool? = nilOrValue(list[9]) + let shippingMethods: [ApplePayShippingMethodDTO?]? = nilOrValue(list[10]) + let applicationData: String? = nilOrValue(list[11]) + let supportedCountries: [String?]? = nilOrValue(list[12]) + var merchantCapability: ApplePayMerchantCapability? + let merchantCapabilityEnumVal: Int? = nilOrValue(list[13]) + if let merchantCapabilityRawValue = merchantCapabilityEnumVal { + merchantCapability = ApplePayMerchantCapability(rawValue: merchantCapabilityRawValue)! + } + + return ApplePayConfigurationDTO( + merchantId: merchantId, + merchantName: merchantName, + allowOnboarding: allowOnboarding, + summaryItems: summaryItems, + requiredBillingContactFields: requiredBillingContactFields, + billingContact: billingContact, + requiredShippingContactFields: requiredShippingContactFields, + shippingContact: shippingContact, + applePayShippingType: applePayShippingType, + allowShippingContactEditing: allowShippingContactEditing, + shippingMethods: shippingMethods, + applicationData: applicationData, + supportedCountries: supportedCountries, + merchantCapability: merchantCapability + ) + } + + func toList() -> [Any?] { + [ + merchantId, + merchantName, + allowOnboarding, + summaryItems, + requiredBillingContactFields, + billingContact?.toList(), + requiredShippingContactFields, + shippingContact?.toList(), + applePayShippingType?.rawValue, + allowShippingContactEditing, + shippingMethods, + applicationData, + supportedCountries, + merchantCapability?.rawValue + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ApplePayContactDTO { - var phoneNumber: String? = nil - var emailAddress: String? = nil - var givenName: String? = nil - var familyName: String? = nil - var phoneticGivenName: String? = nil - var phoneticFamilyName: String? = nil - var addressLines: [String?]? = nil - var subLocality: String? = nil - var city: String? = nil - var postalCode: String? = nil - var subAdministrativeArea: String? = nil - var administrativeArea: String? = nil - var country: String? = nil - var countryCode: String? = nil - - static func fromList(_ list: [Any?]) -> ApplePayContactDTO? { - let phoneNumber: String? = nilOrValue(list[0]) - let emailAddress: String? = nilOrValue(list[1]) - let givenName: String? = nilOrValue(list[2]) - let familyName: String? = nilOrValue(list[3]) - let phoneticGivenName: String? = nilOrValue(list[4]) - let phoneticFamilyName: String? = nilOrValue(list[5]) - let addressLines: [String?]? = nilOrValue(list[6]) - let subLocality: String? = nilOrValue(list[7]) - let city: String? = nilOrValue(list[8]) - let postalCode: String? = nilOrValue(list[9]) - let subAdministrativeArea: String? = nilOrValue(list[10]) - let administrativeArea: String? = nilOrValue(list[11]) - let country: String? = nilOrValue(list[12]) - let countryCode: String? = nilOrValue(list[13]) - - return ApplePayContactDTO( - phoneNumber: phoneNumber, - emailAddress: emailAddress, - givenName: givenName, - familyName: familyName, - phoneticGivenName: phoneticGivenName, - phoneticFamilyName: phoneticFamilyName, - addressLines: addressLines, - subLocality: subLocality, - city: city, - postalCode: postalCode, - subAdministrativeArea: subAdministrativeArea, - administrativeArea: administrativeArea, - country: country, - countryCode: countryCode - ) - } - func toList() -> [Any?] { - return [ - phoneNumber, - emailAddress, - givenName, - familyName, - phoneticGivenName, - phoneticFamilyName, - addressLines, - subLocality, - city, - postalCode, - subAdministrativeArea, - administrativeArea, - country, - countryCode, - ] - } + var phoneNumber: String? + var emailAddress: String? + var givenName: String? + var familyName: String? + var phoneticGivenName: String? + var phoneticFamilyName: String? + var addressLines: [String?]? + var subLocality: String? + var city: String? + var postalCode: String? + var subAdministrativeArea: String? + var administrativeArea: String? + var country: String? + var countryCode: String? + + static func fromList(_ list: [Any?]) -> ApplePayContactDTO? { + let phoneNumber: String? = nilOrValue(list[0]) + let emailAddress: String? = nilOrValue(list[1]) + let givenName: String? = nilOrValue(list[2]) + let familyName: String? = nilOrValue(list[3]) + let phoneticGivenName: String? = nilOrValue(list[4]) + let phoneticFamilyName: String? = nilOrValue(list[5]) + let addressLines: [String?]? = nilOrValue(list[6]) + let subLocality: String? = nilOrValue(list[7]) + let city: String? = nilOrValue(list[8]) + let postalCode: String? = nilOrValue(list[9]) + let subAdministrativeArea: String? = nilOrValue(list[10]) + let administrativeArea: String? = nilOrValue(list[11]) + let country: String? = nilOrValue(list[12]) + let countryCode: String? = nilOrValue(list[13]) + + return ApplePayContactDTO( + phoneNumber: phoneNumber, + emailAddress: emailAddress, + givenName: givenName, + familyName: familyName, + phoneticGivenName: phoneticGivenName, + phoneticFamilyName: phoneticFamilyName, + addressLines: addressLines, + subLocality: subLocality, + city: city, + postalCode: postalCode, + subAdministrativeArea: subAdministrativeArea, + administrativeArea: administrativeArea, + country: country, + countryCode: countryCode + ) + } + + func toList() -> [Any?] { + [ + phoneNumber, + emailAddress, + givenName, + familyName, + phoneticGivenName, + phoneticFamilyName, + addressLines, + subLocality, + city, + postalCode, + subAdministrativeArea, + administrativeArea, + country, + countryCode + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ApplePayShippingMethodDTO { - var label: String - var detail: String - var amount: AmountDTO - var identifier: String - var startDate: String? = nil - var endDate: String? = nil - - static func fromList(_ list: [Any?]) -> ApplePayShippingMethodDTO? { - let label = list[0] as! String - let detail = list[1] as! String - let amount = AmountDTO.fromList(list[2] as! [Any?])! - let identifier = list[3] as! String - let startDate: String? = nilOrValue(list[4]) - let endDate: String? = nilOrValue(list[5]) - - return ApplePayShippingMethodDTO( - label: label, - detail: detail, - amount: amount, - identifier: identifier, - startDate: startDate, - endDate: endDate - ) - } - func toList() -> [Any?] { - return [ - label, - detail, - amount.toList(), - identifier, - startDate, - endDate, - ] - } + var label: String + var detail: String + var amount: AmountDTO + var identifier: String + var startDate: String? + var endDate: String? + + static func fromList(_ list: [Any?]) -> ApplePayShippingMethodDTO? { + let label = list[0] as! String + let detail = list[1] as! String + let amount = AmountDTO.fromList(list[2] as! [Any?])! + let identifier = list[3] as! String + let startDate: String? = nilOrValue(list[4]) + let endDate: String? = nilOrValue(list[5]) + + return ApplePayShippingMethodDTO( + label: label, + detail: detail, + amount: amount, + identifier: identifier, + startDate: startDate, + endDate: endDate + ) + } + + func toList() -> [Any?] { + [ + label, + detail, + amount.toList(), + identifier, + startDate, + endDate + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ApplePaySummaryItemDTO { - var label: String - var amount: AmountDTO - var type: ApplePaySummaryItemType - - static func fromList(_ list: [Any?]) -> ApplePaySummaryItemDTO? { - let label = list[0] as! String - let amount = AmountDTO.fromList(list[1] as! [Any?])! - let type = ApplePaySummaryItemType(rawValue: list[2] as! Int)! - - return ApplePaySummaryItemDTO( - label: label, - amount: amount, - type: type - ) - } - func toList() -> [Any?] { - return [ - label, - amount.toList(), - type.rawValue, - ] - } + var label: String + var amount: AmountDTO + var type: ApplePaySummaryItemType + + static func fromList(_ list: [Any?]) -> ApplePaySummaryItemDTO? { + let label = list[0] as! String + let amount = AmountDTO.fromList(list[1] as! [Any?])! + let type = ApplePaySummaryItemType(rawValue: list[2] as! Int)! + + return ApplePaySummaryItemDTO( + label: label, + amount: amount, + type: type + ) + } + + func toList() -> [Any?] { + [ + label, + amount.toList(), + type.rawValue + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct GooglePayConfigurationDTO { - var googlePayEnvironment: GooglePayEnvironment - var merchantAccount: String? = nil - var merchantInfoDTO: MerchantInfoDTO? = nil - var totalPriceStatus: TotalPriceStatus? = nil - var allowedCardNetworks: [String?]? = nil - var allowedAuthMethods: [String?]? = nil - var allowPrepaidCards: Bool? = nil - var allowCreditCards: Bool? = nil - var assuranceDetailsRequired: Bool? = nil - var emailRequired: Bool? = nil - var existingPaymentMethodRequired: Bool? = nil - var shippingAddressRequired: Bool? = nil - var shippingAddressParametersDTO: ShippingAddressParametersDTO? = nil - var billingAddressRequired: Bool? = nil - var billingAddressParametersDTO: BillingAddressParametersDTO? = nil - - static func fromList(_ list: [Any?]) -> GooglePayConfigurationDTO? { - let googlePayEnvironment = GooglePayEnvironment(rawValue: list[0] as! Int)! - let merchantAccount: String? = nilOrValue(list[1]) - var merchantInfoDTO: MerchantInfoDTO? = nil - if let merchantInfoDTOList: [Any?] = nilOrValue(list[2]) { - merchantInfoDTO = MerchantInfoDTO.fromList(merchantInfoDTOList) - } - var totalPriceStatus: TotalPriceStatus? = nil - let totalPriceStatusEnumVal: Int? = nilOrValue(list[3]) - if let totalPriceStatusRawValue = totalPriceStatusEnumVal { - totalPriceStatus = TotalPriceStatus(rawValue: totalPriceStatusRawValue)! - } - let allowedCardNetworks: [String?]? = nilOrValue(list[4]) - let allowedAuthMethods: [String?]? = nilOrValue(list[5]) - let allowPrepaidCards: Bool? = nilOrValue(list[6]) - let allowCreditCards: Bool? = nilOrValue(list[7]) - let assuranceDetailsRequired: Bool? = nilOrValue(list[8]) - let emailRequired: Bool? = nilOrValue(list[9]) - let existingPaymentMethodRequired: Bool? = nilOrValue(list[10]) - let shippingAddressRequired: Bool? = nilOrValue(list[11]) - var shippingAddressParametersDTO: ShippingAddressParametersDTO? = nil - if let shippingAddressParametersDTOList: [Any?] = nilOrValue(list[12]) { - shippingAddressParametersDTO = ShippingAddressParametersDTO.fromList(shippingAddressParametersDTOList) - } - let billingAddressRequired: Bool? = nilOrValue(list[13]) - var billingAddressParametersDTO: BillingAddressParametersDTO? = nil - if let billingAddressParametersDTOList: [Any?] = nilOrValue(list[14]) { - billingAddressParametersDTO = BillingAddressParametersDTO.fromList(billingAddressParametersDTOList) - } - - return GooglePayConfigurationDTO( - googlePayEnvironment: googlePayEnvironment, - merchantAccount: merchantAccount, - merchantInfoDTO: merchantInfoDTO, - totalPriceStatus: totalPriceStatus, - allowedCardNetworks: allowedCardNetworks, - allowedAuthMethods: allowedAuthMethods, - allowPrepaidCards: allowPrepaidCards, - allowCreditCards: allowCreditCards, - assuranceDetailsRequired: assuranceDetailsRequired, - emailRequired: emailRequired, - existingPaymentMethodRequired: existingPaymentMethodRequired, - shippingAddressRequired: shippingAddressRequired, - shippingAddressParametersDTO: shippingAddressParametersDTO, - billingAddressRequired: billingAddressRequired, - billingAddressParametersDTO: billingAddressParametersDTO - ) - } - func toList() -> [Any?] { - return [ - googlePayEnvironment.rawValue, - merchantAccount, - merchantInfoDTO?.toList(), - totalPriceStatus?.rawValue, - allowedCardNetworks, - allowedAuthMethods, - allowPrepaidCards, - allowCreditCards, - assuranceDetailsRequired, - emailRequired, - existingPaymentMethodRequired, - shippingAddressRequired, - shippingAddressParametersDTO?.toList(), - billingAddressRequired, - billingAddressParametersDTO?.toList(), - ] - } + var googlePayEnvironment: GooglePayEnvironment + var merchantAccount: String? + var merchantInfoDTO: MerchantInfoDTO? + var totalPriceStatus: TotalPriceStatus? + var allowedCardNetworks: [String?]? + var allowedAuthMethods: [String?]? + var allowPrepaidCards: Bool? + var allowCreditCards: Bool? + var assuranceDetailsRequired: Bool? + var emailRequired: Bool? + var existingPaymentMethodRequired: Bool? + var shippingAddressRequired: Bool? + var shippingAddressParametersDTO: ShippingAddressParametersDTO? + var billingAddressRequired: Bool? + var billingAddressParametersDTO: BillingAddressParametersDTO? + + static func fromList(_ list: [Any?]) -> GooglePayConfigurationDTO? { + let googlePayEnvironment = GooglePayEnvironment(rawValue: list[0] as! Int)! + let merchantAccount: String? = nilOrValue(list[1]) + var merchantInfoDTO: MerchantInfoDTO? + if let merchantInfoDTOList: [Any?] = nilOrValue(list[2]) { + merchantInfoDTO = MerchantInfoDTO.fromList(merchantInfoDTOList) + } + var totalPriceStatus: TotalPriceStatus? + let totalPriceStatusEnumVal: Int? = nilOrValue(list[3]) + if let totalPriceStatusRawValue = totalPriceStatusEnumVal { + totalPriceStatus = TotalPriceStatus(rawValue: totalPriceStatusRawValue)! + } + let allowedCardNetworks: [String?]? = nilOrValue(list[4]) + let allowedAuthMethods: [String?]? = nilOrValue(list[5]) + let allowPrepaidCards: Bool? = nilOrValue(list[6]) + let allowCreditCards: Bool? = nilOrValue(list[7]) + let assuranceDetailsRequired: Bool? = nilOrValue(list[8]) + let emailRequired: Bool? = nilOrValue(list[9]) + let existingPaymentMethodRequired: Bool? = nilOrValue(list[10]) + let shippingAddressRequired: Bool? = nilOrValue(list[11]) + var shippingAddressParametersDTO: ShippingAddressParametersDTO? + if let shippingAddressParametersDTOList: [Any?] = nilOrValue(list[12]) { + shippingAddressParametersDTO = ShippingAddressParametersDTO.fromList(shippingAddressParametersDTOList) + } + let billingAddressRequired: Bool? = nilOrValue(list[13]) + var billingAddressParametersDTO: BillingAddressParametersDTO? + if let billingAddressParametersDTOList: [Any?] = nilOrValue(list[14]) { + billingAddressParametersDTO = BillingAddressParametersDTO.fromList(billingAddressParametersDTOList) + } + + return GooglePayConfigurationDTO( + googlePayEnvironment: googlePayEnvironment, + merchantAccount: merchantAccount, + merchantInfoDTO: merchantInfoDTO, + totalPriceStatus: totalPriceStatus, + allowedCardNetworks: allowedCardNetworks, + allowedAuthMethods: allowedAuthMethods, + allowPrepaidCards: allowPrepaidCards, + allowCreditCards: allowCreditCards, + assuranceDetailsRequired: assuranceDetailsRequired, + emailRequired: emailRequired, + existingPaymentMethodRequired: existingPaymentMethodRequired, + shippingAddressRequired: shippingAddressRequired, + shippingAddressParametersDTO: shippingAddressParametersDTO, + billingAddressRequired: billingAddressRequired, + billingAddressParametersDTO: billingAddressParametersDTO + ) + } + + func toList() -> [Any?] { + [ + googlePayEnvironment.rawValue, + merchantAccount, + merchantInfoDTO?.toList(), + totalPriceStatus?.rawValue, + allowedCardNetworks, + allowedAuthMethods, + allowPrepaidCards, + allowCreditCards, + assuranceDetailsRequired, + emailRequired, + existingPaymentMethodRequired, + shippingAddressRequired, + shippingAddressParametersDTO?.toList(), + billingAddressRequired, + billingAddressParametersDTO?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct MerchantInfoDTO { - var merchantName: String? = nil - var merchantId: String? = nil - - static func fromList(_ list: [Any?]) -> MerchantInfoDTO? { - let merchantName: String? = nilOrValue(list[0]) - let merchantId: String? = nilOrValue(list[1]) - - return MerchantInfoDTO( - merchantName: merchantName, - merchantId: merchantId - ) - } - func toList() -> [Any?] { - return [ - merchantName, - merchantId, - ] - } + var merchantName: String? + var merchantId: String? + + static func fromList(_ list: [Any?]) -> MerchantInfoDTO? { + let merchantName: String? = nilOrValue(list[0]) + let merchantId: String? = nilOrValue(list[1]) + + return MerchantInfoDTO( + merchantName: merchantName, + merchantId: merchantId + ) + } + + func toList() -> [Any?] { + [ + merchantName, + merchantId + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ShippingAddressParametersDTO { - var allowedCountryCodes: [String?]? = nil - var isPhoneNumberRequired: Bool? = nil - - static func fromList(_ list: [Any?]) -> ShippingAddressParametersDTO? { - let allowedCountryCodes: [String?]? = nilOrValue(list[0]) - let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) - - return ShippingAddressParametersDTO( - allowedCountryCodes: allowedCountryCodes, - isPhoneNumberRequired: isPhoneNumberRequired - ) - } - func toList() -> [Any?] { - return [ - allowedCountryCodes, - isPhoneNumberRequired, - ] - } + var allowedCountryCodes: [String?]? + var isPhoneNumberRequired: Bool? + + static func fromList(_ list: [Any?]) -> ShippingAddressParametersDTO? { + let allowedCountryCodes: [String?]? = nilOrValue(list[0]) + let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) + + return ShippingAddressParametersDTO( + allowedCountryCodes: allowedCountryCodes, + isPhoneNumberRequired: isPhoneNumberRequired + ) + } + + func toList() -> [Any?] { + [ + allowedCountryCodes, + isPhoneNumberRequired + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct BillingAddressParametersDTO { - var format: String? = nil - var isPhoneNumberRequired: Bool? = nil - - static func fromList(_ list: [Any?]) -> BillingAddressParametersDTO? { - let format: String? = nilOrValue(list[0]) - let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) - - return BillingAddressParametersDTO( - format: format, - isPhoneNumberRequired: isPhoneNumberRequired - ) - } - func toList() -> [Any?] { - return [ - format, - isPhoneNumberRequired, - ] - } + var format: String? + var isPhoneNumberRequired: Bool? + + static func fromList(_ list: [Any?]) -> BillingAddressParametersDTO? { + let format: String? = nilOrValue(list[0]) + let isPhoneNumberRequired: Bool? = nilOrValue(list[1]) + + return BillingAddressParametersDTO( + format: format, + isPhoneNumberRequired: isPhoneNumberRequired + ) + } + + func toList() -> [Any?] { + [ + format, + isPhoneNumberRequired + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct CashAppPayConfigurationDTO { - var cashAppPayEnvironment: CashAppPayEnvironment - var returnUrl: String - - static func fromList(_ list: [Any?]) -> CashAppPayConfigurationDTO? { - let cashAppPayEnvironment = CashAppPayEnvironment(rawValue: list[0] as! Int)! - let returnUrl = list[1] as! String - - return CashAppPayConfigurationDTO( - cashAppPayEnvironment: cashAppPayEnvironment, - returnUrl: returnUrl - ) - } - func toList() -> [Any?] { - return [ - cashAppPayEnvironment.rawValue, - returnUrl, - ] - } + var cashAppPayEnvironment: CashAppPayEnvironment + var returnUrl: String + + static func fromList(_ list: [Any?]) -> CashAppPayConfigurationDTO? { + let cashAppPayEnvironment = CashAppPayEnvironment(rawValue: list[0] as! Int)! + let returnUrl = list[1] as! String + + return CashAppPayConfigurationDTO( + cashAppPayEnvironment: cashAppPayEnvironment, + returnUrl: returnUrl + ) + } + + func toList() -> [Any?] { + [ + cashAppPayEnvironment.rawValue, + returnUrl + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct PaymentResultDTO { - var type: PaymentResultEnum - var reason: String? = nil - var result: PaymentResultModelDTO? = nil - - static func fromList(_ list: [Any?]) -> PaymentResultDTO? { - let type = PaymentResultEnum(rawValue: list[0] as! Int)! - let reason: String? = nilOrValue(list[1]) - var result: PaymentResultModelDTO? = nil - if let resultList: [Any?] = nilOrValue(list[2]) { - result = PaymentResultModelDTO.fromList(resultList) - } - - return PaymentResultDTO( - type: type, - reason: reason, - result: result - ) - } - func toList() -> [Any?] { - return [ - type.rawValue, - reason, - result?.toList(), - ] - } + var type: PaymentResultEnum + var reason: String? + var result: PaymentResultModelDTO? + + static func fromList(_ list: [Any?]) -> PaymentResultDTO? { + let type = PaymentResultEnum(rawValue: list[0] as! Int)! + let reason: String? = nilOrValue(list[1]) + var result: PaymentResultModelDTO? + if let resultList: [Any?] = nilOrValue(list[2]) { + result = PaymentResultModelDTO.fromList(resultList) + } + + return PaymentResultDTO( + type: type, + reason: reason, + result: result + ) + } + + func toList() -> [Any?] { + [ + type.rawValue, + reason, + result?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct PaymentResultModelDTO { - var sessionId: String? = nil - var sessionData: String? = nil - var sessionResult: String? = nil - var resultCode: String? = nil - var order: OrderResponseDTO? = nil - - static func fromList(_ list: [Any?]) -> PaymentResultModelDTO? { - let sessionId: String? = nilOrValue(list[0]) - let sessionData: String? = nilOrValue(list[1]) - let sessionResult: String? = nilOrValue(list[2]) - let resultCode: String? = nilOrValue(list[3]) - var order: OrderResponseDTO? = nil - if let orderList: [Any?] = nilOrValue(list[4]) { - order = OrderResponseDTO.fromList(orderList) - } - - return PaymentResultModelDTO( - sessionId: sessionId, - sessionData: sessionData, - sessionResult: sessionResult, - resultCode: resultCode, - order: order - ) - } - func toList() -> [Any?] { - return [ - sessionId, - sessionData, - sessionResult, - resultCode, - order?.toList(), - ] - } + var sessionId: String? + var sessionData: String? + var sessionResult: String? + var resultCode: String? + var order: OrderResponseDTO? + + static func fromList(_ list: [Any?]) -> PaymentResultModelDTO? { + let sessionId: String? = nilOrValue(list[0]) + let sessionData: String? = nilOrValue(list[1]) + let sessionResult: String? = nilOrValue(list[2]) + let resultCode: String? = nilOrValue(list[3]) + var order: OrderResponseDTO? + if let orderList: [Any?] = nilOrValue(list[4]) { + order = OrderResponseDTO.fromList(orderList) + } + + return PaymentResultModelDTO( + sessionId: sessionId, + sessionData: sessionData, + sessionResult: sessionResult, + resultCode: resultCode, + order: order + ) + } + + func toList() -> [Any?] { + [ + sessionId, + sessionData, + sessionResult, + resultCode, + order?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct OrderResponseDTO { - var pspReference: String - var orderData: String - var amount: AmountDTO? = nil - var remainingAmount: AmountDTO? = nil - - static func fromList(_ list: [Any?]) -> OrderResponseDTO? { - let pspReference = list[0] as! String - let orderData = list[1] as! String - var amount: AmountDTO? = nil - if let amountList: [Any?] = nilOrValue(list[2]) { - amount = AmountDTO.fromList(amountList) - } - var remainingAmount: AmountDTO? = nil - if let remainingAmountList: [Any?] = nilOrValue(list[3]) { - remainingAmount = AmountDTO.fromList(remainingAmountList) - } - - return OrderResponseDTO( - pspReference: pspReference, - orderData: orderData, - amount: amount, - remainingAmount: remainingAmount - ) - } - func toList() -> [Any?] { - return [ - pspReference, - orderData, - amount?.toList(), - remainingAmount?.toList(), - ] - } + var pspReference: String + var orderData: String + var amount: AmountDTO? + var remainingAmount: AmountDTO? + + static func fromList(_ list: [Any?]) -> OrderResponseDTO? { + let pspReference = list[0] as! String + let orderData = list[1] as! String + var amount: AmountDTO? + if let amountList: [Any?] = nilOrValue(list[2]) { + amount = AmountDTO.fromList(amountList) + } + var remainingAmount: AmountDTO? + if let remainingAmountList: [Any?] = nilOrValue(list[3]) { + remainingAmount = AmountDTO.fromList(remainingAmountList) + } + + return OrderResponseDTO( + pspReference: pspReference, + orderData: orderData, + amount: amount, + remainingAmount: remainingAmount + ) + } + + func toList() -> [Any?] { + [ + pspReference, + orderData, + amount?.toList(), + remainingAmount?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct PlatformCommunicationModel { - var type: PlatformCommunicationType - var data: String? = nil - var paymentResult: PaymentResultDTO? = nil - - static func fromList(_ list: [Any?]) -> PlatformCommunicationModel? { - let type = PlatformCommunicationType(rawValue: list[0] as! Int)! - let data: String? = nilOrValue(list[1]) - var paymentResult: PaymentResultDTO? = nil - if let paymentResultList: [Any?] = nilOrValue(list[2]) { - paymentResult = PaymentResultDTO.fromList(paymentResultList) - } - - return PlatformCommunicationModel( - type: type, - data: data, - paymentResult: paymentResult - ) - } - func toList() -> [Any?] { - return [ - type.rawValue, - data, - paymentResult?.toList(), - ] - } + var type: PlatformCommunicationType + var data: String? + var paymentResult: PaymentResultDTO? + + static func fromList(_ list: [Any?]) -> PlatformCommunicationModel? { + let type = PlatformCommunicationType(rawValue: list[0] as! Int)! + let data: String? = nilOrValue(list[1]) + var paymentResult: PaymentResultDTO? + if let paymentResultList: [Any?] = nilOrValue(list[2]) { + paymentResult = PaymentResultDTO.fromList(paymentResultList) + } + + return PlatformCommunicationModel( + type: type, + data: data, + paymentResult: paymentResult + ) + } + + func toList() -> [Any?] { + [ + type.rawValue, + data, + paymentResult?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ComponentCommunicationModel { - var type: ComponentCommunicationType - var componentId: String - var data: Any? = nil - var paymentResult: PaymentResultDTO? = nil - - static func fromList(_ list: [Any?]) -> ComponentCommunicationModel? { - let type = ComponentCommunicationType(rawValue: list[0] as! Int)! - let componentId = list[1] as! String - let data: Any? = list[2] - var paymentResult: PaymentResultDTO? = nil - if let paymentResultList: [Any?] = nilOrValue(list[3]) { - paymentResult = PaymentResultDTO.fromList(paymentResultList) - } - - return ComponentCommunicationModel( - type: type, - componentId: componentId, - data: data, - paymentResult: paymentResult - ) - } - func toList() -> [Any?] { - return [ - type.rawValue, - componentId, - data, - paymentResult?.toList(), - ] - } + var type: ComponentCommunicationType + var componentId: String + var data: Any? + var paymentResult: PaymentResultDTO? + + static func fromList(_ list: [Any?]) -> ComponentCommunicationModel? { + let type = ComponentCommunicationType(rawValue: list[0] as! Int)! + let componentId = list[1] as! String + let data: Any? = list[2] + var paymentResult: PaymentResultDTO? + if let paymentResultList: [Any?] = nilOrValue(list[3]) { + paymentResult = PaymentResultDTO.fromList(paymentResultList) + } + + return ComponentCommunicationModel( + type: type, + componentId: componentId, + data: data, + paymentResult: paymentResult + ) + } + + func toList() -> [Any?] { + [ + type.rawValue, + componentId, + data, + paymentResult?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct PaymentEventDTO { - var paymentEventType: PaymentEventType - var result: String? = nil - var data: [String?: Any?]? = nil - var error: ErrorDTO? = nil - - static func fromList(_ list: [Any?]) -> PaymentEventDTO? { - let paymentEventType = PaymentEventType(rawValue: list[0] as! Int)! - let result: String? = nilOrValue(list[1]) - let data: [String?: Any?]? = nilOrValue(list[2]) - var error: ErrorDTO? = nil - if let errorList: [Any?] = nilOrValue(list[3]) { - error = ErrorDTO.fromList(errorList) - } - - return PaymentEventDTO( - paymentEventType: paymentEventType, - result: result, - data: data, - error: error - ) - } - func toList() -> [Any?] { - return [ - paymentEventType.rawValue, - result, - data, - error?.toList(), - ] - } + var paymentEventType: PaymentEventType + var result: String? + var data: [String?: Any?]? + var error: ErrorDTO? + + static func fromList(_ list: [Any?]) -> PaymentEventDTO? { + let paymentEventType = PaymentEventType(rawValue: list[0] as! Int)! + let result: String? = nilOrValue(list[1]) + let data: [String?: Any?]? = nilOrValue(list[2]) + var error: ErrorDTO? + if let errorList: [Any?] = nilOrValue(list[3]) { + error = ErrorDTO.fromList(errorList) + } + + return PaymentEventDTO( + paymentEventType: paymentEventType, + result: result, + data: data, + error: error + ) + } + + func toList() -> [Any?] { + [ + paymentEventType.rawValue, + result, + data, + error?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ErrorDTO { - var errorMessage: String? = nil - var reason: String? = nil - var dismissDropIn: Bool? = nil - - static func fromList(_ list: [Any?]) -> ErrorDTO? { - let errorMessage: String? = nilOrValue(list[0]) - let reason: String? = nilOrValue(list[1]) - let dismissDropIn: Bool? = nilOrValue(list[2]) - - return ErrorDTO( - errorMessage: errorMessage, - reason: reason, - dismissDropIn: dismissDropIn - ) - } - func toList() -> [Any?] { - return [ - errorMessage, - reason, - dismissDropIn, - ] - } + var errorMessage: String? + var reason: String? + var dismissDropIn: Bool? + + static func fromList(_ list: [Any?]) -> ErrorDTO? { + let errorMessage: String? = nilOrValue(list[0]) + let reason: String? = nilOrValue(list[1]) + let dismissDropIn: Bool? = nilOrValue(list[2]) + + return ErrorDTO( + errorMessage: errorMessage, + reason: reason, + dismissDropIn: dismissDropIn + ) + } + + func toList() -> [Any?] { + [ + errorMessage, + reason, + dismissDropIn + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct DeletedStoredPaymentMethodResultDTO { - var storedPaymentMethodId: String - var isSuccessfullyRemoved: Bool - - static func fromList(_ list: [Any?]) -> DeletedStoredPaymentMethodResultDTO? { - let storedPaymentMethodId = list[0] as! String - let isSuccessfullyRemoved = list[1] as! Bool - - return DeletedStoredPaymentMethodResultDTO( - storedPaymentMethodId: storedPaymentMethodId, - isSuccessfullyRemoved: isSuccessfullyRemoved - ) - } - func toList() -> [Any?] { - return [ - storedPaymentMethodId, - isSuccessfullyRemoved, - ] - } + var storedPaymentMethodId: String + var isSuccessfullyRemoved: Bool + + static func fromList(_ list: [Any?]) -> DeletedStoredPaymentMethodResultDTO? { + let storedPaymentMethodId = list[0] as! String + let isSuccessfullyRemoved = list[1] as! Bool + + return DeletedStoredPaymentMethodResultDTO( + storedPaymentMethodId: storedPaymentMethodId, + isSuccessfullyRemoved: isSuccessfullyRemoved + ) + } + + func toList() -> [Any?] { + [ + storedPaymentMethodId, + isSuccessfullyRemoved + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct CardComponentConfigurationDTO { - var environment: Environment - var clientKey: String - var countryCode: String - var amount: AmountDTO? = nil - var shopperLocale: String? = nil - var cardConfiguration: CardConfigurationDTO - var analyticsOptionsDTO: AnalyticsOptionsDTO - - static func fromList(_ list: [Any?]) -> CardComponentConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let countryCode = list[2] as! String - var amount: AmountDTO? = nil - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[4]) - let cardConfiguration = CardConfigurationDTO.fromList(list[5] as! [Any?])! - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! - - return CardComponentConfigurationDTO( - environment: environment, - clientKey: clientKey, - countryCode: countryCode, - amount: amount, - shopperLocale: shopperLocale, - cardConfiguration: cardConfiguration, - analyticsOptionsDTO: analyticsOptionsDTO - ) - } - func toList() -> [Any?] { - return [ - environment.rawValue, - clientKey, - countryCode, - amount?.toList(), - shopperLocale, - cardConfiguration.toList(), - analyticsOptionsDTO.toList(), - ] - } + var environment: Environment + var clientKey: String + var countryCode: String + var amount: AmountDTO? + var shopperLocale: String? + var cardConfiguration: CardConfigurationDTO + var analyticsOptionsDTO: AnalyticsOptionsDTO + + static func fromList(_ list: [Any?]) -> CardComponentConfigurationDTO? { + let environment = Environment(rawValue: list[0] as! Int)! + let clientKey = list[1] as! String + let countryCode = list[2] as! String + var amount: AmountDTO? + if let amountList: [Any?] = nilOrValue(list[3]) { + amount = AmountDTO.fromList(amountList) + } + let shopperLocale: String? = nilOrValue(list[4]) + let cardConfiguration = CardConfigurationDTO.fromList(list[5] as! [Any?])! + let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! + + return CardComponentConfigurationDTO( + environment: environment, + clientKey: clientKey, + countryCode: countryCode, + amount: amount, + shopperLocale: shopperLocale, + cardConfiguration: cardConfiguration, + analyticsOptionsDTO: analyticsOptionsDTO + ) + } + + func toList() -> [Any?] { + [ + environment.rawValue, + clientKey, + countryCode, + amount?.toList(), + shopperLocale, + cardConfiguration.toList(), + analyticsOptionsDTO.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct InstantPaymentConfigurationDTO { - var instantPaymentType: InstantPaymentType - var environment: Environment - var clientKey: String - var countryCode: String - var amount: AmountDTO? = nil - var shopperLocale: String? = nil - var analyticsOptionsDTO: AnalyticsOptionsDTO - var googlePayConfigurationDTO: GooglePayConfigurationDTO? = nil - var applePayConfigurationDTO: ApplePayConfigurationDTO? = nil - - static func fromList(_ list: [Any?]) -> InstantPaymentConfigurationDTO? { - let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! - let environment = Environment(rawValue: list[1] as! Int)! - let clientKey = list[2] as! String - let countryCode = list[3] as! String - var amount: AmountDTO? = nil - if let amountList: [Any?] = nilOrValue(list[4]) { - amount = AmountDTO.fromList(amountList) - } - let shopperLocale: String? = nilOrValue(list[5]) - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! - var googlePayConfigurationDTO: GooglePayConfigurationDTO? = nil - if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { - googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) - } - var applePayConfigurationDTO: ApplePayConfigurationDTO? = nil - if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { - applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) - } - - return InstantPaymentConfigurationDTO( - instantPaymentType: instantPaymentType, - environment: environment, - clientKey: clientKey, - countryCode: countryCode, - amount: amount, - shopperLocale: shopperLocale, - analyticsOptionsDTO: analyticsOptionsDTO, - googlePayConfigurationDTO: googlePayConfigurationDTO, - applePayConfigurationDTO: applePayConfigurationDTO - ) - } - func toList() -> [Any?] { - return [ - instantPaymentType.rawValue, - environment.rawValue, - clientKey, - countryCode, - amount?.toList(), - shopperLocale, - analyticsOptionsDTO.toList(), - googlePayConfigurationDTO?.toList(), - applePayConfigurationDTO?.toList(), - ] - } + var instantPaymentType: InstantPaymentType + var environment: Environment + var clientKey: String + var countryCode: String + var amount: AmountDTO? + var shopperLocale: String? + var analyticsOptionsDTO: AnalyticsOptionsDTO + var googlePayConfigurationDTO: GooglePayConfigurationDTO? + var applePayConfigurationDTO: ApplePayConfigurationDTO? + + static func fromList(_ list: [Any?]) -> InstantPaymentConfigurationDTO? { + let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! + let environment = Environment(rawValue: list[1] as! Int)! + let clientKey = list[2] as! String + let countryCode = list[3] as! String + var amount: AmountDTO? + if let amountList: [Any?] = nilOrValue(list[4]) { + amount = AmountDTO.fromList(amountList) + } + let shopperLocale: String? = nilOrValue(list[5]) + let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[6] as! [Any?])! + var googlePayConfigurationDTO: GooglePayConfigurationDTO? + if let googlePayConfigurationDTOList: [Any?] = nilOrValue(list[7]) { + googlePayConfigurationDTO = GooglePayConfigurationDTO.fromList(googlePayConfigurationDTOList) + } + var applePayConfigurationDTO: ApplePayConfigurationDTO? + if let applePayConfigurationDTOList: [Any?] = nilOrValue(list[8]) { + applePayConfigurationDTO = ApplePayConfigurationDTO.fromList(applePayConfigurationDTOList) + } + + return InstantPaymentConfigurationDTO( + instantPaymentType: instantPaymentType, + environment: environment, + clientKey: clientKey, + countryCode: countryCode, + amount: amount, + shopperLocale: shopperLocale, + analyticsOptionsDTO: analyticsOptionsDTO, + googlePayConfigurationDTO: googlePayConfigurationDTO, + applePayConfigurationDTO: applePayConfigurationDTO + ) + } + + func toList() -> [Any?] { + [ + instantPaymentType.rawValue, + environment.rawValue, + clientKey, + countryCode, + amount?.toList(), + shopperLocale, + analyticsOptionsDTO.toList(), + googlePayConfigurationDTO?.toList(), + applePayConfigurationDTO?.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct InstantPaymentSetupResultDTO { - var instantPaymentType: InstantPaymentType - var isSupported: Bool - var resultData: Any? = nil - - static func fromList(_ list: [Any?]) -> InstantPaymentSetupResultDTO? { - let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! - let isSupported = list[1] as! Bool - let resultData: Any? = list[2] - - return InstantPaymentSetupResultDTO( - instantPaymentType: instantPaymentType, - isSupported: isSupported, - resultData: resultData - ) - } - func toList() -> [Any?] { - return [ - instantPaymentType.rawValue, - isSupported, - resultData, - ] - } + var instantPaymentType: InstantPaymentType + var isSupported: Bool + var resultData: Any? + + static func fromList(_ list: [Any?]) -> InstantPaymentSetupResultDTO? { + let instantPaymentType = InstantPaymentType(rawValue: list[0] as! Int)! + let isSupported = list[1] as! Bool + let resultData: Any? = list[2] + + return InstantPaymentSetupResultDTO( + instantPaymentType: instantPaymentType, + isSupported: isSupported, + resultData: resultData + ) + } + + func toList() -> [Any?] { + [ + instantPaymentType.rawValue, + isSupported, + resultData + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct UnencryptedCardDTO { - var cardNumber: String? = nil - var expiryMonth: String? = nil - var expiryYear: String? = nil - var cvc: String? = nil - - static func fromList(_ list: [Any?]) -> UnencryptedCardDTO? { - let cardNumber: String? = nilOrValue(list[0]) - let expiryMonth: String? = nilOrValue(list[1]) - let expiryYear: String? = nilOrValue(list[2]) - let cvc: String? = nilOrValue(list[3]) - - return UnencryptedCardDTO( - cardNumber: cardNumber, - expiryMonth: expiryMonth, - expiryYear: expiryYear, - cvc: cvc - ) - } - func toList() -> [Any?] { - return [ - cardNumber, - expiryMonth, - expiryYear, - cvc, - ] - } + var cardNumber: String? + var expiryMonth: String? + var expiryYear: String? + var cvc: String? + + static func fromList(_ list: [Any?]) -> UnencryptedCardDTO? { + let cardNumber: String? = nilOrValue(list[0]) + let expiryMonth: String? = nilOrValue(list[1]) + let expiryYear: String? = nilOrValue(list[2]) + let cvc: String? = nilOrValue(list[3]) + + return UnencryptedCardDTO( + cardNumber: cardNumber, + expiryMonth: expiryMonth, + expiryYear: expiryYear, + cvc: cvc + ) + } + + func toList() -> [Any?] { + [ + cardNumber, + expiryMonth, + expiryYear, + cvc + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct EncryptedCardDTO { - var encryptedCardNumber: String? = nil - var encryptedExpiryMonth: String? = nil - var encryptedExpiryYear: String? = nil - var encryptedSecurityCode: String? = nil - - static func fromList(_ list: [Any?]) -> EncryptedCardDTO? { - let encryptedCardNumber: String? = nilOrValue(list[0]) - let encryptedExpiryMonth: String? = nilOrValue(list[1]) - let encryptedExpiryYear: String? = nilOrValue(list[2]) - let encryptedSecurityCode: String? = nilOrValue(list[3]) - - return EncryptedCardDTO( - encryptedCardNumber: encryptedCardNumber, - encryptedExpiryMonth: encryptedExpiryMonth, - encryptedExpiryYear: encryptedExpiryYear, - encryptedSecurityCode: encryptedSecurityCode - ) - } - func toList() -> [Any?] { - return [ - encryptedCardNumber, - encryptedExpiryMonth, - encryptedExpiryYear, - encryptedSecurityCode, - ] - } + var encryptedCardNumber: String? + var encryptedExpiryMonth: String? + var encryptedExpiryYear: String? + var encryptedSecurityCode: String? + + static func fromList(_ list: [Any?]) -> EncryptedCardDTO? { + let encryptedCardNumber: String? = nilOrValue(list[0]) + let encryptedExpiryMonth: String? = nilOrValue(list[1]) + let encryptedExpiryYear: String? = nilOrValue(list[2]) + let encryptedSecurityCode: String? = nilOrValue(list[3]) + + return EncryptedCardDTO( + encryptedCardNumber: encryptedCardNumber, + encryptedExpiryMonth: encryptedExpiryMonth, + encryptedExpiryYear: encryptedExpiryYear, + encryptedSecurityCode: encryptedSecurityCode + ) + } + + func toList() -> [Any?] { + [ + encryptedCardNumber, + encryptedExpiryMonth, + encryptedExpiryYear, + encryptedSecurityCode + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct ActionComponentConfigurationDTO { - var environment: Environment - var clientKey: String - var shopperLocale: String? = nil - var amount: AmountDTO? = nil - var analyticsOptionsDTO: AnalyticsOptionsDTO - - static func fromList(_ list: [Any?]) -> ActionComponentConfigurationDTO? { - let environment = Environment(rawValue: list[0] as! Int)! - let clientKey = list[1] as! String - let shopperLocale: String? = nilOrValue(list[2]) - var amount: AmountDTO? = nil - if let amountList: [Any?] = nilOrValue(list[3]) { - amount = AmountDTO.fromList(amountList) - } - let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[4] as! [Any?])! - - return ActionComponentConfigurationDTO( - environment: environment, - clientKey: clientKey, - shopperLocale: shopperLocale, - amount: amount, - analyticsOptionsDTO: analyticsOptionsDTO - ) - } - func toList() -> [Any?] { - return [ - environment.rawValue, - clientKey, - shopperLocale, - amount?.toList(), - analyticsOptionsDTO.toList(), - ] - } + var environment: Environment + var clientKey: String + var shopperLocale: String? + var amount: AmountDTO? + var analyticsOptionsDTO: AnalyticsOptionsDTO + + static func fromList(_ list: [Any?]) -> ActionComponentConfigurationDTO? { + let environment = Environment(rawValue: list[0] as! Int)! + let clientKey = list[1] as! String + let shopperLocale: String? = nilOrValue(list[2]) + var amount: AmountDTO? + if let amountList: [Any?] = nilOrValue(list[3]) { + amount = AmountDTO.fromList(amountList) + } + let analyticsOptionsDTO = AnalyticsOptionsDTO.fromList(list[4] as! [Any?])! + + return ActionComponentConfigurationDTO( + environment: environment, + clientKey: clientKey, + shopperLocale: shopperLocale, + amount: amount, + analyticsOptionsDTO: analyticsOptionsDTO + ) + } + + func toList() -> [Any?] { + [ + environment.rawValue, + clientKey, + shopperLocale, + amount?.toList(), + analyticsOptionsDTO.toList() + ] + } } /// Generated class from Pigeon that represents data sent in messages. struct OrderCancelResponseDTO { - var orderCancelResponseBody: [String?: Any?] - var updatedPaymentMethods: [String?: Any?]? = nil - - static func fromList(_ list: [Any?]) -> OrderCancelResponseDTO? { - let orderCancelResponseBody = list[0] as! [String?: Any?] - let updatedPaymentMethods: [String?: Any?]? = nilOrValue(list[1]) - - return OrderCancelResponseDTO( - orderCancelResponseBody: orderCancelResponseBody, - updatedPaymentMethods: updatedPaymentMethods - ) - } - func toList() -> [Any?] { - return [ - orderCancelResponseBody, - updatedPaymentMethods, - ] - } + var orderCancelResponseBody: [String?: Any?] + var updatedPaymentMethods: [String?: Any?]? + + static func fromList(_ list: [Any?]) -> OrderCancelResponseDTO? { + let orderCancelResponseBody = list[0] as! [String?: Any?] + let updatedPaymentMethods: [String?: Any?]? = nilOrValue(list[1]) + + return OrderCancelResponseDTO( + orderCancelResponseBody: orderCancelResponseBody, + updatedPaymentMethods: updatedPaymentMethods + ) + } + + func toList() -> [Any?] { + [ + orderCancelResponseBody, + updatedPaymentMethods + ] + } } private class CheckoutPlatformInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) - case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) - case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) - case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 136: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 137: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 138: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 139: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) - case 140: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) - case 141: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 142: - return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) - case 143: - return ErrorDTO.fromList(self.readValue() as! [Any?]) - case 144: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 145: - return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 146: - return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) - case 147: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) - case 148: - return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) - case 149: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 150: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) - case 151: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 152: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 153: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) - case 154: - return SessionDTO.fromList(self.readValue() as! [Any?]) - case 155: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 156: - return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 128: + return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 129: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 130: + return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) + case 131: + return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 132: + return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) + case 133: + return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) + case 134: + return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) + case 135: + return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + case 136: + return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 137: + return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 138: + return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 139: + return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) + case 140: + return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) + case 141: + return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 142: + return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) + case 143: + return ErrorDTO.fromList(self.readValue() as! [Any?]) + case 144: + return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 145: + return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 146: + return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) + case 147: + return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) + case 148: + return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) + case 149: + return OrderResponseDTO.fromList(self.readValue() as! [Any?]) + case 150: + return PaymentEventDTO.fromList(self.readValue() as! [Any?]) + case 151: + return PaymentResultDTO.fromList(self.readValue() as! [Any?]) + case 152: + return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) + case 153: + return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) + case 154: + return SessionDTO.fromList(self.readValue() as! [Any?]) + case 155: + return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + case 156: + return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } } private class CheckoutPlatformInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? ActionComponentConfigurationDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { - super.writeByte(138) - super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { - super.writeByte(139) - super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { - super.writeByte(140) - super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { - super.writeByte(141) - super.writeValue(value.toList()) - } else if let value = value as? EncryptedCardDTO { - super.writeByte(142) - super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { - super.writeByte(143) - super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentConfigurationDTO { - super.writeByte(145) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentSetupResultDTO { - super.writeByte(146) - super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { - super.writeByte(147) - super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResponseDTO { - super.writeByte(148) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(149) - super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { - super.writeByte(150) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(151) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(152) - super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { - super.writeByte(153) - super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { - super.writeByte(154) - super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { - super.writeByte(155) - super.writeValue(value.toList()) - } else if let value = value as? UnencryptedCardDTO { - super.writeByte(156) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } + override func writeValue(_ value: Any) { + if let value = value as? ActionComponentConfigurationDTO { + super.writeByte(128) + super.writeValue(value.toList()) + } else if let value = value as? AmountDTO { + super.writeByte(129) + super.writeValue(value.toList()) + } else if let value = value as? AnalyticsOptionsDTO { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayConfigurationDTO { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayContactDTO { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayShippingMethodDTO { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? ApplePaySummaryItemDTO { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? BillingAddressParametersDTO { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? CardComponentConfigurationDTO { + super.writeByte(136) + super.writeValue(value.toList()) + } else if let value = value as? CardConfigurationDTO { + super.writeByte(137) + super.writeValue(value.toList()) + } else if let value = value as? CashAppPayConfigurationDTO { + super.writeByte(138) + super.writeValue(value.toList()) + } else if let value = value as? ComponentCommunicationModel { + super.writeByte(139) + super.writeValue(value.toList()) + } else if let value = value as? DeletedStoredPaymentMethodResultDTO { + super.writeByte(140) + super.writeValue(value.toList()) + } else if let value = value as? DropInConfigurationDTO { + super.writeByte(141) + super.writeValue(value.toList()) + } else if let value = value as? EncryptedCardDTO { + super.writeByte(142) + super.writeValue(value.toList()) + } else if let value = value as? ErrorDTO { + super.writeByte(143) + super.writeValue(value.toList()) + } else if let value = value as? GooglePayConfigurationDTO { + super.writeByte(144) + super.writeValue(value.toList()) + } else if let value = value as? InstantPaymentConfigurationDTO { + super.writeByte(145) + super.writeValue(value.toList()) + } else if let value = value as? InstantPaymentSetupResultDTO { + super.writeByte(146) + super.writeValue(value.toList()) + } else if let value = value as? MerchantInfoDTO { + super.writeByte(147) + super.writeValue(value.toList()) + } else if let value = value as? OrderCancelResponseDTO { + super.writeByte(148) + super.writeValue(value.toList()) + } else if let value = value as? OrderResponseDTO { + super.writeByte(149) + super.writeValue(value.toList()) + } else if let value = value as? PaymentEventDTO { + super.writeByte(150) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultDTO { + super.writeByte(151) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultModelDTO { + super.writeByte(152) + super.writeValue(value.toList()) + } else if let value = value as? PlatformCommunicationModel { + super.writeByte(153) + super.writeValue(value.toList()) + } else if let value = value as? SessionDTO { + super.writeByte(154) + super.writeValue(value.toList()) + } else if let value = value as? ShippingAddressParametersDTO { + super.writeByte(155) + super.writeValue(value.toList()) + } else if let value = value as? UnencryptedCardDTO { + super.writeByte(156) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } } private class CheckoutPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return CheckoutPlatformInterfaceCodecReader(data: data) - } + override func reader(with data: Data) -> FlutterStandardReader { + CheckoutPlatformInterfaceCodecReader(data: data) + } - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return CheckoutPlatformInterfaceCodecWriter(data: data) - } + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + CheckoutPlatformInterfaceCodecWriter(data: data) + } } class CheckoutPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = CheckoutPlatformInterfaceCodec(readerWriter: CheckoutPlatformInterfaceCodecReaderWriter()) + static let shared = CheckoutPlatformInterfaceCodec(readerWriter: CheckoutPlatformInterfaceCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol CheckoutPlatformInterface { - func getReturnUrl(completion: @escaping (Result) -> Void) - func createSession(sessionId: String, sessionData: String, configuration: Any?, completion: @escaping (Result) -> Void) - func clearSession() throws - func encryptCard(unencryptedCardDTO: UnencryptedCardDTO, publicKey: String, completion: @escaping (Result) -> Void) - func encryptBin(bin: String, publicKey: String, completion: @escaping (Result) -> Void) - func enableConsoleLogging(loggingEnabled: Bool) throws + func getReturnUrl(completion: @escaping (Result) -> Void) + func createSession(sessionId: String, sessionData: String, configuration: Any?, completion: @escaping (Result) -> Void) + func clearSession() throws + func encryptCard(unencryptedCardDTO: UnencryptedCardDTO, publicKey: String, completion: @escaping (Result) -> Void) + func encryptBin(bin: String, publicKey: String, completion: @escaping (Result) -> Void) + func enableConsoleLogging(loggingEnabled: Bool) throws } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class CheckoutPlatformInterfaceSetup { - /// The codec used by CheckoutPlatformInterface. - static var codec: FlutterStandardMessageCodec { CheckoutPlatformInterfaceCodec.shared } - /// Sets up an instance of `CheckoutPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CheckoutPlatformInterface?) { - let getReturnUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getReturnUrlChannel.setMessageHandler { _, reply in - api.getReturnUrl { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + /// The codec used by CheckoutPlatformInterface. + static var codec: FlutterStandardMessageCodec { CheckoutPlatformInterfaceCodec.shared } + /// Sets up an instance of `CheckoutPlatformInterface` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CheckoutPlatformInterface?) { + let getReturnUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api { + getReturnUrlChannel.setMessageHandler { _, reply in + api.getReturnUrl { result in + switch result { + case let .success(res): + reply(wrapResult(res)) + case let .failure(error): + reply(wrapError(error)) + } + } + } + } else { + getReturnUrlChannel.setMessageHandler(nil) } - } - } else { - getReturnUrlChannel.setMessageHandler(nil) - } - let createSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - createSessionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let sessionIdArg = args[0] as! String - let sessionDataArg = args[1] as! String - let configurationArg: Any? = args[2] - api.createSession(sessionId: sessionIdArg, sessionData: sessionDataArg, configuration: configurationArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let createSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession", binaryMessenger: binaryMessenger, codec: codec) + if let api { + createSessionChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let sessionIdArg = args[0] as! String + let sessionDataArg = args[1] as! String + let configurationArg: Any? = args[2] + api.createSession(sessionId: sessionIdArg, sessionData: sessionDataArg, configuration: configurationArg) { result in + switch result { + case let .success(res): + reply(wrapResult(res)) + case let .failure(error): + reply(wrapError(error)) + } + } + } + } else { + createSessionChannel.setMessageHandler(nil) } - } - } else { - createSessionChannel.setMessageHandler(nil) - } - let clearSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - clearSessionChannel.setMessageHandler { _, reply in - do { - try api.clearSession() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let clearSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession", binaryMessenger: binaryMessenger, codec: codec) + if let api { + clearSessionChannel.setMessageHandler { _, reply in + do { + try api.clearSession() + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + clearSessionChannel.setMessageHandler(nil) } - } - } else { - clearSessionChannel.setMessageHandler(nil) - } - let encryptCardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - encryptCardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let unencryptedCardDTOArg = args[0] as! UnencryptedCardDTO - let publicKeyArg = args[1] as! String - api.encryptCard(unencryptedCardDTO: unencryptedCardDTOArg, publicKey: publicKeyArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let encryptCardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard", binaryMessenger: binaryMessenger, codec: codec) + if let api { + encryptCardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let unencryptedCardDTOArg = args[0] as! UnencryptedCardDTO + let publicKeyArg = args[1] as! String + api.encryptCard(unencryptedCardDTO: unencryptedCardDTOArg, publicKey: publicKeyArg) { result in + switch result { + case let .success(res): + reply(wrapResult(res)) + case let .failure(error): + reply(wrapError(error)) + } + } + } + } else { + encryptCardChannel.setMessageHandler(nil) } - } - } else { - encryptCardChannel.setMessageHandler(nil) - } - let encryptBinChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - encryptBinChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let binArg = args[0] as! String - let publicKeyArg = args[1] as! String - api.encryptBin(bin: binArg, publicKey: publicKeyArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let encryptBinChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin", binaryMessenger: binaryMessenger, codec: codec) + if let api { + encryptBinChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let binArg = args[0] as! String + let publicKeyArg = args[1] as! String + api.encryptBin(bin: binArg, publicKey: publicKeyArg) { result in + switch result { + case let .success(res): + reply(wrapResult(res)) + case let .failure(error): + reply(wrapError(error)) + } + } + } + } else { + encryptBinChannel.setMessageHandler(nil) } - } - } else { - encryptBinChannel.setMessageHandler(nil) - } - let enableConsoleLoggingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - enableConsoleLoggingChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let loggingEnabledArg = args[0] as! Bool - do { - try api.enableConsoleLogging(loggingEnabled: loggingEnabledArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let enableConsoleLoggingChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging", binaryMessenger: binaryMessenger, codec: codec) + if let api { + enableConsoleLoggingChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let loggingEnabledArg = args[0] as! Bool + do { + try api.enableConsoleLogging(loggingEnabled: loggingEnabledArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + enableConsoleLoggingChannel.setMessageHandler(nil) } - } - } else { - enableConsoleLoggingChannel.setMessageHandler(nil) } - } } + private class DropInPlatformInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) - case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) - case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) - case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 136: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 137: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 138: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) - case 139: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 140: - return ErrorDTO.fromList(self.readValue() as! [Any?]) - case 141: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 142: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) - case 143: - return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) - case 144: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) - case 145: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 128: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 129: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 130: + return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) + case 131: + return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 132: + return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) + case 133: + return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) + case 134: + return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) + case 135: + return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + case 136: + return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 137: + return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 138: + return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) + case 139: + return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 140: + return ErrorDTO.fromList(self.readValue() as! [Any?]) + case 141: + return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 142: + return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) + case 143: + return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) + case 144: + return PaymentEventDTO.fromList(self.readValue() as! [Any?]) + case 145: + return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } } private class DropInPlatformInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { - super.writeByte(138) - super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { - super.writeByte(139) - super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { - super.writeByte(140) - super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { - super.writeByte(141) - super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { - super.writeByte(142) - super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResponseDTO { - super.writeByte(143) - super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { - super.writeByte(145) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } + override func writeValue(_ value: Any) { + if let value = value as? AmountDTO { + super.writeByte(128) + super.writeValue(value.toList()) + } else if let value = value as? AmountDTO { + super.writeByte(129) + super.writeValue(value.toList()) + } else if let value = value as? AnalyticsOptionsDTO { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayConfigurationDTO { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayContactDTO { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayShippingMethodDTO { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? ApplePaySummaryItemDTO { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? BillingAddressParametersDTO { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? CardConfigurationDTO { + super.writeByte(136) + super.writeValue(value.toList()) + } else if let value = value as? CashAppPayConfigurationDTO { + super.writeByte(137) + super.writeValue(value.toList()) + } else if let value = value as? DeletedStoredPaymentMethodResultDTO { + super.writeByte(138) + super.writeValue(value.toList()) + } else if let value = value as? DropInConfigurationDTO { + super.writeByte(139) + super.writeValue(value.toList()) + } else if let value = value as? ErrorDTO { + super.writeByte(140) + super.writeValue(value.toList()) + } else if let value = value as? GooglePayConfigurationDTO { + super.writeByte(141) + super.writeValue(value.toList()) + } else if let value = value as? MerchantInfoDTO { + super.writeByte(142) + super.writeValue(value.toList()) + } else if let value = value as? OrderCancelResponseDTO { + super.writeByte(143) + super.writeValue(value.toList()) + } else if let value = value as? PaymentEventDTO { + super.writeByte(144) + super.writeValue(value.toList()) + } else if let value = value as? ShippingAddressParametersDTO { + super.writeByte(145) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } } private class DropInPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return DropInPlatformInterfaceCodecReader(data: data) - } + override func reader(with data: Data) -> FlutterStandardReader { + DropInPlatformInterfaceCodecReader(data: data) + } - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return DropInPlatformInterfaceCodecWriter(data: data) - } + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + DropInPlatformInterfaceCodecWriter(data: data) + } } class DropInPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = DropInPlatformInterfaceCodec(readerWriter: DropInPlatformInterfaceCodecReaderWriter()) + static let shared = DropInPlatformInterfaceCodec(readerWriter: DropInPlatformInterfaceCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol DropInPlatformInterface { - func showDropInSession(dropInConfigurationDTO: DropInConfigurationDTO) throws - func showDropInAdvanced(dropInConfigurationDTO: DropInConfigurationDTO, paymentMethodsResponse: String) throws - func onPaymentsResult(paymentsResult: PaymentEventDTO) throws - func onPaymentsDetailsResult(paymentsDetailsResult: PaymentEventDTO) throws - func onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: DeletedStoredPaymentMethodResultDTO) throws - func onBalanceCheckResult(balanceCheckResponse: String) throws - func onOrderRequestResult(orderRequestResponse: String) throws - func onOrderCancelResult(orderCancelResponse: OrderCancelResponseDTO) throws - func cleanUpDropIn() throws + func showDropInSession(dropInConfigurationDTO: DropInConfigurationDTO) throws + func showDropInAdvanced(dropInConfigurationDTO: DropInConfigurationDTO, paymentMethodsResponse: String) throws + func onPaymentsResult(paymentsResult: PaymentEventDTO) throws + func onPaymentsDetailsResult(paymentsDetailsResult: PaymentEventDTO) throws + func onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: DeletedStoredPaymentMethodResultDTO) throws + func onBalanceCheckResult(balanceCheckResponse: String) throws + func onOrderRequestResult(orderRequestResponse: String) throws + func onOrderCancelResult(orderCancelResponse: OrderCancelResponseDTO) throws + func cleanUpDropIn() throws } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class DropInPlatformInterfaceSetup { - /// The codec used by DropInPlatformInterface. - static var codec: FlutterStandardMessageCodec { DropInPlatformInterfaceCodec.shared } - /// Sets up an instance of `DropInPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: DropInPlatformInterface?) { - let showDropInSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - showDropInSessionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let dropInConfigurationDTOArg = args[0] as! DropInConfigurationDTO - do { - try api.showDropInSession(dropInConfigurationDTO: dropInConfigurationDTOArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + /// The codec used by DropInPlatformInterface. + static var codec: FlutterStandardMessageCodec { DropInPlatformInterfaceCodec.shared } + /// Sets up an instance of `DropInPlatformInterface` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: DropInPlatformInterface?) { + let showDropInSessionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession", binaryMessenger: binaryMessenger, codec: codec) + if let api { + showDropInSessionChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let dropInConfigurationDTOArg = args[0] as! DropInConfigurationDTO + do { + try api.showDropInSession(dropInConfigurationDTO: dropInConfigurationDTOArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + showDropInSessionChannel.setMessageHandler(nil) } - } - } else { - showDropInSessionChannel.setMessageHandler(nil) - } - let showDropInAdvancedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - showDropInAdvancedChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let dropInConfigurationDTOArg = args[0] as! DropInConfigurationDTO - let paymentMethodsResponseArg = args[1] as! String - do { - try api.showDropInAdvanced(dropInConfigurationDTO: dropInConfigurationDTOArg, paymentMethodsResponse: paymentMethodsResponseArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let showDropInAdvancedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced", binaryMessenger: binaryMessenger, codec: codec) + if let api { + showDropInAdvancedChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let dropInConfigurationDTOArg = args[0] as! DropInConfigurationDTO + let paymentMethodsResponseArg = args[1] as! String + do { + try api.showDropInAdvanced(dropInConfigurationDTO: dropInConfigurationDTOArg, paymentMethodsResponse: paymentMethodsResponseArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + showDropInAdvancedChannel.setMessageHandler(nil) } - } - } else { - showDropInAdvancedChannel.setMessageHandler(nil) - } - let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onPaymentsResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let paymentsResultArg = args[0] as! PaymentEventDTO - do { - try api.onPaymentsResult(paymentsResult: paymentsResultArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onPaymentsResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let paymentsResultArg = args[0] as! PaymentEventDTO + do { + try api.onPaymentsResult(paymentsResult: paymentsResultArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onPaymentsResultChannel.setMessageHandler(nil) } - } - } else { - onPaymentsResultChannel.setMessageHandler(nil) - } - let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onPaymentsDetailsResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let paymentsDetailsResultArg = args[0] as! PaymentEventDTO - do { - try api.onPaymentsDetailsResult(paymentsDetailsResult: paymentsDetailsResultArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onPaymentsDetailsResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let paymentsDetailsResultArg = args[0] as! PaymentEventDTO + do { + try api.onPaymentsDetailsResult(paymentsDetailsResult: paymentsDetailsResultArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onPaymentsDetailsResultChannel.setMessageHandler(nil) } - } - } else { - onPaymentsDetailsResultChannel.setMessageHandler(nil) - } - let onDeleteStoredPaymentMethodResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onDeleteStoredPaymentMethodResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let deleteStoredPaymentMethodResultDTOArg = args[0] as! DeletedStoredPaymentMethodResultDTO - do { - try api.onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: deleteStoredPaymentMethodResultDTOArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onDeleteStoredPaymentMethodResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onDeleteStoredPaymentMethodResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let deleteStoredPaymentMethodResultDTOArg = args[0] as! DeletedStoredPaymentMethodResultDTO + do { + try api.onDeleteStoredPaymentMethodResult(deleteStoredPaymentMethodResultDTO: deleteStoredPaymentMethodResultDTOArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onDeleteStoredPaymentMethodResultChannel.setMessageHandler(nil) } - } - } else { - onDeleteStoredPaymentMethodResultChannel.setMessageHandler(nil) - } - let onBalanceCheckResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onBalanceCheckResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let balanceCheckResponseArg = args[0] as! String - do { - try api.onBalanceCheckResult(balanceCheckResponse: balanceCheckResponseArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onBalanceCheckResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onBalanceCheckResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let balanceCheckResponseArg = args[0] as! String + do { + try api.onBalanceCheckResult(balanceCheckResponse: balanceCheckResponseArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onBalanceCheckResultChannel.setMessageHandler(nil) } - } - } else { - onBalanceCheckResultChannel.setMessageHandler(nil) - } - let onOrderRequestResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onOrderRequestResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let orderRequestResponseArg = args[0] as! String - do { - try api.onOrderRequestResult(orderRequestResponse: orderRequestResponseArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onOrderRequestResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onOrderRequestResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let orderRequestResponseArg = args[0] as! String + do { + try api.onOrderRequestResult(orderRequestResponse: orderRequestResponseArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onOrderRequestResultChannel.setMessageHandler(nil) } - } - } else { - onOrderRequestResultChannel.setMessageHandler(nil) - } - let onOrderCancelResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onOrderCancelResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let orderCancelResponseArg = args[0] as! OrderCancelResponseDTO - do { - try api.onOrderCancelResult(orderCancelResponse: orderCancelResponseArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onOrderCancelResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onOrderCancelResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let orderCancelResponseArg = args[0] as! OrderCancelResponseDTO + do { + try api.onOrderCancelResult(orderCancelResponse: orderCancelResponseArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onOrderCancelResultChannel.setMessageHandler(nil) } - } - } else { - onOrderCancelResultChannel.setMessageHandler(nil) - } - let cleanUpDropInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - cleanUpDropInChannel.setMessageHandler { _, reply in - do { - try api.cleanUpDropIn() - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let cleanUpDropInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn", binaryMessenger: binaryMessenger, codec: codec) + if let api { + cleanUpDropInChannel.setMessageHandler { _, reply in + do { + try api.cleanUpDropIn() + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + cleanUpDropInChannel.setMessageHandler(nil) } - } - } else { - cleanUpDropInChannel.setMessageHandler(nil) } - } } + private class DropInFlutterInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 130: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 131: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 132: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 128: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 129: + return OrderResponseDTO.fromList(self.readValue() as! [Any?]) + case 130: + return PaymentResultDTO.fromList(self.readValue() as! [Any?]) + case 131: + return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) + case 132: + return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } } private class DropInFlutterInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { - super.writeByte(132) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } + override func writeValue(_ value: Any) { + if let value = value as? AmountDTO { + super.writeByte(128) + super.writeValue(value.toList()) + } else if let value = value as? OrderResponseDTO { + super.writeByte(129) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultDTO { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultModelDTO { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? PlatformCommunicationModel { + super.writeByte(132) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } } private class DropInFlutterInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return DropInFlutterInterfaceCodecReader(data: data) - } + override func reader(with data: Data) -> FlutterStandardReader { + DropInFlutterInterfaceCodecReader(data: data) + } - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return DropInFlutterInterfaceCodecWriter(data: data) - } + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + DropInFlutterInterfaceCodecWriter(data: data) + } } class DropInFlutterInterfaceCodec: FlutterStandardMessageCodec { - static let shared = DropInFlutterInterfaceCodec(readerWriter: DropInFlutterInterfaceCodecReaderWriter()) + static let shared = DropInFlutterInterfaceCodec(readerWriter: DropInFlutterInterfaceCodecReaderWriter()) } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol DropInFlutterInterfaceProtocol { - func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) - func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) + func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) + func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) } + class DropInFlutterInterface: DropInFlutterInterfaceProtocol { - private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger) { - self.binaryMessenger = binaryMessenger - } - var codec: FlutterStandardMessageCodec { - return DropInFlutterInterfaceCodec.shared - } - func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } + private let binaryMessenger: FlutterBinaryMessenger + init(binaryMessenger: FlutterBinaryMessenger) { + self.binaryMessenger = binaryMessenger + } + + var codec: FlutterStandardMessageCodec { + DropInFlutterInterfaceCodec.shared + } + + func onDropInSessionPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } + } + } + + func onDropInAdvancedPlatformCommunication(platformCommunicationModel platformCommunicationModelArg: PlatformCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([platformCommunicationModelArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } + } + } } + private class ComponentPlatformInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 130: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 131: - return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) - case 133: - return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) - case 134: - return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) - case 135: - return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 136: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 137: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 138: - return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 139: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) - case 140: - return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) - case 141: - return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 142: - return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) - case 143: - return ErrorDTO.fromList(self.readValue() as! [Any?]) - case 144: - return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 145: - return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 146: - return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) - case 147: - return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) - case 148: - return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) - case 149: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 150: - return PaymentEventDTO.fromList(self.readValue() as! [Any?]) - case 151: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 152: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 153: - return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) - case 154: - return SessionDTO.fromList(self.readValue() as! [Any?]) - case 155: - return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) - case 156: - return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 128: + return ActionComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 129: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 130: + return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) + case 131: + return ApplePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 132: + return ApplePayContactDTO.fromList(self.readValue() as! [Any?]) + case 133: + return ApplePayShippingMethodDTO.fromList(self.readValue() as! [Any?]) + case 134: + return ApplePaySummaryItemDTO.fromList(self.readValue() as! [Any?]) + case 135: + return BillingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + case 136: + return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 137: + return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 138: + return CashAppPayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 139: + return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) + case 140: + return DeletedStoredPaymentMethodResultDTO.fromList(self.readValue() as! [Any?]) + case 141: + return DropInConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 142: + return EncryptedCardDTO.fromList(self.readValue() as! [Any?]) + case 143: + return ErrorDTO.fromList(self.readValue() as! [Any?]) + case 144: + return GooglePayConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 145: + return InstantPaymentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 146: + return InstantPaymentSetupResultDTO.fromList(self.readValue() as! [Any?]) + case 147: + return MerchantInfoDTO.fromList(self.readValue() as! [Any?]) + case 148: + return OrderCancelResponseDTO.fromList(self.readValue() as! [Any?]) + case 149: + return OrderResponseDTO.fromList(self.readValue() as! [Any?]) + case 150: + return PaymentEventDTO.fromList(self.readValue() as! [Any?]) + case 151: + return PaymentResultDTO.fromList(self.readValue() as! [Any?]) + case 152: + return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) + case 153: + return PlatformCommunicationModel.fromList(self.readValue() as! [Any?]) + case 154: + return SessionDTO.fromList(self.readValue() as! [Any?]) + case 155: + return ShippingAddressParametersDTO.fromList(self.readValue() as! [Any?]) + case 156: + return UnencryptedCardDTO.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } } private class ComponentPlatformInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? ActionComponentConfigurationDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AmountDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayContactDTO { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? ApplePayShippingMethodDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? ApplePaySummaryItemDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? BillingAddressParametersDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(137) - super.writeValue(value.toList()) - } else if let value = value as? CashAppPayConfigurationDTO { - super.writeByte(138) - super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { - super.writeByte(139) - super.writeValue(value.toList()) - } else if let value = value as? DeletedStoredPaymentMethodResultDTO { - super.writeByte(140) - super.writeValue(value.toList()) - } else if let value = value as? DropInConfigurationDTO { - super.writeByte(141) - super.writeValue(value.toList()) - } else if let value = value as? EncryptedCardDTO { - super.writeByte(142) - super.writeValue(value.toList()) - } else if let value = value as? ErrorDTO { - super.writeByte(143) - super.writeValue(value.toList()) - } else if let value = value as? GooglePayConfigurationDTO { - super.writeByte(144) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentConfigurationDTO { - super.writeByte(145) - super.writeValue(value.toList()) - } else if let value = value as? InstantPaymentSetupResultDTO { - super.writeByte(146) - super.writeValue(value.toList()) - } else if let value = value as? MerchantInfoDTO { - super.writeByte(147) - super.writeValue(value.toList()) - } else if let value = value as? OrderCancelResponseDTO { - super.writeByte(148) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(149) - super.writeValue(value.toList()) - } else if let value = value as? PaymentEventDTO { - super.writeByte(150) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(151) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(152) - super.writeValue(value.toList()) - } else if let value = value as? PlatformCommunicationModel { - super.writeByte(153) - super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { - super.writeByte(154) - super.writeValue(value.toList()) - } else if let value = value as? ShippingAddressParametersDTO { - super.writeByte(155) - super.writeValue(value.toList()) - } else if let value = value as? UnencryptedCardDTO { - super.writeByte(156) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } + override func writeValue(_ value: Any) { + if let value = value as? ActionComponentConfigurationDTO { + super.writeByte(128) + super.writeValue(value.toList()) + } else if let value = value as? AmountDTO { + super.writeByte(129) + super.writeValue(value.toList()) + } else if let value = value as? AnalyticsOptionsDTO { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayConfigurationDTO { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayContactDTO { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? ApplePayShippingMethodDTO { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? ApplePaySummaryItemDTO { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? BillingAddressParametersDTO { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? CardComponentConfigurationDTO { + super.writeByte(136) + super.writeValue(value.toList()) + } else if let value = value as? CardConfigurationDTO { + super.writeByte(137) + super.writeValue(value.toList()) + } else if let value = value as? CashAppPayConfigurationDTO { + super.writeByte(138) + super.writeValue(value.toList()) + } else if let value = value as? ComponentCommunicationModel { + super.writeByte(139) + super.writeValue(value.toList()) + } else if let value = value as? DeletedStoredPaymentMethodResultDTO { + super.writeByte(140) + super.writeValue(value.toList()) + } else if let value = value as? DropInConfigurationDTO { + super.writeByte(141) + super.writeValue(value.toList()) + } else if let value = value as? EncryptedCardDTO { + super.writeByte(142) + super.writeValue(value.toList()) + } else if let value = value as? ErrorDTO { + super.writeByte(143) + super.writeValue(value.toList()) + } else if let value = value as? GooglePayConfigurationDTO { + super.writeByte(144) + super.writeValue(value.toList()) + } else if let value = value as? InstantPaymentConfigurationDTO { + super.writeByte(145) + super.writeValue(value.toList()) + } else if let value = value as? InstantPaymentSetupResultDTO { + super.writeByte(146) + super.writeValue(value.toList()) + } else if let value = value as? MerchantInfoDTO { + super.writeByte(147) + super.writeValue(value.toList()) + } else if let value = value as? OrderCancelResponseDTO { + super.writeByte(148) + super.writeValue(value.toList()) + } else if let value = value as? OrderResponseDTO { + super.writeByte(149) + super.writeValue(value.toList()) + } else if let value = value as? PaymentEventDTO { + super.writeByte(150) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultDTO { + super.writeByte(151) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultModelDTO { + super.writeByte(152) + super.writeValue(value.toList()) + } else if let value = value as? PlatformCommunicationModel { + super.writeByte(153) + super.writeValue(value.toList()) + } else if let value = value as? SessionDTO { + super.writeByte(154) + super.writeValue(value.toList()) + } else if let value = value as? ShippingAddressParametersDTO { + super.writeByte(155) + super.writeValue(value.toList()) + } else if let value = value as? UnencryptedCardDTO { + super.writeByte(156) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } } private class ComponentPlatformInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return ComponentPlatformInterfaceCodecReader(data: data) - } + override func reader(with data: Data) -> FlutterStandardReader { + ComponentPlatformInterfaceCodecReader(data: data) + } - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return ComponentPlatformInterfaceCodecWriter(data: data) - } + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + ComponentPlatformInterfaceCodecWriter(data: data) + } } class ComponentPlatformInterfaceCodec: FlutterStandardMessageCodec { - static let shared = ComponentPlatformInterfaceCodec(readerWriter: ComponentPlatformInterfaceCodecReaderWriter()) + static let shared = ComponentPlatformInterfaceCodec(readerWriter: ComponentPlatformInterfaceCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol ComponentPlatformInterface { - func updateViewHeight(viewId: Int64) throws - func onPaymentsResult(componentId: String, paymentsResult: PaymentEventDTO) throws - func onPaymentsDetailsResult(componentId: String, paymentsDetailsResult: PaymentEventDTO) throws - func isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, paymentMethodResponse: String, componentId: String, completion: @escaping (Result) -> Void) - func onInstantPaymentPressed(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, encodedPaymentMethod: String, componentId: String) throws - func handleAction(actionComponentConfiguration: ActionComponentConfigurationDTO, componentId: String, actionResponse: [String?: Any?]?) throws - func onDispose(componentId: String) throws + func updateViewHeight(viewId: Int64) throws + func onPaymentsResult(componentId: String, paymentsResult: PaymentEventDTO) throws + func onPaymentsDetailsResult(componentId: String, paymentsDetailsResult: PaymentEventDTO) throws + func isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, paymentMethodResponse: String, componentId: String, completion: @escaping (Result) -> Void) + func onInstantPaymentPressed(instantPaymentConfigurationDTO: InstantPaymentConfigurationDTO, encodedPaymentMethod: String, componentId: String) throws + func handleAction(actionComponentConfiguration: ActionComponentConfigurationDTO, componentId: String, actionResponse: [String?: Any?]?) throws + func onDispose(componentId: String) throws } /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class ComponentPlatformInterfaceSetup { - /// The codec used by ComponentPlatformInterface. - static var codec: FlutterStandardMessageCodec { ComponentPlatformInterfaceCodec.shared } - /// Sets up an instance of `ComponentPlatformInterface` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ComponentPlatformInterface?) { - let updateViewHeightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - updateViewHeightChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let viewIdArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) - do { - try api.updateViewHeight(viewId: viewIdArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + /// The codec used by ComponentPlatformInterface. + static var codec: FlutterStandardMessageCodec { ComponentPlatformInterfaceCodec.shared } + /// Sets up an instance of `ComponentPlatformInterface` to handle messages through the `binaryMessenger`. + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: ComponentPlatformInterface?) { + let updateViewHeightChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight", binaryMessenger: binaryMessenger, codec: codec) + if let api { + updateViewHeightChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let viewIdArg = args[0] is Int64 ? args[0] as! Int64 : Int64(args[0] as! Int32) + do { + try api.updateViewHeight(viewId: viewIdArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + updateViewHeightChannel.setMessageHandler(nil) } - } - } else { - updateViewHeightChannel.setMessageHandler(nil) - } - let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onPaymentsResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let componentIdArg = args[0] as! String - let paymentsResultArg = args[1] as! PaymentEventDTO - do { - try api.onPaymentsResult(componentId: componentIdArg, paymentsResult: paymentsResultArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onPaymentsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onPaymentsResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let componentIdArg = args[0] as! String + let paymentsResultArg = args[1] as! PaymentEventDTO + do { + try api.onPaymentsResult(componentId: componentIdArg, paymentsResult: paymentsResultArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onPaymentsResultChannel.setMessageHandler(nil) } - } - } else { - onPaymentsResultChannel.setMessageHandler(nil) - } - let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onPaymentsDetailsResultChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let componentIdArg = args[0] as! String - let paymentsDetailsResultArg = args[1] as! PaymentEventDTO - do { - try api.onPaymentsDetailsResult(componentId: componentIdArg, paymentsDetailsResult: paymentsDetailsResultArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onPaymentsDetailsResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onPaymentsDetailsResultChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let componentIdArg = args[0] as! String + let paymentsDetailsResultArg = args[1] as! PaymentEventDTO + do { + try api.onPaymentsDetailsResult(componentId: componentIdArg, paymentsDetailsResult: paymentsDetailsResultArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onPaymentsDetailsResultChannel.setMessageHandler(nil) } - } - } else { - onPaymentsDetailsResultChannel.setMessageHandler(nil) - } - let isInstantPaymentSupportedByPlatformChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - isInstantPaymentSupportedByPlatformChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let instantPaymentConfigurationDTOArg = args[0] as! InstantPaymentConfigurationDTO - let paymentMethodResponseArg = args[1] as! String - let componentIdArg = args[2] as! String - api.isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: instantPaymentConfigurationDTOArg, paymentMethodResponse: paymentMethodResponseArg, componentId: componentIdArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let isInstantPaymentSupportedByPlatformChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform", binaryMessenger: binaryMessenger, codec: codec) + if let api { + isInstantPaymentSupportedByPlatformChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let instantPaymentConfigurationDTOArg = args[0] as! InstantPaymentConfigurationDTO + let paymentMethodResponseArg = args[1] as! String + let componentIdArg = args[2] as! String + api.isInstantPaymentSupportedByPlatform(instantPaymentConfigurationDTO: instantPaymentConfigurationDTOArg, paymentMethodResponse: paymentMethodResponseArg, componentId: componentIdArg) { result in + switch result { + case let .success(res): + reply(wrapResult(res)) + case let .failure(error): + reply(wrapError(error)) + } + } + } + } else { + isInstantPaymentSupportedByPlatformChannel.setMessageHandler(nil) } - } - } else { - isInstantPaymentSupportedByPlatformChannel.setMessageHandler(nil) - } - let onInstantPaymentPressedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onInstantPaymentPressedChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let instantPaymentConfigurationDTOArg = args[0] as! InstantPaymentConfigurationDTO - let encodedPaymentMethodArg = args[1] as! String - let componentIdArg = args[2] as! String - do { - try api.onInstantPaymentPressed(instantPaymentConfigurationDTO: instantPaymentConfigurationDTOArg, encodedPaymentMethod: encodedPaymentMethodArg, componentId: componentIdArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onInstantPaymentPressedChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onInstantPaymentPressedChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let instantPaymentConfigurationDTOArg = args[0] as! InstantPaymentConfigurationDTO + let encodedPaymentMethodArg = args[1] as! String + let componentIdArg = args[2] as! String + do { + try api.onInstantPaymentPressed(instantPaymentConfigurationDTO: instantPaymentConfigurationDTOArg, encodedPaymentMethod: encodedPaymentMethodArg, componentId: componentIdArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onInstantPaymentPressedChannel.setMessageHandler(nil) } - } - } else { - onInstantPaymentPressedChannel.setMessageHandler(nil) - } - let handleActionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - handleActionChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let actionComponentConfigurationArg = args[0] as! ActionComponentConfigurationDTO - let componentIdArg = args[1] as! String - let actionResponseArg: [String?: Any?]? = nilOrValue(args[2]) - do { - try api.handleAction(actionComponentConfiguration: actionComponentConfigurationArg, componentId: componentIdArg, actionResponse: actionResponseArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let handleActionChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction", binaryMessenger: binaryMessenger, codec: codec) + if let api { + handleActionChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let actionComponentConfigurationArg = args[0] as! ActionComponentConfigurationDTO + let componentIdArg = args[1] as! String + let actionResponseArg: [String?: Any?]? = nilOrValue(args[2]) + do { + try api.handleAction(actionComponentConfiguration: actionComponentConfigurationArg, componentId: componentIdArg, actionResponse: actionResponseArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + handleActionChannel.setMessageHandler(nil) } - } - } else { - handleActionChannel.setMessageHandler(nil) - } - let onDisposeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - onDisposeChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let componentIdArg = args[0] as! String - do { - try api.onDispose(componentId: componentIdArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let onDisposeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose", binaryMessenger: binaryMessenger, codec: codec) + if let api { + onDisposeChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let componentIdArg = args[0] as! String + do { + try api.onDispose(componentId: componentIdArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + onDisposeChannel.setMessageHandler(nil) } - } - } else { - onDisposeChannel.setMessageHandler(nil) } - } } + private class ComponentFlutterInterfaceCodecReader: FlutterStandardReader { - override func readValue(ofType type: UInt8) -> Any? { - switch type { - case 128: - return AmountDTO.fromList(self.readValue() as! [Any?]) - case 129: - return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) - case 130: - return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 131: - return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) - case 132: - return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) - case 133: - return OrderResponseDTO.fromList(self.readValue() as! [Any?]) - case 134: - return PaymentResultDTO.fromList(self.readValue() as! [Any?]) - case 135: - return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) - case 136: - return SessionDTO.fromList(self.readValue() as! [Any?]) - default: - return super.readValue(ofType: type) - } - } + override func readValue(ofType type: UInt8) -> Any? { + switch type { + case 128: + return AmountDTO.fromList(self.readValue() as! [Any?]) + case 129: + return AnalyticsOptionsDTO.fromList(self.readValue() as! [Any?]) + case 130: + return CardComponentConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 131: + return CardConfigurationDTO.fromList(self.readValue() as! [Any?]) + case 132: + return ComponentCommunicationModel.fromList(self.readValue() as! [Any?]) + case 133: + return OrderResponseDTO.fromList(self.readValue() as! [Any?]) + case 134: + return PaymentResultDTO.fromList(self.readValue() as! [Any?]) + case 135: + return PaymentResultModelDTO.fromList(self.readValue() as! [Any?]) + case 136: + return SessionDTO.fromList(self.readValue() as! [Any?]) + default: + return super.readValue(ofType: type) + } + } } private class ComponentFlutterInterfaceCodecWriter: FlutterStandardWriter { - override func writeValue(_ value: Any) { - if let value = value as? AmountDTO { - super.writeByte(128) - super.writeValue(value.toList()) - } else if let value = value as? AnalyticsOptionsDTO { - super.writeByte(129) - super.writeValue(value.toList()) - } else if let value = value as? CardComponentConfigurationDTO { - super.writeByte(130) - super.writeValue(value.toList()) - } else if let value = value as? CardConfigurationDTO { - super.writeByte(131) - super.writeValue(value.toList()) - } else if let value = value as? ComponentCommunicationModel { - super.writeByte(132) - super.writeValue(value.toList()) - } else if let value = value as? OrderResponseDTO { - super.writeByte(133) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultDTO { - super.writeByte(134) - super.writeValue(value.toList()) - } else if let value = value as? PaymentResultModelDTO { - super.writeByte(135) - super.writeValue(value.toList()) - } else if let value = value as? SessionDTO { - super.writeByte(136) - super.writeValue(value.toList()) - } else { - super.writeValue(value) - } - } + override func writeValue(_ value: Any) { + if let value = value as? AmountDTO { + super.writeByte(128) + super.writeValue(value.toList()) + } else if let value = value as? AnalyticsOptionsDTO { + super.writeByte(129) + super.writeValue(value.toList()) + } else if let value = value as? CardComponentConfigurationDTO { + super.writeByte(130) + super.writeValue(value.toList()) + } else if let value = value as? CardConfigurationDTO { + super.writeByte(131) + super.writeValue(value.toList()) + } else if let value = value as? ComponentCommunicationModel { + super.writeByte(132) + super.writeValue(value.toList()) + } else if let value = value as? OrderResponseDTO { + super.writeByte(133) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultDTO { + super.writeByte(134) + super.writeValue(value.toList()) + } else if let value = value as? PaymentResultModelDTO { + super.writeByte(135) + super.writeValue(value.toList()) + } else if let value = value as? SessionDTO { + super.writeByte(136) + super.writeValue(value.toList()) + } else { + super.writeValue(value) + } + } } private class ComponentFlutterInterfaceCodecReaderWriter: FlutterStandardReaderWriter { - override func reader(with data: Data) -> FlutterStandardReader { - return ComponentFlutterInterfaceCodecReader(data: data) - } + override func reader(with data: Data) -> FlutterStandardReader { + ComponentFlutterInterfaceCodecReader(data: data) + } - override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return ComponentFlutterInterfaceCodecWriter(data: data) - } + override func writer(with data: NSMutableData) -> FlutterStandardWriter { + ComponentFlutterInterfaceCodecWriter(data: data) + } } class ComponentFlutterInterfaceCodec: FlutterStandardMessageCodec { - static let shared = ComponentFlutterInterfaceCodec(readerWriter: ComponentFlutterInterfaceCodecReaderWriter()) + static let shared = ComponentFlutterInterfaceCodec(readerWriter: ComponentFlutterInterfaceCodecReaderWriter()) } /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol ComponentFlutterInterfaceProtocol { - func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) - func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) + func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) + func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) } + class ComponentFlutterInterface: ComponentFlutterInterfaceProtocol { - private let binaryMessenger: FlutterBinaryMessenger - init(binaryMessenger: FlutterBinaryMessenger) { - self.binaryMessenger = binaryMessenger - } - var codec: FlutterStandardMessageCodec { - return ComponentFlutterInterfaceCodec.shared - } - func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([cardComponentConfigurationDTOArg, sessionDTOArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } - func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([componentCommunicationModelArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(FlutterError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } - } - } + private let binaryMessenger: FlutterBinaryMessenger + init(binaryMessenger: FlutterBinaryMessenger) { + self.binaryMessenger = binaryMessenger + } + + var codec: FlutterStandardMessageCodec { + ComponentFlutterInterfaceCodec.shared + } + + func _generateCodecForDTOs(cardComponentConfigurationDTO cardComponentConfigurationDTOArg: CardComponentConfigurationDTO, sessionDTO sessionDTOArg: SessionDTO, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([cardComponentConfigurationDTOArg, sessionDTOArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } + } + } + + func onComponentCommunication(componentCommunicationModel componentCommunicationModelArg: ComponentCommunicationModel, completion: @escaping (Result) -> Void) { + let channelName = "dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([componentCommunicationModelArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(FlutterError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } + } + } } diff --git a/ios/Classes/dropIn/DropInPlatformApi.swift b/ios/Classes/dropIn/DropInPlatformApi.swift index d76651a4..7dd5acca 100644 --- a/ios/Classes/dropIn/DropInPlatformApi.swift +++ b/ios/Classes/dropIn/DropInPlatformApi.swift @@ -11,6 +11,8 @@ class DropInPlatformApi: DropInPlatformInterface { private var dropInSessionStoredPaymentMethodsDelegate: DropInSessionsStoredPaymentMethodsDelegate? private var dropInAdvancedFlowDelegate: DropInAdvancedFlowDelegate? private var dropInAdvancedFlowStoredPaymentMethodsDelegate: DropInAdvancedFlowStoredPaymentMethodsDelegate? + private var checkBalanceHandler: ((Result) -> Void)? + private var requestOrderHandler: ((Result) -> Void)? init( dropInFlutterApi: DropInFlutterInterface, @@ -84,10 +86,10 @@ class DropInPlatformApi: DropInPlatformInterface { ) } - let paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethods: paymentMethods) + let paymentMethodsWithoutGiftCards = removeGiftCardPaymentMethods(paymentMethods: paymentMethods, dropInConfigurationDTO.isPartialPaymentSupported) let configuration = try dropInConfigurationDTO.createDropInConfiguration(payment: adyenContext.payment) let dropInComponent = DropInComponent( - paymentMethods: paymentMethodsWithoutGiftCards, + paymentMethods: paymentMethods, context: adyenContext, configuration: configuration, title: dropInConfigurationDTO.preselectedPaymentMethodTitle @@ -95,6 +97,9 @@ class DropInPlatformApi: DropInPlatformInterface { dropInAdvancedFlowDelegate = DropInAdvancedFlowDelegate(dropInFlutterApi: dropInFlutterApi) dropInAdvancedFlowDelegate?.dropInInteractorDelegate = self dropInComponent.delegate = dropInAdvancedFlowDelegate + if dropInConfigurationDTO.isPartialPaymentSupported { + dropInComponent.partialPaymentDelegate = self + } if dropInConfigurationDTO.isRemoveStoredPaymentMethodEnabled == true { dropInAdvancedFlowStoredPaymentMethodsDelegate = DropInAdvancedFlowStoredPaymentMethodsDelegate( viewController: viewController, @@ -134,16 +139,30 @@ class DropInPlatformApi: DropInPlatformInterface { } func onBalanceCheckResult(balanceCheckResponse: String) throws { + guard let checkBalanceHandler else { return } + do { + guard let balanceCheckData = balanceCheckResponse.data(using: .utf8) else { throw PlatformError(errorDescription: "Failure parsing balance check response.") } + let balance = try jsonDecoder.decode(Balance.self, from: balanceCheckData) + checkBalanceHandler(.success(balance)) + } catch { + checkBalanceHandler(.failure(error)) + } } func onOrderRequestResult(orderRequestResponse: String) throws { + guard let requestOrderHandler else { return } + do { + guard let orderRequestData = orderRequestResponse.data(using: .utf8) else { throw PlatformError(errorDescription: "Failure parsing order request response.") } + let partialPaymentOrder = try jsonDecoder.decode(PartialPaymentOrder.self, from: orderRequestData) + requestOrderHandler(.success(partialPaymentOrder)) + } catch { + requestOrderHandler(.failure(error)) + } } - func onOrderCancelResult(orderCancelResponse: OrderCancelResponseDTO) throws { - - } + func onOrderCancelResult(orderCancelResponse: OrderCancelResponseDTO) throws {} func cleanUpDropIn() { sessionHolder.reset() @@ -151,6 +170,8 @@ class DropInPlatformApi: DropInPlatformInterface { dropInAdvancedFlowDelegate?.dropInInteractorDelegate = nil dropInAdvancedFlowDelegate = nil dropInAdvancedFlowStoredPaymentMethodsDelegate = nil + checkBalanceHandler = nil + requestOrderHandler = nil dropInViewController = nil hostViewController = nil } @@ -164,7 +185,7 @@ class DropInPlatformApi: DropInPlatformInterface { case .error: onDropInResultError(paymentEventDTO: paymentEventDTO) case .update: - return + onDropInResultUpdate(paymentEventDTO: paymentEventDTO) } } @@ -235,8 +256,32 @@ class DropInPlatformApi: DropInPlatformInterface { hostViewController?.adyen.topPresenter.present(alertController, animated: true) } } + + private func onDropInResultUpdate(paymentEventDTO: PaymentEventDTO) { + do { + guard let updatedPaymentMethods = paymentEventDTO.data?[Constants.updatedPaymentMethodsKey] ?? "" else { + throw PlatformError(errorDescription: "Updated payment methods not provided.") + } + + guard let orderResponse = paymentEventDTO.data?[Constants.orderResponseKey] ?? "" else { + throw PlatformError(errorDescription: "Order not provided.") + } + + let updatedPaymentMethodsData = try JSONSerialization.data(withJSONObject: updatedPaymentMethods, options: []) + let paymentMethods = try jsonDecoder.decode(PaymentMethods.self, from: updatedPaymentMethodsData) + let orderData = try JSONSerialization.data(withJSONObject: orderResponse, options: []) + let order = try jsonDecoder.decode(PartialPaymentOrder.self, from: orderData) + try dropInViewController?.dropInComponent.reload(with: order, paymentMethods) + } catch { + adyenPrint(error.localizedDescription) + } + } - private func removeGiftCardPaymentMethods(paymentMethods: PaymentMethods) -> PaymentMethods { + private func removeGiftCardPaymentMethods(paymentMethods: PaymentMethods, isPartialPaymentSupported: Bool) -> PaymentMethods { + if isPartialPaymentSupported { + return paymentMethods + } + let storedPaymentMethods = paymentMethods.stored.filter { !($0.type == PaymentMethodType.giftcard) } let paymentMethods = paymentMethods.regular.filter { !($0.type == PaymentMethodType.giftcard) } return PaymentMethods(regular: paymentMethods, stored: storedPaymentMethods) @@ -297,3 +342,40 @@ extension DropInPlatformApi: DropInInteractorDelegate { } } } + +extension DropInPlatformApi: PartialPaymentDelegate { + func checkBalance(with data: Adyen.PaymentComponentData, component: any Adyen.Component, completion: @escaping (Result) -> Void) { + do { + checkBalanceHandler = completion + let platformCommunicationModel = try PlatformCommunicationModel( + type: PlatformCommunicationType.balanceCheck, + data: data.jsonObject.toJsonStringRepresentation() + ) + dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel: platformCommunicationModel, completion: { _ in }) + } catch { + completion(.failure(error)) + } + } + + func requestOrder(for component: any Adyen.Component, completion: @escaping (Result) -> Void) { + requestOrderHandler = completion + let platformCommunicationModel = PlatformCommunicationModel(type: PlatformCommunicationType.requestOrder) + dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel: platformCommunicationModel, completion: { _ in }) + } + + func cancelOrder(_ order: Adyen.PartialPaymentOrder, component: any Adyen.Component) { + do { + let cancelOrderData: [String: Any] = [ + Constants.orderKey: order.jsonObject, + Constants.shouldUpdatePaymentMethodsKey: false + ] + let data = try JSONSerialization.data(withJSONObject: cancelOrderData, options: []) + let cancelOrderDataString = String(data: data, encoding: .utf8) + let platformCommunicationModel = PlatformCommunicationModel(type: PlatformCommunicationType.cancelOrder, data: cancelOrderDataString) + dropInFlutterApi.onDropInAdvancedPlatformCommunication(platformCommunicationModel: platformCommunicationModel, completion: { _ in }) + } catch { + adyenPrint(error.localizedDescription) + } + } + +} diff --git a/ios/Classes/utils/Constants.swift b/ios/Classes/utils/Constants.swift new file mode 100644 index 00000000..d73ee00c --- /dev/null +++ b/ios/Classes/utils/Constants.swift @@ -0,0 +1,7 @@ + +enum Constants { + static let orderKey = "order" + static let orderResponseKey = "orderResponse" + static let updatedPaymentMethodsKey = "updatedPaymentMethods" + static let shouldUpdatePaymentMethodsKey = "shouldUpdatePaymentMethods" +} diff --git a/lib/src/common/adyen_checkout_session.dart b/lib/src/common/adyen_checkout_session.dart index 124ad223..db5ef305 100644 --- a/lib/src/common/adyen_checkout_session.dart +++ b/lib/src/common/adyen_checkout_session.dart @@ -69,7 +69,7 @@ class AdyenCheckoutSession { InstantPaymentType.applePay, ); } else if (configuration is DropInConfiguration) { - return configuration.toDTO(sdkVersionNumber); + return configuration.toDTO(sdkVersionNumber, true); } else if (configuration is InstantComponentConfiguration) { return configuration.toDTO( sdkVersionNumber, diff --git a/lib/src/drop_in/drop_in.dart b/lib/src/drop_in/drop_in.dart index 8ccdcb7f..71465b98 100644 --- a/lib/src/drop_in/drop_in.dart +++ b/lib/src/drop_in/drop_in.dart @@ -36,7 +36,7 @@ class DropIn { await sdkVersionNumberProvider.getSdkVersionNumber(); dropInPlatformApi.showDropInSession( - dropInConfiguration.toDTO(sdkVersionNumber), + dropInConfiguration.toDTO(sdkVersionNumber, true), ); dropInFlutterApi.dropInSessionPlatformCommunicationStream = @@ -93,9 +93,13 @@ class DropIn { paymentMethodsResponse, toEncodable: (value) => throw Exception("Could not encode $value"), ); + final isPartialPaymentSupported = advancedCheckout.partialPayment != null; dropInPlatformApi.showDropInAdvanced( - dropInConfiguration.toDTO(sdkVersionNumber), + dropInConfiguration.toDTO( + sdkVersionNumber, + isPartialPaymentSupported, + ), encodedPaymentMethodsResponse, ); @@ -241,7 +245,8 @@ class DropIn { final Map submitDataDecoded = jsonDecode(submitData); switch (advancedCheckout) { case AdvancedCheckout it: - if (submitDataDecoded[Constants.submitDataKey].containsKey("order")) { + if (submitDataDecoded[Constants.submitDataKey] + .containsKey(Constants.orderKey)) { _mapOrderToCompactOrder(submitDataDecoded); } @@ -255,11 +260,13 @@ class DropIn { } } + // iOS provides more fields than needed. Therefore, only the necessary fields are used. void _mapOrderToCompactOrder(Map submitDataDecoded) { - final order = submitDataDecoded[Constants.submitDataKey]["order"]; - submitDataDecoded[Constants.submitDataKey]["order"] = { - "pspReference": order["pspReference"], - "orderData": order["orderData"], + final order = + submitDataDecoded[Constants.submitDataKey][Constants.orderKey]; + submitDataDecoded[Constants.submitDataKey][Constants.orderKey] = { + Constants.pspReferenceKey: order[Constants.pspReferenceKey], + Constants.orderDataKey: order[Constants.orderDataKey], }; } @@ -278,55 +285,55 @@ class DropIn { PlatformCommunicationModel event, PartialPayment? partialPayment, ) async { - if (partialPayment == null) { - //TODO Check with Android to investigate the race condition + try { + final data = jsonDecode(event.data as String); + final Map balanceCheckRequestBody = { + Constants.paymentMethodKey: data[Constants.paymentMethodKey], + Constants.amountKey: data[Constants.amountKey], + }; + final balanceCheckResponse = + await partialPayment?.onCheckBalance(balanceCheckRequestBody); + dropInPlatformApi.onBalanceCheckResult(jsonEncode(balanceCheckResponse)); + } catch (error) { + // This delay is necessary because Android shows the spinner after a short delay. await Future.delayed(const Duration(milliseconds: 300)); dropInPlatformApi.onBalanceCheckResult(""); - throw Exception("Partial payment implementation is not provided."); } - - final data = jsonDecode(event.data as String); - final Map requestBody = { - "paymentMethod": data["paymentMethod"], - "amount": data["amount"], - }; - - final balanceCheckResponse = - await partialPayment.onCheckBalance(requestBody); - dropInPlatformApi.onBalanceCheckResult(jsonEncode(balanceCheckResponse)); } void _handleOrderRequest( PlatformCommunicationModel event, PartialPayment? partialPayment, ) async { - if (partialPayment == null) { - //TODO Check with Android to investigate the race condition + try { + final orderRequestResponse = await partialPayment?.onRequestOrder(); + dropInPlatformApi.onOrderRequestResult(jsonEncode(orderRequestResponse)); + } catch (error) { + // This delay is necessary because Android shows the spinner after a short delay. await Future.delayed(const Duration(milliseconds: 300)); dropInPlatformApi.onOrderRequestResult(""); - throw Exception("Partial payment implementation is not provided."); } - - final orderRequestResponse = await partialPayment.onRequestOrder(); - dropInPlatformApi.onOrderRequestResult(jsonEncode(orderRequestResponse)); } void _handleOrderCancel( PlatformCommunicationModel event, PartialPayment? partialPayment, ) async { - if (partialPayment == null) { + try { + final orderResponse = jsonDecode(event.data as String); + final orderCancelResponse = await partialPayment?.onCancelOrder( + orderResponse[Constants.shouldUpdatePaymentMethodsKey] as bool? ?? + false, + orderResponse[Constants.orderKey], + ); + final orderCancelResponseDTO = orderCancelResponse?.toDTO() ?? + OrderCancelResponseDTO(orderCancelResponseBody: {}); + dropInPlatformApi.onOrderCancelResult(orderCancelResponseDTO); + } catch (error) { + // This delay is necessary because Android shows the spinner after a short delay. + await Future.delayed(const Duration(milliseconds: 300)); dropInPlatformApi.onOrderCancelResult( OrderCancelResponseDTO(orderCancelResponseBody: {})); - throw Exception("Partial payment implementation is not provided."); } - - final orderResponse = jsonDecode(event.data as String); - final orderCancelResponse = await partialPayment.onCancelOrder( - orderResponse["shouldUpdatePaymentMethods"] as bool? ?? false, - orderResponse["order"], - ); - - dropInPlatformApi.onOrderCancelResult(orderCancelResponse.toDTO()); } } diff --git a/lib/src/generated/platform_api.g.dart b/lib/src/generated/platform_api.g.dart index b5fa400e..83775ec6 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 []; } @@ -220,6 +221,7 @@ class DropInConfigurationDTO { required this.isRemoveStoredPaymentMethodEnabled, this.preselectedPaymentMethodTitle, this.paymentMethodNames, + required this.isPartialPaymentSupported, }); Environment environment; @@ -252,6 +254,8 @@ class DropInConfigurationDTO { Map? paymentMethodNames; + bool isPartialPaymentSupported; + Object encode() { return [ environment.index, @@ -269,6 +273,7 @@ class DropInConfigurationDTO { isRemoveStoredPaymentMethodEnabled, preselectedPaymentMethodTitle, paymentMethodNames, + isPartialPaymentSupported, ]; } @@ -294,12 +299,15 @@ class DropInConfigurationDTO { cashAppPayConfigurationDTO: result[8] != null ? CashAppPayConfigurationDTO.decode(result[8]! as List) : null, - analyticsOptionsDTO: AnalyticsOptionsDTO.decode(result[9]! as List), + analyticsOptionsDTO: + AnalyticsOptionsDTO.decode(result[9]! as List), showPreselectedStoredPaymentMethod: result[10]! as bool, skipListWhenSinglePaymentMethod: result[11]! as bool, isRemoveStoredPaymentMethodEnabled: result[12]! as bool, preselectedPaymentMethodTitle: result[13] as String?, - paymentMethodNames: (result[14] as Map?)?.cast(), + paymentMethodNames: + (result[14] as Map?)?.cast(), + isPartialPaymentSupported: result[15]! as bool, ); } } @@ -354,7 +362,8 @@ class CardConfigurationDTO { showCvcForStoredCard: result[3]! as bool, showCvc: result[4]! as bool, kcpFieldVisibility: FieldVisibility.values[result[5]! as int], - socialSecurityNumberFieldVisibility: FieldVisibility.values[result[6]! as int], + socialSecurityNumberFieldVisibility: + FieldVisibility.values[result[6]! as int], supportedCardTypes: (result[7] as List?)!.cast(), ); } @@ -431,12 +440,15 @@ 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] != null ? ApplePayContactDTO.decode(result[5]! as List) : null, - requiredShippingContactFields: (result[6] as List?)?.cast(), + requiredShippingContactFields: + (result[6] as List?)?.cast(), shippingContact: result[7] != null ? ApplePayContactDTO.decode(result[7]! as List) : null, @@ -444,7 +456,8 @@ class ApplePayConfigurationDTO { ? ApplePayShippingType.values[result[8]! as int] : null, allowShippingContactEditing: result[9] as bool?, - shippingMethods: (result[10] as List?)?.cast(), + shippingMethods: + (result[10] as List?)?.cast(), applicationData: result[11] as String?, supportedCountries: (result[12] as List?)?.cast(), merchantCapability: result[13] != null @@ -694,9 +707,8 @@ class GooglePayConfigurationDTO { merchantInfoDTO: result[2] != null ? MerchantInfoDTO.decode(result[2]! as List) : null, - totalPriceStatus: result[3] != null - ? TotalPriceStatus.values[result[3]! as int] - : null, + totalPriceStatus: + result[3] != null ? TotalPriceStatus.values[result[3]! as int] : null, allowedCardNetworks: (result[4] as List?)?.cast(), allowedAuthMethods: (result[5] as List?)?.cast(), allowPrepaidCards: result[6] as bool?, @@ -1149,8 +1161,10 @@ class CardComponentConfigurationDTO { ? AmountDTO.decode(result[3]! as List) : null, shopperLocale: result[4] as String?, - cardConfiguration: CardConfigurationDTO.decode(result[5]! as List), - analyticsOptionsDTO: AnalyticsOptionsDTO.decode(result[6]! as List), + cardConfiguration: + CardConfigurationDTO.decode(result[5]! as List), + analyticsOptionsDTO: + AnalyticsOptionsDTO.decode(result[6]! as List), ); } } @@ -1211,7 +1225,8 @@ class InstantPaymentConfigurationDTO { ? AmountDTO.decode(result[4]! as List) : null, shopperLocale: result[5] as String?, - analyticsOptionsDTO: AnalyticsOptionsDTO.decode(result[6]! as List), + analyticsOptionsDTO: + AnalyticsOptionsDTO.decode(result[6]! as List), googlePayConfigurationDTO: result[7] != null ? GooglePayConfigurationDTO.decode(result[7]! as List) : null, @@ -1363,7 +1378,8 @@ class ActionComponentConfigurationDTO { amount: result[3] != null ? AmountDTO.decode(result[3]! as List) : null, - analyticsOptionsDTO: AnalyticsOptionsDTO.decode(result[4]! as List), + analyticsOptionsDTO: + AnalyticsOptionsDTO.decode(result[4]! as List), ); } } @@ -1388,8 +1404,10 @@ class OrderCancelResponseDTO { static OrderCancelResponseDTO decode(Object result) { result as List; return OrderCancelResponseDTO( - orderCancelResponseBody: (result[0] as Map?)!.cast(), - updatedPaymentMethods: (result[1] as Map?)?.cast(), + orderCancelResponseBody: + (result[0] as Map?)!.cast(), + updatedPaymentMethods: + (result[1] as Map?)?.cast(), ); } } @@ -1493,63 +1511,63 @@ class _CheckoutPlatformInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 129: + case 129: return AmountDTO.decode(readValue(buffer)!); - case 130: + case 130: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: + case 131: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: + case 132: return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: + case 133: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: + case 134: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: + case 135: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: + case 136: return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 137: + case 137: return CardConfigurationDTO.decode(readValue(buffer)!); - case 138: + case 138: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 139: + case 139: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 140: + case 140: return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 141: + case 141: return DropInConfigurationDTO.decode(readValue(buffer)!); - case 142: + case 142: return EncryptedCardDTO.decode(readValue(buffer)!); - case 143: + case 143: return ErrorDTO.decode(readValue(buffer)!); - case 144: + case 144: return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 145: + case 145: return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 146: + case 146: return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 147: + case 147: return MerchantInfoDTO.decode(readValue(buffer)!); - case 148: + case 148: return OrderCancelResponseDTO.decode(readValue(buffer)!); - case 149: + case 149: return OrderResponseDTO.decode(readValue(buffer)!); - case 150: + case 150: return PaymentEventDTO.decode(readValue(buffer)!); - case 151: + case 151: return PaymentResultDTO.decode(readValue(buffer)!); - case 152: + case 152: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 153: + case 153: return PlatformCommunicationModel.decode(readValue(buffer)!); - case 154: + case 154: return SessionDTO.decode(readValue(buffer)!); - case 155: + case 155: return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 156: + case 156: return UnencryptedCardDTO.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1565,11 +1583,14 @@ class CheckoutPlatformInterface { : __pigeon_binaryMessenger = binaryMessenger; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = _CheckoutPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = + _CheckoutPlatformInterfaceCodec(); Future getReturnUrl() async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.getReturnUrl'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -1594,15 +1615,19 @@ class CheckoutPlatformInterface { } } - Future createSession(String sessionId, String sessionData, Object? configuration) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future createSession( + String sessionId, String sessionData, Object? configuration) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.createSession'; + 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) { @@ -1622,8 +1647,10 @@ class CheckoutPlatformInterface { } Future clearSession() async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.clearSession'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -1643,15 +1670,18 @@ class CheckoutPlatformInterface { } } - Future encryptCard(UnencryptedCardDTO unencryptedCardDTO, String publicKey) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future encryptCard( + UnencryptedCardDTO unencryptedCardDTO, String publicKey) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptCard'; + 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) { @@ -1671,14 +1701,16 @@ class CheckoutPlatformInterface { } Future encryptBin(String bin, String publicKey) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.encryptBin'; + 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) { @@ -1698,14 +1730,16 @@ class CheckoutPlatformInterface { } Future enableConsoleLogging(bool loggingEnabled) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.CheckoutPlatformInterface.enableConsoleLogging'; + 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) { @@ -1786,41 +1820,41 @@ class _DropInPlatformInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AmountDTO.decode(readValue(buffer)!); - case 129: + case 129: return AmountDTO.decode(readValue(buffer)!); - case 130: + case 130: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: + case 131: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: + case 132: return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: + case 133: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: + case 134: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: + case 135: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: + case 136: return CardConfigurationDTO.decode(readValue(buffer)!); - case 137: + case 137: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 138: + case 138: return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 139: + case 139: return DropInConfigurationDTO.decode(readValue(buffer)!); - case 140: + case 140: return ErrorDTO.decode(readValue(buffer)!); - case 141: + case 141: return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 142: + case 142: return MerchantInfoDTO.decode(readValue(buffer)!); - case 143: + case 143: return OrderCancelResponseDTO.decode(readValue(buffer)!); - case 144: + case 144: return PaymentEventDTO.decode(readValue(buffer)!); - case 145: + case 145: return ShippingAddressParametersDTO.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1836,17 +1870,21 @@ class DropInPlatformInterface { : __pigeon_binaryMessenger = binaryMessenger; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = _DropInPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = + _DropInPlatformInterfaceCodec(); - Future showDropInSession(DropInConfigurationDTO dropInConfigurationDTO) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future showDropInSession( + DropInConfigurationDTO dropInConfigurationDTO) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInSession'; + 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) { @@ -1860,15 +1898,19 @@ class DropInPlatformInterface { } } - Future showDropInAdvanced(DropInConfigurationDTO dropInConfigurationDTO, String paymentMethodsResponse) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future showDropInAdvanced(DropInConfigurationDTO dropInConfigurationDTO, + String paymentMethodsResponse) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.showDropInAdvanced'; + 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) { @@ -1883,14 +1925,16 @@ class DropInPlatformInterface { } Future onPaymentsResult(PaymentEventDTO paymentsResult) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsResult'; + 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) { @@ -1904,15 +1948,18 @@ class DropInPlatformInterface { } } - Future onPaymentsDetailsResult(PaymentEventDTO paymentsDetailsResult) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onPaymentsDetailsResult( + PaymentEventDTO paymentsDetailsResult) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onPaymentsDetailsResult'; + 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) { @@ -1926,15 +1973,19 @@ class DropInPlatformInterface { } } - Future onDeleteStoredPaymentMethodResult(DeletedStoredPaymentMethodResultDTO deleteStoredPaymentMethodResultDTO) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onDeleteStoredPaymentMethodResult( + DeletedStoredPaymentMethodResultDTO + deleteStoredPaymentMethodResultDTO) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onDeleteStoredPaymentMethodResult'; + 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) { @@ -1949,14 +2000,16 @@ class DropInPlatformInterface { } Future onBalanceCheckResult(String balanceCheckResponse) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onBalanceCheckResult'; + 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) { @@ -1971,14 +2024,16 @@ class DropInPlatformInterface { } Future onOrderRequestResult(String orderRequestResponse) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderRequestResult'; + 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) { @@ -1992,15 +2047,18 @@ class DropInPlatformInterface { } } - Future onOrderCancelResult(OrderCancelResponseDTO orderCancelResponse) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onOrderCancelResult( + OrderCancelResponseDTO orderCancelResponse) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.onOrderCancelResult'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([orderCancelResponse]) as List?; + final List? __pigeon_replyList = await __pigeon_channel + .send([orderCancelResponse]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -2015,8 +2073,10 @@ class DropInPlatformInterface { } Future cleanUpDropIn() async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.DropInPlatformInterface.cleanUpDropIn'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2064,15 +2124,15 @@ class _DropInFlutterInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AmountDTO.decode(readValue(buffer)!); - case 129: + case 129: return OrderResponseDTO.decode(readValue(buffer)!); - case 130: + case 130: return PaymentResultDTO.decode(readValue(buffer)!); - case 131: + case 131: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 132: + case 132: return PlatformCommunicationModel.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2081,59 +2141,73 @@ class _DropInFlutterInterfaceCodec extends StandardMessageCodec { } abstract class DropInFlutterInterface { - static const MessageCodec pigeonChannelCodec = _DropInFlutterInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = + _DropInFlutterInterfaceCodec(); - void onDropInSessionPlatformCommunication(PlatformCommunicationModel platformCommunicationModel); + void onDropInSessionPlatformCommunication( + PlatformCommunicationModel platformCommunicationModel); - void onDropInAdvancedPlatformCommunication(PlatformCommunicationModel platformCommunicationModel); + void onDropInAdvancedPlatformCommunication( + PlatformCommunicationModel platformCommunicationModel); - static void setup(DropInFlutterInterface? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DropInFlutterInterface? api, + {BinaryMessenger? binaryMessenger}) { { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null.'); final List args = (message as List?)!; - final PlatformCommunicationModel? arg_platformCommunicationModel = (args[0] as PlatformCommunicationModel?); + final PlatformCommunicationModel? arg_platformCommunicationModel = + (args[0] as PlatformCommunicationModel?); assert(arg_platformCommunicationModel != null, 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInSessionPlatformCommunication was null, expected non-null PlatformCommunicationModel.'); try { - api.onDropInSessionPlatformCommunication(arg_platformCommunicationModel!); + api.onDropInSessionPlatformCommunication( + arg_platformCommunicationModel!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null.'); final List args = (message as List?)!; - final PlatformCommunicationModel? arg_platformCommunicationModel = (args[0] as PlatformCommunicationModel?); + final PlatformCommunicationModel? arg_platformCommunicationModel = + (args[0] as PlatformCommunicationModel?); assert(arg_platformCommunicationModel != null, 'Argument for dev.flutter.pigeon.adyen_checkout.DropInFlutterInterface.onDropInAdvancedPlatformCommunication was null, expected non-null PlatformCommunicationModel.'); try { - api.onDropInAdvancedPlatformCommunication(arg_platformCommunicationModel!); + api.onDropInAdvancedPlatformCommunication( + arg_platformCommunicationModel!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -2240,63 +2314,63 @@ class _ComponentPlatformInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ActionComponentConfigurationDTO.decode(readValue(buffer)!); - case 129: + case 129: return AmountDTO.decode(readValue(buffer)!); - case 130: + case 130: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 131: + case 131: return ApplePayConfigurationDTO.decode(readValue(buffer)!); - case 132: + case 132: return ApplePayContactDTO.decode(readValue(buffer)!); - case 133: + case 133: return ApplePayShippingMethodDTO.decode(readValue(buffer)!); - case 134: + case 134: return ApplePaySummaryItemDTO.decode(readValue(buffer)!); - case 135: + case 135: return BillingAddressParametersDTO.decode(readValue(buffer)!); - case 136: + case 136: return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 137: + case 137: return CardConfigurationDTO.decode(readValue(buffer)!); - case 138: + case 138: return CashAppPayConfigurationDTO.decode(readValue(buffer)!); - case 139: + case 139: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 140: + case 140: return DeletedStoredPaymentMethodResultDTO.decode(readValue(buffer)!); - case 141: + case 141: return DropInConfigurationDTO.decode(readValue(buffer)!); - case 142: + case 142: return EncryptedCardDTO.decode(readValue(buffer)!); - case 143: + case 143: return ErrorDTO.decode(readValue(buffer)!); - case 144: + case 144: return GooglePayConfigurationDTO.decode(readValue(buffer)!); - case 145: + case 145: return InstantPaymentConfigurationDTO.decode(readValue(buffer)!); - case 146: + case 146: return InstantPaymentSetupResultDTO.decode(readValue(buffer)!); - case 147: + case 147: return MerchantInfoDTO.decode(readValue(buffer)!); - case 148: + case 148: return OrderCancelResponseDTO.decode(readValue(buffer)!); - case 149: + case 149: return OrderResponseDTO.decode(readValue(buffer)!); - case 150: + case 150: return PaymentEventDTO.decode(readValue(buffer)!); - case 151: + case 151: return PaymentResultDTO.decode(readValue(buffer)!); - case 152: + case 152: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 153: + case 153: return PlatformCommunicationModel.decode(readValue(buffer)!); - case 154: + case 154: return SessionDTO.decode(readValue(buffer)!); - case 155: + case 155: return ShippingAddressParametersDTO.decode(readValue(buffer)!); - case 156: + case 156: return UnencryptedCardDTO.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2312,11 +2386,14 @@ class ComponentPlatformInterface { : __pigeon_binaryMessenger = binaryMessenger; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = _ComponentPlatformInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = + _ComponentPlatformInterfaceCodec(); Future updateViewHeight(int viewId) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.updateViewHeight'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2336,15 +2413,18 @@ class ComponentPlatformInterface { } } - Future onPaymentsResult(String componentId, PaymentEventDTO paymentsResult) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onPaymentsResult( + String componentId, PaymentEventDTO paymentsResult) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsResult'; + 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) { @@ -2358,15 +2438,18 @@ class ComponentPlatformInterface { } } - Future onPaymentsDetailsResult(String componentId, PaymentEventDTO paymentsDetailsResult) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onPaymentsDetailsResult( + String componentId, PaymentEventDTO paymentsDetailsResult) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onPaymentsDetailsResult'; + 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) { @@ -2380,15 +2463,24 @@ class ComponentPlatformInterface { } } - Future isInstantPaymentSupportedByPlatform(InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, String paymentMethodResponse, String componentId) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future isInstantPaymentSupportedByPlatform( + InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, + String paymentMethodResponse, + String componentId) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.isInstantPaymentSupportedByPlatform'; + 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) { @@ -2407,15 +2499,24 @@ class ComponentPlatformInterface { } } - Future onInstantPaymentPressed(InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, String encodedPaymentMethod, String componentId) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future onInstantPaymentPressed( + InstantPaymentConfigurationDTO instantPaymentConfigurationDTO, + String encodedPaymentMethod, + String componentId) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onInstantPaymentPressed'; + 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) { @@ -2429,15 +2530,24 @@ class ComponentPlatformInterface { } } - Future handleAction(ActionComponentConfigurationDTO actionComponentConfiguration, String componentId, Map? actionResponse) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future handleAction( + ActionComponentConfigurationDTO actionComponentConfiguration, + String componentId, + Map? actionResponse) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.handleAction'; + 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) { @@ -2452,8 +2562,10 @@ class ComponentPlatformInterface { } Future onDispose(String componentId) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + const String __pigeon_channelName = + 'dev.flutter.pigeon.adyen_checkout.ComponentPlatformInterface.onDispose'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, @@ -2513,23 +2625,23 @@ class _ComponentFlutterInterfaceCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return AmountDTO.decode(readValue(buffer)!); - case 129: + case 129: return AnalyticsOptionsDTO.decode(readValue(buffer)!); - case 130: + case 130: return CardComponentConfigurationDTO.decode(readValue(buffer)!); - case 131: + case 131: return CardConfigurationDTO.decode(readValue(buffer)!); - case 132: + case 132: return ComponentCommunicationModel.decode(readValue(buffer)!); - case 133: + case 133: return OrderResponseDTO.decode(readValue(buffer)!); - case 134: + case 134: return PaymentResultDTO.decode(readValue(buffer)!); - case 135: + case 135: return PaymentResultModelDTO.decode(readValue(buffer)!); - case 136: + case 136: return SessionDTO.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2538,53 +2650,67 @@ class _ComponentFlutterInterfaceCodec extends StandardMessageCodec { } abstract class ComponentFlutterInterface { - static const MessageCodec pigeonChannelCodec = _ComponentFlutterInterfaceCodec(); + static const MessageCodec pigeonChannelCodec = + _ComponentFlutterInterfaceCodec(); - void _generateCodecForDTOs(CardComponentConfigurationDTO cardComponentConfigurationDTO, SessionDTO sessionDTO); + void _generateCodecForDTOs( + CardComponentConfigurationDTO cardComponentConfigurationDTO, + SessionDTO sessionDTO); - void onComponentCommunication(ComponentCommunicationModel componentCommunicationModel); + void onComponentCommunication( + ComponentCommunicationModel componentCommunicationModel); - static void setup(ComponentFlutterInterface? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ComponentFlutterInterface? api, + {BinaryMessenger? binaryMessenger}) { { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { __pigeon_channel.setMessageHandler(null); } else { __pigeon_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null.'); + 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null.'); final List args = (message as List?)!; - final CardComponentConfigurationDTO? arg_cardComponentConfigurationDTO = (args[0] as CardComponentConfigurationDTO?); + final CardComponentConfigurationDTO? + arg_cardComponentConfigurationDTO = + (args[0] as CardComponentConfigurationDTO?); assert(arg_cardComponentConfigurationDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null CardComponentConfigurationDTO.'); final SessionDTO? arg_sessionDTO = (args[1] as SessionDTO?); assert(arg_sessionDTO != null, 'Argument for dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface._generateCodecForDTOs was null, expected non-null SessionDTO.'); try { - api._generateCodecForDTOs(arg_cardComponentConfigurationDTO!, arg_sessionDTO!); + api._generateCodecForDTOs( + arg_cardComponentConfigurationDTO!, arg_sessionDTO!); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.adyen_checkout.ComponentFlutterInterface.onComponentCommunication', + 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 { @@ -2592,8 +2718,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())); } }); } diff --git a/lib/src/util/constants.dart b/lib/src/util/constants.dart index 11c99501..b1075cce 100644 --- a/lib/src/util/constants.dart +++ b/lib/src/util/constants.dart @@ -11,4 +11,12 @@ class Constants { static const String componentIdKey = "componentId"; static const String submitDataKey = "data"; static const String submitExtraKey = "extra"; + static const String amountKey = "amount"; + static const String pspReferenceKey = "pspReference"; + static const String orderKey = "order"; + static const String orderDataKey = "orderData"; + static const String orderResponseKey = "orderResponse"; + static const String updatedPaymentMethodsKey = "updatedPaymentMethods"; + static const String shouldUpdatePaymentMethodsKey = + "shouldUpdatePaymentMethods"; } diff --git a/lib/src/util/dto_mapper.dart b/lib/src/util/dto_mapper.dart index c7687451..103365b2 100644 --- a/lib/src/util/dto_mapper.dart +++ b/lib/src/util/dto_mapper.dart @@ -11,27 +11,30 @@ extension AnalyticsOptionsMapper on AnalyticsOptions { } extension DropInConfigurationMapper on DropInConfiguration { - DropInConfigurationDTO toDTO(String sdkVersionNumber) => + DropInConfigurationDTO toDTO( + String sdkVersionNumber, + isPartialPaymentSupported, + ) => DropInConfigurationDTO( - environment: environment, - clientKey: clientKey, - countryCode: countryCode.toUpperCase(), - amount: amount?.toDTO(), - shopperLocale: shopperLocale, - cardConfigurationDTO: cardConfiguration?.toDTO(), - applePayConfigurationDTO: applePayConfiguration?.toDTO(), - googlePayConfigurationDTO: googlePayConfiguration?.toDTO(), - cashAppPayConfigurationDTO: cashAppPayConfiguration?.toDTO(), - analyticsOptionsDTO: analyticsOptions.toDTO(sdkVersionNumber), - isRemoveStoredPaymentMethodEnabled: - _isRemoveStoredPaymentMethodEnabled( - storedPaymentMethodConfiguration), - showPreselectedStoredPaymentMethod: storedPaymentMethodConfiguration - ?.showPreselectedStoredPaymentMethod ?? - true, - skipListWhenSinglePaymentMethod: skipListWhenSinglePaymentMethod, - preselectedPaymentMethodTitle: preselectedPaymentMethodTitle, - paymentMethodNames: paymentMethodNames, + environment: environment, + clientKey: clientKey, + countryCode: countryCode.toUpperCase(), + amount: amount?.toDTO(), + shopperLocale: shopperLocale, + cardConfigurationDTO: cardConfiguration?.toDTO(), + applePayConfigurationDTO: applePayConfiguration?.toDTO(), + googlePayConfigurationDTO: googlePayConfiguration?.toDTO(), + cashAppPayConfigurationDTO: cashAppPayConfiguration?.toDTO(), + analyticsOptionsDTO: analyticsOptions.toDTO(sdkVersionNumber), + isRemoveStoredPaymentMethodEnabled: _isRemoveStoredPaymentMethodEnabled( + storedPaymentMethodConfiguration), + showPreselectedStoredPaymentMethod: storedPaymentMethodConfiguration + ?.showPreselectedStoredPaymentMethod ?? + true, + skipListWhenSinglePaymentMethod: skipListWhenSinglePaymentMethod, + preselectedPaymentMethodTitle: preselectedPaymentMethodTitle, + paymentMethodNames: paymentMethodNames, + isPartialPaymentSupported: isPartialPaymentSupported, ); bool _isRemoveStoredPaymentMethodEnabled( diff --git a/lib/src/util/payment_event_handler.dart b/lib/src/util/payment_event_handler.dart index 098f41be..117d08f7 100644 --- a/lib/src/util/payment_event_handler.dart +++ b/lib/src/util/payment_event_handler.dart @@ -1,5 +1,6 @@ import 'package:adyen_checkout/src/common/model/payment_event.dart'; import 'package:adyen_checkout/src/generated/platform_api.g.dart'; +import 'package:adyen_checkout/src/util/constants.dart'; class PaymentEventHandler { PaymentEventDTO mapToPaymentEventDTO(PaymentEvent paymentEvent) { @@ -23,8 +24,8 @@ class PaymentEventHandler { Update() => PaymentEventDTO( paymentEventType: PaymentEventType.update, data: { - "updatedPaymentMethods": paymentEvent.paymentMethods, - "orderResponse": paymentEvent.orderResponse, + Constants.updatedPaymentMethodsKey: paymentEvent.paymentMethods, + Constants.orderResponseKey: paymentEvent.orderResponse, }, ), }; diff --git a/pigeons/platform_api.dart b/pigeons/platform_api.dart index 60928b7f..1d791f96 100644 --- a/pigeons/platform_api.dart +++ b/pigeons/platform_api.dart @@ -154,6 +154,7 @@ class DropInConfigurationDTO { final bool isRemoveStoredPaymentMethodEnabled; final String? preselectedPaymentMethodTitle; final Map? paymentMethodNames; + final bool isPartialPaymentSupported; DropInConfigurationDTO( this.environment, @@ -171,6 +172,7 @@ class DropInConfigurationDTO { this.isRemoveStoredPaymentMethodEnabled, this.preselectedPaymentMethodTitle, this.paymentMethodNames, + this.isPartialPaymentSupported, ); } diff --git a/test/dto_mapping_test.dart b/test/dto_mapping_test.dart index 56086b2f..725f0695 100644 --- a/test/dto_mapping_test.dart +++ b/test/dto_mapping_test.dart @@ -25,7 +25,7 @@ void main() { shopperLocale: shopperLocal, storedPaymentMethodConfiguration: storedPaymentMethodConfiguration); - final dropInConfigurationDto = dropInConfiguration.toDTO("0.0.1"); + final dropInConfigurationDto = dropInConfiguration.toDTO("0.0.1", true); expect(dropInConfigurationDto.environment, Environment.test); expect(dropInConfigurationDto.clientKey, demoClientKey); @@ -42,6 +42,7 @@ void main() { expect(dropInConfigurationDto.skipListWhenSinglePaymentMethod, false); expect(dropInConfigurationDto.showPreselectedStoredPaymentMethod, true); expect(dropInConfigurationDto.isRemoveStoredPaymentMethodEnabled, true); + expect(dropInConfigurationDto.isPartialPaymentSupported, true); }); test(