diff --git a/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt index 7513a748..a792e31e 100644 --- a/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt +++ b/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt @@ -2,6 +2,6 @@ package com.adyen.checkout.flutter.example import io.flutter.embedding.android.FlutterFragmentActivity -//We need to explain to merchants that we require a FlutterFragmentActivity instead the default FlutterActivity in order to support AndroidX. It is required from the checkout SDK. +//Requires a FlutterFragmentActivity instead the default FlutterActivity. class MainActivity : FlutterFragmentActivity() { } diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 21d2b408..4d5c3b77 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -53,6 +53,7 @@ 500E5112FE84E8FF424A2FAF /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7581FD482B332CF700AEC65C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 759D7A922B0380EB00C5F718 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Main.strings; sourceTree = ""; }; 759D7A932B0380EB00C5F718 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/LaunchScreen.strings; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -154,6 +155,7 @@ 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( + 7581FD482B332CF700AEC65C /* Runner.entitlements */, 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, @@ -472,6 +474,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -652,6 +655,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -674,6 +678,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/example/ios/Runner/Runner.entitlements b/example/ios/Runner/Runner.entitlements new file mode 100644 index 00000000..8051c352 --- /dev/null +++ b/example/ios/Runner/Runner.entitlements @@ -0,0 +1,9 @@ + + + + + com.apple.developer.in-app-payments + + + + diff --git a/example/lib/config.dart b/example/lib/config.dart index bf8ccbc6..540cee38 100644 --- a/example/lib/config.dart +++ b/example/lib/config.dart @@ -10,10 +10,13 @@ class Config { { "CLIENT_KEY" : "YOUR_CLIENT_KEY", "X_API_KEY" : "YOUR X_API_KEY" + "APPLE_PAY_MERCHANT_ID_KEY": "YOUR_APPLE_PAY_MERCHANT_ID_KEY" } */ static const String clientKey = String.fromEnvironment('CLIENT_KEY'); static const String xApiKey = String.fromEnvironment('X_API_KEY'); + static const String merchantId = + String.fromEnvironment('APPLE_PAY_MERCHANT_ID_KEY'); //Environment constants static const String merchantAccount = "TestMerchantCheckout"; @@ -25,6 +28,8 @@ class Config { static const String baseUrl = "checkout-test.adyen.com"; static const String apiVersion = "v71"; static const String iOSReturnUrl = "flutter-ui-host://payments"; + static const GooglePayEnvironment googlePayEnvironment = + GooglePayEnvironment.test; //Example data static Amount amount = Amount(currency: "EUR", value: 1200); diff --git a/example/lib/network/service.dart b/example/lib/network/service.dart index d0a36367..40e8d734 100644 --- a/example/lib/network/service.dart +++ b/example/lib/network/service.dart @@ -18,7 +18,7 @@ class Service { headers: _createHeaders(), body: sessionRequestNetworkModel.toRawJson(), ); - print("PspReference: ${response.headers["pspreference"]}"); + print("Session pspReference: ${response.headers["pspreference"]}"); return SessionResponseNetworkModel.fromRawJson(response.body); } diff --git a/example/lib/repositories/adyen_drop_in_repository.dart b/example/lib/repositories/adyen_drop_in_repository.dart index 0499711d..5a86e433 100644 --- a/example/lib/repositories/adyen_drop_in_repository.dart +++ b/example/lib/repositories/adyen_drop_in_repository.dart @@ -78,6 +78,10 @@ class AdyenDropInRepository extends AdyenBaseRepository { Future fetchPaymentMethods() async { return await service.fetchPaymentMethods(PaymentMethodsRequestNetworkModel( + amount: AmountNetworkModel( + currency: Config.amount.currency, + value: Config.amount.value, + ), merchantAccount: Config.merchantAccount, countryCode: Config.countryCode, channel: determineChannel(), diff --git a/example/lib/screens/drop_in/drop_in_screen.dart b/example/lib/screens/drop_in/drop_in_screen.dart index 7da0594e..bc63709f 100644 --- a/example/lib/screens/drop_in/drop_in_screen.dart +++ b/example/lib/screens/drop_in/drop_in_screen.dart @@ -92,13 +92,13 @@ class _DropInScreenState extends State { const CardConfiguration cardsConfiguration = CardConfiguration(); const ApplePayConfiguration applePayConfiguration = ApplePayConfiguration( - merchantId: Config.merchantAccount, + merchantId: Config.merchantId, merchantName: Config.merchantName, ); const GooglePayConfiguration googlePayConfiguration = GooglePayConfiguration( - googlePayEnvironment: GooglePayEnvironment.test, + googlePayEnvironment: Config.googlePayEnvironment, shippingAddressRequired: true, billingAddressRequired: true, ); @@ -115,7 +115,7 @@ class _DropInScreenState extends State { ); final DropInConfiguration dropInConfiguration = DropInConfiguration( - environment: Environment.test, + environment: Config.environment, clientKey: Config.clientKey, countryCode: Config.countryCode, shopperLocale: Config.shopperLocale, diff --git a/lib/src/util/sdk_version_number_provider.dart b/lib/src/util/sdk_version_number_provider.dart index e56752d6..34cc01b0 100644 --- a/lib/src/util/sdk_version_number_provider.dart +++ b/lib/src/util/sdk_version_number_provider.dart @@ -9,7 +9,7 @@ class SdkVersionNumberProvider { final RegExp regex = RegExp('version:s*(.*?)s*\\n'); final match = regex.firstMatch(pubspecContent); final versionNumber = match?.group(1) ?? ""; - return versionNumber; + return versionNumber.trim(); } catch (exception) { AdyenLogger.instance.print( "Could not find adyen checkout pubspec file for reading the SDK version number"); diff --git a/pubspec.yaml b/pubspec.yaml index 1c4b48ed..ef315c40 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,8 +10,8 @@ environment: dependencies: flutter: sdk: flutter - plugin_platform_interface: 2.1.7 - stream_transform: 2.1.0 + plugin_platform_interface: ^2.1.7 + stream_transform: ^2.1.0 dev_dependencies: flutter_test: