heureka/overenozakazniky
PHP client for Heureka “Ověřeno zákazníky” (ShopCertification). Set customer email, numeric order ID, and ordered product ITEM_IDs, then log orders via the API. Supports CZ and SK services; includes examples and docs.
OrderPlaced events). It can be triggered post-checkout via Laravel’s queues/jobs (e.g., LogOrderToHeurekaJob) for async processing.HEUREKA_CZ/HEUREKA_SK constants enables regional segmentation without code duplication.RequesterException) integrate with Laravel’s exception handling (e.g., App\Exceptions\Handler).email, orderId, and optional productItemIds (mapped from Laravel’s orders/order_items tables).ITEM_ID alignment with Heureka’s feed (may require migration if IDs differ).| Risk Area | Mitigation Strategy |
|---|---|
| API Key Exposure | Store keys in Laravel’s .env (never in code). Use config('services.heureka'). |
| Rate Limiting | Implement retry logic (e.g., Laravel’s Retryable trait) for transient failures. |
| Data Validation | Validate email/orderId formats via Laravel’s Form Requests or Model Validation. |
| Regional Misconfig | Enforce TLD (cz/sk) via config validation or middleware. |
| Deprecation Risk | Monitor Heureka’s API changes; wrap client in a service contract for easy swaps. |
productItemIds sourced? Are they stored in Laravel’s DB, or generated dynamically?ITEM_ID ↔ Laravel product_id?Heureka\ShopCertification) in AppServiceProvider.Heureka facade for cleaner syntax (e.g., Heureka::logOrder($order)).config/services.php:
'heureka' => [
'api_key' => env('HEUREKA_API_KEY'),
'tld' => env('HEUREKA_TLD', 'cz'), // 'cz' or 'sk'
],
email, orderId, and productItemIds:
public function getHeurekaData(): array
{
return [
'email' => $this->email,
'orderId' => $this->id,
'productItemIds' => $this->items->pluck('heureka_item_id')->toArray(),
];
}
heureka_item_id field if not already present.composer require heureka/overeno-zakazniky..env and config/services.php.class HeurekaService
{
public function __construct(private ShopCertification $client) {}
public function logOrder(Order $order): void
{
$this->client->setEmail($order->email);
$this->client->setOrderId($order->id);
$order->items->each(fn($item) => $this->client->addProductItemId($item->heureka_item_id));
$this->client->logOrder();
}
}
class LogOrderToHeurekaJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
public function handle(HeurekaService $service, Order $order)
{
$service->logOrder($order);
}
}
OrderPlaced event listener:
LogOrderToHeurekaJob::dispatch($order)->onQueue('heureka');
ITEM_ID alignment with Heureka’s XML feed (may need data migration if IDs differ).heureka_item_id.config('services.heureka.enabled')).heureka/overeno-zakazniky for breaking changes (e.g., PHP 8+ support).composer.json if stability is critical..env updates.try {
$this->client->logOrder();
} catch (RequesterException $e) {
\Log::error('Heureka API Error', ['response' => $e->getResponse()]);
throw new \RuntimeException('Failed to log order to Heureka.');
}
podpora@heureka.cz) for API-specific issues.Laravel\Queue\Retryable).order_items table has an index on heureka_item_id for fastHow can I help you explore Laravel packages today?