-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87ef2c7
commit 0cfa94f
Showing
14 changed files
with
31 additions
and
49 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
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
25 changes: 13 additions & 12 deletions
25
paymentsheet/src/main/java/com/stripe/android/link/ui/paymentmenthod/PaymentMethodScreen.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,45 +1,46 @@ | ||
package com.stripe.android.link.ui.paymentmenthod | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.unit.dp | ||
import com.stripe.android.link.ui.PrimaryButton | ||
import com.stripe.android.link.ui.ScrollableTopLevelColumn | ||
import com.stripe.android.paymentsheet.model.label | ||
import com.stripe.android.paymentsheet.ui.FormElement | ||
import com.stripe.android.paymentsheet.ui.PaymentMethodForm | ||
import com.stripe.android.uicore.utils.collectAsState | ||
import java.util.UUID | ||
|
||
@Composable | ||
internal fun PaymentMethodScreen( | ||
viewModel: PaymentMethodViewModel | ||
) { | ||
val state by viewModel.state.collectAsState() | ||
val context = LocalContext.current | ||
val uuid = rememberSaveable { UUID.randomUUID().toString() } | ||
|
||
Column { | ||
FormElement( | ||
ScrollableTopLevelColumn { | ||
PaymentMethodForm( | ||
uuid = uuid, | ||
args = state.formArguments, | ||
enabled = true, | ||
selectedPaymentMethodCode = state.selectedPaymentMethodCode, | ||
formElements = state.formElements, | ||
formArguments = state.formArguments, | ||
usBankAccountFormArguments = state.usBankAccountFormArguments, | ||
horizontalPadding = 16.dp, | ||
onFormFieldValuesChanged = { formValues -> | ||
viewModel.formValuesChanged(formValues) | ||
}, | ||
onInteractionEvent = {}, | ||
formElements = state.formElements, | ||
) | ||
|
||
Text(state.paymentSelection?.label?.resolve(context) ?: "null") | ||
|
||
PrimaryButton( | ||
label = state.primaryButtonLabel.resolve(context), | ||
state = state.primaryButtonState, | ||
onButtonClick = { | ||
|
||
} | ||
onButtonClick = viewModel::onPayClicked | ||
) | ||
} | ||
} |
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
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
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