@@ -19,14 +19,14 @@ import com.paypal.android.paymentbuttons.PayPalButton
19
19
import com.paypal.android.paymentbuttons.PayPalButtonColor
20
20
import com.paypal.android.paymentbuttons.PayPalButtonLabel
21
21
import com.paypal.android.paymentbuttons.PaymentButtonSize
22
- import com.paypal.android.uishared.enums.DemoPaymentButtonType
22
+ import com.paypal.android.paypalwebpayments.PayPalWebCheckoutFundingSource
23
23
import com.paypal.android.uishared.state.ActionState
24
24
import com.paypal.android.uishared.state.CompletedActionState
25
25
import com.paypal.android.utils.UIConstants
26
26
27
27
@Composable
28
28
fun <S , E > ActionPaymentButtonColumn (
29
- type : DemoPaymentButtonType ,
29
+ fundingSource : PayPalWebCheckoutFundingSource ,
30
30
state : ActionState <S , E >,
31
31
onClick : () -> Unit ,
32
32
modifier : Modifier = Modifier ,
@@ -36,7 +36,7 @@ fun <S, E> ActionPaymentButtonColumn(
36
36
modifier = modifier
37
37
) {
38
38
DemoPaymentButton (
39
- type = type ,
39
+ fundingSource = fundingSource ,
40
40
onClick = {
41
41
if (state is ActionState .Idle ) {
42
42
onClick()
@@ -59,29 +59,31 @@ fun <S, E> ActionPaymentButtonColumn(
59
59
60
60
@Composable
61
61
fun DemoPaymentButton (
62
- type : DemoPaymentButtonType ,
62
+ fundingSource : PayPalWebCheckoutFundingSource ,
63
63
onClick : () -> Unit ,
64
64
modifier : Modifier = Modifier
65
65
) {
66
- when (type) {
67
- DemoPaymentButtonType .PAYPAL -> AndroidView (
66
+ when (fundingSource) {
67
+
68
+ PayPalWebCheckoutFundingSource .CARD -> AndroidView (
68
69
factory = { context ->
69
- PayPalButton (context).apply { setOnClickListener { onClick() } }
70
+ CardButton (context).apply { setOnClickListener { onClick() } }
70
71
},
71
72
update = { button ->
72
- button.color = PayPalButtonColor .BLUE
73
- button.label = PayPalButtonLabel .PAY
73
+ button.label = CardButtonLabel .PAY
74
74
button.size = PaymentButtonSize .LARGE
75
75
},
76
76
modifier = modifier
77
77
)
78
78
79
- DemoPaymentButtonType . CARD -> AndroidView (
79
+ else -> AndroidView (
80
80
factory = { context ->
81
- CardButton (context).apply { setOnClickListener { onClick() } }
81
+ PayPalButton (context).apply { setOnClickListener { onClick() } }
82
82
},
83
83
update = { button ->
84
- button.label = CardButtonLabel .PAY
84
+ button.color = PayPalButtonColor .BLUE
85
+ button.label = PayPalButtonLabel .PAY
86
+ button.size = PaymentButtonSize .LARGE
85
87
},
86
88
modifier = modifier
87
89
)
@@ -95,7 +97,7 @@ fun StatefulActionPaymentButtonPreview() {
95
97
Surface (modifier = Modifier .fillMaxSize()) {
96
98
Column {
97
99
ActionPaymentButtonColumn (
98
- type = DemoPaymentButtonType .CARD ,
100
+ fundingSource = PayPalWebCheckoutFundingSource .CARD ,
99
101
state = ActionState .Idle ,
100
102
onClick = {},
101
103
modifier = Modifier
0 commit comments