Jump to content

Fatal Error Error: Cannot redeclare class Cakephp


jamshaid_0007

Recommended Posts

i am integrating paypal digital payment method. i downloaded lib from github and inclued in app/vendor but when i run this code it gives error:

 

Fatal Error

Error: Cannot redeclare class Digital_Goods
File: /var/www/hs/GenII/app/Vendor/paypal-digital-goods/paypal-digital-goods.class.php
Line: 13

path of all files:/var/www/hs/GenII/app/Vendor/paypal-digital-goods/

 

following are lib clases

paypal-configuration.class.php

paypal-digital-goods.class.php

paypal-subscription.class.php

 

here is controller action where i included these classes

public function set_credentials() {

App::import('Vendor', 'Paypal-configurationClass',array('file' => 'paypal-digital-goods' . DS . 'paypal-configuration.class.php'));
App::import('Vendor', 'Paypal-subscriptionClass', array('file' => 'paypal-digital-goods' . DS . 'paypal-subscription.class.php'));
App::import('Vendor', 'Paypal-digital-goodsClass', array('file' => 'paypal-digital-goods'. DS . 'paypal-digital-goods.class.php'));
//App::import('Vendor', 'paypal-purchaseClass', array('file' => 'paypal-digital-goods' . DS . 'paypal-purchase.class.php'));




         $base_url =  $_SERVER['SERVER_NAME'].Router::url('/');
         $returnUrlcan =     "returnUrl?payPal=cancel";
         $returnUrlpaid =    "returnUrl?payPal=paid";
         $returnUrlnotify =  "returnUrl?payPal=notify";
    PayPal_Digital_Goods_Configuration::username( 'my id' );
    PayPal_Digital_Goods_Configuration::password( '********' );
    PayPal_Digital_Goods_Configuration::signature( 'dsdfdsfsfd' );
        
    PayPal_Digital_Goods_Configuration::return_url($this->get_script_uri( $returnUrlpaid ) );
    PayPal_Digital_Goods_Configuration::cancel_url($this->get_script_uri( $returnUrlcan ) );
    PayPal_Digital_Goods_Configuration::business_name( 'Demo Store' );

    PayPal_Digital_Goods_Configuration::notify_url($this->get_script_uri( $returnUrlnotify) );

    // Uncomment the line below to switch to the live PayPal site
    //PayPal_Digital_Goods_Configuration::environment( 'live' );

    if( PayPal_Digital_Goods_Configuration::username() == 'your_api_username' || PayPal_Digital_Goods_Configuration::password() == 'your_api_password' || PayPal_Digital_Goods_Configuration::signature() == 'your_api_signature' )
        exit( 'You must set your API credentials in ' . __FILE__ . ' for this example to work.' );
        }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.