• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / #7371

31 Aug 2023 11:57PM UTC coverage: 66.703% (+0.2%) from 66.496%
#7371

push

php-coveralls

web-flow
Merge pull request #1559 from stripe/latest-codegen-beta

Update generated code for beta

10 of 10 new or added lines in 3 files covered. (100.0%)

1823 of 2733 relevant lines covered (66.7%)

3.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.0
/lib/Service/QuoteService.php
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);
1✔
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\LineItem>
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\LineItem>
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);
1✔
75
    }
76

77
    /**
78
     * Retrieves a paginated list of lines for a quote. These lines describe changes
79
     * that will be used to create new subscription schedules or update existing
80
     * subscription schedules when the quote is accepted.
81
     *
82
     * @param string $id
83
     * @param null|array $params
84
     * @param null|array|\Stripe\Util\RequestOptions $opts
85
     *
86
     * @throws \Stripe\Exception\ApiErrorException if the request fails
87
     *
88
     * @return \Stripe\Collection<\Stripe\QuoteLine>
89
     */
90
    public function allLines($id, $params = null, $opts = null)
91
    {
92
        return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/lines', $id), $params, $opts);
×
93
    }
94

95
    /**
96
     * Preview the invoice line items that would be generated by accepting the quote.
97
     *
98
     * @param string $parentId
99
     * @param string $id
100
     * @param null|array $params
101
     * @param null|array|\Stripe\Util\RequestOptions $opts
102
     *
103
     * @throws \Stripe\Exception\ApiErrorException if the request fails
104
     *
105
     * @return \Stripe\Collection<\Stripe\InvoiceLineItem>
106
     */
107
    public function allPreviewInvoiceLines($parentId, $id, $params = null, $opts = null)
108
    {
109
        return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices/%s/lines', $parentId, $id), $params, $opts);
×
110
    }
111

112
    /**
113
     * Preview the invoices that would be generated by accepting the quote.
114
     *
115
     * @param string $parentId
116
     * @param null|array $params
117
     * @param null|array|\Stripe\Util\RequestOptions $opts
118
     *
119
     * @throws \Stripe\Exception\ApiErrorException if the request fails
120
     *
121
     * @return \Stripe\Collection<\Stripe\QuotePreviewInvoice>
122
     */
123
    public function allPreviewInvoices($parentId, $params = null, $opts = null)
124
    {
125
        return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_invoices', $parentId), $params, $opts);
×
126
    }
127

128
    /**
129
     * Preview the schedules that would be generated by accepting the quote.
130
     *
131
     * @param string $parentId
132
     * @param null|array $params
133
     * @param null|array|\Stripe\Util\RequestOptions $opts
134
     *
135
     * @throws \Stripe\Exception\ApiErrorException if the request fails
136
     *
137
     * @return \Stripe\Collection<\Stripe\QuotePreviewSchedule>
138
     */
139
    public function allPreviewSubscriptionSchedules($parentId, $params = null, $opts = null)
140
    {
141
        return $this->requestCollection('get', $this->buildPath('/v1/quotes/%s/preview_subscription_schedules', $parentId), $params, $opts);
×
142
    }
143

144
    /**
145
     * Cancels the quote.
146
     *
147
     * @param string $id
148
     * @param null|array $params
149
     * @param null|array|\Stripe\Util\RequestOptions $opts
150
     *
151
     * @throws \Stripe\Exception\ApiErrorException if the request fails
152
     *
153
     * @return \Stripe\Quote
154
     */
155
    public function cancel($id, $params = null, $opts = null)
156
    {
157
        return $this->request('post', $this->buildPath('/v1/quotes/%s/cancel', $id), $params, $opts);
2✔
158
    }
159

160
    /**
161
     * A quote models prices and services for a customer. Default options for
162
     * <code>header</code>, <code>description</code>, <code>footer</code>, and
163
     * <code>expires_at</code> can be set in the dashboard via the <a
164
     * href="https://dashboard.stripe.com/settings/billing/quote">quote template</a>.
165
     *
166
     * @param null|array $params
167
     * @param null|array|\Stripe\Util\RequestOptions $opts
168
     *
169
     * @throws \Stripe\Exception\ApiErrorException if the request fails
170
     *
171
     * @return \Stripe\Quote
172
     */
173
    public function create($params = null, $opts = null)
174
    {
175
        return $this->request('post', '/v1/quotes', $params, $opts);
1✔
176
    }
177

178
    /**
179
     * Converts a stale quote to draft.
180
     *
181
     * @param string $id
182
     * @param null|array $params
183
     * @param null|array|\Stripe\Util\RequestOptions $opts
184
     *
185
     * @throws \Stripe\Exception\ApiErrorException if the request fails
186
     *
187
     * @return \Stripe\Quote
188
     */
189
    public function draftQuote($id, $params = null, $opts = null)
190
    {
191
        return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_draft', $id), $params, $opts);
×
192
    }
193

194
    /**
195
     * Finalizes the quote.
196
     *
197
     * @param string $id
198
     * @param null|array $params
199
     * @param null|array|\Stripe\Util\RequestOptions $opts
200
     *
201
     * @throws \Stripe\Exception\ApiErrorException if the request fails
202
     *
203
     * @return \Stripe\Quote
204
     */
205
    public function finalizeQuote($id, $params = null, $opts = null)
206
    {
207
        return $this->request('post', $this->buildPath('/v1/quotes/%s/finalize', $id), $params, $opts);
1✔
208
    }
209

210
    /**
211
     * Converts a draft or open quote to stale.
212
     *
213
     * @param string $id
214
     * @param null|array $params
215
     * @param null|array|\Stripe\Util\RequestOptions $opts
216
     *
217
     * @throws \Stripe\Exception\ApiErrorException if the request fails
218
     *
219
     * @return \Stripe\Quote
220
     */
221
    public function markStaleQuote($id, $params = null, $opts = null)
222
    {
223
        return $this->request('post', $this->buildPath('/v1/quotes/%s/mark_stale', $id), $params, $opts);
×
224
    }
225

226
    /**
227
     * Download the PDF for a finalized quote.
228
     *
229
     * @param string $id
230
     * @param callable $readBodyChunkCallable
231
     * @param null|array $params
232
     * @param null|array|\Stripe\Util\RequestOptions $opts
233
     *
234
     * @throws \Stripe\Exception\ApiErrorException if the request fails
235
     *
236
     * @return mixed
237
     */
238
    public function pdf($id, $readBodyChunkCallable, $params = null, $opts = null)
239
    {
240
        $opts = \Stripe\Util\RequestOptions::parse($opts);
1✔
241
        if (!isset($opts->apiBase)) {
1✔
242
            $opts->apiBase = $this->getClient()->getFilesBase();
1✔
243
        }
244

245
        return $this->requestStream('get', $this->buildPath('/v1/quotes/%s/pdf', $id), $readBodyChunkCallable, $params, $opts);
1✔
246
    }
247

248
    /**
249
     * Recompute the upcoming invoice estimate for the quote.
250
     *
251
     * @param string $id
252
     * @param null|array $params
253
     * @param null|array|\Stripe\Util\RequestOptions $opts
254
     *
255
     * @throws \Stripe\Exception\ApiErrorException if the request fails
256
     *
257
     * @return \Stripe\Quote
258
     */
259
    public function reestimate($id, $params = null, $opts = null)
260
    {
261
        return $this->request('post', $this->buildPath('/v1/quotes/%s/reestimate', $id), $params, $opts);
×
262
    }
263

264
    /**
265
     * Retrieves the quote with the given ID.
266
     *
267
     * @param string $id
268
     * @param null|array $params
269
     * @param null|array|\Stripe\Util\RequestOptions $opts
270
     *
271
     * @throws \Stripe\Exception\ApiErrorException if the request fails
272
     *
273
     * @return \Stripe\Quote
274
     */
275
    public function retrieve($id, $params = null, $opts = null)
276
    {
277
        return $this->request('get', $this->buildPath('/v1/quotes/%s', $id), $params, $opts);
1✔
278
    }
279

280
    /**
281
     * A quote models prices and services for a customer.
282
     *
283
     * @param string $id
284
     * @param null|array $params
285
     * @param null|array|\Stripe\Util\RequestOptions $opts
286
     *
287
     * @throws \Stripe\Exception\ApiErrorException if the request fails
288
     *
289
     * @return \Stripe\Quote
290
     */
291
    public function update($id, $params = null, $opts = null)
292
    {
293
        return $this->request('post', $this->buildPath('/v1/quotes/%s', $id), $params, $opts);
1✔
294
    }
295
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc