diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c3bce0..1ebe0a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # VertexClient Changelog This file tracks all the changes (https://keepachangelog.com/en/1.0.0/) made to the client. This allows parsers such as Dependabot to provide a clean overview in pull requests. +## [v0.12.0] - 2026-03-12 + +#### Added + +- Add optional `posting_date` parameter to Invoice payload. When provided, sets `@postingDate` on the `InvoiceRequest` element for Vertex tax reporting period control. Omitting `posting_date` preserves existing behavior (no `@postingDate` attribute sent). + ## [v0.11.3] - 2025-01-21 #### Changed diff --git a/README.md b/README.md index f9624d4..669cfd9 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,10 @@ VertexClient.invoice( # Vertex's Document Number is a unique referencial identifier for this invoice. document_number: "unique-identifier-1a43b", + # Optional posting date for controlling the Vertex tax reporting period (e.g. ship date). + # Defaults to documentDate when omitted. + posting_date: "2018-11-16", + # ... All of the of the payload from quotation here ... ) diff --git a/lib/vertex_client/payloads/invoice.rb b/lib/vertex_client/payloads/invoice.rb index 12816d7..3f934ac 100644 --- a/lib/vertex_client/payloads/invoice.rb +++ b/lib/vertex_client/payloads/invoice.rb @@ -11,10 +11,12 @@ def validate! end def body - super.merge({ - :'@documentNumber' => params[:document_number], - :'@documentDate' => params[:date] - }) + b = super.merge({ + :'@documentNumber' => params[:document_number], + :'@documentDate' => params[:date] + }) + b[:'@postingDate'] = params[:posting_date] if params[:posting_date].present? + b end def document_number_missing? diff --git a/lib/vertex_client/version.rb b/lib/vertex_client/version.rb index 08747e4..68c0311 100644 --- a/lib/vertex_client/version.rb +++ b/lib/vertex_client/version.rb @@ -1,3 +1,3 @@ module VertexClient - VERSION = '0.11.3' + VERSION = '0.12.0' end diff --git a/test/payloads/invoice_test.rb b/test/payloads/invoice_test.rb index b13474a..cf5aece 100644 --- a/test/payloads/invoice_test.rb +++ b/test/payloads/invoice_test.rb @@ -16,6 +16,16 @@ }), payload.body end + it 'includes @postingDate in body when posting_date is provided' do + working_quote_params[:posting_date] = '2026-03-12' + payload = VertexClient::Payload::Invoice.new(working_quote_params) + assert_equal '2026-03-12', payload.body[:'@postingDate'] + end + + it 'omits @postingDate from body when posting_date is not provided' do + assert_nil payload.body[:'@postingDate'] + end + it_supports_tax_only_adjustments(:working_quote_params) it 'supports sending is_tax_exempt to customer' do