【问题标题】:ZF2: Class 'Payum\Sofort\Payment\SofortUeberWeisung' not foundZF2:未找到“Payum\Sofort\Payment\SofortUeberWeisung”类
【发布时间】:2017-11-10 18:50:34
【问题描述】:

这是我的控制器,它使用供应商中 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();
   }
  }

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

我做错了什么,请纠正我,

【问题讨论】:

  • @Dymen1 你能看看这个吗?

标签: class controller zend-framework2 payum


【解决方案1】:

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

use Sofort\Payment\SofortUeberWeisung;

【讨论】:

    猜你喜欢
    • 2016-08-16
    • 1970-01-01
    • 2014-07-27
    • 2017-07-28
    • 1970-01-01
    • 2015-09-08
    • 2021-07-24
    • 2016-11-05
    • 1970-01-01
    相关资源
    最近更新 更多