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

stripe / stripe-java / 2073

pending completion
2073

Pull #447

travis-ci

web-flow
Support new Product+Plan API
Pull Request #447: Support new Product+Plan API

1495 of 2510 relevant lines covered (59.56%)

213.09 hits per line

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

48.57
/src/main/java/com/stripe/model/Subscription.java
1
package com.stripe.model;
2

3
import com.stripe.exception.APIConnectionException;
4
import com.stripe.exception.APIException;
5
import com.stripe.exception.AuthenticationException;
6
import com.stripe.exception.CardException;
7
import com.stripe.exception.InvalidRequestException;
8
import com.stripe.net.APIResource;
9
import com.stripe.net.RequestOptions;
10

11
import java.util.Map;
12

13

14
public class Subscription extends APIResource implements MetadataStore<Subscription>, HasId {
16✔
15
        String id;
16
        String object;
17
        Double applicationFeePercent;
18
        String billing;
19
        Boolean cancelAtPeriodEnd;
20
        Long canceledAt;
21
        Long created;
22
        Long currentPeriodEnd;
23
        Long currentPeriodStart;
24
        ExpandableField<Customer> customer;
25
        Integer daysUntilDue;
26
        Discount discount;
27
        Long endedAt;
28
        SubscriptionItemCollection items;
29
        Map<String, String> metadata;
30
        Plan plan;
31
        Integer quantity;
32
        Long start;
33
        String status;
34
        Double taxPercent;
35
        Long trialEnd;
36
        Long trialStart;
37
        Long billingCycleAnchor;
38

39
        public String getId() {
40
                return id;
41
        }
42

43
        public void setId(String id) {
44
                this.id = id;
45
        }
46

47
        public String getObject() {
48
                return object;
49
        }
50

51
        public void setObject(String object) {
52
                this.object = object;
53
        }
54

55
        public Double getApplicationFeePercent() {
56
                return applicationFeePercent;
57
        }
58

59
        public void setApplicationFeePercent(Double applicationFeePercent) {
60
                this.applicationFeePercent = applicationFeePercent;
61
        }
62

63
        public String getBilling() {
64
                return billing;
65
        }
66

67
        public void setBilling(String billing) {
68
                this.billing = billing;
69
        }
70

71
        public Boolean getCancelAtPeriodEnd() {
72
                return cancelAtPeriodEnd;
73
        }
74

75
        public void setCancelAtPeriodEnd(Boolean cancelAtPeriodEnd) {
76
                this.cancelAtPeriodEnd = cancelAtPeriodEnd;
77
        }
78

79
        public Long getCanceledAt() {
80
                return canceledAt;
81
        }
82

83
        public void setCanceledAt(Long canceledAt) {
84
                this.canceledAt = canceledAt;
85
        }
86

87
        public Long getCreated() {
88
                return created;
89
        }
90

91
        public void setCreated(Long created) {
92
                this.created = created;
93
        }
94

95
        public Long getCurrentPeriodEnd() {
96
                return currentPeriodEnd;
97
        }
98

99
        public void setCurrentPeriodEnd(Long currentPeriodEnd) {
100
                this.currentPeriodEnd = currentPeriodEnd;
101
        }
102

103
        public Long getCurrentPeriodStart() {
104
                return currentPeriodStart;
105
        }
106

107
        public void setCurrentPeriodStart(Long currentPeriodStart) {
108
                this.currentPeriodStart = currentPeriodStart;
109
        }
110

111
        public String getCustomer() {
112
                if (this.customer == null) {
16✔
113
                        return null;
×
114
                }
115
                return this.customer.getId();
16✔
116
        }
117

118
        public void setCustomer(String customerID) {
119
                this.customer = setExpandableFieldID(customerID, this.customer);
×
120
        }
×
121

122
        public Customer getCustomerObject() {
123
                if (this.customer == null) {
×
124
                        return null;
×
125
                }
126
                return this.customer.getExpanded();
×
127
        }
128

129
        public void setCustomerObject(Customer c) {
130
                this.customer = new ExpandableField<Customer>(c.getId(), c);
×
131
        }
×
132

133
        public Integer getDaysUntilDue() {
134
                return daysUntilDue;
135
        }
136

137
        public void setDaysUntilDue(Integer daysUntilDue) {
138
                this.daysUntilDue = daysUntilDue;
139
        }
140

141
        public Discount getDiscount() {
142
                return discount;
143
        }
144

145
        public void setDiscount(Discount discount) {
146
                this.discount = discount;
147
        }
148

149
        public Long getEndedAt() {
150
                return endedAt;
151
        }
152

153
        public void setEndedAt(Long endedAt) {
154
                this.endedAt = endedAt;
155
        }
156

157
        public Map<String, String> getMetadata() {
158
                return metadata;
159
        }
160

161
        public void setMetadata(Map<String, String> metadata) {
162
                this.metadata = metadata;
163
        }
164

165
        public Plan getPlan() {
166
                return plan;
167
        }
168

169
        public void setPlan(Plan plan) {
170
                this.plan = plan;
171
        }
172

173
        public Integer getQuantity() {
174
                return quantity;
175
        }
176

177
        public void setQuantity(Integer quantity) {
178
                this.quantity = quantity;
179
        }
180

181
        public Long getStart() {
182
                return start;
183
        }
184

185
        public void setStart(Long start) {
186
                this.start = start;
187
        }
188

189
        public String getStatus() {
190
                return status;
191
        }
192

193
        public void setStatus(String status) {
194
                this.status = status;
195
        }
196

197
        public Double getTaxPercent() {
198
                return taxPercent;
199
        }
200

201
        public void setTaxPercent(Double taxPercent) {
202
                this.taxPercent = taxPercent;
203
        }
204

205
        public Long getTrialEnd() {
206
                return trialEnd;
207
        }
208

209
        public void setTrialEnd(Long trialEnd) {
210
                this.trialEnd = trialEnd;
211
        }
212

213
        public Long getTrialStart() {
214
                return trialStart;
215
        }
216

217
        public void setTrialStart(Long trialStart) {
218
                this.trialStart = trialStart;
219
        }
220

221
        public SubscriptionItemCollection getSubscriptionItems() {
222
                return items;
223
        }
224

225
        public void setSubscriptionItems(SubscriptionItemCollection items) {
226
                this.items = items;
227
        }
228

229
        public Long getBillingCycleAnchor() {
230
                return billingCycleAnchor;
231
        }
232

233
        public void setBillingCycleAnchor(Long billingCycleAnchor) {
234
                this.billingCycleAnchor = billingCycleAnchor;
235
        }
236

237
        @Deprecated
238
        public static SubscriptionCollection all(Map<String, Object> params)
239
                        throws AuthenticationException, InvalidRequestException,
240
                        APIConnectionException, CardException, APIException {
241
                return list(params, null);
8✔
242
        }
243

244
        @Deprecated
245
        public static SubscriptionCollection all(Map<String, Object> params,
246
                                                                                         RequestOptions options) throws AuthenticationException,
247
                        InvalidRequestException, APIConnectionException, CardException,
248
                        APIException {
249
                return list(params, options);
×
250
        }
251

252
        public static Subscription create(Map<String, Object> params)
253
                        throws AuthenticationException, InvalidRequestException,
254
                        APIConnectionException, CardException, APIException {
255
                return create(params, null);
36✔
256
        }
257

258
        public static Subscription create(Map<String, Object> params, RequestOptions options)
259
                        throws AuthenticationException, InvalidRequestException,
260
                        APIConnectionException, CardException, APIException {
261
                return request(RequestMethod.POST, classURL(Subscription.class), params, Subscription.class, options);
36✔
262
        }
263

264
        public static SubscriptionCollection list(Map<String, Object> params)
265
                        throws AuthenticationException,
266
                        InvalidRequestException, APIConnectionException, CardException,
267
                        APIException {
268
                return list(params, null);
×
269
        }
270

271
        public static SubscriptionCollection list(Map<String, Object> params,
272
                                                                                          RequestOptions options) throws AuthenticationException,
273
                        InvalidRequestException, APIConnectionException, CardException,
274
                        APIException {
275
                return requestCollection(classURL(Subscription.class), params, SubscriptionCollection.class, options);
8✔
276
        }
277

278
        public static Subscription retrieve(String id) throws AuthenticationException,
279
                        InvalidRequestException, APIConnectionException, CardException,
280
                        APIException {
281
                return retrieve(id, null);
8✔
282
        }
283

284
        public static Subscription retrieve(String id, RequestOptions options)
285
                        throws AuthenticationException, InvalidRequestException,
286
                        APIConnectionException, CardException, APIException {
287
                return request(RequestMethod.GET, instanceURL(Subscription.class, id), null, Subscription.class, options);
8✔
288
        }
289

290
        public static Subscription retrieve(String id, Map<String, Object> params, RequestOptions options)
291
                        throws AuthenticationException, InvalidRequestException,
292
                        APIConnectionException, CardException, APIException {
293
                return request(RequestMethod.GET, instanceURL(Subscription.class, id), params, Subscription.class, options);
×
294
        }
295

296
        public Subscription update(Map<String, Object> params)
297
                        throws AuthenticationException, InvalidRequestException,
298
                        APIConnectionException, CardException, APIException {
299
                return update(params, (RequestOptions) null);
36✔
300
        }
301

302
        @Deprecated
303
        public Subscription update(Map<String, Object> params, String apiKey)
304
                        throws AuthenticationException, InvalidRequestException,
305
                        APIConnectionException, CardException, APIException {
306
                return update(params, RequestOptions.builder().setApiKey(apiKey).build());
×
307
        }
308

309
        public Subscription update(Map<String, Object> params, RequestOptions options)
310
                        throws AuthenticationException, InvalidRequestException,
311
                        APIConnectionException, CardException, APIException {
312
                return request(RequestMethod.POST, instanceURL(Subscription.class, id), params, Subscription.class, options);
36✔
313
        }
314

315
        public Subscription cancel(Map<String, Object> params) throws AuthenticationException,
316
                        InvalidRequestException, APIConnectionException, CardException,
317
                        APIException {
318
                return cancel(params, (RequestOptions) null);
12✔
319
        }
320

321
        @Deprecated
322
        public Subscription cancel(Map<String, Object> params, String apiKey) throws AuthenticationException,
323
                        InvalidRequestException, APIConnectionException, CardException,
324
                        APIException {
325
                return cancel(params, RequestOptions.builder().setApiKey(apiKey).build());
×
326
        }
327

328
        public Subscription cancel(Map<String, Object> params, RequestOptions options) throws AuthenticationException,
329
                        InvalidRequestException, APIConnectionException, CardException,
330
                        APIException {
331
                return request(RequestMethod.DELETE, instanceURL(Subscription.class, id), params, Subscription.class, options);
12✔
332
        }
333

334
        public void deleteDiscount() throws AuthenticationException,
335
                        InvalidRequestException, APIConnectionException, CardException,
336
                        APIException {
337
                deleteDiscount((RequestOptions) null);
4✔
338
        }
4✔
339

340
        @Deprecated
341
        public void deleteDiscount(String apiKey) throws AuthenticationException,
342
                        InvalidRequestException, APIConnectionException, CardException,
343
                        APIException {
344
                RequestOptions result = null;
×
345
                if (apiKey != null) {
×
346
                        result = RequestOptions.builder().setApiKey(apiKey).build();
×
347
                }
348
                deleteDiscount(result);
×
349
        }
×
350

351
        public void deleteDiscount(RequestOptions options) throws AuthenticationException,
352
                        InvalidRequestException, APIConnectionException, CardException,
353
                        APIException {
354
                request(RequestMethod.DELETE, String.format("%s/discount", instanceURL(Subscription.class, id)), null, Discount.class, options);
4✔
355
        }
4✔
356
}
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

© 2024 Coveralls, Inc