Flutterwave / PHP-v3

PHP Library for Flutterwave v3 APIs
MIT License
19 stars 18 forks source link

Validating transaction is throwing Application error via PHP SDK #64

Open dersure opened 1 year ago

dersure commented 1 year ago

Hello I am trying to make a Direct Card Charge via the PHP SDK but getting Error: Undefined constant Flutterwave\Helper\Config::BASE_URL in /Users/andre/Desktop/Workspace/saas-manager/vendor/flutterwavedev/flutterwave-v3/src/Service/Transactions.php:34

When I passed a custom config with the base url to constant to Flutterwave\Service\Transactions class, it then throws an ArgumentCountError: Too few arguments to function Flutterwave\EventHandlers\TransactionVerificationEventHandler::__construct(), 0 passed in /Users/andre/Desktop/Workspace/saas-manager/vendor/flutterwavedev/flutterwave-v3/src/Service/Transactions.php on line 36 and exactly 1 expected in /Users/andre/Desktop/Workspace/saas-manager/vendor/flutterwavedev/flutterwave-v3/src/EventHandlers/TransactionVerificationEventHandler.php:17

MY PHP CODE BELOW:

    public function validate(string $ref, string|int $otp): string
    {
        $res = (new Transactions())->validate($otp, $ref);

        if ($res->status === 'success') {
            return "Your payment status: " . $res->processor_response;
        }
    }