-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1416 from Adyen/develop
Release 5.1.0
- Loading branch information
Showing
183 changed files
with
4,959 additions
and
2,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
[//]: # (This file will be used for the release notes on GitHub when publishing.) | ||
[//]: # (Types of changes: `Added` `Changed` `Deprecated` `Removed` `Fixed` `Security`) | ||
[//]: # (Types of changes: `Breaking changes` `New` `Added` `Changed` `Deprecated` `Removed` `Fixed`) | ||
[//]: # (Example:) | ||
[//]: # (## Added) | ||
[//]: # ( - New payment method) | ||
[//]: # (## Changed) | ||
[//]: # ( - DropIn service's package changed from `com.adyen.dropin` to `com.adyen.dropin.services`) | ||
[//]: # ( # Deprecated) | ||
[//]: # (## Deprecated) | ||
[//]: # ( - Configurations public constructor are deprecated, please use each Configuration's builder to make a Configuration object) | ||
|
||
## New | ||
- The [BcmcComponent](https://adyen.github.io/adyen-android/bcmc/com.adyen.checkout.bcmc/-bcmc-component/index.html) now supports co-badged Bancontact cards and card brand detection. | ||
- The [BcmcComponentState](https://adyen.github.io/adyen-android/bcmc/com.adyen.checkout.bcmc/-bcmc-component-state/index.html) now contains 3 extra fields: `cardBrand`, `binValue` and `lastFourDigits`. | ||
- You can now override payment method names in Drop-in by using [DropInConfiguration.Builder.overridePaymentMethodName(type, name)](https://adyen.github.io/adyen-android/drop-in/com.adyen.checkout.dropin/-drop-in-configuration/-builder/override-payment-method-name.html). | ||
- For stored cards, Drop-in now shows the card name (for example **Visa** or **Mastercard**) instead of **Credit Card**. | ||
- Now it is possible to show installment amounts for card payments using [InstallmentConfiguration.showInstallmentAmount](https://adyen.github.io/adyen-android/card/com.adyen.checkout.card/-installment-configuration/show-installment-amount.html) in [CardConfiguration.Builder.setInstallmentConfigurations()](https://adyen.github.io/adyen-android/card/com.adyen.checkout.card/-card-configuration/-builder/set-installment-configurations.html). | ||
- For gift cards, you can now hide the PIN text field by setting [GiftCardConfiguration.Builder.setPinRequired()](https://adyen.github.io/adyen-android/giftcard/com.adyen.checkout.giftcard/-gift-card-configuration/-builder/set-pin-required.html) to **false**. | ||
- For Google Pay: | ||
- When initializing the [Google Pay button](https://docs.adyen.com/payment-methods/google-pay/android-component/#2-show-the-google-pay-button), you can now use [GooglePayComponent.getGooglePayButtonParameters()](https://adyen.github.io/adyen-android/googlepay/com.adyen.checkout.googlepay/-google-pay-component/get-google-pay-button-parameters.html) to get the `allowedPaymentMethods` attribute. | ||
- You can now use [AllowedAuthMethods](https://adyen.github.io/adyen-android/googlepay/com.adyen.checkout.googlepay/-allowed-auth-methods/index.html) and [AllowedCardNetworks](https://adyen.github.io/adyen-android/googlepay/com.adyen.checkout.googlepay/-allowed-card-networks/index.html) to easily access to the possible values for [GooglePayConfiguration.Builder.setAllowedAuthMethods()](https://adyen.github.io/adyen-android/googlepay/com.adyen.checkout.googlepay/-google-pay-configuration/-builder/set-allowed-auth-methods.html) and [GooglePayConfiguration.Builder.setAllowedCardNetworks()](https://adyen.github.io/adyen-android/googlepay/com.adyen.checkout.googlepay/-google-pay-configuration/-builder/set-allowed-card-networks.html). | ||
|
||
## Fixed | ||
- `@RestrictTo` annotations no longer cause false errors with Android Studio and Lint. | ||
- Using the layout inspector or having view attribute inspection enabled in the developer options no longer causes a crash when viewing a payment method. | ||
- Implementing the `:action` module no longer gives a duplicate class error caused by a duplicate namespace. | ||
- For Drop-in, dismissing the gift card payment method no longer prevents further interaction. | ||
- Fixed a bug where components would not be displayed in Jetpack Compose lazy lists. | ||
|
||
## Changed | ||
- Dependency versions: | ||
| Name | Version | | ||
|--------------------------------------------------------------------------------------------------------|-------------------------------| | ||
| [AndroidX Compose BoM](https://developer.android.com/jetpack/compose/bom/bom-mapping) | **2023.09.01** | | ||
| [AndroidX Compose Activity](https://developer.android.com/jetpack/androidx/releases/activity#1.8.0) | **1.8.0** | | ||
| [Material Design](https://m2.material.io/) | **1.10.0** | | ||
| [Gradle](https://docs.gradle.org/8.4/release-notes.html) | **8.4** | | ||
| [Android Gradle plugin](https://developer.android.com/build/releases/gradle-plugin) | **8.1.2** | | ||
| [AndroidX Compose BoM](https://developer.android.com/jetpack/compose/bom/bom-mapping) | **2023.10.01** | | ||
| [AndroidX Recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.3.2) | **1.3.2** | | ||
| [AndroidX Fragment](https://developer.android.com/jetpack/androidx/releases/fragment#1.6.2) | **1.6.2** | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 10 additions & 80 deletions
90
bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,36 @@ | ||
/* | ||
* Copyright (c) 2019 Adyen N.V. | ||
* Copyright (c) 2023 Adyen N.V. | ||
* | ||
* This file is open source and available under the MIT license. See the LICENSE file for more info. | ||
* | ||
* Created by arman on 18/9/2019. | ||
* Created by ozgur on 22/8/2023. | ||
*/ | ||
|
||
package com.adyen.checkout.bcmc | ||
|
||
import androidx.lifecycle.LifecycleOwner | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.adyen.checkout.action.core.internal.ActionHandlingComponent | ||
import com.adyen.checkout.action.core.internal.DefaultActionHandlingComponent | ||
import com.adyen.checkout.action.core.internal.ui.GenericActionDelegate | ||
import com.adyen.checkout.bcmc.internal.provider.BcmcComponentProvider | ||
import com.adyen.checkout.bcmc.internal.ui.BcmcDelegate | ||
import com.adyen.checkout.card.CardBrand | ||
import com.adyen.checkout.card.CardType | ||
import com.adyen.checkout.card.CardComponent | ||
import com.adyen.checkout.card.internal.ui.CardDelegate | ||
import com.adyen.checkout.components.core.PaymentMethodTypes | ||
import com.adyen.checkout.components.core.internal.ButtonComponent | ||
import com.adyen.checkout.components.core.internal.ComponentEventHandler | ||
import com.adyen.checkout.components.core.internal.PaymentComponent | ||
import com.adyen.checkout.components.core.internal.PaymentComponentEvent | ||
import com.adyen.checkout.components.core.internal.toActionCallback | ||
import com.adyen.checkout.components.core.internal.ui.ComponentDelegate | ||
import com.adyen.checkout.core.internal.util.LogUtil | ||
import com.adyen.checkout.core.internal.util.Logger | ||
import com.adyen.checkout.ui.core.internal.ui.ButtonDelegate | ||
import com.adyen.checkout.ui.core.internal.ui.ComponentViewType | ||
import com.adyen.checkout.ui.core.internal.ui.ViewableComponent | ||
import com.adyen.checkout.ui.core.internal.util.mergeViewFlows | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
/** | ||
* A [PaymentComponent] that supports the [PaymentMethodTypes.BCMC] payment method. | ||
*/ | ||
class BcmcComponent internal constructor( | ||
private val bcmcDelegate: BcmcDelegate, | ||
private val genericActionDelegate: GenericActionDelegate, | ||
private val actionHandlingComponent: DefaultActionHandlingComponent, | ||
class BcmcComponent( | ||
cardDelegate: CardDelegate, | ||
genericActionDelegate: GenericActionDelegate, | ||
actionHandlingComponent: DefaultActionHandlingComponent, | ||
internal val componentEventHandler: ComponentEventHandler<BcmcComponentState>, | ||
) : ViewModel(), | ||
PaymentComponent, | ||
ViewableComponent, | ||
ButtonComponent, | ||
ActionHandlingComponent by actionHandlingComponent { | ||
|
||
override val delegate: ComponentDelegate get() = actionHandlingComponent.activeDelegate | ||
|
||
override val viewFlow: Flow<ComponentViewType?> = mergeViewFlows( | ||
viewModelScope, | ||
bcmcDelegate.viewFlow, | ||
genericActionDelegate.viewFlow, | ||
) | ||
|
||
init { | ||
bcmcDelegate.initialize(viewModelScope) | ||
genericActionDelegate.initialize(viewModelScope) | ||
componentEventHandler.initialize(viewModelScope) | ||
} | ||
|
||
internal fun observe( | ||
lifecycleOwner: LifecycleOwner, | ||
callback: (PaymentComponentEvent<BcmcComponentState>) -> Unit | ||
) { | ||
bcmcDelegate.observe(lifecycleOwner, viewModelScope, callback) | ||
genericActionDelegate.observe(lifecycleOwner, viewModelScope, callback.toActionCallback()) | ||
} | ||
|
||
internal fun removeObserver() { | ||
bcmcDelegate.removeObserver() | ||
genericActionDelegate.removeObserver() | ||
} | ||
|
||
override fun isConfirmationRequired(): Boolean = bcmcDelegate.isConfirmationRequired() | ||
|
||
override fun submit() { | ||
(delegate as? ButtonDelegate)?.onSubmit() ?: Logger.e(TAG, "Component is currently not submittable, ignoring.") | ||
} | ||
|
||
override fun setInteractionBlocked(isInteractionBlocked: Boolean) { | ||
(delegate as? BcmcDelegate)?.setInteractionBlocked(isInteractionBlocked) | ||
?: Logger.e(TAG, "Payment component is not interactable, ignoring.") | ||
} | ||
|
||
override fun onCleared() { | ||
super.onCleared() | ||
Logger.d(TAG, "onCleared") | ||
bcmcDelegate.onCleared() | ||
genericActionDelegate.onCleared() | ||
componentEventHandler.onCleared() | ||
} | ||
|
||
) : CardComponent(cardDelegate, genericActionDelegate, actionHandlingComponent, componentEventHandler) { | ||
companion object { | ||
private val TAG = LogUtil.getTag() | ||
|
||
@JvmField | ||
val PROVIDER = BcmcComponentProvider() | ||
|
||
@JvmField | ||
val PAYMENT_METHOD_TYPES = listOf(PaymentMethodTypes.BCMC) | ||
|
||
internal val SUPPORTED_CARD_TYPE = CardBrand(cardType = CardType.BCMC) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.