sdsad
All checks were successful
Deploy / deploy-staging (push) Successful in 25s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-08-14 00:40:45 +02:00
parent 2adff4c91d
commit 743c743c2c
3 changed files with 212 additions and 44 deletions

View File

@@ -265,6 +265,10 @@ final class Router
Http::json(['data' => $this->saveCostPlan($projectKey, Http::input())], 201);
}
if (preg_match('~^cost-plans/(\d+)$~', $resource, $matches) && $method === 'PATCH') {
Http::json(['data' => $this->updateCostPlan($projectKey, (int) $matches[1], Http::input())]);
}
if ($resource === 'payouts' && $method === 'GET') {
Http::json(['data' => $this->payouts($projectKey)]);
}
@@ -1912,6 +1916,24 @@ final class Router
]);
}
private function updateCostPlan(string $projectKey, int $planId, array $input): array
{
$plan = $this->repository()->getCostPlan($projectKey, $planId);
if (!is_array($plan)) {
throw new ApiException('Manuell eingetragener Miner nicht gefunden.', 404);
}
if (!array_key_exists('auto_renew', $input)) {
throw new ApiException('Es kann aktuell nur auto_renew geaendert werden.', 422, ['field' => 'auto_renew']);
}
return $this->repository()->updateCostPlanAutoRenew(
$projectKey,
$planId,
!empty($input['auto_renew'])
);
}
private function savePayout(string $projectKey, array $input): array
{
$transferMode = $this->enumValue($input['transfer_mode'] ?? 'manual', ['manual', 'full_latest'], 'transfer_mode');