Flutterwave / PHP-v3

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

Undefined constant Flutterwave\Config\PackageConfig::BASE_URL #68

Open Corneille9 opened 7 months ago

Corneille9 commented 7 months ago

Description

When attempting to verify a transaction using the verifyWithTxref() method in the flutterwavedev/flutterwave-v3 package, an error occurs indicating "Undefined constant Flutterwave\Config\PackageConfig::BASE_URL". This issue arises during the initialization of the Transactions service.

Steps to Reproduce

  1. Initialize the Transactions service with the appropriate configuration using the following code:

    $transaction = new \Flutterwave\Service\Transactions(
        PackageConfig::setUp(
            ……,
            ……,
            ……,
        )
    );
  2. Attempt to verify the transaction using the verifyWithTxref($id) method.

Expected behaviour

The Transactions service should initialize successfully.

Actual behaviour

The error "Undefined constant Flutterwave\Config\PackageConfig::BASE_URL" occurs during the initialization of the Transactions service, specifically in the constructor at line 34: $this->baseUrl = $this->config::BASE_URL.

Configuration

Additional Information

The issue seems to stem from the constructor of the \Flutterwave\Service\Transactions class. The line $this->baseUrl = $this->config::BASE_URL attempts to access the constant BASE_URL from PackageConfig, resulting in an undefined constant error.