Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | address-field-check-2543786-1.patch | 1.22 KB | crazysix |
Comments
Comment #1
crazysix CreditAttribution: crazysix as a volunteer commentedI 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!
Comment #2
crazysix CreditAttribution: crazysix as a volunteer commentedComment #3
ajm8372 CreditAttribution: ajm8372 commentedI 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.