我想为Quickbooks创建Account对象。但是,当我尝试:
service.create(account_object)
它返回错误:
Quickbooks::InvalidModelException: Classification is not included in the list
我尝试输入一个默认值(https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/account),但它返回相同的错误..
答案 0 :(得分:0)
帐户分类将类似于责任,收入,费用或资产等。
转到此网址https://developer.intuit.com/docs/api/accounting/Account
查看AccountType部分=>子属性
它包含我们在创建帐户时可以使用的所有分类和帐户类型列表
您可以使用以下示例代码创建帐户
begin
oauth_client = OAuth::AccessToken.new($qb_oauth_consumer, token, secret)
service = Quickbooks::Service::Account.new(:access_token => oauth_client, :company_id => realm_id)
new_account = Quickbooks::Model::Account.new(:name => 'Undeposited money', :account_type => 'Other Current Asset', :classification => 'Asset' )
create_acccount = service.create(new_account)
rescue Exception => e
# e.message will show response of quickbooks for you request
puts e.message
# e.message.inspect will show logs
puts e.backtrace.inspect
end