Skip to content

Fix app preapprovals #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 22, 2016
Merged
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
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2016-06-21
* Released v5.1.1
* Added support for app-level preapprovals
* Added accountReviewStatus to AccountStatusesObjectData

2016-04-15
* Released v5.1.0, updating API support to 2016-03-30
* Added support for several new data fields in /checkout: payment_error, non-profit org data, and bank information for ACH payments
Expand Down
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>5.1.0</version>
<version>5.1.1</version>

<name>wepay-java-sdk</name>
<description>WePay Java SDK</description>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/wepay/model/Preapproval.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.json.*;

import com.wepay.WePay;
import com.wepay.net.WePayResource;
import com.wepay.exception.WePayException;
import com.wepay.model.data.*;
Expand Down Expand Up @@ -101,6 +102,12 @@ public static Preapproval create(PreapprovalData data, String accessToken) throw
params.put("transaction_rbits", new JSONArray(transactionRbitsJson));
}

if (accessToken == null) {
// app-level pre-approvals
params.put("client_id", WePay.clientId);
params.put("client_secret", WePay.clientSecret);
}

Preapproval p = gson.fromJson(request("/preapproval/create", params, accessToken), Preapproval.class);
p.preapprovalData = data;
return p;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/wepay/net/WePayResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, Stri
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Api-Version", "2016-03-30");
connection.setRequestProperty("User-Agent", "WePay Java SDK v5.1.0");
connection.setRequestProperty("User-Agent", "WePay Java SDK v5.1.1");
if (accessToken != null) {
connection.setRequestProperty("Authorization", "Bearer " + accessToken);
}
Expand Down