Models that include tax_inclusive_amount use #to_f when serializing to XML, landing as floats, but specify no :as type, and default to Strings when deserialized.
Example XML string from serialization of a SalesReceipt (note <TaxInclusiveAmt>0.0</TaxInclusiveAmt>):
"<SalesReceipt xmlns=\"http://schema.intuit.com/finance/v3\" sparse=\"false\">\n<Id>11</Id>\n<SyncToken>0</SyncToken>\n<MetaData>\n<CreateTime>2022-05-29T14:59:48-0700</CreateTime>\n<LastUpdatedTime>2022-05-29T14:59:48-0700</LastUpdatedTime>\n</MetaData>\n<DocNumber>1003</DocNumber>\n<TxnDate>2022-05-27 00:00:00 +0000</TxnDate>\n<Line>\n<Id>1</Id>\n<LineNum>1</LineNum>\n<Description>Custom Design</Description>\n<Amount>337.5</Amount>\n<DetailType>SalesItemLineDetail</DetailType>\n<SalesItemLineDetail>\n<ItemRef name=\"Design\">4</ItemRef>\n<UnitPrice>75.0</UnitPrice>\n<Qty>4.5</Qty>\n<TaxCodeRef>NON</TaxCodeRef>\n<TaxInclusiveAmt>0.0</TaxInclusiveAmt>\n</SalesItemLineDetail>\n</Line>\n<Line>\n<Amount>337.5</Amount>\n<DetailType>SubTotalLineDetail</DetailType>\n<SubTotalLineDetail>\n<UnitPrice>0.0</UnitPrice>\n<Qty>0.0</Qty>\n</SubTotalLineDetail>\n</Line>\n<CustomerRef name=\"Dylan Sollfrank\">6</CustomerRef>\n<BillAddr>\n<Id>49</Id>\n<Line1>Dylan Sollfrank</Line1>\n<Lat>INVALID</Lat>\n<Long>INVALID</Long>\n</BillAddr>\n<PaymentMethodRef name=\"Check\">2</PaymentMethodRef>\n<PaymentRefNum>10264</PaymentRefNum>\n<DepositToAccountRef name=\"Checking\">35</DepositToAccountRef>\n<CustomerMemo>Thank you for your business and have a great day!</CustomerMemo>\n<TxnTaxDetail>\n<TotalTax>0.0</TotalTax>\n</TxnTaxDetail>\n<CustomField>\n<DefinitionId>1</DefinitionId>\n<Name>Crew #</Name>\n<Type>StringType</Type>\n</CustomField>\n<CustomField>\n<DefinitionId>2</DefinitionId>\n<Type>StringType</Type>\n</CustomField>\n<CurrencyRef name=\"United States Dollar\">USD</CurrencyRef>\n<ApplyTaxAfterDiscount>false</ApplyTaxAfterDiscount>\n<PrintStatus>NotSet</PrintStatus>\n<Balance>0.0</Balance>\n<EmailStatus>NotSet</EmailStatus>\n<TotalAmt>337.5</TotalAmt>\n</SalesReceipt>"
The resultant object when Quickbooks::Model::SalesReceipt.from_xml is used to deserialize (note "tax_inclusive_amount"=>"0.0", and compare with, for example, "unit_price"=>0.75e2 at same level)
Models that include
tax_inclusive_amount
use#to_f
when serializing to XML, landing as floats, but specify no:as
type, and default to Strings when deserialized.Example XML string from serialization of a SalesReceipt (note
<TaxInclusiveAmt>0.0</TaxInclusiveAmt>
):The resultant object when
Quickbooks::Model::SalesReceipt.from_xml
is used to deserialize (note"tax_inclusive_amount"=>"0.0"
, and compare with, for example,"unit_price"=>0.75e2
at same level)Looks like the same behavior will apply for:
Lines like https://github.com/ruckus/quickbooks-ruby/blob/1d5cee0600dfa6a357e8b8a374ba76895ef18e84/lib/quickbooks/model/sales_item_line_detail.rb#L12 should should perhaps be modified to specify
:as => BigDecimal
like https://github.com/ruckus/quickbooks-ruby/blob/1d5cee0600dfa6a357e8b8a374ba76895ef18e84/lib/quickbooks/model/sales_item_line_detail.rb#L6 ?