All files / src/features/GiveOnboarding/pages/Agreement/Review index.tsx

100% Statements 8/8
100% Branches 4/4
100% Functions 1/1
100% Lines 8/8

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                                      9x 22x 22x 21x               21x 6x         15x                                     9x      
import { IStep } from "@features/GiveOnboarding/types";
import useGetCurrentMerchantId from "@hooks/common/useGetCurrentMerchantId";
import { forwardRef, useRef } from "react";
import AgreementStatusWrapper from "features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/wraper/AgreementStatusWrapper";
import BankDisclosure from "features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/components/BankDisclosure";
import CardTypes from "features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/components/CardTypes";
import RefundPolicy from "features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/components/RefundPolicy";
import MerchantApplicationScheduleFee from "features/Merchants/MerchantSidePanel/AgreementAndSnapshot/Agreement/components/MerchantApplicationScheduleFee";
import { useMerchantDataPreview } from "@components/Merchants/MerchantPreview/hooks/useMerchantDataPreview";
import PCISectionOnboard from "./PCISectionOnboard";
import { PagesContainer } from "../../pages.atoms";
import { FormLoader } from "@features/GiveOnboarding/components/loaders/FormLoader";
import { RefundPolicyHandle } from "@features/Merchants/MerchantSidePanel/ApprovalFlowPanel/types";
 
interface Props {
  data_key: IStep;
  isOnboarding?: boolean;
}
//AGREEMENT USED IN MERCHNAT ONBOARDING
const AgreementReview = forwardRef((props: Props, ref: any) => {
  const { merchantId } = useGetCurrentMerchantId();
  const refundPolicyRef = useRef<RefundPolicyHandle>(null);
  const { data, isMerchantLoading } = useMerchantDataPreview({
    id: merchantId,
    isEnterprise: false,
    refetchOnMount: true,
  });
 
 
  // fee config comes from merchant/id endpoint
  if (isMerchantLoading)
    return (
      <PagesContainer>
        <FormLoader />
      </PagesContainer>
    );
  return (
    <PagesContainer>
      <AgreementStatusWrapper p="0px" defaultContext={{ data, id: merchantId }}>
        {/* The Merchant Agreement prose belongs to the Sign step, not Review.
            Review only surfaces the merchant-specific terms (bank disclosure,
            card types, refund policy, fee schedule); the acquirer's published
            agreement is presented for signing in Agreement/Sign. */}
        <BankDisclosure
          isOnboarding
          processor={data?.merchantInfo?.processor || data?.merchantInfo?.parentDefaultProcessorName}
        />
        <CardTypes />
        <RefundPolicy ref={refundPolicyRef} isOnboarding merchantID={merchantId} />
        <MerchantApplicationScheduleFee isOnboarding />
        <PCISectionOnboard canBeHidden ref={ref} data_key={props.data_key} refundPolicyRef={refundPolicyRef} />
      </AgreementStatusWrapper>
    </PagesContainer>
  );
});
AgreementReview.displayName = "AgreementReview";
 
export default AgreementReview;