app/controllers/avatax/configuration_controller.rb in killbill-avatax-3.0.1 vs app/controllers/avatax/configuration_controller.rb in killbill-avatax-3.0.2
- old
+ new
@@ -12,11 +12,12 @@
#
# Tax Codes
#
def set_tax_code
- @products = KillBillClient::Model::Catalog.simple_catalog(options_for_klient).last.products.map(&:name)
+ simple_catalog = KillBillClient::Model::Catalog.simple_catalog(nil, options_for_klient).last
+ @products = simple_catalog ? simple_catalog.products.map(&:name) : []
end
def do_set_tax_code
::Killbill::Avatax::AvataxClient.set_tax_code(params.require(:product_name),
params.require(:tax_code),
@@ -102,11 +103,11 @@
# Merge the new values with the current config. The config will likely contain additional fields that we don't want to clobber.
# The user should really use the more powerful /admin_tenants screen - this plugin screen was just created
# to be able to pass the initial AvaTax certification.
current_config = KillBillClient::Model::Tenant.get_tenant_plugin_config('killbill-avatax', options_for_klient)
-
- (current_config.values || ['']).first.split.each do |property|
+ config_values = current_config.values
+ config_values.present? && config_values.first.split.each do |property|
k, v = property.split('=')
plugin_config << case k
when 'org.killbill.billing.plugin.avatax.accountId', 'org.killbill.billing.plugin.avatax.licenseKey', 'org.killbill.billing.plugin.avatax.companyCode', 'org.killbill.billing.plugin.avatax.commitDocuments'
next
else