/** * Handle the widget data. */ public function handle(ConfigurationRepositoryInterface $configuration) { $template = $configuration->get('anomaly.extension.xml_feed_widget::template', $this->widget->getId()); /* @var EditorFieldTypePresenter $presenter */ $presenter = $template->getFieldTypePresenter('value'); $this->widget->setContent($presenter->parsed(['widget' => $this->widget])); }
/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration */ public function handle(ConfigurationRepositoryInterface $configuration) { /* @var ConfigurationInterface $html */ $html = $configuration->get('anomaly.extension.html_widget::html', $this->widget->getId()); /* @var EditorFieldTypePresenter $presenter */ if ($presenter = $html->getFieldTypePresenter('value')) { $this->widget->addData('html', $presenter->parsed()); } }
/** * Return the form fields. * * @param ConfigurationFormBuilder $builder */ public function handle(ConfigurationFormBuilder $builder, ConfigurationRepositoryInterface $configuration) { $scope = $builder->getScope(); $namespace = $builder->getFormEntry() . '::'; /** * Get the fields from the config system. Sections are * optionally defined the same way. */ if (!($fields = $this->config->get($namespace . 'configuration/configuration'))) { $fields = $fields = $this->config->get($namespace . 'configuration', []); } if ($sections = $this->config->get($namespace . 'configuration/sections')) { $builder->setSections($sections); } /** * Finish each field. */ foreach ($fields as $slug => &$field) { /** * Force an array. This is done later * too in normalization but we need it now * because we are normalizing / guessing our * own parameters somewhat. */ if (is_string($field)) { $field = ['type' => $field]; } // Make sure we have a config property. $field['config'] = array_get($field, 'config', []); // Default the label. if (trans()->has($label = array_get($field, 'label', $namespace . 'configuration.' . $slug . '.label'))) { $field['label'] = trans($label); } // Default the label. $field['label'] = trans(array_get($field, 'label', $namespace . 'configuration.' . $slug . '.name')); // Default the warning. if (trans()->has($warning = array_get($field, 'warning', $namespace . 'configuration.' . $slug . '.warning'))) { $field['warning'] = trans($warning); } // Default the placeholder. $field['config']['placeholder'] = trans(array_get($field, 'placeholder', $namespace . 'configuration.' . $slug . '.placeholder')); // Default the instructions. if (trans()->has($instructions = array_get($field, 'instructions', $namespace . 'configuration.' . $slug . '.instructions'))) { $field['instructions'] = trans($instructions); } // Get the value defaulting to the default value. if ($applied = $configuration->get($namespace . $slug, $scope)) { $field['value'] = $applied->getValue(); } else { $field['value'] = array_get($field['config'], 'default_value'); } } $builder->setFields($fields); }
/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration */ public function handle(ConfigurationRepositoryInterface $configuration) { $mode = $configuration->get('anomaly.extension.stripe_gateway::test_mode', $this->gateway->getSlug()); /* @var EncryptedFieldTypePresenter $key */ if ($mode->getValue()) { $key = $configuration->presenter('anomaly.extension.stripe_gateway::test_api_key', $this->gateway->getSlug()); } else { $key = $configuration->presenter('anomaly.extension.stripe_gateway::live_api_key', $this->gateway->getSlug()); } $gateway = new Gateway(); $gateway->setApiKey($key->decrypted()); $gateway->setTestMode($mode->getValue()); return $gateway; }
/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration * @return SIMGateway */ public function handle(ConfigurationRepositoryInterface $configuration) { /* @var EncryptedFieldTypePresenter $id */ /* @var EncryptedFieldTypePresenter $key */ /* @var EncryptedFieldTypePresenter $secret */ /* @var SettingInterface $mode */ $id = $configuration->presenter('anomaly.extension.authorizenet_aim_gateway::api_login_id', $this->gateway->getSlug()); $key = $configuration->presenter('anomaly.extension.authorizenet_aim_gateway::transaction_key', $this->gateway->getSlug()); $mode = $configuration->get('anomaly.extension.authorizenet_aim_gateway::test_mode', $this->gateway->getSlug()); $gateway = new AIMGateway(); $gateway->setTransactionKey($key->decrypted()); $gateway->setDeveloperMode($mode->getValue()); $gateway->setApiLoginId($id->decrypted()); $gateway->setTestMode($mode->getValue()); return $gateway; }
/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration */ public function handle(ConfigurationRepositoryInterface $configuration) { /* @var EncryptedFieldTypePresenter $username */ /* @var EncryptedFieldTypePresenter $password */ /* @var EncryptedFieldTypePresenter $signature */ /* @var ConfigurationInterface $mode */ $username = $configuration->presenter('anomaly.extension.paypal_express_gateway::username', $this->gateway->getSlug()); $password = $configuration->presenter('anomaly.extension.paypal_express_gateway::password', $this->gateway->getSlug()); $signature = $configuration->presenter('anomaly.extension.paypal_express_gateway::signature', $this->gateway->getSlug()); $mode = $configuration->get('anomaly.extension.paypal_express_gateway::test_mode', $this->gateway->getSlug()); $gateway = new ExpressGateway(); $gateway->setUsername($username->decrypted()); $gateway->setPassword($password->decrypted()); $gateway->setSignature($signature->decrypted()); $gateway->setTestMode($mode->getValue()); return $gateway; }