Skip to content

Commit

Permalink
Merge pull request #354 from Adyen/feature/updateToAndroid5.9.0
Browse files Browse the repository at this point in the history
Updated Android Drop-in/Components SDK to v5.9.0
  • Loading branch information
Robert-SD authored Feb 12, 2025
2 parents 2eeac97 + 7e16b50 commit e5b318f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### New

- Set minimum SDK version to Flutter 3.16/Dart 3.2
- Android Components/Drop-in
version: [5.9.0](https://docs.adyen.com/online-payments/release-notes/?title%5B0%5D=Android+Components%2FDrop-in#releaseNote=2025-01-17-android-componentsdrop-in-5.9.0).

## 1.3.0

Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
![Flutter](https://github.com/Adyen/adyen-flutter/assets/13377878/66a9fab8-dba0-426f-acd4-ab0bfd469d20)

# Adyen Flutter

[![Pub Package](https://img.shields.io/pub/v/adyen_checkout.svg)](https://pub.dev/packages/adyen_checkout)
[![Adyen iOS](https://img.shields.io/badge/ios-v5.15.0-brightgreen.svg)](https://github.com/Adyen/adyen-ios/releases/tag/5.15.0)
[![Adyen Android](https://img.shields.io/badge/android-v5.8.0-brightgreen.svg)](https://github.com/Adyen/adyen-android/releases/tag/5.8.0)
[![Adyen Android](https://img.shields.io/badge/android-v5.9.0-brightgreen.svg)](https://github.com/Adyen/adyen-android/releases/tag/5.9.0)

The Adyen Flutter package provides you with the building blocks to create a checkout experience for
your shoppers, allowing them to pay using the payment method of their choice. This is
Expand Down Expand Up @@ -54,16 +55,25 @@ release a new version when we need to.

* [Checkout API v71](https://docs.adyen.com/api-explorer/Checkout/71/overview) or later.

#### Android
#### Android

* [Android 5.0](https://www.android.com/versions/lollipop-5-0/) (API 21) or later.
* [Kotlin 1.8.22](https://kotlinlang.org/docs/releases.html) or later.
* [AGP 8.1](https://developer.android.com/build/releases/gradle-plugin) or later with Gradle 8.
* Requires the usage of a `FlutterFragmentActivity` instead of the default `FlutterActivity` in the MainActivity of your [native Android](https://github.com/Adyen/adyen-flutter/blob/main/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt) layer.
* Requires the usage of a `FlutterFragmentActivity` instead of the default `FlutterActivity` in the
MainActivity of
your [native Android](https://github.com/Adyen/adyen-flutter/blob/main/example/android/app/src/main/kotlin/com/adyen/checkout/flutter/example/MainActivity.kt)
layer.

#### iOS

* [iOS 12](https://support.apple.com/en-us/118387) or later.
* Add the return URL handler to your AppDelegate in your [native iOS](https://github.com/Adyen/adyen-flutter/blob/5301abab34773e820c4fd38be54d3bf4bb247fd6/example/ios/Runner/AppDelegate.swift#L18) layer.
* Add a custom [URL scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) that matches the returnUrl you use.
* Add the return URL handler to your AppDelegate in
your [native iOS](https://github.com/Adyen/adyen-flutter/blob/5301abab34773e820c4fd38be54d3bf4bb247fd6/example/ios/Runner/AppDelegate.swift#L18)
layer.
* Add a
custom [URL scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app)
that matches the returnUrl you use.

## Integration

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {
}

dependencies {
implementation('com.adyen.checkout:drop-in:5.8.0')
implementation('com.adyen.checkout:drop-in:5.9.0')
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.15.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.adyen.checkout.flutter.utils.Constants
import com.adyen.checkout.googlepay.GooglePayComponent
import com.adyen.checkout.sessions.core.CheckoutSession
import com.adyen.checkout.sessions.core.SessionSetupResponse
import com.adyen.checkout.ui.core.AdyenComponentView
import java.util.UUID

class GooglePayComponentManager(
Expand All @@ -31,6 +32,7 @@ class GooglePayComponentManager(
private var checkoutConfiguration: CheckoutConfiguration? = null
private var setupCallback: ((Result<InstantPaymentSetupResultDTO>) -> Unit)? = null
private var googlePayComponent: GooglePayComponent? = null
private var adyenComponentView: AdyenComponentView? = null

override fun onAvailabilityResult(
isAvailable: Boolean,
Expand All @@ -41,13 +43,19 @@ class GooglePayComponentManager(
return
}

googlePayComponent = createGooglePayComponent(paymentMethod)
val googlePayComponent = createGooglePayComponent(paymentMethod)
if (googlePayComponent == null) {
setupCallback?.invoke(Result.failure(Exception("Google Pay setup failed")))
return
}

val allowedPaymentMethods = googlePayComponent?.getGooglePayButtonParameters()?.allowedPaymentMethods.orEmpty()
this.googlePayComponent = googlePayComponent
this.adyenComponentView =
AdyenComponentView(activity).apply {
attach(googlePayComponent, activity)
}

val allowedPaymentMethods = googlePayComponent.getGooglePayButtonParameters().allowedPaymentMethods
setupCallback?.invoke(
Result.success(
InstantPaymentSetupResultDTO(
Expand Down Expand Up @@ -108,6 +116,7 @@ class GooglePayComponentManager(
checkoutConfiguration = null
setupCallback = null
googlePayComponent = null
adyenComponentView = null
}
}

Expand Down

0 comments on commit e5b318f

Please sign in to comment.