• 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/ShippingRate.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe;
6

7
/**
8
 * Shipping rates describe the price of shipping presented to your customers and
9
 * applied to a purchase. For more information, see <a href="https://stripe.com/docs/payments/during-payment/charge-shipping">Charge for shipping</a>.
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 bool $active Whether the shipping rate can be used for new purchases. Defaults to <code>true</code>.
14
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15
 * @property null|\Stripe\StripeObject $delivery_estimate The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
16
 * @property null|string $display_name The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
17
 * @property null|\Stripe\StripeObject $fixed_amount
18
 * @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.
19
 * @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.
20
 * @property null|string $tax_behavior Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of <code>inclusive</code>, <code>exclusive</code>, or <code>unspecified</code>.
21
 * @property null|string|\Stripe\TaxCode $tax_code A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. The Shipping tax code is <code>txcd_92010001</code>.
22
 * @property string $type The type of calculation to use on the shipping rate. Can only be <code>fixed_amount</code> for now.
23
 */
24
class ShippingRate extends ApiResource
25
{
26
    const OBJECT_NAME = 'shipping_rate';
27

28
    use ApiOperations\Update;
29

30
    const TAX_BEHAVIOR_EXCLUSIVE = 'exclusive';
31
    const TAX_BEHAVIOR_INCLUSIVE = 'inclusive';
32
    const TAX_BEHAVIOR_UNSPECIFIED = 'unspecified';
33

34
    const TYPE_FIXED_AMOUNT = 'fixed_amount';
35

36
    /**
37
     * Creates a new shipping rate object.
38
     *
39
     * @param null|array $params
40
     * @param null|array|string $options
41
     *
42
     * @throws \Stripe\Exception\ApiErrorException if the request fails
43
     *
44
     * @return \Stripe\ShippingRate the created resource
45
     */
NEW
46
    public static function create($params = null, $options = null)
×
47
    {
NEW
48
        self::_validateParams($params);
×
NEW
49
        $url = static::classUrl();
×
50

NEW
51
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
×
NEW
52
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
53
        $obj->setLastResponse($response);
×
54

NEW
55
        return $obj;
×
56
    }
57

58
    /**
59
     * Returns a list of your shipping rates.
60
     *
61
     * @param null|array $params
62
     * @param null|array|string $opts
63
     *
64
     * @throws \Stripe\Exception\ApiErrorException if the request fails
65
     *
66
     * @return \Stripe\Collection<\Stripe\ShippingRate> of ApiResources
67
     */
NEW
68
    public static function all($params = null, $opts = null)
×
69
    {
NEW
70
        $url = static::classUrl();
×
71

NEW
72
        return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
×
73
    }
74

75
    /**
76
     * Returns the shipping rate object with the given ID.
77
     *
78
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
79
     * @param null|array|string $opts
80
     *
81
     * @throws \Stripe\Exception\ApiErrorException if the request fails
82
     *
83
     * @return \Stripe\ShippingRate
84
     */
NEW
85
    public static function retrieve($id, $opts = null)
×
86
    {
NEW
87
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
88
        $instance = new static($id, $opts);
×
NEW
89
        $instance->refresh();
×
90

NEW
91
        return $instance;
×
92
    }
93

94
    /**
95
     * Updates an existing shipping rate object.
96
     *
97
     * @param string $id the ID of the resource to update
98
     * @param null|array $params
99
     * @param null|array|string $opts
100
     *
101
     * @throws \Stripe\Exception\ApiErrorException if the request fails
102
     *
103
     * @return \Stripe\ShippingRate the updated resource
104
     */
NEW
105
    public static function update($id, $params = null, $opts = null)
×
106
    {
NEW
107
        self::_validateParams($params);
×
NEW
108
        $url = static::resourceUrl($id);
×
109

NEW
110
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
NEW
111
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
112
        $obj->setLastResponse($response);
×
113

NEW
114
        return $obj;
×
115
    }
116
}
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