feat: add API Gateway, RapidMail and Shopify integrations, update WireGuard configs, add Redis override and architecture docs

This commit is contained in:
2025-11-04 23:08:17 +01:00
parent 5d6edea3bb
commit f9b8cf9f33
23 changed files with 3621 additions and 8 deletions

View File

@@ -0,0 +1,89 @@
<?php
declare(strict_types=1);
namespace App\Infrastructure\Api\Shopify;
use App\Framework\ApiGateway\ApiRequest;
use App\Framework\ApiGateway\ValueObjects\ApiEndpoint;
use App\Framework\Core\ValueObjects\Duration;
use App\Framework\Http\Headers;
use App\Framework\Http\Method as HttpMethod;
use App\Framework\Http\Url\Url;
use App\Framework\Retry\RetryStrategy;
use App\Infrastructure\Api\Shopify\ValueObjects\{ShopifyApiKey, ShopifyStore};
/**
* Domain-specific API request for creating orders in Shopify
*
* Example usage:
*
* $request = new CreateOrderApiRequest(
* apiKey: $apiKey,
* store: ShopifyStore::fromString('mystore'),
* orderData: [
* 'line_items' => [
* ['variant_id' => 123, 'quantity' => 2]
* ],
* 'customer' => ['email' => 'customer@example.com']
* ]
* );
*
* $response = $apiGateway->send($request);
*/
final readonly class CreateOrderApiRequest implements ApiRequest
{
public function __construct(
private ShopifyApiKey $apiKey,
private ShopifyStore $store,
private array $orderData,
private ?RetryStrategy $retryStrategy = null
) {
}
public function getEndpoint(): ApiEndpoint
{
$shopUrl = "https://{$this->store->value}.myshopify.com/admin/api/2024-01/orders.json";
return ApiEndpoint::fromUrl(
Url::parse($shopUrl)
);
}
public function getMethod(): HttpMethod
{
return HttpMethod::POST;
}
public function getPayload(): array
{
return [
'order' => $this->orderData,
];
}
public function getTimeout(): Duration
{
// Order creation should be quick
return Duration::fromSeconds(10);
}
public function getRetryStrategy(): ?RetryStrategy
{
return $this->retryStrategy;
}
public function getHeaders(): Headers
{
return new Headers([
'X-Shopify-Access-Token' => $this->apiKey->value,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
]);
}
public function getRequestName(): string
{
return 'shopify.create_order';
}
}