I have a commerce site that throws an error when a user's billing address is in Ireland. When attempting to submit billing information, including credit card information, the form displays the following error.
"We cannot process your credit card payment without a valid billing address."

I looked into it and the issue appears to be around line 502 in commerce_hosted_pci.module.

    foreach (array('thoroughfare', 'locality', 'postal_code', 'country') as $address_key) {
      if (empty($address_value[$address_key])) {
        $valid_billing_address = FALSE;
      }
    }

This code assumes any address should have these fields.

CommentFileSizeAuthor
#1 address-field-check-2543786-1.patch1.22 KBcrazysix
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

crazysix’s picture

I think the answer here is to let addressfield determine necessary fields to some extent. I have included a patch that does just this. Any address requires a country and thoroughfare. However, locality and postal code are only required if addressfield considers those part of the format for that country.

Patch is attached. Thanks!

crazysix’s picture

Status: Active » Needs review
ajm8372’s picture

I had the same issue with the Hosted PCI module and charging a card from a user in Ireland. I reviewed and tested the patch above and it resolved the issue for me.