checkr

package module
v0.0.0-...-b3e15df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2017 License: MIT Imports: 18 Imported by: 0

README

checkr

A package providing interaction with the Checkr API

This package currently implements on the basic functionality needed by Outdoorsy. This include: Candidates, Reports, MVR Screenings and Webhooks. I will try to build this out more in the future, but time constraints are not allowing me to create a fully fledged SDK at this time.

Please feel free to submit issues and PRs. If you wish to submit a PR, please follow the conventions already present in the package.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadSignature = newError("webhook signature validation failed")
)
View Source
var ReportPackages = struct {
	TaskerStandard string
	TaskerPro      string
	DriverStandard string
	DriverPro      string
}{
	TaskerStandard: "tasker_standard",
	TaskerPro:      "tasker_pro",
	DriverStandard: "driver_standard",
	DriverPro:      "driver_pro",
}
View Source
var ReportStatus = struct {
	Pending   string
	Clear     string
	Consider  string
	Suspended string
	Dispute   string
}{
	Pending:   "pending",
	Clear:     "clear",
	Consider:  "consider",
	Suspended: "suspended",
	Dispute:   "dispute",
}
View Source
var ScreeningStatus = struct {
	Pending  string
	Clear    string
	Consider string
}{
	Pending:  "pending",
	Clear:    "clear",
	Consider: "consider",
}
View Source
var WebhookType = struct {
	Report struct {
		Created   string
		Upgraded  string
		Completed string
		Suspended string
		Resumed   string
	}
	Candidate struct {
		PreAdverseAction      string
		PostAdverseAction     string
		Engaged               string
		DriverLicenseRequired string
		IDRequired            string
	}
}{
	Report: struct {
		Created   string
		Upgraded  string
		Completed string
		Suspended string
		Resumed   string
	}{
		Created:   "report.created",
		Upgraded:  "report.upgraded",
		Completed: "report.completed",
		Suspended: "report.suspended",
		Resumed:   "report.resumed",
	},
	Candidate: struct {
		PreAdverseAction      string
		PostAdverseAction     string
		Engaged               string
		DriverLicenseRequired string
		IDRequired            string
	}{
		PreAdverseAction:      "candidate.pre_adverse_action",
		PostAdverseAction:     "candidate.post_adverse_action",
		Engaged:               "candidate.engaged",
		DriverLicenseRequired: "candidate.driver_license_required",
		IDRequired:            "candidate.id_required",
	},
}

Functions

This section is empty.

Types

type Accident

type Accident struct {
	AccidentDate          ShortDate `json:"accident_date"`
	Description           string    `json:"description"`
	City                  string    `json:"city"`
	County                string    `json:"county"`
	State                 string    `json:"state"`
	OrderNumber           string    `json:"order_number"`
	Points                string    `json:"points"`
	VehicleSpeed          string    `json:"vehicle_speed"`
	ReinstatementDate     string    `json:"reinstatement_date"`
	ActionTaken           string    `json:"action_taken"`
	TicketNumber          string    `json:"ticket_number"`
	EnforcingAgency       string    `json:"enforcing_agency"`
	Jurisdiction          string    `json:"jurisdiction"`
	Severity              string    `json:"severity"`
	ViolationNumber       string    `json:"violation_number"`
	LicensePlate          string    `json:"license_plate"`
	FineAmount            string    `json:"fine_amount"`
	StateCode             string    `json:"state_code"`
	AcdCode               string    `json:"acd_code"`
	InjuryAccident        bool      `json:"injury_accident"`
	FatalityAccident      bool      `json:"fatality_accident"`
	FatalityCount         int       `json:"fatality_count"`
	InjuryCount           int       `json:"injury_count"`
	VehiclesInvolvedCount int       `json:"vehicles_involved_count"`
	ReportNumber          string    `json:"report_number"`
	PolicyNumber          string    `json:"policy_number"`
}

type Candidate

type Candidate struct {
	// Generated by Checkr
	ID        string    `json:"id,omitempty"`
	Object    string    `json:"object,omitempty"`
	URI       string    `json:"uri,omitempty"`
	CreatedAt Timestamp `json:"created_at,omitempty"`

	// Sent to create new Candidate
	FirstName                   string    `json:"first_name"`
	MiddleName                  string    `json:"middle_name,omitempty"`
	NoMiddleName                bool      `json:"no_middle_name"`
	LastName                    string    `json:"last_name"`
	Email                       string    `json:"email"`
	Phone                       string    `json:"phone"`
	Zipcode                     string    `json:"zipcode,omitempty"`
	DOB                         ShortDate `json:"dob,omitempty"`
	BirthCountry                string    `json:"birth_country,omitempty"`
	SSN                         string    `json:"ssn,omitempty"`
	DriverLicenseNumber         string    `json:"driver_license_number,omitempty"`
	DriverLicenseState          string    `json:"driver_license_state,omitempty"`
	DriverLicenseProvince       string    `json:"driver_license_province,omitempty"`
	PreviousDriverLicenseNumber string    `json:"previous_driver_license_number,omitempty"`
	PreviousDriverLicenseState  string    `json:"previous_driver_license_state,omitempty"`
	CopyRequested               bool      `json:"copy_requested,omitempty"`
	Adjudication                string    `json:"adjudication,omitempty"`
	CustomID                    string    `json:"custom_id,omitempty"`
	ReportIDs                   []string  `json:"report_ids,omitempty"`
	GeoIDs                      []string  `json:"geo_ids,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(country string) (Client, error)

NewClient initializes a new client for the requested country. This function must be used to create a Client object. Global Key variable must be set before calling this function.

func (Client) CandidateCreate

func (c Client) CandidateCreate(can *Candidate) error

Create creates a new Candidate object in Checkr. Populate the appropriate fields in your candidate object before making the request. Fields generated by Checkr will be populated after the response.

func (Client) CandidateRetrieve

func (c Client) CandidateRetrieve(id string) (*Candidate, error)

Retrieve retrieves a Candidate by ID.

func (Client) CandidatesListAll

func (c Client) CandidatesListAll() ([]*Candidate, error)

func (Client) MVRRetrieve

func (c Client) MVRRetrieve(id string) (*MVRScreening, error)

func (Client) ReportCreate

func (c Client) ReportCreate(candidateID string, pkg string) (*Report, error)

Create creates a new Report object in Checkr. Populate the appropriate fields in your candidate object before making the request. Fields generated by Checkr will be populated after the response.

func (Client) ReportRetrieve

func (c Client) ReportRetrieve(id string) (*Report, error)

func (Client) UploadDocument

func (c Client) UploadDocument(candidateID, documentType, filename, mimeType string, body io.Reader) (*Document, error)

type Document

type Document struct {
	ID          string    `json:"id"`
	Object      string    `json:"object"`
	Type        string    `json:"type"`
	CreatedAt   Timestamp `json:"created_at"`
	DownloadURI string    `json:"download_uri"`
	Filesize    int       `json:"filesize"`
	Filename    string    `json:"filename"`
	ContentType string    `json:"content_type"`
}

type MVRScreening

type MVRScreening struct {
	FullName           string      `json:"full_name"`
	LicenseNumber      string      `json:"license_number"`
	LicenseState       string      `json:"license_state"`
	LicenseStatus      string      `json:"license_status"`
	LicenseType        string      `json:"license_type"`
	LicenseClass       string      `json:"license_class"`
	ExpirationDate     ShortDate   `json:"expiration_date"`
	IssuedDate         ShortDate   `json:"issued_date"`
	FirstIssuedDate    ShortDate   `json:"first_issued_date"`
	InferredIssuedDate ShortDate   `json:"inferred_issued_date"`
	Restrictions       []string    `json:"restrictions"`
	Accidents          []Accident  `json:"accidents"`
	Violations         []Violation `json:"violations"`
	// contains filtered or unexported fields
}

type Report

type Report struct {
	ID                       string    `json:"id"`
	Object                   string    `json:"object"`
	URI                      string    `json:"uri"`
	Status                   string    `json:"status"`
	CreatedAt                Timestamp `json:"created_at"`
	CompletedAt              Timestamp `json:"completed_at"`
	TurnaroundTime           int       `json:"turnaround_time"`
	Package                  string    `json:"package"`
	CandidateID              string    `json:"candidate_id"`
	SSNTraceID               string    `json:"ssn_trace_id"`
	SexOffenderSearchID      string    `json:"sex_offender_search_id"`
	NationalCriminalSearchID string    `json:"national_criminal_search_id"`
	CountyCriminalSearchIds  []string  `json:"county_criminal_search_ids"`
	MotorVehicleReportID     string    `json:"motor_vehicle_report_id"`
	// contains filtered or unexported fields
}
func (r *Report) GetVerificationLinks() (Verification, error)

type ShortDate

type ShortDate struct {
	time.Time
}

ShortDate wraps time.Time and handles custom marshalling in the shortDateFormat format.

func (ShortDate) MarshalJSON

func (b ShortDate) MarshalJSON() ([]byte, error)

func (*ShortDate) UnmarshalJSON

func (b *ShortDate) UnmarshalJSON(data []byte) error

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp wraps time.Time and handles custom marshalling in the timestampFormat format.

func (Timestamp) MarshalJSON

func (b Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (b *Timestamp) UnmarshalJSON(data []byte) error

type Verification

type Verification struct {
	Object string `json:"object"`
	Count  int    `json:"count"`
	Data   []struct {
		CompletedAt      Timestamp `json:"completed_at"`
		CreatedAt        string    `json:"created_at"`
		ID               string    `json:"id"`
		Object           string    `json:"object"`
		URI              string    `json:"uri"`
		VerificationType string    `json:"verification_type"`
		VerificationURL  string    `json:"verification_url"`
	} `json:"data"`
}

type Violation

type Violation struct {
	Type           string `json:"type"`
	IssuedDate     string `json:"issued_date"`
	ConvictionDate string `json:"conviction_date"`
	Description    string `json:"description"`
	Points         int    `json:"points"`
	City           string `json:"city"`
	County         string `json:"county"`
	State          string `json:"state"`
	TicketNumber   string `json:"ticket_number"`
	Disposition    string `json:"disposition"`
	Category       string `json:"category"`
	CourtName      string `json:"court_name"`
	AcdCode        string `json:"acd_code"`
	StateCode      string `json:"state_code"`
	Docket         string `json:"docket"`
}

type Webhook

type Webhook struct {
	ID        string    `json:"id"`
	Object    string    `json:"object"`
	Type      string    `json:"type"`
	CreatedAt Timestamp `json:"created_at"`
	Data      struct {
		Object json.RawMessage `json:"object"`
	} `json:"data"`
}

func NewWebhook

func NewWebhook(r *http.Request) (*Webhook, error)

NewWebhook reads the body of the request and verifies the webhook signature.

func (*Webhook) Candidate

func (w *Webhook) Candidate() *Candidate

func (*Webhook) IsCandidate

func (w *Webhook) IsCandidate() bool

func (*Webhook) IsReport

func (w *Webhook) IsReport() bool

func (*Webhook) Report

func (w *Webhook) Report() *Report

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL