Remove outdated edge gateway object classes, add new agent implementation
Transitioned from obsolete gateway object classes (`edge_gateway_shell_action_jobs_o`, `edge_gateway_shell_events_o`, `edge_gateway_shell_sessions_o`, `edge_gateway_update_jobs_o`) to the new agent implementation (`edge-gateway-agent/agent.php`).
This commit is contained in:
@@ -29,6 +29,8 @@ use interfaces\economic_i;
|
||||
|
||||
class economic implements economic_i
|
||||
{
|
||||
public const DRAFT_CUSTOMER_EXPORT_BLOCKED_MESSAGE = 'Transactions for the configured draft customer cannot be exported to e-conomic.';
|
||||
|
||||
/**
|
||||
* Configuration of the economic module
|
||||
* @var economic_c
|
||||
@@ -120,6 +122,37 @@ class economic implements economic_i
|
||||
return new $this->helpers->economic_tasks();
|
||||
}
|
||||
|
||||
public function getTransactionDraftCustomerNumber(): ?int
|
||||
{
|
||||
$value = $this->config->transaction_draft_customer_number->getVariableValue();
|
||||
if ($value === null || $value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$customer_number = (int)$value;
|
||||
return $customer_number > 0 ? $customer_number : null;
|
||||
}
|
||||
|
||||
public function isDraftCustomerNumber(?int $customer_number): bool
|
||||
{
|
||||
$configured_customer_number = $this->getTransactionDraftCustomerNumber();
|
||||
if ($configured_customer_number === null || $customer_number === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $configured_customer_number === (int)$customer_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function assertCustomerNumberIsNotDraft(?int $customer_number): void
|
||||
{
|
||||
if ($this->isDraftCustomerNumber($customer_number)) {
|
||||
throw new \Exception(self::DRAFT_CUSTOMER_EXPORT_BLOCKED_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a customer in e-conomic and return the raw upstream payload.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user