diff --git a/pom.xml b/pom.xml index 6a6c4c6..2e6b15b 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,8 @@ UTF-8 + 1.8 + 1.8 @@ -58,7 +60,11 @@ http [0.2,) - + + javax.xml.bind + jaxb-api + 2.3.0 + @@ -93,13 +99,23 @@ 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 + @@ -148,5 +164,4 @@ https://oss.sonatype.org/content/repositories/snapshots - diff --git a/src/main/java/cc/protea/spreedly/Spreedly.java b/src/main/java/cc/protea/spreedly/Spreedly.java index e9edee3..605a887 100644 --- a/src/main/java/cc/protea/spreedly/Spreedly.java +++ b/src/main/java/cc/protea/spreedly/Spreedly.java @@ -1,5 +1,7 @@ package cc.protea.spreedly; +import cc.protea.spreedly.model.*; + import java.util.ArrayList; import java.util.List; @@ -387,5 +389,37 @@ 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, SpreedlyCompleteRequest request) { + return util.post("https://core.spreedly.com/v1/transactions/" + token + "/complete.xml", request, SpreedlyTransactionResponse.class); + } + + /** + * Create an SCA Provider on the given Merchant Profile. An SCA Provider can be used to run 3DS2 Global + * authentications on the authenticate endpoint or as part of authorize and purchase transactions. + */ + public SpreedlyMerchantProfile create(final SpreedlyMerchantProfileRequest request) { + return util.post("https://core.spreedly.com/v1/merchant_profiles.xml", request, SpreedlyMerchantProfile.class); + } + + /** + * Adds a gateway account to the authenticated environment. One gateway account is required for each set of merchant account + * credentials. Spreedly stores and protects the credentials to be used to authenticate with gateway accounts for + * transaction processing. + */ + public SpreedlyScaProvider create(final SpreedlyScaProviderRequest request) { + return util.post("https://core.spreedly.com/v1/sca/providers.xml", request, SpreedlyScaProvider.class); + } + /** + * Authenticate a given payment method and amount against provided SCA Provider Key (specified in request URL). + */ + public SpreedlyScaAuthenticationResponse authenticateScaProvider(String scaProviderKey , final SpreedlyTransactionRequest request) { + return util.post("https://core.spreedly.com/v1/sca/providers/" + scaProviderKey + "/authenticate.xml", request, SpreedlyScaAuthenticationResponse.class); + } } diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyAmexDetails.java b/src/main/java/cc/protea/spreedly/model/SpreedlyAmexDetails.java new file mode 100644 index 0000000..6373e61 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyAmexDetails.java @@ -0,0 +1,28 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "amex") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyAmexDetails { + + @XmlElement(name = "acquirer_bin") public String acquirerBin; + @XmlElement(name = "merchant_url") public String merchantUrl; + + public String getAcquirerBin() { + return acquirerBin; + } + + public void setAcquirerBin(String acquirerBin) { + this.acquirerBin = acquirerBin; + } + + public String getMerchantUrl() { + return merchantUrl; + } + + public void setMerchantUrl(String merchantUrl) { + this.merchantUrl = merchantUrl; + } + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyAmexNetwork.java b/src/main/java/cc/protea/spreedly/model/SpreedlyAmexNetwork.java new file mode 100644 index 0000000..821bb6a --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyAmexNetwork.java @@ -0,0 +1,48 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "amex") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyAmexNetwork { + + @XmlElement(name = "acquirer_merchant_id") public String acquirerMerchantId; + @XmlElement(name = "country_code") public Long countryCode; + @XmlElement(name = "mcc") public Long mcc; + @XmlElement(name = "merchant_name") public String name; + + public String getAcquirerMerchantId() { + return acquirerMerchantId; + } + + public void setAcquirerMerchantId(String acquirerMerchantId) { + this.acquirerMerchantId = acquirerMerchantId; + } + + public Long getCountryCode() { + return countryCode; + } + + public void setCountryCode(Long countryCode) { + this.countryCode = countryCode; + } + + public Long getMcc() { + return mcc; + } + + public void setMcc(Long mcc) { + this.mcc = mcc; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyCompleteRequest.java b/src/main/java/cc/protea/spreedly/model/SpreedlyCompleteRequest.java new file mode 100644 index 0000000..44c9251 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyCompleteRequest.java @@ -0,0 +1,57 @@ +package cc.protea.spreedly.model; + +import java.util.ArrayList; +import java.util.List; +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.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = {"entry"}) +@XmlRootElement(name = "context") +public class SpreedlyCompleteRequest { + + protected List entry; + + + public List getEntry() { + if (entry == null) { + entry = new ArrayList(); + } + return this.entry; + } + + public void setEntry(List entry) { + this.entry = entry; + } + + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = {"key", "value"}) + public static class Entry { + + @XmlElement(required = true) + protected String key; + @XmlElement(required = true) + protected Object value; + + public String getKey() { + return key; + } + + public void setKey(String value) { + this.key = value; + } + + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + } + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyCreditNetwork.java b/src/main/java/cc/protea/spreedly/model/SpreedlyCreditNetwork.java new file mode 100644 index 0000000..70751d0 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyCreditNetwork.java @@ -0,0 +1,41 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "card_networks") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyCreditNetwork { + + @XmlElement(name = "visa") + public SpreedlyVisaNetwork visa; + @XmlElement(name = "mastercard") + public SpreedlyMastercardNetwork mastercard; + @XmlElement(name = "amex") + public SpreedlyAmexNetwork amex; + + public SpreedlyVisaNetwork getVisa() { + return visa; + } + + public void setVisa(SpreedlyVisaNetwork visa) { + this.visa = visa; + } + + public SpreedlyMastercardNetwork getMastercard() { + return mastercard; + } + + public void setMastercard(SpreedlyMastercardNetwork mastercard) { + this.mastercard = mastercard; + } + + public SpreedlyAmexNetwork getAmex() { + return amex; + } + + public void setAmex(SpreedlyAmexNetwork amex) { + this.amex = amex; + } + + +} \ No newline at end of file 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/SpreedlyMastercardDetails.java b/src/main/java/cc/protea/spreedly/model/SpreedlyMastercardDetails.java new file mode 100644 index 0000000..17247d9 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyMastercardDetails.java @@ -0,0 +1,29 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "mastercard") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyMastercardDetails { + + @XmlElement(name = "acquirer_bin") public String acquirerBin; + @XmlElement(name = "merchant_url") public String merchantUrl; + + public String getAcquirerBin() { + return acquirerBin; + } + + public void setAcquirerBin(String acquirerBin) { + this.acquirerBin = acquirerBin; + } + + public String getMerchantUrl() { + return merchantUrl; + } + + public void setMerchantUrl(String merchantUrl) { + this.merchantUrl = merchantUrl; + } + + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyMastercardNetwork.java b/src/main/java/cc/protea/spreedly/model/SpreedlyMastercardNetwork.java new file mode 100644 index 0000000..b78698c --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyMastercardNetwork.java @@ -0,0 +1,48 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "mastercard") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyMastercardNetwork { + + @XmlElement(name = "acquirer_merchant_id") public String acquirerMerchantId; + @XmlElement(name = "country_code") public Long countryCode; + @XmlElement(name = "mcc") public Long mcc; + @XmlElement(name = "merchant_name") public String name; + + public String getAcquirerMerchantId() { + return acquirerMerchantId; + } + + public void setAcquirerMerchantId(String acquirerMerchantId) { + this.acquirerMerchantId = acquirerMerchantId; + } + + public Long getCountryCode() { + return countryCode; + } + + public void setCountryCode(Long countryCode) { + this.countryCode = countryCode; + } + + public Long getMcc() { + return mcc; + } + + public void setMcc(Long mcc) { + this.mcc = mcc; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfile.java b/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfile.java new file mode 100644 index 0000000..cab0404 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfile.java @@ -0,0 +1,44 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@XmlRootElement(name = "merchant_profile") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyMerchantProfile { + @XmlElement(name = "description") public String description; + @XmlElement(name = "token") public String token; + @XmlElement(name = "card_networks") + SpreedlyCreditNetwork creditNetwork; + @XmlElement(name = "created_at") public Date createdOn; + @XmlElement(name = "updated_at") public Date updatedOn; + + + public SpreedlyCreditNetwork getCreditNetwork() { + return creditNetwork; + } + public void setCreditNetwork(SpreedlyCreditNetwork creditNetwork) { + this.creditNetwork = creditNetwork; + } + public Date getCreatedOn() { + return createdOn; + } + public void setCreatedOn(final Date createdOn) { + this.createdOn = createdOn; + } + public Date getUpdatedOn() { + return updatedOn; + } + public void setUpdatedOn(final Date updatedOn) { + this.updatedOn = updatedOn; + } + public String getDescription() { + return description; + } + public void setDescription(final String description) { + this.description = description; + } + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfileRequest.java b/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfileRequest.java new file mode 100644 index 0000000..3e20472 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyMerchantProfileRequest.java @@ -0,0 +1,47 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "merchant_profile") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyMerchantProfileRequest { + @XmlElement(name = "description") + public String description; + @XmlElement(name = "amex") + public SpreedlyAmexNetwork amex; + @XmlElement(name = "visa") + public SpreedlyVisaNetwork visa; + @XmlElement(name = "mastercard") + public SpreedlyMastercardNetwork mastercard; + + public SpreedlyAmexNetwork getAmex() { + return amex; + } + + public void setAmex(SpreedlyAmexNetwork amex) { + this.amex = amex; + } + + public SpreedlyVisaNetwork getVisa() { + return visa; + } + + public void setVisa(SpreedlyVisaNetwork visa) { + this.visa = visa; + } + + public SpreedlyMastercardNetwork getMastercard() { + return mastercard; + } + + public void setMastercard(SpreedlyMastercardNetwork mastercard) { + this.mastercard = mastercard; + } + + public String getDescription() { + return description; + } + public void setDescription(final String description) { + this.description = description; + } +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyScaAuthenticationResponse.java b/src/main/java/cc/protea/spreedly/model/SpreedlyScaAuthenticationResponse.java new file mode 100644 index 0000000..2df30d0 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyScaAuthenticationResponse.java @@ -0,0 +1,110 @@ +package cc.protea.spreedly.model; + +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 java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@XmlRootElement(name = "transaction") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyScaAuthenticationResponse implements SpreedlyErrorSetting { + + /** + * Any positive whole number, for example 1234 = $12.34. + */ + @XmlElement(name = "amount") public Integer amountInCents; + /** + * Date and time of origination. + */ + @XmlElement(name = "created_at") public Date createdOn; + /** + * ISO 4217 Currency Code e.g., USD, MXN, EUR + */ + @XmlElement(name = "currency_code") public String currencyCode; + /** + * true if transaction was successful. + */ + public boolean succeeded; + /** + * The token uniquely identifying the transaction at Spreedly. + * This token can be passed into an authorize or purchase transaction via the sca_authentication_token field to automatically fill its payment_method_token and Third Party 3DS2 fields. + */ + public String token; + /** + * SCA Provider token that performs a Spreedly 3DS2 Global authentication before attempting the gateway transaction. + * Please see our Spreedly 3DS2 Global Guide for more info. + */ + @XmlElement(name = "sca_provider_key") public String scaProviderKey; + + public SpreedlyMessage message; + + public Integer getAmountInCents() { + return amountInCents; + } + + public void setAmountInCents(Integer amountInCents) { + this.amountInCents = amountInCents; + } + + public Date getCreatedOn() { + return createdOn; + } + + public void setCreatedOn(Date createdOn) { + this.createdOn = createdOn; + } + + public String getCurrencyCode() { + return currencyCode; + } + + public void setCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + } + + public boolean isSucceeded() { + return succeeded; + } + + public void setSucceeded(boolean succeeded) { + this.succeeded = succeeded; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getScaProviderKey() { + return scaProviderKey; + } + + public void setScaProviderKey(String scaProviderKey) { + this.scaProviderKey = scaProviderKey; + } + + public SpreedlyMessage getMessage() { + return message; + } + public SpreedlyScaAuthenticationResponse setMessage(final SpreedlyMessage message) { + this.message = message; + return this; + } + + public void setError(final String key, final String error) { + message = new SpreedlyMessage(); + message.key = key; + message.message = error; + this.succeeded = false; + } +} diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyScaProvider.java b/src/main/java/cc/protea/spreedly/model/SpreedlyScaProvider.java new file mode 100644 index 0000000..2ec3013 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyScaProvider.java @@ -0,0 +1,80 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; +import java.util.Date; + +@XmlRootElement(name = "sca_provider") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyScaProvider { + + @XmlElement(name = "token") public String token; + @XmlElement(name = "type") public String type ; + @XmlElement(name = "created_at") public Date createdOn; + @XmlElement(name = "updated_at") public Date updatedOn; + @XmlElement(name = "visa") + public SpreedlyVisaDetails visa; + @XmlElement(name = "mastercard") + public SpreedlyMastercardDetails mastercard; + @XmlElement(name = "amex") + public SpreedlyAmexDetails amex; + + public String getType() { + return type; + } + + public String isType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public SpreedlyVisaDetails getVisa() { + return visa; + } + + public void setVisa(SpreedlyVisaDetails visa) { + this.visa = visa; + } + + public SpreedlyMastercardDetails getMastercard() { + return mastercard; + } + + public void setMastercard(SpreedlyMastercardDetails mastercard) { + this.mastercard = mastercard; + } + + public SpreedlyAmexDetails getAmex() { + return amex; + } + + public void setAmex(SpreedlyAmexDetails amex) { + this.amex = amex; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + + + public Date getCreatedOn() { + return createdOn; + } + public void setCreatedOn(final Date createdOn) { + this.createdOn = createdOn; + } + public Date getUpdatedOn() { + return updatedOn; + } + public void setUpdatedOn(final Date updatedOn) { + this.updatedOn = updatedOn; + } + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyScaProviderRequest.java b/src/main/java/cc/protea/spreedly/model/SpreedlyScaProviderRequest.java new file mode 100644 index 0000000..6e5eb7c --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyScaProviderRequest.java @@ -0,0 +1,67 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "sca_provider") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyScaProviderRequest { + + @XmlElement(name = "merchant_profile_key") public String merchantProfileKey; + @XmlElement(name = "type") public String type; + @XmlElement(name = "sandbox") public boolean sandbox = false; + @XmlElement(name = "visa") + public SpreedlyVisaDetails visa; + @XmlElement(name = "mastercard") + public SpreedlyMastercardDetails mastercard; + @XmlElement(name = "amex") + public SpreedlyAmexDetails amex; + + public String getMerchantProfileKey() { + return merchantProfileKey; + } + + public void setMerchantProfileKey(String merchantProfileKey) { + this.merchantProfileKey = merchantProfileKey; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public boolean getSandbox() { + return sandbox; + } + + public void setSandbox(boolean sandbox) { + this.sandbox = sandbox; + } + + public SpreedlyVisaDetails getVisa() { + return visa; + } + + public void setVisa(SpreedlyVisaDetails visa) { + this.visa = visa; + } + + public SpreedlyMastercardDetails getMastercard() { + return mastercard; + } + + public void setMastercard(SpreedlyMastercardDetails mastercard) { + this.mastercard = mastercard; + } + + public SpreedlyAmexDetails getAmex() { + return amex; + } + + public void setAmex(SpreedlyAmexDetails amex) { + this.amex = amex; + } + +} \ 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..a130e6d 100644 --- a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionRequest.java @@ -91,6 +91,27 @@ 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; + + /** + * The token received in response body of SCA Authenticate endpoint when performing an SCA Authentication on a specified payment method. + */ + @XmlElement(name = "sca_authentication_token") public String scaAuthenticationToken; + + /** + * SCA Provider token that performs a Spreedly 3DS2 Global authentication before attempting the gateway transaction. + * Please see our Spreedly 3DS2 Global Guide for more info. + */ + @XmlElement(name = "sca_provider_key") public String scaProviderKey; + /** * @return A unique string generated by Spreedly to identify a gateway. */ @@ -284,8 +305,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 +318,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 +337,44 @@ 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; + } + + public String getScaAuthenticationToken() { + return scaAuthenticationToken; + } + public void setScaAuthenticationToken(String scaAuthenticationToken) { + this.scaAuthenticationToken = scaAuthenticationToken; + } + public String getScaProviderKey() { + return scaProviderKey; + } + + public void setScaProviderKey(String scaProviderKey) { + this.scaProviderKey = scaProviderKey; + } } diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java b/src/main/java/cc/protea/spreedly/model/SpreedlyTransactionResponse.java index d746e86..3d61d55 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,6 +116,23 @@ 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/SpreedlyVisaDetails.java b/src/main/java/cc/protea/spreedly/model/SpreedlyVisaDetails.java new file mode 100644 index 0000000..9456c4a --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyVisaDetails.java @@ -0,0 +1,28 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "visa") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyVisaDetails { + + @XmlElement(name = "acquirer_bin") public String acquirerBin; + @XmlElement(name = "merchant_url") public String merchantUrl; + + public String getAcquirerBin() { + return acquirerBin; + } + + public void setAcquirerBin(String acquirerBin) { + this.acquirerBin = acquirerBin; + } + + public String getMerchantUrl() { + return merchantUrl; + } + + public void setMerchantUrl(String merchantUrl) { + this.merchantUrl = merchantUrl; + } + +} \ No newline at end of file diff --git a/src/main/java/cc/protea/spreedly/model/SpreedlyVisaNetwork.java b/src/main/java/cc/protea/spreedly/model/SpreedlyVisaNetwork.java new file mode 100644 index 0000000..9665cd8 --- /dev/null +++ b/src/main/java/cc/protea/spreedly/model/SpreedlyVisaNetwork.java @@ -0,0 +1,48 @@ +package cc.protea.spreedly.model; + +import javax.xml.bind.annotation.*; + +@XmlRootElement(name = "visa") +@XmlAccessorType(XmlAccessType.FIELD) +public class SpreedlyVisaNetwork { + + @XmlElement(name = "acquirer_merchant_id") public String acquirerMerchantId; + @XmlElement(name = "country_code") public Long countryCode; + @XmlElement(name = "mcc") public Long mcc; + @XmlElement(name = "merchant_name") public String name; + + public String getAcquirerMerchantId() { + return acquirerMerchantId; + } + + public void setAcquirerMerchantId(String acquirerMerchantId) { + this.acquirerMerchantId = acquirerMerchantId; + } + + public Long getCountryCode() { + return countryCode; + } + + public void setCountryCode(Long countryCode) { + this.countryCode = countryCode; + } + + public Long getMcc() { + return mcc; + } + + public void setMcc(Long mcc) { + this.mcc = mcc; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} \ No newline at end of file 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