Skip to content
Code-Schnipsel Gruppen Projekte
ApplePay.php 2,7 KiB
Newer Older
<?php

namespace QUI\ERP\Payments\Stripe\PaymentMethods;

use QUI;
use QUI\ERP\Accounting\Invoice\Invoice;
use QUI\ERP\Accounting\Invoice\InvoiceView;
use QUI\ERP\Accounting\Payments\Payments;

/**
 * Class ApplePay
 *
 * Payment via Apple Pay
 */
class ApplePay extends AbstractBrowserPay
{
    /**
     * @return string
     */
    public function getTitle()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.ApplePay.title');
    }

    /**
     * @return string
     */
    public function getDescription()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.ApplePay.description');
    }

    /**
     * Get title for frontend
     *
     * @return string
     */
    public function getFrontendTitle()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.frontend.ApplePay.title');
    }

    /**
     * Get description for frontend
     *
     * @return string
     */
    public function getFrontendDescription()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.frontend.ApplePay.description');
    }

    /**
     * Get title for the Payment step (OrderProcess)
     *
     * @return string
     */
    public function getPaymentStepTitle()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.PaymentStep.title.ApplePay');
    }

    /**
     * Get description step for the Payment step (OrderProcess)
     *
     * @return string
     */
    public function getPaymentStepInfo()
    {
        return $this->getLocale()->get('quiqqer/payment-stripe', 'payment.PaymentStep.info.ApplePay');
    }

    /**
     * Get type of Browser this BrowserPay works with
     *
    public function getBrowserTypes()
        return [
            \Browser::BROWSER_IPHONE,
            \Browser::BROWSER_IPAD,
            \Browser::BROWSER_SAFARI
        ];

    /**
     * Return the payment icon (the URL path)
     * Can be overwritten
     *
     * @return string
     */
    public function getIcon()
    {
        return Payments::getInstance()->getHost().
               URL_OPT_DIR.
               'quiqqer/payment-stripe/bin/images/Payment_ApplePay.png';
    }

    /**
     * Return the extra text for the invoice
     *
     * @param Invoice|InvoiceView $Invoice
     * @return mixed
     */
    public function getInvoiceInformationText($Invoice)
    {
        try {
            return $Invoice->getCustomer()->getLocale()->get(
                'quiqqer/payment-stripe',
                'additional_invoice_text.ApplePay'
            );
        } catch (\Exception $Exception) {
            QUI\System\Log::writeException($Exception);
            return '';
        }
    }