xero-ruby icon indicating copy to clipboard operation
xero-ruby copied to clipboard

Passing NOTAX option to line_amount_types for a Quote does not set the quote as NOTAX.

Open jonathanclarke opened this issue 4 years ago • 5 comments

As per the title: Passing NOTAX option to line_amount_types for a Quote should set the quote in xero as No Tax.

Existing behavior is broken and only sets the attribute as NONE and not as NOTAX.

Quote line_amount_types should reference QuoteLineAmountTypes and not LineAmountTypes

PR Here: https://github.com/XeroAPI/xero-ruby/pull/126

jonathanclarke avatar Feb 05 '21 12:02 jonathanclarke

Hey @jonathanclarke - thanks for the contribution and the PR. I'm trying to validate the issue as this might actually be an API bug not just in the ruby SDK.

So you are creating a quote with some sample JSON that includes:

line_amount_types": "NOTAX"

And response is setting value to:

line_amount_types: "NONE"

Instead of the proper list of values in https://github.com/XeroAPI/xero-ruby/blob/be42b63c48a70661bb399beb04f81b43d8ddd391/lib/xero-ruby/models/accounting/quote_line_amount_types.rb

I ask because I need to fix this in the API spec first and want to be 100%

https://github.com/XeroAPI/Xero-OpenAPI

SerKnight avatar Feb 11 '21 00:02 SerKnight

At first glance this does look setup properly, but I will try to reproduce and get the core fix asap.

Screen Shot 2021-02-10 at 5 46 26 PM

Any other code, logs, or raw responses you can provide to reproduce would be helpful

SerKnight avatar Feb 11 '21 00:02 SerKnight

Setting the hash as follows

{:quote_id=>nil,
 :quote_number=>"Q-001",
 :reference=>"Q-001",
 :terms=>"",
 :contact=>{:contact_id=>"d821ed76-fd94-4186-a8d4-6f9c98517574"},
 :line_items=>
  [{:description=>"rect 1", :unit_amount=>100.0, :line_amount=>664.0, :quantity=>6.64},
   {:description=>"rect 2", :unit_amount=>1000.0, :line_amount=>11440.0, :quantity=>11.44},
   {:description=>"rect 3", :unit_amount=>100.0, :line_amount=>563.0, :quantity=>5.63}],
 :date=>"2021-02-11",
 :expiry_date=>"2021-02-18",
 :currency_code=>"AUD",
 :sub_total=>12667.00,
 :title=>"Quote for test xero",
 :summary=>"<div>Description, Inclusions &amp; Exclusions</div>",
 :tracking=>[],
 :line_amount_types=>"NOTAX"}

The error then becomes as follows

Invalid ENUM value NONE for class #QuoteLineAmountTypes

If you look at the PR you can see that the quote should really be referencing quote_line_amount_types and not line_amount_types as per the API spec.

jonathanclarke avatar Feb 11 '21 09:02 jonathanclarke

Subtle difference by the way: LineAmountTypes references NO_TAX QuoteLineAmountTypes references NOTAX

The Xero API is fine I think, the issue lies in the ruby SDK and how you should enable the Quote to refer to LineAmountTypes (which I think is mainly for invoices) vs QuoteLineAmountTypes (which is for quotes).

jonathanclarke avatar Feb 11 '21 10:02 jonathanclarke

Hey @jonathanclarke - I've created a ticket with the Quotes product team to get this sorted.

Thanks for reporting the bug.. Not a clear timeframe till solved but context below Basically the solve will be 1 of 2 options.

  1. Support the documented LineAmount types
Exclusive Line items are exclusive of tax
Inclusive Line items are inclusive tax
NoTax Line have no tax
  1. Update the docs to reflect the actually supported Enums NONE, etc..

SerKnight avatar Apr 12 '21 16:04 SerKnight