Model/IPNPaymentCreator.php
public function handleOrderPayment($requestOrderPayment)
    {
        $return = null;

        $authId              = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_ID);
        $transactionEntity   = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_TRANSACTION_ENTITY);
        $parentTransactionId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_PARENT_TRANSACTION_ID);

        $orderPaymentAuthorization = $this->loadOrderPayment($authId);
        $orderPaymentParent        = $this->loadOrderPayment($parentTransactionId);
        $orderId                   = $orderPaymentParent->getOrderId();

        if ((self::HANDLE_TRANSACTION_ENTITY == $transactionEntity) && $orderId) {
            $requestOrderPayment->setOrderId($orderId);
            $requestOrderPayment->save();
            $requestOrderPayment = $this->addRequestPaymentComment($requestOrderPayment);

            if (\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::REFUND_ACTION == $requestOrderPayment->getAction()) {
                $this->updateParentTransactionRefundAmount($orderPaymentParent, $requestOrderPayment->getAmount());
            }
            if ((\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::AUTHORIZATION_ACTION == $orderPaymentAuthorization->getAction())
                && ($orderId == $orderPaymentAuthorization->getOrderId())
            ) {
                $this->updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization);
            }
            $return = $requestOrderPayment;
        }

        return $return;
    }
public function handleOrderPayment($requestOrderPayment)
    {
        $return = null;

        $authId              = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_ID);
        $transactionEntity   = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_TRANSACTION_ENTITY);
        $parentTransactionId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_PARENT_TRANSACTION_ID);

        $orderPaymentAuthorization = $this->loadOrderPayment($authId);
        $orderPaymentParent        = $this->loadOrderPayment($parentTransactionId);
        $orderId                   = $orderPaymentParent->getOrderId();

        if ((self::HANDLE_TRANSACTION_ENTITY == $transactionEntity) && $orderId) {
            $requestOrderPayment->setOrderId($orderId);
            $requestOrderPayment->save();
            $requestOrderPayment = $this->addRequestPaymentComment($requestOrderPayment);

            if (\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::REFUND_ACTION == $requestOrderPayment->getAction()) {
                $this->updateParentTransactionRefundAmount($orderPaymentParent, $requestOrderPayment->getAmount());
            }
            if ((\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::AUTHORIZATION_ACTION == $orderPaymentAuthorization->getAction())
                && ($orderId == $orderPaymentAuthorization->getOrderId())
            ) {
                $this->updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization);
            }
            $return = $requestOrderPayment;
        }

        return $return;
    }
public function handleOrderPayment ( $ requestOrderPayment ) { $ return = null ; $ authId = $ this -> getRequest ( ) -> getRequestParameter ( self :: PAYPAL_IPN_AUTH_ID ) ; $ transactionEntity = $ this -> getRequest ( ) -> getRequestParameter ( self :: PAYPAL_IPN_TRANSACTION_ENTITY ) ; $ parentTransactionId = $ this -> getRequest ( ) -> getRequestParameter ( self :: PAYPAL_IPN_PARENT_TRANSACTION_ID ) ; $ orderPaymentAuthorization = $ this -> loadOrderPayment ( $ authId ) ; $ orderPaymentParent = $ this -> loadOrderPayment ( $ parentTransactionId ) ; $ orderId = $ orderPaymentParent -> getOrderId ( ) ; if ( ( self :: HANDLE_TRANSACTION_ENTITY == $ transactionEntity ) && $ orderId ) { $ requestOrderPayment -> setOrderId ( $ orderId ) ; $ requestOrderPayment -> save ( ) ; $ requestOrderPayment = $ this -> addRequestPaymentComment ( $ requestOrderPayment ) ; if ( \ OxidEsales \ PayPalModule \ Model \ IPNRequestPaymentSetter :: REFUND_ACTION == $ requestOrderPayment -> getAction ( ) ) { $ this -> updateParentTransactionRefundAmount ( $ orderPaymentParent , $ requestOrderPayment -> getAmount ( ) ) ; } if ( ( \ OxidEsales \ PayPalModule \ Model \ IPNRequestPaymentSetter :: AUTHORIZATION_ACTION == $ orderPaymentAuthorization -> getAction ( ) ) && ( $ orderId == $ orderPaymentAuthorization -> getOrderId ( ) ) ) { $ this -> updateOrderPaymentAuthorizationStatus ( $ orderPaymentAuthorization ) ; } $ return = $ requestOrderPayment ; } return $ return ; }
Handling of IPN data that has not yet a paypal order payment
entry in shop database.
Checks if information from IPN is relevant for Shop. That is the case
if the related PayPal parent transaction can be found in table oepaypal_orderpayments.

If data is relevant, we need to
- create paypal order payment, store it in database and return it.
- if it is a refund, update the parent transaction's refunded amount
- update authorization status (can be Pending, In Progress, Completed)

@param \OxidEsales\PayPalModule\Model\OrderPayment $requestOrderPayment

@return \OxidEsales\PayPalModule\Model\OrderPayment|null
Handling of IPN data that has not yet a paypal order payment entry in shop database . Checks if information from IPN is relevant for Shop . That is the case if the related PayPal parent transaction can be found in table oepaypal_orderpayments .