Skip to content

Commit 7ea825a

Browse files
author
Thomas Hunziker
committed
Release 3.0.1
1 parent 837bc32 commit 7ea825a

File tree

11 files changed

+152
-34
lines changed

11 files changed

+152
-34
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>3.0.0</version>
26+
<version>3.0.1</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:3.0.0"
36+
compile "com.postfinancecheckout:postfinancecheckout-java-sdk:3.0.1"
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-3.0.0.jar`
49+
* `target/postfinancecheckout-java-sdk-3.0.1.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 = '3.0.0'
5+
version = '3.0.1'
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 := "3.0.0",
5+
version := "3.0.1",
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>3.0.0</version>
8+
<version>3.0.1</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/model/PaymentContract.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ public OffsetDateTime getCreatedOn() {
164164

165165

166166
/**
167-
* The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
167+
* A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
168168
* @return externalId
169169
**/
170-
@ApiModelProperty(value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.")
170+
@ApiModelProperty(value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.")
171171
public String getExternalId() {
172172
return externalId;
173173
}

src/main/java/com/postfinancecheckout/sdk/model/PaymentLink.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ public String getCurrency() {
182182

183183

184184
/**
185-
* The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
185+
* A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
186186
* @return externalId
187187
**/
188-
@ApiModelProperty(value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.")
188+
@ApiModelProperty(value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.")
189189
public String getExternalId() {
190190
return externalId;
191191
}

src/main/java/com/postfinancecheckout/sdk/model/PaymentLinkCreate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public PaymentLinkCreate externalId(String externalId) {
7878
}
7979

8080
/**
81-
* The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
81+
* A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
8282
* @return externalId
8383
**/
84-
@ApiModelProperty(required = true, value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.")
84+
@ApiModelProperty(required = true, value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.")
8585
public String getExternalId() {
8686
return externalId;
8787
}

src/main/java/com/postfinancecheckout/sdk/model/PaymentTerminalLocation.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import com.fasterxml.jackson.annotation.JsonCreator;
2626
import com.fasterxml.jackson.annotation.JsonValue;
2727
import com.postfinancecheckout.sdk.model.PaymentTerminalAddress;
28-
import com.postfinancecheckout.sdk.model.PaymentTerminalConfiguration;
2928
import com.postfinancecheckout.sdk.model.PaymentTerminalLocationState;
3029
import io.swagger.annotations.ApiModel;
3130
import io.swagger.annotations.ApiModelProperty;
@@ -44,10 +43,6 @@ public class PaymentTerminalLocation {
4443
protected PaymentTerminalAddress contactAddress = null;
4544

4645

47-
@JsonProperty("defaultConfiguration")
48-
protected PaymentTerminalConfiguration defaultConfiguration = null;
49-
50-
5146
@JsonProperty("id")
5247
protected Long id = null;
5348

@@ -83,16 +78,6 @@ public PaymentTerminalAddress getContactAddress() {
8378
}
8479

8580

86-
/**
87-
*
88-
* @return defaultConfiguration
89-
**/
90-
@ApiModelProperty(value = "")
91-
public PaymentTerminalConfiguration getDefaultConfiguration() {
92-
return defaultConfiguration;
93-
}
94-
95-
9681
/**
9782
* The ID is the primary key of the entity. The ID identifies the entity uniquely.
9883
* @return id
@@ -164,7 +149,6 @@ public boolean equals(java.lang.Object o) {
164149
}
165150
PaymentTerminalLocation paymentTerminalLocation = (PaymentTerminalLocation) o;
166151
return Objects.equals(this.contactAddress, paymentTerminalLocation.contactAddress) &&
167-
Objects.equals(this.defaultConfiguration, paymentTerminalLocation.defaultConfiguration) &&
168152
Objects.equals(this.id, paymentTerminalLocation.id) &&
169153
Objects.equals(this.linkedSpaceId, paymentTerminalLocation.linkedSpaceId) &&
170154
Objects.equals(this.name, paymentTerminalLocation.name) &&
@@ -175,7 +159,7 @@ public boolean equals(java.lang.Object o) {
175159

176160
@Override
177161
public int hashCode() {
178-
return Objects.hash(contactAddress, defaultConfiguration, id, linkedSpaceId, name, plannedPurgeDate, state, version);
162+
return Objects.hash(contactAddress, id, linkedSpaceId, name, plannedPurgeDate, state, version);
179163
}
180164

181165

@@ -185,7 +169,6 @@ public String toString() {
185169
sb.append("class PaymentTerminalLocation {\n");
186170

187171
sb.append(" contactAddress: ").append(toIndentedString(contactAddress)).append("\n");
188-
sb.append(" defaultConfiguration: ").append(toIndentedString(defaultConfiguration)).append("\n");
189172
sb.append(" id: ").append(toIndentedString(id)).append("\n");
190173
sb.append(" linkedSpaceId: ").append(toIndentedString(linkedSpaceId)).append("\n");
191174
sb.append(" name: ").append(toIndentedString(name)).append("\n");

src/main/java/com/postfinancecheckout/sdk/model/Token.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ public Boolean isEnabledForOneClickPayment() {
132132

133133

134134
/**
135-
* The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
135+
* A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
136136
* @return externalId
137137
**/
138-
@ApiModelProperty(value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.")
138+
@ApiModelProperty(value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.")
139139
public String getExternalId() {
140140
return externalId;
141141
}

src/main/java/com/postfinancecheckout/sdk/model/TokenCreate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ public TokenCreate externalId(String externalId) {
5353
}
5454

5555
/**
56-
* The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
56+
* A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.
5757
* @return externalId
5858
**/
59-
@ApiModelProperty(required = true, value = "The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.")
59+
@ApiModelProperty(required = true, value = "A client generated nonce which identifies the entity to be created. Subsequent creation requests with the same external ID will not create new entities but return the initially created entity instead.")
6060
public String getExternalId() {
6161
return externalId;
6262
}

src/main/java/com/postfinancecheckout/sdk/service/TokenService.java

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.postfinancecheckout.sdk.ApiClient;
44

5+
import com.postfinancecheckout.sdk.model.Charge;
56
import com.postfinancecheckout.sdk.model.ClientError;
67
import com.postfinancecheckout.sdk.model.EntityQuery;
78
import com.postfinancecheckout.sdk.model.EntityQueryFilter;
@@ -879,6 +880,140 @@ public HttpResponse deleteForHttpResponse(Long spaceId, Long id, Map<String, Obj
879880
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
880881

881882

883+
httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT);
884+
return httpRequest.execute();
885+
}
886+
887+
/**
888+
* Process Transaction
889+
* This operation processes the given transaction by using the token associated with the transaction.
890+
* <p><b>200</b> - This status code indicates that a client request was successfully received, understood, and accepted.
891+
* <p><b>442</b> - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
892+
* <p><b>542</b> - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
893+
* @param spaceId
894+
* @param transactionId The id of the transaction for which we want to check if the token can be created or not.
895+
* @return Charge
896+
* @throws IOException if an error occurs while attempting to invoke the API
897+
* For more information visit this link.
898+
* @see <a href="https://checkout.postfinance.ch/doc/api/web-service#token-service--process-transaction">Process Transaction Documentation</a>
899+
900+
**/
901+
public Charge processTransaction(Long spaceId, Long transactionId) throws IOException {
902+
HttpResponse response = processTransactionForHttpResponse(spaceId, transactionId);
903+
String returnType = "Charge";
904+
if(returnType.equals("String")){
905+
return (Charge) (Object) response.parseAsString();
906+
}
907+
TypeReference typeRef = new TypeReference<Charge>() {};
908+
return (Charge)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
909+
}
910+
911+
/**
912+
* Process Transaction
913+
* This operation processes the given transaction by using the token associated with the transaction.
914+
* <p><b>200</b> - This status code indicates that a client request was successfully received, understood, and accepted.
915+
* <p><b>442</b> - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error.
916+
* <p><b>542</b> - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request.
917+
* @param spaceId
918+
* @param transactionId The id of the transaction for which we want to check if the token can be created or not.
919+
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
920+
* @return Charge
921+
* @throws IOException if an error occurs while attempting to invoke the API
922+
* For more information visit this link.
923+
* @see <a href="https://checkout.postfinance.ch/doc/api/web-service#token-service--process-transaction">Process Transaction Documentation</a>
924+
925+
**/
926+
public Charge processTransaction(Long spaceId, Long transactionId, Map<String, Object> params) throws IOException {
927+
HttpResponse response = processTransactionForHttpResponse(spaceId, transactionId, params);
928+
String returnType = "Charge";
929+
if(returnType.equals("String")){
930+
return (Charge) (Object) response.parseAsString();
931+
}
932+
TypeReference typeRef = new TypeReference<Charge>() {};
933+
return (Charge)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
934+
}
935+
936+
public HttpResponse processTransactionForHttpResponse(Long spaceId, Long transactionId) throws IOException {
937+
// verify the required parameter 'spaceId' is set
938+
if (spaceId == null) {
939+
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling processTransaction");
940+
}// verify the required parameter 'transactionId' is set
941+
if (transactionId == null) {
942+
throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling processTransaction");
943+
}
944+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/token/process-transaction");
945+
if (spaceId != null) {
946+
String key = "spaceId";
947+
Object value = spaceId;
948+
if (value instanceof Collection) {
949+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
950+
} else if (value instanceof Object[]) {
951+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
952+
} else {
953+
uriBuilder = uriBuilder.queryParam(key, value);
954+
}
955+
} if (transactionId != null) {
956+
String key = "transactionId";
957+
Object value = transactionId;
958+
if (value instanceof Collection) {
959+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
960+
} else if (value instanceof Object[]) {
961+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
962+
} else {
963+
uriBuilder = uriBuilder.queryParam(key, value);
964+
}
965+
}
966+
967+
String url = uriBuilder.build().toString();
968+
GenericUrl genericUrl = new GenericUrl(url);
969+
970+
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
971+
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
972+
973+
974+
httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT);
975+
return httpRequest.execute();
976+
}
977+
978+
public HttpResponse processTransactionForHttpResponse(Long spaceId, Long transactionId, Map<String, Object> params) throws IOException {
979+
// verify the required parameter 'spaceId' is set
980+
if (spaceId == null) {
981+
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling processTransaction");
982+
}// verify the required parameter 'transactionId' is set
983+
if (transactionId == null) {
984+
throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling processTransaction");
985+
}
986+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/token/process-transaction");
987+
988+
// Copy the params argument if present, to allow passing in immutable maps
989+
Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
990+
// Add the required query param 'spaceId' to the map of query params
991+
allParams.put("spaceId", spaceId);
992+
// Add the required query param 'transactionId' to the map of query params
993+
allParams.put("transactionId", transactionId);
994+
995+
for (Map.Entry<String, Object> entryMap: allParams.entrySet()) {
996+
String key = entryMap.getKey();
997+
Object value = entryMap.getValue();
998+
999+
if (key != null && value != null) {
1000+
if (value instanceof Collection) {
1001+
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1002+
} else if (value instanceof Object[]) {
1003+
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
1004+
} else {
1005+
uriBuilder = uriBuilder.queryParam(key, value);
1006+
}
1007+
}
1008+
}
1009+
1010+
String url = uriBuilder.build().toString();
1011+
GenericUrl genericUrl = new GenericUrl(url);
1012+
1013+
HttpContent content = apiClient.new JacksonJsonHttpContent(null);
1014+
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
1015+
1016+
8821017
httpRequest.setReadTimeout(ApiClient.READ_TIMEOUT);
8831018
return httpRequest.execute();
8841019
}

0 commit comments

Comments
 (0)