Skip to content

Commit

Permalink
Merge pull request #1265 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 5.0.0-alpha02
  • Loading branch information
jreij authored Jul 18, 2023
2 parents 4a3e0a4 + df7316d commit 6388365
Show file tree
Hide file tree
Showing 499 changed files with 16,700 additions and 2,268 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3

# Setup Java 11
# Setup Java 17
# https://github.com/marketplace/actions/setup-java-jdk
- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17
cache: 'gradle'

- name: Grant execute permission for gradlew
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3

# Setup Java 11
# Setup Java 17
# https://github.com/marketplace/actions/setup-java-jdk
- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17
cache: 'gradle'

- name: Grant execute permission for gradlew
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: ./gradlew dokkaHtmlMultiModule --no-daemon

- name: Deploy GitHub Pages
uses: JamesIves/[email protected].1
uses: JamesIves/[email protected].3
with:
BRANCH: gh-pages
FOLDER: build/docs/
4 changes: 2 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
with:
ref: main

- name: Set up JDK 11
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17
cache: 'gradle'

- name: Grant execute permission for gradlew
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/update_verification_metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update verification metadata

on:
push:
branches:
- 'renovate/**'
paths:
- 'dependencies.gradle'

jobs:
gradle-update-verification-metadata:
# https://github.com/actions/virtual-environments/
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# https://github.com/marketplace/actions/checkout
- uses: actions/checkout@v3

# Setup Java 17
# https://github.com/marketplace/actions/setup-java-jdk
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Run gradlew check
- name: Gradle update verification metadata
run: ./gradlew --write-verification-metadata sha256 build --no-daemon

- name: Commit
run: |
git config --local user.email '[email protected]'
git config --local user.name 'GitHub Action'
git add .
git commit -am 'Update verification metadata'
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
8 changes: 2 additions & 6 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal class SubmitFingerprintRepository internal constructor(
}
else -> {
Logger.e(TAG, "submitFingerprint: unexpected response $response")
throw IllegalStateException("Failed to retrieve 3DS2 fingerprint result")
error("Failed to retrieve 3DS2 fingerprint result")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ import com.adyen.checkout.components.core.internal.util.viewModelFactory
import com.adyen.checkout.core.internal.data.api.HttpClientFactory
import com.adyen.checkout.ui.core.internal.DefaultRedirectHandler
import com.adyen.threeds2.ThreeDS2Service
import com.adyen.threeds2.parameters.ChallengeParameters
import kotlinx.coroutines.Dispatchers

class Adyen3DS2ComponentProvider
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
class Adyen3DS2ComponentProvider(
constructor(
overrideComponentParams: ComponentParams? = null,
overrideSessionParams: SessionParams? = null,
) : ActionComponentProvider<Adyen3DS2Component, Adyen3DS2Configuration, Adyen3DS2Delegate> {
Expand Down Expand Up @@ -79,11 +79,9 @@ class Adyen3DS2ComponentProvider(
savedStateHandle: SavedStateHandle,
application: Application,
): Adyen3DS2Delegate {
val defaultThreeDSRequestorAppURL = ChallengeParameters.getEmbeddedRequestorAppURL(application)
val componentParams = componentParamsMapper.mapToParams(
adyen3DS2Configuration = configuration,
sessionParams = null,
defaultThreeDSRequestorAppURL = defaultThreeDSRequestorAppURL,
)
val httpClient = HttpClientFactory.getHttpClient(componentParams.environment)
val submitFingerprintService = SubmitFingerprintService(httpClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal object Adyen3DS2ViewProvider : ViewProvider {
defStyleAttr: Int
): ComponentView = when (viewType) {
Adyen3DS2ComponentViewType -> PaymentInProgressView(context, attrs, defStyleAttr)
else -> throw IllegalStateException("Unsupported view type")
else -> error("Unsupported view type")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ internal class DefaultAdyen3DS2Delegate(

val fingerprintToken = FingerprintToken.SERIALIZER.deserialize(fingerprintJson)
val configParameters = AdyenConfigParameters.Builder(
/* directoryServerId = */
// directoryServerId
fingerprintToken.directoryServerId,
/* directoryServerPublicKey = */
// directoryServerPublicKey
fingerprintToken.directoryServerPublicKey,
/* directoryServerRootCertificates = */
// directoryServerRootCertificates
fingerprintToken.directoryServerRootCertificates,
).build()

Expand All @@ -211,6 +211,9 @@ internal class DefaultAdyen3DS2Delegate(
}

coroutineScope.launch(defaultDispatcher + coroutineExceptionHandler) {
// This makes sure the 3DS2 SDK doesn't re-use any state from previous transactions
closeTransaction()

@Suppress("SwallowedException")
try {
Logger.d(TAG, "initialize 3DS2 SDK")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ internal data class Adyen3DS2ComponentParams(
override val isCreatedByDropIn: Boolean,
override val amount: Amount,
val uiCustomization: UiCustomization?,
val threeDSRequestorAppURL: String,
val threeDSRequestorAppURL: String?,
) : ComponentParams
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ internal class Adyen3DS2ComponentParamsMapper(
fun mapToParams(
adyen3DS2Configuration: Adyen3DS2Configuration,
sessionParams: SessionParams?,
defaultThreeDSRequestorAppURL: String,
): Adyen3DS2ComponentParams {
return adyen3DS2Configuration
.mapToParamsInternal(defaultThreeDSRequestorAppURL)
.mapToParamsInternal()
.override(overrideComponentParams)
.override(sessionParams ?: overrideSessionParams)
}

private fun Adyen3DS2Configuration.mapToParamsInternal(
defaultThreeDSRequestorAppURL: String,
): Adyen3DS2ComponentParams {
private fun Adyen3DS2Configuration.mapToParamsInternal(): Adyen3DS2ComponentParams {
return Adyen3DS2ComponentParams(
shopperLocale = shopperLocale,
environment = environment,
Expand All @@ -39,7 +36,7 @@ internal class Adyen3DS2ComponentParamsMapper(
isCreatedByDropIn = false,
amount = amount,
uiCustomization = uiCustomization,
threeDSRequestorAppURL = threeDSRequestorAppURL ?: defaultThreeDSRequestorAppURL,
threeDSRequestorAppURL = threeDSRequestorAppURL,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ internal class DefaultAdyen3DS2DelegateTest(
observerRepository = ActionObserverRepository(),
savedStateHandle = SavedStateHandle(),
componentParams = Adyen3DS2ComponentParamsMapper(null, null)
.mapToParams(configuration, null, "embeddedRequestorAppUrl"),
.mapToParams(configuration, null),
submitFingerprintRepository = submitFingerprintRepository,
paymentDataRepository = paymentDataRepository,
adyen3DS2Serializer = adyen3DS2Serializer,
Expand Down Expand Up @@ -526,7 +526,7 @@ internal class DefaultAdyen3DS2DelegateTest(
}

override fun getProgressView(p0: Activity?): ProgressDialog {
throw IllegalStateException("This method should not be used")
error("This method should not be used")
}

override fun close() = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.adyen.checkout.components.core.Amount
import com.adyen.checkout.components.core.internal.ui.model.GenericComponentParams
import com.adyen.checkout.core.Environment
import com.adyen.threeds2.customization.UiCustomization
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import java.util.Locale

Expand All @@ -25,11 +25,11 @@ internal class Adyen3DS2ComponentParamsMapperTest {
.build()

val params = Adyen3DS2ComponentParamsMapper(null, null)
.mapToParams(adyen3DS2Configuration, null, TEST_REQUESTOR_APP_URL)
.mapToParams(adyen3DS2Configuration, null)

val expected = getAdyen3DS2ComponentParams()

Assertions.assertEquals(expected, params)
assertEquals(expected, params)
}

@Test
Expand All @@ -43,14 +43,14 @@ internal class Adyen3DS2ComponentParamsMapperTest {
.build()

val params = Adyen3DS2ComponentParamsMapper(null, null)
.mapToParams(adyen3DS2Configuration, null, TEST_REQUESTOR_APP_URL)
.mapToParams(adyen3DS2Configuration, null)

val expected = getAdyen3DS2ComponentParams(
uiCustomization = uiCustomization,
threeDSRequestorAppURL = testUrl,
)

Assertions.assertEquals(expected, params)
assertEquals(expected, params)
}

@Test
Expand All @@ -73,7 +73,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
)

val params = Adyen3DS2ComponentParamsMapper(overrideParams, null)
.mapToParams(adyen3DS2Configuration, null, TEST_REQUESTOR_APP_URL)
.mapToParams(adyen3DS2Configuration, null)

val expected = getAdyen3DS2ComponentParams(
shopperLocale = Locale.GERMAN,
Expand All @@ -87,7 +87,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
),
)

Assertions.assertEquals(expected, params)
assertEquals(expected, params)
}

private fun getAdyen3DS2ConfigurationBuilder() = Adyen3DS2Configuration.Builder(
Expand All @@ -105,7 +105,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
isCreatedByDropIn: Boolean = false,
amount: Amount = Amount.EMPTY,
uiCustomization: UiCustomization? = null,
threeDSRequestorAppURL: String = TEST_REQUESTOR_APP_URL,
threeDSRequestorAppURL: String? = null,
) = Adyen3DS2ComponentParams(
shopperLocale = shopperLocale,
environment = environment,
Expand All @@ -120,6 +120,5 @@ internal class Adyen3DS2ComponentParamsMapperTest {
companion object {
private const val TEST_CLIENT_KEY_1 = "test_qwertyuiopasdfghjklzxcvbnmqwerty"
private const val TEST_CLIENT_KEY_2 = "live_qwertyui34566776787zxcvbnmqwerty"
private const val TEST_REQUESTOR_APP_URL = "TEST_REQUESTOR_APP_URL"
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ If you are upgrading from 3.x.x to a current release, check out our [migration g
Import the Component module for the Payment Method you want to use by adding it to your `build.gradle` file.
For example, for the Drop-in solution you should add:
```groovy
implementation "com.adyen.checkout:drop-in:4.11.0"
implementation "com.adyen.checkout:drop-in:4.12.0"
```
For a Credit Card component you should add:
```groovy
implementation "com.adyen.checkout:card:4.11.0"
implementation "com.adyen.checkout:card:4.12.0"
```

### Client Key
Expand Down
Loading

0 comments on commit 6388365

Please sign in to comment.