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

stripe / stripe-php / 9308533534

30 May 2024 08:07PM UTC coverage: 65.24% (-0.9%) from 66.176%
9308533534

push

github

web-flow
Added PHPDocs for `create`, `update`, `delete`, `all`, `retrieve` methods after moving them out of traits.  (#1701)

* Demagiced crudl operation

* Improvements from codegen#1452

* Updated override to fix indents

1080 of 1682 new or added lines in 106 files covered. (64.21%)

15 existing lines in 3 files now uncovered.

3444 of 5279 relevant lines covered (65.24%)

2.29 hits per line

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

0.0
/lib/Climate/Order.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Climate;
6

7
/**
8
 * Orders represent your intent to purchase a particular Climate product. When you create an order, the
9
 * payment is deducted from your merchant balance.
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_fees Total amount of <a href="https://frontierclimate.com/">Frontier</a>'s service fees in the currency's smallest unit.
14
 * @property int $amount_subtotal Total amount of the carbon removal in the currency's smallest unit.
15
 * @property int $amount_total Total amount of the order including fees in the currency's smallest unit.
16
 * @property null|\Stripe\StripeObject $beneficiary
17
 * @property null|int $canceled_at Time at which the order was canceled. Measured in seconds since the Unix epoch.
18
 * @property null|string $cancellation_reason Reason for the cancellation of this order.
19
 * @property null|string $certificate For delivered orders, a URL to a delivery certificate for the order.
20
 * @property null|int $confirmed_at Time at which the order was confirmed. Measured in seconds since the Unix epoch.
21
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
22
 * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase, representing the currency for this order.
23
 * @property null|int $delayed_at Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
24
 * @property null|int $delivered_at Time at which the order was delivered. Measured in seconds since the Unix epoch.
25
 * @property \Stripe\StripeObject[] $delivery_details Details about the delivery of carbon removal for this order.
26
 * @property int $expected_delivery_year The year this order is expected to be delivered.
27
 * @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.
28
 * @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.
29
 * @property string $metric_tons Quantity of carbon removal that is included in this order.
30
 * @property string|\Stripe\Climate\Product $product Unique ID for the Climate <code>Product</code> this order is purchasing.
31
 * @property null|int $product_substituted_at Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
32
 * @property string $status The current status of this order.
33
 */
34
class Order extends \Stripe\ApiResource
35
{
36
    const OBJECT_NAME = 'climate.order';
37

38
    use \Stripe\ApiOperations\Update;
39

40
    const CANCELLATION_REASON_EXPIRED = 'expired';
41
    const CANCELLATION_REASON_PRODUCT_UNAVAILABLE = 'product_unavailable';
42
    const CANCELLATION_REASON_REQUESTED = 'requested';
43

44
    const STATUS_AWAITING_FUNDS = 'awaiting_funds';
45
    const STATUS_CANCELED = 'canceled';
46
    const STATUS_CONFIRMED = 'confirmed';
47
    const STATUS_DELIVERED = 'delivered';
48
    const STATUS_OPEN = 'open';
49

50
    /**
51
     * Creates a Climate order object for a given Climate product. The order will be
52
     * processed immediately after creation and payment will be deducted your Stripe
53
     * balance.
54
     *
55
     * @param null|array $params
56
     * @param null|array|string $options
57
     *
58
     * @throws \Stripe\Exception\ApiErrorException if the request fails
59
     *
60
     * @return \Stripe\Climate\Order the created resource
61
     */
NEW
62
    public static function create($params = null, $options = null)
×
63
    {
NEW
64
        self::_validateParams($params);
×
NEW
65
        $url = static::classUrl();
×
66

NEW
67
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
×
NEW
68
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
69
        $obj->setLastResponse($response);
×
70

NEW
71
        return $obj;
×
72
    }
73

74
    /**
75
     * Lists all Climate order objects. The orders are returned sorted by creation
76
     * date, with the most recently created orders appearing first.
77
     *
78
     * @param null|array $params
79
     * @param null|array|string $opts
80
     *
81
     * @throws \Stripe\Exception\ApiErrorException if the request fails
82
     *
83
     * @return \Stripe\Collection<\Stripe\Climate\Order> of ApiResources
84
     */
NEW
85
    public static function all($params = null, $opts = null)
×
86
    {
NEW
87
        $url = static::classUrl();
×
88

NEW
89
        return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
×
90
    }
91

92
    /**
93
     * Retrieves the details of a Climate order object with the given ID.
94
     *
95
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
96
     * @param null|array|string $opts
97
     *
98
     * @throws \Stripe\Exception\ApiErrorException if the request fails
99
     *
100
     * @return \Stripe\Climate\Order
101
     */
NEW
102
    public static function retrieve($id, $opts = null)
×
103
    {
NEW
104
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
105
        $instance = new static($id, $opts);
×
NEW
106
        $instance->refresh();
×
107

NEW
108
        return $instance;
×
109
    }
110

111
    /**
112
     * Updates the specified order by setting the values of the parameters passed.
113
     *
114
     * @param string $id the ID of the resource to update
115
     * @param null|array $params
116
     * @param null|array|string $opts
117
     *
118
     * @throws \Stripe\Exception\ApiErrorException if the request fails
119
     *
120
     * @return \Stripe\Climate\Order the updated resource
121
     */
NEW
122
    public static function update($id, $params = null, $opts = null)
×
123
    {
NEW
124
        self::_validateParams($params);
×
NEW
125
        $url = static::resourceUrl($id);
×
126

NEW
127
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
NEW
128
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
129
        $obj->setLastResponse($response);
×
130

NEW
131
        return $obj;
×
132
    }
133

134
    /**
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\Climate\Order the canceled order
141
     */
142
    public function cancel($params = null, $opts = null)
×
143
    {
144
        $url = $this->instanceUrl() . '/cancel';
×
145
        list($response, $opts) = $this->_request('post', $url, $params, $opts);
×
146
        $this->refreshFrom($response, $opts);
×
147

148
        return $this;
×
149
    }
150
}
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