Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/242.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在CakePHP中使用CCAVENTE支付网关_Php_Cakephp_Namespaces_Ccavenue - Fatal编程技术网

在CakePHP中使用CCAVENTE支付网关

在CakePHP中使用CCAVENTE支付网关,php,cakephp,namespaces,ccavenue,Php,Cakephp,Namespaces,Ccavenue,我使用的是CakePHP3.2。我必须将支付网关集成到我的网站 我正在使用图书馆来整合我的网站 但是通过composer安装它是不起作用的 composer require kishanio/ccavenue 所以,我下载了所有文件并将其解压缩到 /vendor/CCAvenue-PHP-Library-master Payment.php的路径 /vendor/CCAvenue-PHP-Library-master/src/Payment.php 在控制器中,我做的就像 <?php

我使用的是CakePHP3.2。我必须将支付网关集成到我的网站

我正在使用图书馆来整合我的网站

但是通过composer安装它是不起作用的

composer require kishanio/ccavenue
所以,我下载了所有文件并将其解压缩到

/vendor/CCAvenue-PHP-Library-master
Payment.php的路径

/vendor/CCAvenue-PHP-Library-master/src/Payment.php
在控制器中,我做的就像

<?php
namespace App\Controller;

use App\Controller\AppController;
use Cake\Event\Event;
require_once(ROOT.'/vendor/CCAvenue-PHP-Library-master/src/Payment.php');

use Kishanio\CCAvenue\Payment as CCAvenueClient;
class OrdersController extends AppController
{
    public function paymentViaPaymentGateway($invoice = null)
    {

          $payble_amount = 500;

          $ccavenue = new CCAvenueClient('key', 'id', 'redirect');

          // set details
          $ccavenue->setAmount($payble_amount);
          $ccavenue->setOrderId($invoice);
          $ccavenue->setBillingName($getOrder->user_address->name);
          $ccavenue->setBillingAddress($getOrder->user_address->line_1);
          $ccavenue->setBillingCity($getOrder->user_address->city);
          $ccavenue->setBillingZip($getOrder->user_address->postal);
          $ccavenue->setBillingState($getOrder->user_address->state);
          $ccavenue->setBillingCountry('India');
          $ccavenue->setBillingEmail($this->Auth->user('email'));
          $ccavenue->setBillingTel($this->Auth->user('mobile'));
          $ccavenue->setBillingNotes($invoice);

          // copy all the billing details to shipping details
          $ccavenue->billingSameAsShipping();

          // get encrypted data to be passed
          $data = $ccavenue->getEncryptedData();

          // merchant id to be passed along the param
          $merchant = $ccavenue->getMerchantId();

          $this->set('data', $data);
          $this->set('merchant', $merchant);
    }
}
Utils.php
包含

namespace Kishanio\CCAvenue;

use Kishanio\CCAvenue\Payment;
但是,这会产生如下错误

致命错误:在中找不到类“Kishanio\CCAvenue\Utils” /联机/vendor/CCAvenue PHP Library master/src/Payment.PHP的路径 243

Payment.php中指向错误的内容

public function getEncryptedData() {
  $utils = new Utils( $this );           // line 243
  $merchant_data = $this->getMerchantData( $utils->getChecksum() );
  return $utils->encrypt($merchant_data,$this->getWorkingKey());
}

你找到解决问题的方法了吗?一年前我必须解决它,但我不记得我到底做了什么来解决它。如果您面临任何问题,请发布单独的问题或在您的评论中添加更多信息,以便我能以更好的方式帮助您。在我的情况下,PagesController无法找到CCAvenueClient类。这个问题似乎差不多。我所能做的就是假设这个存储库的实际所有者没有提到任何一行代码。让我们看看您是否有任何想法或建议,否则我会继续尝试其他替代方案。您可能缺少包含该类的
使用名称空间
行。使用您正在使用的代码片段创建一个单独的问题,并共享指向该问题的链接。您找到解决问题的方法了吗?我必须在一年前解决它不记得我到底做了什么来解决它。如果您面临任何问题,请发布单独的问题或在您的评论中添加更多信息,以便我能以更好的方式帮助您。在我的情况下,PagesController无法找到CCAvenueClient类。这个问题似乎差不多。我所能做的就是假设这个存储库的实际所有者没有提到任何一行代码。让我们看看您是否有任何想法或建议,否则我会继续尝试其他备选方案。您可能缺少包含该类的
使用命名空间
行。使用您正在使用的代码片段创建一个单独的问题,并共享指向该问题的链接。
public function getEncryptedData() {
  $utils = new Utils( $this );           // line 243
  $merchant_data = $this->getMerchantData( $utils->getChecksum() );
  return $utils->encrypt($merchant_data,$this->getWorkingKey());
}