PHP icon indicating copy to clipboard operation
PHP copied to clipboard

Undefined constant Flutterwave\Config\PackageConfig::BASE_URL

Open Corneille9 opened this issue 1 year ago • 0 comments

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

  • API Version: v3
  • Environment: live
  • Language: PHP 8.1 | Laravel 10.10

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.

Corneille9 avatar Feb 21 '24 15:02 Corneille9