Skip to content

Commit

Permalink
Upgrade Jackson to v2 and set ObjectMapper to case insensitive
Browse files Browse the repository at this point in the history
Fixes an issue on some systems where the case of fields in Rapid does not
match the properties of the object
  • Loading branch information
incarnate committed Apr 21, 2017
1 parent 87c2cb8 commit b0f9235
Show file tree
Hide file tree
Showing 38 changed files with 148 additions and 130 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All Notable changes will be documented in this file

## 1.3.0

- Updated SDK to use TLS 1.2 when connecting to eWAY
- Updated Jackson (JSON library) to version 2

## 1.2.0

- Added ability to set the Rapid API version and new associated fields
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ A Java library to integrate with eWAY's Rapid Payment API.
Sign up with eWAY at:
- Australia: https://www.eway.com.au/
- New Zealand: https://eway.io/nz/
- UK: https://eway.io/uk/
- Hong Kong: https://eway.io/hk/
- Malaysia: https://eway.io/my/
- Singapore: https://eway.io/sg/
Expand Down
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.ewaypayments</groupId>
<artifactId>eway-rapid-java</artifactId>
<version>1.2.0</version>
<version>1.3.0</version>
<packaging>jar</packaging>

<name>eWAY Rapid API Library</name>
Expand Down Expand Up @@ -67,10 +67,11 @@
<version>4.12</version>
</dependency>
<!-- Jersey JSON Jackson (2.x) entity providers support module -->
<!---->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.8</version>
<version>2.25.1</version>
</dependency>
<!-- Apache Commons Validator provides the building blocks for both client
side validation and server side data validation. It may be used standalone
Expand All @@ -96,7 +97,12 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.0</version>
<version>2.6.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.7</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.eway.payment.rapid.sdk.beans.external;

import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

/**
* Card Details
Expand Down Expand Up @@ -32,7 +33,7 @@ public String getName() {
*
* @param name Name on the card
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("Name")
public void setName(String name) {
this.name = name;
Expand All @@ -53,7 +54,7 @@ public String getNumber() {
*
* @param number Number on the credit card
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("Number")
public void setNumber(String number) {
this.number = number;
Expand All @@ -74,7 +75,7 @@ public String getExpiryMonth() {
*
* @param expiryMonth Card expiry month
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("ExpiryMonth")
public void setExpiryMonth(String expiryMonth) {
if (expiryMonth != null && expiryMonth.length() == 1) {
Expand All @@ -97,7 +98,7 @@ public String getExpiryYear() {
*
* @param expiryYear Card expiry year
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("ExpiryYear")
public void setExpiryYear(String expiryYear) {
this.expiryYear = expiryYear;
Expand All @@ -117,7 +118,7 @@ public String getStartMonth() {
*
* @param startMonth Card start month
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("StartMonth")
public void setStartMonth(String startMonth) {
this.startMonth = startMonth;
Expand All @@ -137,7 +138,7 @@ public String getStartYear() {
*
* @param startYear Card start year
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("StartYear")
public void setStartYear(String startYear) {
this.startYear = startYear;
Expand All @@ -157,7 +158,7 @@ public String getIssueNumber() {
*
* @param issueNumber Card issue number
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("IssueNumber")
public void setIssueNumber(String issueNumber) {
this.issueNumber = issueNumber;
Expand All @@ -177,7 +178,7 @@ public String getCVN() {
*
* @param CVN Card verification number
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CVN")
public void setCVN(String CVN) {
this.CVN = CVN;
Expand All @@ -197,7 +198,7 @@ public int getCardType() {
*
* @param cardType Card Type
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardType")
public void setCardType(int cardType) {
this.cardType = cardType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.eway.payment.rapid.sdk.beans.external;

import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Contains line item information
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

public class BeagleVerification {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import com.eway.payment.rapid.sdk.beans.external.CardDetails;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Customer {
Expand Down Expand Up @@ -66,42 +67,42 @@ public class Customer {
@JsonProperty("Url")
private String url;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardNumber")
private String cardNumber;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardStartMonth")
private String cardStartMonth;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardStartYear")
private String cardStartYear;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardIssueNumber")
private String cardIssueNumber;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardName")
private String cardName;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardExpiryMonth")
private Integer cardExpiryMonth;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardExpiryYear")
private Integer cardExpiryYear;

@JsonProperty("IsActive")
private String isActive;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CardDetails")
private CardDetails cardDetails;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(Include.NON_NULL)
@JsonProperty("CustomerIP")
private String customerDeviceIP;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

public class Option {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Contains payment information
*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Payment {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.apache.commons.lang3.StringUtils;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RefundDetails {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ShippingAddress {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Transaction {
Expand Down Expand Up @@ -46,11 +46,11 @@ public class Transaction {
@JsonProperty("Verification")
private Verification verification;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("Customer")
private Customer customer;

@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("ShippingAddress")
private ShippingAddress shippingAddress;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.eway.payment.rapid.sdk.beans.internal;

import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

public class Verification {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.eway.payment.rapid.sdk.entities;

import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

public class CancelAuthorisationRequest extends Request {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.eway.payment.rapid.sdk.entities;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Response object for a Cancel Authorisation request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.eway.payment.rapid.sdk.entities;

import com.eway.payment.rapid.sdk.beans.internal.Payment;
import org.codehaus.jackson.annotate.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty;

public class CapturePaymentRequest extends Request {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
package com.eway.payment.rapid.sdk.entities;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Response object from capturing a payment
*/
@SuppressWarnings("restriction")
@XmlRootElement(name = "CapturePaymentResponse")
@JsonIgnoreProperties(ignoreUnknown = true)
public class CapturePaymentResponse extends Response {

@XmlElement(name = "ResponseCode")
@JsonProperty("ResponseCode")
private String responseCode;

@XmlElement(name = "ResponseMessage")
@JsonProperty("ResponseMessage")
private String responseMessage;

@XmlElement(name = "TransactionID")
@JsonProperty("TransactionID")
private String transactionID;

@XmlElement(name = "TransactionStatus")
@JsonProperty("TransactionStatus")
private Boolean transactionStatus;

@XmlElement(name = "Errors")
@JsonProperty("Errors")
private String errors;

/**
Expand Down
Loading

0 comments on commit b0f9235

Please sign in to comment.