Skip to content

Commit

Permalink
Merge pull request #85 from Adyen/feature/ImprovementsFromTesting
Browse files Browse the repository at this point in the history
Small adjustments that were found during testing
  • Loading branch information
Robert-SD authored Dec 22, 2023
2 parents 15c22a3 + 841d887 commit d6f43bd
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
5 changes: 5 additions & 0 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7581FD482B332CF700AEC65C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
759D7A922B0380EB00C5F718 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Main.strings; sourceTree = "<group>"; };
759D7A932B0380EB00C5F718 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -154,6 +155,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
7581FD482B332CF700AEC65C /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions example/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.in-app-payments</key>
<array>
</array>
</dict>
</plist>
5 changes: 5 additions & 0 deletions example/lib/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion example/lib/network/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 4 additions & 0 deletions example/lib/repositories/adyen_drop_in_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class AdyenDropInRepository extends AdyenBaseRepository {

Future<String> 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(),
Expand Down
6 changes: 3 additions & 3 deletions example/lib/screens/drop_in/drop_in_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ class _DropInScreenState extends State<DropInScreen> {
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,
);
Expand All @@ -115,7 +115,7 @@ class _DropInScreenState extends State<DropInScreen> {
);

final DropInConfiguration dropInConfiguration = DropInConfiguration(
environment: Environment.test,
environment: Config.environment,
clientKey: Config.clientKey,
countryCode: Config.countryCode,
shopperLocale: Config.shopperLocale,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/util/sdk_version_number_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,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:
Expand Down

0 comments on commit d6f43bd

Please sign in to comment.