All files / src/features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/components BankDisclosure.tsx

100% Statements 6/6
100% Branches 12/12
100% Functions 2/2
100% Lines 6/6

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                                          51x 51x 51x   51x         51x                 102x                                                                    
import SectionCardBase from "@shared/SidePanel/components/SectionCard/SectionCardBase";
import { Box, Grid } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import GiveDivider from "@shared/GiveDivider/GiveDivider";
import {
  BANK_DETAILS,
  processorMap,
  WORLDPAY_BANK_DETAILS,
} from "features/Merchants/MerchantSidePanel/constants";
import { useAppTheme } from "@theme/v2/Provider";
import { useGetFeatureFlagValues } from "FeatureFlags/useGetFeatureFlagValues";
import { ProcessorValue } from "@features/Merchants/MerchantSidePanel/types";
 
function BankDisclosure({
  isOnboarding,
  processor,
}: {
  isOnboarding?: boolean;
  processor?: ProcessorValue;
}) {
  const { isMobileView } = useCustomThemeV2();
  const { isMerchantProcessorEnabled } = useGetFeatureFlagValues();
  const { palette } = useAppTheme();
  const usedBankDetails =
    processor &&
    processorMap[processor] === processorMap.worldpay &&
    isMerchantProcessorEnabled
      ? WORLDPAY_BANK_DETAILS
      : BANK_DETAILS;
  return (
    <SectionCardBase
      sx={{ mt: "20px" }}
      leftTitle="Bank Disclosure"
      childrenContainerSx={{
        border: isOnboarding ? `1px solid ${palette.border?.primary}` : "",
      }}
    >
      {usedBankDetails.map(({ name, addr1, addr2 }, index) => {
        return (
          <Grid
            mb={!isMobileView ? "12px" : 0}
            spacing="8px"
            container
            key={name}
          >
            <Grid item xs={12} sm={6}>
              <GiveText variant="bodyS" color="secondary">
                {name}
              </GiveText>
            </Grid>
 
            <Grid item xs={12} sm={6}>
              <GiveText variant="bodyS">
                {addr1}
                <br />
                {addr2}
              </GiveText>
            </Grid>
 
            <Box width="100%" px="8px">
              {index < usedBankDetails.length - 1 && isMobileView && (
                <GiveDivider />
              )}
            </Box>
          </Grid>
        );
      })}
    </SectionCardBase>
  );
}
 
export default BankDisclosure;