/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration * @param Repository $config * @return Gateway */ public function handle(ConfigurationRepositoryInterface $configuration, Repository $config) { $testMode = $config->get('anomaly.module.payments::config.test_mode'); if ($testMode) { $key = $configuration->presenter('anomaly.extension.stripe_gateway::test_api_key', $this->account->getSlug())->__value(); } else { $key = $configuration->presenter('anomaly.extension.stripe_gateway::live_api_key', $this->account->getSlug())->__value(); } $gateway = new Gateway(); $gateway->setApiKey($key); $gateway->setTestMode($testMode); return $gateway; }
/** * 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; }