Skip to content

Commit fbb047d

Browse files
author
sunny
committed
moves vertex_transaction_type to purchase object only in request as it isnt returned in repsonse
1 parent 462b8e5 commit fbb047d

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

Library/Adjustment.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ public List<CustomField> CustomFields
9393
}
9494
private List<CustomField> _customFields;
9595

96-
/// <summary>
97-
/// Optional vertex transaction type for tax purposes.
98-
/// </summary>
99-
public string VertexTransactionType { get; set; }
100-
10196
private const string UrlPrefix = "/accounts/";
10297
private const string UrlPostfix = "/adjustments/";
10398

@@ -284,10 +279,6 @@ internal override void ReadXml(XmlTextReader reader)
284279
TaxCode = reader.ReadElementContentAsString();
285280
break;
286281

287-
case "vertex_transaction_type":
288-
VertexTransactionType = reader.ReadElementContentAsString();
289-
break;
290-
291282
case "tax_type":
292283
TaxType = reader.ReadElementContentAsString();
293284
break;
@@ -414,8 +405,6 @@ internal void WriteXml(XmlTextWriter xmlWriter, bool embedded = false)
414405

415406
if (TaxCode != null)
416407
xmlWriter.WriteElementString("tax_code", TaxCode);
417-
if (VertexTransactionType != null)
418-
xmlWriter.WriteElementString("vertex_transaction_type", VertexTransactionType);
419408
if (StartDate != DateTime.MinValue)
420409
xmlWriter.WriteElementString("start_date", StartDate.ToString("s"));
421410
if (EndDate.HasValue)

Library/Purchase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ public List<string> CouponCodes
138138
/// </summary>
139139
public string TransactionType { get; set; }
140140

141+
/// <summary>
142+
/// Optional vertex transaction type for tax purposes.
143+
/// </summary>
144+
public string VertexTransactionType { get; set; }
145+
141146
#region Constructors
142147

143148
internal Purchase()
@@ -281,6 +286,9 @@ internal override void WriteXml(XmlTextWriter xmlWriter)
281286
if (TransactionType != null)
282287
xmlWriter.WriteElementString("transaction_type", TransactionType);
283288

289+
if (VertexTransactionType != null)
290+
xmlWriter.WriteElementString("vertex_transaction_type", VertexTransactionType);
291+
284292
if (NetTerms.HasValue)
285293
xmlWriter.WriteElementString("net_terms", NetTerms.Value.ToString());
286294

Test/Fixtures/purchases/invoice-with-vertex-201.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Content-Type: application/xml; charset=utf-8
2727
<total_in_cents type="integer">580</total_in_cents>
2828
<currency>USD</currency>
2929
<tax_exempt type="boolean">false</tax_exempt>
30-
<vertex_transaction_type>lease</vertex_transaction_type>
3130
<created_at type="datetime">2025-11-25T22:00:00Z</created_at>
3231
<updated_at type="datetime">2025-11-25T22:00:00Z</updated_at>
3332
</adjustment>

Test/PurchaseTest.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -291,33 +291,26 @@ public void PurchaseWithVertexTransactionType()
291291
adjustment.Currency = "USD";
292292
adjustment.Quantity = 1;
293293
adjustment.UnitAmountInCents = 580;
294-
adjustment.VertexTransactionType = "lease";
295294

296295
var purchase = new Purchase(account.AccountCode, "USD");
297296
purchase.Account = account;
297+
purchase.VertexTransactionType = "lease";
298298
purchase.Adjustments.Add(adjustment);
299299

300300
// Verify the request serializes vertex_transaction_type correctly
301301
var xmlOutput = new System.Text.StringBuilder();
302302
using (var xmlWriter = new XmlTextWriter(new System.IO.StringWriter(xmlOutput)))
303303
{
304-
adjustment.WriteEmbeddedXml(xmlWriter);
304+
purchase.WriteXml(xmlWriter);
305305
}
306306
var xml = xmlOutput.ToString();
307307
Assert.Contains("<vertex_transaction_type>lease</vertex_transaction_type>", xml);
308308

309-
// Simulate what Purchase.Invoice(purchase) would return by using a fixture
310-
// This mocks the API response without making an actual HTTP call
309+
// Verify that a valid InvoiceCollection can be deserialized
310+
// (vertex_transaction_type is only sent in requests, not returned in responses)
311311
var mockResponse = GetMockInvoiceCollectionResponse();
312-
313-
// Assert the mocked response contains vertex_transaction_type
314312
Assert.NotNull(mockResponse.ChargeInvoice);
315313
Assert.Equal(mockResponse.ChargeInvoice.State, Invoice.InvoiceState.Paid);
316-
Assert.NotNull(mockResponse.ChargeInvoice.Adjustments);
317-
Assert.Single(mockResponse.ChargeInvoice.Adjustments);
318-
Assert.Equal(mockResponse.ChargeInvoice.Adjustments[0].VertexTransactionType, "lease");
319-
Assert.Equal(mockResponse.ChargeInvoice.Adjustments[0].UnitAmountInCents, 580);
320-
Assert.Equal(mockResponse.ChargeInvoice.Adjustments[0].Description, "Test Adjustment");
321314
}
322315

323316
private InvoiceCollection GetMockInvoiceCollectionResponse()

0 commit comments

Comments
 (0)