You are here

protected function MolliePaymentInstaller::getOnboardingStatus in Mollie Payment 7.2

1 call to MolliePaymentInstaller::getOnboardingStatus()
MolliePaymentInstaller::checkMollieAccount in includes/mollie_payment.installer.inc
Checks if a Mollie account has been configured.

File

includes/mollie_payment.installer.inc, line 314

Class

MolliePaymentInstaller
Class MolliePaymentInstaller.

Namespace

Drupal\mollie_payment

Code

protected function getOnboardingStatus() {
  $status = 'unknown';
  $organizationToken = variable_get('mollie_payment_default_access_token', '');
  if (!empty($organizationToken)) {
    $options = array(
      'headers' => array(
        'Authorization' => 'Bearer ' . $organizationToken,
      ),
    );
    $response = drupal_http_request('https://api.mollie.com/v2/onboarding/me', $options);
    if ($response->code == 200) {
      $data = json_decode($response->data);
      return isset($data->status) ? $data->status : $status;
    }
  }
  return $status;
}