diff --git a/pom.xml b/pom.xml index 6a6c4c6..3784552 100644 --- a/pom.xml +++ b/pom.xml @@ -93,13 +93,20 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.1.1 attach-javadocs jar + + false + false + 1.8 + http://docs.oracle.com/javase/7/docs/api/ http://docs.oracle.com/javase/7/docs/api/ + none + diff --git a/src/main/java/cc/protea/spreedly/Spreedly.java b/src/main/java/cc/protea/spreedly/Spreedly.java index e9edee3..8c7536b 100644 --- a/src/main/java/cc/protea/spreedly/Spreedly.java +++ b/src/main/java/cc/protea/spreedly/Spreedly.java @@ -1,5 +1,8 @@ package cc.protea.spreedly; +import cc.protea.spreedly.model.*; +import cc.protea.spreedly.model.internal.*; + import java.util.ArrayList; import java.util.List; @@ -387,5 +390,14 @@ public List listPaymentMethodTransactions(final Str public SpreedlyPaymentMethod update(final SpreedlyPaymentMethod paymentMethod) { return util.put("https://core.spreedly.com/v1/payment_methods/" + paymentMethod.token + ".xml", paymentMethod, SpreedlyPaymentMethod.class); } + + /** + * Completes a 3DS 2 transaction in the device fingerprint stage. + * For more details see https://docs.spreedly.com/guides/3dsecure2/ + * @param token transaction_token to complete + */ + public SpreedlyTransactionResponse complete(String token) { + return util.post("https://core.spreedly.com/v1/transactions/" + token + "/complete.xml", null, SpreedlyTransactionResponse.class); + } } diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyGatewayAccount.java b/src/main/java/cc/protea/spreedly/model/SpreedlyGatewayAccount.java index d532e87..6da7e6e 100644 --- a/src/main/java/cc/protea/spreedly/model/SpreedlyGatewayAccount.java +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyGatewayAccount.java @@ -32,6 +32,9 @@ public class SpreedlyGatewayAccount { @XmlElement(name = "created_at") public Date createdOn; @XmlElement(name = "updated_at") public Date updatedOn; @XmlElement(name = "description") public String description; + public String mode; + public boolean sandbox; + public String getToken() { return token; } @@ -105,4 +108,19 @@ public void setDescription(final String description) { this.description = description; } + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } + + public boolean isSandbox() { + return sandbox; + } + + public void setSandbox(boolean sandbox) { + this.sandbox = sandbox; + } } \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java index da7d43e..2bcbc7c 100644 --- a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java @@ -91,6 +91,16 @@ public class SpreedlyTransactionRequest { */ @XmlElement(name = "callback_url") public String callbackUrl; + /** + * Browser info collected for 3ds. Please see https://docs.spreedly.com/guides/3dsecure2/ for more info + */ + @XmlElement(name = "browser_info") public String browserInfo; + + /** + * Set to 2 to use 3DS2. Please see https://docs.spreedly.com/guides/3dsecure2/ for more info + */ + @XmlElement(name = "three_ds_version") public String threeDsVersion; + /** * @return A unique string generated by Spreedly to identify a gateway. */ @@ -284,8 +294,9 @@ public boolean isAttempt3dSecure() { /** * @param attempt3dSecure true if the system should use a multi-stage 3D Secure workflow. See https://docs.spreedly.com/guides/3dsecure/ for instructions. */ - public void setAttempt3dSecure(final boolean attempt3dSecure) { + public SpreedlyTransactionRequest setAttempt3dSecure(final boolean attempt3dSecure) { this.attempt3dSecure = attempt3dSecure; + return this; } /** * @return See https://docs.spreedly.com/guides/3dsecure/ for instructions. @@ -296,8 +307,9 @@ public String getRedirectUrl() { /** * @param redirectUrl See https://docs.spreedly.com/guides/3dsecure/ for instructions. */ - public void setRedirectUrl(final String redirectUrl) { + public SpreedlyTransactionRequest setRedirectUrl(final String redirectUrl) { this.redirectUrl = redirectUrl; + return this; } /** * The callback url will receive a POST back of all transactions that have changed since the last callback. @@ -314,10 +326,28 @@ public String getCallbackUrl() { * it will retry the callback again at least 4 times at ever-increasing intervals. * @param callbackUrl */ - public void setCallbackUrl(final String callbackUrl) { + public SpreedlyTransactionRequest setCallbackUrl(final String callbackUrl) { this.callbackUrl = callbackUrl; + return this; } + public String getBrowserInfo() + { + return browserInfo; + } + public void setBrowserInfo(String browserInfo) + { + this.browserInfo = browserInfo; + } + public String getThreeDsVersion() + { + return threeDsVersion; + } + + public void setThreeDsVersion(String threeDsVersion) + { + this.threeDsVersion = threeDsVersion; + } } diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java index d746e86..8732eff 100644 --- a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java @@ -1,17 +1,16 @@ package cc.protea.spreedly.model; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import cc.protea.spreedly.model.internal.SpreedlyErrorSetting; +import cc.protea.spreedly.model.internal.SpreedlyNestedMapAdapter; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import cc.protea.spreedly.model.internal.SpreedlyErrorSetting; -import cc.protea.spreedly.model.internal.SpreedlyNestedMapAdapter; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; @XmlRootElement(name = "transaction") @XmlAccessorType(XmlAccessType.FIELD) @@ -117,7 +116,24 @@ public class SpreedlyTransactionResponse implements SpreedlyErrorSetting { @XmlElement(name = "setup_response") public SpreedlyTransactionResponseDetails setupResponse; @XmlElement(name = "redirect_response") public SpreedlyTransactionResponseDetails redirectResponse; @XmlElement(name = "callback_response") public SpreedlyTransactionResponseDetails callbackResponse; - + + /** + * The required action in the 3DS 2 flow, e.g., none, device_fingerprint, challenge, etc + * See https://docs.spreedly.com/guides/3dsecure2/ for more information. + */ + @XmlElement(name = "required_action") public String requiredAction; + + + /** + * The device fingerprint form to render in case that the required_action is device_fingerprint. + * See https://docs.spreedly.com/guides/3dsecure2/ for more information. + */ + @XmlElement(name = "device_fingerprint_form") public String deviceFingerprintForm; + + @XmlElement(name = "challenge_url") public String challengeUrl; + + @XmlElement(name = "challenge_form") public String challengeForm; + /** * @return Any positive whole number, for example 1234 = $12.34. */ @@ -534,5 +550,48 @@ public SpreedlyTransactionResponse setShippingAddress(SpreedlyShippingAddress sh this.shippingAddress = shippingAddress; return this; } - + + public String getRequiredAction() + { + return requiredAction; + } + + public SpreedlyTransactionResponse setRequiredAction(String requiredAction) + { + this.requiredAction = requiredAction; + return this; + } + + public String getDeviceFingerprintForm() + { + return deviceFingerprintForm; + } + + public SpreedlyTransactionResponse setDeviceFingerprintForm(String deviceFingerprintForm) + { + this.deviceFingerprintForm = deviceFingerprintForm; + return this; + } + + public String getChallengeUrl() + { + return challengeUrl; + } + + public SpreedlyTransactionResponse setChallengeUrl(String challengeUrl) + { + this.challengeUrl = challengeUrl; + return this; + } + + public String getChallengeForm() + { + return challengeForm; + } + + public SpreedlyTransactionResponse setChallengeForm(String challengeForm) + { + this.challengeForm = challengeForm; + return this; + } } diff --git a/src/main/java/cc/protea/spreedly/model/internal/SpreedlyGatewayAccountUpdate.java b/src/main/java/cc/protea/spreedly/model/internal/SpreedlyGatewayAccountUpdate.java index 4226e8c..747816e 100644 --- a/src/main/java/cc/protea/spreedly/model/internal/SpreedlyGatewayAccountUpdate.java +++ b/src/main/java/cc/protea/spreedly/model/internal/SpreedlyGatewayAccountUpdate.java @@ -17,6 +17,9 @@ public class SpreedlyGatewayAccountUpdate { DocumentBuilder documentBuilder; + + @XmlElement(name = "mode") + public String mode; public SpreedlyGatewayAccountUpdate() { try { @@ -28,6 +31,7 @@ public SpreedlyGatewayAccountUpdate() { public SpreedlyGatewayAccountUpdate(final SpreedlyGatewayAccount in) { this.gatewayType = in.gatewayType; + this.mode = in.getMode(); for (SpreedlyGatewayCredential credential : in.credentials) { SpreedlyInternalKeyValuePair pair = new SpreedlyInternalKeyValuePair(); pair.key = credential.name; diff --git a/target/test-classes/SpreedlyTransactionResponse.xml b/target/test-classes/SpreedlyTransactionResponse.xml deleted file mode 100644 index 5a58200..0000000 --- a/target/test-classes/SpreedlyTransactionResponse.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 80 - true - 2014-11-11T01:08:44Z - 2014-11-11T01:08:44Z - USD - true - succeeded - 1vcqQrU0d9f4NB5vdnx5wsoaAss - PurchaseViaReference - - - - - - - - - Y - - - - - wax@example.com - Waxillium - Ladrian - 3911 Main Street - Apartment 3 - Wanaque - NJ - 28592-8851 - US - - - 61 - Succeeded! - 8XJtbE1p4NTZ6fFqwwn0GrkjEmW - - true - Successful purchase - - - - - false - - - false - 2014-11-11T01:08:44Z - 2014-11-11T01:08:44Z - - KL7jgc4iy3MSMXfmqUNLVSHXmxN - - - \ No newline at end of file