diff --git a/Intacct.SDK.Tests/Functions/AccountsReceivable/ArPaymentCreate2Test.cs b/Intacct.SDK.Tests/Functions/AccountsReceivable/ArPaymentCreate2Test.cs
new file mode 100644
index 00000000..cc49e693
--- /dev/null
+++ b/Intacct.SDK.Tests/Functions/AccountsReceivable/ArPaymentCreate2Test.cs
@@ -0,0 +1,65 @@
+/*
+ * 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.AccountsReceivable;
+using Intacct.SDK.Tests.Xml;
+using System;
+using Xunit;
+
+namespace Intacct.SDK.Tests.Functions.AccountsReceivable
+{
+ public class ArPaymentCreate2Test : XmlObjectTestHelper
+ {
+ [Fact]
+ public void GetXmlTest()
+ {
+ string expected = @"
+
+
+
+ Printed Check
+ C0020
+ 1000
+ Test Memo
+ 06/30/2021
+
+ 1922.12
+ 123
+ 07/01/2021
+
+ 1020
+ 900
+
+
+";
+
+ ArPaymentCreate2 record = new ArPaymentCreate2("unittest")
+ {
+ CustomerId = "C0020",
+ TransactionPaymentAmount = 1922.12M,
+ SummaryRecordNo = 123,
+ ReceivedDate = new DateTime(2021, 06, 30),
+ PaymentMethod = "Printed Check",
+ ReferenceNumber = "1000",
+ Description = "Test Memo",
+ OverpaymentDepartmentId = "900",
+ OverpaymentLocationId = "1020",
+ WhenPaidDate = new DateTime(2021, 07, 01)
+ };
+
+ this.CompareXml(expected, record);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj b/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj
index ba422f68..d0b0c116 100644
--- a/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj
+++ b/Intacct.SDK.Tests/Intacct.SDK.Tests.csproj
@@ -1,11 +1,11 @@
- net4.6.1;netcoreapp2.1;netcoreapp3.1
+ net5.0;net4.6.1;netcoreapp2.1;netcoreapp3.1
false
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/Intacct.SDK.Tests/Xml/XmlObjectTestHelper.cs b/Intacct.SDK.Tests/Xml/XmlObjectTestHelper.cs
index f4215e35..cda5f223 100644
--- a/Intacct.SDK.Tests/Xml/XmlObjectTestHelper.cs
+++ b/Intacct.SDK.Tests/Xml/XmlObjectTestHelper.cs
@@ -1,22 +1,22 @@
/*
* 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
+ * 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
+ *
+ * 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.Xml;
using System.IO;
using System.Text;
using System.Xml;
-using Intacct.SDK.Xml;
using Xunit;
namespace Intacct.SDK.Tests.Xml
@@ -34,14 +34,15 @@ public void CompareXml(string expected, IXmlObject apiFunction)
};
IaXmlWriter xml = new IaXmlWriter(stream, xmlSettings);
-
+
apiFunction.WriteXml(ref xml);
xml.Flush();
stream.Position = 0;
StreamReader reader = new StreamReader(stream);
-
- Assert.Equal(expected, reader.ReadToEnd());
+
+ var foo = reader.ReadToEnd();
+ Assert.Equal(expected, foo);
}
}
}
\ No newline at end of file
diff --git a/Intacct.SDK/Functions/AccountsReceivable/AbstractArPayment2.cs b/Intacct.SDK/Functions/AccountsReceivable/AbstractArPayment2.cs
new file mode 100644
index 00000000..bc23b84e
--- /dev/null
+++ b/Intacct.SDK/Functions/AccountsReceivable/AbstractArPayment2.cs
@@ -0,0 +1,123 @@
+/*
+ * 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 System;
+using System.Collections.Generic;
+
+namespace Intacct.SDK.Functions.AccountsReceivable
+{
+ public abstract class AbstractArPayment2 : AbstractFunction
+ {
+ ///
+ /// ARPYMTDETAILS
+ ///
+ public List ApplyToTransactions = new List();
+
+ ///
+ /// FINANCIALENTITY
+ ///
+ public string BankAccountId;
+
+ ///
+ /// BASECURR
+ ///
+ public string BaseCurrency;
+
+ ///
+ /// AMOUNTOPAY
+ ///
+ public decimal? BasePaymentAmount;
+
+ public string BillToPayName;
+ public string CustomerId;
+ public string Description;
+
+ ///
+ /// EXCH_RATE_TYPE_ID
+ ///
+ public string ExchangeRateType;
+
+ ///
+ /// EXCHANGE_RATE
+ ///
+ public decimal? ExchangeRateValue;
+
+ ///
+ /// OVERPAYMENTAMOUNT
+ ///
+ public decimal? OverpaymentAmount;
+
+ public string OverpaymentDepartmentId;
+ public string OverpaymentLocationId;
+
+ ///
+ /// PAYMENTDATE
+ ///
+ public DateTime? PaymentDate;
+
+ public string PaymentMethod;
+
+ ///
+ /// RECEIPTDATE
+ ///
+ public DateTime? ReceivedDate;
+
+ ///
+ /// DOCNUMBER
+ ///
+ public string ReferenceNumber;
+
+ ///
+ /// PRBATCH
+ ///
+ public int? SummaryRecordNo;
+
+ ///
+ /// CURRENCY
+ ///
+ public string TransactionCurrency;
+
+ ///
+ /// TRX_AMOUNTTOPAY
+ ///
+ public decimal? TransactionPaymentAmount;
+
+ ///
+ /// UNDEPOSITEDACCOUNTNO
+ ///
+ public string UndepositedFundsGlAccountNo;
+
+ ///
+ /// WHENPAID
+ ///
+ public DateTime? WhenPaidDate;
+
+ #region Unmappable AbstractArPayment Fields
+
+ /// public string CreditCardType;
+
+ // public DateTime? ExchangeRateDate;
+
+ // public string AuthorizationCode;
+
+ // public int? RecordNo;
+
+ #endregion Unmappable AbstractArPayment Fields
+
+ protected AbstractArPayment2(string controlId = null) : base(controlId)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Intacct.SDK/Functions/AccountsReceivable/ArPaymentCreate2.cs b/Intacct.SDK/Functions/AccountsReceivable/ArPaymentCreate2.cs
new file mode 100644
index 00000000..f4f0f9d9
--- /dev/null
+++ b/Intacct.SDK/Functions/AccountsReceivable/ArPaymentCreate2.cs
@@ -0,0 +1,130 @@
+/*
+ * 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.Xml;
+
+namespace Intacct.SDK.Functions.AccountsReceivable
+{
+ ///
+ /// This class creates a payment using the non-legacy version of the API.
+ ///
+ public class ArPaymentCreate2 : AbstractArPayment2
+ {
+ public ArPaymentCreate2(string controlId = null) : base(controlId)
+ {
+ }
+
+ public override void WriteXml(ref IaXmlWriter xml)
+ {
+ xml.WriteStartElement("function");
+ xml.WriteAttribute("controlid", ControlId, true);
+
+ xml.WriteStartElement("create");
+
+ xml.WriteStartElement("arpymt");
+
+ if (!string.IsNullOrWhiteSpace(UndepositedFundsGlAccountNo))
+ {
+ xml.WriteElement("undepositedaccountno", BankAccountId); // undepfundsacct
+ }
+ else
+ {
+ xml.WriteElement("financialentity", BankAccountId); // bankaccountid
+ }
+
+ xml.WriteElement("paymentmethod", PaymentMethod, true);
+ xml.WriteElement("customerid", CustomerId, true);
+ xml.WriteElement("docnumber", ReferenceNumber); // "refid"
+ xml.WriteElement("description", Description);
+
+ //if (ExchangeRateDate.HasValue)
+ //{
+ // xml.WriteStartElement("exchratedate");
+ // xml.WriteDateSplitElements2(ExchangeRateDate.Value);
+ // xml.WriteEndElement(); //exchratedate
+ //}
+
+ if (!string.IsNullOrWhiteSpace(ExchangeRateType))
+ {
+ xml.WriteElement("exch_rate_type_id", ExchangeRateType); // "exchratetype"
+ }
+ else if (ExchangeRateValue.HasValue)
+ {
+ xml.WriteElement("exchange_rate", ExchangeRateValue); // "exchrate"
+ }
+ else if (!string.IsNullOrWhiteSpace(BaseCurrency) || !string.IsNullOrWhiteSpace(TransactionCurrency))
+ {
+ xml.WriteElement("exchratetype", ExchangeRateType, true);
+ }
+
+ xml.WriteStartElement("receiptdate"); // "datereceived"
+ xml.WriteDateMMddyyyy(ReceivedDate.Value); // Required element
+ xml.WriteEndElement(); //receiptdate
+
+ if (PaymentDate.HasValue)
+ {
+ xml.WriteStartElement("paymentdate");
+ xml.WriteDateMMddyyyy(PaymentDate.Value);
+ xml.WriteEndElement(); //paymentdate
+ }
+
+ xml.WriteElement("amounttopay", BasePaymentAmount, true); // "translatedamount"
+ xml.WriteElement("trx_amounttopay", TransactionPaymentAmount, true); // paymentamount
+
+ xml.WriteElement("prbatch", SummaryRecordNo); // batchkey
+
+ if (WhenPaidDate.HasValue)
+ {
+ xml.WriteStartElement("whenpaid");
+ xml.WriteDateMMddyyyy(WhenPaidDate.Value);
+ xml.WriteEndElement(); //paymentdate
+ }
+
+ xml.WriteElement("currency", TransactionCurrency);
+ xml.WriteElement("basecurr", BaseCurrency);
+
+ xml.WriteElement("undepositedaccountno", UndepositedFundsGlAccountNo);
+
+ xml.WriteElement("overpaymentamount", OverpaymentAmount, true);
+ xml.WriteElement("overpaymentlocationid", OverpaymentLocationId); // "overpaylocid"
+ xml.WriteElement("overpaymentdepartmentid", OverpaymentDepartmentId); // "overpaydeptid"
+
+ xml.WriteElement("billtopayname", BillToPayName);
+
+ //xml.WriteElement("cctype", CreditCardType);
+ //xml.WriteElement("authcode", AuthorizationCode);
+
+ if (ApplyToTransactions.Count > 0)
+ {
+ xml.WriteStartElement("arpymtdetails"); // "arpaymentitem"
+
+ foreach (ArPaymentItem2 applyToTransaction in ApplyToTransactions)
+ {
+ applyToTransaction.WriteXml(ref xml);
+ }
+
+ xml.WriteEndElement(); // arpymtdetails
+ }
+
+ // TODO online payment methods
+
+ xml.WriteEndElement(); //create
+
+ xml.WriteEndElement(); //arpymt
+
+ xml.WriteEndElement(); //function
+ }
+ }
+}
\ No newline at end of file
diff --git a/Intacct.SDK/Functions/AccountsReceivable/ArPaymentItem2.cs b/Intacct.SDK/Functions/AccountsReceivable/ArPaymentItem2.cs
new file mode 100644
index 00000000..521fddd3
--- /dev/null
+++ b/Intacct.SDK/Functions/AccountsReceivable/ArPaymentItem2.cs
@@ -0,0 +1,39 @@
+/*
+ * 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.Xml;
+
+namespace Intacct.SDK.Functions.AccountsReceivable
+{
+ public class ArPaymentItem2 : IXmlObject
+ {
+ public decimal? AmountToApply;
+ public int? ApplyToRecordId;
+
+ public ArPaymentItem2()
+ {
+ }
+
+ public void WriteXml(ref IaXmlWriter xml)
+ {
+ xml.WriteStartElement("arpymtdetail"); // "arpaymentitem"
+
+ xml.WriteElement("recordkey", ApplyToRecordId, true); // "invoicekey"
+ xml.WriteElement("trx_paymentamount", AmountToApply, true); // "amount"
+
+ xml.WriteEndElement(); // arpymtdetail
+ }
+ }
+}
\ No newline at end of file
diff --git a/Intacct.SDK/Intacct.SDK.csproj b/Intacct.SDK/Intacct.SDK.csproj
index 1c9fa37d..2d3df3b6 100644
--- a/Intacct.SDK/Intacct.SDK.csproj
+++ b/Intacct.SDK/Intacct.SDK.csproj
@@ -1,8 +1,8 @@
- netstandard2.0
+ netstandard2.0;net5.0
Intacct.SDK
- 3.0.0
+ 3.1.0
intacct
Sage Intacct SDK
Sage Intacct SDK for .NET
@@ -15,11 +15,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Intacct.SDK/Xml/IaXmlWriter.cs b/Intacct.SDK/Xml/IaXmlWriter.cs
index 5778e6bb..65b59c39 100644
--- a/Intacct.SDK/Xml/IaXmlWriter.cs
+++ b/Intacct.SDK/Xml/IaXmlWriter.cs
@@ -1,29 +1,27 @@
/*
* 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
+ * 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
+ *
+ * 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 System;
using System.Collections.Generic;
using System.IO;
-using System.Text;
using System.Xml;
namespace Intacct.SDK.Xml
{
public class IaXmlWriter : XmlWriter
{
-
public const string IntacctDateFormat = "MM/dd/yyyy";
public const string IntacctDateTimeFormat = "MM/dd/yyyy HH:mm:ss";
@@ -31,78 +29,56 @@ public class IaXmlWriter : XmlWriter
public const string IntacctMultiSelectGlue = "#~#";
private readonly XmlWriter _writer;
-
- public override WriteState WriteState => _writer.WriteState;
public IaXmlWriter(Stream output, XmlWriterSettings settings)
{
_writer = Create(output, settings);
}
+ public override WriteState WriteState => _writer.WriteState;
- public override void WriteStartDocument()
- {
- _writer.WriteStartDocument();
- }
-
- public override void WriteStartDocument(bool standalone)
- {
- _writer.WriteStartDocument(standalone);
- }
-
- public override void WriteEndDocument()
- {
- _writer.WriteEndDocument();
- }
-
- public override void WriteDocType(string name, string pubid, string sysid, string subset)
- {
- _writer.WriteDocType(name, pubid, sysid, subset);
- }
-
- public new void WriteStartElement(string localName)
- {
- _writer.WriteStartElement(localName);
- }
-
- public new void WriteStartElement(string localName, string ns)
- {
- _writer.WriteStartElement(localName, ns);
- }
-
- public override void WriteStartElement(string prefix, string localName, string ns)
- {
- _writer.WriteStartElement(prefix, localName, ns);
- }
-
- public override void WriteEndElement()
+ public override void Flush()
{
- _writer.WriteEndElement();
+ _writer.Flush();
}
- public override void WriteFullEndElement()
+ public override string LookupPrefix(string ns)
{
- _writer.WriteFullEndElement();
+ return _writer.LookupPrefix(ns);
}
- public new void WriteStartAttribute(string localName)
+ public void WriteAttribute(string localName, string value, bool writeNull = false)
{
- _writer.WriteStartAttribute(localName);
+ if (!string.IsNullOrEmpty(value) || writeNull == true)
+ {
+ _writer.WriteAttributeString(localName, value);
+ }
}
- public new void WriteStartAttribute(string localName, string ns)
+ public void WriteAttribute(string localName, int? value, bool writeNull = false)
{
- _writer.WriteStartAttribute(localName, ns);
+ if (value == null)
+ {
+ if (writeNull == true)
+ {
+ _writer.WriteAttributeString(localName, "");
+ }
+ }
+ else
+ {
+ _writer.WriteAttributeString(localName, value.ToString());
+ }
}
- public override void WriteStartAttribute(string prefix, string localName, string ns)
+ public void WriteAttribute(string localName, bool value)
{
- _writer.WriteStartAttribute(prefix, localName, ns);
+ string val = (value == true) ? "true" : "false";
+ _writer.WriteAttributeString(localName, val);
}
- public override void WriteEndAttribute()
+ public override void WriteBase64(byte[] buffer, int index, int count)
{
- _writer.WriteEndAttribute();
+ _writer.WriteBase64(buffer, index, count);
}
public override void WriteCData(string text)
@@ -110,73 +86,80 @@ public override void WriteCData(string text)
_writer.WriteCData(text);
}
- public override void WriteComment(string text)
- {
- _writer.WriteComment(text);
- }
-
- public override void WriteProcessingInstruction(string name, string text)
- {
- _writer.WriteProcessingInstruction(name, text);
- }
-
- public override void WriteEntityRef(string name)
- {
- _writer.WriteEntityRef(name);
- }
-
public override void WriteCharEntity(char ch)
{
_writer.WriteCharEntity(ch);
}
- public override void WriteWhitespace(string ws)
+ public override void WriteChars(char[] buffer, int index, int count)
{
- _writer.WriteWhitespace(ws);
+ _writer.WriteChars(buffer, index, count);
}
- public override void WriteString(string text)
+ public override void WriteComment(string text)
{
- _writer.WriteString(text);
+ _writer.WriteComment(text);
}
- public override void WriteSurrogateCharEntity(char lowChar, char highChar)
+ public void WriteCustomFieldsExplicit(Dictionary customFields)
{
- _writer.WriteSurrogateCharEntity(lowChar, highChar);
- }
+ if (customFields.Count > 0)
+ {
+ WriteStartElement("customfields");
+ foreach (KeyValuePair customField in customFields)
+ {
+ WriteStartElement("customfield");
+ WriteElement("customfieldname", customField.Key, true);
- public override void WriteChars(char[] buffer, int index, int count)
- {
- _writer.WriteChars(buffer, index, count);
- }
-
- public override void WriteRaw(char[] buffer, int index, int count)
- {
- _writer.WriteRaw(buffer, index, count);
+ if (customField.Value == null)
+ {
+ WriteEmptyElement("customfieldvalue");
+ }
+ else
+ {
+ WriteElement("customfieldvalue", customField.Value, true);
+ }
+ WriteEndElement(); //customfield
+ }
+ WriteEndElement(); //customfields
+ }
}
- public override void WriteRaw(string data)
+ public void WriteCustomFieldsImplicit(Dictionary customFields)
{
- _writer.WriteRaw(data);
+ if (customFields.Count > 0)
+ {
+ foreach (KeyValuePair customField in customFields)
+ {
+ if (customField.Value == null)
+ {
+ WriteEmptyElement(customField.Key);
+ }
+ else
+ {
+ WriteElement(customField.Key, customField.Value, true);
+ }
+ }
+ }
}
- public override void WriteBase64(byte[] buffer, int index, int count)
+ public void WriteDateMMddyyyy(DateTime date)
{
- _writer.WriteBase64(buffer, index, count);
+ _writer.WriteRaw(date.ToString("MM/dd/yyyy"));
}
-
- public override void Flush()
+
+ public void WriteDateSplitElements(DateTime date, bool writeNull = true)
{
- _writer.Flush();
+ WriteElement("year", date.ToString("yyyy"), writeNull);
+ WriteElement("month", date.ToString("MM"), writeNull);
+ WriteElement("day", date.ToString("dd"), writeNull);
}
- public override string LookupPrefix(string ns)
+ public override void WriteDocType(string name, string pubid, string sysid, string subset)
{
- return _writer.LookupPrefix(ns);
+ _writer.WriteDocType(name, pubid, sysid, subset);
}
- // XML Helper Functions
-
public void WriteElement(string localName, string value, bool writeNull = false)
{
if (value == null)
@@ -193,6 +176,7 @@ public void WriteElement(string localName, string value, bool writeNull = false)
}
}
+ // XML Helper Functions
public void WriteElement(string localName, int value)
{
_writer.WriteElementString(localName, value.ToString());
@@ -257,7 +241,7 @@ public void WriteElement(string localName, bool? value, bool writeNull = false)
}
}
}
-
+
public void WriteElement(string localName, DateTime value, string format = IntacctDateTimeFormat)
{
_writer.WriteElementString(localName, value == default(DateTime) ? "" : value.ToString(format));
@@ -283,85 +267,100 @@ public void WriteEmptyElement(string localName)
_writer.WriteStartElement(localName);
_writer.WriteEndElement();
}
-
- public void WriteAttribute(string localName, string value, bool writeNull = false)
+
+ public override void WriteEndAttribute()
{
- if (!string.IsNullOrEmpty(value) || writeNull == true)
- {
+ _writer.WriteEndAttribute();
+ }
- _writer.WriteAttributeString(localName, value);
- }
+ public override void WriteEndDocument()
+ {
+ _writer.WriteEndDocument();
}
- public void WriteAttribute(string localName, int? value, bool writeNull = false)
+ public override void WriteEndElement()
{
- if (value == null)
- {
- if (writeNull == true)
- {
- _writer.WriteAttributeString(localName, "");
- }
- }
- else
- {
- _writer.WriteAttributeString(localName, value.ToString());
- }
+ _writer.WriteEndElement();
}
- public void WriteAttribute(string localName, bool value)
+ public override void WriteEntityRef(string name)
{
- string val = (value == true) ? "true" : "false";
- _writer.WriteAttributeString(localName, val);
+ _writer.WriteEntityRef(name);
}
- public void WriteDateSplitElements(DateTime date, bool writeNull = true)
+ public override void WriteFullEndElement()
{
- WriteElement("year", date.ToString("yyyy"), writeNull);
- WriteElement("month", date.ToString("MM"), writeNull);
- WriteElement("day", date.ToString("dd"), writeNull);
+ _writer.WriteFullEndElement();
}
- public void WriteCustomFieldsExplicit(Dictionary customFields)
+ public override void WriteProcessingInstruction(string name, string text)
{
- if (customFields.Count > 0)
- {
- WriteStartElement("customfields");
- foreach (KeyValuePair customField in customFields)
- {
- WriteStartElement("customfield");
- WriteElement("customfieldname", customField.Key, true);
-
- if (customField.Value == null)
- {
- WriteEmptyElement("customfieldvalue");
- }
- else
- {
- WriteElement("customfieldvalue", customField.Value, true);
- }
- WriteEndElement(); //customfield
- }
- WriteEndElement(); //customfields
- }
+ _writer.WriteProcessingInstruction(name, text);
}
- public void WriteCustomFieldsImplicit(Dictionary customFields)
+ public override void WriteRaw(char[] buffer, int index, int count)
{
- if (customFields.Count > 0)
- {
- foreach (KeyValuePair customField in customFields)
- {
- if (customField.Value == null)
- {
- WriteEmptyElement(customField.Key);
- }
- else
- {
- WriteElement(customField.Key, customField.Value, true);
- }
- }
- }
+ _writer.WriteRaw(buffer, index, count);
+ }
+
+ public override void WriteRaw(string data)
+ {
+ _writer.WriteRaw(data);
+ }
+
+ public new void WriteStartAttribute(string localName)
+ {
+ _writer.WriteStartAttribute(localName);
+ }
+
+ public new void WriteStartAttribute(string localName, string ns)
+ {
+ _writer.WriteStartAttribute(localName, ns);
+ }
+
+ public override void WriteStartAttribute(string prefix, string localName, string ns)
+ {
+ _writer.WriteStartAttribute(prefix, localName, ns);
+ }
+
+ public override void WriteStartDocument()
+ {
+ _writer.WriteStartDocument();
+ }
+
+ public override void WriteStartDocument(bool standalone)
+ {
+ _writer.WriteStartDocument(standalone);
}
+ public new void WriteStartElement(string localName)
+ {
+ _writer.WriteStartElement(localName);
+ }
+
+ public new void WriteStartElement(string localName, string ns)
+ {
+ _writer.WriteStartElement(localName, ns);
+ }
+
+ public override void WriteStartElement(string prefix, string localName, string ns)
+ {
+ _writer.WriteStartElement(prefix, localName, ns);
+ }
+
+ public override void WriteString(string text)
+ {
+ _writer.WriteString(text);
+ }
+
+ public override void WriteSurrogateCharEntity(char lowChar, char highChar)
+ {
+ _writer.WriteSurrogateCharEntity(lowChar, highChar);
+ }
+
+ public override void WriteWhitespace(string ws)
+ {
+ _writer.WriteWhitespace(ws);
+ }
}
}
\ No newline at end of file
diff --git a/Intacct.SDK/Xml/LoggingHandler.cs b/Intacct.SDK/Xml/LoggingHandler.cs
index 0fc85900..8f5e9762 100644
--- a/Intacct.SDK/Xml/LoggingHandler.cs
+++ b/Intacct.SDK/Xml/LoggingHandler.cs
@@ -1,34 +1,33 @@
/*
* 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
+ * 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
+ *
+ * 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.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
-using Intacct.SDK.Logging;
-using Microsoft.Extensions.Logging;
namespace Intacct.SDK.Xml
{
public class LoggingHandler : DelegatingHandler
{
private ILogger _logger;
-
- private MessageFormatter _logMessageFormatter;
-
+
private LogLevel _logLevel;
+ private MessageFormatter _logMessageFormatter;
public LoggingHandler(HttpMessageHandler innerHandler, ILogger logger, MessageFormatter logMessageFormat, LogLevel logLevel) : base(innerHandler)
{
@@ -49,11 +48,10 @@ protected override async Task SendAsync(HttpRequestMessage
catch (Exception ex)
{
_logger.Log(_logLevel, ex, _logMessageFormatter.Format(request, response));
- throw ex;
+ throw;
}
return response;
}
-
}
}
\ No newline at end of file