0

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

1

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.

| improve this answer | |
  • Thanks, this has helped me resolve the issue. By overriding the core file app/code/core/Mage/Paypal/Model/Express.php, I then commented out a section of the code from the order(Varien_Object $payment, $amount) function, specifically the code after the line $orderTransactionId = $payment->getTransactionId(); to the line above return $this; – wr125 Oct 23 '14 at 11:05
0

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;
    }
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.