Question

I am trying to extend the core code for authorize.net and when I do I am getting a payment method is not available exception. This is just the part of my code that I am using to extend.

config.xml

<config>
<modules>
    <Namespace_Service>
        <version>1.0.0</version>
    </Namespace_Service>
</modules>
<global>
<models>
     <paygate>
          <rewrite>
              <authorizenet>
                  Namespace_Service_Model_Paygate_Authorizenet
               </authorizenet>
           </rewrite>
     </paygate>     
</models>
<config>

Authorizenet.php

<?php

class Namespace_Service_Model_Paygate_Authorizenet extends Mage_Paygate_Model_Authorizenet
{
protected function _place($payment, $amount, $requestType)
{
    $payment->setAnetTransType($requestType);
    $payment->setAmount($amount);
    $request= $this->_buildRequest($payment);
    $result = $this->_postRequest($request);

    if(strlen($result->getAvsResultCode()) > 0)
    {
        $payment->setData('cc_avs_status', $result->getAvsResultCode());
    }

    switch ($requestType) {
        case self::REQUEST_TYPE_AUTH_ONLY:
            $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
            $defaultExceptionMessage = Mage::helper('paygate')->__('Payment authorization error.');
            break;
        case self::REQUEST_TYPE_AUTH_CAPTURE:
            $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
            $defaultExceptionMessage = Mage::helper('paygate')->__('Payment capturing error.');
            break;
    }

    switch ($result->getResponseCode()) {
        case self::RESPONSE_CODE_APPROVED:
            $this->getCardsStorage($payment)->flushCards();
            $card = $this->_registerCard($result, $payment);
            $this->_addTransaction(
                $payment,
                $card->getLastTransId(),
                $newTransactionType,
                array('is_transaction_closed' => 0),
                array($this->_realTransactionIdKey => $card->getLastTransId()),
                Mage::helper('paygate')->getTransactionMessage(
                    $payment, $requestType, $card->getLastTransId(), $card, $amount
                )
            );
            if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
                $card->setCapturedAmount($card->getProcessedAmount());
                $this->getCardsStorage($payment)->updateCard($card);
            }
            return $this;
        case self::RESPONSE_CODE_HELD:
            if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED
                || $result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PENDING_REVIEW
            ) {
                $card = $this->_registerCard($result, $payment);
                $this->_addTransaction(
                    $payment,
                    $card->getLastTransId(),
                    $newTransactionType,
                    array('is_transaction_closed' => 0),
                    array(
                        $this->_realTransactionIdKey => $card->getLastTransId(),
                        $this->_isTransactionFraud => true
                    ),
                    Mage::helper('paygate')->getTransactionMessage(
                        $payment, $requestType, $card->getLastTransId(), $card, $amount
                    )
                );
                if ($requestType == self::REQUEST_TYPE_AUTH_CAPTURE) {
                    $card->setCapturedAmount($card->getProcessedAmount());
                    $this->getCardsStorage()->updateCard($card);
                }
                $payment
                    ->setIsTransactionPending(true)
                    ->setIsFraudDetected(true);
                return $this;
            }
            if ($result->getResponseReasonCode() == self::RESPONSE_REASON_CODE_PARTIAL_APPROVE) {
                $checksum = $this->_generateChecksum($request, $this->_partialAuthorizationChecksumDataKeys);
                $this->_getSession()->setData($this->_partialAuthorizationChecksumSessionKey, $checksum);
                if ($this->_processPartialAuthorizationResponse($result, $payment)) {
                    return $this;
                }
            }
            Mage::throwException($defaultExceptionMessage);
        case self::RESPONSE_CODE_DECLINED:
        case self::RESPONSE_CODE_ERROR:
            Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
        default:
            Mage::throwException($defaultExceptionMessage);
    }
    return $this;
}
}

I can't seem to find what is going on. In the log file it gives me the failed to open stream: No such file or directory in ..../lib/Varien/Autoload.php on line 93 error

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top