Add fuel API ingestion and historic storage design spec

Includes verified API authentication flow, correct base URL, all DB
table schemas for stations, current prices, history, and archive.
Fuel types corrected to match live API (B7_STANDARD, B7_PREMIUM).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-03 18:09:50 +01:00
parent 02d4c9d888
commit 5ad89e977d
11 changed files with 595 additions and 102 deletions

54
.claude/rules/payments.md Normal file
View File

@@ -0,0 +1,54 @@
# Payments & Subscriptions
## Stack
Laravel Cashier (Stripe). Never implement custom billing logic — use Cashier methods.
## Stripe products
Three recurring subscription products (monthly):
- `basic` — £0.99/mo
- `plus` — £2.49/mo
- `pro` — £3.99/mo
Price IDs stored in `config/services.php` under `stripe.prices.*`, loaded from .env:
```
STRIPE_PRICES_BASIC=price_xxx
STRIPE_PRICES_PLUS=price_xxx
STRIPE_PRICES_PRO=price_xxx
```
## Tier helpers (SubscriptionService)
```php
public function tier(User $user): string
// Returns 'free' | 'basic' | 'plus' | 'pro'
public function canReceiveSms(User $user): bool
// true if tier is plus or pro
public function smsRemainingThisMonth(User $user): int
// checks alerts table count for current month
```
Never check tier inline in components or notification classes — always use SubscriptionService.
## Cashier conventions
- Billable model: `User` (add `use Billable` trait)
- Webhook route: `POST /stripe/webhook` — handled by Cashier automatically
- Webhook secret in `.env` as `STRIPE_WEBHOOK_SECRET`
- Always handle `customer.subscription.deleted` to downgrade user to free tier
- Trial: none for v1
## Upgrade / downgrade flow
- User upgrades in account settings Livewire component
- Swap plan with `$user->subscription()->swap($newPriceId)`
- Cashier handles proration automatically
- On downgrade to free: cancel subscription, remove WhatsApp/SMS notification preference
## Stripe test mode
Use Stripe test keys in local `.env`. Never commit real Stripe keys.
Test cards: 4242424242424242 (success), 4000000000000002 (decline).