Skip to content

Commit

Permalink
add plan update method
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag committed Dec 14, 2011
1 parent fdd05b6 commit ff0657d
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>1.0.8</version>
<version>1.0.9</version>
</dependency>

### Others

You'll need to manually install the following JARs:

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

Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.8
1.0.9
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<packaging>jar</packaging>
<version>1.0.8</version>
<version>1.0.9</version>
<name>stripe-java</name>
<url>https://github.com/stripe/stripe-java</url>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/Stripe.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public abstract class Stripe
{
public static final String API_BASE = "https://api.stripe.com/v1";
public static final String VERSION = "1.0.8";
public static final String VERSION = "1.0.9";
public static String apiKey;
}
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/model/Plan.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static Plan retrieve(String id) throws StripeException {
return request(RequestMethod.GET, instanceURL(Plan.class, id), null, Plan.class);
}

public static Plan update(Map<String, Object> params) throws StripeException {
public Plan update(Map<String, Object> params) throws StripeException {
return request(RequestMethod.POST, instanceURL(Plan.class, this.id), params, Plan.class);
}

Expand Down
13 changes: 11 additions & 2 deletions src/test/java/com/stripe/StripeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class StripeTest
static Map<String, Object> defaultPlanParams = new HashMap<String, Object>();
static Map<String, Object> defaultCouponParams = new HashMap<String, Object>();

static String getUniquePlanId() { return String.format("JAVA-BINDINGS-PLAN-%s", UUID.randomUUID()); }
static String getUniqueCouponId() { return String.format("JAVA-BINDINGS-COUPON-%s", UUID.randomUUID()); }
static String getUniquePlanId() { return String.format("JAVA-PLAN-%s", UUID.randomUUID()); }
static String getUniqueCouponId() { return String.format("JAVA-COUPON-%s", UUID.randomUUID()); }

static Map<String, Object> getUniquePlanParams() {
Map<String, Object> uniqueParams = new HashMap<String, Object>();
Expand Down Expand Up @@ -184,6 +184,15 @@ public void testInvalidCard() throws StripeException {
assertEquals(plan.getInterval(), "month");
}

@Test public void testPlanUpdate() throws StripeException {
Plan createdPlan = Plan.create(getUniquePlanParams());
System.out.println(createdPlan);
Map<String, Object> updateParams = new HashMap<String, Object>();
updateParams.put("name", "Updated Plan Name");
Plan updatedplan = createdPlan.update(updateParams);
assertEquals(updatedplan.getName(), "Updated Plan Name");
}

@Test public void testPlanRetrieve() throws StripeException {
Plan createdPlan = Plan.create(getUniquePlanParams());
Plan retrievedPlan = Plan.retrieve(createdPlan.getId());
Expand Down

0 comments on commit ff0657d

Please sign in to comment.