From 9b4408cb5b696e4bebe25113c589b6f534adf1ef Mon Sep 17 00:00:00 2001 From: Jason Divock Date: Wed, 6 Apr 2022 12:30:48 -0600 Subject: [PATCH] hide simulated and connect fields --- .../src/screens/CollectCardPaymentScreen.tsx | 96 ++++++++++++------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/example/src/screens/CollectCardPaymentScreen.tsx b/example/src/screens/CollectCardPaymentScreen.tsx index 9d2ede39..f7cb179f 100644 --- a/example/src/screens/CollectCardPaymentScreen.tsx +++ b/example/src/screens/CollectCardPaymentScreen.tsx @@ -27,6 +27,7 @@ export default function CollectCardPaymentScreen() { }); const [testCardNumber, setTestCardNumber] = useState('4242424242424242'); const [enableInterac, setEnableInterac] = useState(false); + const [enableConnect, setEnableConnect] = useState(false); const [capturePI, setCapturePI] = useState(true); const { params } = useRoute>(); @@ -230,6 +231,9 @@ export default function CollectCardPaymentScreen() { }); const { paymentIntent, error } = await processPayment(paymentIntentId); + + console.log(error); + if (error) { addLogs({ name: 'Process Payment', @@ -302,16 +306,18 @@ export default function CollectCardPaymentScreen() { contentContainerStyle={styles.container} keyboardShouldPersistTaps="always" > - - setTestCardNumber(value)} - placeholder="card number" - /> - + {simulated && ( + + setTestCardNumber(value)} + placeholder="card number" + /> + + )} - + - - - setInputValues((state) => ({ ...state, connectedAccountId: value })) + + setEnableConnect(value)} + /> } - placeholder="Connected Stripe Account ID" /> + {enableConnect && ( + <> + + + setInputValues((state) => ({ + ...state, + connectedAccountId: value, + })) + } + placeholder="Connected Stripe Account ID" + /> + + + + + setInputValues((state) => ({ + ...state, + applicationFeeAmount: value, + })) + } + placeholder="Application Fee Amount" + /> + + + )} - - - setInputValues((state) => ({ - ...state, - applicationFeeAmount: value, - })) - } - placeholder="Application Fee Amount" - /> -