Skip to content

Commit

Permalink
Release 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wallee-deployment-user committed Feb 9, 2023
1 parent 5f14dd9 commit b0ff55c
Show file tree
Hide file tree
Showing 204 changed files with 8,141 additions and 13,592 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>ch.postfinance</groupId>
<artifactId>postfinancecheckout-java-sdk</artifactId>
<version>5.0.0</version>
<version>5.1.0</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 "ch.postfinance:postfinancecheckout-java-sdk:5.0.0"
compile "ch.postfinance:postfinancecheckout-java-sdk:5.1.0"
```

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

Then manually install the following JARs:

* `target/postfinancecheckout-java-sdk-5.0.0.jar`
* `target/postfinancecheckout-java-sdk-5.1.0.jar`
* `target/lib/*.jar`

## Usage
Expand Down
6 changes: 3 additions & 3 deletions 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 = 'ch.postfinance'
version = '5.0.0'
version = '5.1.0'

buildscript {
repositories {
Expand Down Expand Up @@ -97,19 +97,19 @@ ext {
swagger_annotations_version = "1.5.17"
jackson_version = "2.14.1"
google_api_client_version = "1.23.0"
jersey_common_version = "2.34"
jodatime_version = "2.9.9"
junit_version = "4.13.2"
httpclient_version = "4.5.14"
}

dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.api-client:google-api-client:${google_api_client_version}"
compile "org.glassfish.jersey.core:jersey-common:${jersey_common_version}"
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
testCompile "junit:junit:$junit_version"
}
3 changes: 2 additions & 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 := "ch.postfinance",
name := "postfinancecheckout-java-sdk",
version := "5.0.0",
version := "5.1.0",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand All @@ -15,6 +15,7 @@ lazy val root = (project in file(".")).
"com.fasterxml.jackson.core" % "jackson-core" % "2.14.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.14.1" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.14.1" % "compile",
"org.apache.httpcomponents" % "httpclient" % "4.5.14" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.14.1" % "compile",
"junit" % "junit" % "4.13.2" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
Expand Down
12 changes: 6 additions & 6 deletions 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>5.0.0</version>
<version>5.1.0</version>
<url>https://postfinance.ch/en/business/products/e-commerce/postfinance-checkout-all-in-one.html</url>
<description>The SDK for simplifying the integration with PostFinance Checkout API.</description>
<scm>
Expand Down Expand Up @@ -269,11 +269,11 @@
<artifactId>google-api-client</artifactId>
<version>${google-api-client-version}</version>
</dependency>
<!-- Jersey common to get an implementation of javax.ws.rs.core.UriBuilder for building URLs from templates -->
<!-- Apache HttpClient for building URLs from templates -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>${jersey-common-version}</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${apache-httpclient-version}</version>
</dependency>
<!-- JSON processing: jackson -->
<dependency>
Expand Down Expand Up @@ -309,8 +309,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.17</swagger-annotations-version>
<google-api-client-version>1.23.0</google-api-client-version>
<jersey-common-version>2.34</jersey-common-version>
<jackson-version>2.14.1</jackson-version>
<apache-httpclient-version>4.5.14</apache-httpclient-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/postfinance/sdk/DefaultHeaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void intercept(HttpRequest request) throws IOException {

private HttpHeaders getDefaultHeaders() {
HttpHeaders headers = new HttpHeaders();
headers.put("x-meta-sdk-version", "5.0.0");
headers.put("x-meta-sdk-version", "5.1.0");
headers.put("x-meta-sdk-language", "java");
headers.put("x-meta-sdk-provider", "PostFinance Checkout");
headers.put("x-meta-sdk-language-version", System.getProperty("java.version"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,36 @@ public class PostFinanceCheckoutSdkException extends RuntimeException {

private static final long serialVersionUID = 1675383192982547616L;

private final ErrorCode code;

private final String message;

/**
* Constructor.
*
* @param errorCode
* @param code
* the PostFinanceCheckout SDK error code
* @param message
* the exception message details
*/
public PostFinanceCheckoutSdkException(ErrorCode errorCode, String message) {
super(String.format("Error code: %d. %s", errorCode.getCode(), message));
public PostFinanceCheckoutSdkException(ErrorCode code, String message) {
super();
this.code = code;
this.message = String.format("Error code: %d. %s", code.getCode(), message);
}

/**
* @return the PostFinanceCheckout SDK error code
*/
public ErrorCode getCode() {
return this.code;
}

/**
* @return the PostFinanceCheckout SDK error message
*/
public String getMessage() {
return this.message;
}

}
106 changes: 106 additions & 0 deletions src/main/java/ch/postfinance/sdk/URIBuilderUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* PostFinance Checkout SDK
*
* This library allows to interact with the PostFinance Checkout payment service.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package ch.postfinance.sdk;

import com.google.api.client.http.UriTemplate;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collection;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.apache.http.client.utils.URIBuilder;

/**
* Helper class for creating and modifying URIBuilder {@link URIBuilder}
*/
public final class URIBuilderUtil {
/**
* Create a new URIBuilder instance from url
*
* @throws IllegalArgumentException if url is not a valid URI template or is null.
* @param url to be used as URI
* @return a new {@link URIBuilder}
*/
public static URIBuilder create(String url) {
try {
return new URIBuilder(url);
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URI: " + e.getLocalizedMessage());
}
}

/**
* Create a new {@link URIBuilder} instance from url with parameters
*
* @throws IllegalArgumentException if url is not a valid URI template or is null.
* @param url to be used as URI template
* @param pathParameters path parameters to be resolved in url
* @return a new {@link URIBuilder}
*/
public static URIBuilder create(String url, Map<String, Object> pathParameters) {
try {
return new URIBuilder(UriTemplate.expand(url, pathParameters, false));
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URI: " + e.getLocalizedMessage());
}
}

/**
* Build {@link URIBuilder} to {@link URI}
*
* @throws IllegalArgumentException if url is not a valid URI template or is null.
* @param uriBuilder {@link URIBuilder} to build
* @return a new {@link URI}
*/
public static URI build(URIBuilder uriBuilder) {
try {
return uriBuilder.build();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid URI: " + e.getLocalizedMessage());
}
}

/**
* Apply query parameter
* @param uriBuilder uri builder instance query parameters will applied to
* @param paramName query parameter name
* @param paramValue query parameter value
* @return uri builder with applied parameters
*/
public static URIBuilder applyQueryParam(URIBuilder uriBuilder, String paramName, Object paramValue) {
if (paramValue instanceof Collection) {
uriBuilder = applyCollection(uriBuilder, paramName, ((Collection) paramValue).toArray());
} else if (paramValue instanceof Object[]) {
uriBuilder = applyCollection(uriBuilder, paramName, (Object[]) paramValue);
} else {
uriBuilder = uriBuilder.addParameter(paramName, paramValue.toString());
}
return uriBuilder;
}

private static URIBuilder applyCollection(URIBuilder uriBuilder, String paramName, Object[] paramValues) {
for (Object paramValue: paramValues) {
uriBuilder.addParameter(paramName, paramValue.toString());
}
return uriBuilder;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public AbstractAccountUpdate lastModifiedDate(OffsetDateTime lastModifiedDate) {
}

/**
*
* The date and time when the object was last modified.
* @return lastModifiedDate
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The date and time when the object was last modified.")
public OffsetDateTime getLastModifiedDate() {
return lastModifiedDate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ public AbstractApplicationUserUpdate state(CreationEntityState state) {
}

/**
*
* The object&#39;s current state.
* @return state
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The object's current state.")
public CreationEntityState getState() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ public AbstractCustomerActive language(String language) {
}

/**
*
* The language that is linked to the object.
* @return language
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The language that is linked to the object.")
public String getLanguage() {
return language;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public AbstractHumanUserUpdate state(CreationEntityState state) {
}

/**
*
* The object&#39;s current state.
* @return state
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The object's current state.")
public CreationEntityState getState() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public AbstractSpaceUpdate lastModifiedDate(OffsetDateTime lastModifiedDate) {
}

/**
*
* The date and time when the object was last modified.
* @return lastModifiedDate
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The date and time when the object was last modified.")
public OffsetDateTime getLastModifiedDate() {
return lastModifiedDate;
}
Expand Down Expand Up @@ -174,10 +174,10 @@ public AbstractSpaceUpdate state(CreationEntityState state) {
}

/**
*
* The object&#39;s current state.
* @return state
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The object's current state.")
public CreationEntityState getState() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public AbstractTokenUpdate language(String language) {
}

/**
*
* The language that is linked to the object.
* @return language
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The language that is linked to the object.")
public String getLanguage() {
return language;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ public AbstractTransactionPending language(String language) {
}

/**
*
* The language that is linked to the object.
* @return language
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The language that is linked to the object.")
public String getLanguage() {
return language;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ public AbstractWebhookListenerUpdate state(CreationEntityState state) {
}

/**
*
* The object&#39;s current state.
* @return state
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The object's current state.")
public CreationEntityState getState() {
return state;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public AbstractWebhookUrlUpdate state(CreationEntityState state) {
}

/**
*
* The object&#39;s current state.
* @return state
**/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "The object's current state.")
public CreationEntityState getState() {
return state;
}
Expand Down
Loading

0 comments on commit b0ff55c

Please sign in to comment.