Skip to content

Commit af014a2

Browse files
authored
Merge pull request #43 from wepay/0713Update
updated to 07-13 API version
2 parents 9b6a187 + 67ce090 commit af014a2

File tree

9 files changed

+32
-9
lines changed

9 files changed

+32
-9
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2016-11-14
2+
* Released v6.1.0, updating API support to 2016-07-13
3+
* Several changes to the auto_capture and auto_release params, read the API changelog at https://developer.wepay.com/general/change-log
4+
* Since this is 2016-07-13 or later, this falls under the new api-version restrictions. This will not affect SDK users, but you may wish to be aware of them
5+
16
2016-08-15
27
* Released v6.0.0, updating API support to 2016-06-22
38
* Replaced "bank account" with "payment bank"

lib/wepay-2016-06-22.jar

55.3 KB
Binary file not shown.

lib/wepay.jar

15.6 KB
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>6.0.0</version>
11+
<version>6.1.0</version>
1212

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

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static Checkout create(CheckoutData data, String accessToken) throws JSON
9090
if (data.fee != null) params.put("fee", FeeData.build_fee(data.fee));
9191

9292
if (data.callbackUri != null) params.put("callback_uri", data.callbackUri);
93-
if (data.autoCapture != null) params.put("auto_capture", data.autoCapture);
93+
if (data.autoRelease != null) params.put("auto_release", data.autoRelease);
9494
if (data.referenceId != null) params.put("reference_id", data.referenceId);
9595
if (data.uniqueId != null) params.put("unique_id", data.uniqueId);
9696

@@ -186,14 +186,26 @@ public void refund(CheckoutRefundData refundData, String accessToken) throws JSO
186186
request("/checkout/refund", params, accessToken);
187187
if (this.checkoutData != null) this.checkoutData.refundReason = refundData.refundReason;
188188
}
189-
190-
public void capture(String accessToken) throws JSONException, IOException, WePayException {
189+
190+
191+
public void manualCapture(String accessToken) throws JSONException, IOException, WePayException {
191192
JSONObject params = new JSONObject();
192193
params.put("checkout_id", this.checkoutId);
193194
Checkout c = gson.fromJson((request("/checkout/capture", params, accessToken)), Checkout.class);
194195
this.state = c.state;
195196
}
196197

198+
/*
199+
* checkout/capture was renamed to checkout/release in the 2016-07-13 release
200+
*/
201+
202+
public void release(String accessToken) throws JSONException, IOException, WePayException {
203+
JSONObject params = new JSONObject();
204+
params.put("checkout_id", this.checkoutId);
205+
Checkout c = gson.fromJson((request("/checkout/release", params, accessToken)), Checkout.class);
206+
this.state = c.state;
207+
}
208+
197209
public Long getCheckoutId() {
198210
return checkoutId;
199211
}
@@ -303,8 +315,8 @@ public String getDeliveryType() {
303315
return checkoutData.deliveryType;
304316
}
305317

306-
public Boolean isAutoCapture() {
307-
return checkoutData.autoCapture;
318+
public Boolean isAutoRelease() {
319+
return checkoutData.autoRelease;
308320
}
309321

310322
public Boolean isRequireShipping() {

src/main/java/com/wepay/model/data/CheckoutData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class CheckoutData {
1313
public String type;
1414
public BigDecimal amount;
1515
public FeeData fee;
16-
public Boolean autoCapture;
16+
public Boolean autoRelease;
1717
public HostedCheckoutData hostedCheckout;
1818
public String deliveryType;
1919
public String cancelReason;

src/main/java/com/wepay/model/data/HostedCheckoutData.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class HostedCheckoutData {
1313
public ThemeObjectData themeObject;
1414
public String checkoutUri;
1515
public AddressData shippingAddress;
16+
public Boolean autoCapture;
1617

1718
public static JSONObject build_hosted_checkout(HostedCheckoutData info) throws JSONException {
1819
JSONObject o = new JSONObject();
@@ -24,6 +25,7 @@ public static JSONObject build_hosted_checkout(HostedCheckoutData info) throws J
2425
if (info.prefillInfo != null) o.put("prefill_info", PrefillInfoData.buildPrefillInfo(info.prefillInfo));
2526
if (info.fundingSources != null) o.put("funding_sources", info.fundingSources);
2627
if (info.themeObject != null) o.put("theme_object", ThemeObjectData.buildThemeObject(info.themeObject));
28+
if (info.autoCapture != null) {o.put("auto_capture", info.autoCapture);}
2729
return o;
2830
}
2931
}

src/main/java/com/wepay/model/data/PMCreditCardData.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
public class PMCreditCardData {
55
public Long id;
66
public CreditCardAdditionalData data;
7+
public Boolean autoCapture;
78

89
public JSONObject toJSON() throws JSONException {
910
JSONObject o = new JSONObject();
1011
o.put("id", id);
1112
if (data != null) {
1213
o.put("data", data.toJSON());
1314
}
15+
if (autoCapture != null) {
16+
o.put("auto_capture", autoCapture);
17+
}
1418
return o;
1519
}
1620
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, Stri
5454
connection.setDoInput(true);
5555
connection.setRequestMethod("POST");
5656
connection.setRequestProperty("Content-Type", "application/json");
57-
connection.setRequestProperty("Api-Version", "2016-06-22");
58-
connection.setRequestProperty("User-Agent", "WePay Java SDK v6.0.0");
57+
connection.setRequestProperty("Api-Version", "2016-07-13");
58+
connection.setRequestProperty("User-Agent", "WePay Java SDK v6.1.0");
5959
if (accessToken != null) {
6060
connection.setRequestProperty("Authorization", "Bearer " + accessToken);
6161
}

0 commit comments

Comments
 (0)