Converts the items in the order into paypal items for purchase.

@param object $order Order.

@return array
770123
private function toPayPalItems($order)
    {
        $items = [];

        foreach ($order->items as $shopItem) {

            if ($shopItem->price > 0) {

                $item = new Item();

                $item->setName(substr($shopItem->displayName, 0, 127))
                    ->setDescription($shopItem->sku)
                    ->setCurrency($shopItem->currency)
                    ->setQuantity($shopItem->quantity)
                    ->setTax($shopItem->tax)
                    ->setPrice($shopItem->price);

                $items[] = $item;
            }
        }

        return $items;
    }
1193895
public function applyOrder($order)
    {
        switch ($order) {
            case 'time':
                $this->orderBy(['created_at' => SORT_ASC]);
                break;

            case 'supports':
            default:
                $this->orderBy(['(supports / pow((((UNIX_TIMESTAMP(NOW()) - created_at) / 3600) + 2),1.8) )' => SORT_DESC]);
                break;
        }

        return $order;
    }
1026617
public function show(Order $order)
    {
        Shop::instance($order->shop_id);
        $paymentMethods = Shop::getPaymentMethods()->flatten()->mapWithKeys(function($method) {
            return [$method::getId() => $method::getName()];
        })->all();
        $orderStatuses = $this->orderstatus->all()->pluck('name', 'id')->toArray();

        return view('order::admin.orders.view', compact('order', 'paymentMethods', 'orderStatuses'));
    }
824957
public function single($order)
    {
        $entry = new Entry($order);

        $entry
            ->conditionalField('id', function () {
                return Subbly::api('subbly.user')->hasAccess('subbly.backend.auth');
            })

            ->field('uid')
            ->field('status')
            ->field('gateway')
            ->decimal('total_price', $order->total_price)
            ->integer('total_items', $order->total_items)
            ->decimal('shipping_cost', $order->shipping_cost)

            ->relationshipField('user', 'Subbly\\Presenter\\V1\\UserPresenter')
            ->relationshipField('billing_address', 'Subbly\\Presenter\\V1\\OrderAddressPresenter')
            ->relationshipField('shipping_address', 'Subbly\\Presenter\\V1\\OrderAddressPresenter')
            ->relationshipField('products', 'Subbly\\Presenter\\V1\\OrderProductPresenter')

            ->dateField('created_at')
            ->dateField('updated_at')
        ;

        return $entry->toArray();
    }
174479
protected function parseOrder($order)
    {
        if(isset($order[0]))
        {
            $result = ' order by ' . implode(',', $order);
            foreach($order as $item)
            {
                $this->params = array_merge($this->params, $item->getBinds());
            }
            return $result;
        }
        else
        {
            return '';
        }
    }
67562
public function getOrderInformation(): array
    {
        return [
            'amount' => (int) $this->xml->OrderInformation->Amount,
            'currency' => (string) $this->xml->OrderInformation->Currency,
            'orderNumber' => (string) $this->xml->OrderInformation->OrderNumber,
            'orderDescription' => (string) $this->xml->OrderInformation->OrderDescription,
            'fee' => (int) $this->xml->OrderInformation->Fee,
            'roundingAmount' => (int) $this->xml->OrderInformation->RoundingAmount,
            'total' => (int) $this->xml->OrderInformation->Total,
            'timestamp' => (string) $this->xml->OrderInformation->Timestamp,
        ];
    }
712784
private function formatArray($order, $item, $remove = false, $lastItem = true)
    {
        return [
            'remove'   => $remove,
            'lastItem' => $lastItem,
            'item'     => [
                'quantity' => $item->getQuantity(),
                'total'    => $this->moneyFormatter->format(
                    $item->getTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
                'subtotal' => $this->moneyFormatter->format(
                    $item->getSubTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
            ],
            'order' => [
                'total' => $this->moneyFormatter->format(
                    $order->getTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
                'items-total' => $this->moneyFormatter->format(
                    $order->getItemsTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
            ],
            'payments' => $this->getPaymentsTotals($order),
        ];
    }
439121
function order($order)
	{
		$parsed_order = array();
		foreach(explode(',', $order) as $property_name)
		{
			$property_name = trim($property_name);
			if(preg_match('/^-(.+)/', $property_name, $m))
			{
				$property_name = $m[1];
				$dir = ' DESC';
			}
			else
				$dir = '';

			$property_name = $this->first_parse($property_name);
			$property_name = $this->stack_parse($property_name);
			$property_name = $this->class_parse($property_name);

			$parsed_order[] = "$property_name$dir";
		}

		$this->_where['*raw_order'] = "ORDER BY ".join(', ', $parsed_order);

		return $this;
	}
318162
private function getCurrentShippingMethodCostsCollection(OrderInterface $order) : Collection
    {
        return $this->methodProvider->getShippingMethodCosts($order->getShippingMethod(), new OrderContext($order));
    }
463322
public function run(array $orderItems, SpySalesOrder $orderEntity, ReadOnlyArrayObject $data)
    {
        $orderTransfer = $this->getOrderTransfer($orderEntity);
        $this->getFacade()->authorizePayment($orderTransfer);

        return [];
    }
882198
public function edit(Order $order)
    {
        Shop::instance($order->shop_id);
        $paymentMethods = Shop::getPaymentMethods()->flatten()->mapWithKeys(function($method) {
            return [$method::getId() => $method::getName()];
        })->all();
        return view('order::admin.orders.edit', compact('order', 'paymentMethods'));
    }
963776
public function getItems($order = null)
    {
        if (null === $order) {
            return $this->items;
        }

        return $this->sort($this->items, $order);
    }
1076305
private function formatTransactionData($order, $transaction, $amount)
    {
        return [
            'Time' => $this->timezone->formatDateTime(
                date('Y-m-d H:i:s', $transaction->date / 1000),
                2,
                2
            ),
            'Reference' => $transaction->reference,
            'Amount' => $order->getBaseCurrency()->formatTxt($amount / 100),
            'Transaction ID' => $transaction->id
        ];
    }
657932
public function createOrder($order = array())
    {
        $myOrder = new Order($order);
        $response = OrderService::createOrder($myOrder);

        if (isset($response["orderCode"])) {
            //success
            return $response;
        } else {
            Error::throwError("apierror");
        }
    }
1014313
public function findCouponsByOrder(OrderInterface $order)
    {
        $orderCoupons = $this
            ->createQueryBuilder('oc')
            ->where('oc.order = :order')
            ->setParameter('order', $order)
            ->getQuery()
            ->getResult();

        return array_map(function (OrderCouponInterface $orderCoupon) {
            return $orderCoupon->getCoupon();
        }, $orderCoupons);
    }
56888
protected function getOrderBys($order)
    {
        $separatedOrders = [$order];

        if ($this->isMultiOrderQuery($order)) {
            $separatedOrders = explode(',', $order);
        }

        return $separatedOrders;
    }
1046657
public function refundOrder(Order $order, $currency, array $params = [])
    {
        $params['currency'] = $currency;

        $this->postAndMap($order->getResourcePath().'/refund', $params, 'toOrder', $order);
    }