From 3f5770777773dbc5932355a186598068424dc16a Mon Sep 17 00:00:00 2001 From: Thomas Hunziker Date: Mon, 15 Mar 2021 07:24:49 +0100 Subject: [PATCH] Release 2.2.23 --- README.md | 6 +- build.gradle | 2 +- build.sbt | 2 +- pom.xml | 2 +- .../model/AuthenticatedCardDataCreate.java | 27 ++- .../sdk/model/TokenizedCardDataCreate.java | 27 ++- .../service/PaymentTerminalTillService.java | 169 ++++++++++++++++++ 7 files changed, 227 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 33d13f28..8a676e1c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this dependency to your project's POM: com.wallee wallee-java-sdk - 2.2.22 + 2.2.23 compile ``` @@ -33,7 +33,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "com.wallee:wallee-java-sdk:2.2.22" +compile "com.wallee:wallee-java-sdk:2.2.23" ``` ### Others @@ -46,7 +46,7 @@ mvn clean package Then manually install the following JARs: -* `target/wallee-java-sdk-2.2.22.jar` +* `target/wallee-java-sdk-2.2.23.jar` * `target/lib/*.jar` ## Usage diff --git a/build.gradle b/build.gradle index c5268bdc..d1a906c1 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.wallee' -version = '2.2.22' +version = '2.2.23' buildscript { repositories { diff --git a/build.sbt b/build.sbt index fbc3b48a..fcd2ed17 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.wallee", name := "wallee-java-sdk", - version := "2.2.22", + version := "2.2.23", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/pom.xml b/pom.xml index 0f5473fc..e7e068a8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ wallee-java-sdk jar wallee-java-sdk - 2.2.22 + 2.2.23 https://www.wallee.com The SDK for simplifying the integration with wallee API. diff --git a/src/main/java/com/wallee/sdk/model/AuthenticatedCardDataCreate.java b/src/main/java/com/wallee/sdk/model/AuthenticatedCardDataCreate.java index 745ada6c..3ead8a24 100644 --- a/src/main/java/com/wallee/sdk/model/AuthenticatedCardDataCreate.java +++ b/src/main/java/com/wallee/sdk/model/AuthenticatedCardDataCreate.java @@ -67,6 +67,10 @@ public class AuthenticatedCardDataCreate { protected RecurringIndicator recurringIndicator = null; + @JsonProperty("schemeTransactionReference") + protected String schemeTransactionReference = null; + + @JsonProperty("tokenRequestorId") protected String tokenRequestorId = null; @@ -205,6 +209,25 @@ public void setRecurringIndicator(RecurringIndicator recurringIndicator) { } + public AuthenticatedCardDataCreate schemeTransactionReference(String schemeTransactionReference) { + this.schemeTransactionReference = schemeTransactionReference; + return this; + } + + /** + * + * @return schemeTransactionReference + **/ + @ApiModelProperty(value = "") + public String getSchemeTransactionReference() { + return schemeTransactionReference; + } + + public void setSchemeTransactionReference(String schemeTransactionReference) { + this.schemeTransactionReference = schemeTransactionReference; + } + + public AuthenticatedCardDataCreate tokenRequestorId(String tokenRequestorId) { this.tokenRequestorId = tokenRequestorId; return this; @@ -241,12 +264,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.expiryDate, authenticatedCardDataCreate.expiryDate) && Objects.equals(this.primaryAccountNumber, authenticatedCardDataCreate.primaryAccountNumber) && Objects.equals(this.recurringIndicator, authenticatedCardDataCreate.recurringIndicator) && + Objects.equals(this.schemeTransactionReference, authenticatedCardDataCreate.schemeTransactionReference) && Objects.equals(this.tokenRequestorId, authenticatedCardDataCreate.tokenRequestorId); } @Override public int hashCode() { - return Objects.hash(cardHolderName, cardVerificationCode, cardholderAuthentication, cryptogram, expiryDate, primaryAccountNumber, recurringIndicator, tokenRequestorId); + return Objects.hash(cardHolderName, cardVerificationCode, cardholderAuthentication, cryptogram, expiryDate, primaryAccountNumber, recurringIndicator, schemeTransactionReference, tokenRequestorId); } @@ -262,6 +286,7 @@ public String toString() { sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); sb.append(" primaryAccountNumber: ").append(toIndentedString(primaryAccountNumber)).append("\n"); sb.append(" recurringIndicator: ").append(toIndentedString(recurringIndicator)).append("\n"); + sb.append(" schemeTransactionReference: ").append(toIndentedString(schemeTransactionReference)).append("\n"); sb.append(" tokenRequestorId: ").append(toIndentedString(tokenRequestorId)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/wallee/sdk/model/TokenizedCardDataCreate.java b/src/main/java/com/wallee/sdk/model/TokenizedCardDataCreate.java index 1c8ee200..6179caa4 100644 --- a/src/main/java/com/wallee/sdk/model/TokenizedCardDataCreate.java +++ b/src/main/java/com/wallee/sdk/model/TokenizedCardDataCreate.java @@ -62,6 +62,10 @@ public class TokenizedCardDataCreate { protected RecurringIndicator recurringIndicator = null; + @JsonProperty("schemeTransactionReference") + protected String schemeTransactionReference = null; + + @JsonProperty("tokenRequestorId") protected String tokenRequestorId = null; @@ -181,6 +185,25 @@ public void setRecurringIndicator(RecurringIndicator recurringIndicator) { } + public TokenizedCardDataCreate schemeTransactionReference(String schemeTransactionReference) { + this.schemeTransactionReference = schemeTransactionReference; + return this; + } + + /** + * + * @return schemeTransactionReference + **/ + @ApiModelProperty(value = "") + public String getSchemeTransactionReference() { + return schemeTransactionReference; + } + + public void setSchemeTransactionReference(String schemeTransactionReference) { + this.schemeTransactionReference = schemeTransactionReference; + } + + public TokenizedCardDataCreate tokenRequestorId(String tokenRequestorId) { this.tokenRequestorId = tokenRequestorId; return this; @@ -216,12 +239,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.expiryDate, tokenizedCardDataCreate.expiryDate) && Objects.equals(this.primaryAccountNumber, tokenizedCardDataCreate.primaryAccountNumber) && Objects.equals(this.recurringIndicator, tokenizedCardDataCreate.recurringIndicator) && + Objects.equals(this.schemeTransactionReference, tokenizedCardDataCreate.schemeTransactionReference) && Objects.equals(this.tokenRequestorId, tokenizedCardDataCreate.tokenRequestorId); } @Override public int hashCode() { - return Objects.hash(cardHolderName, cardVerificationCode, cryptogram, expiryDate, primaryAccountNumber, recurringIndicator, tokenRequestorId); + return Objects.hash(cardHolderName, cardVerificationCode, cryptogram, expiryDate, primaryAccountNumber, recurringIndicator, schemeTransactionReference, tokenRequestorId); } @@ -236,6 +260,7 @@ public String toString() { sb.append(" expiryDate: ").append(toIndentedString(expiryDate)).append("\n"); sb.append(" primaryAccountNumber: ").append(toIndentedString(primaryAccountNumber)).append("\n"); sb.append(" recurringIndicator: ").append(toIndentedString(recurringIndicator)).append("\n"); + sb.append(" schemeTransactionReference: ").append(toIndentedString(schemeTransactionReference)).append("\n"); sb.append(" tokenRequestorId: ").append(toIndentedString(tokenRequestorId)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/com/wallee/sdk/service/PaymentTerminalTillService.java b/src/main/java/com/wallee/sdk/service/PaymentTerminalTillService.java index 4b300640..d39d3deb 100644 --- a/src/main/java/com/wallee/sdk/service/PaymentTerminalTillService.java +++ b/src/main/java/com/wallee/sdk/service/PaymentTerminalTillService.java @@ -203,4 +203,173 @@ public HttpResponse performTransactionForHttpResponse(Long spaceId, Long transac return httpRequest.execute(); } + /** + * Perform Payment Terminal Transaction (using TID) + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - 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. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalIdentifier The identifier (aka TID) of the terminal which should be used to process the transaction. + * @param language The language in which the messages should be rendered in. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction (using TID) Documentation + + **/ + public Transaction performTransactionByIdentifier(Long spaceId, Long transactionId, String terminalIdentifier, String language) throws IOException { + HttpResponse response = performTransactionByIdentifierForHttpResponse(spaceId, transactionId, terminalIdentifier, language); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + /** + * Perform Payment Terminal Transaction (using TID) + * Starts a payment terminal transaction and waits for its completion. If the call returns with a long polling timeout status, you may try again. The processing of the transaction will be picked up where it was left off. + *

200 - This status code indicates that a client request was successfully received, understood, and accepted. + *

409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request. + *

442 - 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. + *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. + *

543 - This status code indicates that the long polling request timed out. + * @param spaceId + * @param transactionId The ID of the transaction which is used to process with the terminal. + * @param terminalIdentifier The identifier (aka TID) of the terminal which should be used to process the transaction. + * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. + * @return Transaction + * @throws IOException if an error occurs while attempting to invoke the API + * For more information visit this link. + * @see Perform Payment Terminal Transaction (using TID) Documentation + + **/ + public Transaction performTransactionByIdentifier(Long spaceId, Long transactionId, String terminalIdentifier, Map params) throws IOException { + HttpResponse response = performTransactionByIdentifierForHttpResponse(spaceId, transactionId, terminalIdentifier, params); + String returnType = "Transaction"; + if(returnType.equals("String")){ + return (Transaction) (Object) response.parseAsString(); + } + TypeReference typeRef = new TypeReference() {}; + return (Transaction)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); + } + + public HttpResponse performTransactionByIdentifierForHttpResponse(Long spaceId, Long transactionId, String terminalIdentifier, String language) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'terminalIdentifier' is set + if (terminalIdentifier == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalIdentifier' when calling performTransactionByIdentifier"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction-by-identifier"); + if (spaceId != null) { + String key = "spaceId"; + Object value = spaceId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (transactionId != null) { + String key = "transactionId"; + Object value = transactionId; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (terminalIdentifier != null) { + String key = "terminalIdentifier"; + Object value = terminalIdentifier; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } if (language != null) { + String key = "language"; + Object value = language; + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + + public HttpResponse performTransactionByIdentifierForHttpResponse(Long spaceId, Long transactionId, String terminalIdentifier, Map params) throws IOException { + // verify the required parameter 'spaceId' is set + if (spaceId == null) { + throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'transactionId' is set + if (transactionId == null) { + throw new IllegalArgumentException("Missing the required parameter 'transactionId' when calling performTransactionByIdentifier"); + }// verify the required parameter 'terminalIdentifier' is set + if (terminalIdentifier == null) { + throw new IllegalArgumentException("Missing the required parameter 'terminalIdentifier' when calling performTransactionByIdentifier"); + } + UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/payment-terminal-till/perform-transaction-by-identifier"); + + // Copy the params argument if present, to allow passing in immutable maps + Map allParams = params == null ? new HashMap() : new HashMap(params); + // Add the required query param 'spaceId' to the map of query params + allParams.put("spaceId", spaceId); + // Add the required query param 'transactionId' to the map of query params + allParams.put("transactionId", transactionId); + // Add the required query param 'terminalIdentifier' to the map of query params + allParams.put("terminalIdentifier", terminalIdentifier); + + for (Map.Entry entryMap: allParams.entrySet()) { + String key = entryMap.getKey(); + Object value = entryMap.getValue(); + + if (key != null && value != null) { + if (value instanceof Collection) { + uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray()); + } else if (value instanceof Object[]) { + uriBuilder = uriBuilder.queryParam(key, (Object[]) value); + } else { + uriBuilder = uriBuilder.queryParam(key, value); + } + } + } + + String url = uriBuilder.build().toString(); + GenericUrl genericUrl = new GenericUrl(url); + + HttpContent content = null; + HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); + httpRequest.getHeaders().setContentType("application/json;charset=utf-8"); + httpRequest.setReadTimeout(90 * 1000); + + return httpRequest.execute(); + } + }