eBay adapter covers OAuth, inventory API, fulfillment API, taxonomy service and webhook signature verification. Frappe ERP adapter wraps the Frappe HTTP client for order/invoice sync. Includes CustomerResolver, InvoiceMailer, and the EbayWebhookController for inbound eBay marketplace notifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Infrastructure\Mail;
|
|
|
|
use App\Application\Order\InvoiceMailerInterface;
|
|
use App\Domain\Order\Invoice;
|
|
use Symfony\Component\Mailer\MailerInterface;
|
|
use Symfony\Component\Mime\Email;
|
|
|
|
final class SymfonyInvoiceMailer implements InvoiceMailerInterface
|
|
{
|
|
public function __construct(
|
|
private readonly MailerInterface $mailer,
|
|
private readonly string $supplierEmail,
|
|
private readonly string $senderEmail,
|
|
) {
|
|
}
|
|
|
|
public function sendInvoice(Invoice $invoice): void
|
|
{
|
|
$order = $invoice->getOrder();
|
|
$article = $order->getArticle();
|
|
$customer = $order->getCustomer();
|
|
|
|
$body = \sprintf(
|
|
"Neue Bestellung eingegangen — bitte sofort versenden.\n\n"
|
|
."Bestellnummer : %s\n"
|
|
."Artikel : %s\n"
|
|
."Inventarnummer: %s\n"
|
|
."Käufer : %s\n"
|
|
."Verkaufspreis : €%s\n\n"
|
|
.'Die Rechnung liegt diesem E-Mail als PDF bei.',
|
|
$order->getPlatformOrderId(),
|
|
$article->getEbayTitle() ?? $article->getSku(),
|
|
$article->getInventoryNumber(),
|
|
$customer->getName(),
|
|
$order->getSalePrice(),
|
|
);
|
|
|
|
$email = (new Email())
|
|
->from($this->senderEmail)
|
|
->to($this->supplierEmail)
|
|
->subject('Neue Bestellung: '.$order->getPlatformOrderId())
|
|
->text($body)
|
|
->attachFromPath(
|
|
$invoice->getFullPath(),
|
|
'Rechnung-'.$invoice->getFrappeInvoiceId().'.pdf',
|
|
'application/pdf',
|
|
);
|
|
|
|
$this->mailer->send($email);
|
|
}
|
|
}
|