All files / src/sections/Checkout CreditCardFeesModal.tsx

0% Statements 0/15
0% Branches 0/8
0% Functions 0/6
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157                                                                                                                                                                                                                                                                                                                         
import NiceModal from "@ebay/nice-modal-react";
import GiveBaseModal from "@shared/modals/GiveBaseModal";
import GiveText from "@shared/Text/GiveText";
import useNiceModal from "@common/Modal/ModalFactory/hooks/useNiceModal";
import {
  CheckCircleIcon,
  CreditCardIcon,
  LockIcon,
  StorefrontIcon,
} from "@phosphor-icons/react";
import { Box } from "@mui/material";
import { styled, useAppTheme } from "@theme/v2/Provider";
import { Stack } from "@mui/system";
import GivePayment from "@assets/icons/GivePayment";
import SslPciIcon from "@assets/icons/SslPciIcon";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import GiveDivider from "@shared/GiveDivider/GiveDivider";
 
const feeItems = [
  {
    Icon: CheckCircleIcon,
    color: "success",
    title: "No Platform Fee:",
    description:
      " GivePayments charges $0.00 (yes, that is zero) platform fee. The only platform that doesn't charge an additional platform fee on top of the credit card fee.",
  },
  {
    Icon: CreditCardIcon,
    color: "default",
    title: "Credit and Debit Card Fees:",
    description:
      "Credit card processing fee is 2.9% the amount plus 29 cents per transaction. Debit card processing fee is 1.5% the amount plus 29 cents per transaction. American Express processing fee is 1.0% the amount plus 35 cents per transaction.",
  },
  {
    Icon: StorefrontIcon,
    color: "default",
    title: "Organisation Fee:",
    description:
      "The Organization can add an optional fee to cover their processing expenses. The fee is 0.0% on credit cards, 1.0% on debit cards, and 1.0% on American Express credit card.",
  },
];
 
//TODO: to be integrated when new checkout page is ready
const CreditCardFeesModal = NiceModal.create(() => {
  const { open, onClose } = useNiceModal();
  const { palette } = useAppTheme();
  const { isMobileView } = useCustomThemeV2();
 
  return (
    <GiveBaseModal
      open={open}
      title="Credit Card and Platform Fees"
      width="600px"
      height={isMobileView ? "fit-content" : "450px"}
      onClose={onClose}
      showFooter={false}
      sx={{
        "& .MuiDialogContent-root": {
          paddingX: "24px !important",
          paddingBottom: "24px !important",
        },
      }}
    >
      <FeesContainer>
        {feeItems.map(({ Icon, color, title, description }, index) => (
          <FeesItem key={index}>
            <IconFrame color={color}>
              <Icon
                size={16}
                color={
                  color === "success"
                    ? palette.primitive?.success?.[50]
                    : palette.icon?.["icon-primary"]
                }
              />
            </IconFrame>
            <Box>
              <GiveText
                variant="bodyS"
                fontWeight={573}
                color="primary"
                component="span"
              >
                {title}{" "}
              </GiveText>
              <GiveText variant="bodyS" color="secondary" component="span">
                {description}
              </GiveText>
            </Box>
          </FeesItem>
        ))}
      </FeesContainer>
      <GiveDivider />
      <FooterContainer>
        <GivePayment />
        <Stack
          gap={"12px"}
          alignItems={isMobileView ? "start" : "end"}
          direction="column"
        >
          <Box sx={{ display: "flex", alignItems: "center", gap: "8px" }}>
            <LockIcon size={20} />
            <GiveText variant="bodyS" color="secondary">
              Transaction Secured and Encrypted
            </GiveText>
          </Box>
          <SslPciIcon />
        </Stack>
      </FooterContainer>
    </GiveBaseModal>
  );
});
 
export default CreditCardFeesModal;
 
const FeesContainer = styled(Box)(() => ({
  display: "flex",
  flexDirection: "column",
  flexWrap: "nowrap",
  alignItems: "center",
  alignContent: "center",
  gap: "24px",
}));
 
const FeesItem = styled(Box)(() => ({
  display: "flex",
  alignItems: "start",
  gap: "16px",
}));
 
const IconFrame = styled(Box)<{ color?: string }>(({ color, theme }) => ({
  backgroundColor:
    color === "success"
      ? theme.palette.primitive?.success[25]
      : theme.palette.primitive?.transparent?.["darken-5"],
  borderRadius: "50%",
  height: "36px",
  width: "36px",
  minWidth: "36px",
  minHeight: "36px",
  display: "flex",
  justifyContent: "center",
  alignItems: "center",
  boxSizing: "border-box",
}));
 
const FooterContainer = styled(Box)(({ theme }) => ({
  display: "flex",
  flexDirection: "row",
  justifyContent: "space-between",
  [theme.breakpoints.down("sm")]: {
    flexDirection: "column",
    gap: "24px",
    alignItems: "start",
  },
}));