'berater-'.uniqid('', true).'@example.com', 'password' => bcrypt('secret'), 'lang' => 'de', ]); $incentive = Incentive::factory()->create([ 'qualification_start' => '2026-04-01', 'qualification_end' => '2026-08-31', 'calculation_end' => '2026-08-31', 'status' => 1, ]); $participant = IncentiveParticipant::factory()->create([ 'incentive_id' => $incentive->id, 'user_id' => $consultant->id, ]); $country = Country::firstOrCreate(['code' => 'DE'], [ 'phone' => '49', 'en' => 'Germany', 'de' => 'Deutschland', 'es' => 'Alemania', 'fr' => 'Allemagne', 'it' => 'Germania', 'ru' => 'Германия', ]); $shoppingUser = ShoppingUser::create([ 'auth_user_id' => $consultant->id, 'member_id' => $consultant->id, 'billing_email' => 'kundin-'.uniqid('', true).'@example.com', 'billing_country_id' => $country->id, 'shipping_country_id' => $country->id, 'is_for' => 'ot', ]); $abo = UserAbo::create([ 'shopping_user_id' => $shoppingUser->id, 'member_id' => $consultant->id, 'is_for' => 'ot', 'email' => 'kundin-'.uniqid('', true).'@example.com', 'payone_userid' => 1, 'clearingtype' => 'cc', 'active' => true, 'status' => 2, 'abo_interval' => 5, ]); IncentiveNewAbo::create([ 'participant_id' => $participant->id, 'user_abo_id' => $abo->id, 'activated_at' => '2026-04-09', ]); $order = ShoppingOrder::create([ 'shopping_user_id' => $shoppingUser->id, 'auth_user_id' => $consultant->id, 'country_id' => $country->id, 'user_shop_id' => 1, 'payment_for' => 6, 'total' => 92.60, 'subtotal' => 82.79, 'points' => 54, 'paid' => false, 'is_abo' => true, 'mode' => 'live', ]); UserAboOrder::create([ 'user_abo_id' => $abo->id, 'shopping_order_id' => $order->id, 'status' => 8, 'paid' => false, ]); // Abo wurde inzwischen geloescht (ersetzt) - wie im Fall Dannenhauer (#198) $abo->delete(); $usv = UserSalesVolume::create([ 'user_id' => $consultant->id, 'shopping_order_id' => $order->id, 'month' => 8, 'year' => 2026, 'points' => 54, 'status_points' => 1, 'total_net' => 82.79, 'status' => 2, ]); IncentiveTracker::trackSalesVolume($usv); $log = IncentivePointsLog::where('participant_id', $participant->id) ->where('user_sales_volume_id', $usv->id) ->where('is_storno', false) ->first(); expect($log)->not->toBeNull() ->and((int) $log->points_accumulated)->toBe(54) ->and((int) $log->month)->toBe(8); });