Skip to content

Commit

Permalink
Merge pull request #1416 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 5.1.0
  • Loading branch information
araratthehero committed Dec 11, 2023
2 parents 7722943 + adc16be commit 05c0582
Show file tree
Hide file tree
Showing 183 changed files with 4,959 additions and 2,052 deletions.
9 changes: 5 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,20 @@ ij_groovy_wrap_long_lines = false

# noinspection EditorConfigKeyCorrectness
[{*.kt,*.kts}]
ktlint_standard_import-ordering = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_code_style = android_studio
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_function-signature = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable
max_line_length = 120
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_assignment_wrap = normal
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ Import the corresponding module in your `build.gradle` file.

For Drop-in:
```groovy
implementation "com.adyen.checkout:drop-in-compose:5.0.1"
implementation "com.adyen.checkout:drop-in-compose:5.1.0"
```
For the Credit Card component:
```groovy
implementation "com.adyen.checkout:card:5.0.1"
implementation "com.adyen.checkout:components-compose:5.0.1"
implementation "com.adyen.checkout:card:5.1.0"
implementation "com.adyen.checkout:components-compose:5.1.0"
```

### Without Jetpack Compose

For Drop-in:
```groovy
implementation "com.adyen.checkout:drop-in:5.0.1"
implementation "com.adyen.checkout:drop-in:5.1.0"
```
For the Credit Card component:
```groovy
implementation "com.adyen.checkout:card:5.0.1"
implementation "com.adyen.checkout:card:5.1.0"
```

The library is available on [Maven Central][mavenRepo].
Expand Down
28 changes: 21 additions & 7 deletions RELEASE_NOTES.md
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** |
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal class ACHDirectDebitComponentParamsMapperTest {

val sessionParams = SessionParams(
enableStoreDetails = sessionsValue,
installmentOptions = null,
installmentConfiguration = null,
amount = null,
returnUrl = "",
)
Expand Down Expand Up @@ -212,7 +212,7 @@ internal class ACHDirectDebitComponentParamsMapperTest {
achConfiguration,
sessionParams = SessionParams(
enableStoreDetails = null,
installmentOptions = null,
installmentConfiguration = null,
amount = sessionsValue,
returnUrl = "",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import com.adyen.checkout.voucher.VoucherConfiguration
import com.adyen.checkout.wechatpay.WeChatPayActionConfiguration
import java.util.Locale

@Suppress("UNCHECKED_CAST")
@Suppress(
"UNCHECKED_CAST",
"ktlint:standard:discouraged-comment-location",
"ktlint:standard:type-parameter-list-spacing",
)
abstract class ActionHandlingPaymentMethodConfigurationBuilder<
ConfigurationT : Configuration,
BuilderT : BaseConfigurationBuilder<ConfigurationT, BuilderT>
Expand Down
90 changes: 10 additions & 80 deletions bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcComponent.kt
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)
}
}
15 changes: 3 additions & 12 deletions bcmc/src/main/java/com/adyen/checkout/bcmc/BcmcComponentState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@
*
* This file is open source and available under the MIT license. See the LICENSE file for more info.
*
* Created by ozgur on 20/2/2023.
* Created by ozgur on 27/9/2023.
*/

package com.adyen.checkout.bcmc

import com.adyen.checkout.components.core.PaymentComponentData
import com.adyen.checkout.components.core.PaymentComponentState
import com.adyen.checkout.components.core.paymentmethod.CardPaymentMethod
import com.adyen.checkout.card.CardComponentState

/**
* Represents the state of [BcmcComponent].
*/
data class BcmcComponentState(
override val data: PaymentComponentData<CardPaymentMethod>,
override val isInputValid: Boolean,
override val isReady: Boolean
) : PaymentComponentState<CardPaymentMethod>
typealias BcmcComponentState = CardComponentState
Loading

0 comments on commit 05c0582

Please sign in to comment.