Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BankAccount Model Not Available? #560

Open
frasermayfield opened this issue Nov 21, 2022 · 0 comments
Open

BankAccount Model Not Available? #560

frasermayfield opened this issue Nov 21, 2022 · 0 comments

Comments

@frasermayfield
Copy link

Using xeroizer 3.0.1 with Rails 6.1.4

I am trying to use the BankAccount model as part of creating BankTransactions. In the documentation it states to use:

bank_account = xero.Account.first(:where => {:type => 'BANK'})

Which works but it returns an instance of the Account class as follows:

#<Xeroizer::Record::Account :account_id: "7018f80e-5d4e-4323-8c98-2beed1e9c437", :name: "ACCOUNT NAME", :status: "ACTIVE", :type: "BANK", :tax_type: "NONE", :class: "ASSET", :enable_payments_to_account: false, :show_in_expense_claims: false, :bank_account_number: "20202020304050", :currency_code: "GBP", :reporting_code: "ASS", :reporting_code_name: "Assets", :updated_date_utc: 2022-11-03 14:08:18 UTC>

However when you then create a new BankTransaction using the following:

contact = xero.Contact.first
xero_spend = xero.BankTransaction.build(:date => '01/01/2022', :contact => contact, :bank_account => bank_account, :type => "SPEND")

It returns an error:

Xeroizer::AssociationTypeMismatch: Xeroizer::Record::BankAccount expected, got Xeroizer::Record::Account

As such I have tried running the following instead:

bank_account = xero.BankAccount.first

But this returns the following error:

NoMethodError: undefined method `BankAccount' for #Xeroizer::OAuth2Application:0x00005605707e8990

Is there something I need to do to enable querying the BankAccount model directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant