Cache integration API reads and refresh them on a schedule
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Hickmeister
2026-10-11 19:01:32 +01:00
co-authored by Claude Sonnet 5.5
parent 8bee8d42c7
commit 2fe4fbd91e
10 changed files with 253 additions and 24 deletions
+4 -4
View File
@@ -92,7 +92,7 @@ class ShippingController extends Controller
'height' => ['required', 'numeric', 'gt:0', 'lte:200'],
]);
try {
$receipt = collect($this->pendingOrders($etsy))->first(fn (array $order): bool => (string) ($order['receipt_id'] ?? '') === (string) $details['receipt_id']);
$receipt = collect($this->pendingOrders($etsy, true))->first(fn (array $order): bool => (string) ($order['receipt_id'] ?? '') === (string) $details['receipt_id']);
if (! $receipt) {
return redirect()->route('shipping')->withErrors(['quote' => 'This Etsy order is no longer pending. Refresh the order list.']);
}
@@ -184,7 +184,7 @@ class ShippingController extends Controller
}
try {
$receipt = collect($this->pendingOrders($etsy))->first(fn (array $order): bool => (string) ($order['receipt_id'] ?? '') === (string) $request->session()->get('shipping_receipt_id'));
$receipt = collect($this->pendingOrders($etsy, true))->first(fn (array $order): bool => (string) ($order['receipt_id'] ?? '') === (string) $request->session()->get('shipping_receipt_id'));
if (! $receipt || ($receipt['zip'] ?? null) !== $details['delivery_postcode']) {
return redirect()->route('shipping')->withErrors(['collection' => 'The Etsy order or delivery postcode changed. Request a fresh quote.']);
}
@@ -236,10 +236,10 @@ class ShippingController extends Controller
}
/** @return array<int, array<string, mixed>> */
private function pendingOrders(Etsy $etsy): array
private function pendingOrders(Etsy $etsy, bool $fresh = false): array
{
$connection = EtsyConnection::first();
return $connection && $etsy->configured() ? ($etsy->receipts($connection)['results'] ?? []) : [];
return $connection && $etsy->configured() ? ($etsy->receipts($connection, $fresh)['results'] ?? []) : [];
}
}