Skip to content

Crash on parsing TaxExemptionReasonId #2

Description

@2math

Hi, thank you for this grate package!

I have 1 client who has on one of his customers set TaxExemptionReasonId.
The problem comes when the Customer is been parsing from JSON. The field
taxExemptionReasonId is int?, while for some reason from the QB server is
coming as a String => "5". This leads to a crash.
It is sad that in QB documentation is also mentioned as numeric field : https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/customer#the-customer-object

I had a workaround locally on my machine over your package to handle this issue, but will be nice
if could be handled on the package side. Probably will have to report this type issue to Intuit as well?

In Customer.toJson I have changed the parsing of the field as :

      taxExemptionReasonId: (json['TaxExemptionReasonId'] is String) ?
          int.tryParse(json['TaxExemptionReasonId'] as String)
          : json['TaxExemptionReasonId'] as int?,

Using v0.0.5

Thanks in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions