Skip to content

PayPal missing transaction types #1426

Open
@Rahza

Description

@Rahza

In the Ipn model, only txn_type "recurring_payment" will be processed for recurring payments. However, PayPal also sends IPN messages with other txn_types such as "recurring_payment_profile_created" or "recurring_payment_suspended".

if (isset($this->_request['txn_type']) && 'recurring_payment' == $this->_request['txn_type']) {
    $this->_getRecurringProfile();
    if ($httpAdapter) {
        $this->_postBack($httpAdapter);
    }
    $this->_processRecurringProfile();
} else {
    $this->_getOrder();
    if ($httpAdapter) {
        $this->_postBack($httpAdapter);
    }
    $this->_processOrder();
}

The request will enter the else {} branch above and consequently fail and return HTTP 503, because _getOrder will try to load an order, but there is not parameter "invoice" in the request.

protected function _getOrder()
{
    if (empty($this->_order)) {
        // get proper order
        $id = $this->_request['invoice'];
        $this->_order = Mage::getModel('sales/order')->loadByIncrementId($id);
        if (!$this->_order->getId()) {
            $this->_debugData['exception'] = sprintf('Wrong order ID: "%s".', $id);
            $this->_debug();
            Mage::app()->getResponse()
                ->setHeader('HTTP/1.1','503 Service Unavailable')
                ->sendResponse();
            exit;
        }
        // re-initialize config with the method code and store id
        $methodCode = $this->_order->getPayment()->getMethod();
        $this->_config = Mage::getModel('paypal/config', array($methodCode, $this->_order->getStoreId()));
        if (!$this->_config->isMethodActive($methodCode) || !$this->_config->isMethodAvailable()) {
            throw new Exception(sprintf('Method "%s" is not available.', $methodCode));
        }

        $this->_verifyOrder();
    }
    return $this->_order;
}

Are there any plans to implement the missing txn_types? Has anybody already solved this issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions