我正在使用CakePHP 3.2 . 我必须将CCAvenue支付网关集成到我的网站 .
我正在使用https://github.com/kishanio/CCAvenue-PHP-Library库将CCAvenue整合到我的网站中 .
但是通过composer安装它是行不通的
composer require kishanio/ccavenue
所以,我下载并提取所有文件
/vendor/CCAvenue-PHP-Library-master
Payment.php
的路径
/vendor/CCAvenue-PHP-Library-master/src/Payment.php
在 controller ,我做得很好
<?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 与 Payment.php
位于同一目录中,而Payment.php包含
namespace Kishanio\CCAvenue;
use Kishanio\CCAvenue\Utils;
和 Utils.php 包含
namespace Kishanio\CCAvenue;
use Kishanio\CCAvenue\Payment;
But, this gives error as
致命错误:第243行的/path_to/vendor/CCAvenue-PHP-Library-master/src/Payment.php中找不到类'Kishanio \ CCAvenue \ Utils'
Payment.php的内容,指出错误 .
public function getEncryptedData() {
$utils = new Utils( $this ); // line 243
$merchant_data = $this->getMerchantData( $utils->getChecksum() );
return $utils->encrypt($merchant_data,$this->getWorkingKey());
}