| 1 |
<?php |
| 2 |
|
| 3 |
// File generated from our OpenAPI spec |
| 4 |
|
| 5 |
namespace Stripe\Service; |
| 6 |
|
| 7 |
class QuoteService extends \Stripe\Service\AbstractService |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Accepts the specified quote. |
| 11 |
* |
| 12 |
* @param string $id |
| 13 |
* @param null|array $params |
| 14 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 15 |
* |
| 16 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 17 |
* |
| 18 |
* @return \Stripe\Quote |
| 19 |
*/ |
| 20 |
public function accept($id, $params = null, $opts = null) |
| 21 |
{ |
| 22 |
return $this->request('post', $this->buildPath('/v1/quotes/%s/accept', $id), $params, $opts); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Returns a list of your quotes. |
| 27 |
* |
| 28 |
* @param null|array $params |
| 29 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 30 |
* |
| 31 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 32 |
* |
| 33 |
* @return \Stripe\Collection<\Stripe\Quote> |
| 34 |
*/ |
| 35 |
public function all($params = null, $opts = null) |
| 36 |
{ |
| 37 |
return $this->requestCollection('get', '/v1/quotes', $params, $opts); |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* When retrieving a quote, there is an includable <a |
| 42 |
* href="https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items"><strong>computed.upfront.line_items</strong></a> |
| 43 |
* property containing the first handful of those items. There is also a URL where |
| 44 |
* you can retrieve the full (paginated) list of upfront line items. |
| 45 |
* |
| 46 |
* @param string $id |
| 47 |
* @param null|array $params |
| 48 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 49 |
* |
| 50 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 51 |
* |
| 52 |
* @return \Stripe\Collection<\Stripe\Quote> |
| 53 |
*/ |
| 54 |
public function allComputedUpfrontLineItems($id, $params = null, $opts = null) |
| 55 |
{ |
| 56 |
return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/computed_upfront_line_items', $id), $params, $opts); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* When retrieving a quote, there is an includable <strong>line_items</strong> |
| 61 |
* property containing the first handful of those items. There is also a URL where |
| 62 |
* you can retrieve the full (paginated) list of line items. |
| 63 |
* |
| 64 |
* @param string $id |
| 65 |
* @param null|array $params |
| 66 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 67 |
* |
| 68 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 69 |
* |
| 70 |
* @return \Stripe\Collection<\Stripe\Quote> |
| 71 |
*/ |
| 72 |
public function allLineItems($id, $params = null, $opts = null) |
| 73 |
{ |
| 74 |
return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/line_items', $id), $params, $opts); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Cancels the quote. |
| 79 |
* |
| 80 |
* @param string $id |
| 81 |
* @param null|array $params |
| 82 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 83 |
* |
| 84 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 85 |
* |
| 86 |
* @return \Stripe\Quote |
| 87 |
*/ |
| 88 |
public function cancel($id, $params = null, $opts = null) |
| 89 |
{ |
| 90 |
return $this->request('post', $this->buildPath('/v1/quotes/%s/cancel', $id), $params, $opts); |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* A quote models prices and services for a customer. Default options for |
| 95 |
* <code>header</code>, <code>description</code>, <code>footer</code>, and |
| 96 |
* <code>expires_at</code> can be set in the dashboard via the <a |
| 97 |
* href="https://dashboard.stripe.com/settings/billing/quote">quote template</a>. |
| 98 |
* |
| 99 |
* @param null|array $params |
| 100 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 101 |
* |
| 102 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 103 |
* |
| 104 |
* @return \Stripe\Quote |
| 105 |
*/ |
| 106 |
public function create($params = null, $opts = null) |
| 107 |
{ |
| 108 |
return $this->request('post', '/v1/quotes', $params, $opts); |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Finalizes the quote. |
| 113 |
* |
| 114 |
* @param string $id |
| 115 |
* @param null|array $params |
| 116 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 117 |
* |
| 118 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 119 |
* |
| 120 |
* @return \Stripe\Quote |
| 121 |
*/ |
| 122 |
public function finalizeQuote($id, $params = null, $opts = null) |
| 123 |
{ |
| 124 |
return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts); |
| 125 |
} |
| 126 |
|
| 127 |
/** |
| 128 |
* Retrieves the quote with the given ID. |
| 129 |
* |
| 130 |
* @param string $id |
| 131 |
* @param null|array $params |
| 132 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 133 |
* |
| 134 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 135 |
* |
| 136 |
* @return \Stripe\Quote |
| 137 |
*/ |
| 138 |
public function retrieve($id, $params = null, $opts = null) |
| 139 |
{ |
| 140 |
return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* A quote models prices and services for a customer. |
| 145 |
* |
| 146 |
* @param string $id |
| 147 |
* @param null|array $params |
| 148 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 149 |
* |
| 150 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 151 |
* |
| 152 |
* @return \Stripe\Quote |
| 153 |
*/ |
| 154 |
public function update($id, $params = null, $opts = null) |
| 155 |
{ |
| 156 |
return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts); |
| 157 |
} |
| 158 |
|
| 159 |
/** |
| 160 |
* Download the PDF for a finalized quote. |
| 161 |
* |
| 162 |
* @param string $id |
| 163 |
* @param callable $readBodyChunkCallable |
| 164 |
* @param null|array $params |
| 165 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 166 |
* |
| 167 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 168 |
*/ |
| 169 |
public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null) |
| 170 |
{ |
| 171 |
$opts = \Stripe\Util\RequestOptions::parse($opts); |
| 172 |
if (!isset($opts->apiBase)) { |
| 173 |
$opts->apiBase = $this->getClient()->getFilesBase(); |
| 174 |
} |
| 175 |
$this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts); |
| 176 |
} |
| 177 |
} |
| 178 |
|