• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Openpay LIBRARY

#7
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.