Skip to content

Commit

Permalink
Merge pull request #438 from Plant-for-the-Planet-org/develop
Browse files Browse the repository at this point in the history
Release October II
  • Loading branch information
mariahosfeld authored Oct 18, 2023
2 parents b68a779 + 3294d9e commit a294f8e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
30 changes: 19 additions & 11 deletions src/Donations/Components/DonationsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,23 @@ function DonationsForm(): ReactElement {
const [isPaymentProcessing, setIsPaymentProcessing] = React.useState(false);
const [paymentError, setPaymentError] = React.useState(""); //TODOO - confirm and remove

const canPayWithPlanetCash =
projectDetails !== null &&
projectDetails.purpose !== "funds" &&
projectDetails.purpose !== "planet-cash" &&
profile !== null &&
isSignedUp &&
profile.planetCash !== null &&
projectDetails.taxDeductionCountries?.includes(
profile.planetCash.country
) &&
!(isGift && giftDetails.recipientName === "") &&
!(onBehalf && onBehalfDonor.firstName === "");

//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?
Expand Down Expand Up @@ -223,7 +236,7 @@ function DonationsForm(): ReactElement {
amount: getFormatedCurrency(
i18n.language,
currency,
paymentSetup.unitCost * quantity,
paymentSetup.unitCost * quantity
),
});
break;
Expand All @@ -233,7 +246,7 @@ function DonationsForm(): ReactElement {
amount: getFormatedCurrency(
i18n.language,
currency,
paymentSetup.unitCost * quantity,
paymentSetup.unitCost * quantity
),
});
break;
Expand Down Expand Up @@ -324,12 +337,7 @@ function DonationsForm(): ReactElement {
<p className="title-text">{t("donate")}</p>
)}
{/* show PlanetCashSelector only if user is signed up and have a planetCash account */}
{projectDetails.purpose !== "funds" &&
projectDetails.purpose !== "planet-cash" &&
!(isGift && giftDetails.recipientName === "") &&
!(onBehalf && onBehalfDonor.firstName === "") &&
isSignedUp &&
profile?.planetCash && <PlanetCashSelector />}
{canPayWithPlanetCash && <PlanetCashSelector />}
{!(onBehalf && onBehalfDonor.firstName === "") &&
(projectDetails.purpose === "trees" ? (
<div className="donations-gift-container mt-10">
Expand Down Expand Up @@ -395,7 +403,7 @@ function DonationsForm(): ReactElement {
currency={currency}
amount={formatAmountForStripe(
paymentSetup?.unitCost * quantity,
currency.toLowerCase(),
currency.toLowerCase()
)}
onPaymentFunction={onPaymentFunction}
paymentSetup={paymentSetup}
Expand All @@ -405,7 +413,7 @@ function DonationsForm(): ReactElement {
query: { ...router.query, step: CONTACT },
},
undefined,
{ shallow: true },
{ shallow: true }
);
setRetainQuantityValue(true);
}}
Expand Down
6 changes: 4 additions & 2 deletions src/Donations/LeftPanel/LeftPanelInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ const LeftPanelInfo = ({
const router = useRouter();

const info = projectDetails || pCashSignupDetails;
const canShowAvatar = donationStep !== null && donationStep > 0;
const canShowAvatar =
pCashSignupDetails !== null || (donationStep !== null && donationStep > 0);
const canShowTransactionSummary =
paymentSetup !== null && (donationStep === 2 || donationStep === 3);
const canShowSummary = donationStep !== null && donationStep > 0;
const canShowSummary =
pCashSignupDetails !== null || (donationStep !== null && donationStep > 0);
const canShowGift =
(donationStep === 1 || donationStep === 2 || donationStep === 3) &&
giftDetails.type !== null &&
Expand Down

1 comment on commit a294f8e

@vercel
Copy link

@vercel vercel bot commented on a294f8e Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.