Reputation: 135
For payment gateway I used Ingenico SDK and it's not properly implement in CI, pass Namespace issue and class not found issue.
Upvotes: 0
Views: 728
Reputation: 11
For the INGENICO SDK there are 2 Option available, you can also use it's service by send data based on Hidden content and pass key and username served from Ingenico Profile.
Upvotes: 1
Reputation: 4582
From your application directory, run the following command:
composer require ingenico-epayments/connect-sdk-php
Next, you will want to have CodeIgniter autoload composer packages, so in your config/config.php file:
$config['composer_autoload'] = TRUE;
Now you'll be able to use composer packages, which means in your controller or model you could do something like this (I'm showing use in a controller):
<?php
use \Ingenico\Connect\Sdk\CommunicatorConfiguration;
use \Ingenico\Connect\Sdk\DefaultConnection;
use \Ingenico\Connect\Sdk\Communicator;
use \Ingenico\Connect\Sdk\Client;
class Test extends CI_Controller {
public function __construct(){
parent::__construct();
}
/**
* This is an example of basic usage from
* https://epayments.developer-ingenico.com/documentation/sdk/server/php/
*/
public function index()
{
$communicatorConfiguration =
new CommunicatorConfiguration('ApiKeyId', 'ApiSecret', 'BaseUri', 'Integrator');
$connection = new DefaultConnection();
$communicator = new Communicator($connection, $communicatorConfiguration);
$client = new Client($communicator);
// Do something with $client ...
}
}
Notice how the use statements are located above the class, yet there is no namespace. Normally in CodeIgniter you won't have namespaces, unless they are your own libraries or third_party classes. Since there is no namespace, the use statements let PHP know you intend to use the Ingenico classes by name, instead of prefixing them with \Ingenico\Connect\Sdk. You could use the prefix instead of the use statements if that makes you happy.
Upvotes: 3