Skip to content

Commit ebfb37f

Browse files
author
sunny
committed
adds vertex_transaction_type to adjustment response
1 parent 91e9b2c commit ebfb37f

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

Library/Adjustment.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ internal override void ReadXml(XmlTextReader reader)
284284
TaxCode = reader.ReadElementContentAsString();
285285
break;
286286

287+
case "vertex_transaction_type":
288+
VertexTransactionType = reader.ReadElementContentAsString();
289+
break;
290+
287291
case "tax_type":
288292
TaxType = reader.ReadElementContentAsString();
289293
break;

Test/AdjustmentTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,24 @@ public void AdjustmentWithVertexTransactionType()
298298
}
299299
var xml = xmlOutput.ToString();
300300
Assert.Contains("<vertex_transaction_type>lease</vertex_transaction_type>", xml);
301+
302+
// Verify that vertex_transaction_type can be deserialized from responses
303+
var mockResponse = GetMockAdjustmentResponse();
304+
Assert.NotNull(mockResponse);
305+
Assert.Equal(mockResponse.State, Adjustment.AdjustmentState.Invoiced);
306+
Assert.Equal("lease", mockResponse.VertexTransactionType);
307+
}
308+
309+
private Adjustment GetMockAdjustmentResponse()
310+
{
311+
// Mock the Adjustment response using a fixture with vertex_transaction_type
312+
var adjustment = new Adjustment();
313+
var xmlFixture = FixtureImporter.Get(FixtureType.Adjustments, "show-with-vertex-200").Xml;
314+
using (var reader = new XmlTextReader(new System.IO.StringReader(xmlFixture)))
315+
{
316+
adjustment.ReadXml(reader);
317+
}
318+
return adjustment;
301319
}
302320
}
303321
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
HTTP/1.1 200 OK
2+
Content-Type: application/xml; charset=utf-8
3+
4+
<?xml version="1.0" encoding="UTF-8"?>
5+
<adjustment href="https://api.recurly.com/v2/adjustments/abcdef1234567890" type="charge">
6+
<account href="https://api.recurly.com/v2/accounts/account"/>
7+
<invoice href="https://api.recurly.com/v2/invoices/1234"/>
8+
<subscription href="https://api.recurly.com/v2/subscriptions/1234567890abcdef"/>
9+
<uuid>abcdef1234567890</uuid>
10+
<state>invoiced</state>
11+
<description>$12 Annual Subscription</description>
12+
<item_code></item_code>
13+
<accounting_code></accounting_code>
14+
<product_code nil="nil"></product_code>
15+
<origin>plan</origin>
16+
<unit_amount_in_cents type="integer">1200</unit_amount_in_cents>
17+
<quantity type="integer">1</quantity>
18+
<discount_in_cents type="integer">0</discount_in_cents>
19+
<tax_in_cents type="integer">0</tax_in_cents>
20+
<total_in_cents type="integer">1200</total_in_cents>
21+
<currency>USD</currency>
22+
<taxable type="boolean">false</taxable>
23+
<tax_code></tax_code>
24+
<vertex_transaction_type>lease</vertex_transaction_type>
25+
<start_date type="datetime">2011-04-30T07:00:00Z</start_date>
26+
<end_date type="datetime">2011-04-30T07:00:00Z</end_date>
27+
<created_at type="datetime">2011-08-31T03:30:00Z</created_at>
28+
</adjustment>

Test/Recurly.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
<Content Include="Fixtures\adjustments\show-404.xml">
135135
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
136136
</Content>
137+
<Content Include="Fixtures\adjustments\show-with-vertex-200.xml">
138+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
139+
</Content>
137140
<Content Include="Fixtures\billinginfo\destroy-204.xml">
138141
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
139142
</Content>

0 commit comments

Comments
 (0)