1

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:

enter image description here

Thanks in advance...

1 Answer 1

0

Why not install it directly in vendor directory with composer ?

composer require dwolla/dwollaswagger

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.