config / plaid.php
'baseUrl' => 'https://tartan.plaid.com/',
'client_id' => "xxxxxx",
'secret' => "xxxxxx",
'prefix' => 'plaid',
'webhook' => "http://requestb.in/1dm3d8e1",
'slackChannel' => 'sendboxyy', // change this to whatever works for you.
'stripFakes' => true, // this will remove the 'fake_institution' from being resolved in saving the accounts
'autoupgrade' => true,
供应商\ travoltron \ plaid \ src \ plaid.php
public static function addAuthUser($username, $password, $pin = null, $type)
{
try {
$request = self::client()->post('auth', [
'json' => [
'client_id' => config('plaid.client_id'),
'secret' => config('plaid.secret'),
'username' => $username,
'password' => $password,
'pin' => $pin,
'type' => $type,
'options' => [
'list' => config('plaid.auth.list')
]
]
]);
return json_decode($request->getBody(), true);
} catch (RequestException $e) {
return json_decode($e->getResponse()->getBody()->getContents(), true);
}
}
控制器
public function addPlaidUser(){
$formData = Input::all();
$response = array();
if(!empty($formData)){
Input::replace($this->arrayStripTags(Input::all()));
$validator = Validator::make(
Input::all(),
array(
'username' => 'required',
'password' => 'required',
),
array(
"username.required" => trans("Username field is required."),
"password.required" => trans("Password field is required."),
)
);
if($validator->fails()){
$response = $this->change_error_msg_layout($validator->errors()->getMessages());
}else{
$authUser = Plaid::addAuthUser('mukesh', 'hemant', null, 'chase');
$response["status"] = "success";
$response["message"] = "";
$response["data"] = $authUser;
}
}else {
$response["status"] = "error";
$response["message"] = trans("Invalid request");
$response["data"] = array();
}
return json_encode($response);
}
api响应
{“状态”:“成功”,“消息”:“”,“数据”:{“代码”:1102,“消息”:“秘密或client_id无效”,“解决”:“客户ID不存在或机密与您提供的客户端ID不匹配。“}}