Проблема API Finicity - PullRequest
       2

Проблема API Finicity

1 голос
/ 03 октября 2019

Мы используем API Finicity для получения выписок и транзакций. Мы выполнили следующие шаги, но при получении учетных записей клиентов мы получаем «aggregationStatusCode: 185» [https://api.finicity.com/aggregation/v1/customers/['customer_id']/accounts].

  1. Чтобы получить учетную запись custommer, которую я использую https://api.finicity.com/aggregation/v1/customers/['customer_id']/accounts.
  2. Затем мы выбираем выписки для учетной записи, используя "https://api.finicity.com/aggregation/v1/customers/['customer_id']/accounts/['account_id']/statement?index=1;, это повторяется 6 раз. Нам нужно 6выписка по месяцам для каждой учетной записи.
  3. Затем мы выбираем транзакцию для учетной записи, используя "https://api.finicity.com/aggregation/v1/customers/['customer_id']/accounts/['account_id']/transactions?fromDate=".$from."&toDate=".strtotime(date('Y-m-d'))."&limit=".$transactionLimit."&includePending=true";

. Мы столкнулись с двумя нижеуказанными проблемами. 1. Ошибка тайм-аута при выборе более 2 учетных записей. 2. Получение «aggregationStatusCode: 185» для некоторых реальных счетов.

Ниже приведен код для справки.

function get_statements(){

   $FinicityAppToken=$_POST['FinicityAppToken'];    
   $customerId=$_POST['customerId'];    
   $leadId=$_POST['leadId'];
   $finicityConnectUrl=$_POST['finicityConnectUrl'];

   $NoOFStatements = 6;
   $transactionLimit = 100;
   $transactionsMonth = 1;  

    $url="https://api.finicity.com/aggregation/v1/customers/".$customerId."/accounts"; 
    $response=callAPI('POST', $url,false,$FinicityAppToken);

    $response = json_decode($response); 

    $allstatements=array();
    if($response){
           if(isset($response->accounts)){
              $accounts = array();
              $array = array();

              foreach($response->accounts as $account){

                if ($account->aggregationStatusCode == 0 && $account->aggregationSuccessDate != '' && $account->aggregationAttemptDate != '') {

                        for($i=1;$i<=$NoOFStatements;$i++) {
                             $url="https://api.finicity.com/aggregation/v1/customers/".$customerId."/accounts/".$account->id."/statement?index=".$i;
                             $stateresponse=callAPI('GET', $url,false,$FinicityAppToken);
                             $temp = array();
                             $temp['accountId'] = $account->id;
                             $temp['statement'] = base64_encode($stateresponse);
                             $statements[]=$temp;
                        }

                      $act = array();
                      $month = date('m') - $transactionsMonth;
                      $from = strtotime(date('Y').'-'.$month.'-1');               
                      $url="https://api.finicity.com/aggregation/v1/customers/".$customerId."/accounts/".$account->id."/transactions?fromDate=".$from."&toDate=".strtotime(date('Y-m-d'))."&limit=".$transactionLimit."&includePending=true";

                      $data['url'] = $url;
                      $transactions = json_decode(callAPI('GET', $url,false,$FinicityAppToken));

                      $act['account']['accountNumber'] = $account->number;
                      unset($account->number);

                      $act['account']['currencySymbol'] = $account->currency;
                      unset($account->currency);

                      if(empty((array) $account->detail)) {
                         $account->detail = (object) transactionsDetailsEmpty();
                      }  

                     $act['account'] = json_decode(json_encode($account), true);

                      if(isset($transactions->transactions)) {
                         $act['transactions'] = $transactions->transactions;

                      } else {
                        $act['transactions'] = array();                 
                      }
                    // echo "step"; 
                      $accounts[] = $act;

                } else {

                         $data['success'] = 1;
                         $data['response']=$response ;
                         $data['finicityConnectUrl'] = $finicityConnectUrl;
                         $data['leadId'] = $leadId;
                         $data['FinicityAppToken'] = $FinicityAppToken;
                         $data['customerId'] = $customerId;
                         echo json_encode($data); 
                         die(); 
                }

                $j++;

              }

              $array['accounts'] = $accounts;
              $array['leadId'] = $leadId;

              $data['accounts'] = $array;   

              $url="https://api.finicity.com/aggregation/v1/customers/".$customerId; 
              $response=callAPI('DELETE', $url,false,$FinicityAppToken);      
           }
       }   

}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...