You are here

function commerce_sermepa_update_7101 in Commerce sermepa 7

Rename Ds_Merchant_Titular to Ds_MerchantName.

File

./commerce_sermepa.install, line 57
Install, update and uninstall functions for the Commerce Sermepa module.

Code

function commerce_sermepa_update_7101() {

  // Update Ds_MerchantName value and save it.
  $rule_config = rules_config_load('commerce_payment_commerce_sermepa');
  foreach ($rule_config
    ->actions() as $action) {
    if ($action->settings['payment_method']['method_id'] == 'commerce_sermepa') {
      $action->settings['payment_method']['settings']['Ds_MerchantName'] = $action->settings['payment_method']['settings']['Ds_Merchant_Titular'];
      unset($action->settings['payment_method']['settings']['Ds_Merchant_Titular']);
    }
  }
  $rule_config
    ->save();

  // Reset payment methods values.
  commerce_payment_methods_reset();

  // Clear rules config cache.
  entity_get_controller('rules_config')
    ->resetCache();
}