diff --git a/ipp-v3-java-data/pom.xml b/ipp-v3-java-data/pom.xml index 928ca712..758ca0a5 100755 --- a/ipp-v3-java-data/pom.xml +++ b/ipp-v3-java-data/pom.xml @@ -4,7 +4,7 @@ com.intuit.quickbooks-online ipp-v3-java-devkit-pom - 6.6.1 + 6.6.2 ipp-v3-java-data diff --git a/ipp-v3-java-data/src/main/java/com/intuit/ipp/data/WebhooksCloudEvents.java b/ipp-v3-java-data/src/main/java/com/intuit/ipp/data/WebhooksCloudEvents.java new file mode 100644 index 00000000..fb35c1a6 --- /dev/null +++ b/ipp-v3-java-data/src/main/java/com/intuit/ipp/data/WebhooksCloudEvents.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2025 Intuit + * + * 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 com.intuit.ipp.data; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * New CloudEvents-based webhook event item. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class WebhooksCloudEvents { + + @JsonProperty("specversion") + private String specVersion; + + @JsonProperty("id") + private String id; + + @JsonProperty("source") + private String source; + + @JsonProperty("type") + private String type; + + @JsonProperty("datacontenttype") + private String dataContentType; + + @JsonProperty("time") + private String time; + + @JsonProperty("intuitentityid") + private String intuitEntityId; + + @JsonProperty("intuitaccountid") + private String intuitAccountId; + + @JsonProperty("data") + private Map data; + + public String getSpecVersion() { + return specVersion; + } + + public void setSpecVersion(String specVersion) { + this.specVersion = specVersion; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDataContentType() { + return dataContentType; + } + + public void setDataContentType(String dataContentType) { + this.dataContentType = dataContentType; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getIntuitEntityId() { + return intuitEntityId; + } + + public void setIntuitEntityId(String intuitEntityId) { + this.intuitEntityId = intuitEntityId; + } + + public String getIntuitAccountId() { + return intuitAccountId; + } + + public void setIntuitAccountId(String intuitAccountId) { + this.intuitAccountId = intuitAccountId; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } +} diff --git a/ipp-v3-java-devkit/pom.xml b/ipp-v3-java-devkit/pom.xml index 7521d9a8..c3fa33da 100644 --- a/ipp-v3-java-devkit/pom.xml +++ b/ipp-v3-java-devkit/pom.xml @@ -5,7 +5,7 @@ ipp-v3-java-devkit-pom com.intuit.quickbooks-online - 6.6.1 + 6.6.2 ipp-v3-java-devkit jar @@ -20,8 +20,8 @@ com.intuit.quickbooks-online ipp-v3-java-data - 6.6.1 - + 6.6.2 + javax.xml.bind jaxb-api diff --git a/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/WebhooksService.java b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/WebhooksService.java index 9df51b3f..ce9583f9 100755 --- a/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/WebhooksService.java +++ b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/WebhooksService.java @@ -19,14 +19,18 @@ import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.List; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; + import jakarta.xml.bind.DatatypeConverter; import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.intuit.ipp.data.WebhooksCloudEvents; import com.intuit.ipp.util.StringUtils; import com.intuit.ipp.data.WebhooksEvent; @@ -88,6 +92,31 @@ public WebhooksEvent getWebhooksEvent(String payload) { } } + + /** + * Deserialize new CloudEvents-based webhook payloads which are arrays of events + * PR parity: method name uses getWebhooksCloudEvents (typo preserved) + * @param payload JSON array payload + * @return list of WebhooksCloudEvents or null if payload empty/invalid + */ + public List getWebhooksCloudEvents(String payload) { + if (!StringUtils.hasText(payload)) { + return null; + } + try { + ObjectMapper mapper = new ObjectMapper(); + return mapper.readValue(payload, new TypeReference>() {}); + } catch (JsonParseException e) { + LOG.error("Error while parsing new webhooks payload", e); + return null; + } catch (JsonMappingException e) { + LOG.error("Error while mapping new webhooks payload", e); + return null; + } catch (IOException e) { + LOG.error("IO exception while parsing new webhooks payload", e); + return null; + } + } /** * Verifier key to validate webhooks payload @@ -98,4 +127,4 @@ private String getVerifierKey() { } -} +} \ No newline at end of file diff --git a/ipp-v3-java-devkit/src/main/resources/ippdevkit.properties b/ipp-v3-java-devkit/src/main/resources/ippdevkit.properties index 77192ba1..f9c86727 100755 --- a/ipp-v3-java-devkit/src/main/resources/ippdevkit.properties +++ b/ipp-v3-java-devkit/src/main/resources/ippdevkit.properties @@ -2,7 +2,7 @@ ## Devkit Version # This version has to be updated according to the pom version -version = 6.6.1 +version = 6.6.2 # This is to have the request source to be sent to IDS request header request.source = V3JavaSDK diff --git a/ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/WebhooksServiceTest.java b/ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/WebhooksServiceTest.java index 301f0077..3b0ebca2 100755 --- a/ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/WebhooksServiceTest.java +++ b/ipp-v3-java-devkit/src/test/java/com/intuit/ipp/services/WebhooksServiceTest.java @@ -15,6 +15,7 @@ *******************************************************************************/ package com.intuit.ipp.services; +import com.intuit.ipp.data.WebhooksCloudEvents; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -56,6 +57,15 @@ public void testGetWebhooksEvent() throws FMSException { Assert.assertNotNull(webhooksEvent); Assert.assertEquals(webhooksEvent.getEventNotifications().size(), 1); } - -} + @Test + public void testGetWebhooksCloudEvents() throws FMSException { + String newPayload = "[{\"specversion\":\"1.0\",\"id\":\"d1a3aedd-9670-41bf-a4f9-c148a1cc4e03\",\"source\":\"intuit.dsnBgbseACLLRZNxo2dfc4evmEJdxde58xeeYcZliOU=\",\"type\":\"qbo.class.created.v1\",\"time\":\"2025-10-07T19:59:07.034359333Z\",\"intuitentityid\":\"1234\",\"intuitaccountid\":\"310687\"}]"; + java.util.List events = webhooksService.getWebhooksCloudEvents(newPayload); + Assert.assertNotNull(events); + Assert.assertEquals(events.size(), 1); + Assert.assertEquals(events.get(0).getSpecVersion(), "1.0"); + Assert.assertEquals(events.get(0).getId(), "d1a3aedd-9670-41bf-a4f9-c148a1cc4e03"); + } + +} \ No newline at end of file diff --git a/ipp-v3-java-devkit/src/test/resources/ippdevkit.properties b/ipp-v3-java-devkit/src/test/resources/ippdevkit.properties index 2dcd305c..b049f5ed 100755 --- a/ipp-v3-java-devkit/src/test/resources/ippdevkit.properties +++ b/ipp-v3-java-devkit/src/test/resources/ippdevkit.properties @@ -1,7 +1,7 @@ ### IPP Dev Kit helper properties ## Devkit version -version = 6.6.1 +version = 6.6.2 # This is to have the request source to be sent to IDS request header request.source = V3JavaSDK diff --git a/oauth2-platform-api/pom.xml b/oauth2-platform-api/pom.xml index d5e91257..9b40e4cd 100644 --- a/oauth2-platform-api/pom.xml +++ b/oauth2-platform-api/pom.xml @@ -20,7 +20,7 @@ ipp-v3-java-devkit-pom com.intuit.quickbooks-online - 6.6.1 + 6.6.2 oauth2-platform-api Quickbooks API Helper for OAuth2 diff --git a/oauth2-platform-api/src/main/resources/oauthclient.properties b/oauth2-platform-api/src/main/resources/oauthclient.properties index 263fa506..07842f50 100644 --- a/oauth2-platform-api/src/main/resources/oauthclient.properties +++ b/oauth2-platform-api/src/main/resources/oauthclient.properties @@ -34,7 +34,7 @@ EMAIL=email INTUIT_NAME=intuit_name #Version -version = 6.6.1 +version = 6.6.2 #MIGRATION SERVICE URL OAUTH_MIGRATION_URL_PRODUCTION=https://developer.api.intuit.com/v2/oauth2/tokens/migrate diff --git a/oauth2-platform-api/src/test/resources/oauthclient.properties b/oauth2-platform-api/src/test/resources/oauthclient.properties index 263fa506..07842f50 100644 --- a/oauth2-platform-api/src/test/resources/oauthclient.properties +++ b/oauth2-platform-api/src/test/resources/oauthclient.properties @@ -34,7 +34,7 @@ EMAIL=email INTUIT_NAME=intuit_name #Version -version = 6.6.1 +version = 6.6.2 #MIGRATION SERVICE URL OAUTH_MIGRATION_URL_PRODUCTION=https://developer.api.intuit.com/v2/oauth2/tokens/migrate diff --git a/payments-api/pom.xml b/payments-api/pom.xml index 9152726f..f938306b 100644 --- a/payments-api/pom.xml +++ b/payments-api/pom.xml @@ -19,7 +19,7 @@ ipp-v3-java-devkit-pom com.intuit.quickbooks-online - 6.6.1 + 6.6.2 payments-api Payments API SDK diff --git a/payments-api/src/main/resources/payment.properties b/payments-api/src/main/resources/payment.properties index 05f99949..54946f78 100644 --- a/payments-api/src/main/resources/payment.properties +++ b/payments-api/src/main/resources/payment.properties @@ -18,7 +18,7 @@ PAYMENTS_BASE_URL_PRODUCTION=https://api.intuit.com/quickbooks/v4/payments/ PAYMENTS_BASE_URL_SANDBOX=https://sandbox.api.intuit.com/quickbooks/v4/payments/ #Version -version = 6.6.1 +version = 6.6.2 #TLS Version TLS_VERSION=TLSv1.2 \ No newline at end of file diff --git a/payments-api/src/test/resources/payment.properties b/payments-api/src/test/resources/payment.properties index 05f99949..54946f78 100644 --- a/payments-api/src/test/resources/payment.properties +++ b/payments-api/src/test/resources/payment.properties @@ -18,7 +18,7 @@ PAYMENTS_BASE_URL_PRODUCTION=https://api.intuit.com/quickbooks/v4/payments/ PAYMENTS_BASE_URL_SANDBOX=https://sandbox.api.intuit.com/quickbooks/v4/payments/ #Version -version = 6.6.1 +version = 6.6.2 #TLS Version TLS_VERSION=TLSv1.2 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 441b59b7..9cee69de 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.intuit.quickbooks-online ipp-v3-java-devkit-pom - 6.6.1 + 6.6.2 pom IPP V3 Java DevKit https://github.com/intuit/QuickBooks-V3-Java-SDK