Skip to content

Commit a4e5f01

Browse files
author
Thomas Hunziker
committed
Release 2.2.5
1 parent 36e25f7 commit a4e5f01

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

README.md

Lines changed: 3 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>com.postfinancecheckout</groupId>
2525
<artifactId>postfinancecheckout-java-sdk</artifactId>
26-
<version>2.2.4</version>
26+
<version>2.2.5</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 "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.4"
36+
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.5"
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-2.2.4.jar`
49+
* `target/postfinancecheckout-java-sdk-2.2.5.jar`
5050
* `target/lib/*.jar`
5151

5252
## Usage

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 = 'com.postfinancecheckout'
5-
version = '2.2.4'
5+
version = '2.2.5'
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 := "com.postfinancecheckout",
44
name := "postfinancecheckout-java-sdk",
5-
version := "2.2.4",
5+
version := "2.2.5",
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>2.2.4</version>
8+
<version>2.2.5</version>
99
<url>https://www.postfinance.ch/checkout</url>
1010
<description>The SDK for simplifying the integration with PostFinance Checkout API.</description>
1111
<scm>

src/main/java/com/postfinancecheckout/sdk/ApiClient.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818

1919
public class ApiClient {
20-
private final String basePath = "https://checkout.postfinance.ch:443/api";
20+
private final String basePath;
2121
private final HttpRequestFactory httpRequestFactory;
2222
private final ObjectMapper objectMapper;
23-
private long userId;
24-
private String applicationKey;
23+
private final long userId;
24+
private final String applicationKey;
2525

2626
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
2727
private static ObjectMapper createDefaultObjectMapper() {
@@ -40,13 +40,27 @@ private static ObjectMapper createDefaultObjectMapper() {
4040
* @param applicationKey
4141
*/
4242
public ApiClient(long userId, String applicationKey) {
43+
this(userId, applicationKey, "https://checkout.postfinance.ch:443/api");
44+
}
45+
46+
/**
47+
* Constructor for ApiClient
48+
*
49+
* @param userId
50+
* @param applicationKey
51+
*/
52+
public ApiClient(long userId, String applicationKey, String basePath) {
4353
if (applicationKey == null || applicationKey.trim().isEmpty()) {
4454
throw new IllegalArgumentException("The application key cannot be empty or null.");
4555
}
4656
if (userId < 1) {
4757
throw new IllegalArgumentException("The user id is invalid.");
4858
}
49-
59+
if (basePath == null || basePath.trim().isEmpty()) {
60+
throw new IllegalArgumentException("The base path cannot be empty.");
61+
}
62+
63+
this.basePath = basePath;
5064
this.userId = userId;
5165
this.applicationKey = applicationKey;
5266
this.httpRequestFactory = this.createRequestFactory();

0 commit comments

Comments
 (0)