/** * Perform a new query that retrieves you the list of Sales Information. * * @return a SaleResponseInformation list object. * @see {@link com.payhub.ws.api.SaleResponseInformation}; */ public function getAllSalesInformation() { $url = $this->getUrl() . Sale::$SALE_ID_LINK; $request = $this->setHeadersGet($url, $this->_oauthToken); $result = $this->doGet($request); //var_dump($result); foreach ($result['_embedded']['sales'] as $sales) { $response_tmp = SaleResponseInformation::fromArray($sales); $response_tmp->setTransactionManager($this); $response[] = $response_tmp; } return $response; }
/** * Perform a new query that retrieves you the list of Sales Information. * * @return a SaleResponseInformation list object. * @see {@link com.payhub.ws.api.SaleResponseInformation}; */ public function getAllSalesInformation() { $url = $this->getUrl() . Sale::$SALE_ID_LINK; $request = $this->setHeadersGet($url, $this->_oauthToken); $result = $this->doGet($request); if (array_key_exists('_embedded', $result)) { foreach ($result['_embedded']['sales'] as $sales) { $response_tmp = SaleResponseInformation::fromArray($sales); $response_tmp->setTransactionManager($this); $response[] = $response_tmp; } return $response; } else { $errors_tmp = new Errors(); foreach ($result as $errorData) { $errors_tmp = Errors::fromArray($errorData); } $errors[] = $errors_tmp; return $errors; } }
/** * @param $json * @param $request */ public function doSale($request) { $json = json_encode($this->object_unset_nulls(null)); curl_setopt($request, CURLOPT_POSTFIELDS, $json); $result = $this->doPost($request, $this->getUrl()); $response = SaleResponseInformation::fromArray($result); return $response; }