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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | 28x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 37x 36x 72x 3x 3x 3x 28x 28x 72x 72x 36x | import { Box, Grid } from "@mui/material";
import GiveCheckbox from "@shared/GiveCheckbox/GiveCheckbox";
import SectionCardBase from "@shared/SidePanel/components/SectionCard/SectionCardBase";
import GiveText from "@shared/Text/GiveText";
import { Dispatch, ReactElement, SetStateAction, forwardRef } from "react";
import { StatusInfo } from "../../agreements.types";
import moment from "moment";
import { PLATFORM_TIMEZONE } from "@utils/timezones";
import { RenderTextsComponent } from "../../Snapshot/components/BaseCardComponent";
import { useCustomThemeV2 } from "@theme/hooks/useCustomThemeV2";
import TerminationForm from "./TerminationForm";
import { useEnterprisePermissions } from "@components/AcquirerEnterprises/CreateEnterprise/hooks/useEnterprisePermissions";
import { checkPortals } from "@utils/routing";
import RESOURCE_BASE, {
NEW_ACTION_DENY_MESSAGE,
OPERATIONS,
} from "@constants/permissions";
import GiveTooltip from "@shared/Tooltip/GiveTooltip";
import { ArrowPlacement } from "@shared/Tooltip/GiveTooltip.types";
import { useAccessControl } from "features/Permissions/AccessControl";
import GiveLink from "@shared/Link/GiveLink";
import { TMerchantBaseContextData } from "@components/Merchants/MerchantPreview/data.types";
import { styled, useAppTheme } from "@theme/v2/Provider";
import { SELF_ASSESSMENT_ATTESTATION_OF_COMPLIANCE_URL } from "@constants/constants";
interface Props {
setRadioButtons?: Dispatch<
SetStateAction<{
isPciChecked: boolean;
isPreviousTerminationChecked: boolean;
}>
>;
radioState?: {
isPciChecked: boolean;
isPreviousTerminationChecked: boolean;
};
statusInfo?: StatusInfo;
canBeHidden?: boolean;
defaultContext?: TMerchantBaseContextData;
isSidepanel?: boolean;
}
const PCISection = forwardRef<any, Props>(
(
{ setRadioButtons, radioState, statusInfo, defaultContext, isSidepanel },
ref,
) => {
const isUpdateAllowed = useAccessControl({
resource: RESOURCE_BASE.MERCHANT,
operation: OPERATIONS.UPDATE,
});
const {
status,
msaPreviousTerminationProcessorName,
msaPreviousTerminationAt,
msaPreviousTerminationReason,
msaPreviousTermination,
} = statusInfo || {};
const { isMobileView } = useCustomThemeV2();
const { agreement_signing } = useEnterprisePermissions();
const { isEnterprisePortal } = checkPortals();
const hiddenSection = !agreement_signing && isEnterprisePortal;
const { isPciChecked, isPreviousTerminationChecked } = radioState || {};
const isSigned = status === "signed";
const { palette } = useAppTheme();
const payload = [
{
title: "PCI Compliance",
subTitle: (
<GiveText
variant="bodyXS"
color="secondary"
component="span"
sx={{
wordBreak: "break-all",
overflowWrap: "break-all",
}}
>
By checking this checkbox, you confirm that your business adheres to
the Payment Card Industry Data Security Standard (PCI DSS)
requirements and is PCI compliant. If you are unsure, complete the{" "}
<StyledGiveLink
color={palette.primitive?.blue[100]}
sx={{
display: "inline",
fontSize: "12px",
textDecoration: "underline",
}}
link={SELF_ASSESSMENT_ATTESTATION_OF_COMPLIANCE_URL}
openInNewTab
>
Self-Assessment Questionnaire A and Attestation of Compliance{" "}
</StyledGiveLink>{" "}
to ensure your business meets the PCI DSS standards.
</GiveText>
),
isChecked: isPciChecked || isSigned,
isDisabled: isSigned,
isDisabledWithPermission: isEnterprisePortal
? !agreement_signing || !isUpdateAllowed
: !isUpdateAllowed,
isRequired: true,
dataTestId: "checkbox-msa-pci-compliant",
onChange: () => {
setRadioButtons &&
setRadioButtons((prev) => ({
...prev,
isPciChecked: !prev?.isPciChecked,
}));
},
},
{
title: "I have not had any previous terminations",
subTitle:
"I confirm that my previous merchant account(s) have not been terminated and are not currently subject to termination proceedings. I understand that providing false information or failing to disclose a prior account termination can result in the rejection of this application or subsequent termination of any account granted based on this application.",
isChecked: !isPreviousTerminationChecked,
isDisabled: isSigned,
dataTestId: "previousTermination_checkbox",
onChange: () => {
setRadioButtons &&
setRadioButtons((prev) => ({
...prev,
isPreviousTerminationChecked: !prev?.isPreviousTerminationChecked,
}));
},
},
];
const terminationArr = [
{
label: "Name of Previous Processor",
value: msaPreviousTerminationProcessorName,
},
{
label: "Date of Termination",
value: msaPreviousTerminationAt
? moment.unix(msaPreviousTerminationAt as number).tz(PLATFORM_TIMEZONE).format("MM/DD/YYYY")
: "",
},
{
label: "Reason for Termination",
value: msaPreviousTerminationReason,
},
];
const isTerminationShown =
(isSigned && msaPreviousTermination) ||
(!isSigned && !!msaPreviousTerminationProcessorName);
const isTerminationInputs = !isSigned && isPreviousTerminationChecked;
if (hiddenSection) return null;
return (
<SectionCardBase
childrenContainerSx={{ padding: isSidepanel ? "20px" : 0 }}
>
{payload?.map((data) => (
<CustomRadioComponent key={data?.title} {...data} />
))}
{isTerminationShown && (
<Grid container>
<Grid xs={0.7} item />{" "}
<Grid xs={11} item>
{terminationArr?.map(({ label, value }, index, arr) => {
const gridProps = isMobileView
? {
xs: 12,
}
: undefined;
const isNoDivider = arr?.length - 1 === index;
return (
<RenderTextsComponent
key={label}
label={label}
value={value}
itemGridProps={gridProps}
parentGridProps={gridProps}
isDivider={!isNoDivider && isMobileView}
/>
);
})}
</Grid>
</Grid>
)}
{isTerminationInputs && (
<TerminationForm
msaPreviousTerminationProcessorName={
msaPreviousTerminationProcessorName
}
msaPreviousTerminationAt={msaPreviousTerminationAt}
msaPreviousTerminationReason={msaPreviousTerminationReason}
defaultContext={defaultContext}
/>
)}
</SectionCardBase>
);
},
);
PCISection.displayName = "PCISection";
export default PCISection;
const CustomRadioComponent = ({
title,
subTitle,
isChecked,
isDisabled: isCheckDisabled,
isDisabledWithPermission = false,
onChange,
isRequired,
dataTestId,
}: {
title?: string;
subTitle?: string | ReactElement | (() => ReactElement);
isChecked?: boolean;
isDisabled?: boolean;
isDisabledWithPermission?: boolean;
onChange: () => void;
isRequired?: boolean;
dataTestId?: string;
}) => {
const isDisabled = isCheckDisabled || isDisabledWithPermission;
return (
<GiveTooltip
arrowPlacement={ArrowPlacement.TOP_START}
title={NEW_ACTION_DENY_MESSAGE}
color="default"
disableHoverListener={!isDisabledWithPermission}
customTooltipStyles={{ width: "fit-content" }}
>
<Grid my="7px" container>
<Grid xs={0.7} item>
<GiveCheckbox
onChange={onChange}
checked={isChecked}
disabled={isDisabled}
data-testid={dataTestId}
/>
</Grid>
<Grid xs={11} item pt="2px">
<Box>
{title && (
<GiveText
fontSize="14px"
color={isDisabled ? "secondary" : "primary"}
mb="4px"
>
{title}
{isRequired && (
<GiveText color="error" component="span">
*
</GiveText>
)}
</GiveText>
)}
{subTitle && (
<GiveText variant="bodyXS" color="secondary">
{typeof subTitle === "function" ? subTitle?.() : subTitle}
</GiveText>
)}
</Box>
</Grid>
</Grid>
</GiveTooltip>
);
};
const StyledGiveLink = styled(GiveLink)(() => ({
display: "inline",
fontSize: "12px",
lineHeight: "14px",
textDecoration: "underline",
}));
|