Skip to content

Commit 5f14dd9

Browse files
Release 5.0.0
1 parent 358da57 commit 5f14dd9

File tree

86 files changed

+4633
-803
lines changed

Some content is hidden

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

86 files changed

+4633
-803
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2022 wallee AG
189+
Copyright 2023 wallee AG
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add this dependency to your project's POM:
2323
<dependency>
2424
<groupId>ch.postfinance</groupId>
2525
<artifactId>postfinancecheckout-java-sdk</artifactId>
26-
<version>4.0.15</version>
26+
<version>5.0.0</version>
2727
<scope>compile</scope>
2828
</dependency>
2929
```
@@ -33,7 +33,7 @@ Add this dependency to your project's POM:
3333
Add this dependency to your project's build file:
3434

3535
```groovy
36-
compile "ch.postfinance:postfinancecheckout-java-sdk:4.0.15"
36+
compile "ch.postfinance:postfinancecheckout-java-sdk:5.0.0"
3737
```
3838

3939
### Others
@@ -46,7 +46,7 @@ mvn clean package
4646

4747
Then manually install the following JARs:
4848

49-
* `target/postfinancecheckout-java-sdk-4.0.15.jar`
49+
* `target/postfinancecheckout-java-sdk-5.0.0.jar`
5050
* `target/lib/*.jar`
5151

5252
## Usage
@@ -72,6 +72,9 @@ public class Example {
7272
// API Client
7373
ApiClient apiClient = new ApiClient(userId, secret);
7474

75+
//Setup a custom connection timeout if needed. (Default value is: 25 seconds)
76+
apiClient.setReadTimeOut(20);
77+
7578
// Create an API service instance:
7679
TransactionService transactionService = apiClient.getTransactionService();
7780

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'idea'
22
apply plugin: 'eclipse'
33

44
group = 'ch.postfinance'
5-
version = '4.0.15'
5+
version = '5.0.0'
66

77
buildscript {
88
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "ch.postfinance",
44
name := "postfinancecheckout-java-sdk",
5-
version := "4.0.15",
5+
version := "5.0.0",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>postfinancecheckout-java-sdk</artifactId>
66
<packaging>jar</packaging>
77
<name>postfinancecheckout-java-sdk</name>
8-
<version>4.0.15</version>
8+
<version>5.0.0</version>
99
<url>https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html</url>
1010
<description>The SDK for simplifying the integration with PostFinance Checkout API.</description>
1111
<scm>

src/main/java/ch/postfinance/sdk/ApiClient.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222

2323
public class ApiClient {
24+
private int readTimeOut = 25;
2425
private final String basePath;
2526
private final HttpRequestFactory httpRequestFactory;
2627
private final ObjectMapper objectMapper;
2728
private final long userId;
2829
private final String applicationKey;
2930
private final Map<String, String> defaultHeaders;
30-
public final static int READ_TIMEOUT = 20 * 1000;
3131

3232
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
3333
private static ObjectMapper createDefaultObjectMapper() {
@@ -102,6 +102,14 @@ public ObjectMapper getObjectMapper() {
102102
return objectMapper;
103103
}
104104

105+
public int getReadTimeOut() {
106+
return readTimeOut;
107+
}
108+
109+
public void setReadTimeOut(int readTimeOut) {
110+
this.readTimeOut = readTimeOut;
111+
}
112+
105113
public class JacksonJsonHttpContent extends AbstractHttpContent {
106114
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
107115
private final Object data;

src/main/java/ch/postfinance/sdk/DefaultHeaders.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void intercept(HttpRequest request) throws IOException {
3434

3535
private HttpHeaders getDefaultHeaders() {
3636
HttpHeaders headers = new HttpHeaders();
37-
headers.put("x-meta-sdk-version", "4.0.15");
37+
headers.put("x-meta-sdk-version", "5.0.0");
3838
headers.put("x-meta-sdk-language", "java");
3939
headers.put("x-meta-sdk-provider", "PostFinance Checkout");
4040
headers.put("x-meta-sdk-language-version", System.getProperty("java.version"));
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* PostFinance Checkout SDK
3+
*
4+
* This library allows to interact with the PostFinance Checkout payment service.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
20+
package ch.postfinance.sdk;
21+
22+
/**
23+
* The error code represents a potential error which may be thrown by Wallee SDK.
24+
*
25+
*/
26+
public enum ErrorCode {
27+
28+
ENTITY_NOT_FOUND(0, "Entity not found")
29+
;
30+
31+
private final int code;
32+
private final String description;
33+
34+
private ErrorCode(int code, String description) {
35+
this.code = code;
36+
this.description = description;
37+
}
38+
39+
public String getDescription() {
40+
return description;
41+
}
42+
43+
public int getCode() {
44+
return code;
45+
}
46+
47+
@Override
48+
public String toString() {
49+
return code + ": " + description;
50+
}
51+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* PostFinance Checkout SDK
3+
*
4+
* This library allows to interact with the PostFinance Checkout payment service.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
20+
package ch.postfinance.sdk;
21+
22+
/**
23+
* Exception thrown when the PostFinanceCheckout SDK API call results in an invalid response.
24+
*/
25+
public class PostFinanceCheckoutSdkException extends RuntimeException {
26+
27+
private static final long serialVersionUID = 1675383192982547616L;
28+
29+
/**
30+
* Constructor.
31+
*
32+
* @param errorCode
33+
* the PostFinanceCheckout SDK error code
34+
* @param message
35+
* the exception message details
36+
*/
37+
public PostFinanceCheckoutSdkException(ErrorCode errorCode, String message) {
38+
super(String.format("Error code: %d. %s", errorCode.getCode(), message));
39+
}
40+
41+
}

src/main/java/ch/postfinance/sdk/model/PaymentInitiationAdviceFile.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,18 @@ public class PaymentInitiationAdviceFile {
4343
protected OffsetDateTime createdOn = null;
4444

4545

46+
@JsonProperty("failureMessage")
47+
protected String failureMessage = null;
48+
49+
4650
@JsonProperty("fileGeneratedOn")
4751
protected OffsetDateTime fileGeneratedOn = null;
4852

4953

54+
@JsonProperty("forwardedOn")
55+
protected OffsetDateTime forwardedOn = null;
56+
57+
5058
@JsonProperty("id")
5159
protected Long id = null;
5260

@@ -82,6 +90,16 @@ public OffsetDateTime getCreatedOn() {
8290
}
8391

8492

93+
/**
94+
*
95+
* @return failureMessage
96+
**/
97+
@ApiModelProperty(value = "")
98+
public String getFailureMessage() {
99+
return failureMessage;
100+
}
101+
102+
85103
/**
86104
*
87105
* @return fileGeneratedOn
@@ -92,6 +110,16 @@ public OffsetDateTime getFileGeneratedOn() {
92110
}
93111

94112

113+
/**
114+
* The shipping date indicates the date on which the pain file was transferred to an external processing system.
115+
* @return forwardedOn
116+
**/
117+
@ApiModelProperty(value = "The shipping date indicates the date on which the pain file was transferred to an external processing system.")
118+
public OffsetDateTime getForwardedOn() {
119+
return forwardedOn;
120+
}
121+
122+
95123
/**
96124
* The ID is the primary key of the entity. The ID identifies the entity uniquely.
97125
* @return id
@@ -163,7 +191,9 @@ public boolean equals(java.lang.Object o) {
163191
}
164192
PaymentInitiationAdviceFile paymentInitiationAdviceFile = (PaymentInitiationAdviceFile) o;
165193
return Objects.equals(this.createdOn, paymentInitiationAdviceFile.createdOn) &&
194+
Objects.equals(this.failureMessage, paymentInitiationAdviceFile.failureMessage) &&
166195
Objects.equals(this.fileGeneratedOn, paymentInitiationAdviceFile.fileGeneratedOn) &&
196+
Objects.equals(this.forwardedOn, paymentInitiationAdviceFile.forwardedOn) &&
167197
Objects.equals(this.id, paymentInitiationAdviceFile.id) &&
168198
Objects.equals(this.linkedSpaceId, paymentInitiationAdviceFile.linkedSpaceId) &&
169199
Objects.equals(this.name, paymentInitiationAdviceFile.name) &&
@@ -174,7 +204,7 @@ public boolean equals(java.lang.Object o) {
174204

175205
@Override
176206
public int hashCode() {
177-
return Objects.hash(createdOn, fileGeneratedOn, id, linkedSpaceId, name, processedOn, processor, state);
207+
return Objects.hash(createdOn, failureMessage, fileGeneratedOn, forwardedOn, id, linkedSpaceId, name, processedOn, processor, state);
178208
}
179209

180210

@@ -184,7 +214,9 @@ public String toString() {
184214
sb.append("class PaymentInitiationAdviceFile {\n");
185215

186216
sb.append(" createdOn: ").append(toIndentedString(createdOn)).append("\n");
217+
sb.append(" failureMessage: ").append(toIndentedString(failureMessage)).append("\n");
187218
sb.append(" fileGeneratedOn: ").append(toIndentedString(fileGeneratedOn)).append("\n");
219+
sb.append(" forwardedOn: ").append(toIndentedString(forwardedOn)).append("\n");
188220
sb.append(" id: ").append(toIndentedString(id)).append("\n");
189221
sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n");
190222
sb.append(" name: ").append(toIndentedString(name)).append("\n");

0 commit comments

Comments
 (0)