Skip to content

Commit

Permalink
Merge pull request #45 from wepay/feature-version-2016-12-07
Browse files Browse the repository at this point in the history
Feature version 2016 12 07
  • Loading branch information
y2chaits authored Dec 21, 2016
2 parents b7f9edb + 9eab849 commit d4bd1d6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2016-12-21
* Released v8.0.0, updating API support to 2016-12-07
* Added support for optional account_id in CreditCard.authorize()
* Added CreditCard.getBackingInstrumentName()

2016-12-21
* Released v7.0.0, updating API support to 2016-08-10
* No other changes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WePay-Java-SDK

Note
================================
This WePay-Java-SDK is for <a href = "https://www.wepay.com/developer/version/2016-08-10">WePay Api Version 2016-08-10</a>. The jar for the previous API versions can be found in the lib folder.
This WePay-Java-SDK is for <a href = "https://www.wepay.com/developer/version/2016-12-07">WePay Api Version 2016-12-07</a>. The jar for the previous API versions can be found in the lib folder.

Building
================================
Expand Down
Binary file added lib/wepay-2016-08-10.jar
Binary file not shown.
Binary file modified lib/wepay.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.wepay</groupId>
<artifactId>wepay-java-sdk</artifactId>
<version>7.0.0</version>
<version>8.0.0</version>

<name>wepay-java-sdk</name>
<description>WePay Java SDK</description>
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/wepay/model/CreditCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class CreditCard extends WePayResource {
protected Integer expirationMonth;
protected Integer expirationYear;
protected String lastFour;
protected String backingInstrumentName;
protected Boolean autoUpdate;
protected Long[] rbitIds;

Expand Down Expand Up @@ -58,10 +59,19 @@ public static CreditCard modify(Long creditCardId, String accessToken, Boolean a
}

public void authorize(String accessToken) throws JSONException, IOException, WePayException {
this.authorize(0L, accessToken);
}

public void authorize(Long account_id, String accessToken) throws JSONException, IOException, WePayException {
JSONObject params = new JSONObject();
params.put("credit_card_id", this.creditCardId);
params.put("client_id", WePay.clientId);
params.put("client_secret", WePay.clientSecret);

if (account_id > 0) {
params.put("account_id", account_id);
}

request("/credit_card/authorize", params, accessToken);
}

Expand Down Expand Up @@ -152,6 +162,10 @@ public String getLastFour() {
return lastFour;
}

public String getBackingInstrumentName() {
return backingInstrumentName;
}

public Boolean getAutoUpdate() {
return autoUpdate;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/wepay/net/WePayResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, Stri
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Api-Version", "2016-08-10");
connection.setRequestProperty("User-Agent", "WePay Java SDK v7.0.0");
connection.setRequestProperty("Api-Version", "2016-12-07");
connection.setRequestProperty("User-Agent", "WePay Java SDK v8.0.0");
if (accessToken != null) {
connection.setRequestProperty("Authorization", "Bearer " + accessToken);
}
Expand Down

0 comments on commit d4bd1d6

Please sign in to comment.