Skip to content

Commit

Permalink
Merge pull request #46 from Adyen/feature/adjustCashAppPayIntegration
Browse files Browse the repository at this point in the history
Moved cashAppPay SDK to pod file of example app
  • Loading branch information
Robert-SD authored Oct 6, 2023
2 parents f0daaae + 2de3d63 commit 2df1e9b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ project 'Runner', {
'Release' => :release,
}

pod 'Adyen/CashAppPay'

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
Expand Down
20 changes: 14 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class _MyAppState extends State<MyApp> {
_adyenSessionRepository.deleteStoredPaymentMethod,
);

final CashAppPayConfiguration cashAppPayConfiguration =
await _createCashAppPayConfiguration();

final DropInConfiguration dropInConfiguration = DropInConfiguration(
environment: Environment.test,
clientKey: Config.clientKey,
Expand All @@ -111,6 +114,7 @@ class _MyAppState extends State<MyApp> {
shopperLocale: Config.shopperLocale,
cardsConfiguration: cardsConfiguration,
storedPaymentMethodConfiguration: storedPaymentMethodConfiguration,
cashAppPayConfiguration: cashAppPayConfiguration,
);

return await _adyenCheckout.startPayment(
Expand All @@ -124,8 +128,6 @@ class _MyAppState extends State<MyApp> {
Future<PaymentResult> startDropInAdvancedFlow() async {
final String paymentMethodsResponse =
await _adyenSessionRepository.fetchPaymentMethods();
final String returnUrl =
await _adyenSessionRepository.determineExampleReturnUrl();

final CardsConfiguration cardsConfiguration =
CardsConfiguration(showStorePaymentField: true);
Expand All @@ -143,10 +145,7 @@ class _MyAppState extends State<MyApp> {
);

final CashAppPayConfiguration cashAppPayConfiguration =
CashAppPayConfiguration(
CashAppPayEnvironment.sandbox,
returnUrl,
);
await _createCashAppPayConfiguration();

final StoredPaymentMethodConfiguration storedPaymentMethodConfiguration =
StoredPaymentMethodConfiguration(
Expand Down Expand Up @@ -179,6 +178,15 @@ class _MyAppState extends State<MyApp> {
);
}

//To support CashAppPay please add "pod 'Adyen/CashAppPay'" to your Podfile.
Future<CashAppPayConfiguration> _createCashAppPayConfiguration() async {
return CashAppPayConfiguration(
CashAppPayEnvironment.sandbox,
await _adyenSessionRepository.determineExampleReturnUrl(),
);
}


_dialogBuilder(BuildContext context, PaymentResult paymentResult) {
String message = "";
if (paymentResult.result != null) {
Expand Down
1 change: 0 additions & 1 deletion ios/adyen_checkout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ Adyen checkout SDK for Flutter
s.swift_version = '5.0'

s.dependency 'Adyen', '5.4.0'
s.dependency 'Adyen/CashAppPay'
end

0 comments on commit 2df1e9b

Please sign in to comment.