Skip to content

Commit 3a206d3

Browse files
authored
Merge pull request #40 from wepay/fix-app-preapprovals
Fix app preapprovals
2 parents d2559fc + 8e05ed3 commit 3a206d3

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2016-06-21
2+
* Released v5.1.1
3+
* Added support for app-level preapprovals
4+
* Added accountReviewStatus to AccountStatusesObjectData
5+
16
2016-04-15
27
* Released v5.1.0, updating API support to 2016-03-30
38
* Added support for several new data fields in /checkout: payment_error, non-profit org data, and bank information for ACH payments

lib/wepay.jar

-866 Bytes
Binary file not shown.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<groupId>com.wepay</groupId>
1010
<artifactId>wepay-java-sdk</artifactId>
11-
<version>5.1.0</version>
11+
<version>5.1.1</version>
1212

1313
<name>wepay-java-sdk</name>
1414
<description>WePay Java SDK</description>

src/main/java/com/wepay/model/Preapproval.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import org.json.*;
77

8+
import com.wepay.WePay;
89
import com.wepay.net.WePayResource;
910
import com.wepay.exception.WePayException;
1011
import com.wepay.model.data.*;
@@ -101,6 +102,12 @@ public static Preapproval create(PreapprovalData data, String accessToken) throw
101102
params.put("transaction_rbits", new JSONArray(transactionRbitsJson));
102103
}
103104

105+
if (accessToken == null) {
106+
// app-level pre-approvals
107+
params.put("client_id", WePay.clientId);
108+
params.put("client_secret", WePay.clientSecret);
109+
}
110+
104111
Preapproval p = gson.fromJson(request("/preapproval/create", params, accessToken), Preapproval.class);
105112
p.preapprovalData = data;
106113
return p;

src/main/java/com/wepay/net/WePayResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, Stri
5555
connection.setRequestMethod("POST");
5656
connection.setRequestProperty("Content-Type", "application/json");
5757
connection.setRequestProperty("Api-Version", "2016-03-30");
58-
connection.setRequestProperty("User-Agent", "WePay Java SDK v5.1.0");
58+
connection.setRequestProperty("User-Agent", "WePay Java SDK v5.1.1");
5959
if (accessToken != null) {
6060
connection.setRequestProperty("Authorization", "Bearer " + accessToken);
6161
}

0 commit comments

Comments
 (0)