PHP code example of asioso / pimcore-payone-module

1. Go to this page and download the library: Download asioso/pimcore-payone-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asioso / pimcore-payone-module example snippets



    /**
     * payment iframe
     */
    public function paymentFrameAction(Request $request)
    {
        // init
        $cart = $this->getCart();
        $checkoutManager = Factory::getInstance()->getCheckoutManager($cart);

        if ($checkoutManager->isCommitted()) {
            throw new \Exception('Cart already committed');
        }

        $paymentInformation = $checkoutManager->startOrderPayment();
        $payment = $checkoutManager->getPayment();

        $language = substr($request->getLocale(), 0, 2);

        // payment config
        if($payment instanceof BsPayone) {
            // payone
            $payment->setPaymentInformation($paymentInformation);
            $config['orderIdent'] = $paymentInformation->getInternalPaymentId();
            $config['cart'] = $cart;
            $config['language'] =   substr($request->getLocale(), 0, 2);

        }

        else {
            throw new \Exception('Unknown Payment configured.');
        }

        // init payment
        $this->view->payment = $payment->initPayment($cart->getPriceCalculator()->getGrandTotal(), $config);        
        
    }