You are here

function commerce_paypal_post_update_1 in Commerce PayPal 8

Import the PayPal Checkout flow config.

File

./commerce_paypal.post_update.php, line 14
Post update functions for Commerce PayPal.

Code

function commerce_paypal_post_update_1() {

  /** @var \Drupal\commerce\Config\ConfigUpdaterInterface $config_updater */
  $config_updater = \Drupal::service('commerce.config_updater');
  $message = '';
  $config_names = [
    'commerce_checkout.commerce_checkout_flow.paypal_checkout',
  ];
  $result = $config_updater
    ->import($config_names);
  $success_results = $result
    ->getSucceeded();
  $failure_results = $result
    ->getFailed();
  if ($success_results) {
    $message = t('Succeeded:') . '<br>';
    foreach ($success_results as $success_message) {
      $message .= $success_message . '<br>';
    }
    $message .= '<br>';
  }
  if ($failure_results) {
    $message .= t('Failed:') . '<br>';
    foreach ($failure_results as $failure_message) {
      $message .= $failure_message . '<br>';
    }
  }
  return $message;
}