Skip to content

Missing TaxRate type in validator (downloading of tax rates fails) #223

@saboter

Description

@saboter

Hi @SerKnight,

some of our customers have tax rate types which are unknown to current validator. Tax rates download fails with:

ArgumentError: invalid value for "report_tax_type", must be one of ["AVALARA", "BASEXCLUDED", "CAPITALSALESOUTPUT", "CAPITALEXPENSESINPUT", "ECOUTPUT", "ECOUTPUTSERVICES", "ECINPUT", "ECACQUISITIONS", "EXEMPTEXPENSES", "EXEMPTINPUT", "EXEMPTOUTPUT", "GSTONIMPORTS", "INPUT", "INPUTTAXED", "MOSSSALES", "NONE", "NONEOUTPUT", "OUTPUT", "PURCHASESINPUT", "SALESOUTPUT", "EXEMPTCAPITAL", "EXEMPTEXPORT", "CAPITALEXINPUT", "GSTONCAPIMPORTS", "GSTONCAPITALIMPORTS", "REVERSECHARGES", "PAYMENTS", "INVOICE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS", "TXCA", "SRCAS", "DSOUTPUT", "BLINPUT2", "EPINPUT", "IMINPUT2", "MEINPUT", "IGDSINPUT2", "ESN33OUTPUT", "OPINPUT", "OSOUTPUT", "TXN33INPUT", "TXESSINPUT", "TXREINPUT", "TXPETINPUT", "NRINPUT", "ES33OUTPUT", "ZERORATEDINPUT", "ZERORATEDOUTPUT", "DRCHARGESUPPLY", "DRCHARGE", "CAPINPUT", "CAPIMPORTS", "IMINPUT", "INPUT2", "CIUINPUT", "SRINPUT", "OUTPUT2", "SROUTPUT", "CAPOUTPUT", "SROUTPUT2", "CIUOUTPUT", "ZROUTPUT", "ZREXPORT", "ACC28PLUS", "ACCUPTO28", "OTHEROUTPUT", "SHOUTPUT", "ZRINPUT", "BADDEBT", "OTHERINPUT"].

After some debugging I have hot-fixed by monkey patching the validator allowed values array. These four rate types were missing:
"TOURISTREFUND", "SROVR", "IGDSINPUT3", "BADDEBTRELIEF"

I have following questions and improvement ideas to this topic:

  • this type of issue is not new (we already had something similar in the past) it looks that something is broken by design = newly added types are not propagated to the generated api sources fast enough, maybe you could shed some light to it
  • in general tax rates could be also user defined (https://central.xero.com/s/article/Add-or-edit-tax-rates-GL#Addanewtaxrate) and in that case strict validator comparing value with some constants array does not make sense
  • it would be handy if the validation messages contained also the value which did not pass the validation:

        fail ArgumentError, "invalid value for \"report_tax_type\", must be one of #{validator.allowable_values}."

        vs.

        fail ArgumentError, "invalid value (#{report_tax_type}) for \"report_tax_type\", must be one of #{validator.allowable_values}."

Thank you,

Martin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions