Differentiate Billing from Wallet with storage usage breakdown.
Deploy Ladill Transfer / deploy (push) Successful in 27s
Deploy Ladill Transfer / deploy (push) Successful in 27s
Billing lists per-transfer storage costs and monthly estimates; Wallet stays focused on balance and top-up. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Qr;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\QrSetting;
|
||||
use App\Models\Transfer;
|
||||
use App\Services\Billing\BillingClient;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -49,10 +50,30 @@ class AccountController extends Controller
|
||||
$user = ladill_account();
|
||||
[$balanceMinor, $ledger] = $this->billingSnapshot($user?->public_id);
|
||||
|
||||
$activeTransfers = Transfer::query()
|
||||
->where('user_id', $user->id)
|
||||
->where('status', Transfer::STATUS_ACTIVE)
|
||||
->where(function ($query) {
|
||||
$query->whereNull('expires_at')->orWhere('expires_at', '>', now());
|
||||
})
|
||||
->orderByDesc('storage_bytes')
|
||||
->get();
|
||||
|
||||
$storageBytes = (int) $activeTransfers->sum('storage_bytes');
|
||||
$storageGb = round($storageBytes / (1024 * 1024 * 1024), 2);
|
||||
$pricePerGb = (float) config('transfer.price_per_gb_month', 1.0);
|
||||
$monthlyTotalGhs = round($activeTransfers->sum(fn (Transfer $transfer) => $transfer->monthlyCostGhs()), 2);
|
||||
|
||||
return view('qr.account.billing', [
|
||||
'balanceMinor' => $balanceMinor,
|
||||
'spentMinor' => (int) ($ledger['spent_minor'] ?? 0),
|
||||
'creditedMinor' => (int) ($ledger['credited_minor'] ?? 0),
|
||||
'activeTransfers' => $activeTransfers,
|
||||
'storageBytes' => $storageBytes,
|
||||
'storageGb' => $storageGb,
|
||||
'pricePerGb' => $pricePerGb,
|
||||
'monthlyTotalGhs' => $monthlyTotalGhs,
|
||||
'walletUrl' => route('account.wallet'),
|
||||
'topupUrl' => $this->topupUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ class AfiaService
|
||||
- After creating a transfer: users get a share link and downloadable QR code; recipients scan ladill.com/q/{code} or open the link.
|
||||
- Files: browse all stored files across transfers with sizes and download counts.
|
||||
- Analytics: download trends, top transfers, recent download activity.
|
||||
- Wallet & Billing: prepaid storage is billed from the Ladill wallet (sidebar → Wallet). Top up at account.ladill.com/wallet.
|
||||
- Wallet: Ladill wallet balance and top-up (sidebar → Wallet). Top up at account.ladill.com/wallet.
|
||||
- Billing: storage usage, per-transfer monthly costs, and spend history (sidebar → Billing).
|
||||
- Team: invite teammates to manage transfers together (sidebar → Team).
|
||||
- Settings: notification preferences for transfer activity.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user