diff --git a/Library/GiftCard.cs b/Library/GiftCard.cs
index fffbcc0c..452624bb 100644
--- a/Library/GiftCard.cs
+++ b/Library/GiftCard.cs
@@ -9,7 +9,7 @@ namespace Recurly
///
/// https://dev.recurly.com/docs/gift-card-object
///
- public class GiftCard : RecurlyEntity
+ public class GiftCard : RevRecEntity
{
///
/// Unique ID assigned to this gift card.
@@ -99,7 +99,7 @@ public Account GifterAccount
///
/// When the gift card was sent to the recipient by Recurly via email,
/// if method was email and the "Gift Card Delivery" email template was enabled.
- /// This will be empty for post delivery or email delivery
+ /// This will be empty for post delivery or email delivery
/// where the email template was disabled.
///
public DateTime? DeliveredAt { get; private set; }
@@ -233,6 +233,8 @@ internal override void ReadXml(XmlTextReader reader)
DateTime dateVal;
+ ReadRevRecNode(reader);
+
switch (reader.Name)
{
case "id":
@@ -333,6 +335,8 @@ internal override void WriteXml(XmlTextWriter xmlWriter)
xmlWriter.WriteElementString("currency", Currency);
xmlWriter.WriteElementString("unit_amount_in_cents", UnitAmountInCents.ToString());
+ WriteRevRecNodes(xmlWriter);
+
if (GifterAccount != null)
GifterAccount.WriteXml(xmlWriter, "gifter_account");
diff --git a/Library/Item.cs b/Library/Item.cs
index c040d049..914ff652 100644
--- a/Library/Item.cs
+++ b/Library/Item.cs
@@ -10,7 +10,7 @@ namespace Recurly
/// An item in Recurly.
///
///
- public class Item : RecurlyEntity
+ public class Item : RevRecEntity
{
public string ItemCode { get; set; }
@@ -108,6 +108,8 @@ internal override void ReadXml(XmlTextReader reader)
if (reader.NodeType != XmlNodeType.Element) continue;
+ ReadRevRecNode(reader);
+
switch (reader.Name)
{
case "item_code":
@@ -135,6 +137,7 @@ internal override void WriteXml(XmlTextWriter xmlWriter)
xmlWriter.WriteStringIfValid("external_sku", ExternalSku);
xmlWriter.WriteStringIfValid("accounting_code", AccountingCode);
xmlWriter.WriteStringIfValid("revenue_schedule_type", RevenueScheduleType);
+ WriteRevRecNodes(xmlWriter);
xmlWriter.WriteStringIfValid("state", State);
xmlWriter.WriteIfCollectionHasAny("custom_fields", CustomFields);
diff --git a/Library/ShippingMethod.cs b/Library/ShippingMethod.cs
index d20deddd..f09f7208 100644
--- a/Library/ShippingMethod.cs
+++ b/Library/ShippingMethod.cs
@@ -5,7 +5,7 @@
namespace Recurly
{
- public class ShippingMethod : RecurlyEntity
+ public class ShippingMethod : RevRecEntity
{
public string Code { get; set; }
public string Name { get; set; }
@@ -46,6 +46,8 @@ internal override void ReadXml(XmlTextReader reader)
if (reader.NodeType != XmlNodeType.Element) continue;
+ ReadRevRecNode(reader);
+
switch (reader.Name)
{
case "code":
@@ -82,6 +84,7 @@ internal override void WriteXml(XmlTextWriter xmlWriter)
xmlWriter.WriteElementString("code", Code);
xmlWriter.WriteElementString("name", Name);
xmlWriter.WriteElementString("accounting_code", AccountingCode);
+ WriteRevRecNodes(xmlWriter);
xmlWriter.WriteElementString("tax_code", TaxCode);
xmlWriter.WriteEndElement(); // End: shipping_method
diff --git a/Test/Fixtures/FixtureImporter.cs b/Test/Fixtures/FixtureImporter.cs
index 0c64201b..9ec5f3bc 100644
--- a/Test/Fixtures/FixtureImporter.cs
+++ b/Test/Fixtures/FixtureImporter.cs
@@ -85,9 +85,15 @@ public enum FixtureType
ExternalInvoices,
[Description("general_ledger_accounts")]
GeneralLedgerAccounts,
+ [Description("gift_cards")]
+ GiftCards,
+ [Description("items")]
+ Items,
[Description("performance_obligations")]
PerformanceObligations,
[Description("plans")]
Plans,
+ [Description("shipping_methods")]
+ ShippingMethods,
}
}
diff --git a/Test/Fixtures/gift_cards/revrec.show-200.xml b/Test/Fixtures/gift_cards/revrec.show-200.xml
new file mode 100644
index 00000000..e19b7a72
--- /dev/null
+++ b/Test/Fixtures/gift_cards/revrec.show-200.xml
@@ -0,0 +1,32 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+
+
+
+ 1998400800965102260
+ S2TNPI1Z4BRKM9U0
+ first-gift-card
+ 1000
+ USD
+
+ email
+ sally@example.com
+
+ Sally
+ DuMonde
+
+ Benjamin
+ Happy birthday!
+
+ 2024-02-08T17:48:38Z
+ 2024-02-08T17:48:38Z
+ 2024-02-08T17:48:38Z
+
+
+
+ suaz415ebc94
+ sxo2b1hpjrye
+ 7pu
+
diff --git a/Test/Fixtures/items/revrec.show-200.xml b/Test/Fixtures/items/revrec.show-200.xml
new file mode 100644
index 00000000..2b2d744d
--- /dev/null
+++ b/Test/Fixtures/items/revrec.show-200.xml
@@ -0,0 +1,21 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+-
+ plastic_gloves
+ Awesome Plastic Gloves
+ Sleek Plastic
+ awesome-plastic-gloves
+ 1569273944
+ never
+ true
+
+ active
+ suaz415ebc94
+ sxo2b1hpjrye
+ 7pu
+ 2019-09-23T21:25:45Z
+ 2019-09-23T21:25:45Z
+
+
diff --git a/Test/Fixtures/shipping_methods/revrec.show-200.xml b/Test/Fixtures/shipping_methods/revrec.show-200.xml
new file mode 100644
index 00000000..68174311
--- /dev/null
+++ b/Test/Fixtures/shipping_methods/revrec.show-200.xml
@@ -0,0 +1,15 @@
+HTTP/1.1 200 OK
+Content-Type: application/xml; charset=utf-8
+
+
+
+ ups-ground
+ UPS - Ground
+
+
+ suaz415ebc94
+ sxo2b1hpjrye
+ 7pu
+ 2023-07-10T19:54:21Z
+ 2023-12-04T18:54:45Z
+
diff --git a/Test/GiftCardTest.cs b/Test/GiftCardTest.cs
new file mode 100644
index 00000000..c766993b
--- /dev/null
+++ b/Test/GiftCardTest.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Xml;
+using FluentAssertions;
+using Recurly.Test.Fixtures;
+using Xunit;
+
+namespace Recurly.Test
+{
+ public class GiftCardTest : BaseTest
+ {
+ [RecurlyFact(TestEnvironment.Type.Unit)]
+ public void CheckForRevRecData()
+ {
+ var giftCard = new GiftCard();
+
+ var xmlFixture = FixtureImporter.Get(FixtureType.GiftCards, "revrec.show-200").Xml;
+ XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlFixture));
+ giftCard.ReadXml(reader);
+
+ giftCard.LiabilityGlAccountId.Should().Be("suaz415ebc94");
+ giftCard.RevenueGlAccountId.Should().Be("sxo2b1hpjrye");
+ giftCard.PerformanceObligationId.Should().Be("7pu");
+ }
+ }
+}
diff --git a/Test/ItemTest.cs b/Test/ItemTest.cs
index 8ea907a7..aaf6fbee 100644
--- a/Test/ItemTest.cs
+++ b/Test/ItemTest.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
+using System.Xml;
using FluentAssertions;
+using Recurly.Test.Fixtures;
using Xunit;
namespace Recurly.Test
@@ -41,5 +43,19 @@ public void DeactivateItem()
Assert.Equal(item.State, null);
}
+
+ [RecurlyFact(TestEnvironment.Type.Unit)]
+ public void CheckForRevRecData()
+ {
+ var item = new Item();
+
+ var xmlFixture = FixtureImporter.Get(FixtureType.Items, "revrec.show-200").Xml;
+ XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlFixture));
+ item.ReadXml(reader);
+
+ item.LiabilityGlAccountId.Should().Be("suaz415ebc94");
+ item.RevenueGlAccountId.Should().Be("sxo2b1hpjrye");
+ item.PerformanceObligationId.Should().Be("7pu");
+ }
}
}
diff --git a/Test/Recurly.Test.csproj b/Test/Recurly.Test.csproj
index a28d01f3..906e0c47 100644
--- a/Test/Recurly.Test.csproj
+++ b/Test/Recurly.Test.csproj
@@ -161,12 +161,27 @@
Always
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
Always
Always
+
+ Always
+
Always
@@ -182,6 +197,9 @@
Always
+
+ Always
+
Always
@@ -206,6 +224,9 @@
Always
+
+ Always
+
Always
@@ -221,18 +242,6 @@
Always
-
- Always
-
-
- Always
-
-
- Always
-
-
- Always
-