Skip to content

Commit 822cfa6

Browse files
authored
Merge pull request #139 from Adyen/develop
Release 1.6.0
2 parents 941754a + 031708c commit 822cfa6

File tree

69 files changed

+4032
-2387
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4032
-2387
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add this dependency to your project's POM:
2323
<dependency>
2424
<groupId>com.adyen</groupId>
2525
<artifactId>adyen-java-api-library</artifactId>
26-
<version>1.5.4</version>
26+
<version>1.6.0</version>
2727
</dependency>
2828
```
2929

checkstyle.xml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
6+
<!--
7+
8+
Checkstyle configuration that checks the sun coding conventions from:
9+
10+
- the Java Language Specification at
11+
http://java.sun.com/docs/books/jls/second_edition/html/index.html
12+
13+
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
14+
15+
- the Javadoc guidelines at
16+
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
17+
18+
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
19+
20+
- some best practices
21+
22+
Checkstyle is very configurable. Be sure to read the documentation at
23+
http://checkstyle.sf.net (or in your downloaded distribution).
24+
25+
Most Checks are configurable, be sure to consult the documentation.
26+
27+
To completely disable a check, just comment it out or delete it from the file.
28+
29+
Finally, it is worth reading the documentation.
30+
31+
-->
32+
33+
<module name="Checker">
34+
<!--
35+
If you set the basedir property below, then all reported file
36+
names will be relative to the specified directory. See
37+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
38+
39+
<property name="basedir" value="${basedir}"/>
40+
-->
41+
42+
<property name="fileExtensions" value="java, properties, xml"/>
43+
44+
<!-- Checks that a package-info.java file exists for each package. -->
45+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
46+
<!--<module name="JavadocPackage"/>-->
47+
48+
<!-- Checks whether files end with a new line. -->
49+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
50+
<!--<module name="NewlineAtEndOfFile"/>-->
51+
52+
<!-- Checks that property files contain the same keys. -->
53+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
54+
<module name="Translation"/>
55+
56+
<!-- Checks for Size Violations. -->
57+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
58+
<module name="FileLength"/>
59+
60+
<!-- Checks for whitespace -->
61+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
62+
<module name="FileTabCharacter"/>
63+
64+
<!-- Miscellaneous other checks. -->
65+
<!-- See http://checkstyle.sf.net/config_misc.html -->
66+
<module name="RegexpSingleline">
67+
<property name="format" value="\s+$"/>
68+
<property name="minimum" value="0"/>
69+
<property name="maximum" value="0"/>
70+
<property name="message" value="Line has trailing spaces."/>
71+
</module>
72+
73+
<!-- Checks for Headers -->
74+
<!-- See http://checkstyle.sf.net/config_header.html -->
75+
<!-- <module name="Header"> -->
76+
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> -->
77+
<!-- <property name="fileExtensions" value="java"/> -->
78+
<!-- </module> -->
79+
80+
<module name="TreeWalker">
81+
82+
<!-- Checks for Javadoc comments. -->
83+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
84+
<!--<module name="JavadocMethod"/>-->
85+
<!--<module name="JavadocType"/>-->
86+
<!--<module name="JavadocVariable"/>-->
87+
<!--<module name="JavadocStyle"/>-->
88+
89+
<!-- Checks for Naming Conventions. -->
90+
<!-- See http://checkstyle.sf.net/config_naming.html -->
91+
<module name="ConstantName"/>
92+
<module name="LocalFinalVariableName"/>
93+
<module name="LocalVariableName"/>
94+
<module name="MemberName"/>
95+
<module name="MethodName"/>
96+
<module name="PackageName"/>
97+
<module name="ParameterName"/>
98+
<module name="StaticVariableName"/>
99+
<module name="TypeName"/>
100+
101+
<!-- Checks for imports -->
102+
<!-- See http://checkstyle.sf.net/config_import.html -->
103+
<module name="AvoidStarImport"/>
104+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
105+
<module name="RedundantImport"/>
106+
<module name="UnusedImports">
107+
<property name="processJavadoc" value="false"/>
108+
</module>
109+
110+
<!-- Checks for Size Violations. -->
111+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
112+
<!--<module name="LineLength"/>-->
113+
<module name="MethodLength"/>
114+
<module name="ParameterNumber"/>
115+
116+
<!-- Checks for whitespace -->
117+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
118+
<module name="EmptyForIteratorPad"/>
119+
<module name="GenericWhitespace"/>
120+
<module name="MethodParamPad"/>
121+
<!--<module name="NoWhitespaceAfter"/>-->
122+
<module name="NoWhitespaceBefore"/>
123+
<!--<module name="OperatorWrap"/>-->
124+
<module name="ParenPad"/>
125+
<module name="TypecastParenPad"/>
126+
<module name="WhitespaceAfter"/>
127+
<module name="WhitespaceAround"/>
128+
129+
<!-- Modifier Checks -->
130+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
131+
<module name="ModifierOrder"/>
132+
<module name="RedundantModifier"/>
133+
134+
<!-- Checks for blocks. You know, those {}'s -->
135+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
136+
<module name="AvoidNestedBlocks"/>
137+
<module name="EmptyBlock"/>
138+
<module name="LeftCurly"/>
139+
<module name="NeedBraces"/>
140+
<module name="RightCurly"/>
141+
142+
<!-- Checks for common coding problems -->
143+
<!-- See http://checkstyle.sf.net/config_coding.html -->
144+
<!--<module name="AvoidInlineConditionals"/>-->
145+
<module name="EmptyStatement"/>
146+
<module name="EqualsHashCode"/>
147+
<!--<module name="HiddenField"/>-->
148+
<module name="IllegalInstantiation"/>
149+
<module name="InnerAssignment"/>
150+
<!--<module name="MagicNumber"/>-->
151+
<module name="MissingSwitchDefault"/>
152+
<module name="SimplifyBooleanExpression"/>
153+
<module name="SimplifyBooleanReturn"/>
154+
155+
<!-- Checks for class design -->
156+
<!-- See http://checkstyle.sf.net/config_design.html -->
157+
<!--<module name="DesignForExtension"/>-->
158+
<module name="FinalClass"/>
159+
<module name="HideUtilityClassConstructor"/>
160+
<!--<module name="InterfaceIsType"/>-->
161+
<!--<module name="VisibilityModifier"/>-->
162+
163+
<!-- Miscellaneous other checks. -->
164+
<!-- See http://checkstyle.sf.net/config_misc.html -->
165+
<module name="ArrayTypeStyle"/>
166+
<!--<module name="FinalParameters"/>-->
167+
<module name="TodoComment"/>
168+
<module name="UpperEll"/>
169+
170+
</module>
171+
172+
</module>

docs/checkout-api.html

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

8695
<h2><a id="paymentsDetails_37"></a>payments/details</h2>

docs/checkout-sdk.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,29 @@ <h1>Checkout SDK integration</h1>
3838
The Checkout SDK service has the following methods:
3939
</p>
4040
<h2><a id="paymentSession_54"></a>paymentSession</h2>
41-
<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>
41+
<p>Provides the data object that can be used to start the Checkout SDK. To set up the payment, pass its amount,
42+
currency, and other required parameters. We use this to optimise the payment flow and perform better risk
43+
assessment of the transaction.</p>
4244
<pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client);
4345
PaymentSessionRequest paymentSessionRequest = <span class="hljs-keyword">new</span> PaymentSessionRequest();
4446
paymentSessionRequest.setAmount(createAmountObject(<span class="hljs-string">"EUR"</span>, <span class="hljs-number">17408L</span>));
4547
paymentSessionRequest.setReference(<span class="hljs-string">"Your order number"</span>);
4648
paymentSessionRequest.returnUrl(<span class="hljs-string">"https://www.yourshop.com/checkout/result"</span>);
4749
paymentSessionRequest.merchantAccount(<span class="hljs-string">"YOUR_MERCHANT_ACCOUNT"</span>);
4850
paymentSessionRequest.setCountryCode(<span class="hljs-string">"NL"</span>);
49-
paymentSessionRequest.setSdkVersion(<span class="hljs-string">"1.3.0"</span>);
50-
PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest);
51+
paymentSessionRequest.setSdkVersion(<span class="hljs-string">"1.3.0"</span>);</code></pre>
52+
This Adyen API supports idempotency. To enable idempotent behavior on this request call, you need
53+
to supply a RequestOptions object with idempotencyKey. In following example,&nbsp;<code class="language-java">"IDEMPOTENCY
54+
KEY FOR THIS REQUEST"</code> is a unique identifer for the message with a maximum 64 characters (we recommend a
55+
UUID).
56+
<p/>
57+
<pre><code class="language-java">RequestOptions requestOptions = <span class="hljs-keyword">new</span> RequestOptions();<br/>requestOptions.setIdempotencyKey(<span
58+
class="hljs-string">"IDEMPOTENCY KEY FOR THIS REQUEST"</span>);<br/>PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest, requestOptions);</code></pre>
59+
If you don't want to use idempotencyKey, simply send paymentRequest as shown in following example:
60+
<p/>
61+
<pre><code class="language-java">PaymentSessionResponse paymentSessionResponse = checkout.paymentSession(paymentSessionRequest);
5162
</code></pre>
63+
</code></pre>
5264
<h2><a id="paymentsresult_67"></a>payments/result</h2>
5365
<p>Verifies the payment result using the payload returned from the Checkout SDK.</p>
5466
<pre><code class="language-java">Checkout checkout = <span class="hljs-keyword">new</span> Checkout(client);

docs/install-library.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ <h3><a id="Maven_86"></a>Maven</h3>
4949
class="hljs-tag">&lt;/<span class="hljs-title">groupId</span>&gt;</span>
5050
<span class="hljs-tag">&lt;<span class="hljs-title">artifactId</span>&gt;</span>adyen-java-api-library<span
5151
class="hljs-tag">&lt;/<span class="hljs-title">artifactId</span>&gt;</span>
52-
<span class="hljs-tag">&lt;<span class="hljs-title">version</span>&gt;</span>1.5.4<span class="hljs-tag">&lt;/<span
52+
<span class="hljs-tag">&lt;<span class="hljs-title">version</span>&gt;</span>1.6.0<span class="hljs-tag">&lt;/<span
53+
5354
class="hljs-title">version</span>&gt;</span>
5455
<span class="hljs-tag">&lt;/<span class="hljs-title">dependency</span>&gt;</span>
5556
</code></pre>

pom.xml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.adyen</groupId>
55
<artifactId>adyen-java-api-library</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.5.4</version>
7+
<version>1.6.0</version>
88
<name>Adyen Java API Library</name>
99
<description>Adyen API Client Library for Java</description>
1010
<url>https://github.com/adyen/adyen-java-api-library</url>
@@ -42,19 +42,11 @@
4242
</configuration>
4343
</plugin>
4444
<plugin>
45-
<artifactId>maven-assembly-plugin</artifactId>
46-
<executions>
47-
<execution>
48-
<phase>package</phase>
49-
<goals>
50-
<goal>single</goal>
51-
</goals>
52-
</execution>
53-
</executions>
45+
<artifactId>maven-jar-plugin</artifactId>
5446
<configuration>
55-
<descriptorRefs>
56-
<descriptorRef>jar-with-dependencies</descriptorRef>
57-
</descriptorRefs>
47+
<archive>
48+
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
49+
</archive>
5850
</configuration>
5951
</plugin>
6052
<plugin>
@@ -126,6 +118,45 @@
126118
<autoReleaseAfterClose>true</autoReleaseAfterClose>
127119
</configuration>
128120
</plugin>
121+
<plugin>
122+
<groupId>org.apache.maven.plugins</groupId>
123+
<artifactId>maven-checkstyle-plugin</artifactId>
124+
<version>3.0.0</version>
125+
<configuration>
126+
<configLocation>checkstyle.xml</configLocation>
127+
<encoding>UTF-8</encoding>
128+
<consoleOutput>true</consoleOutput>
129+
<failsOnError>true</failsOnError>
130+
</configuration>
131+
<executions>
132+
<execution>
133+
<id>validate</id>
134+
<phase>validate</phase>
135+
<goals>
136+
<goal>check</goal>
137+
</goals>
138+
</execution>
139+
</executions>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.apache.felix</groupId>
143+
<artifactId>maven-bundle-plugin</artifactId>
144+
<version>3.5.0</version>
145+
<executions>
146+
<execution>
147+
<id>bundle-manifest</id>
148+
<phase>process-classes</phase>
149+
<goals>
150+
<goal>manifest</goal>
151+
</goals>
152+
</execution>
153+
</executions>
154+
<configuration>
155+
<instructions>
156+
<Export-Package>com.adyen</Export-Package>
157+
</instructions>
158+
</configuration>
159+
</plugin>
129160
</plugins>
130161
</build>
131162
<dependencies>

src/main/java/com/adyen/Client.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Client {
4141
public static final String MARKETPAY_FUND_API_VERSION = "v3";
4242
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v1";
4343
public static final String USER_AGENT_SUFFIX = "adyen-java-api-library/";
44-
public static final String LIB_VERSION = "1.5.4";
44+
public static final String LIB_VERSION = "1.6.0";
4545
public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
4646
public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
4747
public static final String CHECKOUT_API_VERSION = "v32";
@@ -81,6 +81,12 @@ public Client(String apiKey, Environment environment) {
8181
this.setEnvironment(environment);
8282
}
8383

84+
public Client(String apiKey, Environment environment, String liveEndpointUrlPrefix) {
85+
this.config = new Config();
86+
this.config.setApiKey(apiKey);
87+
this.setEnvironment(environment, liveEndpointUrlPrefix);
88+
}
89+
8490
public Client(String apiKey, Environment environment, int connectionTimeoutMillis) {
8591

8692
this.config = new Config();
@@ -109,6 +115,7 @@ public Client(String apiKey, Environment environment, int connectionTimeoutMilli
109115
/**
110116
* @deprecated As of library version 1.5.4, replaced by {@link #setEnvironment(Environment environment, String liveEndpointUrlPrefix)}.
111117
*/
118+
@Deprecated
112119
public void setEnvironment(Environment environment) {
113120
this.setEnvironment(environment, null);
114121
}

src/main/java/com/adyen/Util/DateUtil.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.text.ParseException;
2424
import java.text.SimpleDateFormat;
2525
import java.util.Date;
26+
import java.util.Locale;
27+
import java.util.TimeZone;
2628

2729
public final class DateUtil {
2830
private DateUtil() {
@@ -33,15 +35,15 @@ public static Date parseDateToFormat(String dateString, String format) {
3335
return null;
3436
}
3537

36-
Date date;
37-
SimpleDateFormat fmt = new SimpleDateFormat(format);
38+
SimpleDateFormat fmt = new SimpleDateFormat(format, Locale.ENGLISH);
39+
fmt.setTimeZone(TimeZone.getTimeZone("GMT"));
40+
3841
try {
39-
date = fmt.parse(dateString);
40-
} catch (ParseException e) {
41-
return null;
42+
return fmt.parse(dateString);
43+
} catch (ParseException ignored) {
4244
}
4345

44-
return date;
46+
return null;
4547
}
4648

4749
public static Date parseYmdDate(String dateString) {

0 commit comments

Comments
 (0)