10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -10,6 +10,7 @@ use App\Models\UserCreditItem;
|
|||
use App\Models\UserLevel;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
use App\Services\Incentive\IncentiveTracker;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
|
|
@ -277,17 +278,47 @@ class Payment
|
|||
|
||||
// the Order is Pay, so we can set the Status in the Abo
|
||||
if ($shopping_order->is_abo) {
|
||||
// Payone-Server-Callback kann vor dem Checkout-Erfolgs-Redirect laufen; dann existiert
|
||||
// noch kein UserAbo/UserAboOrder — setAboActive wirkt erst nach Anlage.
|
||||
if ($paid && $shopping_payment) {
|
||||
$shopping_payment->loadMissing([
|
||||
'payment_transactions',
|
||||
'shopping_order.shopping_user',
|
||||
'shopping_order.shopping_order_items',
|
||||
]);
|
||||
if (! $shopping_order->getUserAbo()) {
|
||||
AboHelper::createNewAbo($shopping_payment);
|
||||
$shopping_order->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
AboHelper::setAboActive($shopping_order, 2, true);
|
||||
|
||||
// Incentive: Track activated customer abo
|
||||
IncentiveTracker::trackAboActivated($shopping_order);
|
||||
}
|
||||
|
||||
// Incentive: Track new partner registration (ggf. mit Starterpaket)
|
||||
if ($shopping_order->payment_for == 1) {
|
||||
IncentiveTracker::trackNewPartner($shopping_order);
|
||||
}
|
||||
|
||||
// make Invoice is not exist and is live
|
||||
// Wrapped in try/catch: Rechnungserstellung darf den Payment-Flow nicht crashen
|
||||
if ($shopping_order->mode === 'live' || Util::isTestSystem(true)) {
|
||||
// Reload the shopping order to check for invoice again (defense against race conditions)
|
||||
$shopping_order->refresh();
|
||||
|
||||
if (! $shopping_order->isInvoice()) {
|
||||
$invoice_repo = new InvoiceRepository($shopping_order);
|
||||
$invoice_repo->createAndSalesVolume();
|
||||
try {
|
||||
$invoice_repo = new InvoiceRepository($shopping_order);
|
||||
$invoice_repo->createAndSalesVolume();
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('Payment::paymentStatusPaidAction - Rechnungserstellung fehlgeschlagen', [
|
||||
'shopping_order_id' => $shopping_order->id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue