Class: Plaid::IncomeVerification::Client
- Inherits:
-
Object
- Object
- Plaid::IncomeVerification::Client
- Defined in:
- lib/plaid/income_verification/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationCreateResponse
/income/verification/createbegins the income verification process by returning anincome_verification_id. -
#download_documents(request_options: {}, **params) ⇒ String
/income/verification/documents/downloadprovides the ability to download the source documents associated with the verification. -
#get_paystubs(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationPaystubsGetResponse
/income/verification/paystubs/getreturns the information collected from the paystubs that were used to verify an end user's income. -
#get_taxforms(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationTaxformsGetResponse
/income/verification/taxforms/getreturns the information collected from forms that were used to verify an end user''s income. - #initialize(client:) ⇒ void constructor
-
#precheck(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationPrecheckResponse
/income/verification/precheckis an optional endpoint that can be called before initializing a Link session for income verification.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/plaid/income_verification/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationCreateResponse
/income/verification/create begins the income verification process by returning an income_verification_id.
You can then provide the income_verification_id to /link/token/create under the income_verification
parameter in order to create a Link instance that will prompt the user to go through the income verification
flow. Plaid will fire an INCOME webhook once the user completes the Payroll Income flow, or when the uploaded
documents in the Document Income flow have finished processing.
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 |
# File 'lib/plaid/income_verification/client.rb', line 31 def create(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "income/verification/create", body: Plaid::IncomeVerification::Types::IncomeVerificationCreateRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IncomeVerificationCreateResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#download_documents(request_options: {}, **params) ⇒ String
/income/verification/documents/download provides the ability to download the source documents associated with
the verification.
If Document Income was used, the documents will be those the user provided in Link. For Payroll Income, the most recent files available for download from the payroll provider will be available from this endpoint.
The response to /income/verification/documents/download is a ZIP file in binary data. If a document_id is
passed, a single document will be contained in this file.
If not, the response will contain all documents associated with the verification.
The request_id is returned in the Plaid-Request-ID header.
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 |
# File 'lib/plaid/income_verification/client.rb', line 146 def download_documents(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "income/verification/documents/download", body: Plaid::IncomeVerification::Types::IncomeVerificationDocumentsDownloadRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i return response.body if code.between?(200, 299) error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end |
#get_paystubs(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationPaystubsGetResponse
/income/verification/paystubs/get returns the information collected from the paystubs that were used to verify
an end user's income. It can be called once the status of the verification has been set to
VERIFICATION_STATUS_PROCESSING_COMPLETE, as reported by the INCOME: verification_status webhook. Attempting
to call the endpoint before verification has been completed will result in an error.
This endpoint has been deprecated; new integrations should use /credit/payroll_income/get instead.
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 |
# File 'lib/plaid/income_verification/client.rb', line 86 def get_paystubs(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "income/verification/paystubs/get", body: Plaid::IncomeVerification::Types::IncomeVerificationPaystubsGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IncomeVerificationPaystubsGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#get_taxforms(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationTaxformsGetResponse
/income/verification/taxforms/get returns the information collected from forms that were used to verify an end
user''s income. It can be called once the status of the verification has been set to
VERIFICATION_STATUS_PROCESSING_COMPLETE, as reported by the INCOME: verification_status webhook. Attempting
to call the endpoint before verification has been completed will result in an error.
This endpoint has been deprecated; new integrations should use /credit/payroll_income/get instead.
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 |
# File 'lib/plaid/income_verification/client.rb', line 195 def get_taxforms(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "income/verification/taxforms/get", body: Plaid::IncomeVerification::Types::IncomeVerificationTaxformsGetRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IncomeVerificationTaxformsGetResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |
#precheck(request_options: {}, **params) ⇒ Plaid::Types::IncomeVerificationPrecheckResponse
/income/verification/precheck is an optional endpoint that can be called before initializing a Link session
for income verification. It evaluates whether a given user is supportable by digital income verification and
returns a precheck_id that can be provided to /link/token/create. If the user is eligible for digital
verification, providing the precheck_id in this way will generate a Link UI optimized for the end user and
their specific employer. If the user cannot be confirmed as eligible, the precheck_id can still be provided to
/link/token/create and the user can still use the income verification flow, but they may be required to
manually upload a paystub to verify their income.
While all request fields are optional, providing either employer or transactions_access_tokens data will
increase the chance of receiving a useful result.
This endpoint has been deprecated; new integrations should use /credit/payroll_income/precheck instead.
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 |
# File 'lib/plaid/income_verification/client.rb', line 256 def precheck(request_options: {}, **params) params = Plaid::Internal::Types::Utils.normalize_keys(params) request = Plaid::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "income/verification/precheck", body: Plaid::IncomeVerification::Types::IncomeVerificationPrecheckRequest.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Plaid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) begin (response.body.to_s.empty? ? nil : Plaid::Types::IncomeVerificationPrecheckResponse.load(response.body)) rescue ::JSON::ParserError raise Plaid::Errors::ResponseError.new(response.body, code: code, headers: response.to_hash) end else error_class = Plaid::Errors::ResponseError.subclass_for_code(code) error_types = { 400 => Plaid::Types::PlaidError, 401 => Plaid::Types::PlaidError, 429 => Plaid::Types::PlaidError, 500 => Plaid::Types::PlaidError, (400..499) => Plaid::Types::PlaidError, (500..599) => Plaid::Types::PlaidError } error_body = Plaid::Errors::ResponseError.load_error_body(code, response.body, error_types) raise error_class.new(response.body, code: code, body: error_body, headers: response.to_hash) end end |