ZF2:Class' Payum \ Sofort \ Payment \ SofortUeberWeisung'未找到

时间:2017-06-08 21:52:48

标签: class controller zend-framework2 payum

这是我的控制器使用供应商Payum模块中的类。

<?php
    namespace Orders\Controller;
    use Payum\Sofort;
    use Payum\Sofort\Payment\SofortUeberWeisung;

    class PaymentController extends AbstractActionController
     {

    protected $entityManager;

    public function sofortAction()
    {
      $Sofortueberweisung = new SofortUeberWeisung($configkey);

        $Sofortueberweisung->setAmount(10.21);
        $Sofortueberweisung->setCurrencyCode('EUR');
        //$Sofortueberweisung->setSenderSepaAccount('88888888', '12345678', 'Max Mustermann');
        $Sofortueberweisung->setSenderCountryCode('DE');
        $Sofortueberweisung->setReason('Testueberweisung', 'Verwendungszweck');
        $Sofortueberweisung->setSuccessUrl('http://www.google.de', true);
        $Sofortueberweisung->setAbortUrl('http://www.google.de');
        // $Sofortueberweisung->setNotificationUrl('http://www.google.de', 'loss,pending');
        // $Sofortueberweisung->setNotificationUrl('http://www.yahoo.com', 'loss');
        // $Sofortueberweisung->setNotificationUrl('http://www.bing.com', 'pending');
        // $Sofortueberweisung->setNotificationUrl('http://www.sofort.com', 'received');
        // $Sofortueberweisung->setNotificationUrl('http://www.youtube.com', 'refunded');
        // $Sofortueberweisung->setNotificationUrl('http://www.youtube.com', 'untraceable');
        $Sofortueberweisung->setNotificationUrl('http://www.twitter.com');
        $Sofortueberweisung->setCustomerprotection(true);

             $Sofortueberweisung->sendRequest();

            if($Sofortueberweisung->isError()) {
                //SOFORT-API didn't accept the data
                echo $Sofortueberweisung->getError();
            } else {
                //buyer must be redirected to $paymentUrl else payment cannot be successfully completed!
                $paymentUrl = $Sofortueberweisung->getPaymentUrl();
                header('Location: '.$paymentUrl);
            }
        }

    }

该课程位于Payum \ Sofort \ Payment文件夹

<?php

   namespace Sofort\Payment;
   use Payum\Sofort\Core\SofortLibMultipay;

   class SofortUeberWeisung extends SofortLibMultipay {

    public function __construct($configKey) {
    parent::__construct($configKey);
    $this->_parameters['su'] = array();
   }
  }

为什么它仍然显示在控制器中找不到类但是我可以看到当我在控制器中定义新类时它会进入类。就像附上的图片一样。

我有什么不对,请纠正我,  enter image description here

1 个答案:

答案 0 :(得分:0)

您正在控制器中导入SofortUeberWeisung类,该类在此Sofort\Payment命名空间下,但不在此Payum\Sofort\Payment下。所以那应该在你的控制器中

use Sofort\Payment\SofortUeberWeisung;