All files / src/pages/MerchantCheckout/CheckoutComplete CheckoutComplete.tsx

88.88% Statements 8/9
0% Branches 0/2
75% Functions 3/4
85.71% Lines 6/7

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                1x 1x 1x     1x                                                 1x             1x                
import { styled } from "@theme/v2/Provider";
import { Stack } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import { Icon as StatusIcon } from "@shared/Popup/GivePopupIcons";
import React from "react";
import GiveButton from "@shared/Button/GiveButton";
import useGetCheckoutInfo from "@pages/MerchantCheckout/hooks/useGetCheckoutInfo";
 
const CheckoutComplete = () => {
  const { redirectUrl = "", orderId: orderNumber = "" } = useGetCheckoutInfo();
  const handleRedirect = () => {
    window.location.replace(redirectUrl);
  };
  return (
    <StyledRoot>
      <StyledInfoContainer>
        <StatusIcon type="success-regular" />
        <GiveText variant="h3" pt={0.5}>
          Payment Successful
        </GiveText>
        <GiveText variant="bodyS" pt={0.5}>
          Order Number: {orderNumber}
        </GiveText>
        <GiveText variant="bodyS">
          Your order has been received and currently is being processed. You
          will receive a confirmation email shortly.
        </GiveText>
      </StyledInfoContainer>
 
      <GiveButton
        size="large"
        label="Back on the merchant website"
        onClick={handleRedirect}
      />
    </StyledRoot>
  );
};
 
const StyledRoot = styled(Stack)(({ theme }) => ({
  width: "100%",
  flexDirection: "column",
  alignItems: "center",
  gap: theme.spacing(5),
}));
 
const StyledInfoContainer = styled(Stack)(({ theme }) => ({
  flexDirection: "column",
  alignItems: "center",
  textAlign: "center",
  gap: theme.spacing(2),
}));
 
export default CheckoutComplete;