@param \Magento\Sales\Model\Order $orderData

@return null
188532
private function processBillingAddress($orderData)
    {
        if ($orderData->getBillingAddress()) {
            $billingData = $orderData->getBillingAddress()->getData();
            $this->billingAddress = [
                'billing_address_1' => $this->_getStreet(
                    $billingData['street'],
                    1
                ),
                'billing_address_2' => $this->_getStreet(
                    $billingData['street'],
                    2
                ),
                'billing_city' => $billingData['city'],
                'billing_region' => $billingData['region'],
                'billing_country' => $billingData['country_id'],
                'billing_postcode' => $billingData['postcode'],
            ];
        }
    }
178991
private function setAddressDataForOrder(&$orderAddress, $addressData)
    {
        $orderAddress->setStreet($this->getProperty($addressData, 'street', ''));
        $orderAddress->setNumber($this->getProperty($addressData, 'number', ''));
        $orderAddress->setAddition($this->getProperty($addressData, 'addition', ''));
        $orderAddress->setCity($this->getProperty($addressData, 'city', ''));
        $orderAddress->setZip($this->getProperty($addressData, 'zip', ''));
        $orderAddress->setState($this->getProperty($addressData, 'state', ''));

        $countryName = $this->getProperty($addressData, 'country', '');
        // Get country name if country is an array.
        if (is_array($countryName)) {
            $countryName = '';
            if (isset($countryName['name'])) {
                $countryName = $countryName['name'];
            }
        }
        $orderAddress->setCountry($countryName);
        $orderAddress->setEmail($this->getProperty($addressData, 'email', ''));
        $orderAddress->setPhone($this->getProperty($addressData, 'phone', ''));
        $orderAddress->setNote($this->getProperty($addressData, 'note', ''));

        $orderAddress->setPostboxCity($this->getProperty($addressData, 'postboxCity', ''));
        $orderAddress->setPostboxPostcode($this->getProperty($addressData, 'postboxPostcode', ''));
        $orderAddress->setPostboxNumber($this->getProperty($addressData, 'postboxNumber', ''));

        $address = null;
        if ($this->getProperty($addressData, 'address')) {
            $address = $this->getProperty($addressData, 'address');
        } elseif ($this->getProperty($addressData, 'contactAddress')) {
            $address = $this->getProperty($addressData, 'contactAddress');
        }
        if ($address) {
            $this->getAndSetOrderAddressByContactAddressId($address, null, null, $orderAddress);
        }
    }
362110
public function handleConfirmOrderResponseError( $responseData )
    {
        oxRegistry::get( 'OxpsPaymorrowLogger' )->logWithType( $responseData, 'PM_handleConfirmOrderResponseError' );
        $this->setResponse( $responseData );
        $this->setErrorCode( $this->getErrorCodeFromResponseData( $responseData ) );

        return false;
    }
940824
public function getAuthDateTime($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('authDateTime', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['authDateTime'] : null;
    }
165092
protected function _orderReferenceUpdate($oData)
    {
        $sId = $oData->OrderReference->AmazonOrderReferenceId;
        $oOrder = $this->_loadOrderById('BESTITAMAZONORDERREFERENCEID', $sId);

        if ($oOrder !== false && isset($oData->OrderReference->OrderReferenceStatus->State)) {
            $this->getClient()->processOrderReference($oOrder, $oData->OrderReference);
            $this->logIPNResponse(Logger::INFO, 'OK', $oData);
            return true;
        }

        $this->logIPNResponse(Logger::ERROR, "Order with Order Reference ID: {$sId} not found", $oData);
        return false;
    }
121647
public function getById(OrderId $orderId) : Order
    {
        if (!array_key_exists((string)$orderId, $this->orders)) {
            throw OrderNotFoundException::byId($orderId);
        }

        return $this->orders[(string)$orderId];
    }
1315560
public function getDate($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('date', $orderStatuses[$orderIndex]) ? $orderStatuses[$orderIndex]['date'] : null;
    }
557694
protected function getOrder($orderId)
    {
        if (null == $order = OrderQuery::create()->findPk($orderId)) {
            $this->getLog()->addError(
                $this->getTranslator()->trans("Unknown order ID:  %id", array('%id' => $orderId))
            );
        }

        return $order;
    }
823119
public function getActionCodeDescription($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('actionCodeDescription', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['actionCodeDescription'] : null;
    }
1179821
protected function _paymentCapture($oData)
    {
        $sId = $oData->CaptureDetails->AmazonCaptureId;
        $oOrder = $this->_loadOrderById('BESTITAMAZONCAPTUREID', $sId);

        if ($oOrder !== false && isset($oData->CaptureDetails->CaptureStatus->State)) {
            $this->getClient()->setCaptureState($oOrder, $oData->CaptureDetails, true);
            $this->logIPNResponse(Logger::INFO, 'OK', $oData);
            return true;
        }

        $this->logIPNResponse(Logger::ERROR, "Order with Capture ID: {$sId} not found", $oData);
        return false;
    }
549547
public function deleteOrder(int $orderId) : bool
    {
        Assert::that($orderId)->greaterThan(0, 'The $orderId has to be positive');

        return (bool)$this->master->doRequest('DELETE', sprintf('/admin/WEBAPI/Endpoints/v1_0/OrderService/{KEY}/%d', $orderId));
    }
191618
public function onCallbackSuccess($order, $data = null)
    {
        $paymentId  = is_array($data) ? $data['paymentId'] : $data->paymentId;

        $payerId    = is_array($data) ? $data['PayerID'] : $data->PayerID;

        $this->statusCode = 'failed';

        $this->detail = sprintf('Payment failed. Ref: %s', $paymentId);

        // Begin paypal
        try {

            $this->setContext();

            $payment = Payment::get($paymentId, $this->apiContext);
            
            $execution = new PaymentExecution();

            $execution->setPayerId($payerId);

            $payment->execute($execution, $this->apiContext);

            $payment = Payment::get($paymentId, $this->apiContext);

            $this->statusCode = 'completed';

            $this->transactionId = $payment->id;

            $this->detail = 'Success';

        } catch (PayPalConnectionException $e) {

            $response = json_decode($e->getData());

            throw new GatewayException(
                sprintf(
                    '%s: %s',
                    $response->name,
                    isset($response->message) ? $response->message : 'Paypal payment Failed.'
                ),
                1001,
                $e
            );

        } catch (\Exception $e) {

            throw new GatewayException(
                $e->getMessage(),
                1000,
                $e
            );

        }
    }
1082938
public function getOrderErrorCode($orderIndex = 0)
    {
        $orderStatuses = $this->getOrderStatuses();
        return array_key_exists('errorCode', $orderStatuses[$orderIndex])
            ? $orderStatuses[$orderIndex]['errorCode'] : null;
    }
463322
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $orderTransfer = $this->getOrderTransfer($orderEntity);
        $this->getFacade()->authorizePayment($orderTransfer);

        return [];
    }
38119
public function onStateChange(OrderEvent $event)
    {
        $order = $event->getOrder();

        // If new state is Accepted or Completed and type is not order
        if (in_array($order->getState(), [OrderStates::STATE_ACCEPTED, OrderStates::STATE_COMPLETED])
            && $order->getType() != OrderTypes::TYPE_ORDER
        ) {
            // Transform to an order
            $order
                ->setType(OrderTypes::TYPE_ORDER)
                ->setCreatedAt(new \DateTime())
                ->setNumber(null)
                ->setKey(null)
            ;

            $this->generateNumberAndKey($order);
            $this->handleAddresses($order);

            $errorList = $this->validator->validate($order, ['Default', 'Order']);
            if ($errorList->count() > 0) {
                $messages = [];
                foreach ($errorList as $error) {
                    $messages[] = $error->getMessage();
                }
                throw new OrderException('Invalid order : ' . implode('<br>', $messages));
            }
        }

        // Set completed at
        if ($order->getState() === OrderStates::STATE_COMPLETED && null === $order->getCompletedAt()) {
            $order->setCompletedAt(new \DateTime());
        }
    }
936670
public function load($orderId)
    {
        $db = $this->getDb();
        $data = $db->getRow('SELECT * FROM `oepaypal_order` WHERE `oepaypal_orderid` = ' . $db->quote($orderId));

        return $data;
    }
878221
public function findOneByOrderIdNotFinished($orderId)
    {
        $qb = $this->createQueryBuilder('p');
        $qb->select('p')
            ->where('p.orderId = :orderId')
            ->andWhere('p.finished is NULL')
            ->setParameter('orderId', strtoupper($orderId))
            ;

        return $qb->getQuery()->getOneOrNullResult();
    }