Problems with Cielo Library and communication with Codeigniter

1

I'm implementing communication with Cielo servers for a system of mine.

However, trying to load the Cielo library gives me an error. The folder structure is as follows:

  • third_party / Cielo / {sky git direct lib files}
  • controllers / Cielo_Homol.php {my test driver}

In controller Cielo_Homol.php I have the following code:

<?php defined('BASEPATH') OR exit('No direct script access allowed');

require APPPATH.'third_party/Cielo/Cielo.php';
require APPPATH.'third_party/Cielo/CieloException.php';
require APPPATH.'third_party/Cielo/Transaction.php';
require APPPATH.'third_party/Cielo/Holder.php';
require APPPATH.'third_party/Cielo/PaymentMethod.php';


use Cielo\Cielo;
use Cielo\CieloException;
use Cielo\Transaction;
use Cielo\Holder;
use Cielo\PaymentMethod;

class Cielo_Homol extends CI_Controller {

    private $mid = '1006993069';
    private $key = '25fbb99741c739dd84d7b06ec78c9bac718838630f30b112d033ce2e621b34f3';

    public function index(){
       $cielo = new Cielo($this->mid, $this->key, Cielo::TEST);
    }

}

I'm just trying to run the object to generate errors and start filling in the request data ... BUT, and now starts my problems, you're returning the following error:

  

An uncaught Exception was encountered

     

Type: Error

     

Message: Class 'Sky \ Merchant' not found

     

Filename:   /Users/raphaelschubert/projects/clients/myPage/application/third_party/Cielo/Cielo.php

     

Line Number: 59

     

Backtrace:

     

File:   /Users/raphaelschubert/projects/clients/miPague/application/controllers/Cielo_Homol.php   Line: 23 Function: __construct

     

File: /Users/raphaelschubert/projects/clientes/miPague/index.php Line:   292 Function: require_once

Cielo.php I did not move, it's original just like the library provided in the git link from Cielo.

Would anyone have a light to give me? Thanks for the help ...

    
asked by anonymous 27.04.2016 / 06:39

1 answer

0

/Users/raphaelschubert/projects/clients/myPage/application/controllers/Cielo_Homol.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

use Cielo\Cielo;
use Cielo\CieloException;
use Cielo\Transaction;
use Cielo\Holder;
use Cielo\PaymentMethod;

class Cielo_Homol extends CI_Controller {

    private $mid = '1006993069';
    private $key = '25fbb99741c739dd84d7b06ec78c9bac718838630f30b112d033ce2e621b34f3';

    public function index(){
       $cielo = new Cielo($this->mid, $this->key, Cielo::TEST);
    }

}

/Users/raphaelschubert/projects/clients/myPage/index.php

// adicionar autoloader:
spl_autoload_extensions('.php');

spl_autoload_register(function($classname) {
    if (strpos($classname, '\') !== false) {
        // Namespaced Classes
        $classfile = (str_replace('\', '/', $classname));

        if ($classname[0] !== '/') {
            $classfile = APPPATH . 'third_party/' . $classfile . '.php';
        }
        require($classfile);
    }
}, true, true);
/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
require_once BASEPATH.'core/CodeIgniter.php';
    
27.04.2016 / 13:59