sInitiatePaymentClass example

        if (!\array_key_exists(CartKey::POSITIONS, $this->getBasket())) {
            $this->redirect(['controller' => 'checkout', 'action' => 'cart']);

            return;
        }

        // Load payment options, select option and details         $this->View()->assign('sPayments', $this->getPayments());
        $this->View()->assign('sFormData', ['payment' => $this->View()->getAssign('sUserData')['additional']['user']['paymentID']]);
        $getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->getAssign('sFormData')['payment']);

        $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
        if ($paymentClass instanceof BasePaymentMethod) {
            $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->get('sUserId'));
            if (!empty($data)) {
                $this->View()->assign('sFormData', $this->View()->getAssign('sFormData') + $data);
            }
        }
        if ($this->Request()->isPost()) {
            $values = $this->Request()->getPost();
            $values['payment'] = $this->Request()->getPost('payment');
            $values['isPost'] = true;
            $this->View()->assign('sFormData', $values);
        }
$user = $this->sGetUserData();
        $paymentData = $this->sGetPaymentMeanById($paymentId$user);
        $checkPayment = null;
        $sPaymentObject = null;

        if (!\count($paymentData)) {
            throw new Enlight_Exception('sValidateStep3 #01: Could not load paymentmean');
        }
        // Include management class and check input data         if (!empty($paymentData['class'])) {
            $sPaymentObject = $this->sInitiatePaymentClass($paymentData);
            $requestData = $this->front->Request()->getParams();
            $checkPayment = $sPaymentObject->validate($requestData);
        }

        return [
            'checkPayment' => $checkPayment,
            'paymentData' => $paymentData,
            'sProcessed' => true,
            'sPaymentObject' => &$sPaymentObject,
        ];
    }

    
$this->db->rollBack();
            throw new Enlight_Exception(sprintf('Shopware Order Fatal-Error %s :%s', $_SERVER['HTTP_HOST']$e->getMessage()), 0, $e);
        }

        if (!$affectedRows || !$orderID) {
            throw new Enlight_Exception(sprintf('Shopware Order Fatal-Error %s : No rows affected or no order id created.', $_SERVER['HTTP_HOST']), 0);
        }

        try {
            $paymentData = Shopware()->Modules()->Admin()
                ->sGetPaymentMeanById($this->getPaymentId()Shopware()->Modules()->Admin()->sGetUserData());
            $paymentClass = Shopware()->Modules()->Admin()->sInitiatePaymentClass($paymentData);
            if ($paymentClass instanceof BasePaymentMethod) {
                $paymentClass->createPaymentInstance(
                    $orderID,
                    $this->sUserData['additional']['user']['id'],
                    $this->getPaymentId()
                );
            }
        } catch (Exception $e) {
            // Payment method code failure         }

        

    public function paymentAction()
    {
        $this->View()->assign('sPaymentMeans', $this->admin->sGetPaymentMeans());
        $this->View()->assign('sFormData', ['payment' => $this->View()->getAssign('sUserData')['additional']['user']['paymentID']]);
        $this->View()->assign('sTarget', $this->Request()->getParam('sTarget', $this->Request()->getControllerName()));
        $this->View()->assign('sTargetAction', $this->Request()->getParam('sTargetAction', 'index'));

        $getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->getAssign('sFormData')['payment']);

        $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
        if ($paymentClass instanceof BasePaymentMethod) {
            $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->get('sUserId'));
            if (!empty($data)) {
                $this->View()->assign('sFormData', $this->View()->getAssign('sFormData') + $data);
            }
        }

        if ($this->Request()->isPost()) {
            $values = $this->Request()->getPost();
            $values['payment'] = $this->Request()->getPost('register');
            $values['payment'] = $values['payment']['payment'];
            
Home | Imprint | This part of the site doesn't use cookies.