Skip to content

Commit

Permalink
Merge pull request #156 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 2.0.0
  • Loading branch information
rkewlani authored Feb 25, 2019
2 parents 92f7813 + 19a60f8 commit 7cc63bb
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 24 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@

The Adyen API Library for Java enables you to work with Adyen APIs and Hosted Payment Pages.

## Integration
The Library supports all APIs under the following services:

* checkout
* checkout utility
* payments
* modifications
* payouts
* recurring
* marketpay
* notifications

## Requirements

* Java 7 or higher
Expand All @@ -23,13 +35,13 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<version>1.8.0</version>
<version>2.0.0</version>
</dependency>
```

## Documentation

Follow the rest of our guides from the [documentation](http://adyen.github.io/adyen-java-api-library/index.html) on how to use this library.
* https://docs.adyen.com/developers/development-resources/libraries
* https://docs.adyen.com/developers/checkout/api-integration

## Usage

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<packaging>jar</packaging>
<version>1.8.0</version>
<version>2.0.0</version>
<name>Adyen Java API Library</name>
<description>Adyen API Client Library for Java</description>
<url>https://github.com/adyen/adyen-java-api-library</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/adyen/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class Client {
public static final String MARKETPAY_FUND_API_VERSION = "v3";
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v1";
public static final String LIB_NAME = "adyen-java-api-library";
public static final String LIB_VERSION = "1.8.0";
public static final String LIB_VERSION = "2.0.0";
public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
public static final String CHECKOUT_API_VERSION = "v40";
public static final String CHECKOUT_API_VERSION = "v41";
public static final String CHECKOUT_UTILITY_API_VERSION = "v1";
public static final String ENDPOINT_PROTOCOL = "https://";

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/adyen/model/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ public boolean equals(Object o) {
return Objects.equals(this.expiryMonth, card.expiryMonth)
&& Objects.equals(this.expiryYear, card.expiryYear)
&& Objects.equals(this.cvc, card.cvc)
&& Objects.equals(this.holderName,
card.holderName)
&& Objects.equals(this.holderName, card.holderName)
&& Objects.equals(this.issueNumber, card.issueNumber)
&& Objects.equals(this.number, card.number)
&& Objects.equals(this.startMonth, card.startMonth)
Expand Down
35 changes: 28 additions & 7 deletions src/main/java/com/adyen/model/checkout/PaymentsResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public class PaymentsResponse {
@SerializedName("merchantReference")
private String merchantReference;

@SerializedName("outputDetails")
private Map<String, String> outputDetails;

public PaymentsResponse additionalData(Map<String, String> additionalData) {
this.additionalData = additionalData;
return this;
Expand Down Expand Up @@ -145,6 +148,13 @@ public PaymentsResponse addDetailsItem(InputDetail detailsItem) {
return this;
}

public String getOutputDetailDataByKey(String key) {
if (outputDetails == null) {
return null;
}
return outputDetails.get(key);
}

/**
* When non-empty, contains all the fields that you must submit to the &#x60;/payments/details&#x60; endpoint.
*
Expand Down Expand Up @@ -308,6 +318,14 @@ public void setMerchantReference(String merchantReference) {
this.merchantReference = merchantReference;
}

public Map<String, String> getOutputDetails() {
return outputDetails;
}

public void setOutputDetails(Map<String, String> outputDetails) {
this.outputDetails = outputDetails;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -329,7 +347,8 @@ public boolean equals(Object o) {
&& Objects.equals(this.resultCode, paymentsResponse.resultCode)
&& Objects.equals(this.serviceError, paymentsResponse.serviceError)
&& Objects.equals(this.authResponse, paymentsResponse.authResponse)
&& Objects.equals(this.merchantReference, paymentsResponse.merchantReference);
&& Objects.equals(this.merchantReference, paymentsResponse.merchantReference)
&& Objects.equals(this.outputDetails, paymentsResponse.outputDetails);
}

@Override
Expand All @@ -353,6 +372,7 @@ public String toString() {
sb.append(" serviceError: ").append(toIndentedString(serviceError)).append("\n");
sb.append(" authResponse: ").append(toIndentedString(authResponse)).append("\n");
sb.append(" merchantReference: ").append(toIndentedString(merchantReference)).append("\n");
sb.append(" outputDetails: ").append(toIndentedString(outputDetails)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -389,6 +409,7 @@ public enum ResultCodeEnum {
CANCELLED("Cancelled"),
RECEIVED("Received"),
REDIRECTSHOPPER("RedirectShopper"),
PRESENTTOSHOPPER("PresentToShopper"),
UNKNOWN("Unknown"); //applicable for payments/details

private String value;
Expand Down Expand Up @@ -458,29 +479,29 @@ public boolean get3DAuthenticated() {
}

public String getBoletoBarCodeReference() {
return getAdditionalDataByKey(BOLETO_BARCODE_REFERENCE);
return getOutputDetailDataByKey(BOLETO_BARCODE_REFERENCE);
}

public String getBoletoData() {
return getAdditionalDataByKey(BOLETO_DATA);
return getOutputDetailDataByKey(BOLETO_DATA);
}

public String getAuthCode() {
return getAdditionalDataByKey(AUTH_CODE);
return getOutputDetailDataByKey(AUTH_CODE);
}

public Date getBoletoDueDate() {
String date = getAdditionalDataByKey(BOLETO_DUE_DATE);
String date = getOutputDetailDataByKey(BOLETO_DUE_DATE);
return DateUtil.parseYmdDate(date);
}

public Date getBoletoExpirationDate() {
String date = getAdditionalDataByKey(BOLETO_EXPIRATION_DATE);
String date = getOutputDetailDataByKey(BOLETO_EXPIRATION_DATE);
return DateUtil.parseYmdDate(date);
}

public String getBoletoUrl() {
return getAdditionalDataByKey(BOLETO_URL);
return getOutputDetailDataByKey(BOLETO_URL);
}


Expand Down
36 changes: 27 additions & 9 deletions src/main/java/com/adyen/model/checkout/SubInputDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

package com.adyen.model.checkout;

import com.google.gson.annotations.SerializedName;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;

/**
* SubInputDetail
Expand All @@ -47,6 +47,9 @@ public class SubInputDetail {
@SerializedName("value")
private String value = null;

@SerializedName("Configuration")
private Map<String, String> configuration;

public SubInputDetail items(List<Item> items) {
this.items = items;
return this;
Expand Down Expand Up @@ -151,6 +154,19 @@ public void setValue(String value) {
this.value = value;
}

/**
* The value can be pre-filled, if available.
*
* @return value
**/
public Map<String, String> getConfiguration() {
return configuration;
}

public void setConfiguration(Map<String, String> configuration) {
this.configuration = configuration;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -160,11 +176,13 @@ public boolean equals(Object o) {
return false;
}
SubInputDetail subInputDetail = (SubInputDetail) o;
return Objects.equals(this.items, subInputDetail.items) &&
Objects.equals(this.key, subInputDetail.key) &&
Objects.equals(this.optional, subInputDetail.optional) &&
Objects.equals(this.type, subInputDetail.type) &&
Objects.equals(this.value, subInputDetail.value);
return Objects.equals(this.items, subInputDetail.items)
&& Objects.equals(this.key, subInputDetail.key)
&& Objects.equals(this.optional, subInputDetail.optional)
&& Objects.equals(this.type,
subInputDetail.type)
&& Objects.equals(this.value, subInputDetail.value)
&& Objects.equals(this.configuration, subInputDetail.configuration);
}

@Override
Expand All @@ -182,13 +200,13 @@ public String toString() {
sb.append(" optional: ").append(toIndentedString(optional)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
Expand Down

0 comments on commit 7cc63bb

Please sign in to comment.