/** * @todo check filesize ??? 2MB in documentation * @param string|Pay\Payment\Property $filename * @return Pay\IResponse * @throws Utils\FioException */ public function send($filename = NULL) { if ($filename instanceof Pay\Payment\Property) { $this->xmlFile->setData($filename); } if ($this->xmlFile->isReady()) { $this->setUploadExtenstion('xml'); $filename = $this->xmlFile->getPathname(); } elseif (is_file($filename)) { $this->setUploadExtenstion(pathinfo($filename, PATHINFO_EXTENSION)); } else { throw new Utils\FioException('Is supported only filepath or Property object.'); } $post = array('type' => $this->uploadExtension, 'token' => $this->context->getToken(), 'lng' => $this->language); return $this->response = $this->context->getQueue()->upload($this->getUrl(), $post, $filename); }
/** * @param string|Pay\Payment\Property $filename * @return Response\Pay\IResponse * @throws InvalidArgumentException */ public function send($filename = NULL) { if ($filename instanceof Pay\Payment\Property) { $this->xmlFile->setData($filename); } if ($this->xmlFile->isReady()) { $this->setUploadExtenstion('xml'); $filename = $this->xmlFile->getPathname(); } elseif (is_file($filename)) { $this->setUploadExtenstion(pathinfo($filename, PATHINFO_EXTENSION)); } else { throw new InvalidArgumentException('Is supported only filepath or Property object.'); } $token = $this->getAccount()->getToken(); $post = ['type' => $this->uploadExtension, 'token' => $token, 'lng' => $this->language]; return $this->response = $this->queue->upload($this->getUrl(), $token, $post, $filename); }