Skip to content

Commit

Permalink
Merge pull request #120 from Intacct/v2.3.0
Browse files Browse the repository at this point in the history
Fix issues, Add missing fields and new function
  • Loading branch information
NagBoranna authored Sep 4, 2020
2 parents 06df4d2 + 328fa3f commit 00b18cf
Show file tree
Hide file tree
Showing 23 changed files with 400 additions and 216 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2020 Sage Intacct, Inc.
*
* 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
*
* or in the "LICENSE" file accompanying this file. This file 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.
*/

using Intacct.SDK.Functions.AccountsPayable;
using Intacct.SDK.Tests.Xml;
using Xunit;

namespace Intacct.SDK.Tests.Functions.AccountsPayable
{
public class ApPaymentRequestDeclineTest : XmlObjectTestHelper
{
[Fact]
public void GetXmlTest()
{
string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
<decline_appaymentrequest>
<appaymentkeys>
<appaymentkey>1234</appaymentkey>
</appaymentkeys>
</decline_appaymentrequest>
</function>";

ApPaymentRequestDecline record = new ApPaymentRequestDecline("unittest")
{
RecordNo = 1234
};

this.CompareXml(expected, record);
}
}

}
12 changes: 6 additions & 6 deletions Intacct.SDK.Tests/Functions/AccountsPayable/BillCreateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Intacct.SDK.Functions.AccountsPayable;
using Intacct.SDK.Functions;
using Intacct.SDK.Tests.Xml;
using Intacct.SDK.Xml;
using Xunit;

namespace Intacct.SDK.Tests.Functions.AccountsPayable
Expand Down Expand Up @@ -118,6 +113,10 @@ public void GetAllXmlTest()
<customfieldname>customfield1</customfieldname>
<customfieldvalue>customvalue1</customfieldvalue>
</customfield>
<customfield>
<customfieldname>customfield2</customfieldname>
<customfieldvalue />
</customfield>
</customfields>
<billitems>
<lineitem>
Expand Down Expand Up @@ -152,7 +151,8 @@ public void GetAllXmlTest()
AttachmentsId = "6942",
CustomFields = new Dictionary<string, dynamic>
{
{ "customfield1", "customvalue1" }
{ "customfield1", "customvalue1" },
{ "customfield2", null }
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
*/

using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Intacct.SDK.Functions.AccountsPayable;
using Intacct.SDK.Functions;
using Intacct.SDK.Tests.Xml;
using Intacct.SDK.Xml;
using Xunit;

namespace Intacct.SDK.Tests.Functions.AccountsPayable
Expand Down Expand Up @@ -81,6 +76,7 @@ public void GetAllXmlTest()
<STATE>CA</STATE>
<ZIP>95110</ZIP>
<COUNTRY>United States</COUNTRY>
<ISOCOUNTRYCODE>USA</ISOCOUNTRYCODE>
</MAILADDRESS>
</DISPLAYCONTACT>
<ONETIME>false</ONETIME>
Expand Down Expand Up @@ -158,6 +154,7 @@ public void GetAllXmlTest()
StateProvince = "CA",
ZipPostalCode = "95110",
Country = "United States",
IsoCountryCode = "USA",
OneTime = false,
Active = true,
ExcludedFromContactList = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
*/

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Intacct.SDK.Functions.AccountsReceivable;
using Intacct.SDK.Functions;
using Intacct.SDK.Tests.Xml;
using Intacct.SDK.Xml;
using Xunit;

namespace Intacct.SDK.Tests.Functions.AccountsReceivable
Expand All @@ -36,6 +30,7 @@ public void GetXmlTest()
<create_arpayment>
<customerid>C0020</customerid>
<paymentamount>1922.12</paymentamount>
<batchkey>123</batchkey>
<refid>1000</refid>
<overpaylocid>1020</overpaylocid>
<overpaydeptid>900</overpaydeptid>
Expand All @@ -52,6 +47,7 @@ public void GetXmlTest()
{
CustomerId = "C0020",
TransactionPaymentAmount = 1922.12M,
SummaryRecordNo = 123,
ReceivedDate = new DateTime(2016, 06, 30),
PaymentMethod = "Printed Check",
ReferenceNumber = "1000",
Expand Down
12 changes: 12 additions & 0 deletions Intacct.SDK.Tests/Functions/Common/NewQuery/QueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void DefaultParamsTest()
<field>CUSTOMERID</field>
</select>
<object>CUSTOMER</object>
<options />
</query>
</function>";

Expand Down Expand Up @@ -71,6 +72,7 @@ public void AllParamsTest()
<docparid>REPORT</docparid>
<options>
<caseinsensitive>true</caseinsensitive>
<showprivate>true</showprivate>
</options>
<pagesize>10</pagesize>
<offset>5</offset>
Expand All @@ -86,6 +88,7 @@ public void AllParamsTest()
DocParId = "REPORT",
SelectFields = fields,
CaseInsensitive = true,
ShowPrivate = true,
PageSize = 10,
Offset = 5
};
Expand Down Expand Up @@ -249,6 +252,7 @@ public void FieldsTest()
<field>RECORDNO</field>
</select>
<object>ARINVOICE</object>
<options />
</query>
</function>";

Expand Down Expand Up @@ -285,6 +289,7 @@ public void AggregateFunctionsTest()
<count>RECORDNO</count>
</select>
<object>ARINVOICE</object>
<options />
</query>
</function>";

Expand Down Expand Up @@ -326,6 +331,7 @@ public void OrderByTest()
<descending />
</order>
</orderby>
<options />
</query>
</function>";

Expand Down Expand Up @@ -354,6 +360,7 @@ public void EmptyOrderByTest()
<field>CUSTOMERID</field>
</select>
<object>CLASS</object>
<options />
</query>
</function>";

Expand Down Expand Up @@ -387,6 +394,7 @@ public void FilterTest()
<value>10</value>
</lessthanorequalto>
</filter>
<options />
</query>
</function>";

Expand Down Expand Up @@ -428,6 +436,7 @@ public void FilterAndConditionTest()
</lessthanorequalto>
</and>
</filter>
<options />
</query>
</function>";

Expand Down Expand Up @@ -479,6 +488,7 @@ public void FilterOrConditionTest()
</equalto>
</or>
</filter>
<options />
</query>
</function>";

Expand Down Expand Up @@ -531,6 +541,7 @@ public void FilterOrWithAndConditionTest()
</and>
</or>
</filter>
<options />
</query>
</function>";

Expand Down Expand Up @@ -601,6 +612,7 @@ public void ThreeLevelFilterTest()
</and>
</or>
</filter>
<options />
</query>
</function>";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Intacct.SDK.Functions.Company;
using Intacct.SDK.Functions.GeneralLedger;
using Intacct.SDK.Functions;
using Intacct.SDK.Tests.Xml;
using Intacct.SDK.Xml;
using Xunit;

namespace Intacct.SDK.Tests.Functions.GeneralLedger
Expand Down Expand Up @@ -77,6 +72,7 @@ public void GetAllXmlTest()
<LOCATION>100</LOCATION>
<DEPARTMENT>ADM</DEPARTMENT>
<PROJECTID>P100</PROJECTID>
<TASKID>T123</TASKID>
<CUSTOMERID>C100</CUSTOMERID>
<VENDORID>V100</VENDORID>
<EMPLOYEEID>E100</EMPLOYEEID>
Expand All @@ -99,6 +95,7 @@ public void GetAllXmlTest()
LocationId = "100",
DepartmentId = "ADM",
ProjectId = "P100",
TaskId = "T123",
CustomerId = "C100",
VendorId = "V100",
EmployeeId = "E100",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void GetAllXmlTest()
<consolidate>
<bookid>USD Books</bookid>
<reportingperiodname>Month Ended June 2016</reportingperiodname>
<offline>true</offline>
<offline>T</offline>
<updatesucceedingperiods>false</updatesucceedingperiods>
<changesonly>true</changesonly>
<email>noreply@intacct.com</email>
Expand Down
26 changes: 26 additions & 0 deletions Intacct.SDK.Tests/Functions/Projects/ProjectCreateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,31 @@ public void GetXmlTest()
};
this.CompareXml(expected, record);
}

[Fact]
public void GetXmlWithNullValueCustomFieldTest()
{
string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
<create>
<PROJECT>
<NAME>hello world</NAME>
<PROJECTCATEGORY>Contract</PROJECTCATEGORY>
<customfield1 />
</PROJECT>
</create>
</function>";

ProjectCreate record = new ProjectCreate("unittest")
{
ProjectName = "hello world",
ProjectCategory = "Contract",
CustomFields = new Dictionary<string, dynamic>
{
{ "customfield1", null }
},
};
this.CompareXml(expected, record);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,53 @@ public void GetAllXmlTest()

this.CompareXml(expected, record);
}

[Fact]
public void GetXmlDateDueNullTest()
{
string expected = @"<?xml version=""1.0"" encoding=""utf-8""?>
<function controlid=""unittest"">
<create_potransaction>
<transactiontype>Purchase Order</transactiontype>
<datecreated>
<year>2015</year>
<month>06</month>
<day>30</day>
</datecreated>
<vendorid>2530</vendorid>
<termname>N30</termname>
<returnto>
<contactname />
</returnto>
<payto>
<contactname />
</payto>
<potransitems>
<potransitem>
<itemid>02354032</itemid>
<quantity>1200</quantity>
</potransitem>
</potransitems>
</create_potransaction>
</function>";

PurchasingTransactionCreate record = new PurchasingTransactionCreate("unittest")
{
TransactionDefinition = "Purchase Order",
TransactionDate = new DateTime(2015, 06, 30),
VendorId = "2530",
PaymentTerm = "N30",
};

PurchasingTransactionLineCreate line1 = new PurchasingTransactionLineCreate()
{
ItemId = "02354032",
Quantity = 1200,
};

record.Lines.Add(line1);

this.CompareXml(expected, record);
}
}
}
4 changes: 4 additions & 0 deletions Intacct.SDK/Functions/AccountsPayable/AbstractVendor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public abstract class AbstractVendor : AbstractFunction
public string ZipPostalCode;

public string Country;

public string IsoCountryCode;

public bool? ExcludedFromContactList;

Expand Down Expand Up @@ -164,6 +166,7 @@ protected void WriteXmlMailAddress(ref IaXmlWriter xml)
|| !string.IsNullOrWhiteSpace(StateProvince)
|| !string.IsNullOrWhiteSpace(ZipPostalCode)
|| !string.IsNullOrWhiteSpace(Country)
|| !string.IsNullOrWhiteSpace(IsoCountryCode)
)
{
xml.WriteStartElement("MAILADDRESS");
Expand All @@ -174,6 +177,7 @@ protected void WriteXmlMailAddress(ref IaXmlWriter xml)
xml.WriteElementString("STATE", StateProvince);
xml.WriteElementString("ZIP", ZipPostalCode);
xml.WriteElementString("COUNTRY", Country);
xml.WriteElementString("ISOCOUNTRYCODE", IsoCountryCode);

xml.WriteEndElement(); //MAILADDRESS
}
Expand Down
Loading

0 comments on commit 00b18cf

Please sign in to comment.