The description to be shown on the buyer’s payment instrument statement. Maximum: 16 characters.

@param \TdbShopOrder $order
@param string|null   $invoiceNumber - optionally you may pass an invoice number

@return string
543507
public function getSoftDescriptor(\TdbShopOrder $order, $invoiceNumber = null)
    {
        $text = $this->getValue('softDescriptor');
        $data = $this->getTemplateDataFromOrder($order);
        $data['invoiceNumber'] = $invoiceNumber;

        return mb_substr($this->render($text, $data), 0, 16);
    }
1214704
protected function _setPaymentStatus( MShop_Order_Item_Interface $invoice, array $response )
	{
		if( !isset( $response['PAYMENTSTATUS'] ) ) {
			return;
		}

		switch ( $response['PAYMENTSTATUS'] )
		{
			case 'Pending':
				if( isset( $response['PENDINGREASON'] ) )
				{
					if( $response['PENDINGREASON'] === 'authorization' )
					{
						$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_AUTHORIZED );
						break;
					}

					$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', PENDINGREASON = ' . $response['PENDINGREASON'];
					$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
				}

				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'In-Progress':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'Completed':
			case 'Processed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_RECEIVED );
				break;

			case 'Failed':
			case 'Denied':
			case 'Expired':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUSED );
				break;

			case 'Refunded':
			case 'Partially-Refunded':
			case 'Reversed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUND );
				break;

			case 'Canceled-Reversal':
			case 'Voided':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_CANCELED );
				break;

			default:
				$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', response = ' . print_r( $response, true );
				$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
		}
	}
347681
protected function getOrderByExpressionAsString(InternalOrderByInfo $orderBy)
    {
        $result = '';
        foreach ($orderBy->getOrderByInfo()->getOrderByPathSegments() as $order) {
            foreach ($order->getSubPathSegments() as $subOrder) {
                $result .= $result ? ', ' : '';
                $result .= $subOrder->getName();
                $result .= $order->isAscending() ? ' ASC' : ' DESC';
            }
        }
        return $result;
    }
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;
    }
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;
    }
866602
protected function getDetailLink(TdbShopOrder $oOrder)
    {
        $aParameters = array(
            $this->getActiveOrderParameter() => $oOrder->fieldOrdernumber,
        );

        return '?'.TTools::GetArrayAsURL($aParameters);
    }
47915
private function getArticleType(Mage_Sales_Model_Order $order)
    {
        if ($order->getShippingAddress()->getCountry() == Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE) {
            return 7;
        } else {
            $shippingMethod = $this->getShippingConfiguration($order);
            if (isset($shippingMethod[4]) && $shippingMethod[4] == 'D') {
                return 1;
            }
            return 2;
        }
    }
101824
public function prepareInvoiceWithoutItems(OrderInterface $order, $amount)
    {
        try {
            $invoice = $this->orderConverter->toInvoice($order);
            $invoice->setBaseGrandTotal($amount);
            $invoice->setSubtotal($amount);
            $invoice->setBaseSubtotal($amount);
            $invoice->setGrandTotal($amount);

            $order->getInvoiceCollection()->addItem($invoice);

            return $invoice;
        } catch(\Exception $e) {
            $this->bugsnag->notifyException($e);
            throw $e;
        }
    }
950497
protected function getAmazonIdReferenceManager(\TdbShopOrder $order)
    {
        $manager = null;
        try {
            $manager = $this->config->amazonReferenceIdManagerFactory(
                $this->getDb(),
                AmazonPaymentGroupConfig::AMAZON_REFERENCE_ID_MANAGER_FACTORY_TYPE_SHOP_ORDER_ID,
                $order->id
            );
        } catch (\InvalidArgumentException $e) {
            $manager = new AmazonReferenceIdManager($order->getAmazonOrderReferenceId(), $order->id);
        }

        return $manager;
    }
1303928
public function generateReqIdFromOrderTransfer(OrderTransfer $orderTransfer): string
    {
        return $this->generateReqId(
            $orderTransfer->getTotals()->getHash(),
            $orderTransfer->getCustomer()->getCustomerReference() ?? static::GUEST_CUSTOMER_REFERENCE
        );
    }
186707
public static function validate($number, $invoice = null)
    {
        $regexp = sprintf('/^%s(\d{%d})$/', self::$codePrefix, self::$codeLength);

        return preg_match($regexp, $number);
    }
910467
public function setInvoice(\Core\Entity\Invoice $invoice = null) {
        $this->invoice = $invoice;

        return $this;
    }
390417
public function addInvoice(\Gpupo\CommonSchema\ORM\Entity\Trading\Order\Shipping\Invoice\Invoice $invoice)
    {
        $this->invoices[] = $invoice;

        return $this;
    }
1223055
protected function createInvoiceElementFromOrderElement(OrderElementInterface $orderElement)
    {
        $invoice = $this->invoiceElementManager->create();
        $invoice->setOrderElement($orderElement);
        $invoice->setDescription($orderElement->getDescription());
        $invoice->setDesignation($orderElement->getDesignation());
        $invoice->setPrice($orderElement->getPrice(true));
        $invoice->setUnitPriceExcl($orderElement->getUnitPrice(false));
        $invoice->setUnitPriceInc($orderElement->getUnitPrice(true));
        $invoice->setVatRate($orderElement->getVatRate());
        $invoice->setQuantity($orderElement->getQuantity());
        $invoice->setTotal($orderElement->getTotal(true));

        return $invoice;
    }
698844
def get_order_description(self, payment, order):
        
        template = getattr(settings, 'GETPAID_ORDER_DESCRIPTION', None)
        if template:
            return Template(template).render(Context({"payment": payment, "order": order}))
        else:
            return six.text_type(order)
519326
public function createCard(BasePaymentForm $paymentForm, Order $order = null): CreditCard {

        $card = new CreditCard;

        if ($paymentForm instanceof CreditCardPaymentForm) {
            $this->populateCard($card, $paymentForm);
        }

        if ($order) {
            if ($billingAddress = $order->getBillingAddress()) {
                // Set top level names to the billing names
                $card->setFirstName($billingAddress->firstName);
                $card->setLastName($billingAddress->lastName);

                $card->setBillingFirstName($billingAddress->firstName);
                $card->setBillingLastName($billingAddress->lastName);
                $card->setBillingAddress1($billingAddress->address1);
                $card->setBillingAddress2($billingAddress->address2);
                $card->setBillingCity($billingAddress->city);
                $card->setBillingPostcode($billingAddress->zipCode);
                if ($billingAddress->getCountry()) {
                    $card->setBillingCountry($billingAddress->getCountry()->iso);
                }
                if ($billingAddress->getState()) {
                    $state = $billingAddress->getState()->abbreviation ?: $billingAddress->getState()->name;
                    $card->setBillingState($state);
                }
                $card->setBillingPhone($billingAddress->phone);
                $card->setBillingCompany($billingAddress->businessName);
                $card->setCompany($billingAddress->businessName);
            }

            if ($shippingAddress = $order->getShippingAddress()) {
                $card->setShippingFirstName($shippingAddress->firstName);
                $card->setShippingLastName($shippingAddress->lastName);
                $card->setShippingAddress1($shippingAddress->address1);
                $card->setShippingAddress2($shippingAddress->address2);
                $card->setShippingCity($shippingAddress->city);
                $card->setShippingPostcode($shippingAddress->zipCode);

                if ($shippingAddress->getCountry()) {
                    $card->setShippingCountry($shippingAddress->getCountry()->iso);
                }

                if ($shippingAddress->getState()) {
                    $state = $shippingAddress->getState()->abbreviation ?: $shippingAddress->getState()->name;
                    $card->setShippingState($state);
                }

                $card->setShippingPhone($shippingAddress->phone);
                $card->setShippingCompany($shippingAddress->businessName);
            }

            $card->setEmail($order->getEmail());
        }

        return $card;
    }
1207351
public function getOpenInvoiceData($merchantReference, $order)
    {
        $count = 0;
        $currency = $order->getOrderCurrencyCode();
        $openInvoiceData = array();

        // loop through items
        foreach ($order->getItemsCollection() as $item) {
            //skip dummies
            if ($item->isDummy()) {
                continue;
            }

            ++$count;

            $linename = "line" . $count;
            $openInvoiceData['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
            $openInvoiceData['openinvoicedata.' . $linename . '.description'] = str_replace(
                "\n", '',
                trim($item->getName())
            );
            $openInvoiceData['openinvoicedata.' . $linename . '.itemAmount'] = $this->formatAmount(
                $item->getPrice(),
                $currency
            );
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatAmount'] = ($item->getTaxAmount() > 0 && $item->getPriceInclTax() > 0) ? $this->formatAmount(
                $item->getPriceInclTax(),
                $currency
            ) - $this->formatAmount(
                $item->getPrice(),
                $currency
            ) : $this->formatAmount($item->getTaxAmount(), $currency);
            // Calculate vat percentage
            $id = $item->getProductId();
            $product = $this->loadProductById($id);
            $taxRate = $this->getTaxRate($order, $product->getTaxClassId());
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatPercentage'] = $this->getMinorUnitTaxPercent($taxRate);
            $openInvoiceData['openinvoicedata.' . $linename . '.numberOfItems'] = (int)$item->getQtyOrdered();


            if ($this->isHighVatCategory($order->getPayment())) {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "High";
            } else {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "None";
            }

            // Needed for RatePay
            if ($item->getSku() != "") {
                $openInvoiceData['openinvoicedata.' . $linename . '.itemId'] = $item->getSku();
            }
        }

        //discount cost
        if ($order->getDiscountAmount() > 0 || $order->getDiscountAmount() < 0) {
            $linename = "line" . ++$count;
            $openInvoiceData['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
            $openInvoiceData['openinvoicedata.' . $linename . '.description'] = $this->__('Total Discount');
            $openInvoiceData['openinvoicedata.' . $linename . '.itemAmount'] = $this->formatAmount(
                $order->getDiscountAmount(),
                $currency
            );
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatPercentage'] = "0";
            $openInvoiceData['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
            if ($this->isHighVatCategory($order->getPayment())) {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "High";
            } else {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "None";
            }
        }

        //shipping cost
        if ($order->getShippingAmount() > 0 || $order->getShippingTaxAmount() > 0) {
            $linename = "line" . ++$count;
            $openInvoiceData['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
            $openInvoiceData['openinvoicedata.' . $linename . '.description'] = $order->getShippingDescription();
            $openInvoiceData['openinvoicedata.' . $linename . '.itemAmount'] = $this->formatAmount(
                $order->getShippingAmount(),
                $currency
            );
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatAmount'] = $this->formatAmount(
                $order->getShippingTaxAmount(),
                $currency
            );
            // Calculate vat percentage
            $taxClass = Mage::getStoreConfig('tax/classes/shipping_tax_class', $order->getStoreId());
            $taxRate = $this->getTaxRate($order, $taxClass);
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatPercentage'] = $this->getMinorUnitTaxPercent($taxRate);
            $openInvoiceData['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
            if ($this->isHighVatCategory($order->getPayment())) {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "High";
            } else {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "None";
            }
        }

        if ($order->getPaymentFeeAmount() > 0) {
            $linename = "line" . ++$count;
            $openInvoiceData['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
            $openInvoiceData['openinvoicedata.' . $linename . '.description'] = $this->__('Payment Fee');
            $openInvoiceData['openinvoicedata.' . $linename . '.itemAmount'] = $this->formatAmount(
                $order->getPaymentFeeAmount(),
                $currency
            );
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatAmount'] = "0";
            $openInvoiceData['openinvoicedata.' . $linename . '.itemVatPercentage'] = "0";
            $openInvoiceData['openinvoicedata.' . $linename . '.numberOfItems'] = 1;
            if ($this->isHighVatCategory($order->getPayment())) {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "High";
            } else {
                $openInvoiceData['openinvoicedata.' . $linename . '.vatCategory'] = "None";
            }
        }

        $openInvoiceData['openinvoicedata.refundDescription'] = "Refund / Correction for " . $merchantReference;
        $openInvoiceData['openinvoicedata.numberOfLines'] = $count;

        return $openInvoiceData;
    }