You are here

protected function MollieProfile::setMollieClient in Mollie Payment 8.2

Set the Mollie API Client.

1 call to MollieProfile::setMollieClient()
MollieProfile::getMollieClient in src/Entity/MollieProfile.php
Get the Mollie API Client.

File

src/Entity/MollieProfile.php, line 180

Class

MollieProfile
Defines a Mollie profile entity.

Namespace

Drupal\mollie_payment\Entity

Code

protected function setMollieClient() {
  $mollieClient = new \Mollie_API_Client();
  try {
    $mollieClient
      ->setApiKey($this
      ->getApiKey());

    // Register major version of Drupal.
    $mollieClient
      ->addVersionString('Drupal/8.x');

    // Register minor version of Drupal.
    $mollieClient
      ->addVersionString('Drupal/' . VERSION);
    $this->mollieClient = $mollieClient;
  } catch (Mollie_API_Exception $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
  return $this;
}