Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we set target to 11? We will soon need this module in commerce service

</properties>

<dependencies>
Expand All @@ -58,7 +60,11 @@
<artifactId>http</artifactId>
<version>[0.2,)</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -158,5 +164,4 @@
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

</project>
24 changes: 23 additions & 1 deletion src/main/java/cc/protea/spreedly/Spreedly.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cc.protea.spreedly;

import cc.protea.spreedly.model.*;
import cc.protea.spreedly.model.internal.*;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -400,4 +399,27 @@ public SpreedlyTransactionResponse complete(String token, SpreedlyCompleteReques
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);
}
}
28 changes: 28 additions & 0 deletions src/main/java/cc/protea/spreedly/model/SpreedlyAmexDetails.java
Original file line number Diff line number Diff line change
@@ -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 Long acquirerBin;
@XmlElement(name = "merchant_url") public String merchantUrl;

public Long getAcquirerBin() {
return acquirerBin;
}

public void setAcquirerBin(Long acquirerBin) {
this.acquirerBin = acquirerBin;
}

public String getMerchantUrl() {
return merchantUrl;
}

public void setMerchantUrl(String merchantUrl) {
this.merchantUrl = merchantUrl;
}

}
48 changes: 48 additions & 0 deletions src/main/java/cc/protea/spreedly/model/SpreedlyAmexNetwork.java
Original file line number Diff line number Diff line change
@@ -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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be Integer, but not critical

@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;
}



}
70 changes: 32 additions & 38 deletions src/main/java/cc/protea/spreedly/model/SpreedlyCompleteRequest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package cc.protea.spreedly.model;

import java.util.ArrayList;
Expand All @@ -10,54 +9,49 @@
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"entry"
})
@XmlType(name = "", propOrder = {"entry"})
@XmlRootElement(name = "context")
public class SpreedlyCompleteRequest {

protected List<SpreedlyCompleteRequest.Entry> entry;
protected List<SpreedlyCompleteRequest.Entry> entry;


public List<SpreedlyCompleteRequest.Entry> getEntry() {
if (entry == null) {
entry = new ArrayList<SpreedlyCompleteRequest.Entry>();
}
return this.entry;
}
public List<SpreedlyCompleteRequest.Entry> getEntry() {
if (entry == null) {
entry = new ArrayList<SpreedlyCompleteRequest.Entry>();
}
return this.entry;
}

public void setEntry(List<Entry> entry) {
this.entry = entry;
}
public void setEntry(List<Entry> entry) {
this.entry = entry;
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"key",
"value"
})
public static class 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;
@XmlElement(required = true)
protected String key;
@XmlElement(required = true)
protected Object value;

public String getKey() {
return key;
}
public String getKey() {
return key;
}

public void setKey(String value) {
this.key = value;
}
public void setKey(String value) {
this.key = value;
}

public Object getValue() {
return value;
}
public Object getValue() {
return value;
}

public void setValue(Object value) {
this.value = value;
}
public void setValue(Object value) {
this.value = value;
}

}
}

}
}
41 changes: 41 additions & 0 deletions src/main/java/cc/protea/spreedly/model/SpreedlyCreditNetwork.java
Original file line number Diff line number Diff line change
@@ -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;
}


}
Original file line number Diff line number Diff line change
@@ -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 Long acquirerBin;
@XmlElement(name = "merchant_url") public String merchantUrl;

public Long getAcquirerBin() {
return acquirerBin;
}

public void setAcquirerBin(Long acquirerBin) {
this.acquirerBin = acquirerBin;
}

public String getMerchantUrl() {
return merchantUrl;
}

public void setMerchantUrl(String merchantUrl) {
this.merchantUrl = merchantUrl;
}


}
Original file line number Diff line number Diff line change
@@ -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;
}



}
Loading