Skip to content

Commit

Permalink
Release 2.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hunziker committed Jul 31, 2020
1 parent 36e25f7 commit a4e5f01
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
6 changes: 3 additions & 3 deletions 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.postfinancecheckout</groupId>
<artifactId>postfinancecheckout-java-sdk</artifactId>
<version>2.2.4</version>
<version>2.2.5</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -33,7 +33,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.4"
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.5"
```

### Others
Expand All @@ -46,7 +46,7 @@ mvn clean package

Then manually install the following JARs:

* `target/postfinancecheckout-java-sdk-2.2.4.jar`
* `target/postfinancecheckout-java-sdk-2.2.5.jar`
* `target/lib/*.jar`

## Usage
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'idea'
apply plugin: 'eclipse'

group = 'com.postfinancecheckout'
version = '2.2.4'
version = '2.2.5'

buildscript {
repositories {
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "com.postfinancecheckout",
name := "postfinancecheckout-java-sdk",
version := "2.2.4",
version := "2.2.5",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>postfinancecheckout-java-sdk</artifactId>
<packaging>jar</packaging>
<name>postfinancecheckout-java-sdk</name>
<version>2.2.4</version>
<version>2.2.5</version>
<url>https://www.postfinance.ch/checkout</url>
<description>The SDK for simplifying the integration with PostFinance Checkout API.</description>
<scm>
Expand Down
22 changes: 18 additions & 4 deletions src/main/java/com/postfinancecheckout/sdk/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@


public class ApiClient {
private final String basePath = "https://checkout.postfinance.ch:443/api";
private final String basePath;
private final HttpRequestFactory httpRequestFactory;
private final ObjectMapper objectMapper;
private long userId;
private String applicationKey;
private final long userId;
private final String applicationKey;

// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
private static ObjectMapper createDefaultObjectMapper() {
Expand All @@ -40,13 +40,27 @@ private static ObjectMapper createDefaultObjectMapper() {
* @param applicationKey
*/
public ApiClient(long userId, String applicationKey) {
this(userId, applicationKey, "https://checkout.postfinance.ch:443/api");
}

/**
* Constructor for ApiClient
*
* @param userId
* @param applicationKey
*/
public ApiClient(long userId, String applicationKey, String basePath) {
if (applicationKey == null || applicationKey.trim().isEmpty()) {
throw new IllegalArgumentException("The application key cannot be empty or null.");
}
if (userId < 1) {
throw new IllegalArgumentException("The user id is invalid.");
}

if (basePath == null || basePath.trim().isEmpty()) {
throw new IllegalArgumentException("The base path cannot be empty.");
}

this.basePath = basePath;
this.userId = userId;
this.applicationKey = applicationKey;
this.httpRequestFactory = this.createRequestFactory();
Expand Down

0 comments on commit a4e5f01

Please sign in to comment.