From cd00b927f90ef8a63efcff40423b9d3478d29c45 Mon Sep 17 00:00:00 2001 From: prachigarg19 <72646230+prachigarg19@users.noreply.github.com> Date: Thu, 9 Nov 2023 17:13:47 +0530 Subject: [PATCH 1/9] refactor: remove conditions --- src/Donations/Components/DonationsForm.tsx | 14 ++++----- .../PaymentMethods/PaymentMethodTabs.tsx | 4 +-- .../PaymentRequestCustomButton.tsx | 30 +++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Donations/Components/DonationsForm.tsx b/src/Donations/Components/DonationsForm.tsx index 6652bff0..0e3e7371 100644 --- a/src/Donations/Components/DonationsForm.tsx +++ b/src/Donations/Components/DonationsForm.tsx @@ -108,7 +108,7 @@ function DonationsForm(): ReactElement { //Only used for native pay. Is this still applicable, or should this be removed? const onPaymentFunction = async ( paymentMethod: PaymentMethod, - paymentRequest: PaymentRequest, + paymentRequest: PaymentRequest ) => { // eslint-disable-next-line no-underscore-dangle setPaymentType(paymentRequest._activeBackingLibraryName); //TODOO - is _activeBackingLibraryName a private variable? @@ -223,7 +223,7 @@ function DonationsForm(): ReactElement { amount: getFormatedCurrency( i18n.language, currency, - paymentSetup.unitCost * quantity, + paymentSetup.unitCost * quantity ), }); break; @@ -233,7 +233,7 @@ function DonationsForm(): ReactElement { amount: getFormatedCurrency( i18n.language, currency, - paymentSetup.unitCost * quantity, + paymentSetup.unitCost * quantity ), }); break; @@ -389,13 +389,13 @@ function DonationsForm(): ReactElement { paymentSetup?.gateways?.stripe?.account && currency ? ( { +}: // isApplePayEnabled, +// isGooglePayEnabled, +PaymentButtonProps): ReactElement | null => { const { t, ready } = useTranslation(["common"]); const { paymentRequest, setPaymentRequest } = useContext(QueryParamContext); @@ -74,6 +74,7 @@ export const PaymentRequestCustomButton = ({ if (result) { setPaymentRequest(pr); } + console.log(result); }); } }, [stripe, paymentRequest, country, currency, amount]); @@ -130,6 +131,7 @@ export const PaymentRequestCustomButton = ({ } }; }, [paymentRequest, onPaymentFunction]); + console.log(paymentRequest); return ready ? (
- ) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY && - isGooglePayEnabled ? ( //TODOO - is _canMakePaymentAvailability a private variable? + ) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY ? ( //TODOO - is _canMakePaymentAvailability a private variable?
- ) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY ? ( //TODOO - is _canMakePaymentAvailability a private variable? + ) : paymentRequest._canMakePaymentAvailability.GOOGLE_PAY && + isGooglePayEnabled ? ( //TODOO - is _canMakePaymentAvailability a private variable?