Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.1.0 #1416

Merged
merged 87 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c6e2a8a
Merge pull request #1386 from Adyen/main
jreij Nov 10, 2023
b30a642
Do not rebase renovate PRs automatically
jreij Nov 10, 2023
4f80096
Merge pull request #1388 from Adyen/fix/renovate_rebase
jreij Nov 13, 2023
2de5c55
Show card name instead of "Credit Card" on stored card payment compon…
araratthehero Nov 9, 2023
39ecc10
Add overridePaymentMethodName method in DropInConfiguration
araratthehero Nov 9, 2023
78daf08
Move test classes to the correct package for drop-in
araratthehero Nov 10, 2023
3e7d66a
Modify overridePaymentMethodInformation implementation.
araratthehero Nov 10, 2023
aaba2de
Remove redundant DropInViewModelFactoryTest
araratthehero Nov 10, 2023
a4a090b
Add release notes
araratthehero Nov 10, 2023
e44f359
Address CR comments
araratthehero Nov 13, 2023
9ebd55e
Merge pull request #1380 from Adyen/feature/override_payment_method_n…
araratthehero Nov 14, 2023
cf90737
Update dependency androidx.activity:activity-compose to v1.8.0
renovate[bot] Nov 10, 2023
889a25e
Merge pull request #1357 from Adyen/renovate/compose_activity_version
jreij Nov 14, 2023
aeba138
Update dependency org.json:json to v20231013
renovate[bot] Nov 14, 2023
8b3db81
Merge pull request #1361 from Adyen/renovate/major-json_version
jreij Nov 14, 2023
6188fd7
Update dependency com.google.android.material:material to v1.10.0
renovate[bot] Nov 14, 2023
8048b38
Update verification-metadata.xml
jreij Nov 14, 2023
61eed42
Merge pull request #1359 from Adyen/renovate/material_version
jreij Nov 14, 2023
1cb0e30
Make it possible to override version and platform for analytics
OscarSpruit Nov 7, 2023
fec9115
Use an enum for the platform value
OscarSpruit Nov 9, 2023
f297f33
Merge pull request #1378 from Adyen/feature/overridable_analytics
OscarSpruit Nov 15, 2023
57bdb02
Update dependency gradle to v8.4
renovate[bot] Nov 15, 2023
f7d6dc5
Merge pull request #1358 from Adyen/renovate/gradle-8.x
jreij Nov 15, 2023
cd9ee7a
Rename telemetry to analytics
jreij Nov 15, 2023
f07444a
Merge pull request #1391 from Adyen/fix/telemetry_terminology
jreij Nov 15, 2023
34f8435
Update android_gradle_plugin_version to v8.1.2
renovate[bot] Nov 10, 2023
7eee68d
Update verification-metadata.xml
jreij Nov 15, 2023
ee30933
Merge pull request #1352 from Adyen/renovate/android_gradle_plugin_ve…
jreij Nov 16, 2023
8a951a1
Update plugin org.jetbrains.dokka to v1.9.10
renovate[bot] Nov 16, 2023
958aafb
Merge pull request #1362 from Adyen/renovate/dokka_version
jreij Nov 16, 2023
8aadbd2
Revert "Revert "Refactor BCMC""
ozgur00 Nov 10, 2023
841aa78
Merge pull request #1387 from Adyen/revert-1385-revert-1331-refactor/…
ozgur00 Nov 23, 2023
f722dc1
Fix selected card index not being reset when a new card is detected
ozgur00 Nov 15, 2023
fe94d02
Merge pull request #1392 from Adyen/fix/selected-card-index
ozgur00 Nov 23, 2023
bb4dce2
Allow showing amounts as part of installment options
araratthehero Nov 16, 2023
03242f5
Add translations
araratthehero Nov 20, 2023
99c8da0
Format numberOfInstallments options based on locale
araratthehero Nov 20, 2023
5fa0a21
Add unit tests for NumberExtension, InstallmentUtils and CurrencyUtils
araratthehero Nov 21, 2023
1d95c41
Do optimisations and improve tests for InstallmentUtils
araratthehero Nov 21, 2023
3dd68a6
Update release notes
araratthehero Nov 22, 2023
6d44e09
Address CR comments
araratthehero Nov 23, 2023
2e367b5
Merge pull request #1389 from Adyen/feature/display_amounts_for_insta…
araratthehero Nov 23, 2023
d5fe9cf
Update ktlint to version 1.0.1
jreij Nov 16, 2023
05a80b1
Update verification-metadata.xml
jreij Nov 16, 2023
02afea9
Fix new ktlint rules with 1.0.1
jreij Nov 16, 2023
c95e82e
Fix ktlint rules discouraged-comment-location and parameter-list-spac…
jreij Nov 16, 2023
b97df6a
Rename version and platform in AnalyticsMapper to provide more clarity
jreij Nov 22, 2023
c533454
Add allow trailing comma rules
jreij Nov 24, 2023
06f6d0f
Merge pull request #1393 from Adyen/dependencies/ktlint_v1
jreij Nov 24, 2023
1ba2349
Update dependency androidx.compose:compose-bom to v2023.10.01
renovate[bot] Nov 24, 2023
e515021
Merge pull request #1375 from Adyen/renovate/compose_bom_version
jreij Nov 24, 2023
313d13d
Update detekt_version to v1.23.3
renovate[bot] Dec 1, 2023
4bb0d1a
Merge pull request #1407 from Adyen/renovate/detekt_version
OscarSpruit Dec 1, 2023
80f5880
Update dependency androidx.recyclerview:recyclerview to v1.3.2
renovate[bot] Dec 4, 2023
420c7b6
Merge pull request #1406 from Adyen/renovate/recyclerview_version
jreij Dec 4, 2023
28e81b6
Update plugin io.gitlab.arturbosch.detekt to v1.23.3
renovate[bot] Dec 4, 2023
eb58637
Merge pull request #1408 from Adyen/renovate/detekt_gradle_plugin_ver…
jreij Dec 4, 2023
c1c36c1
Add pinRequired configuration for gift card component
OscarSpruit Nov 22, 2023
ed050eb
Merge pull request #1398 from Adyen/feature/pin_required_config
OscarSpruit Dec 4, 2023
4694ac6
Update dependency org.robolectric:robolectric to v4.11.1
renovate[bot] Dec 4, 2023
02a4619
Merge pull request #1410 from Adyen/renovate/robolectric_version
jreij Dec 4, 2023
ac9bbc7
Update okhttp monorepo to v4.12.0
renovate[bot] Dec 4, 2023
d71dfb3
Merge pull request #1411 from Adyen/renovate/okhttp-monorepo
jreij Dec 4, 2023
fb63e1c
Update dependency androidx.fragment:fragment-ktx to v1.6.2
renovate[bot] Dec 4, 2023
00cf321
Merge pull request #1412 from Adyen/renovate/fragment_version
jreij Dec 4, 2023
71ae855
Reverted back the changes made in AdyenComponentView to add the compo…
araratthehero Dec 1, 2023
5d8dc98
Merge pull request #1403 from Adyen/fix/component_not_showing_in_comp…
araratthehero Dec 6, 2023
c057ca5
Add tests for GooglePayUtils
jreij Dec 5, 2023
6523e4e
Add getGooglePayButtonParameters to GooglePayComponent
jreij Dec 5, 2023
45f18d4
Make AllowedAuthMethods and AllowedCardNetworks public
jreij Dec 5, 2023
aec762b
Restore previous release notes
jreij Dec 5, 2023
74882b6
Update release notes for Google Pay
jreij Dec 6, 2023
0bf7868
Merge pull request #1413 from Adyen/feature/google_pay_allowed_paymen…
jreij Dec 6, 2023
1a7ff19
Add compose dependencies
OscarSpruit Nov 30, 2023
1afa81e
Remove unnecessary compose compiler args
OscarSpruit Nov 30, 2023
1ea76a0
Setup Compose theming
OscarSpruit Nov 30, 2023
c096390
Migrate Card Component with sessions example to compose
OscarSpruit Nov 30, 2023
3e1d0f4
Add result screen when payment flow is finished
OscarSpruit Nov 30, 2023
28e4144
Add copyright notice to files that missed it
OscarSpruit Nov 30, 2023
df7f920
Tweak Detekt rules for Compose
OscarSpruit Nov 30, 2023
6d44eff
Handle user cancellation
OscarSpruit Dec 4, 2023
c91f1b6
Improve composables
OscarSpruit Dec 5, 2023
51de3ac
Add dimensions to compose theme
OscarSpruit Dec 6, 2023
43953e3
Merge pull request #1404 from Adyen/feature/compse_example
OscarSpruit Dec 11, 2023
185ecde
Bump version to 5.1.0
jreij Dec 7, 2023
a9d9c8b
Update release notes for 5.1.0
jreij Dec 7, 2023
adc16be
Merge pull request #1415 from Adyen/release/5.1.0
jreij Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
}
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