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

stripe / stripe-php / 8653696086

11 Apr 2024 09:49PM UTC coverage: 61.376% (-0.1%) from 61.521%
8653696086

push

github

ramya-stripe
Fix bad merge

6 of 6 new or added lines in 1 file covered. (100.0%)

61 existing lines in 7 files now uncovered.

2417 of 3938 relevant lines covered (61.38%)

3.14 hits per line

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

50.0
/lib/Service/ProductService.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Service;
6

7
/**
8
 * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
9
 */
10
/**
11
 * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
12
 */
13
class ProductService extends \Stripe\Service\AbstractService
14
{
15
    /**
16
     * Returns a list of your products. The products are returned sorted by creation
17
     * date, with the most recently created products appearing first.
18
     *
19
     * @param null|array $params
20
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
21
     *
22
     * @throws \Stripe\Exception\ApiErrorException if the request fails
23
     *
24
     * @return \Stripe\Collection<\Stripe\Product>
25
     */
26
    public function all($params = null, $opts = null)
1✔
27
    {
28
        return $this->requestCollection('get', '/v1/products', $params, $opts);
1✔
29
    }
30

31
    /**
32
     * Retrieve a list of features for a product.
33
     *
34
     * @param string $parentId
35
     * @param null|array $params
36
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
37
     *
38
     * @throws \Stripe\Exception\ApiErrorException if the request fails
39
     *
40
     * @return \Stripe\Collection<\Stripe\ProductFeature>
41
     */
42
    public function allFeatures($parentId, $params = null, $opts = null)
×
43
    {
44
        return $this->requestCollection('get', $this->buildPath('/v1/products/%s/features', $parentId), $params, $opts);
×
45
    }
46

47
    /**
48
     * Creates a new product object.
49
     *
50
     * @param null|array $params
51
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
52
     *
53
     * @throws \Stripe\Exception\ApiErrorException if the request fails
54
     *
55
     * @return \Stripe\Product
56
     */
57
    public function create($params = null, $opts = null)
1✔
58
    {
59
        return $this->request('post', '/v1/products', $params, $opts);
1✔
60
    }
61

62
    /**
63
     * Creates a product_feature, which represents a feature attachment to a product.
64
     *
65
     * @param string $parentId
66
     * @param null|array $params
67
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
68
     *
69
     * @throws \Stripe\Exception\ApiErrorException if the request fails
70
     *
71
     * @return \Stripe\ProductFeature
72
     */
73
    public function createFeature($parentId, $params = null, $opts = null)
×
74
    {
75
        return $this->request('post', $this->buildPath('/v1/products/%s/features', $parentId), $params, $opts);
×
76
    }
77

78
    /**
79
     * Delete a product. Deleting a product is only possible if it has no prices
80
     * associated with it. Additionally, deleting a product with <code>type=good</code>
81
     * is only possible if it has no SKUs associated with it.
82
     *
83
     * @param string $id
84
     * @param null|array $params
85
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
86
     *
87
     * @throws \Stripe\Exception\ApiErrorException if the request fails
88
     *
89
     * @return \Stripe\Product
90
     */
91
    public function delete($id, $params = null, $opts = null)
1✔
92
    {
93
        return $this->request('delete', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
94
    }
95

96
    /**
97
     * Deletes the feature attachment to a product.
98
     *
99
     * @param string $parentId
100
     * @param string $id
101
     * @param null|array $params
102
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
103
     *
104
     * @throws \Stripe\Exception\ApiErrorException if the request fails
105
     *
106
     * @return \Stripe\ProductFeature
107
     */
108
    public function deleteFeature($parentId, $id, $params = null, $opts = null)
×
109
    {
110
        return $this->request('delete', $this->buildPath('/v1/products/%s/features/%s', $parentId, $id), $params, $opts);
×
111
    }
112

113
    /**
114
     * Retrieves the details of an existing product. Supply the unique product ID from
115
     * either a product creation request or the product list, and Stripe will return
116
     * the corresponding product information.
117
     *
118
     * @param string $id
119
     * @param null|array $params
120
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
121
     *
122
     * @throws \Stripe\Exception\ApiErrorException if the request fails
123
     *
124
     * @return \Stripe\Product
125
     */
126
    public function retrieve($id, $params = null, $opts = null)
1✔
127
    {
128
        return $this->request('get', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
129
    }
130

131
    /**
132
     * Retrieves a product_feature, which represents a feature attachment to a product.
133
     *
134
     * @param string $parentId
135
     * @param string $id
136
     * @param null|array $params
137
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
138
     *
139
     * @throws \Stripe\Exception\ApiErrorException if the request fails
140
     *
141
     * @return \Stripe\ProductFeature
142
     */
UNCOV
143
    public function retrieveFeature($parentId, $id, $params = null, $opts = null)
×
144
    {
UNCOV
145
        return $this->request('get', $this->buildPath('/v1/products/%s/features/%s', $parentId, $id), $params, $opts);
×
146
    }
147

148
    /**
149
     * Search for products you’ve previously created using Stripe’s <a
150
     * href="/docs/search#search-query-language">Search Query Language</a>. Don’t use
151
     * search in read-after-write flows where strict consistency is necessary. Under
152
     * normal operating conditions, data is searchable in less than a minute.
153
     * Occasionally, propagation of new or updated data can be up to an hour behind
154
     * during outages. Search functionality is not available to merchants in India.
155
     *
156
     * @param null|array $params
157
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
158
     *
159
     * @throws \Stripe\Exception\ApiErrorException if the request fails
160
     *
161
     * @return \Stripe\SearchResult<\Stripe\Product>
162
     */
UNCOV
163
    public function search($params = null, $opts = null)
×
164
    {
UNCOV
165
        return $this->requestSearchResult('get', '/v1/products/search', $params, $opts);
×
166
    }
167

168
    /**
169
     * Updates the specific product by setting the values of the parameters passed. Any
170
     * parameters not provided will be left unchanged.
171
     *
172
     * @param string $id
173
     * @param null|array $params
174
     * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
175
     *
176
     * @throws \Stripe\Exception\ApiErrorException if the request fails
177
     *
178
     * @return \Stripe\Product
179
     */
180
    public function update($id, $params = null, $opts = null)
1✔
181
    {
182
        return $this->request('post', $this->buildPath('/v1/products/%s', $id), $params, $opts);
1✔
183
    }
184
}
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