1.1.6 • Published 22 days ago

crs-screening v1.1.6

Weekly downloads
-
License
ISC
Repository
github
Last release
22 days ago

crs-screening

This system has 3 screening processes.
1 onFico
2
onCriminalReport
3_ onEvictionReport

export class CrsScreening {
   private crs: CrsBase;

   constructor(crs: CrsBase) {
       this.crs = crs;
   }

   // Method for handling FICO-related screening
   public onFico: CrsScreeningProps["onFico"]["function"] = async (
       data: CrsScreeningProps["onFico"]["props"],
   ) => {
       // Validate FICO data using a FICO validator
       const valid = Validators.ValidatorFico.onValidate(data);
       if (valid !== true) {
           return valid; // Return validation error if data is not valid
       }

       // If data is valid, make a request to the FICO endpoint
       const url = "/equifax/credit-report";
       return await this.crs.onRequest<
           CrsScreeningProps["onFico"]["props"],
           CrsScreeningProps["onFico"]["result"]
       >(
           {
               url,
               data,
               method: "post",
           },
           {
               validateToken: true,
           },
       );
   };

   // Method for handling criminal report screening
   public onCriminalReport: CrsScreeningProps["onCriminalReport"]["function"] =
       async (data: CrsScreeningProps["onCriminalReport"]["props"]) => {
           // Validate criminal report data using a validator
           const valid = Validators.ValidatorCriminalReport.onValidate(data);
           if (valid !== true) {
               return valid; // Return validation error if data is not valid
           }

           // If data is valid, make a request to the criminal report endpoint
           const url = "/criminal/new-request";
           return await this.crs.onRequest<
               CrsScreeningProps["onCriminalReport"]["props"],
               CrsScreeningProps["onCriminalReport"]["result"]
           >(
               {
                   url,
                   data,
                   method: "post",
               },
               {
                   validateToken: true,
               },
           );
       };

   // Method for handling eviction report screening
   public onEvictionReport: CrsScreeningProps["onEvictionReport"]["function"] =
       async (data: CrsScreeningProps["onEvictionReport"]["props"]) => {
           // Validate eviction report data using a validator
           const valid = Validators.ValidatorEvictionReport.onValidate(data);
           if (valid !== true) {
               return valid; // Return validation error if data is not valid
           }

           // If data is valid, make a request to the eviction report endpoint
           const url = "/eviction/new-request";
           return await this.crs.onRequest<
               CrsScreeningProps["onEvictionReport"]["props"],
               CrsScreeningProps["onEvictionReport"]["result"]
           >(
               {
                   url,
                   data,
                   method: "post",
               },
               {
                   validateToken: true,
               },
           );
       };
}

This three methods (onFico, onCriminalReport, and onEvictionReport) handles different types of screening processes by validating the input data and making requests to specific endpoints using the onRequest method of the CrsBase class.

1.1.6

22 days ago

1.1.5

22 days ago

1.1.4

23 days ago

1.1.3

23 days ago

1.1.2

24 days ago

1.1.1

25 days ago

1.1.0

25 days ago

1.0.18

30 days ago

1.0.17

2 months ago

1.0.16

2 months ago

1.0.15

2 months ago

1.0.14

2 months ago

1.0.13

2 months ago

1.0.12

2 months ago

1.0.9

2 months ago

1.0.8

2 months ago

1.0.7

2 months ago

1.0.6

2 months ago

1.0.11

2 months ago

1.0.10

2 months ago

1.0.5

6 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago