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

stripe / stripe-php / #7109

pending completion
#7109

push

php-coveralls

pakrym-stripe
Bump version to 10.14.0

1802 of 2534 relevant lines covered (71.11%)

3.95 hits per line

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

81.48
/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 subtotal 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 callable $readBodyChunkCallable
66
     * @param null|array $params
67
     * @param null|array|string $opts
68
     *
69
     * @throws \Stripe\Exception\ApiErrorException if the request fails
70
     */
71
    public function pdf($readBodyChunkCallable, $params = null, $opts = null)
72
    {
73
        $opts = \Stripe\Util\RequestOptions::parse($opts);
1✔
74
        if (null === $opts->apiBase) {
1✔
75
            $opts->apiBase = Stripe::$apiUploadBase;
1✔
76
        }
77

78
        $url = $this->instanceUrl() . '/pdf';
1✔
79
        $this->_requestStream('get', $url, $readBodyChunkCallable, $params, $opts);
1✔
80
    }
81

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

96
        return $this;
1✔
97
    }
98

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

113
        return $this;
1✔
114
    }
115

116
    /**
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\Quote the finalized quote
123
     */
124
    public function finalizeQuote($params = null, $opts = null)
125
    {
126
        $url = $this->instanceUrl() . '/finalize';
1✔
127
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
1✔
128
        $this->refreshFrom($response, $opts);
1✔
129

130
        return $this;
1✔
131
    }
132

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

149
        return $obj;
×
150
    }
151

152
    /**
153
     * @param string $id
154
     * @param null|array $params
155
     * @param null|array|string $opts
156
     *
157
     * @throws \Stripe\Exception\ApiErrorException if the request fails
158
     *
159
     * @return \Stripe\Collection<\Stripe\LineItem> list of LineItems
160
     */
161
    public static function allLineItems($id, $params = null, $opts = null)
162
    {
163
        $url = static::resourceUrl($id) . '/line_items';
1✔
164
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
1✔
165
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
1✔
166
        $obj->setLastResponse($response);
1✔
167

168
        return $obj;
1✔
169
    }
170
}
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