Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Recurly Java Client
===================

The Recurly Java Client library is an open source wrapper library to talk to Recurly's subscription management from your Java app/website. The library interacts with Recurly's [REST API](http://support.recurly.com/faqs/api).
The Recurly Java Client library is an open source wrapper library to talk to Recurly's subscription management from your Java app/website. The library interacts with Recurly's [REST API](https://docs.recurly.com/api).


Usage
-----

Please refer to the JUnit test cases in [RecurlyTest](https://github.com/thobach/recurly-client-java/blob/master/src/com/kwanzoo/recurly/test/RecurlyTest.java)
Please refer to the JUnit test cases in [RecurlyTest](https://github.com/mambu-gmbh/recurly-client-java/blob/master/src/com/kwanzoo/recurly/test/RecurlyTest.java)


Installation
Expand All @@ -19,11 +19,11 @@ Just add the latest jar(under [dist/](https://github.com/thobach/recurly-client-
Dependencies
------------

This wrapper relies on the excellent [Jersey REST client API](https://jersey.dev.java.net/)
This wrapper relies on the excellent [Jersey 2 REST client API](https://jersey.dev.java.net/)

Developed By
-------------

The initial code was developed by Manoj Mathai, GSLab, for Kwanzoo Inc.

The Transparent Post API and further API integration was done by Thomas Bachmann, Mambu GmbH.
The Transparent Post API, Recurly API v2, Recurly JS support, further API integration and migration to Jersey 2 was done by Thomas Bachmann, Mambu GmbH.
Binary file modified dist/recurly-client-java-SNAPSHOT.jar
Binary file not shown.
274 changes: 274 additions & 0 deletions libs/Jersey-LICENSE.txt

Large diffs are not rendered by default.

Binary file added libs/aopalliance-repackaged-2.4.0-b10.jar
Binary file not shown.
Binary file added libs/asm-debug-all-5.0.2.jar
Binary file not shown.
Binary file added libs/hk2-api-2.4.0-b10.jar
Binary file not shown.
Binary file added libs/hk2-locator-2.4.0-b10.jar
Binary file not shown.
Binary file added libs/hk2-utils-2.4.0-b10.jar
Binary file not shown.
Binary file added libs/javassist-3.18.1-GA.jar
Binary file not shown.
Binary file added libs/javax.annotation-api-1.2.jar
Binary file not shown.
Binary file added libs/javax.inject-2.4.0-b10.jar
Binary file not shown.
Binary file added libs/javax.servlet-api-3.0.1.jar
Binary file not shown.
Binary file added libs/javax.ws.rs-api-2.0.1.jar
Binary file not shown.
Binary file added libs/jaxb-api-2.2.7.jar
Binary file not shown.
Binary file removed libs/jersey-client-1.4.jar
Binary file not shown.
Binary file added libs/jersey-client.jar
Binary file not shown.
Binary file added libs/jersey-common.jar
Binary file not shown.
Binary file added libs/jersey-container-servlet-core.jar
Binary file not shown.
Binary file added libs/jersey-container-servlet.jar
Binary file not shown.
Binary file removed libs/jersey-core-1.4.jar
Binary file not shown.
Binary file added libs/jersey-guava-2.17.jar
Binary file not shown.
Binary file added libs/jersey-media-jaxb.jar
Binary file not shown.
Binary file added libs/jersey-server.jar
Binary file not shown.
Binary file removed libs/junit-4.8.2.jar
Binary file not shown.
Binary file added libs/org.osgi.core-4.2.0.jar
Binary file not shown.
Binary file added libs/osgi-resource-locator-1.0.1.jar
Binary file not shown.
Binary file added libs/persistence-api-1.0.jar
Binary file not shown.
188 changes: 188 additions & 0 deletions libs/third-party-license-readme.txt

Large diffs are not rendered by default.

Binary file added libs/validation-api-1.1.0.Final.jar
Binary file not shown.
114 changes: 61 additions & 53 deletions src/com/kwanzoo/recurly/Account.java
Original file line number Diff line number Diff line change
@@ -1,72 +1,80 @@
package com.kwanzoo.recurly;

import java.util.Date;

import javax.ws.rs.client.Entity;
import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.GenericType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
@XmlRootElement(name = "account")
public class Account extends Base {

@XmlRootElement(name="account")
public class Account extends Base{
public static String pluralResourceName = "accounts";

//Required
@XmlElement(name="account_code")
public String accountCode;

@XmlElement(name="username")
public String username;

@XmlElement(name="first_name")
public String firstName;

@XmlElement(name="last_name")
public String lastName;

@XmlElement(name="email")
public String email;

@XmlElement(name="company_name")
public String companyName;

@XmlElement(name="balance_in_cents")
public Integer balanceInCents;

@XmlElement(name="created_at")
public Date createdAt;

@XmlElement(name="billing_info")
public BillingInfo billingInfo;

private static String getResourcePath(String accountCode){
// Required
@XmlElement(name = "account_code")
public String accountCode;

@XmlElement(name = "username")
public String username;

@XmlElement(name = "first_name")
public String firstName;

@XmlElement(name = "last_name")
public String lastName;

@XmlElement(name = "email")
public String email;

@XmlElement(name = "company_name")
public String companyName;

@XmlElement(name = "balance_in_cents")
public Integer balanceInCents;

@XmlElement(name = "billing_info")
public BillingInfo billingInfo;

private static String getResourcePath(String accountCode) {
return pluralResourceName + "/" + accountCode;
}

public static Account get(final String accountCode) throws Exception{
try{
return getWebResourceBuilder(getResourcePath(accountCode)).get(new GenericType<Account>(){});
}
catch(final UniformInterfaceException uie){
throwStatusBasedException(uie.getResponse());
return null;
}
}

@Override

public static Account get(final String accountCode) throws Exception {
try {
return getWebResourceBuilder(getResourcePath(accountCode)).get(new GenericType<Account>() {});
} catch (final ResponseProcessingException rpe) {
throwStatusBasedException(rpe.getResponse());
return null;
}
}

@Override
protected String getResourcePath() {
return getResourcePath(accountCode);
}

@Override
protected String getResourceCreationPath() {
return pluralResourceName;
}

public Account(){}
}

public Account() {
}

public Account(final String accountCode){
this.accountCode = accountCode;
}
public Account(final String accountCode) {
this.accountCode = accountCode;
}

public void reopen() throws Exception {
try {
getWebResourceBuilder(getResourceReopenPath()).put(Entity.xml(this));
} catch (final ResponseProcessingException rpe) {
throwStatusBasedException(rpe.getResponse());
}
}

private String getResourceReopenPath() {
return pluralResourceName + "/" + accountCode + "/reopen";
}
}
87 changes: 87 additions & 0 deletions src/com/kwanzoo/recurly/AccountResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package com.kwanzoo.recurly;

import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.GenericType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Response class for {@link Account} objects. Required since request class {@link Account} may not contain
* hostedLoginToken parameter.
*/
@XmlRootElement(name = "account")
public class AccountResponse extends Base {

public static String pluralResourceName = "accounts";

// Required
@XmlElement(name = "account_code")
public String accountCode;

@XmlElement(name = "username")
public String username;

@XmlElement(name = "first_name")
public String firstName;

@XmlElement(name = "last_name")
public String lastName;

@XmlElement(name = "email")
public String email;

@XmlElement(name = "company_name")
public String companyName;

@XmlElement(name = "balance_in_cents")
public Integer balanceInCents;

@XmlElement(name = "billing_info")
public BillingInfo billingInfo;

@XmlElement(name = "hosted_login_token")
public String hostedLoginToken;

private static String getResourcePath(String accountCode) {
return pluralResourceName + "/" + accountCode;
}

public static AccountResponse get(final String accountCode) throws Exception {
try {
return getWebResourceBuilder(getResourcePath(accountCode)).get(new GenericType<AccountResponse>() {});
} catch (final ResponseProcessingException rpe) {
throwStatusBasedException(rpe.getResponse());
return null;
}
}

@Override
protected String getResourcePath() {
return getResourcePath(accountCode);
}

@Override
protected String getResourceCreationPath() {
return pluralResourceName;
}

public AccountResponse() {
}

public AccountResponse(final String accountCode) {
this.accountCode = accountCode;
}

@Override
public void create() throws Exception {
throw new UnsupportedOperationException(
"AccountResponse class can only be used for retrieving and deleting data, use Account class for creating data.");
}

@Override
public void update() throws Exception {
throw new UnsupportedOperationException(
"AccountResponse class can only be used for retrieving and deleting data, use Account class for updating data.");
}

}
17 changes: 17 additions & 0 deletions src/com/kwanzoo/recurly/Addon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.kwanzoo.recurly;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "subscription_add_on")
public class Addon {

@XmlElement(name = "add_on_code")
public String addOnCode;

@XmlElement(name = "quantity")
public Integer quantity;

@XmlElement(name = "unit_amount_in_cents")
public Integer unitAmountInCents;
}
76 changes: 76 additions & 0 deletions src/com/kwanzoo/recurly/Adjustment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.kwanzoo.recurly;

import java.util.Date;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "adjustment")
public class Adjustment extends Base {

private static String resourceName = "adjustments";

@XmlElement(name = "unit_amount_in_cents")
public Integer unitAmountInCents;

@XmlElement(name = "discount_in_cents")
public Integer discountInCents;

@XmlElement(name = "tax_in_cents")
public Integer taxInCents;

@XmlElement(name = "total_in_cents")
public Integer totalInCents;

@XmlElement(name = "description")
public String description;

@XmlElement(name = "currency")
public String currency;

@XmlElement(name = "uuid")
public String uuid;

@XmlElement(name = "accounting_code")
public String accountingCode;

@XmlElement(name = "tax_exempt")
public Boolean taxExempt;

@XmlElement(name = "product_code")
public String productCode;

@XmlElement(name = "origin")
public String origin;

@XmlElement(name = "quantity")
public String quantity;

@XmlElement(name = "start_date")
public Date startDate;

@XmlElement(name = "created_at")
public Date createdAt;

@XmlElement(name = "end_date")
public Date endDate;

private String accountCode;

@Override
protected String getResourcePath() {
return Account.pluralResourceName + "/" + accountCode + "/" + resourceName;
}

@Override
protected String getResourceCreationPath() {
return getResourcePath();
}

public Adjustment() {
}

public Adjustment(final String accountCode) {
this.accountCode = accountCode;
}
}
Loading