Welcome Guest, Not a member yet? Register   Sign In
Openpay LIBRARY
#7

(This post was last modified: 08-30-2020, 02:46 PM by jreklund.)

Hi, I namespaced all the files, I moved all files to one folder and if a file has more than one class I create a separate file for the other classes in order to have 1 class per file.
I have the files in the following folder:
app/Libraries/Openpay
I added the following line at the top of each file under the folder Openpay

PHP Code:
namespace App\Libraries\Openpay;

In app/Config/Autoload.php file

$psr4 
= [
 
'App'        => APPPATH,                // To ensure filters, etc still found,
 
APP_NAMESPACE => APPPATH,                // For custom namespace
 
'Config'      => APPPATH 'Config',
 
'Openpay'        => APPPATH 'Libraries\Openpay'
 
]; 

In my controller I added the following
use App\Libraries\Openpay\Openpay;

And in the function where I need to use it I added the following:
Openpay::setId('mysecretid');
Openpay::setApiKey('mysecretkey');

The problem that I have now it's when I call any of the class/method like:

$customer = $openpay->customers->add($customerData);
$charge = $openpay->charges->create($chargeData);

I get the following error:
Call to undefined method stdClass::create()
Call to undefined method stdClass::add()

I don't know why I'm getting this error and how to fix it.
Do you have an idea what I'm doing wrong or what I need to change?
Thanks for your help.
Reply


Messages In This Thread
Openpay LIBRARY - by ONGENERAL_TOWER - 03-10-2020, 11:46 AM
RE: Openpay LIBRARY - by includebeer - 03-12-2020, 09:49 AM
RE: Openpay LIBRARY - by cgowez - 08-25-2020, 12:25 PM
RE: Openpay LIBRARY - by Jan Zelenka - 08-26-2020, 04:44 AM
RE: Openpay LIBRARY - by cgowez - 08-26-2020, 07:55 AM
RE: Openpay LIBRARY - by Chroma - 08-27-2020, 04:43 AM
RE: Openpay LIBRARY - by cgowez - 08-30-2020, 02:34 PM
RE: Openpay LIBRARY - by tgix - 09-01-2020, 10:28 PM
RE: Openpay LIBRARY - by cgowez - 09-02-2020, 10:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB