Skip to content

Commit 3406e4b

Browse files
WebhooksCloudEvent payload processing changes and Batch request count update
1 parent f375bc2 commit 3406e4b

File tree

11 files changed

+198
-12
lines changed

11 files changed

+198
-12
lines changed

IPPDotNetDevKitCSV3/Code/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<PackageIcon>$(MSBuildThisFileDirectory)logo.png</PackageIcon>
1515
<OutputPath>$(SolutionDir)artifacts\bin</OutputPath>
1616
<Copyright>Copyright © 2020 Intuit, Inc.</Copyright>
17-
<AssemblyVersion>14.7.0.1</AssemblyVersion>
18-
<FileVersion>14.7.0.1</FileVersion>
17+
<AssemblyVersion>14.7.0.2</AssemblyVersion>
18+
<FileVersion>14.7.0.2</FileVersion>
1919
<Company>Intuit</Company>
2020
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
2121
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.DataService.Test/BatchTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public void AddMoreThanTwentyFiveItemsInBatch()
229229
ServiceContext context = Initializer.InitializeServiceContextQbo();
230230
DataService service = new DataService(context);
231231
Batch batch = service.CreateNewBatch();
232-
for (int i = 0; i <= 26; i++)
232+
for (int i = 0; i <= 31; i++)
233233
{
234234
Customer customer = new Customer();
235235
string guid = Guid.NewGuid().ToString("N");
@@ -270,7 +270,7 @@ public void AddTwentyFivePlusToBatch()
270270
{
271271
Batch batch = GetBatch();
272272
string queryId = string.Empty;
273-
for (int i = 0; i <= 26; i++)
273+
for (int i = 0; i <= 31; i++)
274274
{
275275
batch.Add("query * from Customer", "customerQuery");
276276
}
@@ -327,7 +327,7 @@ public void AddTwentyFivePlusToBatchEntity()
327327
Batch batch = GetBatch();
328328
string queryId = string.Empty;
329329

330-
for (int i = 0; i <= 26; i++)
330+
for (int i = 0; i <= 31; i++)
331331
{
332332
Customer customer = GetCustomer();
333333
batch.Add(customer, "Customer", OperationEnum.create);

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.DataService/Batch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void Add(string query, string id, List<String> optionsData)
211211
IdsExceptionManager.HandleException(exception);
212212
}
213213

214-
if (this.batchRequests.Count > 25)
214+
if (this.batchRequests.Count > 30)
215215
{
216216
IdsException exception = new IdsException(Resources.batchItemsExceededMessage, new BatchItemsExceededException(Resources.batchItemsExceededMessage));
217217
this.serviceContext.IppConfiguration.Logger.CustomLogger.Log(Diagnostics.TraceLevel.Error, string.Format(CultureInfo.InvariantCulture, Resources.ExceptionGeneratedMessage, exception.ToString()));
@@ -287,7 +287,7 @@ public void Add(CDCQuery query, string id, List<string> optionsData)
287287
IdsExceptionManager.HandleException(exception);
288288
}
289289

290-
if (this.batchRequests.Count > 25)
290+
if (this.batchRequests.Count > 30)
291291
{
292292
IdsException exception = new IdsException(Resources.batchItemsExceededMessage, new BatchItemsExceededException(Resources.batchItemsExceededMessage));
293293
this.serviceContext.IppConfiguration.Logger.CustomLogger.Log(Diagnostics.TraceLevel.Error, string.Format(CultureInfo.InvariantCulture, Resources.ExceptionGeneratedMessage, exception.ToString()));
@@ -344,7 +344,7 @@ public void Add(IEntity entity, string id, OperationEnum operation, List<String>
344344
IdsExceptionManager.HandleException(exception);
345345
}
346346

347-
if (this.batchRequests.Count > 25)
347+
if (this.batchRequests.Count > 30)
348348
{
349349
IdsException exception = new IdsException(Resources.batchItemsExceededMessage, new BatchItemsExceededException(Resources.batchItemsExceededMessage));
350350
this.serviceContext.IppConfiguration.Logger.CustomLogger.Log(Diagnostics.TraceLevel.Error, string.Format(CultureInfo.InvariantCulture, Resources.ExceptionGeneratedMessage, exception.ToString()));

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Nupkg/Intuit.Ipp.Nupkg.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageId>IppDotNetSdkForQuickBooksApiV3</PackageId>
1010
<AssemblyName>IppDotNetSdkForQuickBooksApiV3</AssemblyName>
1111
<DocumentationFile>$(BaseOutputPath)$(AssemblyName).xml</DocumentationFile>
12-
<MainVersion>14.7.0.1</MainVersion>
12+
<MainVersion>14.7.0.2</MainVersion>
1313
<PackageVersionSuffix>pre</PackageVersionSuffix>
1414
<Version>$(MainVersion)-$(PackageVersionSuffix)</Version>
1515
<Version>$(MainVersion)</Version>

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Common/CoreConstants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static class CoreConstants
250250
/// <summary>
251251
/// The Request source header value.
252252
/// </summary>
253-
public const string REQUESTSOURCEHEADER = "V3DotNetSDK14.7.0.1";
253+
public const string REQUESTSOURCEHEADER = "V3DotNetSDK14.7.0.2";
254254

255255
/// <summary>
256256
/// multipart/form-data format

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.WebHooksService/Interface/IWebhooksService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,10 @@ public interface IWebhooksService
4242
/// </summary>
4343
WebhooksEvent GetWebooksEvents(string payload);
4444

45+
/// <summary>
46+
/// GetWebhooksEvents fucn to deserialize new json response from Webhooks.
47+
/// </summary>
48+
List<WebhooksCloudEvent> GetWebhooksCloudEvents(string payload);
49+
4550
}
4651
}

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.WebHooksService/Intuit.Ipp.WebHooksService.XML

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
////*********************************************************
2+
// <copyright file="ReportService.cs" company="Intuit">
3+
/*******************************************************************************
4+
* Copyright 2016 Intuit
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*******************************************************************************/
18+
// <summary>This file contains WebhooksCloudEvent Class which deserliaizes Webhooks Events</summary>
19+
////*********************************************************
20+
namespace Intuit.Ipp.WebhooksService
21+
{
22+
using System;
23+
using System.Collections.Generic;
24+
using Newtonsoft.Json;
25+
26+
/// <summary>
27+
/// WebhooksEvent class for WebhooksService
28+
/// </summary>
29+
public class WebhooksCloudEvent
30+
{
31+
/// <summary>
32+
/// Gets list of EventNotifications
33+
/// </summary>
34+
[JsonProperty("specversion")]
35+
public string SpecVersion { get; set; }
36+
37+
/// <summary>
38+
/// Event Id
39+
/// </summary>
40+
[JsonProperty("id")]
41+
public string Id { get; set; }
42+
43+
/// <summary>
44+
/// Event source
45+
/// </summary>
46+
[JsonProperty("source")]
47+
public string Source { get; set; }
48+
49+
/// <summary>
50+
/// Event type
51+
/// </summary>
52+
[JsonProperty("type")]
53+
public string Type { get; set; }
54+
55+
/// <summary>
56+
/// Data content type
57+
/// </summary>
58+
[JsonProperty("datacontenttype")]
59+
public string DataContentType { get; set; }
60+
61+
/// <summary>
62+
/// Time
63+
/// </summary>
64+
[JsonProperty("time")]
65+
public string Time { get; set; }
66+
67+
/// <summary>
68+
/// Intuit Entity Id
69+
/// </summary>
70+
[JsonProperty("intuitentityid")]
71+
public string IntuitEntityId { get; set; }
72+
73+
/// <summary>
74+
/// Intuit Account id
75+
/// </summary>
76+
[JsonProperty("intuitaccountid")]
77+
public string IntuitAccountId { get; set; }
78+
79+
/// <summary>
80+
/// Event data
81+
/// </summary>
82+
[JsonProperty("data")]
83+
public Dictionary<string, string> Data { get; set; }
84+
}
85+
}

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.WebHooksService/WebhooksService.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace Intuit.Ipp.WebhooksService
3838
using System.Collections.Specialized;
3939
using System.Runtime.Serialization;
4040
using System.IO;
41+
using System.Collections.Generic;
4142

4243

4344
/// <summary>
@@ -164,6 +165,16 @@ public WebhooksEvent GetWebooksEvents(string payload)
164165
return webhooksEvent;
165166
}
166167

168+
/// <summary>
169+
/// Executes a Deserialization operation for Webhooks Cloud Events payload
170+
/// </summary>
171+
/// <returns>Returns a WebhooksCloudEvent object.</returns>
172+
public List<WebhooksCloudEvent> GetWebhooksCloudEvents(string payload)
173+
{
174+
List<WebhooksCloudEvent> webhooksEvent = JsonConvert.DeserializeObject<List<WebhooksCloudEvent>>(payload);
175+
return webhooksEvent;
176+
}
177+
167178

168179

169180
/// <summary>

IPPDotNetDevKitCSV3/Code/Intuit.Ipp.WebhooksService.Test/WebhooksServiceTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Intuit.Ipp.WebhooksService.Test
88

99
using Intuit.Ipp.Core;
1010
using Intuit.Ipp.Utility;
11+
using System.Collections.Generic;
1112

1213
[TestClass]
1314
public class WebhooksServiceTest
@@ -79,6 +80,29 @@ public void GetWebooksEvents()
7980

8081

8182

83+
84+
}
85+
catch (System.Exception ex)
86+
{
87+
Assert.Fail(ex.ToString());
88+
}
89+
90+
91+
}
92+
93+
[TestMethod]
94+
public void GetWebhooksCloudEvents()
95+
{
96+
try
97+
{
98+
99+
string wehooksResponsePayloadNew = "[{\"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\"}]";
100+
101+
List<WebhooksCloudEvent> webhooksEvent = webhooksServiceTestCases.GetWebhooksCloudEvents(wehooksResponsePayloadNew);
102+
103+
Assert.AreEqual(webhooksEvent[0].SpecVersion, "1.0");
104+
Assert.AreEqual(webhooksEvent[0].Id, "d1a3aedd-9670-41bf-a4f9-c148a1cc4e03");
105+
82106
}
83107
catch (System.Exception ex)
84108
{

0 commit comments

Comments
 (0)