- Issue created by @Anybody
These should be global constants instead, in a separate class:
/**
* Returns the remote service URL of the SaaS with an optional specific
* service stub.
*
* @param string $service
* The additional uri part of the specific service endpoint stub.
* @param string $system
* The additional uri part of the specific service endpoint stub.
*
* @return string
* The generated remote service url.
*/
public function serviceUrl(string $service = '', string $system = 'main'): string {
$url = $this->utils->config('service_url', 'sandbox');
switch ($url) {
case 'production':
$urls = [
// @todo: These should be global constants:
'main' => 'https://app.billwerk.com/',
'selfservice' => 'https://selfservice.billwerk.com/',
];
break;
case 'sandbox':
$urls = [
// @todo: These should be global constants:
'main' => 'https://sandbox.billwerk.com/',
'selfservice' => 'https://selfservice.sandbox.billwerk.com/',
];
break;
default:
throw new \Exception('Unknown service_url "' . $url . '". Allowed values are "production" or "sandbox". Please check your subman.settings!');
}
if (!isset($urls[$system])) {
throw new \Exception('Service URL could not be determined from URL: "' . $url . '", Service: "' . $service . '"' . ', System: "' . $system . '"');
}
return $urls[$system] . $service;
}
BillwerkApi.php
Also we should watch out for other variables (or setting candidates: ✨ Add a settings page for general (non-security relevant) settings Closed: won't fix ) in code of Subman and Billwerk
Active
1.0
Code