Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion src/Resources/Items.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,38 @@ public function getIncome(string $access_token): object
$this->paramsWithClientCredentials($params)
);
}
}

/**
* Get an Item's income information.
*
* @param array $params for user and employer
* @return object with precheck_id and confidence
*/
public function getIncomePrecheck(array $params = []): object
{
/*$params = [
"access_token" => $access_token
];*/

return $this->doRequest(
$this->buildRequest("post", "income/verification/precheck", $this->clientCredentials($params))
);
}

/**
* Get an Item's income information.
*
* @param string $access_token
* @return object
*/
public function getIncomePaystubs(string $access_token): object
{
$params = [
"access_token" => $access_token
];

return $this->doRequest(
$this->buildRequest("post", "income/verification/paystubs/get", $this->clientCredentials($params))
);
}
}
21 changes: 19 additions & 2 deletions src/Resources/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class Tokens extends AbstractResource
* @param string|null $payment_id
* @param string|null $institution_id
* @param array|null $auth
* @param string|null $precheck_id
* @param int|null $income_insight_days
* @throws PlaidRequestException
* @return object
*/
Expand All @@ -42,7 +44,9 @@ public function create(
?string $android_package_name = null,
?string $payment_id = null,
?string $institution_id = null,
?array $auth = null): object {
?array $auth = null,
?string $precheck_id = null,
?int $income_insight_days = null): object {

$params = [
"client_name" => $client_name,
Expand Down Expand Up @@ -90,6 +94,19 @@ public function create(
$params["auth"] = $auth;
}

if( $precheck_id ){
$params["income_verification"] = [
"precheck_id" => $precheck_id
];
}

if(in_array("assets", $products) && ($income_insight_days !== null)){
$params["asset_report"] = [
"bank_income_insights_enabled" => $income_insight_days > 0,
"days_requested" => $income_insight_days
];
}

return $this->sendRequest(
"post",
"link/token/create",
Expand All @@ -116,4 +133,4 @@ public function get(string $link_token): object
$this->paramsWithClientCredentials($params)
);
}
}
}