Hi, I searched and didn't find if this is a known problem. If you create a profile_type using hook_commerce_customer_profile_type_info() and set 'addressfield' => TRUE (resulting in a second "Billing information" pane), it will auth/capt payments but will not post the addressfield to Authorize.net. This seems to be because "commerce_customer_billing" is being used to check for commerce_customer_address->value() instead of using all declared profile types to check for a value (see commerce_authnet_aim_submit_form_submit() around line 400). I added the following to the function to fix the problem:
$modules = module_implements('commerce_customer_profile_type_info');
foreach ($modules as $module) {
if (module_hook($module, 'commerce_customer_profile_type_info')) {
$profile_types = module_invoke($module, 'commerce_customer_profile_type_info');
foreach ($profile_types as $type => $profile_type) {
$type = 'commerce_customer_'.$type;
if ($order_wrapper->$type->value()) {
$profile_id = $type;
}
}
}
}
Then I just replaced commerce_customer_billing with $profile_id. I would add a patch but this seems more like a hack than anything else. ;)
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_authnet-support-multiple-profile_types-1877676.patch | 1.32 KB | rj |
Comments
Comment #1
rj CreditAttribution: rj commentedPatch is attached.
Comment #2
rj CreditAttribution: rj commentedRenaming the issue and providing a better summary.
AFAIK, commerce_authnet supports only one billing pane, provided by commerce_customer_billing. This becomes an issue if you want to add additional billing panes in a custom module. The above patch allows a site builder to create multiple billing panes.
Comment #3
dwkitchen CreditAttribution: dwkitchen commentedI'm note sure why you would not use the billing address in the billing profile. Can you please give some use cases.
Comment #4
rj CreditAttribution: rj commentedSure. The billing address cannot be used on more than one checkout page, which is an issue if you have multiple checkout processes.
In my case, I have a 'single page checkout' process that has all checkout panes on a single checkout_page that is then attached to node. In other words, a user selects a product, enters billing address, enters cc info, selects the "buy now" button and the order is immediately processed without leaving the node.
I also need to support a second checkout process, one that follows the traditional checkout -> review order -> checkout complete process. AFAIK, I cannot add the billing address to more than one checkout_page at a time, hence I have two billing addresses: one for the 'single page checkout' and one for the 'traditional' checkout process.
Comment #5
dwkitchen CreditAttribution: dwkitchen commentedI am still not 100% sure about the requirements, but I can see there is some potential.
I am changing this to a feature request rather than a bug though.
Comment #6
DamienMcKenna@dwkitchen: fyi https://www.drupal.org/sandbox/rj/1886778.