All files / src/shared/GiveExportModal/hooks/merchantTable merchant.ts

100% Statements 3/3
64.7% Branches 11/17
100% Functions 1/1
100% Lines 3/3

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 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335                          27x         44x     44x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
import { SHOW_RISK_CATEGORY } from "@features/Merchants/MerchantSidePanel/constants";
import { TColumnNames } from "@shared/GiveExportModal/giveExportTypes";
 
type TSectionNames =
  | "merchantInfo"
  | "riskMonitor"
  | "primaryAccountHolder"
  | "businessOwner"
  | "businessProfile"
  | "salesInfo"
  | "ofacInfo";
// | "riskTriggers";
 
export const getMerchantExportColumns = (
  isEnterprisePortal = false,
  isPending = false,
  isMerchantProcessorEnabled = false,
): TColumnNames<TSectionNames> => {
  const baseAssigneeOptionsArray = isEnterprisePortal
    ? []
    : ["KYB Assignee", "Underwriting Assignee", "Sponsor Assignee"];
  return {
    titles: {
      merchantInfo: "Merchant Info",
      salesInfo: "Sales Info",
      // riskTriggers: "Risk Triggers",
      riskMonitor: "Risk Monitor",
      primaryAccountHolder: "Primary Account Holder",
      businessOwner: "Business Owner",
      businessProfile: "Business Profile",
      ofacInfo: "OFAC Info",
    },
    visible: {
      all: [
        "Merchant Name",
        "Business Tax ID",
        "Creation Date",
        ...baseAssigneeOptionsArray,
        "Merchant Status",
      ],
      underwriting: [
        "Merchant Name",
        "Business Tax ID",
        "Creation Date",
        ...baseAssigneeOptionsArray,
        "Underwriting Score",
      ],
      risk: [
        "Merchant Name",
        ...(isEnterprisePortal ? [] : ["Risk Assignee"]),
        "Last Escalation Date",
        "Risk Level",
      ],
      approved: [
        "Merchant Name",
        "MCC",
        "Business Tax ID",
        "Sponsor Approval Date",
        "Risk Level",
      ],
      pending: ["Merchant Name", "Business Tax ID", "Creation Date"],
      sponsor: [
        "Merchant Name",
        ...baseAssigneeOptionsArray,
        "MCC",
        "Ready Date",
      ],
      kyb: [
        "Merchant Name",
        "Business Tax ID",
        "Creation Date",
        ...baseAssigneeOptionsArray,
        "KYB Score",
      ],
      default: [],
    },
    monthly: [
      "Merchant ID",
      "Legal Name",
      "Merchant Name",
      "MCC",
      "Sponsor Approval Date",
      "Sponsor Status",
      "Merchant Status",
      "First Transaction Date",
      "Closure Date",
      "Gross Sales Volume",
      "# Sales",
      "Avg Sales",
      "Gross Refunds Volume",
      "# Refunds",
      "Gross Pre-Chargeback Refunds Volume",
      "# Pre-Chargeback Refunds",
      "Refunds Amount %",
      "# Refunds %",
      "Gross Chargebacks Volume",
      "# Chargebacks",
      "Chargebacks Amount %",
      "# Chargebacks %",
      "Industry",
    ],
    reserveMonthly: [
      "Report Month",
      "Merchant ID",
      "Merchant Name",
      "Legal Name",
      "Billing Descriptor",
      "MCC",
      "Merchant Status",
      "Reserve Funds (USD)",
      "Available Funds (USD)",
      "Total Funds Held (USD)",
      "In-Transit Payouts (USD)",
      "Settled Payouts (USD)",
    ],
    // Merchant Reconciliation Report columns are fully controlled by the backend.
    // This report uses a dedicated GET endpoint and returns its own fixed column set
    // that is not shared with any other report type and cannot be customized by the user.
    reconciliationMonthly: [],
    newMerchantApproval: [
      "Internal ID",
      "Merchant ID",
      "Merchant Onboarded Date",
      "Merchant Name",
      "MCC",
      "Website URL",
      "Billing Descriptor",
      "Average Ticket Amount",
      "High Ticket Amount",
      "Estimated Annual Revenue",
      "Countries where business is conducted outside the USA",
      "Approval Recommendation",
 
      "Primary Account Holder First Name",
      "Primary Account Holder Last Name",
      "Primary Account Holder Email",
      "Primary Account Holder Contact Phone",
      "Primary Account Holder Date of Birth",
      "Primary Account Holder Country of Residence",
      "Primary Account Holder Country of Citizenship",
 
      "Business Owner First Name",
      "Business Owner Last Name",
      "Business Owner Email",
      "Business Owner Contact Phone",
      "Business Owner Tax ID",
      "Business Owner Date of Birth",
      "Business Owner Street Address",
      "Business Owner City",
      "Business Owner State",
      "Business Owner Country",
      "Business Owner Ownership %",
 
      "Legal Name",
      "Business Tax ID",
      "DBA",
      "Type of Business",
      "Ownership Type",
      "Age of Business",
      "Business Street Address",
      "Business City",
      "Business State",
      "Business Country",
      "Business Zip",
      "Business Contact Phone",
    ],
    ofacBusiness: [
      "Merchant Onboarded Date",
      "Merchant ID",
      "MCC",
      "Merchant Name",
      "Legal Name",
      "DBA",
      "Business Tax ID",
      "Type of Business",
      "Ownership Type",
      "Age of Business",
      "OFAC Check At",
      "OFAC Status",
      "Reviewed By",
      "Reviewer Comments",
    ],
    ofacPersons: [
      "Merchant Onboarded Date",
      "Merchant ID",
      "MCC",
      "Merchant Name",
      "Persons Type",
      "Primary Account Holder First Name",
      "Primary Account Holder Last Name",
      "Primary Account Holder Email",
      "Primary Account Holder Contact Phone",
      "Primary Account Holder Date of Birth",
      "Business Owner First Name",
      "Business Owner Last Name",
      "Business Owner Email",
      "Business Owner Contact Phone",
      "Business Owner Tax ID",
      "Business Owner Date of Birth",
      "Business Owner Street Address",
      "Business Owner City",
      "Business Owner State",
      "Business Owner Zip",
      "Business Owner Country",
      "Business Owner Ownership %",
      "OFAC Check At",
      "OFAC Status",
      "Reviewed By",
      "Reviewer Comments",
    ],
    merchantInfo: [
      "Internal ID",
      "Merchant ID",
      "Merchant Onboarded Date",
      "Merchant Name",
      "Parent Provider Name",
      "Sponsor Status",
      "Business Classification",
      "Merchant Status",
      ...(isMerchantProcessorEnabled ? ["Processor"] : []),
      "MCC",
      "Sponsor Approval Date",
      "Creation Date",
      "Origin",
      ...(isEnterprisePortal
        ? []
        : [
            "KYB Assignee",
            "Underwriting Assignee",
            "Sponsor Assignee",
            "Risk Assignee",
          ]),
      "Website URL",
      "Contact Phone",
      "Billing Descriptor",
      "Average Ticket Amount",
      "High Ticket Amount",
      "Estimated Annual Revenue",
      "Countries where business is conducted outside the USA",
      //"Lifetime Volume", TODO: show again after BE fixes the value
      "Can Transfer Money",
      "Can Process Money",
      "KYB Score",
      "Underwriting Score",
      "Approval Recommendation",
      "Ready Date",
    ],
    salesInfo: [
      "Gross Sales Volume",
      "# Sales",
      "Avg Sales",
      "Gross Refunds Volume",
      "# Refunds",
      "Gross Pre-Chargeback Refunds Volume",
      "# Pre-Chargeback Refunds",
      "Refunds Amount %",
      "# Refunds %",
      "Gross Chargebacks Volume",
      "# Chargebacks",
      "Chargebacks Amount %",
      "# Chargebacks %",
      "Industry",
    ],
    // riskTriggers: [
    //   "Change Type",
    //   "Field Changed",
    //   "Previous Value",
    //   "New Value",
    //   "Modified At",
    //   "Reviewed By",
    //   "Reviewer Comments",
    // ],
    ...(!isPending && {
      riskMonitor: [
        "Risk Level",
        "Risk Points",
        ...(SHOW_RISK_CATEGORY ? ["Risk Category"] : []),
        "Ready Date",
        "Last Escalation Date",
      ],
    }),
    riskMonitor: [
      "Risk Level",
      "Risk Points",
      ...(SHOW_RISK_CATEGORY ? ["Risk Category"] : []),
      "Ready Date",
      "Last Escalation Date",
    ],
    primaryAccountHolder: [
      "Primary Account Holder First Name",
      "Primary Account Holder Last Name",
      "Primary Account Holder Email",
      "Primary Account Holder Contact Phone",
      "Primary Account Holder Date of Birth",
      "Primary Account Holder Country of Residence",
      "Primary Account Holder Country of Citizenship",
    ],
    businessOwner: [
      "Business Owner First Name",
      "Business Owner Last Name",
      "Business Owner Email",
      "Business Owner Contact Phone",
      "Business Owner Tax ID",
      "Business Owner Date of Birth",
      "Business Owner Street Address",
      "Business Owner City",
      "Business Owner State",
      "Business Owner Zip",
      "Business Owner Country",
      "Business Owner Ownership %",
    ],
    businessProfile: [
      "Legal Name",
      "Business Tax ID",
      "DBA",
      "Type of Business",
      "Ownership Type",
      "Age of Business",
      "Business Street Address",
      "Business City",
      "Business State",
      "Business Country",
      "Business Zip",
      "Business Contact Phone",
    ],
    ofacInfo: [
      "Persons Type",
      "OFAC Check At",
      "OFAC Status",
      "Reviewed By",
      "Reviewer Comments",
    ],
  };
};