/** * * @return ConnectorResponse */ public function sendInvoiceBasedOnProforma() { $this->_setProperAccountancyMonth(); $requestUrl = sprintf("%s%s.%s", self::API_GET_INVOICE_PROFORMA_ADD_URL, InvoiceAbstract::filterNumber($this->_invoice->{InvoiceProformaResponse::KEY_PELNY_NUMER}), self::DEFAULT_CONNECTION_FILE_TYPE); $this->_initCurrentCurl($requestUrl); $key = Utils::hexToStr($this->_getConfig()->{ConnectorConfig::API_KEY_INVOICE}); $messageHash = Utils::hmac($key, sprintf("%s%s%s", $requestUrl, $this->_getConfig()->{ConnectorConfig::API_LOGIN}, ConnectorConfig::API_KEY_INVOICE_NAME)); $this->_setCurlGetOptions($requestUrl, $this->_getRequestHeaders($messageHash)); return ConnectorResponse::factory(curl_exec($this->_currentCurl)); }
/** * @return ConnectorResponse */ public function send() { $this->_setProperAccountancyMonth(); $content = $this->_invoice->toJson(); $this->_initCurrentCurl(self::API_INVOICE_SEND_URL); $key = Utils::hexToStr($this->_getConfig()->{ConnectorConfig::API_KEY_INVOICE}); $messageHash = Utils::hmac($key, sprintf("%s%s%s%s", self::API_INVOICE_SEND_URL, $this->_getConfig()->{ConnectorConfig::API_LOGIN}, ConnectorConfig::API_KEY_INVOICE_NAME, $content)); $this->_setCurlPostOptions(self::API_INVOICE_SEND_URL, $this->_getRequestHeaders($messageHash), $content); return ConnectorResponse::factory(curl_exec($this->_currentCurl)); }
/** * * @param \ifirma\AccountancyMonthParam $param * @return void */ protected function _setChangeAccountancyMonth(AccountancyMonthParam $param) { $jsonParam = $param->toJson(); $this->_initCurrentCurl(self::API_ACCOUNTANCY_MONTH_URL); $key = Utils::hexToStr($this->_getConfig()->{ConnectorConfig::API_KEY_SUBSCRIBER}); $messageHash = Utils::hmac($key, sprintf("%s%s%s%s", self::API_ACCOUNTANCY_MONTH_URL, $this->_getConfig()->{ConnectorConfig::API_LOGIN}, ConnectorConfig::API_KEY_SUBSCRIBBER_NAME, $jsonParam)); $this->_setCurlPutOptions(self::API_ACCOUNTANCY_MONTH_URL, $this->_getRequestHeaders($messageHash), $jsonParam); $rsp = curl_exec($this->_currentCurl); $response = ConnectorResponse::factory($rsp); $this->_checkResponseAfterAccountancyMonthChange($response); }