Model/Order.php
public function finalizePayPalOrder($result, $basket, $transactionMode)
    {
        $utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
        $date = date('Y-m-d H:i:s', $utilsDate->getTime());

        // set order status, transaction ID and payment date to order
        $this->setPaymentInfoPayPalOrder($result->getTransactionId());

        $currency = $result->getCurrencyCode();
        if (!$currency) {
            $currency = $this->getOrderCurrency()->name;
        }

        // PayPal order info
        $payPalOrder = $this->getPayPalOrder();
        $payPalOrder->setOrderId($this->getId());
        $payPalOrder->setPaymentStatus('pending');
        $payPalOrder->setTransactionMode($transactionMode);
        $payPalOrder->setCurrency($currency);
        $payPalOrder->setTotalOrderSum($basket->getPrice()->getBruttoPrice());
        if ($transactionMode == 'Sale') {
            $payPalOrder->setCapturedAmount($basket->getPrice()->getBruttoPrice());
        }
        $payPalOrder->save();

        $orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
        $orderPayment->setTransactionId($result->getTransactionId());
        $orderPayment->setCorrelationId($result->getCorrelationId());
        $orderPayment->setDate($date);
        $orderPayment->setAction(($transactionMode == 'Sale') ? 'capture' : 'authorization');
        $orderPayment->setStatus($result->getPaymentStatus());
        $orderPayment->setAmount($result->getAmount());
        $orderPayment->setCurrency($result->getCurrencyCode());

        //Adding payment information
        $paymentList = $this->getPayPalOrder()->getPaymentList();
        $paymentList->addPayment($orderPayment);

        //setting order payment status after
        $paymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class);
        $paymentStatusCalculator->setOrder($this->getPayPalOrder());
        $this->getPayPalOrder()->setPaymentStatus($paymentStatusCalculator->getStatus(), $this);
        $this->getPayPalOrder()->save();

        //clear PayPal identification
        $this->getSession()->deleteVariable('oepaypal');
        $this->getSession()->deleteVariable("oepaypal-payerId");
        $this->getSession()->deleteVariable("oepaypal-userId");
        $this->getSession()->deleteVariable('oepaypal-basketAmount');
    }
public function finalizePayPalOrder($result, $basket, $transactionMode)
    {
        $utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
        $date = date('Y-m-d H:i:s', $utilsDate->getTime());

        // set order status, transaction ID and payment date to order
        $this->setPaymentInfoPayPalOrder($result->getTransactionId());

        $currency = $result->getCurrencyCode();
        if (!$currency) {
            $currency = $this->getOrderCurrency()->name;
        }

        // PayPal order info
        $payPalOrder = $this->getPayPalOrder();
        $payPalOrder->setOrderId($this->getId());
        $payPalOrder->setPaymentStatus('pending');
        $payPalOrder->setTransactionMode($transactionMode);
        $payPalOrder->setCurrency($currency);
        $payPalOrder->setTotalOrderSum($basket->getPrice()->getBruttoPrice());
        if ($transactionMode == 'Sale') {
            $payPalOrder->setCapturedAmount($basket->getPrice()->getBruttoPrice());
        }
        $payPalOrder->save();

        $orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
        $orderPayment->setTransactionId($result->getTransactionId());
        $orderPayment->setCorrelationId($result->getCorrelationId());
        $orderPayment->setDate($date);
        $orderPayment->setAction(($transactionMode == 'Sale') ? 'capture' : 'authorization');
        $orderPayment->setStatus($result->getPaymentStatus());
        $orderPayment->setAmount($result->getAmount());
        $orderPayment->setCurrency($result->getCurrencyCode());

        //Adding payment information
        $paymentList = $this->getPayPalOrder()->getPaymentList();
        $paymentList->addPayment($orderPayment);

        //setting order payment status after
        $paymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class);
        $paymentStatusCalculator->setOrder($this->getPayPalOrder());
        $this->getPayPalOrder()->setPaymentStatus($paymentStatusCalculator->getStatus(), $this);
        $this->getPayPalOrder()->save();

        //clear PayPal identification
        $this->getSession()->deleteVariable('oepaypal');
        $this->getSession()->deleteVariable("oepaypal-payerId");
        $this->getSession()->deleteVariable("oepaypal-userId");
        $this->getSession()->deleteVariable('oepaypal-basketAmount');
    }
public function finalizePayPalOrder ( $ result , $ basket , $ transactionMode ) { $ utilsDate = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) ; $ date = date ( 'Y-m-d H:i:s' , $ utilsDate -> getTime ( ) ) ; // set order status, transaction ID and payment date to order $ this -> setPaymentInfoPayPalOrder ( $ result -> getTransactionId ( ) ) ; $ currency = $ result -> getCurrencyCode ( ) ; if ( ! $ currency ) { $ currency = $ this -> getOrderCurrency ( ) -> name ; } // PayPal order info $ payPalOrder = $ this -> getPayPalOrder ( ) ; $ payPalOrder -> setOrderId ( $ this -> getId ( ) ) ; $ payPalOrder -> setPaymentStatus ( 'pending' ) ; $ payPalOrder -> setTransactionMode ( $ transactionMode ) ; $ payPalOrder -> setCurrency ( $ currency ) ; $ payPalOrder -> setTotalOrderSum ( $ basket -> getPrice ( ) -> getBruttoPrice ( ) ) ; if ( $ transactionMode == 'Sale' ) { $ payPalOrder -> setCapturedAmount ( $ basket -> getPrice ( ) -> getBruttoPrice ( ) ) ; } $ payPalOrder -> save ( ) ; $ orderPayment = oxNew ( \ OxidEsales \ PayPalModule \ Model \ OrderPayment :: class ) ; $ orderPayment -> setTransactionId ( $ result -> getTransactionId ( ) ) ; $ orderPayment -> setCorrelationId ( $ result -> getCorrelationId ( ) ) ; $ orderPayment -> setDate ( $ date ) ; $ orderPayment -> setAction ( ( $ transactionMode == 'Sale' ) ? 'capture' : 'authorization' ) ; $ orderPayment -> setStatus ( $ result -> getPaymentStatus ( ) ) ; $ orderPayment -> setAmount ( $ result -> getAmount ( ) ) ; $ orderPayment -> setCurrency ( $ result -> getCurrencyCode ( ) ) ; //Adding payment information $ paymentList = $ this -> getPayPalOrder ( ) -> getPaymentList ( ) ; $ paymentList -> addPayment ( $ orderPayment ) ; //setting order payment status after $ paymentStatusCalculator = oxNew ( \ OxidEsales \ PayPalModule \ Model \ OrderPaymentStatusCalculator :: class ) ; $ paymentStatusCalculator -> setOrder ( $ this -> getPayPalOrder ( ) ) ; $ this -> getPayPalOrder ( ) -> setPaymentStatus ( $ paymentStatusCalculator -> getStatus ( ) , $ this ) ; $ this -> getPayPalOrder ( ) -> save ( ) ; //clear PayPal identification $ this -> getSession ( ) -> deleteVariable ( 'oepaypal' ) ; $ this -> getSession ( ) -> deleteVariable ( "oepaypal-payerId" ) ; $ this -> getSession ( ) -> deleteVariable ( "oepaypal-userId" ) ; $ this -> getSession ( ) -> deleteVariable ( 'oepaypal-basketAmount' ) ; }
Finalizes PayPal order.

@param \OxidEsales\PayPalModule\Model\Response\ResponseDoExpressCheckoutPayment $result          PayPal results array.
@param \OxidEsales\Eshop\Application\Model\Basket                               $basket          Basket object.
@param string                                                                   $transactionMode Transaction mode Sale|Authorization.
Finalizes PayPal order .