Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to override Logger with settings #25

Open
karenmt opened this issue Jan 25, 2023 · 0 comments
Open

Unable to override Logger with settings #25

karenmt opened this issue Jan 25, 2023 · 0 comments

Comments

@karenmt
Copy link

karenmt commented Jan 25, 2023

Kount version installed: 7.5.0
PHP 8.1
Laravel 9.47.0

I am unable to override the Logger settings from what is default in src/settings.ini. I have installed Kount via Composer, with Kount living in vendor/kount/kount-ris-php-sdk. When the Request object is created, it creates the logger using the default settings.ini, then loads the settings provided. At no point does it reload the logger, and there are no functions to do so:

/vendor/kount/kount-ris-php-sdk/src/Kount/Ris/Request.php:

  public function __construct($settings = null)
  {
    // Logger is created from the default settings
    $loggerFactory = Kount_Log_Factory_LogFactory::getLoggerFactory();
    $this->logger = $loggerFactory->getLogger(__CLASS__);

   // Settings are loaded from the settings.ini provided or from the ArraySettings passed in
    if ($settings instanceof Kount_Ris_ArraySettings) {
      $this->settings = $settings;
      Kount_Util_Khash::createKhash($this->settings);
    } else {
      $configReader = Kount_Util_ConfigFileReader::instance($settings);
      $this->settings = new Kount_Ris_ArraySettings($configReader->getSettings());
      Kount_Util_Khash::createKhash($this->settings);
    }

    Kount_Util_Khash::setConfigKey($this->settings->getConfigKey());
    $this->setMerchantId($this->settings->getMerchantId());
    $this->setVersion($this->settings->getVERS());
    $this->setUrl($this->settings->getRisUrl());
    if ($this->settings->getApiKey()) {
      $this->setApiKey($this->settings->getApiKey());
    } else {
      $this->setCertificate(
        $this->settings->getX509CertPath(),
        $this->settings->getX509KeyPath(),
        $this->settings->getX509Passphrase()
      );
    }
    $this->setConnectionTimeout($this->settings->getConnectionTimeout());

    // KHASH payment encoding is enabled by default.
    $this->setKhashPaymentEncoding(true);
  }

Since modifying vendor files is not at all recommended, I cannot actually enable logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant