Skip to content

Commit bad9731

Browse files
Merge pull request #56 from wepay/feature-version-2018-08-29
Released v10.1.0, updating API support to 2018-08-29
2 parents 1516505 + abbb594 commit bad9731

File tree

9 files changed

+94
-12
lines changed

9 files changed

+94
-12
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2018-09-25
2+
* Released v10.1.0, updating API support to 2018-08-29
3+
* Added PaymentMethodData.inlineCreditCard
4+
* Added PMInlineCreditCardData type
5+
* Added WePayException.details, WePayException.documentationUrl and ErrorDetail class to support new fields in error responses
6+
17
2018-09-24
28
* Released v10.0.0
39
* Added support for AccountBalancesObjectData.withdrawalType, UserData.type

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ WePay-Java-SDK
33

44
Note
55
================================
6-
This WePay-Java-SDK is for <a href = "https://www.wepay.com/developer/version/2016-12-07">WePay Api Version 2018-03-21</a>. The jar for the previous API versions can be found in the lib folder.
6+
This WePay-Java-SDK is for WePay API Version 2018-08-29. The jars for the previous API versions can be found in the lib folder.
77

88
Building
99
================================

lib/wepay-2018-03-21.jar

345 KB
Binary file not shown.

lib/wepay.jar

1.97 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>10.0.0</version>
11+
<version>10.1.0</version>
1212

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

src/main/java/com/wepay/exception/WePayException.java

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,68 @@
11
package com.wepay.exception;
22

33
import com.wepay.net.WePayResource;
4+
import java.util.List;
45

56
public class WePayException extends Exception {
6-
7+
8+
private class ErrorDetail {
9+
private List<String> target;
10+
private String targetType;
11+
private String reasonCode;
12+
private String message;
13+
14+
public List<String> getTarget() {
15+
return target;
16+
}
17+
18+
public String getTargetType() {
19+
return targetType;
20+
}
21+
22+
public String getReasonCode() {
23+
return reasonCode;
24+
}
25+
26+
public String getMessage() {
27+
return message;
28+
}
29+
30+
}
31+
732
private String error;
833
private String errorDescription;
934
private Integer errorCode;
10-
35+
private List<ErrorDetail> details;
36+
private String documentationUrl;
37+
1138
public WePayException(String message) {
1239
super(message);
1340
}
14-
41+
1542
public WePayException(String message, Throwable throwable) {
1643
super(message, throwable);
1744
}
18-
45+
1946
public String getError() {
2047
return error;
2148
}
22-
49+
2350
public String getErrorDescription() {
2451
return errorDescription;
2552
}
26-
53+
2754
public Integer getErrorCode() {
2855
return errorCode;
2956
}
30-
57+
58+
public List<ErrorDetail> getDetails() {
59+
return details;
60+
}
61+
62+
public String getDocumentationUrl() {
63+
return documentationUrl;
64+
}
65+
3166
public String getMessage() {
3267
return WePayResource.gson.toJson(this);
3368
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.wepay.model.data;
2+
3+
import org.json.JSONException;
4+
import org.json.JSONObject;
5+
6+
public class PMInlineCreditCardData {
7+
public String ccNumber;
8+
public Integer expirationMonth;
9+
public Integer expirationYear;
10+
public String userName;
11+
public AddressData address;
12+
public String cvv;
13+
public String email;
14+
public String referenceID;
15+
public Boolean autoUpdate;
16+
public String callbackUri;
17+
public String virtualTerminal;
18+
public Boolean paymentRequestFlag;
19+
public Boolean autoCapture;
20+
21+
public JSONObject toJSON() throws JSONException{
22+
JSONObject o = new JSONObject();
23+
o.put("cc_number", ccNumber);
24+
o.put("expiration_month", expirationMonth);
25+
o.put("expiration_year", expirationYear);
26+
o.put("user_name", userName);
27+
o.put("address", AddressData.buildUnifiedAddress(address));
28+
o.put("cvv", cvv);
29+
o.put("email", email);
30+
o.put("reference_id", referenceID);
31+
o.put("auto_update", autoUpdate);
32+
o.put("callback_uri", callbackUri);
33+
o.put("virtual_terminal", virtualTerminal);
34+
o.put("payment_request_flag", paymentRequestFlag);
35+
o.put("auto_capture", autoCapture);
36+
37+
return o;
38+
}
39+
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ public class PaymentMethodData {
77
public PMCreditCardData creditCard;
88
public PMPreapprovalData preapproval;
99
public PMPaymentBankData paymentBank;
10+
public PMInlineCreditCardData inlineCreditCard;
1011

1112

1213
public JSONObject toJSON() throws JSONException {
1314
JSONObject o = new JSONObject();
1415
o.put("type", type);
15-
if (creditCard != null) o.put("credit_card", creditCard.toJSON()); // Only one of credit card, preapproval, or bank account can be present
16+
if (creditCard != null) o.put("credit_card", creditCard.toJSON()); // Only one of credit card, preapproval, bank account, inline credit card can be present
1617
else if (preapproval != null) o.put("preapproval", preapproval.toJSON());
1718
else if (paymentBank != null) o.put("payment_bank", paymentBank.toJSON());
19+
else if (inlineCreditCard != null) o.put("inline_credit_card", inlineCreditCard.toJSON());
1820
return o;
1921
}
2022
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ protected static javax.net.ssl.HttpsURLConnection httpsConnect(String call, Head
5555
connection.setDoInput(true);
5656
connection.setRequestMethod("POST");
5757
connection.setRequestProperty("Content-Type", "application/json");
58-
connection.setRequestProperty("Api-Version", "2018-03-21");
59-
connection.setRequestProperty("User-Agent", "WePay Java SDK v10.0.0");
58+
connection.setRequestProperty("Api-Version", "2018-08-29");
59+
connection.setRequestProperty("User-Agent", "WePay Java SDK v10.1.0");
6060

6161
if (headerData != null) {
6262
if (headerData.accessToken != null) {

0 commit comments

Comments
 (0)