@param $invoiceNumber

@return ResponseInterface
162277
public function getTransactionInvoiceNumber($invoiceNumber)
    {
        if (empty($invoiceNumber)) {
            throw new InvalidArgumentException();
        }

        return $this->getRequest([
            self::API_TRANSACTION_INVOICE_NUMBER_QUERY,
            ['InvoiceNumber' => $invoiceNumber]
        ]);
    }
106772
public function getTransactionInvoiceReference($invoiceReference)
    {
        if (empty($invoiceReference)) {
            throw new InvalidArgumentException();
        }

        return $this->getRequest([
            self::API_TRANSACTION_INVOICE_REFERENCE_QUERY,
            ['InvoiceReference' => $invoiceReference]
        ]);
    }
1172925
public static function generate($invoice)
    {
        if ($invoice->getNumber() !== null) {
            return $invoice->getNumber();
        }

        $repo = self::$em->getRepository(Invoice::class);
        $regexp = sprintf('^%s(\d{%d})$', self::$codePrefix, self::$codeLength);
        $res = $repo->createQueryBuilder('i')
            ->select('i.number')
            ->where("SUBSTRING(i.number, '$regexp') != ''")
            ->setMaxResults(1)
            ->addOrderBy('i.number', 'desc')
            ->getQuery()
            ->getScalarResult();
        $max = $res ? (int) $res[0]['number'] : 0;

        return sprintf('%s%0' . self::$codeLength . 'd', self::$codePrefix, $max + 1);
    }
910467
public function setInvoice(\Core\Entity\Invoice $invoice = null) {
        $this->invoice = $invoice;

        return $this;
    }
1225431
public Invoice updateInvoice(final String invoiceId, final Invoice invoice) {
        return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId, invoice, Invoice.class);
    }
390417
public function addInvoice(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Invoice\Invoice $invoice)
    {
        $this->invoices[] = $invoice;

        return $this;
    }
430435
public function product($invoiceLineHandle, $product)
    {
        $products = new Product($this->client_raw);
        $productHandle = $products->getHandle($product);

        $this->client
            ->CurrentInvoiceLine_SetProduct(
                array(
                    'currentInvoiceLineHandle' => $invoiceLineHandle,
                    'valueHandle' => $productHandle
                )
            );

        return true;
    }
499260
public function getInvoiceAction(Request $request)
    {
        $customerClient = $this->getFactory()->getCustomerClient();
        $customerTransfer = $customerClient->getCustomer();

        if (!$customerTransfer) {
            return $this->redirectResponseInternal(PayoneControllerProvider::ROUTE_LOGIN);
        }

        $getInvoiceTransfer = new PayoneGetInvoiceTransfer();
        $getInvoiceTransfer->setReference($request->query->get('id'));
        $getInvoiceTransfer->setCustomerId($customerTransfer->getIdCustomer());

        $response = $this->getClient()->getInvoice($getInvoiceTransfer);

        if ($response->getStatus() === 'ERROR') {
            return $this->viewResponse(['errormessage' => $response->getInternalErrorMessage()]);
        }

        $callback = function () use ($response) {
            echo base64_decode($response->getRawResponse());
        };

        return $this->streamedResponse($callback, 200, ["Content-type" => "application/pdf"]);
    }
459938
public function showAction(Invoice $invoice, Request $request)
    {
        $buyer = $this->get('security.context')
            ->getToken()
            ->getUser()
            ->getCurrentProfile()
        ;

        // $savedCreditCards = $buyer->getSavedCreditCards();

        return $this->render('HarvestCloudCoreBundle:Buyer/Invoice:show.html.twig', array(
            'invoice' => $invoice,
        ));
    }
624020
public function showInvoiceAction(Request $request, $number)
    {
        
        $em = $this->container->get('doctrine')->getManager();
        /** @var Invoice $invoice */
        $invoice = $em->getRepository('EcommerceBundle:Invoice')->findOneBy(array(
            'invoiceNumber' => $number
        ));

        if (!$invoice ||
            false === $this->container->get('checkout_manager')->isCurrentUserOwner($invoice->getTransaction())) {
            throw new AccessDeniedException();
        }

        /** @var CheckoutManager $checkoutManager */
        $checkoutManager = $this->container->get('checkout_manager');

        $delivery = $invoice->getTransaction()->getDelivery();
        $totals = $checkoutManager->calculateTotals($invoice->getTransaction(), $delivery);

        return array(
                'delivery' => $delivery,
                'invoice'  => $invoice,
                'totals'   => $totals,
            );
    }
55606
public function findInvoice($id)
    {
        try {
            $transaction = BraintreeTransaction::find($id);

            if ($transaction->customerDetails->id != $this->braintree_id) {
                return;
            }

            return new Invoice($this, $transaction);
        } catch (Exception $e) {
            //
        }
    }
1139537
public function invoice($orderId, $invoiceKey)
    {
        $transformer = new InvoiceTransformer(self::STATUS_PAID, $invoiceKey);
        $body        = $transformer->output();

        /** @var \SkyHub\Api\Handler\Response\HandlerInterface $responseHandler */
        $responseHandler = $this->service()->post($this->baseUrlPath("$orderId/invoice"), $body);
        return $responseHandler;
    }
1334920
public function setInvoiceTax(\Core\Entity\InvoiceTax $invoice_tax = null) {
        $this->invoice_tax = $invoice_tax;

        return $this;
    }
242695
public function sendData($data)
    {
        $invoice = new Invoice();
        $invoice->setFullNotifications(true);
        $invoice->setItem($this->createItem());
        $invoice->setCurrency(new Currency($this->getCurrency()));
        $invoice->setRedirectUrl($this->getReturnUrl());
        $invoice->setNotificationUrl($this->getNotifyUrl());
        $invoice->setPosData(json_encode($this->buildPosData()));

        $response = $this->getClient()->createInvoice($invoice);

        return $this->response = new PurchaseResponse($this, $response);
    }
590799
public static function generate(Invoice $invoice, $template = 'default')
    {
        $template = strtolower($template);

        $options = new Options();

        $options->set('isRemoteEnabled', true);

        $pdf = new Dompdf($options);

        $context = stream_context_create([
            'ssl' => [
                'verify_peer'      => false,
                'verify_peer_name' => false,
                'allow_self_signed'=> true,
            ],
        ]);

        $pdf->setHttpContext($context);

        $pdf->loadHtml(View::make('invoices::'.$template, ['invoice' => $invoice]));
        $pdf->render();

        return $pdf;
    }
577291
public function load($invoiceId, $invoiceItemId, $params = [])
    {
        return $this->client()->get(
            'invoices/{invoiceId}/items/{invoiceItemId}',
            ['invoiceId' => $invoiceId, 'invoiceItemId' => $invoiceItemId] + (array) $params
        );
    }
474104
public function setServiceInvoiceTax(\Core\Entity\InvoiceTax $service_invoice_tax = null) {
        $this->service_invoice_tax = $service_invoice_tax;

        return $this;
    }