Bill transfer storage monthly with a 15-day grace period before deletion.
Deploy Ladill Transfer / deploy (push) Successful in 51s

Files stay available while wallet renewals succeed each month. Failed renewals
keep files for TRANSFER_GRACE_PERIOD_DAYS (default 15) before automatic cleanup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 12:28:33 +00:00
co-authored by Cursor
parent 65b634bb0b
commit 311b5b40bb
23 changed files with 502 additions and 56 deletions
+6 -5
View File
@@ -39,10 +39,9 @@ class TransferService
}
$maxBytes = (int) config('transfer.max_file_bytes', 0);
$retentionDays = (int) ($data['retention_days'] ?? config('transfer.default_retention_days', 30));
$retentionDays = max(1, min(365, $retentionDays));
$billingPeriodDays = (int) config('transfer.billing_period_days', 30);
return DB::transaction(function () use ($user, $data, $files, $maxBytes, $retentionDays) {
return DB::transaction(function () use ($user, $data, $files, $maxBytes, $billingPeriodDays) {
$passwordHash = null;
if (! empty($data['password'])) {
$passwordHash = Hash::make((string) $data['password']);
@@ -53,8 +52,7 @@ class TransferService
'title' => trim((string) $data['title']),
'message' => isset($data['message']) ? trim((string) $data['message']) : null,
'password_hash' => $passwordHash,
'retention_days' => $retentionDays,
'expires_at' => now()->addDays($retentionDays),
'retention_days' => $billingPeriodDays,
'status' => Transfer::STATUS_ACTIVE,
]);
@@ -82,6 +80,9 @@ class TransferService
'storage_bytes' => $totalBytes,
]);
$transfer = $transfer->fresh(['files', 'qrCode']);
app(TransferBillingService::class)->chargeInitialPeriod($transfer, $user);
return $transfer->fresh(['files', 'qrCode']);
});
}