CodeIgniter Forums
Openpay LIBRARY - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Openpay LIBRARY (/thread-75730.html)



Openpay LIBRARY - ONGENERAL_TOWER - 03-10-2020

Hi! Im trying to use Openpay library in CI4 but I don't have success, I don't know if im doing right,
Im new using this framewwork, can any one help me?  Huh

This is my code

//controller
PHP Code:
<?php namespace App\Controllers;

use 
Codeigniter\Controller;
use 
App\Libraries\LibreriaPago;

class 
Demo extends BaseController
{
public function 
index(){


$api = new LibreriaPago;
}


//library
PHP Code:
<?php namespace App\Libraries;

require_once 
APPPATH.'/libraries/openpay/Openpay.php';




class 
LibreriaPago extends Openpay
{
public function 
__construct()
    {
        parent::__construct();
    }


// and content of library looks like

PHP Code:
<?php 


if (!function_exists('curl_init')) {
throw new 
Exception('CURL PHP extension is required to run Openpay client.');
}
if (!
function_exists('json_decode')) {
throw new 
Exception('JSON PHP extension is required to run Openpay client.');
}
if (!
function_exists('mb_detect_encoding')) {
throw new 
Exception('Multibyte String PHP extension is required to run Openpay client.');
}

require(
dirname(__FILE__) . '/data/OpenpayApiError.php');
require(
dirname(__FILE__) . '/data/OpenpayApiConsole.php');
require(
dirname(__FILE__) . '/data/OpenpayApiResourceBase.php');
require(
dirname(__FILE__) . '/data/OpenpayApiConnector.php');
require(
dirname(__FILE__) . '/data/OpenpayApiDerivedResource.php');
require(
dirname(__FILE__) . '/data/OpenpayApi.php');

require(
dirname(__FILE__) . '/resources/OpenpayBankAccount.php');
require(
dirname(__FILE__) . '/resources/OpenpayCapture.php');
require(
dirname(__FILE__) . '/resources/OpenpayCard.php');
require(
dirname(__FILE__) . '/resources/OpenpayCharge.php');
require(
dirname(__FILE__) . '/resources/OpenpayCustomer.php');
require(
dirname(__FILE__) . '/resources/OpenpayFee.php');
require(
dirname(__FILE__) . '/resources/OpenpayPayout.php');
require(
dirname(__FILE__) . '/resources/OpenpayPlan.php');
require(
dirname(__FILE__) . '/resources/OpenpayRefund.php');
require(
dirname(__FILE__) . '/resources/OpenpaySubscription.php');
require(
dirname(__FILE__) . '/resources/OpenpayTransfer.php');
require(
dirname(__FILE__) . '/resources/OpenpayWebhook.php');
require(
dirname(__FILE__) . '/resources/OpenpayToken.php');
require(
dirname(__FILE__) . '/resources/OpenpayPse.php');
?>



RE: Openpay LIBRARY - includebeer - 03-12-2020

What is not working? Do you have an error message?