An extension of the popular Paradox Labs integration that provides alternate API account storage.
ParadoxLabs_AuthorizeNetCim
This module was developed to follow in-production, recurring orders while using a sandbox Authorize.net account. The merchant was using a highly customized Magento instance with unique order workflows. The third-party systems that were integrated did not provide adequate test environments. As a result, my team needed a way to track production orders in a test procedure.
As part of that effort, I was tasked with extending the existing Authorize.net CIM integration by Paradox Labs. The extension works by storing an alternate set of API keys, then selectively applying them at the time of transaction by checking the remote IP address against a configured whitelist.
For post-order activity (invoice, shipping), the alternate account is stored on the related payment record and again used to contact the payment gateway.
Configuring the payment method to support an alternate account.
protected function _loadOrCreateCard(Varien_Object $payment)
{
$this->unsetData('reference_flag');
if ($payment->getData('authnetcim_alt_account') == 1) {
$this->setData('reference_flag', 1);
} else if ( ($id = $payment->getOrder()->getCustomerId()) > 0 ) { // @todo future use
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore($payment->getOrder()->getStoreId())->getWebsite()->getId())
->load($id);
if ($customer->getUseAuthnetAltAccount()) {
$this->setData('reference_flag', 1);
}
}
return parent::_loadOrCreateCard($payment);
}