Record explicit workshop acceptance and preserve subsequent synthetic work without accepting receivables. Keep 080000/070000 unapplied, real workshop grants pending and operational issuance blocks intact. Exclude local credentials and real-data preservation reports.
23 lines
1.3 KiB
PHP
23 lines
1.3 KiB
PHP
<?php
|
|
namespace Tests\Support;
|
|
use App\Modules\Services\ServiceInvoicing;
|
|
use App\Modules\Services\ServiceReceivables;
|
|
use App\Shared\Context\CompanyContext;
|
|
use Illuminate\Support\Str;
|
|
final class ReceivablesFixture
|
|
{
|
|
public static function create(?array $base=null): array
|
|
{
|
|
ServiceReceivables::guard();
|
|
// Existing approved calculation path: 862.07 + trunc(137.9312,2) = 1000.00.
|
|
// Only a synthetic parameter choice; never infers tax treatment from the receivable amount.
|
|
$f=InvoiceFixture::create($base,'862.07');
|
|
foreach(['manager'=>['view','prepare','allocate','correction_request'],'reader'=>['view','confirm','reconcile','correction_approve']] as $who=>$rights)
|
|
foreach($rights as $right) IdentityFixture::grant($f[$who]->id,$f['tenant'],$f['company'],'service_receivables.'.$right,$f['unit']);
|
|
app(CompanyContext::class)->selectFor($f['manager']->id,$f['tenant'],$f['company'],$f['unit']);
|
|
$si=app(ServiceInvoicing::class); $review=$si->review($f['draft'],$f['series'],$f['rule'],$f['manager']->id);
|
|
$invoice=$si->issue($f['draft'],$f['manager']->id,['series_id'=>$f['series'],'rule_id'=>$f['rule'],'review_hash'=>$review['review_hash']],(string)Str::uuid())['id'];
|
|
return $f+['invoice'=>$invoice];
|
|
}
|
|
}
|