diff --git a/RockMollie.module.php b/RockMollie.module.php index 5da924c..868c7ea 100644 --- a/RockMollie.module.php +++ b/RockMollie.module.php @@ -37,15 +37,7 @@ public function api(): MollieApiClient { require_once("vendor/autoload.php"); $api = new \Mollie\Api\MollieApiClient(); - - if (getenv('DDEV_HOSTNAME') || !$this->live) { - // use the test api key - $api->setApiKey($this->testapikey); - } else { - // we are live - if (!$this->liveapikey) throw new WireException("No Live API kay found for RockMollie"); - $api->setApiKey($this->liveapikey); - } + $api->setApiKey($this->wire->config->mollieApiKey); return $api; } @@ -70,39 +62,10 @@ public function getModuleConfigInputfields($inputfields) ]); $inputfields->add([ - 'type' => 'toggle', - 'label' => 'API Mode', - 'name' => 'live', - 'value' => $this->live ?: false, - 'notes' => 'Selected item is gray', - 'labelType' => InputfieldToggle::labelTypeCustom, - 'yesLabel' => 'LIVE', - 'noLabel' => 'TEST', - 'columnWidth' => 33, - ]); - - $inputfields->add([ - 'type' => 'text', - 'label' => 'TEST API Key', - 'name' => 'testapikey', - 'value' => $this->testapikey, - 'prependMarkup' => '', - 'columnWidth' => 33, - ]); - - $inputfields->add([ - 'type' => 'text', - 'label' => 'LIVE API Key', - 'name' => 'liveapikey', - 'value' => $this->liveapikey, - 'prependMarkup' => '', - 'columnWidth' => 33, + 'type' => 'markup', + 'label' => 'Setup', + 'icon' => 'code', + 'value' => 'Set $config->mollieApiKey = ... in your site config.php', ]); return $inputfields;