I am trying to integrate dwolla payment gateway in my current project, I have added DwollaSwagger (PHP) library in "lib/internal" folder and trying to access DwollaSwagger.php functions from "block class" getting errors like this.
main.CRITICAL: Error: Class 'Demo\Dwolla\Block\Demo\DwollaSwagger' not found in app/code/Demo/Dwolla/Block/Demo/Customer.php:30
Block class (Customer.php):
<?php
declare(strict_types=1);
namespace Demo\Dwolla\Block\Demo;
require(BP.'/lib/internal/dwolla/dwollaswagger/DwollaSwagger.php');
class Customer extends \Magento\Framework\View\Element\Template
{
protected $request;
protected $dir;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\App\Request\Http $request,
\Magento\Framework\Filesystem\DirectoryList $dir,
array $data = []
) {
$this->request = $request;
$this->dir = $dir;
parent::__construct($context, $data);
}
public function getTokenID(){
$DwollaSwagger = new DwollaSwagger();
DwollaSwagger\Configuration::$username = 'xxxxxxxxxxxxxxxxxxx';
DwollaSwagger\Configuration::$password = 'xxxxxxxxxxxxxxxxxxx';
// For Sandbox
$apiClient = new DwollaSwagger\ApiClient("https://api-sandbox.dwolla.com");
$tokensApi = new DwollaSwagger\TokensApi($apiClient);
$appToken = $tokensApi->token();
return $appToken;
}
}
?>
DwollaSwagger.php class inside 'Lib' folder:
Thanks in advance...