/**
  * Toggle whether renewal discounts should be enabled globally.
  *
  * @param bool $enable
  */
 protected function _toggle_global_renewal_discount($enable)
 {
     $options = it_exchange_get_option('addon_itelic', true, true);
     $options['enable-renewal-discounts'] = $enable;
     it_exchange_save_option('addon_itelic', $options);
     it_exchange_get_option('addon_itelic', true, true);
 }
 /**
  * Do custom initialization.
  */
 public function setUp()
 {
     parent::setUp();
     it_exchange_temporarily_load_addon('guest-checkout');
     it_exchange_temporarily_load_addon('digital-downloads-product-type');
     it_exchange_add_feature_support_to_product_type('recurring-payments', 'digital-downloads-product-type');
     $null = null;
     $this->exchange_admin = new IT_Exchange_Admin($null);
     it_exchange_save_option('settings_general', $this->exchange_admin->set_general_settings_defaults(array()));
     it_exchange_get_option('settings_general', true);
     $this->product_factory = new ITELIC_UnitTest_Factory_For_Products();
     $this->key_factory = new ITELIC_UnitTest_Factory_For_Keys($this->factory);
     $this->activation_factory = new ITELIC_UnitTest_Factory_For_Activations($this->factory);
     $this->release_factory = new ITELIC_UnitTest_Factory_For_Releases($this->factory);
     $this->update_factory = new ITELIC_UnitTest_Factory_For_Updates($this->factory);
     WP_Mock::setUp();
 }
 /**
  * Handle deactivation POST request.
  *
  * @since 1.0
  */
 protected function deactivate()
 {
     $options = it_exchange_get_option('addon_itelic');
     $response = Plugin::$updater->deactivate($options['license'], $options['activation']);
     if (is_wp_error($response)) {
         $this->error_message = $response->get_error_message();
         return;
     }
     $options = it_exchange_get_option('addon_itelic');
     $options['activation'] = '';
     it_exchange_save_option('addon_itelic', $options);
     $this->status_message = __("License deactivated.", Plugin::SLUG);
 }