U-A/U-B: Prozesskern mit Fachmodulen, versionierten Modellen, eingefrorenem Prozessplan, ProcessRunner (harte/weiche Abhängigkeiten), CasePricing, Loyalty nur im Tester
CaseActivities/CaseAutomation sind Fassaden über ProcessRunner. Verhaltensvergleich v0.11: 11 Abläufe und 198 Konstellationen gleich, beabsichtigte Abweichungen I-004/I-005 (F-001/F-002). Volle Suite vor U-B: 785/785. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
98df5e9e3b
commit
7e22e12cac
80 files changed
+4628
-445
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Support\Money;
|
||||
|
||||
/**
|
||||
* A6: payment of an internal occasion with a price (e.g. linen, visitor's tax) – recorded, never reminded.
|
||||
*/
|
||||
final class InternalPayment extends Module
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'payments.internal';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Zahlung (ohne Erinnerungen)',
|
||||
purpose: 'Hält fest, was bei einer Eigenbelegung oder privaten Überlassung bezahlt wurde – ohne Erinnerungen.',
|
||||
phase: 'P03',
|
||||
effects: ['case_write'],
|
||||
toggle: ModuleDefinition::TOGGLE_CONDITIONAL,
|
||||
performers: ['landlord'],
|
||||
events: ['payment'],
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return $case->booking->total !== null && $case->booking->total > 0;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$paid = $booking->paidAmount();
|
||||
|
||||
return [new Activity('payment', 'Zahlung (ohne Erinnerungen)', $case->later($paid >= $booking->total ? ActivityState::Done : ActivityState::Later), Money::format($paid).' von '.Money::format($booking->total).' bezahlt')];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\ProcessSetting;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Support\Money;
|
||||
|
||||
/**
|
||||
* P03: the guest's payments – deposit and balance when we collect (A1–A3), the portal's collection when it collects
|
||||
* (A4/A5: only "laut Portal", never money on our account). Reminders are sent by SendBookingReminders.
|
||||
*/
|
||||
final class PaymentMonitoring extends Module
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'payments.monitor';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Zahlungen des Gastes',
|
||||
purpose: 'Überwacht Anzahlung und Restzahlung und erinnert rechtzeitig – oder zeigt, was das Portal laut eigener Angabe eingezogen hat.',
|
||||
phase: 'P03',
|
||||
effects: ['case_write', 'guest_mail'],
|
||||
waits: ['guest', 'portal', 'time'],
|
||||
triggers: ['payment.recorded', 'portal.amounts', 'schedule:reminders'],
|
||||
parameters: [ProcessSetting::Payments, ProcessSetting::GuestMessages],
|
||||
performers: ['landlord', 'portal'],
|
||||
events: ['payment', 'amount'],
|
||||
readsContractData: true,
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return ! $case->booking->isInternal();
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$binding = $case->binding;
|
||||
|
||||
if ($case->profile->payments() === Responsibility::Portal) {
|
||||
$portal = $booking->processChannel()?->name ?? 'das Portal';
|
||||
$viaPortal = $booking->paidViaPortal();
|
||||
|
||||
return [new Activity('payment', 'Zahlung des Gastes an '.$portal, ActivityState::External, match (true) {
|
||||
$booking->total === null => 'zieht das Portal ein',
|
||||
$viaPortal > 0 => 'laut Portal bezahlt: '.Money::format($viaPortal).' von '.Money::format($booking->total).' (Angabe des Portals, kein Geld bei uns)',
|
||||
default => 'zieht das Portal ein; noch keine Zahlungsangabe',
|
||||
})];
|
||||
}
|
||||
|
||||
if ($booking->total === null) {
|
||||
return [new Activity('payment', 'Zahlungen überwachen', $case->later(ActivityState::Waiting), 'erst möglich, wenn der Preis bekannt ist')];
|
||||
}
|
||||
|
||||
$paid = $booking->paidAmount();
|
||||
|
||||
return [
|
||||
new Activity('deposit', 'Anzahlung erhalten', $case->later(match (true) {
|
||||
$binding && $paid >= (int) $booking->deposit => ActivityState::Done,
|
||||
$binding => ActivityState::Waiting,
|
||||
default => ActivityState::Later,
|
||||
}), Money::format((int) $booking->deposit).($booking->deposit_due_on ? ', fällig '.$booking->deposit_due_on->format('d.m.Y') : '')),
|
||||
new Activity('balance', 'Restzahlung erhalten', $case->later(match (true) {
|
||||
$binding && $paid >= $booking->total => ActivityState::Done,
|
||||
$binding && $paid >= (int) $booking->deposit => ActivityState::Waiting,
|
||||
default => ActivityState::Later,
|
||||
}), Money::format(max(0, $booking->total - (int) $booking->deposit)).($booking->balance_due_on ? ', fällig '.$booking->balance_due_on->format('d.m.Y') : '')),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Process\Modules\Money;
|
||||
|
||||
use App\Enums\ActivityState;
|
||||
use App\Enums\Responsibility;
|
||||
use App\Pricing\CaseMoney;
|
||||
use App\Process\Activity;
|
||||
use App\Process\CaseContext;
|
||||
use App\Process\Modules\Module;
|
||||
use App\Process\Modules\ModuleDefinition;
|
||||
use App\Support\Money;
|
||||
|
||||
/**
|
||||
* P03 for portal collection (A4/A5): the portal's payout on our account. Only a payout the landlord recorded as
|
||||
* received counts (PaymentKind::PortalPayout); an announced payout or a portal report is no proof (decision O5).
|
||||
*/
|
||||
final class PortalPayout extends Module
|
||||
{
|
||||
public static function key(): string
|
||||
{
|
||||
return 'portal.payout';
|
||||
}
|
||||
|
||||
public static function definition(): ModuleDefinition
|
||||
{
|
||||
return new ModuleDefinition(
|
||||
label: 'Auszahlung des Portals',
|
||||
purpose: 'Prüft, ob die Auszahlung des Portals tatsächlich auf unserem Konto eingegangen ist und zu den Angaben passt.',
|
||||
phase: 'P03',
|
||||
effects: ['case_write'],
|
||||
waits: ['portal', 'landlord', 'time'],
|
||||
triggers: ['portal.amounts', 'payment.recorded'],
|
||||
performers: ['landlord'],
|
||||
events: ['payment', 'amount'],
|
||||
readsContractData: true,
|
||||
);
|
||||
}
|
||||
|
||||
public function applies(CaseContext $case): bool
|
||||
{
|
||||
return ! $case->booking->isInternal() && $case->profile->payments() === Responsibility::Portal;
|
||||
}
|
||||
|
||||
public function activities(CaseContext $case): array
|
||||
{
|
||||
$booking = $case->booking;
|
||||
$portal = $booking->processChannel()?->name ?? 'das Portal';
|
||||
$payout = CaseMoney::of($booking)->payout();
|
||||
|
||||
return [new Activity('payout', 'Auszahlung von '.$portal.' auf unser Konto', $case->later(match (true) {
|
||||
! $case->binding => ActivityState::Later,
|
||||
$payout['received'] > 0 && ($payout['outstanding'] ?? 0) === 0 && $payout['difference'] === 0 => ActivityState::Done,
|
||||
default => ActivityState::Waiting,
|
||||
}), trim(($payout['values'] !== [] ? 'angekündigt '.implode(' bzw. ', array_map(fn (int $value): string => Money::format($value), $payout['values'])).' · ' : '').'eingegangen '.Money::format($payout['received']).($payout['difference'] > 0 ? ' · Angaben weichen um '.Money::format($payout['difference']).' ab' : '')))];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user