From bd62127450064be80449fa6197e1281eb4bad396 Mon Sep 17 00:00:00 2001 From: Victor Ndambakuwa Date: Fri, 21 Aug 2020 13:14:26 +0200 Subject: [PATCH] Release 2.2.7 --- README.md | 6 ++-- build.gradle | 2 +- build.sbt | 2 +- pom.xml | 2 +- .../postfinancecheckout/sdk/ApiClient.java | 2 ++ .../sdk/test/TransactionServiceTest.java | 34 +++++++++++++++++-- 6 files changed, 39 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a716174..788a747 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add this dependency to your project's POM: com.postfinancecheckout postfinancecheckout-java-sdk - 2.2.6 + 2.2.7 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.postfinancecheckout:postfinancecheckout-java-sdk:2.2.6" +compile "com.postfinancecheckout:postfinancecheckout-java-sdk:2.2.7" ``` ### Others @@ -46,7 +46,7 @@ mvn clean package Then manually install the following JARs: -* `target/postfinancecheckout-java-sdk-2.2.6.jar` +* `target/postfinancecheckout-java-sdk-2.2.7.jar` * `target/lib/*.jar` ## Usage diff --git a/build.gradle b/build.gradle index f0b9788..3afb272 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'idea' apply plugin: 'eclipse' group = 'com.postfinancecheckout' -version = '2.2.6' +version = '2.2.7' buildscript { repositories { diff --git a/build.sbt b/build.sbt index b36db2e..2d727af 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.postfinancecheckout", name := "postfinancecheckout-java-sdk", - version := "2.2.6", + version := "2.2.7", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/pom.xml b/pom.xml index 1ea873f..8c34f27 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ postfinancecheckout-java-sdk jar postfinancecheckout-java-sdk - 2.2.6 + 2.2.7 https://www.postfinance.ch/checkout The SDK for simplifying the integration with PostFinance Checkout API. diff --git a/src/main/java/com/postfinancecheckout/sdk/ApiClient.java b/src/main/java/com/postfinancecheckout/sdk/ApiClient.java index 3770c70..a1573df 100644 --- a/src/main/java/com/postfinancecheckout/sdk/ApiClient.java +++ b/src/main/java/com/postfinancecheckout/sdk/ApiClient.java @@ -1,6 +1,7 @@ package com.postfinancecheckout.sdk; import com.postfinancecheckout.sdk.service.*; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -29,6 +30,7 @@ private static ObjectMapper createDefaultObjectMapper() { .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) .setDateFormat(new RFC3339DateFormat()); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.registerModule(new JavaTimeModule()); return objectMapper; } diff --git a/src/test/java/com/postfinancecheckout/sdk/test/TransactionServiceTest.java b/src/test/java/com/postfinancecheckout/sdk/test/TransactionServiceTest.java index 23fe9ff..62fb2d5 100644 --- a/src/test/java/com/postfinancecheckout/sdk/test/TransactionServiceTest.java +++ b/src/test/java/com/postfinancecheckout/sdk/test/TransactionServiceTest.java @@ -52,11 +52,16 @@ private TransactionCreate getTransactionPayload() { .amountIncludingTax(BigDecimal.valueOf(29.95)) .sku("red-t-shirt-123"); + + // Customer email address + String customerEmailAddress = "test@example.com"; + + // Customer Billind Address AddressCreate billingAddress = new AddressCreate(); billingAddress.city("Winterthur") .country("CH") - .emailAddress("test@example.com") + .emailAddress(customerEmailAddress) .familyName("Customer") .givenName("Good") .postcode("8400") @@ -70,6 +75,8 @@ private TransactionCreate getTransactionPayload() { this.transactionPayload.setBillingAddress(billingAddress); this.transactionPayload.setShippingAddress(billingAddress); this.transactionPayload.addLineItemsItem(lineItem); + this.transactionPayload.setCustomerId("1234"); + this.transactionPayload.setCustomerEmailAddress(customerEmailAddress); } return this.transactionPayload; } @@ -375,10 +382,31 @@ public void updateTest() { /** * updateTransactionLineItems */ - @Ignore @Test public void updateTransactionLineItemsTest() { - // TODO: test validations + try { + Transaction transaction = this.apiClient.getTransactionService().create(this.spaceId, this.getTransactionPayload()); + + // Line item + LineItemCreate lineItem = new LineItemCreate(); + lineItem.name("Blue T-Shirt") + .uniqueId("5413") + .type(LineItemType.PRODUCT) + .quantity(BigDecimal.valueOf(1)) + .amountIncludingTax(BigDecimal.valueOf(39.95)) + .sku("blue-t-shirt-123"); + + TransactionPending transactionPending = new TransactionPending(); + transactionPending.version(transaction.getVersion().longValue()) + .id(transaction.getId()) + .addLineItemsItem(lineItem) + .customerId(transaction.getCustomerId()) + .currency(transaction.getCurrency()); + Transaction transactionUpdate = this.apiClient.getTransactionService().update(spaceId, transactionPending); + Assert.assertEquals(transaction.getId(), transactionUpdate.getId()); + }catch (Exception e){ + e.printStackTrace(); + } } }