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 | 145x 469x 361x 154x 145x 12x 12x 145x 145x 30x 30x | import { getValueFromString } from "@utils/index";
import { formatToUTC } from "@utils/date.helpers";
import {
LastUpdatedOn_merchant_agreement,
LastUpdatedOn_provider_agreement,
} from "./constants";
export const getTOSVersionDate = (
msaLastUpdatedAt?: number,
isEnterprise?: boolean,
) => {
if (isEnterprise) return LastUpdatedOn_provider_agreement;
// The acquirer-settings MSA date (msa_last_updated_at, unix seconds) is the
// source of truth for the merchant agreement's "Last updated". Format in UTC
// — a shifted-timezone render shows the previous day (see the LegalDocuments
// publishedDate.ts note). The constant is only the absent-data fallback for
// acquirers that have never set an MSA version.
if (!msaLastUpdatedAt) return LastUpdatedOn_merchant_agreement;
return formatToUTC(msaLastUpdatedAt, "MMMM dd, yyyy") as string;
};
export const formatBillingDescriptor = (value?: string) => {
Iif (!value) return "";
return value.replace(/[^a-zA-Z0-9]/g, "").toUpperCase();
};
export const toCents = (amount: string): number => {
const num = parseFloat(amount.replace(/,/g, ""));
return Math.round(num * 100);
};
export const roundTo2Decimals = (value: string | number) => {
Eif (typeof value === "string") {
return +getValueFromString(value);
}
return +value.toFixed(2);
};
|