diff --git a/lib/Quote.php b/lib/Quote.php index 5962d8dd3..54872b5e8 100644 --- a/lib/Quote.php +++ b/lib/Quote.php @@ -61,24 +61,6 @@ class Quote extends ApiResource const STATUS_DRAFT = 'draft'; const STATUS_OPEN = 'open'; - /** - * @param callable $readBodyChunkCallable - * @param null|array $params - * @param null|array|string $opts - * - * @throws \Stripe\Exception\ApiErrorException if the request fails - */ - public function pdf($readBodyChunkCallable, $params = null, $opts = null) - { - $opts = \Stripe\Util\RequestOptions::parse($opts); - if (null === $opts->apiBase) { - $opts->apiBase = Stripe::$apiUploadBase; - } - - $url = $this->instanceUrl() . '/pdf'; - $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); - } - /** * @param null|array $params * @param null|array|string $opts @@ -167,4 +149,23 @@ public static function allLineItems($id, $params = null, $opts = null) return $obj; } + + /** + * @param callable $readBodyChunkCallable + * @param null|array $params + * @param null|array|string $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return void + */ + public function pdf($readBodyChunkCallable, $params = null, $opts = null) + { + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (!isset($opts->apiBase)) { + $opts->apiBase = Stripe::$apiUploadBase; + } + $url = $this->instanceUrl() . '/pdf'; + $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts); + } } diff --git a/lib/Service/QuoteService.php b/lib/Service/QuoteService.php index 05f0dfb66..fe038a213 100644 --- a/lib/Service/QuoteService.php +++ b/lib/Service/QuoteService.php @@ -125,23 +125,29 @@ public function finalizeQuote($id, $params = null, $opts = null) } /** - * Retrieves the quote with the given ID. + * Download the PDF for a finalized quote. * * @param string $id + * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * - * @return \Stripe\Quote + * @return mixed */ - public function retrieve($id, $params = null, $opts = null) + public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) { - return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); + $opts = \Stripe\Util\RequestOptions::parse($opts); + if (!isset($opts->apiBase)) { + $opts->apiBase = $this->getClient()->getFilesBase(); + } + + return $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); } /** - * A quote models prices and services for a customer. + * Retrieves the quote with the given ID. * * @param string $id * @param null|array $params @@ -151,27 +157,24 @@ public function retrieve($id, $params = null, $opts = null) * * @return \Stripe\Quote */ - public function update($id, $params = null, $opts = null) + public function retrieve($id, $params = null, $opts = null) { - return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); + return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } /** - * Download the PDF for a finalized quote. + * A quote models prices and services for a customer. * * @param string $id - * @param callable $readBodyChunkCallable * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\Quote */ - public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) + public function update($id, $params = null, $opts = null) { - $opts = \Stripe\Util\RequestOptions::parse($opts); - if (!isset($opts->apiBase)) { - $opts->apiBase = $this->getClient()->getFilesBase(); - } - $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); + return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); } }