weareswat / invoicexpress-gem

InvoiceXpress ruby gem
www.invoicexpress.com
12 stars 22 forks source link

Missing information on Models::Sequence? #23

Open igorescobar opened 6 years ago

igorescobar commented 6 years ago

Hey there guys, it's me again.

In our use case, we are creating a CreditNote choosing a sequence_id. So what we do is:

We first, fetch all sequences via API and filter the sequence by a specific serie. As far as I know the sequence_id is the one mentioned on the id field. But then we started to see errors like this: 422: Sequence Sequence category mismatch invoices => credit_notes which is really weird...

Then... I noticed that inside of the same response you have different ids depending on the resource which make kinda of pointless having a global id for this resource but anyways... I notice this field: current_credit_note_sequence_id which is probably the id I should be using instead of id.

The thing is that after looking inside of your models:

module Invoicexpress
  module Models

    class Sequence < BaseModel
      include HappyMapper

      tag 'sequence'
      element :id, String
      element :serie, String
      element :current_invoice_number, Integer
      element :current_credit_note_number, Integer
      element :current_debit_note_number, Integer
      element :default_sequence, Boolean
    end

  end
end

I noticed that many of the fields returned by this endpoint are being ignored and not being returned for us to be able to use it... am I missing something or fields like: current_invoice_sequence_id, current_simplified_invoice_sequence_id, current_credit_note_sequence_id, current_debit_note_sequence_id, current_receipt_sequence_id, current_shipping_sequence_id, current_transport_sequence_id, current_proforma_sequence_id, current_quote_sequence_id, current_fees_note_sequence_id and current_purchase_order_sequence_id

Should also be there?

paulosilva86 commented 6 years ago

Hey @igorescobar ,

We updated the API but we haven't been able to update this gem. Do you want to submit a pull request with the desired changes and we'll publish a new version of this gem with those changes?

igorescobar commented 6 years ago

Sure @paulosilva86, will do!