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

stripe / stripe-php / 6471862601

10 Oct 2023 04:02PM UTC coverage: 69.665% (-0.5%) from 70.141%
6471862601

push

github

web-flow
Merge pull request #1570 from localheinz/feature/coveralls

Enhancement: Use `coverallsapp/github-action` to report code coverage

2393 of 3435 relevant lines covered (69.67%)

3.5 hits per line

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

81.82
/lib/Quote.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe;
6

7
/**
8
 * A Quote is a way to model prices that you'd like to provide to a customer.
9
 * Once accepted, it will automatically create an invoice, subscription or subscription schedule.
10
 *
11
 * @property string $id Unique identifier for the object.
12
 * @property string $object String representing the object's type. Objects of the same type share the same value.
13
 * @property int $amount_subtotal Total before any discounts or taxes are applied.
14
 * @property int $amount_total Total after discounts and taxes are applied.
15
 * @property null|string|\Stripe\StripeObject $application ID of the Connect Application that created the quote.
16
 * @property null|int $application_fee_amount The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote.
17
 * @property null|float $application_fee_percent A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. Only applicable if there are line items with recurring prices on the quote.
18
 * @property \Stripe\StripeObject $automatic_tax
19
 * @property string $collection_method Either <code>charge_automatically</code>, or <code>send_invoice</code>. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as <code>active</code>. Defaults to <code>charge_automatically</code>.
20
 * @property \Stripe\StripeObject $computed
21
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
22
 * @property null|string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
23
 * @property null|string|\Stripe\Customer $customer The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed.
24
 * @property null|(string|\Stripe\TaxRate)[] $default_tax_rates The tax rates applied to this quote.
25
 * @property null|string $description A description that will be displayed on the quote PDF.
26
 * @property (string|\Stripe\Discount)[] $discounts The discounts applied to this quote.
27
 * @property int $expires_at The date on which the quote will be canceled if in <code>open</code> or <code>draft</code> status. Measured in seconds since the Unix epoch.
28
 * @property null|string $footer A footer that will be displayed on the quote PDF.
29
 * @property null|\Stripe\StripeObject $from_quote Details of the quote that was cloned. See the <a href="https://stripe.com/docs/quotes/clone">cloning documentation</a> for more details.
30
 * @property null|string $header A header that will be displayed on the quote PDF.
31
 * @property null|string|\Stripe\Invoice $invoice The invoice that was created from this quote.
32
 * @property null|\Stripe\StripeObject $invoice_settings All invoices will be billed using the specified settings.
33
 * @property null|\Stripe\Collection<\Stripe\LineItem> $line_items A list of items the customer is being quoted for.
34
 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
35
 * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
36
 * @property null|string $number A unique number that identifies this particular quote. This number is assigned once the quote is <a href="https://stripe.com/docs/quotes/overview#finalize">finalized</a>.
37
 * @property null|string|\Stripe\Account $on_behalf_of The account on behalf of which to charge. See the <a href="https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts">Connect documentation</a> for details.
38
 * @property string $status The status of the quote.
39
 * @property \Stripe\StripeObject $status_transitions
40
 * @property null|string|\Stripe\Subscription $subscription The subscription that was created or updated from this quote.
41
 * @property \Stripe\StripeObject $subscription_data
42
 * @property null|string|\Stripe\SubscriptionSchedule $subscription_schedule The subscription schedule that was created or updated from this quote.
43
 * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this quote belongs to.
44
 * @property \Stripe\StripeObject $total_details
45
 * @property null|\Stripe\StripeObject $transfer_data The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices.
46
 */
47
class Quote extends ApiResource
48
{
49
    const OBJECT_NAME = 'quote';
50

51
    use ApiOperations\All;
52
    use ApiOperations\Create;
53
    use ApiOperations\Retrieve;
54
    use ApiOperations\Update;
55

56
    const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically';
57
    const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice';
58

59
    const STATUS_ACCEPTED = 'accepted';
60
    const STATUS_CANCELED = 'canceled';
61
    const STATUS_DRAFT = 'draft';
62
    const STATUS_OPEN = 'open';
63

64
    /**
65
     * @param null|array $params
66
     * @param null|array|string $opts
67
     *
68
     * @throws \Stripe\Exception\ApiErrorException if the request fails
69
     *
70
     * @return \Stripe\Quote the accepted quote
71
     */
72
    public function accept($params = null, $opts = null)
1✔
73
    {
74
        $url = $this->instanceUrl() . '/accept';
1✔
75
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
76
        $this->refreshFrom($response, $opts);
1✔
77

78
        return $this;
1✔
79
    }
80

81
    /**
82
     * @param null|array $params
83
     * @param null|array|string $opts
84
     *
85
     * @throws \Stripe\Exception\ApiErrorException if the request fails
86
     *
87
     * @return \Stripe\Quote the canceled quote
88
     */
89
    public function cancel($params = null, $opts = null)
1✔
90
    {
91
        $url = $this->instanceUrl() . '/cancel';
1✔
92
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
93
        $this->refreshFrom($response, $opts);
1✔
94

95
        return $this;
1✔
96
    }
97

98
    /**
99
     * @param null|array $params
100
     * @param null|array|string $opts
101
     *
102
     * @throws \Stripe\Exception\ApiErrorException if the request fails
103
     *
104
     * @return \Stripe\Quote the finalized quote
105
     */
106
    public function finalizeQuote($params = null, $opts = null)
1✔
107
    {
108
        $url = $this->instanceUrl() . '/finalize';
1✔
109
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
110
        $this->refreshFrom($response, $opts);
1✔
111

112
        return $this;
1✔
113
    }
114

115
    /**
116
     * @param string $id
117
     * @param null|array $params
118
     * @param null|array|string $opts
119
     *
120
     * @throws \Stripe\Exception\ApiErrorException if the request fails
121
     *
122
     * @return \Stripe\Collection<\Stripe\LineItem> list of line items
123
     */
124
    public static function allComputedUpfrontLineItems($id, $params = null, $opts = null)
×
125
    {
126
        $url = static::resourceUrl($id) . '/computed_upfront_line_items';
×
127
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
128
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
129
        $obj->setLastResponse($response);
×
130

131
        return $obj;
×
132
    }
133

134
    /**
135
     * @param string $id
136
     * @param null|array $params
137
     * @param null|array|string $opts
138
     *
139
     * @throws \Stripe\Exception\ApiErrorException if the request fails
140
     *
141
     * @return \Stripe\Collection<\Stripe\LineItem> list of line items
142
     */
143
    public static function allLineItems($id, $params = null, $opts = null)
1✔
144
    {
145
        $url = static::resourceUrl($id) . '/line_items';
1✔
146
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
1✔
147
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
1✔
148
        $obj->setLastResponse($response);
1✔
149

150
        return $obj;
1✔
151
    }
152

153
    /**
154
     * @param callable $readBodyChunkCallable
155
     * @param null|array $params
156
     * @param null|array|string $opts
157
     *
158
     * @throws \Stripe\Exception\ApiErrorException if the request fails
159
     *
160
     * @return void
161
     */
162
    public function pdf($readBodyChunkCallable, $params = null, $opts = null)
1✔
163
    {
164
        $opts = \Stripe\Util\RequestOptions::parse($opts);
1✔
165
        if (!isset($opts->apiBase)) {
1✔
166
            $opts->apiBase = \Stripe\Stripe::$apiUploadBase;
1✔
167
        }
168
        $url = $this->instanceUrl() . '/pdf';
1✔
169
        $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts);
1✔
170
    }
171
}
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