@@ -19,14 +19,14 @@ import com.paypal.android.paymentbuttons.PayPalButton
1919import com.paypal.android.paymentbuttons.PayPalButtonColor
2020import com.paypal.android.paymentbuttons.PayPalButtonLabel
2121import com.paypal.android.paymentbuttons.PaymentButtonSize
22- import com.paypal.android.uishared.enums.DemoPaymentButtonType
22+ import com.paypal.android.paypalwebpayments.PayPalWebCheckoutFundingSource
2323import com.paypal.android.uishared.state.ActionState
2424import com.paypal.android.uishared.state.CompletedActionState
2525import com.paypal.android.utils.UIConstants
2626
2727@Composable
2828fun <S , E > ActionPaymentButtonColumn (
29- type : DemoPaymentButtonType ,
29+ fundingSource : PayPalWebCheckoutFundingSource ,
3030 state : ActionState <S , E >,
3131 onClick : () -> Unit ,
3232 modifier : Modifier = Modifier ,
@@ -36,7 +36,7 @@ fun <S, E> ActionPaymentButtonColumn(
3636 modifier = modifier
3737 ) {
3838 DemoPaymentButton (
39- type = type ,
39+ fundingSource = fundingSource ,
4040 onClick = {
4141 if (state is ActionState .Idle ) {
4242 onClick()
@@ -59,29 +59,31 @@ fun <S, E> ActionPaymentButtonColumn(
5959
6060@Composable
6161fun DemoPaymentButton (
62- type : DemoPaymentButtonType ,
62+ fundingSource : PayPalWebCheckoutFundingSource ,
6363 onClick : () -> Unit ,
6464 modifier : Modifier = Modifier
6565) {
66- when (type) {
67- DemoPaymentButtonType .PAYPAL -> AndroidView (
66+ when (fundingSource) {
67+
68+ PayPalWebCheckoutFundingSource .CARD -> AndroidView (
6869 factory = { context ->
69- PayPalButton (context).apply { setOnClickListener { onClick() } }
70+ CardButton (context).apply { setOnClickListener { onClick() } }
7071 },
7172 update = { button ->
72- button.color = PayPalButtonColor .BLUE
73- button.label = PayPalButtonLabel .PAY
73+ button.label = CardButtonLabel .PAY
7474 button.size = PaymentButtonSize .LARGE
7575 },
7676 modifier = modifier
7777 )
7878
79- DemoPaymentButtonType . CARD -> AndroidView (
79+ else -> AndroidView (
8080 factory = { context ->
81- CardButton (context).apply { setOnClickListener { onClick() } }
81+ PayPalButton (context).apply { setOnClickListener { onClick() } }
8282 },
8383 update = { button ->
84- button.label = CardButtonLabel .PAY
84+ button.color = PayPalButtonColor .BLUE
85+ button.label = PayPalButtonLabel .PAY
86+ button.size = PaymentButtonSize .LARGE
8587 },
8688 modifier = modifier
8789 )
@@ -95,7 +97,7 @@ fun StatefulActionPaymentButtonPreview() {
9597 Surface (modifier = Modifier .fillMaxSize()) {
9698 Column {
9799 ActionPaymentButtonColumn (
98- type = DemoPaymentButtonType .CARD ,
100+ fundingSource = PayPalWebCheckoutFundingSource .CARD ,
99101 state = ActionState .Idle ,
100102 onClick = {},
101103 modifier = Modifier
0 commit comments