When setting up taxes in Google Checkout settings for the UK I get the following error ...

user warning: Duplicate entry 'BE' for key 'PRIMARY' query: INSERT INTO uc_gc_taxes (zone, rate, tax_shipping) VALUES ('BERKS', 20, 0) in ...../drupal/sites/all/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.admin.inc on line 230.

This is on page: /admin/store/settings/google_checkout/taxes

This seems to be due to the fact that the zone column in uc_gc_taxes table only holds 2 chars so Bedforshire (code BEDS) ends up as BE and then when I come to add Berkshire (code BERKS) it fails. In the UK the zone_code can be up to 5 characters long, but in the uc_zones table they can actually be up to 32 characters in length.

Running this on my database fixed the problem for me:
ALTER TABLE uc_gc_taxes MODIFY COLUMN zone varchar(32);

but it probably needs a proper fix to drupal/sites/all/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.install

CommentFileSizeAuthor
#3 1512482-google-checkout-taxes.patch635 byteslongwave
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

For the UK though we shouldn't allow separate county taxes, as that doesn't make sense? Perhaps the real fix is to ensure that Google Checkout only applies state taxes to the US?

whizzkid’s picture

Title: zone column in uc_gc_taxes table not wide enough » UK Tax setup for Google Checkout

I would agree that would be better. My fix doesn't work anyway - it allows me to setup the tax rates but it breaks when an order is submitted to Google since they are expecting a valid US state code.

If the tax settings are empty, Google manages to calculate the VAT correctly, so should this admin page just be ignored for anything other than the US state and provinces?

longwave’s picture

Version: 6.x-2.7 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
635 bytes

This patch changes the taxes page to list only US states no matter which country is in use. This code will only ever work for US states anyway due to the resulting list being passed to Google inside <us-state-area> tags.

longwave’s picture

Status: Needs review » Fixed

Committed to both branches. As UK taxes work without any further settings (presuming you set them up in Google Checkout itself) I don't think there is anything more to do here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.