Question

I am currently integrating my Magento website with an OMS system where the OMS system will be responsible for authing and charging card payments and PayPal payments.

I am having trouble with the PayPal side of things.

We are using PayPal Express, and for the integration to work, we need to perform a transaction type of Order, and let our OMS system then authorize and capture the payment.

I have set the Payment Action to Order within the PayPal Express configuration settings. However, when I place an order, an authorization transaction is placed immediately after the order transaction. I don’t want this to happen.

Is there any way to prevent the authorization taking place?

I am using Magento CE 1.8

Was it helpful?

Solution

Yes, core integration initiates an immediate authorization. In order to avoid this you will need to modify logic in app/code/core/Mage/Paypal/Model/Express.php , specifically method below:

public function order(Varien_Object $payment, $amount)

it performs authorization. Remove this logic. You will need to add extra action to the order that handles "Authorize" action, means will send the authorization to the PayPal that will allow to ship goods.

OTHER TIPS

Override the core file

app/code/core/Mage/Paypal/Model/Express.php

Add the below as the content to the overridden file.

class YourNameSpace_Paypal_Model_Express
extends Mage_Paypal_Model_Express
implements Mage_Payment_Model_Recurring_Profile_MethodInterface
{
    /**
     * Order payment
     *
     * Prevent authorize transaction firing, this will be handled by the OMS instead.
     *
     * @param Mage_Sales_Model_Order_Payment $payment
     * @param float                          $amount
     *
     * @return Mage_Paypal_Model_Express
     */
    public function order(Varien_Object $payment, $amount)
    {
        $paypalTransactionData = Mage::getSingleton('checkout/session')->getPaypalTransactionData();
        if (!is_array($paypalTransactionData)) {
            $this->_placeOrder($payment, $amount);
        } else {
            $this->_importToPayment($this->_pro->getApi()->setData($paypalTransactionData), $payment);
        }

        $payment->setAdditionalInformation($this->_isOrderPaymentActionKey, true);

        if ($payment->getIsFraudDetected()) {
            return $this;
        }

        return $this;
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top