Skip to content

Commit

Permalink
[BILL-111] adds vertex_transaction_type to plan
Browse files Browse the repository at this point in the history
  • Loading branch information
epagerecurly committed Oct 30, 2024
1 parent a5c20c6 commit bcf4d4b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Library/Plan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public enum IntervalUnit
public string SuccessUrl { get; set; }
public string CancelUrl { get; set; }

/// <summary>
/// VertexTransactionType is one of rental,sale,lease
/// Requires feature flag and vertex integration to use
/// </summary>
public string VertexTransactionType { get; set; }

public bool? DisplayDonationAmounts { get; set; }
public bool? DisplayQuantity { get; set; }
public bool? DisplayPhoneNumber { get; set; }
Expand Down Expand Up @@ -320,6 +326,10 @@ internal override void ReadXml(XmlTextReader reader)
CancelUrl = reader.ReadElementContentAsString();
break;

case "vertex_transaction_type":
VertexTransactionType = reader.ReadElementContentAsString();
break;

case "display_donation_amounts":
DisplayDonationAmounts = reader.ReadElementContentAsBoolean();
break;
Expand Down Expand Up @@ -474,6 +484,7 @@ internal override void WriteXml(XmlTextWriter xmlWriter)
xmlWriter.WriteStringIfValid("description", Description);
xmlWriter.WriteStringIfValid("accounting_code", AccountingCode);
xmlWriter.WriteStringIfValid("setup_fee_accounting_code", SetupFeeAccountingCode);
xmlWriter.WriteStringIfValid("vertex_transaction_type", VertexTransactionType);

// product revrec features (and setup fee revrec features)
WriteRevRecNodes(xmlWriter);
Expand Down
41 changes: 41 additions & 0 deletions Test/Fixtures/plans/vertex-transaction-type-show-200.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
HTTP/1.1 200 OK
Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<plan href="https://api.recurly.com/v2/plans/silver">
<add_ons href="https://api.recurly.com/v2/plans/silver/add_ons"/>
<plan_code>silver</plan_code>
<name>Silver Plan</name>
<description>Silver is everything but gold</description>
<success_url>http://example.com/api100_success</success_url>
<cancel_url>http://example.com/api100_cancel</cancel_url>
<display_donation_amounts type="boolean">false</display_donation_amounts>
<display_quantity type="boolean">true</display_quantity>
<display_phone_number type="boolean">false</display_phone_number>
<bypass_hosted_confirmation type="boolean">true</bypass_hosted_confirmation>
<unit_name>wid99gets</unit_name>
<payment_page_tos_link>http://example.com/terms-of-service</payment_page_tos_link>
<plan_interval_length type="integer">100</plan_interval_length>
<plan_interval_unit>months</plan_interval_unit>
<trial_interval_length type="integer">15</trial_interval_length>
<trial_interval_unit>days</trial_interval_unit>
<total_billing_cycles type="integer">6</total_billing_cycles>
<accounting_code nil="nil"></accounting_code>
<dunning_campaign_id>1234abcd</dunning_campaign_id>
<liability_gl_account_id>twrbsq39zvo5</liability_gl_account_id>
<revenue_gl_account_id>bwrks63lznoi</revenue_gl_account_id>
<performance_obligation_id>rkslzn</performance_obligation_id>
<setup_fee_liability_gl_account_id>twrisqjjzvo5</setup_fee_liability_gl_account_id>
<setup_fee_revenue_gl_account_id>dlrk123lzabc</setup_fee_revenue_gl_account_id>
<setup_fee_performance_obligation_id>bks6noi</setup_fee_performance_obligation_id>
<created_at type="datetime">2011-04-19T07:00:00Z</created_at>
<vertex_transaction_type>rental</vertex_transaction_type>
<unit_amount_in_cents>
<USD type="integer">1000</USD>
<EUR type="integer">800</EUR>
</unit_amount_in_cents>
<setup_fee_in_cents>
<USD type="integer">500</USD>
<EUR type="integer">400</EUR>
</setup_fee_in_cents>
</plan>
12 changes: 12 additions & 0 deletions Test/PlanTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,17 @@ public void CheckForRevRecData()
plan.SetupFeeRevenueGlAccountId.Should().Be("dlrk123lzabc");
plan.SetupFeePerformanceObligationId.Should().Be("bks6noi");
}

[RecurlyFact(TestEnvironment.Type.Unit)]
public void GetPlanWithVertexTransactionType()
{
var plan = new Plan();

var xmlFixture = FixtureImporter.Get(FixtureType.Plans, "vertex-transaction-type-show-200").Xml;
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlFixture));
plan.ReadXml(reader);

plan.VertexTransactionType.Should().Be("rental");
}
}
}
3 changes: 3 additions & 0 deletions Test/Recurly.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@
<Content Include="Fixtures\plans\show-200.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Fixtures\plans\vertex-transaction-type-show-200.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Fixtures\subscriptions\show-200-inactive.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down

0 comments on commit bcf4d4b

Please sign in to comment.