/** * Get PagSeguro payments * * @param null $page * @return \PagSeguro\Parsers\Transaction\Search\Date\Response|string * @throws \Exception */ private function getPagSeguroAbandoned($page = null) { //check if has a page, if doesn't have one then start at the first. if (is_null($page)) { $page = 1; } try { //check if is the first step, if is just add the response object to local var if (is_null($this->_PagSeguroPaymentList)) { $this->_PagSeguroPaymentList = $this->requestPagSeguroAbandoned($page); } else { $response = $this->requestPagSeguroAbandoned($page); //update some important data $this->_PagSeguroPaymentList->setDate($response->getDate()); $this->_PagSeguroPaymentList->setCurrentPage($response->getCurrentPage()); $this->_PagSeguroPaymentList->setResultsInThisPage($response->getResultsInThisPage() + $this->_PagSeguroPaymentList->getResultsInThisPage()); //add new transactions $this->_PagSeguroPaymentList->addTransactions($response->getTransactions()); } //check if was more pages if ($this->_PagSeguroPaymentList->getTotalPages() > $page) { $this->getPagSeguroPayments(++$page); } } catch (\Exception $exception) { throw $exception; } return $this->_PagSeguroPaymentList; }
/** * Get all transactions and orders and return formatted data * * @return array * @throws \Exception */ public function request() { $this->getTransactions(); if (!is_null($this->_PagSeguroPaymentList->getTransactions())) { foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) { if (!$this->addPayment($this->decryptOrderById($payment), $payment)) { continue; } } } return $this->_arrayPayments; }