Loading src/Form/SettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,17 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t("Enter the specific identification for the issued invoices."), '#required' => FALSE, ]; $form['environment'] = [ '#type' => 'radios', '#title' => $this->t('Environment'), '#options' => [ 'sandbox' => $this->t('Sandbox'), 'live' => $this->t('Live'), ], '#default_value' => $config->get('environment') ?? 'live', ]; return parent::buildForm($form, $form_state); } Loading @@ -98,6 +109,7 @@ class SettingsForm extends ConfigFormBase { ->set('constant', $form_state->getValue('constant')) ->set('specific', $form_state->getValue('specific')) ->set('maturity', $form_state->getValue('maturity')) ->set('environment', $form_state->getValue('environment')) ->save(); parent::submitForm($form, $form_state); } Loading src/InvoiceService.php +4 −0 Original line number Diff line number Diff line Loading @@ -216,6 +216,10 @@ class InvoiceService { $api = new \SFAPIclient($values['email'], $values['api_key'], '', 'API', $company_id); if ($api) { $this->logger->info('Succesfully created Superfaktura API object.'); if ($config->get('environment') === 'sandbox') { $api->useSandBox(); } } else { $this->logger->alert('Could not create the Superfaktura object'); Loading Loading
src/Form/SettingsForm.php +12 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,17 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t("Enter the specific identification for the issued invoices."), '#required' => FALSE, ]; $form['environment'] = [ '#type' => 'radios', '#title' => $this->t('Environment'), '#options' => [ 'sandbox' => $this->t('Sandbox'), 'live' => $this->t('Live'), ], '#default_value' => $config->get('environment') ?? 'live', ]; return parent::buildForm($form, $form_state); } Loading @@ -98,6 +109,7 @@ class SettingsForm extends ConfigFormBase { ->set('constant', $form_state->getValue('constant')) ->set('specific', $form_state->getValue('specific')) ->set('maturity', $form_state->getValue('maturity')) ->set('environment', $form_state->getValue('environment')) ->save(); parent::submitForm($form, $form_state); } Loading
src/InvoiceService.php +4 −0 Original line number Diff line number Diff line Loading @@ -216,6 +216,10 @@ class InvoiceService { $api = new \SFAPIclient($values['email'], $values['api_key'], '', 'API', $company_id); if ($api) { $this->logger->info('Succesfully created Superfaktura API object.'); if ($config->get('environment') === 'sandbox') { $api->useSandBox(); } } else { $this->logger->alert('Could not create the Superfaktura object'); Loading