public static function fromArray($data) { $batch = new BatchResponseInformation(); foreach ($data as $key => $value) { if (property_exists(get_class($batch), $key)) { if ($key == "transactions_detail") { $myArray = array(); foreach ($value as $keys => $val) { $_tmp = TransactionReportInformation::fromArray($val); $myArray[] = $_tmp; } $batch->{$key} = $myArray; } elseif ($key == "errors") { $batch->{$key} = Errors::fromArray($value); } elseif ($key == "batch_info") { $batch->{$key} = BatchInfo::fromArray($value); } else { $batch->{$key} = $value; } } } return $batch; }
public function findTransactions($parameters) { $url = $this->getUrl() . "report/transactionReport/"; $request = $this->setHeadersPost($url, $this->_oauthToken); $transactionReports = $this->findTransactionReports($request, json_encode($parameters)); foreach ($transactionReports as $transactionReport) { $response_tmp = TransactionReportInformation::fromArray($transactionReport); $respose[] = $response_tmp; } return $respose; }