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

Renames connections to financial connections. #4887

Merged
merged 9 commits into from
Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
/identity/ @ccen-stripe @awush-stripe
/identity-example/ @ccen-stripe @awush-stripe

# connections sdk
/connections/ @carlosmuvi-stripe
# financial connections sdk
/financial-connections/ @carlosmuvi-stripe

# shared modules
/stripe-core/ @ccen-stripe
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ changes the public API for CardImageVerificationSheet and releases Identity SDK.
### Identity (`com.stripe:identity`)
* [ADDED] [4820](https://github.com/stripe/stripe-android/pull/4820) Release Stripe's Identity SDK.

### Connections (`com.stripe:connection`)
### Financial Connections (`com.stripe:financial-connections`)
* [ADDED] [4818](https://github.com/stripe/stripe-mandroid/pull/4818) Connections SDK can be optionally included to support ACH Direct Debit payments.

### CardScan (`com.stripe:stripecardscan`)
Expand Down
889 changes: 0 additions & 889 deletions connections/api/connections.api

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def getAccountId() {

dependencies {
implementation project(':payments')
implementation project(':connections')
implementation project(':financial-connections')
implementation "androidx.appcompat:appcompat:$androidxAppcompatVersion"
implementation "androidx.recyclerview:recyclerview:$androidxRecyclerviewVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$androidxLifecycleVersion"
Expand Down
889 changes: 889 additions & 0 deletions financial-connections/api/financial-connections.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ android {


ext {
artifactId = "connections"
artifactName = "connections"
artifactDescrption = "The connections module of Stripe Payment Android SDK"
artifactId = "financial-connections"
artifactName = "financial-connections"
artifactDescrption = "The financial connections module of Stripe Android SDK"
}

apply from: "${rootDir}/deploy/deploy.gradle"
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.stripe.android.connections">
package="com.stripe.android.financialconnections">

<uses-permission android:name="android.permission.INTERNET" />

<application>
<activity
android:name=".ConnectionsSheetRedirectActivity"
android:name="com.stripe.android.financialconnections.FinancialConnectionsSheetRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
Expand All @@ -26,7 +26,7 @@
</intent-filter>
</activity>
<activity
android:name=".ConnectionsSheetActivity"
android:name="com.stripe.android.financialconnections.FinancialConnectionsSheetActivity"
android:exported="false"
android:theme="@style/StripeDefaultTheme" />
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.stripe.android.financialconnections

import androidx.activity.ComponentActivity
import androidx.activity.result.ActivityResultLauncher
import androidx.fragment.app.Fragment

internal class DefaultFinancialConnectionsSheetLauncher(
private val activityResultLauncher: ActivityResultLauncher<FinancialConnectionsSheetContract.Args>
) : FinancialConnectionsSheetLauncher {

constructor(
activity: ComponentActivity,
callback: FinancialConnectionsSheetResultCallback
) : this(
activity.registerForActivityResult(
FinancialConnectionsSheetContract()
) {
callback.onFinancialConnectionsSheetResult(it)
}
)

constructor(
fragment: Fragment,
callback: FinancialConnectionsSheetResultCallback
) : this(
fragment.registerForActivityResult(
FinancialConnectionsSheetContract()
) {
callback.onFinancialConnectionsSheetResult(it)
}
)

override fun present(configuration: FinancialConnectionsSheet.Configuration) {
activityResultLauncher.launch(
FinancialConnectionsSheetContract.Args(
configuration,
)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stripe.android.connections
package com.stripe.android.financialconnections

import android.os.Parcelable
import androidx.activity.ComponentActivity
Expand All @@ -11,11 +11,11 @@ import kotlinx.parcelize.Parcelize
* This *must* be called unconditionally, as part of initialization path,
* typically as a field initializer of an Activity or Fragment.
*/
class ConnectionsSheet internal constructor(
private val connectionsSheetLauncher: ConnectionsSheetLauncher
class FinancialConnectionsSheet internal constructor(
private val financialConnectionsSheetLauncher: FinancialConnectionsSheetLauncher
) {
/**
* Configuration for a Connections Sheet
* Configuration for a [FinancialConnectionsSheet]
*
* @param linkAccountSessionClientSecret the client secret for the Link Account Session
* @param publishableKey the Stripe publishable key
Expand All @@ -27,29 +27,29 @@ class ConnectionsSheet internal constructor(
) : Parcelable

/**
* Present the connections sheet.
* Present the [FinancialConnectionsSheet].
*
* @param configuration the connections sheet configuration
* @param configuration the [FinancialConnectionsSheet] configuration
*/
fun present(
configuration: Configuration
) {
connectionsSheetLauncher.present(configuration)
financialConnectionsSheetLauncher.present(configuration)
}

companion object {
/**
* Constructor to be used when launching the connections sheet from an Activity.
* Constructor to be used when launching the [FinancialConnectionsSheet] from an Activity.
*
* @param activity the Activity that is presenting the connections sheet.
* @param activity the Activity that is presenting the [FinancialConnectionsSheet].
* @param callback called with the result of the connections session after the connections sheet is dismissed.
*/
fun create(
activity: ComponentActivity,
callback: ConnectionsSheetResultCallback
): ConnectionsSheet {
return ConnectionsSheet(
DefaultConnectionsSheetLauncher(activity, callback)
callback: FinancialConnectionsSheetResultCallback
): FinancialConnectionsSheet {
return FinancialConnectionsSheet(
DefaultFinancialConnectionsSheetLauncher(activity, callback)
)
}

Expand All @@ -61,10 +61,10 @@ class ConnectionsSheet internal constructor(
*/
fun create(
fragment: Fragment,
callback: ConnectionsSheetResultCallback
): ConnectionsSheet {
return ConnectionsSheet(
DefaultConnectionsSheetLauncher(fragment, callback)
callback: FinancialConnectionsSheetResultCallback
): FinancialConnectionsSheet {
return FinancialConnectionsSheet(
DefaultFinancialConnectionsSheetLauncher(fragment, callback)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.stripe.android.connections
package com.stripe.android.financialconnections

import android.app.Activity
import android.content.Intent
Expand All @@ -10,36 +10,36 @@ import androidx.annotation.VisibleForTesting
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import com.stripe.android.connections.ConnectionsSheetViewEffect.FinishWithResult
import com.stripe.android.connections.ConnectionsSheetViewEffect.OpenAuthFlowWithUrl
import com.stripe.android.connections.databinding.ActivityConnectionsSheetBinding
import com.stripe.android.connections.presentation.CreateBrowserIntentForUrl
import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.FinishWithResult
import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.OpenAuthFlowWithUrl
import com.stripe.android.financialconnections.databinding.ActivityFinancialconnectionsSheetBinding
import com.stripe.android.financialconnections.presentation.CreateBrowserIntentForUrl
import java.security.InvalidParameterException

internal class ConnectionsSheetActivity : AppCompatActivity() {
internal class FinancialConnectionsSheetActivity : AppCompatActivity() {

private val startForResult = registerForActivityResult(StartActivityForResult()) {
viewModel.onActivityResult()
}

@VisibleForTesting
internal val viewBinding by lazy {
ActivityConnectionsSheetBinding.inflate(layoutInflater)
ActivityFinancialconnectionsSheetBinding.inflate(layoutInflater)
}

@VisibleForTesting
internal var viewModelFactory: ViewModelProvider.Factory =
ConnectionsSheetViewModel.Factory(
FinancialConnectionsSheetViewModel.Factory(
{ application },
{ requireNotNull(starterArgs) },
this,
intent?.extras
)

private val viewModel: ConnectionsSheetViewModel by viewModels { viewModelFactory }
private val viewModel: FinancialConnectionsSheetViewModel by viewModels { viewModelFactory }

private val starterArgs: ConnectionsSheetContract.Args? by lazy {
ConnectionsSheetContract.Args.fromIntent(intent)
private val starterArgs: FinancialConnectionsSheetContract.Args? by lazy {
FinancialConnectionsSheetContract.Args.fromIntent(intent)
}

override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -49,7 +49,7 @@ internal class ConnectionsSheetActivity : AppCompatActivity() {
val starterArgs = this.starterArgs
if (starterArgs == null) {
finishWithResult(
ConnectionsSheetResult.Failed(
FinancialConnectionsSheetResult.Failed(
IllegalArgumentException("ConnectionsSheet started without arguments.")
)
)
Expand All @@ -58,7 +58,7 @@ internal class ConnectionsSheetActivity : AppCompatActivity() {
try {
starterArgs.validate()
} catch (e: InvalidParameterException) {
finishWithResult(ConnectionsSheetResult.Failed(e))
finishWithResult(FinancialConnectionsSheetResult.Failed(e))
return
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ internal class ConnectionsSheetActivity : AppCompatActivity() {
val uri = Uri.parse(this.url)
startForResult.launch(
CreateBrowserIntentForUrl(
context = this@ConnectionsSheetActivity,
context = this@FinancialConnectionsSheetActivity,
uri = uri,
)
)
Expand All @@ -111,13 +111,13 @@ internal class ConnectionsSheetActivity : AppCompatActivity() {
* return canceled result
*/
override fun onBackPressed() {
finishWithResult(ConnectionsSheetResult.Canceled)
finishWithResult(FinancialConnectionsSheetResult.Canceled)
}

private fun finishWithResult(result: ConnectionsSheetResult) {
private fun finishWithResult(result: FinancialConnectionsSheetResult) {
setResult(
Activity.RESULT_OK,
Intent().putExtras(ConnectionsSheetContract.Result(result).toBundle())
Intent().putExtras(FinancialConnectionsSheetContract.Result(result).toBundle())
)
finish()
}
Expand Down
Loading