Skip to content

Commit

Permalink
Release 7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wallee-deployment-user committed Jan 23, 2024
1 parent 9327173 commit 20519a7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 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>7.1.0</version>
<version>7.2.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:7.1.0"
compile "ch.postfinance:postfinancecheckout-java-sdk:7.2.0"
```

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

Then manually install the following JARs:

* `target/postfinancecheckout-java-sdk-7.1.0.jar`
* `target/postfinancecheckout-java-sdk-7.2.0.jar`
* `target/lib/*.jar`

## Usage
Expand Down
5 changes: 3 additions & 2 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 = '7.1.0'
version = '7.2.0'

buildscript {
repositories {
Expand Down Expand Up @@ -98,9 +98,9 @@ ext {
jackson_version = "2.14.1"
google_api_client_version = "2.2.0"
guava_version = "32.1.2-jre"
jodatime_version = "2.9.9"
junit_version = "4.13.2"
httpclient_version = "4.5.14"
bouncycastle_version = "1.77"
}

dependencies {
Expand All @@ -117,5 +117,6 @@ dependencies {
exclude group: 'commons-codec', module: 'commons-codec'
}
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
compile "org.bouncycastle:bcprov-jdk18on:$bouncycastle_version"
testCompile "junit:junit:$junit_version"
}
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 := "ch.postfinance",
name := "postfinancecheckout-java-sdk",
version := "7.1.0",
version := "7.2.0",
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>7.1.0</version>
<version>7.2.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
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", "7.1.0");
headers.put("x-meta-sdk-version", "7.2.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
18 changes: 9 additions & 9 deletions src/main/java/ch/postfinance/sdk/EncryptionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;

import com.wallee.sdk.model.WebhookEncryptionPublicKey;
import ch.postfinance.sdk.model.WebhookEncryptionPublicKey;

/**
* Helper class to verify content body with signature
Expand All @@ -57,19 +57,19 @@ public static boolean isContentValid(String contentToVerify, String contentSigna
try {
verifier.initVerify(publicKey);
} catch (InvalidKeyException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
"Could not verify content due to public key issue: " + e.getLocalizedMessage());
}
try {
verifier.update(contentToVerify.getBytes(StandardCharsets.UTF_8));
} catch (SignatureException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
"Could not verify content due to verifier issue: " + e.getLocalizedMessage());
}
try {
return verifier.verify(Base64.getDecoder().decode(contentSignature));
} catch (SignatureException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
"Could not verify content due to unknown issue: " + e.getLocalizedMessage());

}
Expand All @@ -83,13 +83,13 @@ private static PublicKey getPublicKey(String publicKeyId, byte[] publicKeyBytes,
.generatePublic(
new X509EncodedKeySpec(publicKeyBytes));
} catch (InvalidKeySpecException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
"Invalid public key with ID: " + publicKeyId);
} catch (NoSuchAlgorithmException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
"Unknown webhook signature encryption algorithm: " + signatureAlgorithm);
} catch (NoSuchProviderException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_PROVIDER,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_PROVIDER,
"Unknown webhook signature encryption provider: " + encryptionProvider);
}
}
Expand All @@ -98,7 +98,7 @@ private static Signature getSignature(String signatureAlgorithm) {
try {
return Signature.getInstance(signatureAlgorithm);
} catch (NoSuchAlgorithmException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
"Unknown signature algorithm: " + signatureAlgorithm);
}
}
Expand All @@ -110,7 +110,7 @@ private static String getPublicKeyAlgorithm(String signatureAlgorithm) {
publicKeyAlgorithm = "ECDSA";
break;
default:
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_UNKNOWN_ALGORITHM,
"Unknown webhook signature encryption algorithm: " + signatureAlgorithm);
}
return publicKeyAlgorithm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ public boolean isContentValid(String signatureHeader, String contentToVerify, St
try {
publicKey = this.read(publicKeyId);
} catch (IOException e) {
throw new WalleeSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
throw new PostFinanceCheckoutSdkException(ErrorCode.WEBHOOK_ENCRYPTION_GENERAL_ERROR,
"Could not retrieve public key with ID: " + publicKeyId);
} catch (WalleeSdkException e) {
} catch (PostFinanceCheckoutSdkException e) {
if (e.getCode() == ENTITY_NOT_FOUND) {
throw new WalleeSdkException(
throw new PostFinanceCheckoutSdkException(
ErrorCode.WEBHOOK_ENCRYPTION_PUBLIC_KEY_UNKNOWN,
"Unknown public key with ID: " + publicKeyId);
}
Expand All @@ -200,7 +200,7 @@ public boolean isContentValid(String signatureHeader, String contentToVerify, St
}
return EncryptionUtil.isContentValid(contentToVerify, contentSignature, publicKey, encryptionProviderName, signatureAlgorithm);
} else {
throw new WalleeSdkException(WEBHOOK_ENCRYPTION_SIGNATURE_HEADER_INVALID, "Invalid webhook signature header. Expected format: 'algorithm=<algorithm>, keyId=<keyId>, signature=<signature>'");
throw new PostFinanceCheckoutSdkException(WEBHOOK_ENCRYPTION_SIGNATURE_HEADER_INVALID, "Invalid webhook signature header. Expected format: 'algorithm=<algorithm>, keyId=<keyId>, signature=<signature>'");
}
}

Expand Down

0 comments on commit 20519a7

Please sign in to comment.