Skip to content

Commit 3133d17

Browse files
committed
Add no-arg Customer.cancelSubscription.
Also expose additional props on Subscriptions. Version Bump.
1 parent f0a89b3 commit 3133d17

File tree

7 files changed

+24
-6
lines changed

7 files changed

+24
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Add this dependency to your project's POM:
1717
<dependency>
1818
<groupId>com.stripe</groupId>
1919
<artifactId>stripe-java</artifactId>
20-
<version>1.0.7</version>
20+
<version>1.0.8</version>
2121
</dependency>
2222

2323
### Others
2424

2525
You'll need to manually install the following JARs:
2626

27-
* The Stripe JAR from https://code.stripe.com/stripe-java-1.0.7.jar
27+
* The Stripe JAR from https://code.stripe.com/stripe-java-1.0.8.jar
2828
* [Google Gson](http://code.google.com/p/google-gson/) from <http://google-gson.googlecode.com/files/google-gson-1.7.1-release.zip>.
2929

3030
Usage

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.7
1+
1.0.8

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.stripe</groupId>
55
<artifactId>stripe-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.0.7</version>
7+
<version>1.0.8</version>
88
<name>stripe-java</name>
99
<url>https://github.com/stripe/stripe-java</url>
1010
<dependencies>

src/main/java/com/stripe/Stripe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public abstract class Stripe
44
{
55
public static final String API_BASE = "https://api.stripe.com/v1";
6-
public static final String VERSION = "1.0.7";
6+
public static final String VERSION = "1.0.8";
77
public static String apiKey;
88
}

src/main/java/com/stripe/model/Customer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public Subscription updateSubscription(Map<String, Object> params) throws Stripe
132132
params, Subscription.class);
133133
}
134134

135+
public Subscription cancelSubscription() throws StripeException {
136+
return cancelSubscription(null);
137+
}
138+
135139
public Subscription cancelSubscription(Map<String, Object> params) throws StripeException {
136140
return request(RequestMethod.DELETE,
137141
String.format("%s/subscription", instanceURL(Customer.class, this.id)),

src/main/java/com/stripe/model/Subscription.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class Subscription extends StripeObject {
1010
Long trialStart;
1111
Long trialEnd;
1212
Plan plan;
13+
Long canceledAt;
14+
Long endedAt;
1315

1416
public Long getCurrentPeriodEnd() {
1517
return currentPeriodEnd;
@@ -59,4 +61,16 @@ public Plan getPlan() {
5961
public void setPlan(Plan plan) {
6062
this.plan = plan;
6163
}
64+
public Long getCanceledAt() {
65+
return canceledAt;
66+
}
67+
public void setCanceledAt(Long canceledAt) {
68+
this.canceledAt = canceledAt;
69+
}
70+
public Long getEndedAt() {
71+
return endedAt;
72+
}
73+
public void setEndedAt(Long endedAt) {
74+
this.endedAt = endedAt;
75+
}
6276
}

src/test/java/com/stripe/StripeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public void testInvalidCard() throws StripeException {
224224
Plan plan = Plan.create(getUniquePlanParams());
225225
Customer customer = createDefaultCustomerWithPlan(plan);
226226
assertEquals(customer.getSubscription().getStatus(), "active");
227-
Subscription canceledSubscription = customer.cancelSubscription(null);
227+
Subscription canceledSubscription = customer.cancelSubscription();
228228
assertEquals(canceledSubscription.getStatus(), "canceled");
229229
}
230230

0 commit comments

Comments
 (0)