Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
af9af0e
Adding Deprecated tag to setEnvironment method
Aleffio Oct 9, 2018
804856c
Merge pull request #125 from Adyen/fix-deprecated
Aleffio Oct 15, 2018
b9bf01e
Add StoreToken API implementation
Oct 18, 2018
15783b1
Add helper to set raw card data (#128)
rikterbeek Oct 19, 2018
5eba116
[PW-525]: Idempotency Key support in Payments, modification and check…
rkewlani Oct 24, 2018
d043198
[PW-525]: Updated mock objects to support new request method with Req…
rkewlani Oct 25, 2018
271e6b1
[PW-689]: Updated setEnvironment instructions and library version to …
rkewlani Oct 25, 2018
cfc6fb5
Revert "[PW-689]: Updated setEnvironment instructions and library ver…
rkewlani Oct 25, 2018
550fcac
Revert "[PW-689]: Updated setEnvironment instructions and library ver…
rkewlani Oct 25, 2018
f6307c4
code review comments incorporated.
rkewlani Oct 25, 2018
9dc607a
Merge pull request #131 from Adyen/gh_pages_PW-689_new
rkewlani Oct 25, 2018
9f446d2
corrected copyright section
rkewlani Oct 26, 2018
359887c
Merge pull request #129 from Adyen/feature/idempotency_key_support_PW…
rkewlani Oct 26, 2018
b4dd19a
Incorporating code review comments
Oct 26, 2018
ca2fc85
Merge pull request #127 from ashwindas/develop
rkewlani Oct 29, 2018
cb41ac5
Added OSGI manifest
lancergr Oct 26, 2018
510c1f2
Pin org.apache.felix maven-bundle-plugin to 3.5.0
lancergr Oct 26, 2018
4015766
Fixing storeToken style
lancergr Oct 29, 2018
74b2310
Merge pull request #133 from Adyen/osgi
lancergr Oct 29, 2018
8eb4afb
added idempotency key instructions.
rkewlani Oct 29, 2018
efc208f
Merge pull request #134 from Adyen/gh_pages_idempotency_PW-525
rkewlani Oct 29, 2018
3e7c4f8
formatting change to sync with master branch
rkewlani Oct 29, 2018
6ae02c2
Added paymentMethod DTO for /payments call
lancergr Oct 29, 2018
45e667f
Added deviceFingerprint
lancergr Oct 31, 2018
5c7eda1
Merge pull request #137 from Adyen/checkout-paymentMethod
lancergr Oct 31, 2018
8a159a8
Added date serializers for payments request deliveryDate and dateofBirth
lancergr Oct 31, 2018
2ee2e72
version bumped to 1.6.0
rkewlani Nov 1, 2018
ac1cb06
Merge pull request #138 from Adyen/payments-dates
rkewlani Nov 1, 2018
031708c
Merge branch 'master' into develop
rkewlani Nov 1, 2018
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<version>1.5.4</version>
<version>1.6.0</version>
</dependency>
```

Expand Down
172 changes: 172 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--

Checkstyle configuration that checks the sun coding conventions from:

- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html

- the Sun Code Conventions at http://java.sun.com/docs/codeconv/

- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html

- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html

- some best practices

Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).

Most Checks are configurable, be sure to consult the documentation.

To completely disable a check, just comment it out or delete it from the file.

Finally, it is worth reading the documentation.

-->

<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker

<property name="basedir" value="${basedir}"/>
-->

<property name="fileExtensions" value="java, properties, xml"/>

<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!--<module name="JavadocPackage"/>-->

<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!--<module name="NewlineAtEndOfFile"/>-->

<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength"/>

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter"/>

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!-- <module name="Header"> -->
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->

<module name="TreeWalker">

<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--<module name="JavadocMethod"/>-->
<!--<module name="JavadocType"/>-->
<!--<module name="JavadocVariable"/>-->
<!--<module name="JavadocStyle"/>-->

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>

<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!--<module name="LineLength"/>-->
<module name="MethodLength"/>
<module name="ParameterNumber"/>

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<!--<module name="NoWhitespaceAfter"/>-->
<module name="NoWhitespaceBefore"/>
<!--<module name="OperatorWrap"/>-->
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>

<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<!--<module name="AvoidInlineConditionals"/>-->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!--<module name="HiddenField"/>-->
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!--<module name="MagicNumber"/>-->
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!--<module name="DesignForExtension"/>-->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<!--<module name="InterfaceIsType"/>-->
<!--<module name="VisibilityModifier"/>-->

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<!--<module name="FinalParameters"/>-->
<module name="TodoComment"/>
<module name="UpperEll"/>

</module>

</module>
13 changes: 11 additions & 2 deletions docs/checkout-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,17 @@ <h2><a id="payments_0"></a>payments</h2>
paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"holderName"</span>, <span class="hljs-string">"John Smith"</span>);
paymentsRequest.putPaymentMethodItem(<span class="hljs-string">"cvc"</span>, <span class="hljs-string">"737"</span>);
paymentsRequest.setReturnUrl(<span class="hljs-string">"https://your-company.com/..."</span>);
paymentsRequest.setMerchantAccount(<span class="hljs-string">"YOUR_MERCHANT_ACCOUNT"</span>);
PaymentsResponse paymentResponse = checkout.payments(paymentsRequest);
paymentsRequest.setMerchantAccount(<span class="hljs-string">"YOUR_MERCHANT_ACCOUNT"</span>);</code></pre>
This Adyen API supports idempotency. To enable idempotent behavior on this request call, you need
to supply a RequestOptions object with idempotencyKey. In following example,&nbsp;<code class="language-java">"IDEMPOTENCY
KEY FOR THIS REQUEST"</code> is a unique identifer for the message with a maximum 64 characters (we recommend a
UUID).
<p/>
<pre><code class="language-java">RequestOptions requestOptions = <span class="hljs-keyword">new</span> RequestOptions();<br/>requestOptions.setIdempotencyKey(<span
class="hljs-string">"IDEMPOTENCY KEY FOR THIS REQUEST"</span>);<br/>PaymentsResponse paymentResponse = checkout.payments(paymentsRequest, requestOptions); </code></pre>
If you don't want to use idempotencyKey, simply send paymentRequest as shown in following example:
<p/>
<pre><code class="language-java">PaymentsResponse paymentResponse = checkout.payments(paymentsRequest);
</code></pre>

<h2><a id="paymentsDetails_37"></a>payments/details</h2>
Expand Down
18 changes: 15 additions & 3 deletions docs/checkout-sdk.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,29 @@ <h1>Checkout SDK integration</h1>
The Checkout SDK service has the following methods:
</p>
<h2><a id="paymentSession_54"></a>paymentSession</h2>
<p>Provides the data object that can be used to start the Checkout SDK. To set up the payment, pass its amount, currency, and other required parameters. We use this to optimise the payment flow and perform better risk assessment of the transaction.</p>
<p>Provides the data object that can be used to start the Checkout SDK. To set up the payment, pass its amount,
currency, and other required parameters. We use this to optimise the payment flow and perform better risk
assessment of the transaction.</p>
<pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client);
PaymentSessionRequest paymentSessionRequest = <span class="hljs-keyword">new</span> PaymentSessionRequest();
paymentSessionRequest.setAmount(createAmountObject(<span class="hljs-string">"EUR"</span>, <span class="hljs-number">17408L</span>));
paymentSessionRequest.setReference(<span class="hljs-string">"Your order number"</span>);
paymentSessionRequest.returnUrl(<span class="hljs-string">"https://www.yourshop.com/checkout/result"</span>);
paymentSessionRequest.merchantAccount(<span class="hljs-string">"YOUR_MERCHANT_ACCOUNT"</span>);
paymentSessionRequest.setCountryCode(<span class="hljs-string">"NL"</span>);
paymentSessionRequest.setSdkVersion(<span class="hljs-string">"1.3.0"</span>);
PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest);
paymentSessionRequest.setSdkVersion(<span class="hljs-string">"1.3.0"</span>);</code></pre>
This Adyen API supports idempotency. To enable idempotent behavior on this request call, you need
to supply a RequestOptions object with idempotencyKey. In following example,&nbsp;<code class="language-java">"IDEMPOTENCY
KEY FOR THIS REQUEST"</code> is a unique identifer for the message with a maximum 64 characters (we recommend a
UUID).
<p/>
<pre><code class="language-java">RequestOptions requestOptions = <span class="hljs-keyword">new</span> RequestOptions();<br/>requestOptions.setIdempotencyKey(<span
class="hljs-string">"IDEMPOTENCY KEY FOR THIS REQUEST"</span>);<br/>PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest, requestOptions);</code></pre>
If you don't want to use idempotencyKey, simply send paymentRequest as shown in following example:
<p/>
<pre><code class="language-java">PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest);
</code></pre>
</code></pre>
<h2><a id="paymentsresult_67"></a>payments/result</h2>
<p>Verifies the payment result using the payload returned from the Checkout SDK.</p>
<pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client);
Expand Down
3 changes: 2 additions & 1 deletion docs/install-library.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ <h3><a id="Maven_86"></a>Maven</h3>
class="hljs-tag">&lt;/<span class="hljs-title">groupId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">artifactId</span>&gt;</span>adyen-java-api-library<span
class="hljs-tag">&lt;/<span class="hljs-title">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-title">version</span>&gt;</span>1.5.4<span class="hljs-tag">&lt;/<span
<span class="hljs-tag">&lt;<span class="hljs-title">version</span>&gt;</span>1.6.0<span class="hljs-tag">&lt;/<span

class="hljs-title">version</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-title">dependency</span>&gt;</span>
</code></pre>
Expand Down
57 changes: 44 additions & 13 deletions 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.5.4</version>
<version>1.6.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 Expand Up @@ -42,19 +42,11 @@
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -126,6 +118,45 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Export-Package>com.adyen</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/adyen/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ 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 USER_AGENT_SUFFIX = "adyen-java-api-library/";
public static final String LIB_VERSION = "1.5.4";
public static final String LIB_VERSION = "1.6.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 = "v32";
Expand Down Expand Up @@ -81,6 +81,12 @@ public Client(String apiKey, Environment environment) {
this.setEnvironment(environment);
}

public Client(String apiKey, Environment environment, String liveEndpointUrlPrefix) {
this.config = new Config();
this.config.setApiKey(apiKey);
this.setEnvironment(environment, liveEndpointUrlPrefix);
}

public Client(String apiKey, Environment environment, int connectionTimeoutMillis) {

this.config = new Config();
Expand Down Expand Up @@ -109,6 +115,7 @@ public Client(String apiKey, Environment environment, int connectionTimeoutMilli
/**
* @deprecated As of library version 1.5.4, replaced by {@link #setEnvironment(Environment environment, String liveEndpointUrlPrefix)}.
*/
@Deprecated
public void setEnvironment(Environment environment) {
this.setEnvironment(environment, null);
}
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/com/adyen/Util/DateUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public final class DateUtil {
private DateUtil() {
Expand All @@ -33,15 +35,15 @@ public static Date parseDateToFormat(String dateString, String format) {
return null;
}

Date date;
SimpleDateFormat fmt = new SimpleDateFormat(format);
SimpleDateFormat fmt = new SimpleDateFormat(format, Locale.ENGLISH);
fmt.setTimeZone(TimeZone.getTimeZone("GMT"));

try {
date = fmt.parse(dateString);
} catch (ParseException e) {
return null;
return fmt.parse(dateString);
} catch (ParseException ignored) {
}

return date;
return null;
}

public static Date parseYmdDate(String dateString) {
Expand Down
Loading