Add PayPal, Stripe, CSV-Export; fix .env.production issue
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
- PayPal: Checkout-Integration via srmklive/paypal, Weiterleitung zu PayPal, Bestellung wird nach Capture automatisch auf payment_received gesetzt - Stripe: Payment Elements im Checkout, Intent-API, Zahlung direkt bestätigt - CSV-Export: Admin → Bestellungen → CSV exportieren (UTF-8 BOM für Excel) - PayPal/Stripe nur sichtbar wenn Keys in .env gesetzt - .env.example um PAYPAL_* und STRIPE_* Keys erweitert Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,4 +76,39 @@ class OrderController extends Controller
|
||||
{
|
||||
return $this->invoiceService->generate($order)->download($this->invoiceService->filename($order));
|
||||
}
|
||||
|
||||
public function exportCsv()
|
||||
{
|
||||
$orders = Order::with(['items','billingAddress'])->orderByDesc('created_at')->get();
|
||||
|
||||
$rows = [];
|
||||
$rows[] = ['Bestellnr.','Datum','Status','Zahlungsart','Kunde','E-Mail','Zwischensumme','Rabatt','Versand','Gesamt','MwSt.'];
|
||||
|
||||
foreach ($orders as $order) {
|
||||
$addr = $order->billingAddress();
|
||||
$rows[] = [
|
||||
$order->order_number,
|
||||
$order->created_at->format('d.m.Y H:i'),
|
||||
Order::$statusLabels[$order->status] ?? $order->status,
|
||||
Order::$paymentLabels[$order->payment_method] ?? $order->payment_method,
|
||||
$addr ? $addr->full_name : ($order->guest_email ?? ''),
|
||||
$order->guest_email ?? $order->user?->email ?? '',
|
||||
number_format($order->subtotal, 2, ',', '.'),
|
||||
number_format($order->discount_amount ?? 0, 2, ',', '.'),
|
||||
number_format($order->shipping_cost, 2, ',', '.'),
|
||||
number_format($order->total, 2, ',', '.'),
|
||||
number_format($order->tax_total, 2, ',', '.'),
|
||||
];
|
||||
}
|
||||
|
||||
$csv = "\xEF\xBB\xBF"; // UTF-8 BOM für Excel
|
||||
foreach ($rows as $row) {
|
||||
$csv .= implode(';', array_map(fn($v) => '"' . str_replace('"', '""', $v) . '"', $row)) . "\n";
|
||||
}
|
||||
|
||||
return response($csv, 200, [
|
||||
'Content-Type' => 'text/csv; charset=UTF-8',
|
||||
'Content-Disposition' => 'attachment; filename="bestellungen-' . date('Y-m-d') . '.csv"',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user